diff --git a/Mohem/src/app/absence/absence-confirm/absence-confirm.component.ts b/Mohem/src/app/absence/absence-confirm/absence-confirm.component.ts index d4a765a3..40dc3dd3 100644 --- a/Mohem/src/app/absence/absence-confirm/absence-confirm.component.ts +++ b/Mohem/src/app/absence/absence-confirm/absence-confirm.component.ts @@ -15,13 +15,14 @@ import { AbsenceAttachmentComponent } from '../absence-attachment/absence-attach import { WorkListAttachViewComponent } from 'src/app/notification/work-list-attach-view/work-list-attach-view.component'; import { FileUploader } from 'ng2-file-upload'; import { SubmitAbsenceModalComponent } from '../submit-absence-modal/submit-absence-modal.component'; +import { HomeComponent } from "src/app/notification/home/home.component"; @Component({ selector: 'app-absence-confirm', templateUrl: './absence-confirm.component.html', styleUrls: ['./absence-confirm.component.scss'] }) export class AbsenceConfirmComponent implements OnInit { - direction:string; + direction: string; P_TransactionID: number; approversList = []; selEmp: string = ''; @@ -58,7 +59,7 @@ export class AbsenceConfirmComponent implements OnInit { this.P_TransactionID = this.common.sharedService.getSharedData( AbsenceResponse.SHARED_DATA ); - this.getPassNotificationDetails =this.common.sharedService.getSharedData( + this.getPassNotificationDetails = this.common.sharedService.getSharedData( AbsenceNotificatonBodyResponse.NOT_WORKLIST, true ); @@ -89,7 +90,7 @@ export class AbsenceConfirmComponent implements OnInit { this.getApproversList(); } - ngOnInit() {} + ngOnInit() { } startAbApproval() { if (this.attachListOver) { //first call add attach inside success call submit @@ -126,12 +127,12 @@ export class AbsenceConfirmComponent implements OnInit { this.startAbsApprovalProcess(); } else { //stope - let filtered = this.attachListOver.filter(function(el) { + let filtered = this.attachListOver.filter(function (el) { return el.isSuccess == true; }); this.attachListOver = filtered; let msg: string = ''; - // msg = this.translate.translate("addAttach.errorMsg"); + // msg = this.translate.translate("addAttach.errorMsg"); //this.common.showAlert(msg); } } @@ -168,11 +169,12 @@ export class AbsenceConfirmComponent implements OnInit { if (this.common.validResponse(result)) { this.isSubmitBtnClicked = true; //if(this.isResubmitAbs==false){ - let msg: string = this.ts.trPK('general', 'messageSuccess'); - this.common.presentAlert(msg); - + // let msg: string = this.ts.trPK('general', 'messageSuccess'); + // this.common.presentAlert(msg); + this.common.greenToastPK("eit", "approval-message-success") // } // this.navCtrl.popToRoot(); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } @@ -204,61 +206,61 @@ export class AbsenceConfirmComponent implements OnInit { // }); const modal = await this.modalCtrl.create({ component: AbsenceAttachmentComponent, - componentProps:{ indexLastObj: this.attachListOver.length, TransactionID: this.P_TransactionID}, + componentProps: { indexLastObj: this.attachListOver.length, TransactionID: this.P_TransactionID }, keyboardClose: true, animated: false - }); + }); modal.onDidDismiss() - .then((data) => { - if (data == 'cancel' || data == 'undefined') { - return; - } else { - if (!str) { - this.updateFile(data, attachDocID); + .then((data) => { + if (data == 'cancel' || data == 'undefined') { + return; } else { - this.attachListDisplay = data.data; - this.attachItems = this.attachListDisplay.map(function (el) { - var o = Object.assign({}, el); - o.isSuccess = false; - return o; - }); - this.attachListOver = this.attachListOver ? this.attachListOver.concat(this.attachItems) : this.attachItems; + if (!str) { + this.updateFile(data, attachDocID); + } else { + this.attachListDisplay = data.data; + this.attachItems = this.attachListDisplay.map(function (el) { + var o = Object.assign({}, el); + o.isSuccess = false; + return o; + }); + this.attachListOver = this.attachListOver ? this.attachListOver.concat(this.attachItems) : this.attachItems; + } } - } - }); + }); return await modal.present(); } -/*****submit modal********/ -async openSubmitModal() { - this.common.sharedService.setSharedData( this.attachListOver, 'submitAbsAttachmentList'); - this.common.sharedService.setSharedData(this.absComments, 'absComments'); - const modal = await this.modalCtrl.create({ - component: SubmitAbsenceModalComponent, - backdropDismiss: false, + /*****submit modal********/ + async openSubmitModal() { + this.common.sharedService.setSharedData(this.attachListOver, 'submitAbsAttachmentList'); + this.common.sharedService.setSharedData(this.absComments, 'absComments'); + const modal = await this.modalCtrl.create({ + component: SubmitAbsenceModalComponent, + backdropDismiss: false, - }); - modal.cssClass = 'note-modal'; + }); + modal.cssClass = 'note-modal'; - modal.onDidDismiss() - .then((data) => { - console.log(data.data); + modal.onDidDismiss() + .then((data) => { + console.log(data.data); - if (data.data == 'cancel' || data.data == undefined) { - return; - } else { - this.startAbApproval(); - } - }); + if (data.data == 'cancel' || data.data == undefined) { + return; + } else { + this.startAbApproval(); + } + }); - return await modal.present(); + return await modal.present(); -} + } @@ -266,7 +268,7 @@ async openSubmitModal() { removeFile(objectitem) { - + if (this.attachListOver) { let index2 = this.attachListOver.findIndex(item => item == objectitem); if (index2 > -1) { @@ -300,12 +302,12 @@ async openSubmitModal() { } // valid it } - async OpenAttachFiles(value, Type) { + async OpenAttachFiles(value, Type) { this.common.sharedService.setSharedData({ displayData: value, TypeData: Type }, 'WorkListAttachViewPage'); const modal = await this.modalCtrl.create({ component: WorkListAttachViewComponent }); - + modal.onDidDismiss() .then((data) => { }); @@ -314,7 +316,7 @@ async openSubmitModal() { } updateFile(attachList, attachDocID) { - + let req = { P_ATTACHED_DOCUMENT_ID: attachDocID, P_FILE_DATA: attachList[0].P_FILE_DATA, @@ -327,7 +329,7 @@ async openSubmitModal() { let msg: string = ''; // msg = this.translate.translate("addAttach.attachUpdate"); // this.common.showAlert(msg); - + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); } } // val @@ -345,7 +347,7 @@ async openSubmitModal() { // }); } continueDelete(attach) { - + let req = { P_ATTACHED_DOCUMENT_ID: attach.ATTACHED_DOCUMENT_ID }; @@ -367,9 +369,9 @@ async openSubmitModal() { - /*******************Add attchement Functions*************/ + /*******************Add attchement Functions*************/ - public uploader: FileUploader = new FileUploader({ + public uploader: FileUploader = new FileUploader({ allowedMimeType: ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], maxFileSize: 10 * 1024 * 1024, formatDataFunctionIsAsync: true, @@ -386,7 +388,7 @@ async openSubmitModal() { }); - onFileSelectedclick(event){ + onFileSelectedclick(event) { event.target.value = ''; } @@ -430,7 +432,7 @@ async openSubmitModal() { pushObject(fileData, name, type) { - console.log('before push: '+ this.index); + console.log('before push: ' + this.index); //this.attachListOver.length++; try { let array = name.split('.'); @@ -438,11 +440,11 @@ async openSubmitModal() { this.attachListOver.push( { - AttachmentID: this.attachListOver.length, + AttachmentID: this.attachListOver.length, P_FILE_CONTENT_TYPE: attachType,//type.split('/')[1], P_FILE_DATA: fileData.split(',')[1], P_FILE_NAME: name,//.split('.')[0], - P_TRANSACTION_ID: this.P_TransactionID + P_TRANSACTION_ID: this.P_TransactionID }) } catch (e) { diff --git a/Mohem/src/app/absence/absence-replacement-list/absence-replacement-list.component.ts b/Mohem/src/app/absence/absence-replacement-list/absence-replacement-list.component.ts index 0fcacdb7..d2ef54b6 100644 --- a/Mohem/src/app/absence/absence-replacement-list/absence-replacement-list.component.ts +++ b/Mohem/src/app/absence/absence-replacement-list/absence-replacement-list.component.ts @@ -32,7 +32,7 @@ export class AbsenceReplacementListComponent implements OnInit { P_PAGE_NUM: number; P_PAGE_LIMIT: number; ReplacementList: any = []; - searchBy: string = ""; + searchBy: string = "2"; IsReachEnd: boolean = false; ReplacmentListRes: WorKListReplacmentEmployeeResponse; private WorkListReplacmentEmployeeObj: WorkListReplacmentEmployeeRequest = new WorkListReplacmentEmployeeRequest(); diff --git a/Mohem/src/app/absence/submit-absence/submit-absence.component.html b/Mohem/src/app/absence/submit-absence/submit-absence.component.html index 9a17288e..f3ffe7d4 100644 --- a/Mohem/src/app/absence/submit-absence/submit-absence.component.html +++ b/Mohem/src/app/absence/submit-absence/submit-absence.component.html @@ -5,19 +5,20 @@ - - + + + let item of AbsenceType; let i=index; {{item.ABSENCE_ATTENDANCE_TYPE_NAME}} - + --> {{ts.trPK('submitAbsence','startDate')}} diff --git a/Mohem/src/app/absence/submit-absence/submit-absence.component.ts b/Mohem/src/app/absence/submit-absence/submit-absence.component.ts index 360a5175..159c4842 100644 --- a/Mohem/src/app/absence/submit-absence/submit-absence.component.ts +++ b/Mohem/src/app/absence/submit-absence/submit-absence.component.ts @@ -3,7 +3,7 @@ import { CommonService } from "src/app/hmg-common/services/common/common.service import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service"; import { MenuService } from "src/app/hmg-common/services/menu/menuservice.service"; import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response"; -import { ModalController ,IonSelectOption ,IonSelect } from "@ionic/angular"; +import { ModalController, IonSelectOption, IonSelect } from "@ionic/angular"; import { SubmitAbsenceService } from "../service/submit.absence.service"; import { AbsenceAttahcmentResponse } from "../models/abs.attach.response"; import { AbsenceListService } from "../service/service.service"; @@ -23,8 +23,8 @@ import { DatePicker } from "@ionic-native/date-picker/ngx"; import { Request } from '../../hmg-common/services/models/request'; // import { Request } from "../models/request"; import * as moment from "moment"; -import {ReplacementListComponent} from "../../vacation-rule/replacement-list/replacement-list.component"; -import {ReplacmentResponse} from "../models/replacment-response"; +import { ReplacementListComponent } from "../../vacation-rule/replacement-list/replacement-list.component"; +import { ReplacmentResponse } from "../models/replacment-response"; import { AbsenceResponse } from '../models/absence.response'; import { AbsenceReplacementListComponent } from '../absence-replacement-list/absence-replacement-list.component'; import { AbsenceNotificatonBodyResponse } from 'src/app/notification/models/AbsenceNotificationBodyRes'; @@ -51,7 +51,7 @@ export class SubmitAbsenceComponent implements OnInit { private modalFlag: any = false; menuType: any; employeeSel: any; - absenceType: any; + absenceType = 'noType'; absenceTypeName: string = null; absenceTypeList: any; startDate: any; @@ -99,8 +99,8 @@ export class SubmitAbsenceComponent implements OnInit { this.direction = TranslatorService.getCurrentLanguageName(); ////*new add*///// /**********resubmit************ */ - this.getPassNotificationDetails = this.common.sharedService.getSharedData(AbsenceNotificatonBodyResponse.NOT_WORKLIST, true); - this.getPassdirfromNotifiPage = this.common.sharedService.getSharedData('dirfromNotificationPage'); + this.getPassNotificationDetails = this.common.sharedService.getSharedData(AbsenceNotificatonBodyResponse.NOT_WORKLIST, true); + this.getPassdirfromNotifiPage = this.common.sharedService.getSharedData('dirfromNotificationPage'); //this.getPassNotificationDetails = this.common.sharedService.getSharedData(AbsenceNotificatonBodyResponse.NOT_WORKLIST, true); // this.getPassdirfromNotifiPage = this.navParams.get('dirfromNotificationPage'); if (this.getPassdirfromNotifiPage) { @@ -110,8 +110,8 @@ export class SubmitAbsenceComponent implements OnInit { this.notificationId = this.getPassNotificationDetails.NOTIFICATION_ID; this.selEmp = this.getPassNotificationDetails.SELECTED_EMPLOYEE_NUMBER; this.respID = -999; - this.submitAbsObjList = this.common.sharedService.getSharedData('submitAbsObjList'); - console.log() + this.submitAbsObjList = this.common.sharedService.getSharedData('submitAbsObjList'); + console.log() } else { this.action = "CREATE"; this.selEmp = this.common.sharedService.getSharedData( @@ -185,7 +185,7 @@ export class SubmitAbsenceComponent implements OnInit { } } calcDay() { - console.log("calcDay" ); + console.log("calcDay"); let msg: string = ""; if ( this.startDate == undefined || @@ -233,7 +233,7 @@ export class SubmitAbsenceComponent implements OnInit { this.totalDays = result.CalculateAbsenceDuration.P_ABSENCE_DAYS; } } - async openSearch(){ + async openSearch() { const modal = await this.modalCtrl.create({ component: ReplacementListComponent, keyboardClose: true, @@ -259,7 +259,7 @@ export class SubmitAbsenceComponent implements OnInit { console.log(data) console.log(user); if (data) { - this.employeeName = user.EMPLOYEE_DISPLAY_NAME; + this.employeeName = user.EMPLOYEE_DISPLAY_NAME; this.employeeID = user.USER_NAME; this.employeeSel = this.employeeName + "," + this.employeeID; } @@ -278,12 +278,12 @@ export class SubmitAbsenceComponent implements OnInit { } public onTypeAbsenceChange() { - + if (this.absenceType) { let obj: any = this.absenceTypeList.find( s => s.ABSENCE_ATTENDANCE_TYPE_ID == this.absenceType ); - + if (obj) this.absenceTypeName = obj.DESC_FLEX_CONTEXT_CODE; else this.absenceTypeName = null; @@ -443,7 +443,7 @@ export class SubmitAbsenceComponent implements OnInit { this.textInput = new TextInput( feildsList[i].SEGMENT_PROMPT, feildsList[i].APPLICATION_COLUMN_NAME, - defaultVal, + defaultVal, containerId, defaultValText, feildsList[i].MOBILE_ENABLED, @@ -492,9 +492,9 @@ export class SubmitAbsenceComponent implements OnInit { this.fillAbsStructure(); } } - + bindHtmlElemEvents(id, obj) { - + const elem = document.getElementById(id); elem.addEventListener("change", e => { elem.classList.remove("requiredClassElm"); @@ -1039,20 +1039,20 @@ export class SubmitAbsenceComponent implements OnInit { let elem = document.getElementById( this.absenceDffresponse[i].APPLICATION_COLUMN_NAME ) as HTMLInputElement; - let elemVal=""; + let elemVal = ""; if (elem.classList.contains('onic-date')) { - elemVal = (document.getElementById( + elemVal = (document.getElementById( this.absenceDffresponse[i].APPLICATION_COLUMN_NAME ) as HTMLInputElement).value; - if(elemVal){ + if (elemVal) { elemVal = moment(elemVal).format("YYYY/MM/DD hh:mm:ss"); } - - }else{ - elemVal = (document.getElementById( - this.absenceDffresponse[i].APPLICATION_COLUMN_NAME - ) as HTMLInputElement).value; - } + + } else { + elemVal = (document.getElementById( + this.absenceDffresponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + } textValue = elemVal; if ( @@ -1060,7 +1060,7 @@ export class SubmitAbsenceComponent implements OnInit { this.absenceDffresponse[i].DISPLAY_FLAG != "N" ) { //date - elemVal = this.common.formatDate(elemVal); + elemVal = this.common.formatDate(elemVal); } else if ( this.absenceDffresponse[i].FORMAT_TYPE == "Y" && this.absenceDffresponse[i].DISPLAY_FLAG != "N" @@ -1323,6 +1323,7 @@ export class SubmitAbsenceComponent implements OnInit { } return isSt; } + validateAbcenseTransaction() { (this.elementRef.nativeElement.querySelectorAll( "ion-item" @@ -1447,9 +1448,9 @@ export class SubmitAbsenceComponent implements OnInit { private handleSubmitAbsence(result) { if (this.common.validResponse(result)) { if (this.getPassdirfromNotifiPage) { - this.common.sharedService.setSharedData(result.ResubmitAbsenceTransactionList.P_TRANSACTION_ID, AbsenceResponse.SHARED_DATA); - this.common.openConfirmAbsece(); - // this.navCtrl.push("SubmitAbsenceConfirmPage", { isResubmit: true }); + this.common.sharedService.setSharedData(result.ResubmitAbsenceTransactionList.P_TRANSACTION_ID, AbsenceResponse.SHARED_DATA); + this.common.openConfirmAbsece(); + // this.navCtrl.push("SubmitAbsenceConfirmPage", { isResubmit: true }); } else { this.common.sharedService.setSharedData(result.SumbitAbsenceTransactionList.P_TRANSACTION_ID, AbsenceResponse.SHARED_DATA); this.common.openConfirmAbsece(); diff --git a/Mohem/src/app/app-routing.module.ts b/Mohem/src/app/app-routing.module.ts index b4b5da86..c6a651c9 100644 --- a/Mohem/src/app/app-routing.module.ts +++ b/Mohem/src/app/app-routing.module.ts @@ -25,7 +25,12 @@ const routes: Routes = [ { path: 'offersdiscount', loadChildren: './offersdiscount/offersdiscount.module#OffersdiscountPageModule' }, { path: 'mowadhafi', loadChildren: './mowadhafi/mowadhafi.module#MowadhafiPageModule' }, { path: 'erm-channel', loadChildren: './erm-channel/erm-channel.module#ErmChannelPageModule' }, - { path: 'backend-integrations', loadChildren: './backend-integrations/backend-integrations.module#BackendIntegrationsPageModule' } + { path: 'backend-integrations', loadChildren: './backend-integrations/backend-integrations.module#BackendIntegrationsPageModule' }, + { path: 'reports', loadChildren: './reports/reports.module#ReportsPageModule' }, + + { path: 'termination', loadChildren: './termination/termination.module#TerminationPageModule' }, + { path: 'pending-transaction', loadChildren: './pending-transaction/pending-transaction.module#PendingTransactionPageModule' } + diff --git a/Mohem/src/app/app.component.html b/Mohem/src/app/app.component.html index 5b40ba6e..f4f782cc 100644 --- a/Mohem/src/app/app.component.html +++ b/Mohem/src/app/app.component.html @@ -35,7 +35,14 @@ {{ts.trPK('userProfile','title')}} - + + + + + + {{ts.trPK('userProfile','performance-evaluation')}} + + @@ -47,13 +54,32 @@ - + {{ts.trPK('userProfile','HR-Request')}} +
+ + + + + + + {{menu.MENU_NAME}} + + +
+ + + + + + {{ts.trPK('general','pending-transaction')}} + + @@ -133,6 +159,14 @@ {{ts.trPK('userProfile','title')}} + + + + + + {{ts.trPK('userProfile','performance-evaluation')}} + + @@ -149,6 +183,26 @@ {{ts.trPK('userProfile','HR-Request')}} +
+ + + + + + + {{menu.MENU_NAME}} + + +
+ + + + + + + {{ts.trPK('general','pending-transaction')}} + + diff --git a/Mohem/src/app/app.component.ts b/Mohem/src/app/app.component.ts index 47934fec..676501d7 100644 --- a/Mohem/src/app/app.component.ts +++ b/Mohem/src/app/app.component.ts @@ -14,6 +14,7 @@ import { DigitalIdComponent } from './authentication/digital-id/digital-id.compo import { checkAndUpdatePureExpressionInline } from '@angular/core/src/view/pure_expression'; import { FirebaseX } from '@ionic-native/firebase-x/ngx'; import { BusinessCardComponent } from './authentication/business-card/business-card.component'; +import { MenuResponse } from './hmg-common/services/menu/models/menu-response'; @Component({ selector: 'app-root', @@ -122,7 +123,7 @@ export class AppComponent implements OnInit { public setScreenNameAnalytics(currentPageName: string) { try { - this.firebasex.setScreenName(currentPageName).then((result)=>{ + this.firebasex.setScreenName(currentPageName).then((result) => { console.log(result); }); } catch (Error) { } @@ -208,7 +209,7 @@ export class AppComponent implements OnInit { let jobTitle = user.POSITION_NAME.split('.'); if (jobTitle && jobTitle.length > 1) { this.User_Job_name = jobTitle[0] + " " + jobTitle[1]; - }​ + } //erm channel // if (!CommonService.SKIP) // this.cs.navigateForward('/erm-channel/survey'); @@ -218,7 +219,10 @@ export class AppComponent implements OnInit { }); }); this.events.subscribe('getNotCount', badge => { this.notBadge = badge; }); - this.events.subscribe('myTeamFlag', myTeamFlag => { this.TeamFlag = myTeamFlag; }); + this.events.subscribe('myTeamFlag', myTeamFlag => { + this.TeamFlag = myTeamFlag; + this.menuList = this.cs.sharedService.getSharedData(MenuResponse.MENU_LIST, false); + }); } private initializeDirection() { @@ -267,7 +271,10 @@ export class AppComponent implements OnInit { this.cs.openProfile('sideMenu'); this.menu.toggle(); } - + public performanceEvaluation() { + this.cs.openPerformanceevaluation(); + this.menu.toggle(); + } public openNotification() { this.cs.openNotificationPage(); this.menu.toggle(); @@ -294,7 +301,7 @@ export class AppComponent implements OnInit { //this.userInfo = this.cs.sharedService.getSharedData('bussiness-card-info', false); const modal = await this.modalController.create({ component: BusinessCardComponent, - cssClass: 'digital-id-modal-css', + cssClass: 'business-card-modal-css', componentProps: { 'userInfo': this.userInfo } @@ -348,4 +355,13 @@ export class AppComponent implements OnInit { } else { } }); } + oepnMyRequest(menu) { + this.cs.sharedService.setSharedData(menu, MenuResponse.SELECTED_MENU); + this.cs.openConcurrentReport(); + this.menu.toggle(); + } + oepnTransaction() { + this.cs.openTransactions(); + this.menu.toggle(); + } } diff --git a/Mohem/src/app/app.scss b/Mohem/src/app/app.scss index e91e3666..057206e1 100644 --- a/Mohem/src/app/app.scss +++ b/Mohem/src/app/app.scss @@ -35,4 +35,7 @@ .my-custom-modal-css .modal-wrapper { width: 95%; height: 60%; +} +.dependent-title .ion-title{ + font-size:0.4cm !important; } \ No newline at end of file diff --git a/Mohem/src/app/authentication/authentication.module.ts b/Mohem/src/app/authentication/authentication.module.ts index 0e5e953e..1cdb0ea9 100644 --- a/Mohem/src/app/authentication/authentication.module.ts +++ b/Mohem/src/app/authentication/authentication.module.ts @@ -14,14 +14,15 @@ import { Device } from '@ionic-native/device/ngx'; import { SplashScreen } from '@ionic-native/splash-screen/ngx'; import { SearchableOptionsModule } from '../hmg-common/ui/searchable-select/searchable-options.module'; -import { MobileNumberModule } from 'src/app/hmg-common/ui/mobile-number/mobile-number.module'; +import { MobileNumberModule } from 'src/app/hmg-common/ui/mobile-number/mobile-number.module'; import { SmsdialogPageModule } from 'src/app/hmg-common/ui/smsdialog/smsdialog.module'; import { SmsPageModule } from 'src/app/hmg-common/ui/sms/sms.module'; import { SmsPageComponent } from './sms-page/sms-page.page'; import { CheckUserComponent } from './check-user/check-user.component'; import { ChangePasswordComponent } from './change-password/change-password.component'; -import {ConfirmLoginComponent} from '../authentication/confirm-login/confirm-login.component' -import {WelcomeComponent} from '../authentication/welcome/welcome.component' +import { ConfirmLoginComponent } from '../authentication/confirm-login/confirm-login.component' +import { WelcomeComponent } from '../authentication/welcome/welcome.component' +import { SmsRetriever } from '@ionic-native/sms-retriever/ngx'; const routes: Routes = [ { @@ -84,11 +85,12 @@ const routes: Routes = [ // ConfirmLoginComponent, WelcomeComponent, ], - providers:[ + providers: [ FingerprintAIO, Device, - SplashScreen + SplashScreen, + SmsRetriever ], - entryComponents:[] + entryComponents: [] }) export class AuthenticationPageModule { } diff --git a/Mohem/src/app/authentication/business-card/business-card.component.html b/Mohem/src/app/authentication/business-card/business-card.component.html index 6cabace2..efa14208 100644 --- a/Mohem/src/app/authentication/business-card/business-card.component.html +++ b/Mohem/src/app/authentication/business-card/business-card.component.html @@ -1,5 +1,5 @@ - + +
+ https://hmgwebservices.com/images/Moheem/CS.jpg +

{{userInfo.name_en}}

+

{{userInfo.name_ar}}

+
{{jobName}}
+
{{userInfo.mobile}}
+
{{userInfo.email}}
+
{{userInfo.company_url}}
+
- +
+ - + +
+ +
+

{{userInfo.name_en}}

+
{{jobName}}
+
{{userInfo.mobile}}
+
{{userInfo.email}}
+
{{userInfo.company_url}}
+
+
+ +
+ +
+
diff --git a/Mohem/src/app/authentication/business-card/business-card.component.scss b/Mohem/src/app/authentication/business-card/business-card.component.scss index f85bbad2..f2ee7250 100644 --- a/Mohem/src/app/authentication/business-card/business-card.component.scss +++ b/Mohem/src/app/authentication/business-card/business-card.component.scss @@ -38,10 +38,9 @@ // CS .card-size{ transform: rotate(90deg) !important; - // padding: 5% !important; - // padding-right: 0px !important; padding-right: 0px !important; padding-left: 15% !important; + padding: 8% !important; } .qr-style{ left: 260% !important; @@ -57,6 +56,9 @@ .qr-img-hmg-style{ left: 580px !important; } + .cs-card-size{ + padding: 15px !important; + } } @media screen and (min-width: 400px) and (min-height:700px) and (max-height: 799px){ @@ -81,6 +83,9 @@ .qr-img-hmg-style{ left: 495px !important; } + .cs-card-size{ + padding: 20px !important; + } } @media screen and (min-width: 325px) and (max-width:399px) and (max-height: 812px){ @@ -103,6 +108,9 @@ .qr-img-hmg-style{ left: 550px !important; } + .cs-card-size{ + padding: 10px !important; + } } @media screen and (min-width: 325px) and (max-width:399px) and (max-height: 700px){ @@ -140,18 +148,25 @@ } // HMG .logo-img-hmg-style{ - left: 245px !important; + left: 225px !important; } .qr-img-hmg-style{ left: 430px !important; } + .cs-card-size{ + padding:5px !important; + } + .name-div{ + padding: 3px !important; + } } @media screen and (min-width: 1px) and (max-width:320px) { .card-size{ transform: rotate(90deg) !important; position: relative; - bottom: 3%; + bottom: 10%; left: 8%; + padding: 10% !important } .qr-style{ width: 70% !important; @@ -176,34 +191,47 @@ .logo-img-hmg-style{ width: 380px !important; position: fixed !important; - left: 200px !important; + left: 240px !important; height: 81px !important; - bottom: 205px !important; + bottom: 175px !important; } .qr-img-hmg-style{ width: 105px !important; margin-top: 0px !important; position: relative !important; left: 390px !important; - top: 160px !important; + top: 150px !important; } .cs-card-size{ - padding: 15px !important; + padding: 0px !important; padding-top: 0px !important; padding-left: 1px !important; } } +@media screen and (min-width: 200px) and (max-width: 300px) and (max-height: 700px){ + .font-text-style{ + font-size: 11px !important; + } + .card-size{ + padding: 0% !important; + left: 7% !important; + bottom: 0% !important; + position: relative; + } + +} + .card-size{ transform: rotate(90deg); - padding: 6%; + padding: 18%; } .qr-style{ width: 70%; margin-top: 0px; position: relative; - left: 200%; + left: 135%; } .name-ar-style{ font-size: 20px; @@ -234,5 +262,5 @@ .cs-card-size{ transform: rotate(90deg); - padding: 25px; + padding: 0px; } \ No newline at end of file diff --git a/Mohem/src/app/authentication/business-card/business-card.component.ts b/Mohem/src/app/authentication/business-card/business-card.component.ts index 28a3bde3..0785bfb1 100644 --- a/Mohem/src/app/authentication/business-card/business-card.component.ts +++ b/Mohem/src/app/authentication/business-card/business-card.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit, Input } 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 { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; +import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user'; @Component({ selector: 'app-business-card', @@ -12,15 +14,29 @@ export class BusinessCardComponent implements OnInit { public userInfo: any; public userJobName: any; + public jobName: any; + direction: string; constructor( public modalCtrl: ModalController, public ts: TranslatorService, - public common: CommonService + public common: CommonService, + public authService: AuthenticationService, ) { } ngOnInit() { this.userInfo = JSON.parse(localStorage.getItem('bussiness-card-info')); - console.log(this.userInfo); + this.direction = TranslatorService.getCurrentLanguageName(); + this.authService + .loadAuthenticatedUser() + .subscribe((user: AuthenticatedUser) => { + console.log(user); + if (user) { + let jobTitle = user.POSITION_NAME.split('.'); + if (jobTitle && jobTitle.length > 1) { + this.jobName = jobTitle[0] + " " + jobTitle[1]; + } + } + }); } @@ -30,4 +46,4 @@ export class BusinessCardComponent implements OnInit { }); } -} +} \ No newline at end of file diff --git a/Mohem/src/app/authentication/change-password/change-password.component.html b/Mohem/src/app/authentication/change-password/change-password.component.html index b758a8ce..43e2b34a 100644 --- a/Mohem/src/app/authentication/change-password/change-password.component.html +++ b/Mohem/src/app/authentication/change-password/change-password.component.html @@ -1,64 +1,106 @@ - + - - - - - - - - -
-
-

{{'changePassword,changePassword' | translate}}

+ + + + + + - -

{{'changePassword,newPassword' | translate}}

+ - - - +

{{'changePassword,newPassword' | translate}}

+ + + + + +

{{recentPasswordNote.text}}

+
+ + + +

{{isLetterCase.text}}

+
+ + +

{{isHasDigit.text}}

+
+ + +

{{isMinLength.text}}

+
+ + +

{{isRepeatedLetter.text}}

+
+ + + +

{{confirmMatchNew.text}}

+
+ + +

{{userNameMatchNew.text}}

+
+ +
+ + + + -
- - - -
- +
\ No newline at end of file diff --git a/Mohem/src/app/authentication/change-password/change-password.component.scss b/Mohem/src/app/authentication/change-password/change-password.component.scss index 727737ed..a05e7a94 100644 --- a/Mohem/src/app/authentication/change-password/change-password.component.scss +++ b/Mohem/src/app/authentication/change-password/change-password.component.scss @@ -33,3 +33,7 @@ opacity:.5; } +.info{ + color: #000; + font-weight: bold; +} diff --git a/Mohem/src/app/authentication/change-password/change-password.component.ts b/Mohem/src/app/authentication/change-password/change-password.component.ts index 6ad7b9be..4b2a9f6a 100644 --- a/Mohem/src/app/authentication/change-password/change-password.component.ts +++ b/Mohem/src/app/authentication/change-password/change-password.component.ts @@ -9,7 +9,7 @@ import { SmsReaderService } from 'src/app/hmg-common/services/sms/sms-reader.ser import { ForgetPassword } from '../models/forget.password'; import { LoginModel } from '../models/LoginModel'; import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service'; -import {LoginComponent} from "src/app/authentication/login/login.component"; +import { LoginComponent } from "src/app/authentication/login/login.component"; import { Password } from '../models/password'; import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/models/authenticated-user"; //import { FormBuilder, FormGroup, Validators } from '@angular/forms'; @@ -22,17 +22,89 @@ import { AuthenticatedUser } from "src/app/hmg-common/services/authentication/mo export class ChangePasswordComponent implements OnInit { private loginData = new LoginModel(); public P_NEW_PASSWORD: string = ""; - public P_Confirm_NEW_PASSWORD : string = ""; - public P_OLD_PASSWORD : string = ""; - public P_USER_NAME : string; + public P_Confirm_NEW_PASSWORD: string = ""; + public P_OLD_PASSWORD: string = ""; + public P_USER_NAME: string; public logo = "assets/icon/login/lock.png"; + public testy = 'a123'; userData: any = {}; public isExpiredPwd: boolean = false; public NEW_PASSWORD: boolean = false; public Confirm_NEW_PASSWORD: boolean = false; public OLD_PASSWORD: boolean = false; - //public profile_form: FormGroup; + public currentPasswordIcon = 'password'; + public newPasswordIcon = 'password'; + public confirmPasswordIcon = 'password'; + + public recentPasswordNote = { + yellowImg: '../assets/imgs/mohemm-action/info.png', + text: this.ts.trPK('login', 'current-password-validation') + }; + public isLowerCase = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'lowercase-password-validation'), + isMatch: false + }; + public isUpperCase = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'uppercase-password-validation'), + isMatch: false + }; + public isLetterCase = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'letter-password-validation'), + isMatch: false + }; + public isHasDigit = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'numerica-password-validation'), + isMatch: false + }; + public isMinLength = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'min-password-validation'), + isMatch: false + }; + public isRepeatedLetter = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'repeating-password-validation'), + isMatch: false + }; + // public isContainSpecialChar = { + // blankImg: '../assets/icon/blank.svg', + // greenImg: '../assets/icon/green.svg', + // redImg: '../assets/imgs/close.svg', + // text: this.ts.trPK('login', 'special-character-password-validation'), + // isMatch: false + // }; + public confirmMatchNew = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'not-match-password-validation'), + isMatch: false + }; + public userNameMatchNew = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'contain-username-password-validation'), + isMatch: false + }; + public userId: string; constructor( public cs: CommonService, @@ -43,24 +115,24 @@ export class ChangePasswordComponent implements OnInit { public smsService: SmsReaderService, public changeDetector: ChangeDetectorRef, public sharedData: SharedDataService, - // public formBuilder: FormBuilder, - ) { - console.log("change password constructor"); - } + // public formBuilder: FormBuilder, + ) { + console.log("change password constructor"); + } ngOnInit() { console.log("change password oninit"); this.isExpiredPwd = - this.sharedData.getSharedData(Password.IS_EXPIRED_PSW) || false; + this.sharedData.getSharedData(Password.IS_EXPIRED_PSW) || false; const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); - this.P_USER_NAME =data.P_USER_NAME; + this.P_USER_NAME = data.P_USER_NAME; console.log(this.isExpiredPwd); console.log(this.P_USER_NAME); - // this.profile_form = this.formBuilder.group({ - // password: ['', Validators.compose([Validators.minLength(8)])] - // }); + // this.profile_form = this.formBuilder.group({ + // password: ['', Validators.compose([Validators.minLength(8)])] + // }); // this.authService // .loadAuthenticatedUser() // .subscribe((user: AuthenticatedUser) => { @@ -78,97 +150,228 @@ export class ChangePasswordComponent implements OnInit { private checkUserResult: CheckUserAuthenticationResponse; - submit(){ + submit() { console.log(this.isExpiredPwd); - if(this.isExpiredPwd){ + if (this.isExpiredPwd) { this.expiredPassword(); - }else{ + } else { this.changePassword(); } } - public expiredPassword(){ + public expiredPassword() { const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); //this.loginData.P_USER_NAME = this.P_USER_NAME; - let request:Password = new Password(); - request.P_OLD_PASSWORD=this.P_OLD_PASSWORD; - request.P_Confirm_NEW_PASSWORD=this.P_NEW_PASSWORD; - request.P_NEW_PASSWORD=this.P_Confirm_NEW_PASSWORD; + let request: Password = new Password(); + request.P_OLD_PASSWORD = this.P_OLD_PASSWORD; + request.P_Confirm_NEW_PASSWORD = this.P_NEW_PASSWORD; + request.P_NEW_PASSWORD = this.P_Confirm_NEW_PASSWORD; request.P_USER_NAME = this.P_USER_NAME; this.authService.submitExpiredPassword( - request, - () => { - //this.sendSMSForForgotPassword(); - }, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => { - if (this.cs.validResponse(result)) { - this.checkUserResult = result; - console.log(result); - this.cs.toastPK("changePassword","successChange"); - this.sharedData.setSharedData(false,Password.IS_EXPIRED_PSW); - this.cs.openLogin(); - } - }); + request, + () => { + //this.sendSMSForForgotPassword(); + }, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => { + if (this.cs.validResponse(result)) { + this.checkUserResult = result; + console.log(result); + this.cs.greenToastPK("changePassword", "successChange"); + this.sharedData.setSharedData(false, Password.IS_EXPIRED_PSW); + // this.cs.sharedService.getSharedData( AuthenticationService.IMEI_USER_DATA); + localStorage.setItem('password', this.P_NEW_PASSWORD); + this.cs.openLogin(); + } + }); } - public changePassword(){ + public changePassword() { const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); //this.loginData.P_USER_NAME = this.P_USER_NAME; - let request:Password = new Password(); - request.P_OLD_PASSWORD=this.P_OLD_PASSWORD; - request.P_Confirm_NEW_PASSWORD=this.P_NEW_PASSWORD; - request.P_NEW_PASSWORD=this.P_Confirm_NEW_PASSWORD; + let request: Password = new Password(); + request.P_OLD_PASSWORD = this.P_OLD_PASSWORD; + request.P_Confirm_NEW_PASSWORD = this.P_NEW_PASSWORD; + request.P_NEW_PASSWORD = this.P_Confirm_NEW_PASSWORD; request.P_USER_NAME = this.P_USER_NAME; this.authService.submitChangePassword( - request, - () => { - //this.sendSMSForForgotPassword(); - }, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => { - if (this.cs.validResponse(result)) { - this.checkUserResult = result; - console.log(result); - this.cs.toastPK("changePassword","successChange"); - this.cs.openHome(); - } - }); + request, + () => { + //this.sendSMSForForgotPassword(); + }, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => { + if (this.cs.validResponse(result)) { + this.checkUserResult = result; + localStorage.setItem('password', this.P_NEW_PASSWORD); + console.log(result); + this.cs.greenToastPK("changePassword", "successChange"); + localStorage.setItem('password', this.P_NEW_PASSWORD); + this.cs.openHome(); + } + }); } - onChangeCNP(){ -// in UAT Alow to the length of password less than 8 -// so if we ready to go life change it to >= 8 + onChangeCNP() { + // in UAT Alow to the length of password less than 8 + // so if we ready to go life change it to >= 8 if (this.P_Confirm_NEW_PASSWORD.length >= 3) { - this.Confirm_NEW_PASSWORD=true; + this.Confirm_NEW_PASSWORD = true; + + + } else { + this.Confirm_NEW_PASSWORD = false; + + } - - }else{ - this.Confirm_NEW_PASSWORD=false; - } - -} -onChangeNP(){ -// in UAT Alow to the length of password less than 8 -// so if we ready to go life change it to >= 8 - if (this.P_NEW_PASSWORD.length >= 3) { - this.NEW_PASSWORD=true; - -}else{ - this.NEW_PASSWORD=false; + onChangeNP() { + // in UAT Alow to the length of password less than 8 + // so if we ready to go life change it to >= 8 + if (this.P_NEW_PASSWORD.length >= 3) { + this.NEW_PASSWORD = true; -} + } else { + this.NEW_PASSWORD = false; -} -onChangeOP(){ -// in UAT Alow to the length of password less than 8 -// so if we ready to go life change it to >= 8 - if (this.P_OLD_PASSWORD.length >= 3) { - this.OLD_PASSWORD=true; - -}else{ - this.OLD_PASSWORD=false; + } -} + } + onChangeOP() { + // in UAT Alow to the length of password less than 8 + // so if we ready to go life change it to >= 8 + if (this.P_OLD_PASSWORD.length >= 3) { + this.OLD_PASSWORD = true; -} + } else { + this.OLD_PASSWORD = false; + + } + + } + + checkerFuncation(val) { + if (this.P_NEW_PASSWORD === '') { + switch (val) { + case 1: + return this.isLetterCase.blankImg; + case 3: + return this.isHasDigit.blankImg; + case 4: + return this.isMinLength.blankImg; + case 5: + return this.isRepeatedLetter.blankImg; + // case 6: + // return this.isContainSpecialChar.blankImg; + case 7: + return this.confirmMatchNew.blankImg; + case 8: + return this.userNameMatchNew.blankImg; + } + } else { + switch (val) { + // case 1: + // if (/[a-z]/.test(this.P_NEW_PASSWORD)) { + // this.isLowerCase.isMatch = true; + // return this.isLowerCase.greenImg; + // } else { + // this.isLowerCase.isMatch = false; + // return this.isLowerCase.redImg; + // } + // case 2: + // if (/[A-Z]/.test(this.P_NEW_PASSWORD)) { + // this.isUpperCase.isMatch = true; + // return this.isUpperCase.greenImg; + // } else { + // this.isUpperCase.isMatch = false; + // return this.isUpperCase.redImg; + // } + case 1: + if (/[a-zA-Z]/.test(this.P_NEW_PASSWORD)) { + this.isLetterCase.isMatch = true; + return this.isLetterCase.greenImg; + } else { + this.isLetterCase.isMatch = false; + return this.isLetterCase.redImg; + } + case 3: + if (/[0-9]/.test(this.P_NEW_PASSWORD)) { + this.isHasDigit.isMatch = true; + return this.isHasDigit.greenImg; + } else { + this.isHasDigit.isMatch = false; + return this.isHasDigit.redImg; + } + case 4: + if (this.P_NEW_PASSWORD.length >= 8) { + this.isMinLength.isMatch = true; + return this.isMinLength.greenImg; + } else { + this.isMinLength.isMatch = false; + return this.isMinLength.redImg; + } + case 5: + if (/([a-z])\1/i.test(this.P_NEW_PASSWORD)) { + this.isRepeatedLetter.isMatch = false; + return this.isRepeatedLetter.redImg; + } else { + this.isRepeatedLetter.isMatch = true; + return this.isRepeatedLetter.greenImg; + } + // case 6: + // if (/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(this.P_NEW_PASSWORD)) { + // this.isContainSpecialChar.isMatch = true; + // return this.isContainSpecialChar.greenImg; + // } else { + // this.isContainSpecialChar.isMatch = false; + // return this.isContainSpecialChar.redImg; + // } + case 7: + if (this.P_NEW_PASSWORD !== this.P_Confirm_NEW_PASSWORD) { + this.confirmMatchNew.isMatch = false; + return this.confirmMatchNew.redImg; + } else { + this.confirmMatchNew.isMatch = true; + return this.confirmMatchNew.greenImg; + } + case 8: + if (!this.P_NEW_PASSWORD.includes(this.P_USER_NAME)) { + this.userNameMatchNew.isMatch = true; + return this.userNameMatchNew.greenImg; + } else { + this.userNameMatchNew.isMatch = false; + return this.userNameMatchNew.redImg; + } + } + } + } + + + disabledSubmitBtn() { + if (this.isLetterCase.isMatch && this.isHasDigit.isMatch && this.isMinLength.isMatch + && this.isRepeatedLetter.isMatch && this.P_NEW_PASSWORD !== '' && this.NEW_PASSWORD + && this.Confirm_NEW_PASSWORD && this.OLD_PASSWORD && this.confirmMatchNew.isMatch) { + return false; + } else { return true; } + } + + showPassword(val) { + if (val === 1) + this.newPasswordIcon = 'password'; + else if (val === 2) { + this.confirmPasswordIcon = 'password' + } + else { + this.currentPasswordIcon = 'password'; + } + } + + hidePassword(val) { + if (val === 1) + this.newPasswordIcon = 'text'; + else if (val === 2) { + this.confirmPasswordIcon = 'text' + } + else { + this.currentPasswordIcon = 'text'; + } + } } diff --git a/Mohem/src/app/authentication/check-user/check-user.component.html b/Mohem/src/app/authentication/check-user/check-user.component.html index 35bde363..e99fae9a 100644 --- a/Mohem/src/app/authentication/check-user/check-user.component.html +++ b/Mohem/src/app/authentication/check-user/check-user.component.html @@ -32,6 +32,6 @@
- +
\ No newline at end of file diff --git a/Mohem/src/app/authentication/check-user/check-user.component.ts b/Mohem/src/app/authentication/check-user/check-user.component.ts index fcaed803..2b74c986 100644 --- a/Mohem/src/app/authentication/check-user/check-user.component.ts +++ b/Mohem/src/app/authentication/check-user/check-user.component.ts @@ -46,32 +46,27 @@ export class CheckUserComponent implements OnInit { return true; } - public userCheck() - { + public userCheck() { this.cs.startLoading(); const request = new CheckUserAuthenticationRequest(); request.P_USER_NAME = this.P_USER_NAME; - this.authService.checkUserAuthentication( - request, - () => { - /* Write code for error */ - }, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => { - if (this.cs.validResponse(result)) { - this.checkUserResult = result; - this.cs.stopLoading(); - this.sendSMSForForgotPassword(); - } - }); + this.authService.checkUserAuthentication(request, () => {}, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => { + if (this.cs.validResponse(result)) { + this.checkUserResult = result; + this.cs.stopLoading(); + this.sendSMSForForgotPassword(); + } + }); } private checkUserResult: CheckUserAuthenticationResponse; - private sendSMSForForgotPassword() { + public sendSMSForForgotPassword() { this.cs.startLoading(); let changePwdObj= new LoginRequest(); - changePwdObj.MobileNumber= this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER; + // changePwdObj.MobileNumber= this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER; changePwdObj.P_USER_NAME=this.P_USER_NAME; - changePwdObj.P_MOBILE_NUMBER=this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER; + // changePwdObj.P_MOBILE_NUMBER=this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER; this.authService.sendPublicSMS( changePwdObj, diff --git a/Mohem/src/app/authentication/confirm-login/confirm-login.component.ts b/Mohem/src/app/authentication/confirm-login/confirm-login.component.ts index 2e345b5c..fe0ba645 100644 --- a/Mohem/src/app/authentication/confirm-login/confirm-login.component.ts +++ b/Mohem/src/app/authentication/confirm-login/confirm-login.component.ts @@ -12,7 +12,7 @@ import { GetLoginInfoResponse } from '../../hmg-common/services/authentication/m import { SMSCheckRequest } from 'src/app/hmg-common/services/authentication/models/smscheck.request'; import { SMSCheckResponse } from 'src/app/hmg-common/services/authentication/models/smscheck.response'; import { PushService } from 'src/app/hmg-common/services/push/push.service'; -import { ModalController, Platform } from '@ionic/angular'; +import { ModalController, Platform, AlertController } from '@ionic/angular'; import { CheckUserAuthenticationResponse } from 'src/app/hmg-common/services/authentication/models/check-user-auth.response'; import { LoginModel } from '../models/LoginModel'; import * as moment from 'moment'; @@ -20,6 +20,9 @@ import { CheckAppVersionResponse } from 'src/app/hmg-common/services/authenticat import { NFC } from "@ionic-native/nfc/ngx"; import { DigitalIdComponent } from '../digital-id/digital-id.component'; import { AppUpdateComponent } from '../app-update/app-update.component'; +import { Password } from '../models/password'; +import { CheckUserAuthenticationRequest } from 'src/app/hmg-common/services/authentication/models/check-user-auth.request'; +import { SmsRetriever } from '@ionic-native/sms-retriever/ngx'; @Component({ selector: 'app-confirm-login', @@ -53,7 +56,9 @@ export class ConfirmLoginComponent implements OnInit { public isNFCAvailable = false; direction: string; userInfo: any; - + public businessInfo: object; + private checkUserResult: CheckUserAuthenticationResponse; + private signature: string; constructor( public ts: TranslatorService, public cs: CommonService, @@ -63,7 +68,9 @@ export class ConfirmLoginComponent implements OnInit { public pushService: PushService, public platform: Platform, public modalController: ModalController, - private nfc: NFC + public alertController: AlertController, + private nfc: NFC, + private smsRetriever: SmsRetriever ) { this.loginData = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); this.deviceToken = this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false); @@ -83,6 +90,7 @@ export class ConfirmLoginComponent implements OnInit { this.direction = TranslatorService.getCurrentLanguageName(); this.userInfo = JSON.parse(localStorage.getItem('digitalIDUser')); this.checkNFCStatus(); + this.generateSMSsignature(); // **checkIfAvailable FAIO **// this.checkIfAvailable(); // **getSharedData of IMEI_USER_DATA and REGISTER_DATA_FOR_LOGIIN to set defult value **// @@ -224,13 +232,18 @@ export class ConfirmLoginComponent implements OnInit { } - + public generateSMSsignature() { + this.smsRetriever.getAppHash() + .then((res: any) => this.signature = res) + .catch((error: any) => console.error(error)); + } public sendActivationCode(type: number) { + console.log(this.signature); const request = new SendActivationByType(); this.authService.setPublicFields(request); request.OTP_SendType = type; request.MobileNumber = this.loginData.MobileNumber; - + request.smsSignature = this.signature; request.IsMobileFingerPrint = 0; request.P_USER_NAME = this.loginData.P_USER_NAME; @@ -294,7 +307,7 @@ export class ConfirmLoginComponent implements OnInit { private presentBiometricDialog() { this.faio.show({ title: 'Biometric Authetnciation', // (Android Only) | optional | Default: " Biometric Sign On" - subtitle: 'Coolest Plugin ever', // (Android Only) | optional | Default: null + subtitle: 'Mohemm', // (Android Only) | optional | Default: null description: this.ts.trPK('general', 'auth-please'), // optional | Default: null fallbackButtonTitle: this.ts.trPK('general', 'use-pin'), // optional | When disableBackup is false defaults to "Use Pin". disableBackup: true, // optional | default: false @@ -367,10 +380,24 @@ export class ConfirmLoginComponent implements OnInit { this.authService.checkSMS(request, () => { }, this.ts.trPK('general', 'ok')) .subscribe((result: SMSCheckResponse) => { if (this.cs.validResponse(result)) { + this.businessInfo = { + show_business: result.BusinessCardPrivilege, + name_en: result.MemberInformationList[0].EMPLOYEE_NAME_En, + job_en: result.MemberInformationList[0].JOB_NAME_En, + name_ar: result.MemberInformationList[0].EMPLOYEE_NAME_Ar, + job_ar: result.MemberInformationList[0].JOB_NAME_Ar, + mobile: result.MemberInformationList[0].MobileNumberWithZipCode, + qr: result.MemberInformationList[0].BusinessCardQR, + company_logo: result.BC_Logo ? result.BC_Logo : result.CompanyImageURL, + company_url: result.BC_Domain, + company_type: result.CompanyMainCompany, + email: result.MemberInformationList[0].EMPLOYEE_EMAIL_ADDRESS + } // Wifi Credientials CommonService.MOHEMM_WIFI_SSID = result.Mohemm_Wifi_SSID; CommonService.MOHEMM_WIFI_PASSWORD = result.Mohemm_Wifi_Password; + localStorage.setItem('bussiness-card-info', JSON.stringify(this.businessInfo)); AuthenticationService.servicePrivilage = result.Privilege_List; this.authService.setAuthenticatedUser(result).subscribe(() => { @@ -412,7 +439,7 @@ export class ConfirmLoginComponent implements OnInit { const request = new LoginRequest(); request.P_USER_NAME = this.username; request.P_LANGUAGE = 'US'; // this.language; - request.P_PASSWORD = this.password; + request.P_PASSWORD = localStorage.getItem('password'); this.authService .login(request, () => { console.log('error here'); @@ -431,13 +458,78 @@ export class ConfirmLoginComponent implements OnInit { this.confirm(this.loginType); } else { if (result.IsPasswordExpired) { - // alert("dont forget to handelpresentPasswordExpiredDialog() "); - // this.presentPasswordExpiredDialog(); ***** + this.presentPasswordExpiredDialog(); } } }); } + async presentPasswordExpiredDialog() { + const alert = await this.alertController.create({ + header: this.ts.trPK('general', 'confirm'), + message: this.ts.trPK('login', 'password-expired'), + buttons: [ + { + text: this.ts.trPK('general', 'ok'), + handler: () => { + console.log('Confirm Okay'); + this.sharedData.setSharedData(true, Password.IS_EXPIRED_PSW); + this.userCheck(); + } + } + ] + }); + await alert.present(); + } + + public userCheck() { + this.cs.startLoading(); + const request = new CheckUserAuthenticationRequest(); + request.P_USER_NAME = this.username; + this.authService.checkUserAuthentication( + request, + () => { + /* Write code for error */ + }, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => { + if (this.cs.validResponse(result)) { + this.checkUserResult = result; + this.cs.stopLoading(); + this.sendSMSForForgotPassword(); + } + }); + } + + + private sendSMSForForgotPassword() { + this.cs.startLoading(); + const changePwdObj = new LoginRequest(); + changePwdObj.MobileNumber = this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER; + changePwdObj.P_USER_NAME = this.username; + changePwdObj.P_MOBILE_NUMBER = this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER; + this.authService.sendPublicSMS( + changePwdObj, + () => { + // this.sendSMSForForgotPassword(); + /* Write code for error */ + }, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => { + if (this.cs.validResponse(result)) { + this.checkUserResult = result; + + console.log(result); + + this.loginData = new LoginModel(); + this.loginData.LogInTokenID = result.LogInTokenID; + this.loginData.P_USER_NAME = this.username; + + this.cs.sharedService.setSharedData(this.loginData.P_USER_NAME, LoginRequest.SHARED_DATA); + this.sharedData.setSharedData(this.loginData, AuthenticationService.LOGIN_DATA); + this.sharedData.setSharedData(true, Password.IS_FORGET_PSW); + this.cs.stopLoading(); + this.cs.openSMSPage(); + } + }); + } + private handleAppUpdate(result) { this.iosLink = result.IOSLink; this.androidLink = result.AndroidLink; @@ -463,14 +555,14 @@ export class ConfirmLoginComponent implements OnInit { }); } - async appUpdate(msg, result) { + async appUpdate(msg, result) { const modal = await this.modalController.create({ component: AppUpdateComponent, cssClass: 'app-update-modal-css', - componentProps: {'msg':msg} + componentProps: { 'msg': msg } }); modal.onDidDismiss().then((data) => { - this.handleAppUpdate(result); + this.handleAppUpdate(result); }); return await modal.present(); } @@ -502,9 +594,9 @@ export class ConfirmLoginComponent implements OnInit { let buttonSelected; this.buttons.forEach(element => { element.forEach(elementValue => { - if(typeNumber === elementValue.value){ + if (typeNumber === elementValue.value) { buttonSelected = elementValue; - }else{ + } else { elementValue.visible = false; } }); diff --git a/Mohem/src/app/authentication/forgot/forgot.component.html b/Mohem/src/app/authentication/forgot/forgot.component.html index f363261d..fc00d176 100644 --- a/Mohem/src/app/authentication/forgot/forgot.component.html +++ b/Mohem/src/app/authentication/forgot/forgot.component.html @@ -24,18 +24,65 @@ - {{'changePassword,newPassword' | translate}} - - {{'changePassword,confirmPassword' | translate}} - + + + +

{{recentPasswordNote.text}}

+
+ + + +

{{isLetterCase.text}}

+
+ + +

{{isHasDigit.text}}

+
+ + +

{{isMinLength.text}}

+
+ + +

{{isRepeatedLetter.text}}

+
+ + + +

{{confirmMatchNew.text}}

+
+ + +

{{userNameMatchNew.text}}

@@ -45,6 +92,8 @@
- +
\ No newline at end of file diff --git a/Mohem/src/app/authentication/forgot/forgot.component.scss b/Mohem/src/app/authentication/forgot/forgot.component.scss index 139597f9..55589cb9 100644 --- a/Mohem/src/app/authentication/forgot/forgot.component.scss +++ b/Mohem/src/app/authentication/forgot/forgot.component.scss @@ -1,2 +1,8 @@ +.disabledButton{ + opacity:.5; - +} +.info{ + color: #000; + font-weight: bold; +} diff --git a/Mohem/src/app/authentication/forgot/forgot.component.ts b/Mohem/src/app/authentication/forgot/forgot.component.ts index 8e76d97a..51cc3e09 100644 --- a/Mohem/src/app/authentication/forgot/forgot.component.ts +++ b/Mohem/src/app/authentication/forgot/forgot.component.ts @@ -9,7 +9,6 @@ import { SmsReaderService } from 'src/app/hmg-common/services/sms/sms-reader.ser import { ForgetPassword } from '../models/forget.password'; import { LoginModel } from '../models/LoginModel'; import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service'; -import {LoginComponent} from "src/app/authentication/login/login.component"; @Component({ selector: 'app-forgot', templateUrl: './forgot.component.html', @@ -18,10 +17,81 @@ import {LoginComponent} from "src/app/authentication/login/login.component"; export class ForgotComponent implements OnInit { private loginData = new LoginModel(); - public P_NEW_PASSWORD: string; - public P_Confirm_NEW_PASSWORD : string; - public P_USER_NAME : string; - public logo = "assets/icon/login/lock.png"; + public P_NEW_PASSWORD = ''; + // tslint:disable-next-line: variable-name + public P_Confirm_NEW_PASSWORD = ''; + public P_USER_NAME: string; + public logo = 'assets/icon/login/lock.png'; + public newPasswordIcon = "password"; + public confirmPasswordIcon = "password"; + public recentPasswordNote = { + yellowImg: '../assets/imgs/mohemm-action/info.png', + text: this.ts.trPK('login', 'current-password-validation') + }; + public isLowerCase = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'lowercase-password-validation'), + isMatch: false + }; + public isUpperCase = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'uppercase-password-validation'), + isMatch: false + }; + public isLetterCase = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'letter-password-validation'), + isMatch: false + }; + public isHasDigit = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'numerica-password-validation'), + isMatch: false + }; + public isMinLength = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'min-password-validation'), + isMatch: false + }; + public isRepeatedLetter = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'repeating-password-validation'), + isMatch: false + }; + // public isContainSpecialChar = { + // blankImg: '../assets/icon/blank.svg', + // greenImg: '../assets/icon/green.svg', + // redImg: '../assets/imgs/close.svg', + // text: this.ts.trPK('login', 'special-character-password-validation'), + // isMatch: false + // }; + public confirmMatchNew = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'not-match-password-validation'), + isMatch: false + }; + public userNameMatchNew = { + blankImg: '../assets/icon/blank.svg', + greenImg: '../assets/icon/green.svg', + redImg: '../assets/imgs/close.svg', + text: this.ts.trPK('login', 'contain-username-password-validation'), + isMatch: false + }; + public userId: string; constructor( public cs: CommonService, @@ -35,16 +105,22 @@ export class ForgotComponent implements OnInit { ) { } - ngOnInit() {} + ngOnInit() { + console.log('ENAD >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'); + this.userId = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false).P_USER_NAME; + console.log(this.userId); + } public onForgot() { this.sendSMSForForgotPassword(); } + // tslint:disable-next-line: member-ordering private checkUserResult: CheckUserAuthenticationResponse; private sendSMSForForgotPassword() { const request = new ForgetPassword(); + console.log(request); this.authService.sendForgetPassword( request, () => { @@ -56,7 +132,7 @@ export class ForgotComponent implements OnInit { }); } - public forgotpassword(){ + public forgotpassword() { const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); const forgetPasswordTokenResult = this.sharedData.getSharedData('checkSMSResponse', false); let forgetPasswordTokenID = ''; @@ -64,24 +140,149 @@ export class ForgotComponent implements OnInit { forgetPasswordTokenID = forgetPasswordTokenResult.ForgetPasswordTokenID; } this.loginData.P_USER_NAME = this.P_USER_NAME; - let request: any = {}; - request.P_Confirm_NEW_PASSWORD=this.P_NEW_PASSWORD; - request.P_NEW_PASSWORD=this.P_Confirm_NEW_PASSWORD; + const request: any = {}; + request.P_Confirm_NEW_PASSWORD = this.P_NEW_PASSWORD; + request.P_NEW_PASSWORD = this.P_Confirm_NEW_PASSWORD; request.P_USER_NAME = data.P_USER_NAME; - request.ForgetPasswordTokenID = forgetPasswordTokenID; - + request.ForgetPasswordTokenID = forgetPasswordTokenID; + this.authService.submitForgetPassword( request, () => { - //this.sendSMSForForgotPassword(); }, this.ts.trPK('general', 'ok')).subscribe((result: CheckUserAuthenticationResponse) => { if (this.cs.validResponse(result)) { this.checkUserResult = result; console.log(result); - this.cs.toastPK("changePassword","successChange"); + this.cs.greenToastPK("changePassword", "successChange"); + localStorage.setItem('password', this.P_NEW_PASSWORD); this.cs.openLogin(); } }); - + + } + + checkerFuncation(val) { + if (this.P_NEW_PASSWORD === '') { + switch (val) { + // case 1: + // return this.isLowerCase.blankImg; + // case 2: + // return this.isUpperCase.blankImg; + case 1: + return this.isLetterCase.blankImg; + case 3: + return this.isHasDigit.blankImg; + case 4: + return this.isMinLength.blankImg; + case 5: + return this.isRepeatedLetter.blankImg; + // case 6: + // return this.isContainSpecialChar.blankImg; + case 7: + return this.confirmMatchNew.blankImg; + case 8: + return this.userNameMatchNew.blankImg; + } + } else { + switch (val) { + // case 1: + // if (/[a-z]/.test(this.P_NEW_PASSWORD)) { + // this.isLowerCase.isMatch = true; + // return this.isLowerCase.greenImg; + // } else { + // this.isLowerCase.isMatch = false; + // return this.isLowerCase.redImg; + // } + // case 2: + // if (/[A-Z]/.test(this.P_NEW_PASSWORD)) { + // this.isUpperCase.isMatch = true; + // return this.isUpperCase.greenImg; + // } else { + // this.isUpperCase.isMatch = false; + // return this.isUpperCase.redImg; + // } + case 1: + if (/[a-zA-Z]/.test(this.P_NEW_PASSWORD)) { + this.isLetterCase.isMatch = true; + return this.isLetterCase.greenImg; + } else { + this.isLetterCase.isMatch = false; + return this.isLetterCase.redImg; + } + case 3: + if (/[0-9]/.test(this.P_NEW_PASSWORD)) { + this.isHasDigit.isMatch = true; + return this.isHasDigit.greenImg; + } else { + this.isHasDigit.isMatch = false; + return this.isHasDigit.redImg; + } + case 4: + if (this.P_NEW_PASSWORD.length >= 8) { + this.isMinLength.isMatch = true; + return this.isMinLength.greenImg; + } else { + this.isMinLength.isMatch = false; + return this.isMinLength.redImg; + } + case 5: + if (/([a-z])\1/i.test(this.P_NEW_PASSWORD)) { + this.isRepeatedLetter.isMatch = false; + return this.isRepeatedLetter.redImg; + } else { + this.isRepeatedLetter.isMatch = true; + return this.isRepeatedLetter.greenImg; + } + // case 6: + // if (/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(this.P_NEW_PASSWORD)) { + // this.isContainSpecialChar.isMatch = true; + // return this.isContainSpecialChar.greenImg; + // } else { + // this.isContainSpecialChar.isMatch = false; + // return this.isContainSpecialChar.redImg; + // } + case 7: + if (this.P_NEW_PASSWORD !== this.P_Confirm_NEW_PASSWORD) { + this.confirmMatchNew.isMatch = false; + return this.confirmMatchNew.redImg; + } else { + this.confirmMatchNew.isMatch = true; + return this.confirmMatchNew.greenImg; + } + case 8: + if (!this.P_NEW_PASSWORD.includes(this.userId)) { + this.userNameMatchNew.isMatch = true; + return this.userNameMatchNew.greenImg; + } else { + this.userNameMatchNew.isMatch = false; + return this.userNameMatchNew.redImg; + } + } + } + } + + disabledSubmitBtn() { + if (this.isLetterCase.isMatch && this.isHasDigit.isMatch && this.isMinLength.isMatch + && this.isRepeatedLetter.isMatch && this.P_NEW_PASSWORD !== '' && this.P_NEW_PASSWORD + && this.P_Confirm_NEW_PASSWORD && this.confirmMatchNew.isMatch) { + return false; + } else { return true; } } + + showPassword(val) { + if (val == 1) + this.newPasswordIcon = 'password'; + else { + this.confirmPasswordIcon = 'password' + } + } + + hidePassword(val) { + if (val == 1) + this.newPasswordIcon = 'text'; + else { + this.confirmPasswordIcon = 'text' + } + } + } diff --git a/Mohem/src/app/authentication/models/sendActivationByType.ts b/Mohem/src/app/authentication/models/sendActivationByType.ts index 76d2f29e..6d1447c5 100644 --- a/Mohem/src/app/authentication/models/sendActivationByType.ts +++ b/Mohem/src/app/authentication/models/sendActivationByType.ts @@ -2,30 +2,31 @@ import { Request } from 'src/app/hmg-common/services/models/request'; export class SendActivationByType extends Request { P_USER_NAME: string; // id - UserName:string; + UserName: string; MobileNumber: string; // phone number ZipCode: string; LogInTokenID: string; - OTP_SendType:number; - IsMobileFingerPrint:number; - P_LEGISLATION_CODE:string; + OTP_SendType: number; + IsMobileFingerPrint: number; + P_LEGISLATION_CODE: string; + smsSignature: string; // VersionID:string; - - - -// Test -//{ -// "Channel":31, -// "LanguageID":2, -// "LogInTokenID":"Wfm9uDlWhEi3vFsQMqUz3w==", -// "MobileNumber":"0508079569", -// "P_USER_NAME":"191817", -// "UserName":"191817", -// "VersionID":2.0, -// "P_LEGISLATION_CODE":"SA", -// "IsMobileFingerPrint":0, -// "OTP_SendType":1 -// } + + + + // Test + //{ + // "Channel":31, + // "LanguageID":2, + // "LogInTokenID":"Wfm9uDlWhEi3vFsQMqUz3w==", + // "MobileNumber":"0508079569", + // "P_USER_NAME":"191817", + // "UserName":"191817", + // "VersionID":2.0, + // "P_LEGISLATION_CODE":"SA", + // "IsMobileFingerPrint":0, + // "OTP_SendType":1 + // } diff --git a/Mohem/src/app/authentication/sms-page/sms-page.page.html b/Mohem/src/app/authentication/sms-page/sms-page.page.html index 1fa9de7b..854ab267 100644 --- a/Mohem/src/app/authentication/sms-page/sms-page.page.html +++ b/Mohem/src/app/authentication/sms-page/sms-page.page.html @@ -1,70 +1,142 @@ + + + + + +showBack="true" + +[headerText]="'verificationcode,verificationcode' | translate"> + + + - - -
-
- - -

{{'verificationcode,verificationcode' | translate}}

-
-

{{'verificationcode,title' | translate}} - {{'verificationcode,verificationcode' | translate}} - {{'verificationcode,by' | translate}} - {{'verificationcode , sms' | translate}}, - {{'verificationcode , whatsapp' | translate}}, - - {{'verificationcode,instruct' | translate}} - {{'general,submit' | translate}}

- -
-
-
-

- -
-

{{displayTime}}

-

- - - - - - - - - - + + + + + +
+ +
+ + + + + +

{{'verificationcode,verificationcode' | translate}}

+ +
+ +

{{'verificationcode,title' | translate}} + +{{'verificationcode,verificationcode' | translate}} + +{{'verificationcode,by' | translate}} + +{{'verificationcode , sms' | translate}}, + +{{'verificationcode , whatsapp' | translate}}, + + + +{{'verificationcode,instruct' | translate}} + +{{'general,submit' | translate}}

+ +
+ +
+ +
+ +

+ + + +
+ +

{{displayTime}}

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + +

{{messageValue}}

+ +
+ + + -
- -
-
\ No newline at end of file + +
+ + + +
+ +​ 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..aa9bf3b6 100644 --- a/Mohem/src/app/authentication/sms-page/sms-page.page.ts +++ b/Mohem/src/app/authentication/sms-page/sms-page.page.ts @@ -1,306 +1,629 @@ - import { Component, OnInit } from '@angular/core'; + import { ElementRef } from '@angular/core'; + import { NavController, Platform } from '@ionic/angular'; + import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; + import { CommonService } from 'src/app/hmg-common/services/common/common.service'; + import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service'; + import { SMSCheckRequest } from 'src/app/hmg-common/services/authentication/models/smscheck.request'; + import { LoginModel } from '../models/LoginModel'; + import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; + import { SMSCheckResponse } from 'src/app/hmg-common/services/authentication/models/smscheck.response'; + import { Password } from '../models/password'; + import { GetLoginInfoRequest } from 'src/app/hmg-common/services/authentication/models/get-login-info.request'; + import * as moment from 'moment'; + import { NFC } from "@ionic-native/nfc/ngx"; +import { SmsRetriever } from '@ionic-native/sms-retriever/ngx'; + @Component({ + selector: 'app-sms-page', + templateUrl: './sms-page.page.html', + styleUrls: ['./sms-page.page.scss'] + }) + + export class SmsPageComponent implements OnInit { + public static LOGIN_DATA = 'LOGIN_DATA'; + Channel = 0; + activationCode: string; + P_SESSION_ID: number; + P_USER_NAME: string; + timeInSeconds: any; + time: any; + runTimer: any; + hasStarted: any; + hasFinished: any; + remainingTime: any; + displayTime: any; + loginTokenID: string; + public isForgetPwd = false; + public isExpiredPwd = false; + public count = 0; + private loginData = new LoginModel(); + public deviceToken: any; + public loginTypeData: any; + public logo = 'assets/icon/login/password.png'; + // tslint:disable-next-line: variable-name + public smc_code: any = []; + code: any; + // tslint:disable-next-line: variable-name + user_name: string; + public isPostNoLoad = true; + loginType: any; + activeType: any; + public isNFCAvailable = false; + public showErrorMessage = false; + public messageValue: string; + public businessInfo: object; + public isAutoRead: boolean = false; + constructor( + public navCtrl: NavController, + public translate: TranslatorService, + public common: CommonService, + private elementRef: ElementRef, + public authService: AuthenticationService, + public sharedData: SharedDataService, + public platform: Platform, - private nfc: NFC - ) {} + + private nfc: NFC, + + private smsRetriever: SmsRetriever + + ) { } + + ngOnInit() { + this.checkNFCStatus(); - this.activeType=this.common.getActiveTypeLogin(); - console.log("active "+ this.common.sharedService.getSharedData('active-type',true)); - console.log("activeType :"+this.activeType); + this.activeType = this.common.getActiveTypeLogin(); + + console.log("active " + this.common.sharedService.getSharedData('active-type', true)); + + + + console.log("activeType :" + this.activeType); + this.count = 0; + this.initTimer(); + this.startTimer(); + this.isForgetPwd = this.sharedData.getSharedData(Password.IS_FORGET_PSW) || false; + this.isExpiredPwd = this.sharedData.getSharedData(Password.IS_EXPIRED_PSW) || false; + this.loginData = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); + this.deviceToken = this.common.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false); + // tslint:disable-next-line: triple-equals + if (this.deviceToken == undefined) { + this.deviceToken = localStorage.getItem('deviceToken'); + } + console.log('deviceToken :' + this.deviceToken); + this.loginTypeData = this.common.sharedService.getSharedData(SMSCheckRequest.SHARED_DATA, false); - if( this.loginTypeData){ - this.loginType=this.loginTypeData.loginType; - console.log("loginType :"+this.loginTypeData.loginType); - }else{ - this.loginType=1; - } + if (this.loginTypeData) { + + this.loginType = this.loginTypeData.loginType; + + + + console.log("loginType :" + this.loginTypeData.loginType); + + } else { + + this.loginType = 1; + + } + + this.smsRetriever.startWatching() + + .then((res: any) => this.checkActivation(res, true)) + + .catch((error: any) => console.error(error)); + + } + + checkActivation(res, isAndroid) { + + this.isAutoRead = true; + + var pattern = /\d+/g; + + if (isAndroid) + + var code = res.Message.match(pattern)[0]; + + else + + var code = res; + + + this.activationCode = code + + this.smc_code = code.split(''); + + this.checkVerificationCode(); } initTimer() { + if (!this.timeInSeconds) { - this.timeInSeconds = 600; + + this.timeInSeconds = 120; + } + this.time = this.timeInSeconds; + this.runTimer = false; + this.hasStarted = false; + this.hasFinished = false; + this.remainingTime = this.timeInSeconds; + this.displayTime = this.common.getSecondsAsDigitalClock(this.remainingTime); + } + + startTimer() { + this.runTimer = true; + this.hasStarted = true; + this.timerTick(); + } + + pauseTimer() { + this.runTimer = false; + } + + resumeTimer() { + this.startTimer(); + } + + timerTick() { + setTimeout(() => { + if (!this.runTimer) { + return; + } + this.remainingTime--; + this.displayTime = this.common.getSecondsAsDigitalClock(this.remainingTime); + if (this.remainingTime > 0) { + this.timerTick(); + } else { + this.hasFinished = true; + this.pauseTimer(); + this.navCtrl.pop(); + } + }, 1000); + } + + ionViewWillLeave() { + this.pauseTimer(); + } + + checkOTPLength() { + // tslint:disable-next-line: triple-equals + if (this.activationCode.length == 4) { + this.checkVerificationCode(); + } + } + + checkVerificationCode() { + this.code = this.smc_code.join(''); + if (this.count < 3) { + // tslint:disable-next-line: triple-equals + if (this.code == undefined || this.code == null || this.code == '') { - // this.common.showAlert(this.translate.translate('verificationcode.emptyCode')); + + // this.common.showAlert(this.translate.translate('verificationcode.emptyCode')); + } else { + this.count = this.count + 1; + if (this.isForgetPwd || this.isExpiredPwd) { + this.checkForgetPwdSMS(); + } else { + this.checkSMS(); + } + } + } else { + const msg: string = this.translate.trPK('general', 'noOfTriesLogin'); + this.common.JustAlertDialog(this.translate.trPK('general', 'ok'), msg); + } + } + + async checkNFCStatus() { + try { + let nfcStatus = await this.nfc.enabled(); + console.log("nfc status >>>>>>>>>>" + nfcStatus); + this.isNFCAvailable = true; + } catch (err) { + console.log("Error reading tag", err); + if (err === "NO_NFC") { + this.isNFCAvailable = false; + } else if (err === "NFC_DISABLED") { - this.isNFCAvailable = true; + + this.isNFCAvailable = true; + } else { + this.isNFCAvailable = false; + } + } + } + + public checkSMS() { - this.showErrorMessage = false; - const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); - const request = new SMSCheckRequest(); - request.LogInTokenID = data.LogInTokenID; - request.activationCode = this.code; // code;this.activationCode; - request.P_USER_NAME = data.P_USER_NAME; - request.MobileNumber = data.MobileNumber; - request.IsDeviceNFC = this.isNFCAvailable; - this.authService.checkSMS(request, () => {}, this.translate.trPK('general', 'ok'), true).subscribe((result: SMSCheckResponse) => { - if (this.common.validResponse(result)) { - - //save business card info - this.businessInfo = { - show_business: result.BusinessCardPrivilege, - name_en: result.MemberInformationList[0].EMPLOYEE_NAME_En, - job_en: result.MemberInformationList[0].JOB_NAME_En, - name_ar: result.MemberInformationList[0].EMPLOYEE_NAME_Ar, - job_ar: result.MemberInformationList[0].JOB_NAME_Ar, - mobile: result.MemberInformationList[0].MobileNumberWithZipCode, - qr: result.MemberInformationList[0].BusinessCardQR, - company_logo: result.BC_Logo ? result.BC_Logo: result.CompanyImageURL, - company_url: result.BC_Domain, - company_type: result.CompanyMainCompany, - email: result.MemberInformationList[0].EMPLOYEE_EMAIL_ADDRESS - } - // Wifi Credientials - CommonService.MOHEMM_WIFI_SSID = result.Mohemm_Wifi_SSID; - CommonService.MOHEMM_WIFI_PASSWORD = result.Mohemm_Wifi_Password; - localStorage.setItem('bussiness-card-info', JSON.stringify(this.businessInfo)); - // this.common.sharedService.setSharedData(this.businessInfo,'bussiness-card-info'); - - AuthenticationService.servicePrivilage = result.Privilege_List; - this.authService.setAuthenticatedUser(result).subscribe(() => { - localStorage.setItem('emp-name', result.MemberInformationList[0].EMPLOYEE_NAME); - this.user_name = result.MemberInformationList[0].EMPLOYEE_NAME; - const currDateTime = moment().format('MMM DD , YYYY HH:mm'); - localStorage.setItem('login-at', currDateTime); - if (this.platform.is('cordova')) { - this.insertMobileLogin(); - } - this.common.sharedService.setSharedData(result.MemberInformationList[0].PAYROLL_CODE, "projcet-code"); - this.activeType =this.common.setActiveTypeLogin(0); - this.common.openHome(); - }); - } else { - let errorResult: any; - errorResult = result; - this.showErrorMessage = true; - this.messageValue = errorResult.ErrorEndUserMessage; - this.smc_code = []; - (document.activeElement as HTMLElement).blur(); - setTimeout(() => { - this.showErrorMessage = false; - }, 5000); + this.showErrorMessage = false; + + const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); + + const request = new SMSCheckRequest(); + + request.LogInTokenID = data.LogInTokenID; + + request.activationCode = this.code; // code;this.activationCode; + + request.P_USER_NAME = data.P_USER_NAME; + + request.MobileNumber = data.MobileNumber; + + request.IsDeviceNFC = this.isNFCAvailable; + + this.authService.checkSMS(request, () => { }, this.translate.trPK('general', 'ok'), true).subscribe((result: SMSCheckResponse) => { + + if (this.common.validResponse(result)) { + + + + //save business card info + + this.businessInfo = { + + show_business: result.BusinessCardPrivilege, + + name_en: result.MemberInformationList[0].EMPLOYEE_NAME_En, + + job_en: result.MemberInformationList[0].JOB_NAME_En, + + name_ar: result.MemberInformationList[0].EMPLOYEE_NAME_Ar, + + job_ar: result.MemberInformationList[0].JOB_NAME_Ar, + + mobile: result.MemberInformationList[0].MobileNumberWithZipCode, + + qr: result.MemberInformationList[0].BusinessCardQR, + + company_logo: result.BC_Logo ? result.BC_Logo : result.CompanyImageURL, + + company_url: result.BC_Domain, + + company_type: result.CompanyMainCompany, + + email: result.MemberInformationList[0].EMPLOYEE_EMAIL_ADDRESS + } - }); + + + + // Wifi Credientials + + CommonService.MOHEMM_WIFI_SSID = result.Mohemm_Wifi_SSID; + + CommonService.MOHEMM_WIFI_PASSWORD = result.Mohemm_Wifi_Password; + + localStorage.setItem('bussiness-card-info', JSON.stringify(this.businessInfo)); + + // this.common.sharedService.setSharedData(this.businessInfo,'bussiness-card-info'); + + + + AuthenticationService.servicePrivilage = result.Privilege_List; + + this.authService.setAuthenticatedUser(result).subscribe(() => { + + localStorage.setItem('emp-name', result.MemberInformationList[0].EMPLOYEE_NAME); + + this.user_name = result.MemberInformationList[0].EMPLOYEE_NAME; + + const currDateTime = moment().format('MMM DD , YYYY HH:mm'); + + localStorage.setItem('login-at', currDateTime); + + if (this.platform.is('cordova')) { + + this.insertMobileLogin(); + + } + + this.common.sharedService.setSharedData(result.MemberInformationList[0].PAYROLL_CODE, "projcet-code"); + this.common.sharedService.setSharedData(result.BasicMemberInformation.P_LEGISLATION_CODE, "legislation-code"); + + this.activeType = this.common.setActiveTypeLogin(0); + + this.common.openHome(); + + }); + + } else { + + let errorResult: any; + + errorResult = result; + + this.showErrorMessage = true; + + this.messageValue = errorResult.ErrorEndUserMessage; + + this.smc_code = []; + + (document.activeElement as HTMLElement).blur(); + + setTimeout(() => { + + this.showErrorMessage = false; + + }, 5000); + + } + + }); + } + + public insertMobileLogin() { - const request = new GetLoginInfoRequest(); - this.authService.setPublicFields(request); - request.MobileNumber = this.loginData.MobileNumber; - request.P_USER_NAME = this.loginData.P_USER_NAME; - request.UserName = this.loginData.P_USER_NAME; - request.LogInTokenID = this.loginData.LogInTokenID; - request.CompanyID = 1; // CompanyID - request.DeviceType = this.common.getDeviceType(); - request.DeviceToken = this.deviceToken; // "5ca8a69cf1804db55264c349edffb99b9d63acd9fa9b6b18956bcb2ad3f2ba36";//this.deviceToken; - request.LoginType = this.loginTypeData.loginType; - request.EmployeeName = this.user_name; - this.authService.insertMobileLoginInfo(request, () => { }, this.translate.trPK('general', 'ok'), this.isPostNoLoad) - .subscribe((result: any) => { - console.log('successful insertMobileLogin' ); - }); + + const request = new GetLoginInfoRequest(); + + this.authService.setPublicFields(request); + + request.MobileNumber = this.loginData.MobileNumber; + + request.P_USER_NAME = this.loginData.P_USER_NAME; + + request.UserName = this.loginData.P_USER_NAME; + + request.LogInTokenID = this.loginData.LogInTokenID; + + request.CompanyID = 1; // CompanyID + + request.DeviceType = this.common.getDeviceType(); + + request.DeviceToken = this.deviceToken; // "5ca8a69cf1804db55264c349edffb99b9d63acd9fa9b6b18956bcb2ad3f2ba36";//this.deviceToken; + + request.LoginType = this.loginTypeData.loginType; + + request.EmployeeName = this.user_name; + + this.authService.insertMobileLoginInfo(request, () => { }, this.translate.trPK('general', 'ok'), this.isPostNoLoad) + + .subscribe((result: any) => { + + console.log('successful insertMobileLogin'); + + }); + } + + public checkForgetPwdSMS() { + const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); + const request = new SMSCheckRequest(); + request.LogInTokenID = data.LogInTokenID; + request.activationCode = this.code; // this.activationCode; + request.P_USER_NAME = data.P_USER_NAME; - this.authService.checkForgetSMS(request, () => {}, this.translate.trPK('general', 'ok')).subscribe((result: SMSCheckResponse) => { - if (this.common.validResponse(result)) { - this.sharedData.setSharedData(result, 'checkSMSResponse'); - if (this.isForgetPwd) { - this.common.openForgotPassword(); - } - if (this.isExpiredPwd) { - this.sharedData.setSharedData(true, Password.IS_EXPIRED_PSW); - this.common.openChangePassword(); - } + + this.authService.checkForgetSMS(request, () => { }, this.translate.trPK('general', 'ok')).subscribe((result: SMSCheckResponse) => { + + if (this.common.validResponse(result)) { + + this.sharedData.setSharedData(result, 'checkSMSResponse'); + + if (this.isForgetPwd) { + + this.common.openForgotPassword(); + } - }); + + if (this.isExpiredPwd) { + + this.sharedData.setSharedData(true, Password.IS_EXPIRED_PSW); + + this.common.openChangePassword(); + + } + + } + + }); + } + + onChange() { // tslint:disable-next-line: only-arrow-functions - const filtered = this.smc_code.filter(function(el) { + const filtered = this.smc_code.filter(function (el) { if (el) { return el; } }); - if (filtered.length === 4) { + + if (filtered.length === 4 && !this.isAutoRead) { this.checkVerificationCode(); } } + + + + + + goToNextInput(e) { const key = e.which; const t = e.target; const sib = t.nextElementSibling; const sibPre = t.previousElementSibling; + + if (key === undefined && e.target.value.length==4 && (this.platform.is('ios') && !this.platform.is('mobileweb'))) { + this.checkActivation(e.target.value, false); + } + if (key !== 9 && (key < 48 || key > 57)) { if (key === 8 || key === 46) { return true; @@ -309,7 +632,6 @@ export class SmsPageComponent implements OnInit { return false; } } - if (key === 9) { return true; } @@ -322,4 +644,6 @@ export class SmsPageComponent implements OnInit { } } } + + } diff --git a/Mohem/src/app/eit/add-cei/add-cei.component.html b/Mohem/src/app/eit/add-cei/add-cei.component.html new file mode 100644 index 00000000..6a1c1bc0 --- /dev/null +++ b/Mohem/src/app/eit/add-cei/add-cei.component.html @@ -0,0 +1,24 @@ + + + + + + + {{'vacation-rule, effectiveDate' | translate}} + {{showEffectiveDate}} + +
+
+
+ + +
+ + {{'vacation-rule, next-label' | translate}} +
+
\ No newline at end of file diff --git a/Mohem/src/app/eit/add-cei/add-cei.component.scss b/Mohem/src/app/eit/add-cei/add-cei.component.scss new file mode 100644 index 00000000..a6dbf815 --- /dev/null +++ b/Mohem/src/app/eit/add-cei/add-cei.component.scss @@ -0,0 +1,45 @@ +.footer-button { + border-radius: 2px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; + } + + ion-label { + color: var(--customnavy) !important; + } + + .daynamicForm-Label { + font-size: 16px; + color: #a2a5a6 !important; + display: block; + overflow: hidden; + -webkit-flex: 1; + flex: 1; + font-size: inherit; + white-space: normal; + padding: 5px 0px; + margin: 10px auto; + padding-left: 10px; + } + + + .header-toolbar-new{ + --background: #269DB8; + } + .addEitOkButton{ + white-space: normal !important; + text-transform: capitalize !important; + min-height: 45px !important; + min-width: 5px !important; + margin: 8px !important; + background-color: #269DB8; + width: 80% !important; + color: white!important; + border-radius: 16px !important; + } + + .country{ + margin-top: 10px; + padding: 10px; + } \ No newline at end of file diff --git a/Mohem/src/app/eit/add-cei/add-cei.component.spec.ts b/Mohem/src/app/eit/add-cei/add-cei.component.spec.ts new file mode 100644 index 00000000..fa819bbd --- /dev/null +++ b/Mohem/src/app/eit/add-cei/add-cei.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AddCeiComponent } from './add-cei.component'; + +describe('AddCeiComponent', () => { + let component: AddCeiComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AddCeiComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AddCeiComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/eit/add-cei/add-cei.component.ts b/Mohem/src/app/eit/add-cei/add-cei.component.ts new file mode 100644 index 00000000..8d9ef1f6 --- /dev/null +++ b/Mohem/src/app/eit/add-cei/add-cei.component.ts @@ -0,0 +1,1561 @@ +import { CommonService } from "src/app/hmg-common/services/common/common.service"; +import { Component, OnInit, ViewChild, ElementRef } from "@angular/core"; +import { MenuEntry } from "src/app/hmg-common/services/menu/models/menu.entry"; +import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response"; +import { CeiRequest } from "../models/cei.request"; +import { ModalController } from "@ionic/angular"; +import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service"; +import { EITTransactionsRequest } from "../models/EITTransactionsReq"; +import { EitService } from "../services/eit.service"; +import { TextAreaInput } from "src/app/uI-elements/text-area.input"; +import { NumberInput } from "src/app/uI-elements/number.input"; +import { TextInput } from "src/app/uI-elements/text.input"; +import { SelectInput } from "src/app/uI-elements/select.input"; +import { DateInput } from "src/app/uI-elements/date.input"; +import { TimeInput } from "src/app/uI-elements/time.input"; +import { DateTimeInput } from "src/app/uI-elements/date-time.input"; +import { ButtonInput } from "src/app/uI-elements/button.input"; +import { HiddenInput } from "src/app/uI-elements/hidden.input"; +import * as moment from "moment"; +import { DatePicker } from "@ionic-native/date-picker/ngx"; +import { EIT_ACTION } from "../models/submit.eit.action"; +import { AddCeiResponse } from "../models/add.cei.response"; +import { EITNotificatonBodyResponse } from "../models/EITNotificationBodyRes"; +@Component({ + selector: 'app-add-cei', + templateUrl: './add-cei.component.html', + styleUrls: ['./add-cei.component.scss'], +}) +export class AddCeiComponent implements OnInit { + @ViewChild("containerDiv") containerDiv: ElementRef; + + ////*new add*///// + getPassNotificationDetails: any; + getPassdirfromNotifiPage: boolean = false; + functionName: string = ""; + menuType: any; + ///////////////// + + private textArea: TextAreaInput; + private numberInput: NumberInput; + private textInput: TextInput; + private selectInput: SelectInput; + private dateInput: DateInput; + private timeInput: TimeInput; + private datetimeInput: DateTimeInput; + private buttonInput: ButtonInput; + private hiddenInput: HiddenInput; + private ceiResponse: any; + + private eitVALSettoCall: any = []; + private comtransNo: number = 0; + // private parentChilds: any[]; + getPassMnuEntryObj: MenuEntry; + selMenu: MenuResponse; + eitSubmitAction: number = 0; //not submit + private ceiRequest: CeiRequest; + private validateEitObj: any = []; + private ExtraObj: any = {}; + private arrValues: any = []; + selEmp: string; + respID: number; + headerTitle: string = ""; + isResubmit: boolean = false; + private updatedValues: any = []; + addEITData: any; + direction:string; + public showEffectiveDate: string = moment(new Date).format("DD-MM-YYYY"); + public selectedContactData: any; + + + constructor( + public modalController: ModalController, + public cs: CommonService, + private ts: TranslatorService, + private eitService: EitService, + public datePicker: DatePicker + ) { + this.direction = TranslatorService.getCurrentLanguageName(); + this.selectedContactData = this.cs.sharedService.getSharedData('selectedContactFORChildEducation', false); + this.selEmp = this.cs.sharedService.getSharedData( + MenuResponse.SHARED_SEL_EMP, + false + ); + this.respID = this.cs.sharedService.getSharedData( + MenuResponse.SHARED_SEL_RESP_ID, + false + ); + this.selMenu = new MenuResponse(); + this.selMenu = this.cs.sharedService.getSharedData( + MenuResponse.SHARED_DATA, + false + ); + this.addEITData = this.cs.sharedService.getSharedData("AddEITData", false); + console.log("addEITData: " + this.addEITData); + console.log("dirfromNotificationPage: " + this.addEITData.dirfromNotificationPage); + + this.ceiRequest = new CeiRequest(); + + + ////*new add*///// + /**********resubmit************ */ + this.getPassNotificationDetails = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.NOT_WORKLIST, false);//WARINING + this.getPassdirfromNotifiPage = this.addEITData.dirfromNotificationPage; + if (this.getPassdirfromNotifiPage) { + this.functionName = this.getPassNotificationDetails.FUNCTION_NAME; //;this.getPassNotificationDetails.NOTIFICATION_NAME; + this.menuType = "E"; + this.selEmp = this.getPassNotificationDetails.SELECTED_EMPLOYEE_NUMBER; + this.respID = -999; + this.validateEitObj = this.addEITData.submitEITObjList; + // this.eitSubmitAction=this.getPassNotificationDetails.EIT_ACTION; + let msg: string = ""; + msg = this.ts.trPK("eit", "update-title"); + this.headerTitle = msg; + } else { + this.getPassMnuEntryObj = this.selMenu.GetMenuEntriesList; + this.comtransNo = this.addEITData.transNo; + this.functionName = this.getPassMnuEntryObj.FUNCTION_NAME; + this.menuType = this.selMenu.List_Menu.MENU_TYPE; + this.validateEitObj = this.addEITData.submitEITObjList; + this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; + this.eitSubmitAction = this.cs.sharedService.getSharedData( + EITTransactionsRequest.SUBMIT_EIT_ACTION + ); + } + } + + ngOnInit() {} + + ngAfterViewInit() { + this.getCEIDffStructure(); + } + + private getCEIDffStructure() { + const body = { + P_FUNCTION_NAME: this.functionName, + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID + }; + this.eitService.getCEIDFFStrutre(body).subscribe((result: any) => { + this.handleCEIDffStructureResult(result); + }); + } + + handleCEIDffStructureResult(result) { + if (result.GetCEIDFFStructureList != null) { + this.ceiResponse = result.GetCEIDFFStructureList; + this.drawCEIFields(result.GetCEIDFFStructureList); + } + } + + private drawCEIFields(feildsList) { + const containerId = "containerDiv"; + this.eitVALSettoCall = []; + for (let i = 0; i < feildsList.length; i++) { + let defaultVal: string = ""; + let defaultValText: string = ""; + defaultVal = feildsList[i].E_SERVICES_DV.P_ID_COLUMN_NAME + ? feildsList[i].E_SERVICES_DV.P_ID_COLUMN_NAME + : ""; + defaultValText = feildsList[i].E_SERVICES_DV.P_VALUE_COLUMN_NAME + ? feildsList[i].E_SERVICES_DV.P_VALUE_COLUMN_NAME + : ""; + + if (feildsList[i].DISPLAY_FLAG != "N") { + //check if the field should be displayed + if (feildsList[i].VALIDATION_TYPE == "N") { + //text , date , time + if (feildsList[i].FORMAT_TYPE == "C") { + // character + // if(feildsList[i].DEFAULT_TYPE=="C"||feildsList[i].DEFAULT_TYPE==""){// default type constant + this.textInput = new TextInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + defaultValText, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + // }else if(feildsList[i].DEFAULT_TYPE=="P"||feildsList[i].DEFAULT_TYPE=="S"){// profile/ sql + // this.textInput = new TextInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,this.getDefaultValue(feildsList[i].DESC_FLEX_NAME,feildsList[i].DESC_FLEX_CONTEXT_CODE,feildsList[i].SEGMENT_NAME,feildsList[i].PARENT_SEGMENTS_VS_SplitedVS,feildsList[i].PARENT_SEGMENTS_DV_Splited),containerId,feildsList[i].MOBILE_ENABLED); + // } + } else if (feildsList[i].FORMAT_TYPE == "N") { + // number + // if(feildsList[i].DEFAULT_TYPE=="C"||feildsList[i].DEFAULT_TYPE==""){ + this.numberInput = new NumberInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + // }else if(feildsList[i].DEFAULT_TYPE=="P"||feildsList[i].DEFAULT_TYPE=="S"){ + // this.numberInput = new NumberInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,this.getDefaultValue(feildsList[i].DESC_FLEX_NAME,feildsList[i].DESC_FLEX_CONTEXT_CODE,feildsList[i].SEGMENT_NAME,feildsList[i].PARENT_SEGMENTS_VS_SplitedVS,feildsList[i].PARENT_SEGMENTS_DV_Splited),containerId,feildsList[i].MOBILE_ENABLED); + // } + } else if (feildsList[i].FORMAT_TYPE == "X") { + // standard date + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + //constant + this.dateInput = new DateInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + this.cs.reverseFormatDate(defaultVal), + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } else { + this.dateInput = new DateInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } + // else if(feildsList[i].DEFAULT_TYPE=="D"){//current date + // // this.dateInput = new DateInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,"currentDate",containerId,feildsList[i].MOBILE_ENABLED); + // this.dateInput = new DateInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,defaultVal,containerId,feildsList[i].MOBILE_ENABLED); + + // }else if(feildsList[i].DEFAULT_TYPE=="P"||feildsList[i].DEFAULT_TYPE=="S"){// sql and profile + // this.dateInput = new DateInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,this.getDefaultValue(feildsList[i].DESC_FLEX_NAME,feildsList[i].DESC_FLEX_CONTEXT_CODE,feildsList[i].SEGMENT_NAME,feildsList[i].PARENT_SEGMENTS_VS_SplitedVS,feildsList[i].PARENT_SEGMENTS_DV_Splited),containerId,feildsList[i].MOBILE_ENABLED); + // } + } else if (feildsList[i].FORMAT_TYPE == "Y") { + // standard date time + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + this.datetimeInput = new DateTimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + this.cs.reverseFormatStandardDate(defaultVal), + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } else { + this.datetimeInput = new DateTimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } + const elem = document.getElementById( + feildsList[i].APPLICATION_COLUMN_NAME + ); + // elem.addEventListener("click", e => { + // if (feildsList[i].MOBILE_ENABLED != "Y") return false; + // this.showDateTimePicker( + // feildsList[i].APPLICATION_COLUMN_NAME, + // feildsList[i].MAXIMUM_SIZE + // ); + // e.stopImmediatePropagation(); + // }); + // else if(feildsList[i].DEFAULT_TYPE=="D"){ + // this.datetimeInput = new DateTimeInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,"currentDateTime",containerId,feildsList[i].MOBILE_ENABLED); + // }else if(feildsList[i].DEFAULT_TYPE=="P"||feildsList[i].DEFAULT_TYPE=="S"){ + // this.datetimeInput = new DateTimeInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,this.getDefaultValue(feildsList[i].DESC_FLEX_NAME,feildsList[i].DESC_FLEX_CONTEXT_CODE,feildsList[i].SEGMENT_NAME,feildsList[i].PARENT_SEGMENTS_VS_SplitedVS,feildsList[i].PARENT_SEGMENTS_DV_Splited),containerId,feildsList[i].MOBILE_ENABLED); + // } + } else if (feildsList[i].FORMAT_TYPE == "I") { + //time + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + this.timeInput = new TimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } else { + this.timeInput = new TimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } + } + } else { + if (feildsList[i].READ_ONLY == "Y") { + this.textInput = new TextInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + defaultValText, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else { + // dropdown list missing open in differnt page + //check this validation since he doesnt check the other default_type + //if(feildsList[i].DEFAULT_TYPE=="P" || feildsList[i].DEFAULT_TYPE=="S"){ + this.selectInput = new SelectInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + // }else{ + // this.selectInput = new SelectInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,"",containerId,feildsList[i].MOBILE_ENABLED); + // } + // this.getValueSet(feildsList[i].SEGMENT_NAME); + this.fillDropdownList( + feildsList[i].SEGMENT_NAME, + feildsList[i].E_SERVICES_VS, + feildsList[i].E_SERVICES_DV + ); + // this.eitVALSettoCall.push(feildsList[i]); + } + } + //const elem = document.getElementById(feildsList[i].APPLICATION_COLUMN_NAME); + //elem.addEventListener("click", (e) => { + // this.getValueSet(feildsList[i].SEGMENT_NAME); + // e.stopImmediatePropagation(); + // }); + this.bindHtmlElemEvents( + feildsList[i].APPLICATION_COLUMN_NAME, + feildsList[i] + ); + } else { + // if(feildsList[i].VALIDATION_TYPE=="N"){ + this.hiddenInput = new HiddenInput( + defaultVal, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultValText, + containerId + ); + // }else{ + // this.selectInput = new SelectInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,defaultVal,containerId,feildsList[i].MOBILE_ENABLED,feildsList[i].DISPLAY_FLAG); + // this.fillDropdownList(feildsList[i].SEGMENT_NAME,feildsList[i].E_SERVICES_VS,feildsList[i].E_SERVICES_DV); + // } + this.bindHtmlElemEvents( + feildsList[i].APPLICATION_COLUMN_NAME, + feildsList[i] + ); + } + } + // this.callValueSet(); + // let msg:string=""; + // msg=this.translate.translate("confirmAddEit.start"); + // this.buttonInput = new ButtonInput("EIT_Btn_Submit", this.translate.translate('general.submit'), containerId, ""); + // const elem = document.getElementById("EIT_Btn_Submit"); + // elem.addEventListener("click", (e) => { + // this.validateEITTransaction(); + // }); + if (this.validateEitObj && this.validateEitObj.length > 0) { + this.fillEITStructure(); + } + } + + addFieldToDOM( + fieldObject: any, + fieldId: any, + clickListenerEvent: any, + hasClickListener: boolean + ) { + console.log("AddFieldToDOM"); + const elemDiv = document.createElement("div"); + elemDiv.className = ""; + elemDiv.innerHTML = fieldObject.getTemplate(); + console.log(this.containerDiv.nativeElement); + + this.containerDiv.nativeElement.appendChild(elemDiv); + // document.getElementById('containerDiv').appendChild(elemDiv); + + if (hasClickListener) { + let elem = document.getElementById(fieldId); + elem.addEventListener("click", e => { + clickListenerEvent(e); + e.stopImmediatePropagation(); + }); + } + } + + closeModal() { + console.log("closeModal"); + this.updatedValues = []; + this.modalController.dismiss(); + } + + public showDateTimePicker(elemID, maxSize) { + let elem = document.getElementById(elemID) as HTMLDivElement; + let date: any; + let value = elem.innerHTML; + if (value) date = moment(value, "YYYY/MM/DD HH:mm:ss").toDate(); + else date = new Date(); + this.datePicker + .show({ + date: date, + is24Hour: true, + mode: "datetime" + }) + .then( + date => { + let dateString: string = moment(date).format("YYYY/MM/DD HH:mm:ss"); + //remove seconds if the maximum size is 17 + if (maxSize == 17) { + elem.innerHTML = dateString.substring(0, 16); + elem.dataset.dtvalue = dateString.substring(0, 16); + } else { + elem.innerHTML = dateString; + elem.dataset.dtvalue = dateString; + } + //elem.innerHTML = dateString; + // elem.dataset.dtvalue = dateString; + }, + err => console.log("Error occurred while getting date: ", err) + ); + } + public showTimePicker(elemID, maxSize) { + let elem = document.getElementById(elemID) as HTMLDivElement; + let date: any; + let value = elem.innerHTML; + if (value) { + let nowDate = moment().format("YYYY/MM/DD") + " " + value; + date = moment(nowDate, "YYYY/MM/DD HH:mm:ss").toDate(); + } else { + date = new Date(); + } + this.datePicker + .show({ + date: date, + is24Hour: true, + mode: "time" + }) + .then( + date => { + let dateString: string = moment(date).format("HH:mm:ss"); + //remove seconds if the maximum size is 5 + if (maxSize == 5) { + elem.innerHTML = dateString.substring(0, 5); + elem.dataset.dtvalue = dateString.substring(0, 5); + } else { + elem.innerHTML = dateString; + elem.dataset.dtvalue = dateString; + } + }, + err => console.log("Error occurred while getting date: ", err) + ); + } + + fillDropdownList(segmentName, optionList: any = [], DV: any = "") { + let elemID: any = ""; + let eitObj: any; + if (optionList.length > 0) { + for (let i = 0; i < this.ceiResponse.length; i++) { + if (this.ceiResponse[i].SEGMENT_NAME == segmentName) { + eitObj = this.ceiResponse[i]; + if ( + this.ceiResponse[i].READ_ONLY == "Y" || + this.ceiResponse[i].DISPLAY_FLAG == "N" + ) { + return false; + } + elemID = this.ceiResponse[i].APPLICATION_COLUMN_NAME; + break; + } + } + let select = document.getElementById(elemID) as HTMLSelectElement; + document.getElementById(elemID).innerHTML = ""; + + // for(let i = select.options.length - 1 ; i >= 0 ; i--) + // { + // select.remove(i); + // } + if (eitObj.IsEmptyOption && eitObj.REQUIRED_FLAG == "N") { + var firstoption = document.createElement("option"); + firstoption.text = this.ts.trPK("general", "choose"); + firstoption.value = ""; + select.add(firstoption); + } + for (let i = 0; i < optionList.length; i++) { + var option = document.createElement("option"); + option.text = optionList[i].VALUE_COLUMN_NAME; + option.value = optionList[i].ID_COLUMN_NAME; + select.add(option); + } + if (select.dataset.hiddenval) { + select.value = select.dataset.hiddenval; + //select.dataset.hiddenval=""; + } else { + select.value = DV.P_ID_COLUMN_NAME; + } + select.disabled = false; + } + } + + bindHtmlElemEvents(id, obj) { + const elem = document.getElementById(id); + console.log(elem); + console.log(obj); + const elemType = elem.tagName; + let changeEvent = "ionChange"; + + if (elemType == "SELECT") changeEvent = "change"; + + try { + // elem.addEventListener("change", (e) => { + elem.addEventListener(changeEvent, e => { + //console.log("elem change "+elem.id); + //let x=e.currentTarget as HTMLInputElement; + //let isEmpty:boolean=false; + // if(!x.value) + // isEmpty=true; + //emptyChildElement + elem.classList.remove("requiredClassElm"); + if ( + obj.CHILD_SEGMENTS_VS_Splited && + obj.CHILD_SEGMENTS_VS_Splited.length > 0 + ) { + let listArray: any = obj.CHILD_SEGMENTS_VS_Splited; + listArray.forEach(element => { + //if(isEmpty) + this.emptyChildElement(element); + // else + this.getValueSet(element); + }); + } + if ( + obj.CHILD_SEGMENTS_DV_Splited && + obj.CHILD_SEGMENTS_DV_Splited.length > 0 + ) { + let listArray: any = obj.CHILD_SEGMENTS_DV_Splited; + listArray.forEach(element => { + // if(isEmpty){ + this.emptyChildElement(element); + // }else{ + for (let i = 0; i < this.ceiResponse.length; i++) { + if (this.ceiResponse[i].SEGMENT_NAME == element) { + this.getDefaultValue( + this.ceiResponse[i], + this.ceiResponse[i].DESC_FLEX_NAME, + this.ceiResponse[i].DESC_FLEX_CONTEXT_CODE, + this.ceiResponse[i].SEGMENT_NAME, + this.ceiResponse[i].PARENT_SEGMENTS_VS_SplitedVS, + this.ceiResponse[i].PARENT_SEGMENTS_DV_Splited + ); + } + } + // } + }); + } + return false; + // e.stopImmediatePropagation(); + }); + } catch (e) { + console.log(e.status); + } + } + + public getDefaultValue( + obj, + descFlexName, + descFlexContextCode, + segmentName, + parentValue, + ParentsList + ) { + let dependenciesList: any = []; + let parentVal: any = null; + let isStandardDate: boolean = false; + let isStandardTimeDate: boolean = false; + let isStandardTime: boolean = false; + let isHidden: boolean = false; + let isReadOnlyList: boolean = false; + let isSelectElement: boolean = false; + isStandardDate = this.isStandardDate(obj); + isStandardTimeDate = this.isStandardDateTime(obj); + isStandardTime = this.isStandardTime(obj); + if (obj.DISPLAY_FLAG == "N") isHidden = true; + if (obj.VALIDATION_TYPE != "N" && obj.READ_ONLY == "Y") { + isReadOnlyList = true; + } + if (obj.VALIDATION_TYPE != "N" && obj.READ_ONLY == "N") { + isSelectElement = true; + } + //if(parentValue!=""){ parentVal= this.getDependenciesParams(parentValue)[0].ID_COLUMN_NAME;} + //if(ParentsList!=""){dependenciesList =this.getDependenciesParams(ParentsList); } + + if ( + parentValue != "" && + (obj.VALIDATION_TYPE == "D" || obj.VALIDATION_TYPE == "Y") + ) { + let parvalue = this.getDependenciesParams(parentValue); + if (parvalue && parvalue[0]) parentVal = parvalue[0].ID_COLUMN_NAME; + else { + parentVal = null; + } + if (!parentVal) { + return false; + } + } + if (ParentsList != "") { + if (parentValue) ParentsList.concat(parentValue); + dependenciesList = this.getDependenciesParams(ParentsList); + if (!dependenciesList) { + return false; + } + } + + //if (dependenciesList==false){return false}; + const body = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, //-999, + P_DESC_FLEX_NAME: descFlexName, + P_DESC_FLEX_CONTEXT_CODE: descFlexContextCode, + P_SEGMENT_NAME: segmentName, + P_PARENT_VALUE: parentVal, + GetValueSetValuesTBL: dependenciesList + }; + + this.eitService.getDefaultValue(body).subscribe((result: any) => { + let elem = this.getElementByName(segmentName); + // console.log(elem); + // if(elem.dataset.hiddenval){ + // elem.dataset.hiddenval=""; + // return false; + // } + let obj = this.handleDefaultValueResult(result); + let val = obj.value; + let text = obj.text; + if (val==null){val="";} + if (text==null){text="";} + if (isStandardDate) { + console.log("isStandardDate"); + elem.value = this.cs.reverseFormatDate(val); + } else if (isStandardTimeDate) { + console.log("isStandardTimeDate"); + if (val) { + elem.dataset.dtvalue = this.cs.reverseFormatStandardDate(val); + elem.innerHTML = this.cs.reverseFormatStandardDate(val); + } else { + elem.dataset.dtvalue = ""; + elem.innerHTML = ""; + } + } else if (isStandardTime) { + console.log("isStandardTime"); + if (val) { + elem.dataset.dtvalue = val; + elem.innerHTML = val; + elem.value=val; + } else { + elem.dataset.dtvalue = ""; + elem.innerHTML = ""; + } + } else { + if (isSelectElement) { + let elem = this.getSelectElementByName(segmentName); + elem = document.getElementById(elem), + //alert(elem.length); + // var firstoption = document.createElement("option"); + // firstoption.text = text; + // firstoption.value = val; + // elem.add(firstoption); + elem.value = val; + //elem.text=text; + + }else{ + // console.log("else - " + elem.value); + elem.value = val; + elem.innerText = text; + elem.setAttribute("value", val); + // console.log("else - " + elem.value); + } + } + if (isHidden || isReadOnlyList) { + if (val) elem.dataset.colmText = val; + else elem.dataset.colmText = ""; + elem.value = text; + } + var event = new Event("ionChange"); + elem.dispatchEvent(event); + }); + } + + handleDefaultValueResult(result) { + let data = { + text: result.GetDefaultValueList.P_VALUE_COLUMN_NAME, + value: result.GetDefaultValueList.P_ID_COLUMN_NAME + }; + return data; + } + + callValueSet() { + for (var i = 0; i < this.eitVALSettoCall.length; i++) { + this.getValueSet(this.eitVALSettoCall[i].SEGMENT_NAME); + } + } + + getParentValue(parentValue) { + if (parentValue.length == 0) { + for (let i = 0; i < this.ceiResponse.length; i++) { + if (this.ceiResponse[i].SEGMENT_NAME == parentValue[0].Name) { + if (this.ceiResponse[i].VALIDATION_TYPE == "N") { + let val = (document.getElementById( + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + return val; + } else { + let x = document.getElementById( + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + if (x.options.length > 0) { + let val = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].value + : null; + return val; + } else { + return ""; + } + } + } + } + } else { + return ""; + } + } + + public getValueSet(segmentName) { + let descFlexName: any = ""; + let descFlexContextCode: any = ""; + let parentValue: any = []; + let ParentsList: any = []; + let parentVal: any = null; + let dependenciesList: any = []; + let validationType: string = ""; + + for (let i = 0; i < this.ceiResponse.length; i++) { + if (this.ceiResponse[i].SEGMENT_NAME == segmentName) { + descFlexName = this.ceiResponse[i].DESC_FLEX_NAME; + descFlexContextCode = this.ceiResponse[i].DESC_FLEX_CONTEXT_CODE; + parentValue = this.ceiResponse[i].PARENT_SEGMENTS_VS_SplitedVS; + ParentsList = this.ceiResponse[i].PARENT_SEGMENTS_VS_SplitedVS; + validationType = this.ceiResponse[i].VALIDATION_TYPE; + break; + } + } + if (parentValue != "" && (validationType == "D" || validationType == "Y")) { + let parvalue = this.getDependenciesParams(parentValue); + if (parvalue && parvalue[0]) parentVal = parvalue[0].ID_COLUMN_NAME; + else { + parentVal = null; + } + if (!parentVal) { + return false; + } + } + if (ParentsList != "") { + dependenciesList = this.getDependenciesParams(ParentsList); + if (!dependenciesList) { + return false; + } + } + const body = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, //-999, + P_DESC_FLEX_NAME: descFlexName, + P_DESC_FLEX_CONTEXT_CODE: descFlexContextCode, + P_SEGMENT_NAME: segmentName, + P_PARENT_VALUE: parentVal, + GetValueSetValuesTBL: dependenciesList, + P_PAGE_NUM: 1, + P_PAGE_LIMIT: 1000 + }; + + this.eitService.getSetValue(body).subscribe((result: any) => { + if (result.GetValueSetValuesList != null) { + this.fillDropdownList(segmentName, result.GetValueSetValuesList); + } + }); + let arr: any = []; + return arr; + } + + getDependenciesParams(parentsList) { + let parentArr: any = []; + for (let i = 0; i < parentsList.length; i++) { + for (let j = 0; j < this.ceiResponse.length; j++) { + if (this.ceiResponse[j].SEGMENT_NAME == parentsList[i].Name) { + if (this.ceiResponse[j].DISPLAY_FLAG != "N") { + if (this.ceiResponse[j].VALIDATION_TYPE == "N") { + let idColName: string; + let val: any; + if ( + this.ceiResponse[j].FORMAT_TYPE == "Y" || + this.ceiResponse[j].FORMAT_TYPE == "I" + ) { + //standard date time or //time + let elem = document.getElementById( + this.ceiResponse[j].APPLICATION_COLUMN_NAME + ) as HTMLDivElement; + val = elem.dataset.dtvalue; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } + idColName = val; + if (this.ceiResponse[j].FORMAT_TYPE == "Y") + idColName = this.cs.formatStandardDate(val); + } else { + val = (document.getElementById( + this.ceiResponse[j].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } + idColName = val; + if (this.ceiResponse[j].FORMAT_TYPE == "X") { + //date + // idColName = this.cs.formatDate(val); + idColName = this.cs.formatDateNew(val); + } + } + parentArr.push({ + SEGMENT_NAME: this.ceiResponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: val, + DESCRIPTION: "", + ID_COLUMN_NAME: idColName, + FLEX_VALUE_SET_NAME: this.ceiResponse[j].FLEX_VALUE_SET_NAME + }); + break; + } else { + if (this.ceiResponse[j].READ_ONLY != "Y") { + let x = document.getElementById( + this.ceiResponse[j].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + let text = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].text + : ""; + let val = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].value + : undefined; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { + } + if (text == undefined) { + text = ""; + } + parentArr.push({ + SEGMENT_NAME: this.ceiResponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.ceiResponse[j].FLEX_VALUE_SET_NAME + }); + break; + } else { + let x = document.getElementById( + this.ceiResponse[j].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let text = x.value; + let val = x.dataset.colmText; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { + } + if (text == undefined) { + text = ""; + } + parentArr.push({ + SEGMENT_NAME: this.ceiResponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.ceiResponse[j].FLEX_VALUE_SET_NAME + }); + break; + } + } + } else { + let x = document.getElementById( + this.ceiResponse[j].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let text = x.value; + let val = x.dataset.colmText; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { + } + if (text == undefined) { + text = ""; + } + parentArr.push({ + SEGMENT_NAME: this.ceiResponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.ceiResponse[j].FLEX_VALUE_SET_NAME + }); + break; + } + } + } + } + return parentArr; + } + + emptyChildElement(segmentName) { + let elem = this.getElementByName(segmentName); + elem.value = null; + elem.innerHTML = ""; + if ("dtvalue" in elem.dataset) { + elem.dataset.dtvalue = ""; + } + if ("colmText" in elem.dataset) { + elem.dataset.colmText = ""; + } + var event = new Event("change"); + elem.dispatchEvent(event); + elem.classList.remove("requiredClassElm"); + } + + getRequiredFilds() { + for (let i = 0; i < this.ceiResponse.length; i++) { + if (this.ceiResponse[i].REQUIRED_FLAG == "Y") { + let elemVal = (document.getElementById( + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + if (elemVal == "") { + //alert(this.ceiResponse[i].SEGMENT_NAME+" is required"); + break; + } + } + } + } + + getElementByName(segmentName) { + let elemID: any = ""; + for (let i = 0; i < this.ceiResponse.length; i++) { + if (this.ceiResponse[i].SEGMENT_NAME == segmentName) { + elemID = this.ceiResponse[i].APPLICATION_COLUMN_NAME; + break; + } + } + return document.getElementById(elemID) as HTMLInputElement; + } + + getSelectElementByName(segmentName) { + let elemID: any = ""; + for (let i = 0; i < this.ceiResponse.length; i++) { + if (this.ceiResponse[i].SEGMENT_NAME == segmentName) { + elemID = this.ceiResponse[i].APPLICATION_COLUMN_NAME; + break; + } + } + return elemID; + } + + isStandardDate(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "X") { + // standard date + if ( + obj.DEFAULT_TYPE == "C" || + obj.DEFAULT_TYPE == "D" || + obj.DEFAULT_TYPE == "P" || + obj.DEFAULT_TYPE == "S" + ) { + //constant + isSt = true; + } + } + return isSt; + } + isStandardDateTime(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "Y") { + // standard date time + if ( + obj.DEFAULT_TYPE == "C" || + obj.DEFAULT_TYPE == "D" || + obj.DEFAULT_TYPE == "P" || + obj.DEFAULT_TYPE == "S" + ) { + //constant + isSt = true; + } + } + return isSt; + } + isStandardTime(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "I") { + // standard date time + if ( + obj.DEFAULT_TYPE == "C" || + obj.DEFAULT_TYPE == "D" || + obj.DEFAULT_TYPE == "P" || + obj.DEFAULT_TYPE == "S" + ) { + //constant + isSt = true; + } + } + return isSt; + } + + isStandardDateVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "X") { + // standard date + // if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant + isSt = true; + // } + } + return isSt; + } + isStandardDateTimeVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "Y") { + // standard date time + //if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant + isSt = true; + //} + } + return isSt; + } + isStandardTimeVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "I") { + // standard time + //if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant + isSt = true; + //} + } + return isSt; + } + + fillEITStructure() { + var obj = { peiObjVer: null, peiExtraInfoID: null }; + for (let i = 0; i < this.validateEitObj.length; i++) { + let val: any; + if (this.validateEitObj[i].VARCHAR2_VALUE) + val = this.validateEitObj[i].VARCHAR2_VALUE; + else if (this.validateEitObj[i].DATE_VALUE) + val = this.validateEitObj[i].DATE_VALUE; + else if (this.validateEitObj[i].NUMBER_VALUE) + val = this.validateEitObj[i].NUMBER_VALUE; + const elem = document.getElementById( + this.validateEitObj[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + //obj.transactionNo=this.validateEitObj[i].TRANSACTION_NUMBER; + if (elem) { + if (val) { + let feldDetails = this.ceiResponse.find( + x => + x.APPLICATION_COLUMN_NAME == + this.validateEitObj[i].APPLICATION_COLUMN_NAME + ); + if (feldDetails) { + let isStandardDate = this.isStandardDateVal(feldDetails); + let isStandardDateTime = this.isStandardDateTimeVal(feldDetails); + let isStandardTime = this.isStandardTimeVal(feldDetails); + if (isStandardDate) { + elem.value = this.cs.reverseFormatDate(val); + } else if (isStandardDateTime) { + elem.innerHTML = this.cs.reverseFormatStandardDate(val); + elem.dataset.dtvalue = this.cs.reverseFormatStandardDate(val); + } else if (isStandardTime) { + elem.innerHTML = val; + elem.dataset.dtvalue = val; + } else { + elem.value = val; + elem.setAttribute("value", elem.value); + } + if ( + feldDetails.DISPLAY_FLAG == "N" || + (feldDetails.VALIDATION_TYPE != "N" && + feldDetails.READ_ONLY == "Y") + ) { + elem.dataset.colmText = val; + elem.value = this.validateEitObj[i].SEGMENT_VALUE_DSP; + elem.setAttribute("value", elem.value); + } + } + elem.dataset.hiddenval = val; //hide the value to set it after calling get value set + if ( + feldDetails.CHILD_SEGMENTS_VS_Splited && + feldDetails.CHILD_SEGMENTS_VS_Splited.length > 0 + ) { + let listArray: any = feldDetails.CHILD_SEGMENTS_VS_Splited; + listArray.forEach(element => { + this.getValueSet(element); + }); + } + // var event = new Event('change'); + // elem.dispatchEvent(event); + } + } else { + if ( + this.validateEitObj[i].APPLICATION_COLUMN_NAME == + "CEI_OBJECT_VERSION_NUMBER" + ) + obj.peiObjVer = this.validateEitObj[i].NUMBER_VALUE; + else if ( + this.validateEitObj[i].APPLICATION_COLUMN_NAME == "CONTACT_EXTRA_INFO_ID" + ) + obj.peiExtraInfoID = this.validateEitObj[i].NUMBER_VALUE; + } + } + this.ExtraObj = obj; + } + + public getElementsValues(): any { + this.updatedValues = []; //fill updated list + let valuseArr: any = []; + let varcharValue: any = null; + let numbervalue: any = 0; + let dateValue: any = null; + let transNo: number = this.comtransNo; + let textValue : any; + // if(this.ExtraObj.transactionNo) + // transNo=this.ExtraObj.transactionNo; + for (let i = 0; i < this.ceiResponse.length; i++) { + varcharValue = null; + numbervalue = null; + dateValue = null; + /*********set transaction No of the updated object ********/ + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + } + if (this.ceiResponse[i].DISPLAY_FLAG != "N") { + if (this.ceiResponse[i].VALIDATION_TYPE == "N") { + let elem = document.getElementById( + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let elemVal = (document.getElementById( + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + textValue = elemVal; + //let elemVal= (document.getElementById(this.ceiResponse[i].APPLICATION_COLUMN_NAME)).value; + if ( + this.ceiResponse[i].FORMAT_TYPE == "X" && + this.ceiResponse[i].DISPLAY_FLAG != "N" + ) { + //date + elemVal = this.cs.formatDate(elemVal); + } else if ( + this.ceiResponse[i].FORMAT_TYPE == "Y" && + this.ceiResponse[i].DISPLAY_FLAG != "N" + ) { + //standard date time + // elemVal = elem.dataset.dtvalue; + // elemVal = this.cs.formatStandardDate(elemVal); + elemVal = this.cs.formatDate(elemVal); + } else if ( + this.ceiResponse[i].FORMAT_TYPE == "I" && + this.ceiResponse[i].DISPLAY_FLAG != "N" + ) { + //time + if(elemVal.length>5){ + elemVal = elemVal.substring(11, 16); + }else{ + elemVal = elemVal; + } + } + if (this.ceiResponse[i].REQUIRED_FLAG == "Y" && !elemVal) { + elem.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + elem.classList.remove("requiredClassElm"); + } + // if (elemVal != 'null'){ + varcharValue = elemVal; + //} else{ + // elemVal = null; + // } + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.ceiResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } else { + let x = document.getElementById( + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + if (this.ceiResponse[i].READ_ONLY == "Y") { + let text = x.value; + let val = x.dataset.colmText; + varcharValue = val; + textValue = text; + } else { + let val = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].value + : null; + let txt = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].text + : null; + varcharValue = val; + textValue = txt; + } + if (this.ceiResponse[i].REQUIRED_FLAG == "Y" && !varcharValue) { + x.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.ceiResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } //end else + } else { + let x = document.getElementById( + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + let val = x.dataset.colmText; + textValue = x.value; + if (this.ceiResponse[i].REQUIRED_FLAG == "Y" && !val) { + x.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + if (val) varcharValue = val; + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.ceiResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } + + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + if (this.validateEitObj && this.eitSubmitAction == EIT_ACTION.UPDATE) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + let y = { + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue, + SEGMENT_VALUE_DSP: textValue, + APPLICATION_COLUMN_NAME: this.ceiResponse[i] + .APPLICATION_COLUMN_NAME, + DATATYPE: this.ceiResponse[i].DATATYPE, + DESC_FLEX_CONTEXT_CODE: this.ceiResponse[i].DESC_FLEX_CONTEXT_CODE, + DESC_FLEX_NAME: this.ceiResponse[i].DESC_FLEX_NAME, + DISPLAY_FLAG: this.ceiResponse[i].DISPLAY_FLAG, + SEGMENT_NAME: this.ceiResponse[i].SEGMENT_NAME, + SEGMENT_PROMPT: this.ceiResponse[i].SEGMENT_PROMPT + }; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } + } + } // end for + + if (this.getPassdirfromNotifiPage) { + let updatedObj1 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_ACTION" + ); + let updatedObj2 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "CONTACT_EXTRA_INFO_ID" + ); + let updatedObj3 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "CEI_OBJECT_VERSION_NUMBER" + ); + this.updatedValues.push(updatedObj1); + this.updatedValues.push(updatedObj2); + this.updatedValues.push(updatedObj3); + valuseArr = this.fillExtraInformation( + valuseArr, + updatedObj1.VARCHAR2_VALUE, + updatedObj2.NUMBER_VALUE, + updatedObj3.NUMBER_VALUE, + transNo + ); + } else { + if (this.eitSubmitAction == EIT_ACTION.ADD) { + this.updatedValues = this.fillExtraValuesUpdated( + this.updatedValues, + "NEW_ROW", + -1, + 0, + transNo + ); + valuseArr = this.fillExtraInformation( + valuseArr, + "NEW_ROW", + -1, + 0, + transNo + ); + } else if (this.eitSubmitAction == EIT_ACTION.UPDATE) { + valuseArr = this.fillExtraInformation( + valuseArr, + "UPDATE_ROW", + this.ExtraObj.peiExtraInfoID, + this.ExtraObj.peiObjVer, + transNo + ); + } else if (this.eitSubmitAction == EIT_ACTION.DELETE) { + valuseArr = this.fillExtraInformation( + valuseArr, + "DELETE_ROW", + this.ExtraObj.peiExtraInfoID, + this.ExtraObj.peiObjVer, + transNo + ); + } + } + return valuseArr; + } // end getElementsValues + + fillExtraValuesUpdated( + values: any, + peiAction: string, + peiExtraInfoID: number, + peiObjVer: number, + transNo: number + ): any { + let obj1 = { + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: peiAction, + NUMBER_VALUE: null, + DATE_VALUE: null, + SEGMENT_VALUE_DSP: "", + APPLICATION_COLUMN_NAME: "PEI_ACTION", + DATATYPE: "VARCHAR2", + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + SEGMENT_NAME: "", + SEGMENT_PROMPT: "" + }; + let obj2 = { + TRANSACTION_NUMBER: 1, + APPLICATION_COLUMN_NAME: "CEI_OBJECT_VERSION_NUMBER", + VARCHAR2_VALUE: null, + NUMBER_VALUE: peiObjVer, + DATATYPE: "NUMBER", + SEGMENT_VALUE_DSP: "", + DATE_VALUE: null, + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + SEGMENT_NAME: "", + SEGMENT_PROMPT: "" + }; + let obj3 = { + APPLICATION_COLUMN_NAME: "CONTACT_EXTRA_INFO_ID", + DATATYPE: "NUMBER", + DATE_VALUE: null, + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + NUMBER_VALUE: peiExtraInfoID, + SEGMENT_NAME: "", + SEGMENT_PROMPT: "", + SEGMENT_VALUE_DSP: "", + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: null + }; + values.push(obj1); + values.push(obj2); + values.push(obj3); + return values; + } + fillExtraInformation( + values: any, + peiAction: string, + peiExtraInfoID: number, + peiObjVer: number, + transNo: number + ): any { + values.push({ + TRANSACTION_NUMBER: transNo, + NAME: "PEI_ACTION", + VARCHAR2_VALUE: 'NEW_ROW', + NUMBER_VALUE: null, + DATE_VALUE: null + }); + values.push({ + TRANSACTION_NUMBER: transNo, + NAME: "CONTACT_EXTRA_INFO_ID", + VARCHAR2_VALUE: null, + NUMBER_VALUE: 0, + DATE_VALUE: null + }); + values.push({ + TRANSACTION_NUMBER: transNo, + NAME: "CEI_OBJECT_VERSION_NUMBER", + VARCHAR2_VALUE: null, + NUMBER_VALUE: 0, + DATE_VALUE: null + }); + return values; + } + + submitEit() { + let list = this.ceiRequest.EITTransactionTBL; + this.ceiRequest.EITTransactionTBL = this.fixTransactionNo(list); + this.eitService + .submitChildEducation(this.ceiRequest) + .subscribe((result: AddCeiResponse) => { + this.handleSubmitEitResult(result); + }); + } + + fixTransactionNo(transactionTBL: any): any[] { + let list: any = []; + let newIndex: number = 1; + let length: number = transactionTBL.length; + if (length > 0) { + for (let i = 0; i < length; i++) { + // let item :any={}; + const item = Object.assign({}, transactionTBL[i]); + let transNo: number = item.TRANSACTION_NUMBER; + let obj: any = item; + if (i == 0) { + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } else { + let prevEl: any = transactionTBL[i - 1].TRANSACTION_NUMBER; + if (transNo == prevEl) { + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } else { + newIndex++; + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } + } + } + } + return list; + } + + + public handleSubmitEitResult(result) { + if (this.cs.validResponse(result)) { + this.cs.sharedService.setSharedData(this.ceiRequest, CeiRequest.SHARED_DATA); + this.cs.sharedService.setSharedData(result, AddCeiResponse.SHARED_DATA); + this.cs.openConfirmCEIPage(); + } + } + + public submitChildEducationTransaction() { + this.arrValues = this.getElementsValues(); + if (this.arrValues) { + this.ceiRequest = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, + P_FUNCTION_NAME: this.functionName, + P_CONTACT_RELATIONSHIP_ID: this.selectedContactData.CONTACT_RELATIONSHIP_ID, + P_DESC_FLEX_CONTEXT_CODE: this.ceiResponse[0].DESC_FLEX_CONTEXT_CODE, + EITTransactionTBL: this.arrValues + }; + + this.eitService.submitChildEducation(this.ceiRequest).subscribe((result: any) => { + this.handleSubmitEitResult(result); + }); + } + } +} + diff --git a/Mohem/src/app/eit/cei-homepage/cei-homepage.component.html b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.html new file mode 100644 index 00000000..55aeadb4 --- /dev/null +++ b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.html @@ -0,0 +1,69 @@ + + + + + + +
+ + + + + +

{{user.CONTACT_NAME}}

+
+ +
+ +

{{ts.trPK('eit','relationship-start-date')}}

+
+ +

12/31/2022

+
+
+
+
+ + + +

{{user.RELATIONSHIP}}

+
+
+ +
+ +

{{ts.trPK('eit','relationship-end-date')}}

+
+ +

12/31/2022

+
+
+
+
+
+ +
+
+
+ +
+ + + +
+ {{'vacation-rule, next-label' | translate}} +
+
+ + \ No newline at end of file diff --git a/Mohem/src/app/eit/cei-homepage/cei-homepage.component.scss b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.scss new file mode 100644 index 00000000..9bcdab44 --- /dev/null +++ b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.scss @@ -0,0 +1,40 @@ +@media screen and (min-width: 300px){ + .CreateBtn{ +--background: var(--newgreen) !important; +background: var(--newgreen) !important; +white-space: normal; +color: var(--light); +text-transform: capitalize; +min-height: 1.0cm; +--border-radius: 7px !important; +border-radius: 7px !important; +--min-height: 1.6cm !important; +width: 315px; +font-family: var(--fontFamilyPoppins-SemiBold, inherit); +}} + +@media screen and (min-width: 1px) and (max-width:290px) { +.CreateBtn{ +--background: var(--newgreen) !important; +background: var(--newgreen) !important; +white-space: normal; +color: var(--light); +text-transform: capitalize; +min-height: 1.0cm; +--border-radius: 7px !important; +border-radius: 7px !important; +--min-height: 1.6cm !important; +width: 257px; +font-family: var(--fontFamilyPoppins-SemiBold, inherit); +}} + +.footer{ +padding: 15px 0px; +background-color: var(--light) !important; +border: 0px !important; +box-shadow: none !important; +-webkit-box-shadow: none; +} +.Btn{ +margin: auto; text-align: center; display: block; +} \ No newline at end of file diff --git a/Mohem/src/app/eit/cei-homepage/cei-homepage.component.spec.ts b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.spec.ts new file mode 100644 index 00000000..3ebdf92c --- /dev/null +++ b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CeiHomepageComponent } from './cei-homepage.component'; + +describe('CeiHomepageComponent', () => { + let component: CeiHomepageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CeiHomepageComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CeiHomepageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/eit/cei-homepage/cei-homepage.component.ts b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.ts new file mode 100644 index 00000000..4db964a0 --- /dev/null +++ b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.ts @@ -0,0 +1,51 @@ +import { Component, OnInit } from '@angular/core'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { EitService } from '../services/eit.service'; + +@Component({ + selector: 'app-cei-homepage', + templateUrl: './cei-homepage.component.html', + styleUrls: ['./cei-homepage.component.scss'], +}) +export class CeiHomepageComponent implements OnInit { + + public familyMemberData; + public selectedServiceType; + public direction: string; + myColor: string = 'secondary'; + constructor( + private eitService: EitService, + public ts: TranslatorService, + public cs: CommonService + ) {} + + + ngOnInit() { + this.getContactInfo(); + } + + public getContactInfo () { + this.eitService.getContactInfo({ + P_MENU_TYPE: 'E', + P_SELECTED_RESP_ID: -999 + }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { + if (this.cs.validResponse(response)) { + this.familyMemberData = response['GetEmployeeContactsList']; + this.selectedServiceType = this.familyMemberData[0]; + console.log(this.familyMemberData); + } + }); + } + + public gotoTransactionsPage() { + console.log(this.selectedServiceType); + this.cs.sharedService.setSharedData(this.selectedServiceType, 'selectedContactFORChildEducation'); + this.cs.openCEIListPage(); + } + + public selectedUser(user){ + this.selectedServiceType = user; + } + +} diff --git a/Mohem/src/app/eit/cei-list/cei-list.component.html b/Mohem/src/app/eit/cei-list/cei-list.component.html new file mode 100644 index 00000000..31f62243 --- /dev/null +++ b/Mohem/src/app/eit/cei-list/cei-list.component.html @@ -0,0 +1,42 @@ + + + + +
+
+ + + +

{{'general, noData' | translate}}

+
+ +
+
+ +
+
+ +
+ + + +
+ +
+
+
+
+
+
+
+
+
+ +
+
+
+
+ diff --git a/Mohem/src/app/eit/cei-list/cei-list.component.scss b/Mohem/src/app/eit/cei-list/cei-list.component.scss new file mode 100644 index 00000000..28b2905f --- /dev/null +++ b/Mohem/src/app/eit/cei-list/cei-list.component.scss @@ -0,0 +1,330 @@ +.footer-button { + border-radius: 2px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; + } + + .datetime{ + text-align: center; + font-family: WorkSans-Bold; + margin-left: 47px; + margin-top: -19px; + + } + .iconCalendar{ + margin-left: 30px !important; + width: 22% !important; + height: 26px !important; + margin-top: -69px !important; + margin-bottom: 20px !important; + } + h4 { + font-size: 2.2rem; + text-align: center; + color: #000000; + } + .grids{ + border-radius: 20px !important; + background: white; + padding-left: 1px; + padding-right: 1px; + margin: 13px; + padding-top: 0px; + padding-bottom: 3px; + padding-left: 13px; + padding-right: 13px; + border: 1px solid #cac8c8; + } + + .bgcolor { + + color: white; + border-top-right-radius: 19px; + border-top-left-radius: 15px; + padding-top: 1; + padding-bottom: 0; + margin-top: 0; + margin-bottom: 0; + /* border-radius: 12px !important; */ + background: #269DB8; + border-bottom: 1px solid #a7a4a4; + border-top: 1px solid #cac8c8; + margin-left: -13px; + margin-right: -13px; + } + .colEit{ + border-right: 1px solid #cac8c8; + border-bottom-left-radius: -10px !important; + padding-top: 8px; + padding-bottom: 8px; + margin-left: 18px; + font-size: 12px !important; + } + + .header-div { + + background-color: #269DB8; + text-transform: capitalize; + height: 160px; + // position: relative; + display: block; + margin-bottom: -28px; + } + + .header-toolbar-new{ + --background: #269DB8; + } + + .addClass{ + background-color: #269DB8; + width: 80px; + height: 80px; + right: 8%; + position: fixed; + color: white; + bottom: 5%; + border-radius: 50%; + z-index: 999; + -webkit-box-shadow: 2px -1px 13px 0px rgba(0,0,0,0.59); + -moz-box-shadow: 2px -1px 13px 0px rgba(0,0,0,0.59); + box-shadow: 2px -1px 13px 0px rgba(0,0,0,0.59); + } + + .contentEit:before { + position: absolute; + content: ""; + // background: #269DB8; + height: 140px; + width: 100%; + left: 0; + top: 0px; + z-index: 1; + } + + .hrClass{ + border-width: 0; + box-sizing: content-box; + border-bottom: 1px solid #e6e6e6; + background: #fff !important; + height: 1px; + } + + //////////////////////////////// + .content:before { + position: absolute; + content: ""; + background: #269DB8; + height: 140px; + width: 100%; + left: 0; + top: 0px; + z-index: 1; + } + + + .colorBG{ + --background: #f0efef; + } + + .Title{ + text-align: center; + color: white; + margin-top: -33px; + font-size: 17px; + } + .title{ + text-align: center; + color: black; + margin-top: 5px; + font-size: 17px; + } + .today-graph{ + display: block !important; + height: 196px; + width: 365px; + /* padding-left: 51px; */ + margin-left: 28px !important; + } + + .headerGrid{ + background-color: white !important; + border: 1px solid #cac8c8 !important; + padding-bottom: 53px; + padding-top: -30px; + margin-left: 13px; + margin-right: 13px; + margin-bottom: 10px; + position: relative; + z-index: 1; + border-radius: 20px; + margin-top: 17px; + } + .result-graph{ + font-size: 14px; + margin-left: -48px; + margin-right: 3px; + margin-bottom: -30px; + + + + } + + .green-label{ + font-size: 15px !important; + margin-left: 7px !important; + margin-right: 42px; + } + .green-label-ar{ + font-size: 15px !important; + margin-left: 7px !important; + margin-right: 15px; + } + .blue-label{ + font-size: 15px !important; + margin-left: 7px !important; + margin-right: 13px; + } + .light-label{ + font-size: 15px !important; + margin-left: 7px !important; + margin-right: -26px; + } + .light-label-ar{ + font-size: 15px !important; + margin-right: 7px !important; + margin-left: -26px; + } + + .light-dote{ + background-color: #3CB9D5; + width: 12px; + height: 12px; + border-radius: 50% !important; + display: inline-block; + } + .blue-dote{ + + background-color: #269DB8; + width: 12px; + height: 12px; + border-radius: 50% !important; + display: inline-block; + } + .green-dote{ + background-color: #1FA269; + width: 12px; + height: 12px; + border-radius: 50% !important; + display: inline-block; + margin-right: -1px; + } + .col{ + text-align: right; + } + + .gridService{ + + /* margin-top: 87px; */ + border-radius: 10px; + /* margin-bottom: -49px; */ + margin-left: 14px; + margin-right: 14px; + + } + .columns{ + margin: 3px; + margin-bottom: 13px; + background: white; + border-radius: 27px; + padding-left: 30px; + padding-right: 6px; + padding-top: 19px; + padding-bottom: 8px; + border: 1px solid #cac8c8 !important; + } + + + .service{ + font-size: 22px; + color: black; + letter-spacing: 1px; + font-weight: bold; + } + .services{ + + font-size: 12px; + color: black; + } + + .adult-dote{ + background-color: #3CB9D5; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-left: -17px; + margin-right: 5px; + } + + .adult-dote-ar{ + background-color: #3CB9D5; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-right: 0px; + margin-left: 5px; + } + .child-dote{ + + background-color: #269DB8; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-left: -17px; + margin-right: 5px; + } + .child-dote-ar{ + background-color: #269DB8; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-right: 1px; + margin-left: 5px; + } + .infants-dote{ + background-color: #1FA269; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-left: -17px; + margin-right: 5px; + // margin-bottom: 6px; + } + + .infants-dote-ar{ + background-color: #1FA269; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-right: 1px; + margin-left: 5px; + } + .addEitOkButton{ + white-space: normal !important; + text-transform: capitalize !important; + min-height: 45px !important; + min-width: 5px !important; + margin: 8px !important; + background-color: #269DB8; + width: 80% !important; + color: white!important; + border-radius: 16px !important; + } + + \ No newline at end of file diff --git a/Mohem/src/app/eit/cei-list/cei-list.component.spec.ts b/Mohem/src/app/eit/cei-list/cei-list.component.spec.ts new file mode 100644 index 00000000..ef47a3a9 --- /dev/null +++ b/Mohem/src/app/eit/cei-list/cei-list.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CeiListComponent } from './cei-list.component'; + +describe('CeiListComponent', () => { + let component: CeiListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CeiListComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CeiListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/eit/cei-list/cei-list.component.ts b/Mohem/src/app/eit/cei-list/cei-list.component.ts new file mode 100644 index 00000000..2b7aeec3 --- /dev/null +++ b/Mohem/src/app/eit/cei-list/cei-list.component.ts @@ -0,0 +1,127 @@ +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { EITTransactionsRequest } from './../models/EITTransactionsReq'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { Component, OnInit } from '@angular/core'; +import { EitService } from '../services/eit.service'; +import { EIT_ACTION } from '../models/submit.eit.action'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; + +@Component({ + selector: 'app-cei-list', + templateUrl: './cei-list.component.html', + styleUrls: ['./cei-list.component.scss'], +}) +export class CeiListComponent implements OnInit { + Sdate: any; + emp_no: any; + balance:any; + P_PAGE_NUM: number; + P_PAGE_LIMIT: number; + IsReachEnd = false; + userName: any; + isDelete = false; + getResCEITransactionList: any = []; + eitAddedList: any = []; + getPassMnuEntryObj: any; + selMenu: MenuResponse = new MenuResponse(); + CEITransactionsListObj: EITTransactionsRequest = new EITTransactionsRequest(); + selEmp: string; + respID: number; + transactionNo = 0; + menuType = ''; + public functionName = ''; + private pAction = 0; + public headerTitle = ''; + data: any; + accrualNetInfants: any; + accrualUNetChild: any; + accrualNetAdult: any; + + public options = { + cutoutPercentage: 80, + tooltips: { enabled: false }, + legend: { display: false }}; + gaugeType = 'full'; + accrualBalancesList: any; + common: any; + direction: string; + + constructor( + private cs: CommonService, + private EITService: EitService, + public ts: TranslatorService, + public authService:AuthenticationService,) { + this.direction = TranslatorService.getCurrentLanguageName(); + this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); + this.selEmp = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_EMP, false); + this.respID = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_RESP_ID, false); + this.getPassMnuEntryObj = this.selMenu.GetMenuEntriesList; + this.menuType = this.selMenu.List_Menu.MENU_TYPE; + this.transactionNo = 0; + this.functionName = this.getPassMnuEntryObj.FUNCTION_NAME; + this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; + this.P_PAGE_NUM = 1; + this.P_PAGE_LIMIT = 100; + } + + ngOnInit() { + this.getCEITransactions(); + } + + + public getCEITransactions() { + this.IsReachEnd = false; + this.CEITransactionsListObj.P_PAGE_LIMIT = this.P_PAGE_LIMIT; + this.CEITransactionsListObj.P_PAGE_NUM = this.P_PAGE_NUM; + this.CEITransactionsListObj.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; + this.CEITransactionsListObj.P_SELECTED_RESP_ID = this.respID; + this.CEITransactionsListObj.P_MENU_TYPE = this.selMenu.List_Menu.MENU_TYPE; + this.CEITransactionsListObj.P_FUNCTION_NAME = this.getPassMnuEntryObj.FUNCTION_NAME; + this.EITService.getCEITransactionsList(this.CEITransactionsListObj). + subscribe((result: any) => { + this.handleCEITransactionsResult(result); + }); + } + + public handleCEITransactionsResult(result) { + if (this.cs.validResponse(result)) { + if (this.cs.hasData(result.GetEITTransactionList)) { + this.getResCEITransactionList = result.GetEITTransactionList; + this.P_PAGE_NUM++; + this.CEITransactionsListObj.P_PAGE_NUM = this.P_PAGE_NUM; + const lastItemIndex = this.getResCEITransactionList.length - 1; + if (result.GetEITTransactionList[lastItemIndex] && result.GetEITTransactionList[lastItemIndex].Collection_Transaction[0]) { + const lastitem = result.GetEITTransactionList[lastItemIndex].Collection_Transaction[0]; + // tslint:disable-next-line: triple-equals + if (lastitem.NO_OF_ROWS == lastitem.ROW_NUM) { + this.IsReachEnd = true; + } else { + this.IsReachEnd = false; + } + } + } + } + } + + public addCEIRrq(i?) { + this.pAction = EIT_ACTION.ADD; + this.cs.sharedService.setSharedData(this.pAction, EITTransactionsRequest.SUBMIT_EIT_ACTION); + this.openCEINew(i); + } + + openCEINew(index) { + let item: any = []; + if (this.pAction == EIT_ACTION.UPDATE) { + item = this.getResCEITransactionList[index].Collection_Transaction; + } + this.transactionNo++; + // tslint:disable-next-line: max-line-length + this.cs.sharedService.setSharedData({ dirfromNotificationPage: false, submitEITObjList: undefined, transNo: this.transactionNo }, 'AddEITData'); + this.cs.openAddCEIPage(); + } + +} + + + diff --git a/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.html b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.html new file mode 100644 index 00000000..6c5d2842 --- /dev/null +++ b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.html @@ -0,0 +1,127 @@ + + + + {{headerTitle}} + + + + + + + + + +
{{'general, addAttach' | translate}}
+
+ +
+ +
+
+
+ + + {{ 'general, notAttch' | translate}} + +
+ + +
+ + + + {{attachList.AttachmentID +1 }} . + + + + + {{attachList.P_FILE_NAME }} + + + + + + + +
+ +
+ +
+ + +
+
+ + {{attachRes.FILE_NAME }} + +
+ + + + +
+
+ +
+ + + +
{{'confirmAddEit, comment' | translate}}
+ + + +
+ + +
{{'confirmAddEit, approverList' | translate}}
+
+

{{ 'general, empty' | translate}}

+
+
+ +
+ + +
+
+ +
+
+ + + {{employee.APPROVER}} + + + {{employee.POSITION_TITLE}} + + + +
+
+
+
+
+ +
+ +
+ + +
+ + {{ (isDelete ? 'general, delete' : 'general, submit') | translate }} +
+
\ No newline at end of file diff --git a/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.scss b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.scss new file mode 100644 index 00000000..2ed98379 --- /dev/null +++ b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.scss @@ -0,0 +1,263 @@ +.footer-button { + border-radius: 2px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; + } + + .imgSize { + width: 22px; + height: 22px; + } + + .Header { + font-weight: bold; + color: #1a586d !important; + font-size: 10px; + } + + .tbData { + font-size: 10px; + } + + .btnBack { + background: transparent; + float: right; + } + + .attachmentDiv{ + background: #ffffff; + height: auto; + text-align: center; + padding-top: 1px; + margin: 10px; + border-radius: 15px; + border: 1px solid grey; + } + + .noDataDiv{ + background: #ffffff; + height: 11%; + text-align: center; + padding-top: 1px; + border-radius: 10px; + margin: 10px; + border-radius: 5px; + } + .submitNote{ + background: #ffffff; + height: 80px; + padding-top: 1px; + margin: 10px; + border-radius: 15px; + border: 1px solid grey; + } + + .approvalList{ + --background: #f0efef; + height: auto; + text-align: center; + padding-top: 1px; + border-radius: 10px; + margin: 10px; + border-radius: 5px; + } + + /************************New Design**********************************/ + .notification-list{ + background: none; + background: none; + border-radius: 32px; + ion-item{ + // margin-top: 5px; + // margin-bottom: 5px; + + background-color: transparent; + .item-date{ + width: 100%; + font-size: 16px; + font-weight: bold; + + text-align: start; + padding: 0; + margin: 0; + + position: absolute; + left: 0; + top: 12%; + } + ion-label , [item-end]{ + + white-space: normal; + font-size: 14px; + padding-top: 15%; + // :root[dir="ltr"]{ + // margin-left: 10px; + // } + // :root[dir="rtl"]{ + // margin-right: 10px; + // } + + } + + } + } + + + + + + + .timeline { + position: relative; + margin: 15px 0 0 0; + // border-bottom: solid 1px var(--cusgray); + } + + .timeline:before { + + content: ''; + position: inherit !important; + top: 0; + bottom: 0; + width: 4px; + // background: #e4e4e4; + z-index: 1; + left: 35px; + /* margin-left: -10px; */ + /* z-index: 1; */ + } + + .timeline .timeline-thumb { + + border-radius: 500px; + width: 70px !important; + z-index: 2; + position: absolute; + left: 0px; + // :root[dir="ltr"]{ + // left: 37px; + // } + // :root[dir="rtl"]{ + // right: 37px; + // } + float: right; + top: 9px; + } + + .timeline .timeline-thumb.timeline-icon { + height: 70px; + // text-align: center; + // color: white; + // border: 5px solid #CBD0D3; + // transform: scale(0.2); + } + + + + .timeline .timeline-item { + width: 40px; + + } + + .timeline .timeline-stats { + position: relative; + font-size: 12px; + color: var(--darkgray); + + } + + .empImge{ + border-radius: 50%; + width:100%; + height: 100%; + border: #dedede solid 1px; + + } + .empImgeRep { + border-radius: 50% !important; + width: 80px; + height: 80px; + border: #dedede solid 1px; + } + + .line{ + padding-bottom:87px; + } + + .attachLable{ + position: absolute; + top: 0px; + z-index: 0; + background: #30b8c6; + color: #fff; + border-radius: 50%; + border: 0px; + width: 24px; + height: 24px; + text-align: center; + font-size: 5px; + } + + .removeLable{ + top: 0px; + z-index: 0; + background: #d8252d; + color: #fff; + border-radius: 50%; + border: 0px; + width: 20px; + height: 20px; + text-align: center; + font-size: 5px; + } + + .note-modal { + // width: 90%; + // height: 50%; + // top: 20%; + // left: 5%; + // right: 5%; + // bottom: 5%; + background: rgba(0, 0, 0, 0.5) !important; + padding: 30% 10% !important; + --height: 12cm !important; + // --width: 80% !important; + --border-radius:20px; + + } + .header-toolbar-new{ + --background: #269DB8; + } + .title{ + margin-top: -37px; + margin-left: 85px; + } + .title-ar{ + margin-top: -37px; + margin-right: 101px; + } + .confirmEitOkButton{ + white-space: normal !important; + text-transform: capitalize !important; + min-height: 45px !important; + min-width: 5px !important; + margin: 8px !important; + background-color: #269DB8; + width: 80% !important; + color: white!important; + border-radius: 16px !important; + } + + .approvalTitle-ar{ + font-weight: bold; + font-size: 16px; + text-align: right; + + } + .approvalTitle{ + font-weight: bold; + font-size: 16px; + text-align: left; + } + \ No newline at end of file diff --git a/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.spec.ts b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.spec.ts new file mode 100644 index 00000000..2cf5f990 --- /dev/null +++ b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ConfirmAddCeiComponent } from './confirm-add-cei.component'; + +describe('ConfirmAddCeiComponent', () => { + let component: ConfirmAddCeiComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ConfirmAddCeiComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ConfirmAddCeiComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.ts b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.ts new file mode 100644 index 00000000..9235b0d8 --- /dev/null +++ b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.ts @@ -0,0 +1,445 @@ +import { WorkListAttachViewComponent } from './../../notification/work-list-attach-view/work-list-attach-view.component'; +import { AddAttachComponent } from './../add-attach/add-attach.component'; +import { NotificationGetAttachResponse } from './../models/NotificationGetAttachRes'; +import { EITNotificatonBodyResponse } from './../models/EITNotificationBodyRes'; +import { WorkListButtonRequest } from './../models/NotificationButtonReq'; +import { ApproversList } from './../../absence/models/approvers'; +import { CeiRequest } from './../models/cei.request'; +import { Component, OnInit } from '@angular/core'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +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 { EitService } from '../services/eit.service'; +import { AddCeiResponse } from '../models/add.cei.response'; +import { FileUploader } from 'ng2-file-upload'; +import { SubmitEitModalComponent } from '../submit-eit-modal/submit-eit-modal.component'; + +@Component({ + selector: 'app-confirm-add-cei', + templateUrl: './confirm-add-cei.component.html', + styleUrls: ['./confirm-add-cei.component.scss'], +}) +export class ConfirmAddCeiComponent implements OnInit { + + private P_TransactionID: number; + private ceiRequest: CeiRequest; + approversList = []; + addrespList: any; + eitComments: string = ""; + menuType: string = ""; + selEmp: string = ""; + respID: number; + selMenu: MenuResponse; + getAttachList: any; + attachListDisplay: any = []; + headerTitle: string = ""; + isTrue: any = 0; + attachItems: any; + public isResubmitEIT: boolean = false; + private itemKey: string = ""; + private pActionMode: string = "SUBMIT"; + attachReqObj: WorkListButtonRequest = new WorkListButtonRequest(); + attachmentRes: any; + objIndex1: any; + attachListOver: any = []; + index: any = 0; + getPassNotificationDetails: any; + isSubmitBtnClicked: boolean; + isDelete: boolean = false; + + isUpload: boolean = false; + inQueue: boolean = false; + addAttachmentListReq: any; + attachmentID: number = 0; + addAttachRequest: any = []; + fileData: any; + fileType: any; + dirPage: any; + TransactionID: any; + indexLastObj: any = 0; + filterAllowedType: any = ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']; + direction: string; + + + constructor(public modalController: ModalController, public cs: CommonService, private ts: TranslatorService, private eitService: EitService) { + this.direction = TranslatorService.getCurrentLanguageName() + this.isSubmitBtnClicked = false; + this.ceiRequest = new CeiRequest(); + } + + ngOnInit() { + this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); + this.selEmp = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_EMP, false); + this.respID = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_RESP_ID, false); + this.ceiRequest = this.cs.sharedService.getSharedData(CeiRequest.SHARED_DATA, false); + // this.isResubmitEIT = this.cs.sharedService.getSharedData('confirmAddEITData', false).isResubmit; + if (this.isResubmitEIT) { + this.getPassNotificationDetails = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.NOT_WORKLIST, false); //WARINING ** + this.P_TransactionID = this.cs.sharedService.getSharedData("TransactionIDResubmit", true); + this.itemKey = this.getPassNotificationDetails.ITEM_KEY; + this.pActionMode = "RESUBMIT"; + this.menuType = "E"; + this.respID = -999; + this.selEmp = this.ceiRequest.P_SELECTED_EMPLOYEE_NUMBER; + this.getApproversList(); + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); + let msg: string = ""; + msg = this.ts.trPK("eit", "update-title"); + this.headerTitle = msg; + } else { + this.menuType = this.selMenu.List_Menu.MENU_TYPE; + this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; + this.addrespList = this.cs.sharedService.getSharedData(AddCeiResponse.SHARED_DATA); + this.itemKey = this.addrespList.SubmitCEITransactionList.P_ITEM_KEY; + this.P_TransactionID = this.addrespList.SubmitCEITransactionList.P_TRANSACTION_ID; + // this.isDelete = this.isResubmitEIT = this.cs.sharedService.getSharedData('confirmAddEITData', false).isDelete; + this.getApproversList(); + } + } + + getApproversList() { + let body: any = { + P_TRANSACTION_ID: this.P_TransactionID, + P_AME_TRANSACTION_TYPE: "SSHRMS", + P_PAGE_NUM: 1, + P_PAGE_LIMIT: 1000 + } + this.eitService.getApproversList( + body). + subscribe((result: any) => { + this.handleApproversResult(result); + }); + } + + handleApproversResult(result) { + if (this.cs.validResponse(result)) { + this.approversList = result.GetApprovesList; + } + } + + startCeiApproval() { + if (this.attachListOver) { + let request = { + AddAttachmentList: this.attachListOver + } + this.eitService.addAttachment( + request). + subscribe((result: any) => { + this.handleAddAttachmentResults(result); + }); + } else { + this.startCeiApprovalProcess(); + } + } + + + handleAddAttachmentResults(result) { + if (this.cs.validResponse(result)) { + //this.isUpload=true; + this.isTrue = 0; + for (let i = 0; i < result.AddAttSuccessList.length; i++) { + if (!result.AddAttSuccessList[i].AddSuccess) { + this.attachListOver[i].isSuccess = false; + // if false display cancel button with waring icon or design + }// end if + else { + // if true remove cancel and set isSuccess = true + this.attachListOver[i].isSuccess = true; + this.isTrue = this.isTrue + 1; //count flag of attach status + } // end else + } // end for + + if (this.isTrue == result.AddAttSuccessList.length) { + this.startCeiApprovalProcess(); + } + else { + //stope + let filtered = this.attachListOver.filter(function (el) { return el.isSuccess == true; }); + this.attachListOver = filtered; + let msg: string = ""; + msg = this.ts.trPK("eit", "attach-errorMsg"); + this.cs.presentAlert(msg); + } + } + } + + startCeiApprovalProcess() { + let request: any = {}; + request.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; + request.P_MENU_TYPE = this.menuType; + request.P_SELECTED_RESP_ID = this.respID; + request.P_TRANSACTION_ID = this.P_TransactionID; + request.P_ITEM_KEY = this.itemKey; + request.P_ACTION_MODE = this.pActionMode; + request.P_COMMENTS = this.eitComments; + this.eitService.startCeiApprovalProcess( + request). + subscribe((result: any) => { + this.handleResults(result); + }); + } + cancelEitProcess() { + let body: any = { + P_TRANSACTION_ID: this.P_TransactionID + } + this.eitService.cancelHRTransaction( + body). + subscribe((result: any) => { + this.handleCancelResults(result); + }); + + } + handleCancelResults(result) { + if (this.cs.validResponse(result)) { + this.isSubmitBtnClicked = false; + } + } + handleResults(result) { + if (this.cs.validResponse(result)) { + this.isSubmitBtnClicked = true; + // let msg: string = this.ts.trPK("eit", "approval-message-success"); + // this.cs.presentAlert(msg); + this.cs.greenToastPK("eit", "approval-message-success") + this.cs.openNotificationPage(); + } + } + + async addAttachment(str: boolean, attachItems: any) { + let attachDocID = attachItems.ATTACHED_DOCUMENT_ID; + + this.cs.sharedService.setSharedData( this.P_TransactionID, 'TransactionID'); + this.cs.sharedService.setSharedData(this.attachListOver.length, 'indexLastObj'); + + const modal = await this.modalController.create({ + component: AddAttachComponent + }); + + modal.onDidDismiss() + .then((data) => { + if (data == "cancel" || data == "undefined") { + return; + } else { + if (!str) { + this.updateFile(data, attachDocID); + } else { + console.log(data); + this.attachListDisplay = data.data; + this.attachItems = this.attachListDisplay.map(function (el) { + var o = Object.assign({}, el); + o.isSuccess = false; + return o; + }); + + this.attachListOver = this.attachListOver ? this.attachListOver.concat(this.attachItems) : this.attachItems; + } + } + }); + + return await modal.present(); + } + + /*****submit modal********/ + async openSubmitModal() { + this.cs.sharedService.setSharedData( this.attachListOver, 'submitAttachmentList'); + this.cs.sharedService.setSharedData(this.eitComments, 'eitComments'); + const modal = await this.modalController.create({ + component: SubmitEitModalComponent, + backdropDismiss: false, + + }); + modal.cssClass = 'note-modal'; + + modal.onDidDismiss() + .then((data) => { + console.log(data.data); + + if (data.data == "cancel" || data.data == undefined) { + return; + } else { + this.startCeiApproval(); + } + }); + + return await modal.present(); + + } + + + + removeFile(objectitem) { + if (this.attachListOver) { + let index2 = this.attachListOver.findIndex(item => item == objectitem); + if (index2 > -1) { + this.attachListOver.splice(index2, 1); + } + } + if (this.attachmentRes) { + + let index3 = this.attachmentRes.findIndex(item => item == objectitem); + if (index3 > -1) { + + this.attachmentRes.splice(index3, 1); + } + } + + } + + + getAttachment(NotificationID) { + + this.attachReqObj.P_NOTIFICATION_ID = NotificationID; + + this.eitService.getAttach(this.attachReqObj). + subscribe((result: NotificationGetAttachResponse) => { + this.handleWorkListAttachResult(result); + }); + } + + handleWorkListAttachResult(result) { + if (this.cs.validResponse(result)) { + // this.sharedData.setSharedData(result, WorKListResponse.SHARED_DATA); + if (result.GetAttachementList != null) { + this.attachmentRes = result.GetAttachementList; + } // if result == null + } // valid it + + } + + async OpenAttachFiles(value, Type) { + + this.cs.sharedService.setSharedData({ displayData: value, TypeData: Type }, 'WorkListAttachViewPage'); + const modal = await this.modalController.create({ + component: WorkListAttachViewComponent + }); + + modal.onDidDismiss() + .then((data) => { + }); + + return await modal.present(); + } + + + delelteFile(attach) { + this.cs.confirmAlertDialog((data) => { + if (data == true) { + this.continueDelete(attach); + } + }, this.ts.trPK('general', 'ok'), () => { + + }, this.ts.trPK('general', 'cancel'), this.ts.trPK('general', 'alert'), this.ts.trPK('eit', 'delete-perm')); + } + continueDelete(attach) { + let req = { + P_ATTACHED_DOCUMENT_ID: attach.ATTACHED_DOCUMENT_ID + } + this.eitService.deleteAttach(req). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (result.DeleteAttachmentList.P_RETURN_STATUS === "S") { + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); + let msg: string = ""; + msg = this.ts.trPK("eit", "deleteAttach"); + this.cs.presentAlert(msg); + } + } + }); + } + + updateFile(attachList, attachDocID) { + let req = { + P_ATTACHED_DOCUMENT_ID: attachDocID, + P_FILE_DATA: attachList[0].P_FILE_DATA, + P_FILE_NAME: attachList[0].P_FILE_NAME, + P_FILE_CONTENT_TYPE: attachList[0].P_FILE_CONTENT_TYPE + } + this.eitService.updateAttach(req). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (result.MessageStatus == 1) { + let msg: string = ""; + msg = this.ts.trPK("eit", "attachUpdate"); + this.cs.presentAlert(msg); + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); + } + } // val + }); + } + + + ionViewWillLeave() { + if (this.P_TransactionID && this.isSubmitBtnClicked == false) + this.cancelEitProcess(); + } + + public uploader: FileUploader = new FileUploader({ + allowedMimeType: ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], + maxFileSize: 10 * 1024 * 1024, + formatDataFunctionIsAsync: true, + formatDataFunction: async (item) => { + return new Promise((resolve, reject) => { + resolve({ + name: item._file.name, + length: item._file.size, + contentType: item._file.type, + date: new Date() + }); + }); + } + }); + + + onFileSelectedclick(event){ + event.target.value = ''; + } + + + + onFileSelected(input) { + if (!(this.filterAllowedType.indexOf(input.target.files[0].type) > -1)) { + let msg: string = ""; + msg = this.ts.trPK("general", "notSupport"); + this.cs.presentAlert(msg); + return + } // todo: show alert that you tried uploading wrong files + + else { + const file = input.target.files[0]; + this.getBase64(file).then( + data => this.pushObject(data, file.name, file.type) + ); + } + } + + + getBase64(file) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = () => resolve(reader.result); + reader.onerror = error => reject(error); + }); + } + + + pushObject(fileData, name, type) { + try { + let array = name.split('.'); + let attachType: string = array[array.length - 1]; + + this.attachListOver.push( + { + AttachmentID: this.attachListOver.length, + P_FILE_CONTENT_TYPE: attachType,//type.split('/')[1], + P_FILE_DATA: fileData.split(',')[1], + P_FILE_NAME: name,//.split('.')[0], + P_TRANSACTION_ID: this.P_TransactionID + }) + + } catch (e) { + + } + } +} + diff --git a/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.ts b/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.ts index 72cf9af1..35abae8a 100644 --- a/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.ts +++ b/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.ts @@ -14,6 +14,7 @@ import { EitService } from '../services/eit.service'; import { AddEitResponse } from '../models/add.eit.response'; import { FileUploader } from 'ng2-file-upload'; import { SubmitEitModalComponent } from '../submit-eit-modal/submit-eit-modal.component'; +import { HomeComponent } from 'src/app/notification/home/home.component'; @Component({ selector: 'app-confirm-add-eit', @@ -62,7 +63,7 @@ export class ConfirmAddEitComponent implements OnInit { filterAllowedType: any = ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']; direction: string; - + constructor(public modalController: ModalController, public cs: CommonService, private ts: TranslatorService, private eitService: EitService) { this.direction = TranslatorService.getCurrentLanguageName() this.isSubmitBtnClicked = false; @@ -81,8 +82,8 @@ export class ConfirmAddEitComponent implements OnInit { this.getPassNotificationDetails = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.NOT_WORKLIST, false); //WARINING ** // console.log("this.getPassNotificationDetails: " + this.getPassNotificationDetails); this.P_TransactionID = this.cs.sharedService.getSharedData("TransactionIDResubmit", true); - // let notification = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.NOT_WORKLIST, true); - + // let notification = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.NOT_WORKLIST, true); + this.itemKey = this.getPassNotificationDetails.ITEM_KEY; this.pActionMode = "RESUBMIT"; this.menuType = "E"; @@ -228,12 +229,15 @@ export class ConfirmAddEitComponent implements OnInit { if (this.cs.validResponse(result)) { this.isSubmitBtnClicked = true; //if(this.isResubmitEIT==false){ - let msg: string = this.ts.trPK("eit", "approval-message-success"); - this.cs.presentAlert(msg); + // let msg: string = this.ts.trPK("eit", "approval-message-success"); + // this.cs.presentAlert(msg); + this.cs.greenToastPK("eit", "approval-message-success") // } // this.navCtrl.popToRoot(); // this.cs.openHome(); + this.cs.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + //this.cs.setTotalNumberOfWorklistRequest(true); this.cs.openNotificationPage(); } } @@ -249,7 +253,7 @@ export class ConfirmAddEitComponent implements OnInit { //open the modal with return data let attachDocID = attachItems.ATTACHED_DOCUMENT_ID; - this.cs.sharedService.setSharedData( this.P_TransactionID, 'TransactionID'); + this.cs.sharedService.setSharedData(this.P_TransactionID, 'TransactionID'); this.cs.sharedService.setSharedData(this.attachListOver.length, 'indexLastObj'); const modal = await this.modalController.create({ @@ -298,7 +302,7 @@ export class ConfirmAddEitComponent implements OnInit { /*****submit modal********/ async openSubmitModal() { - this.cs.sharedService.setSharedData( this.attachListOver, 'submitAttachmentList'); + this.cs.sharedService.setSharedData(this.attachListOver, 'submitAttachmentList'); this.cs.sharedService.setSharedData(this.eitComments, 'eitComments'); const modal = await this.modalController.create({ component: SubmitEitModalComponent, @@ -314,7 +318,7 @@ export class ConfirmAddEitComponent implements OnInit { if (data.data == "cancel" || data.data == undefined) { return; } else { - this.startEitApproval(); + this.startEitApproval(); } }); @@ -482,7 +486,7 @@ export class ConfirmAddEitComponent implements OnInit { }); - onFileSelectedclick(event){ + onFileSelectedclick(event) { event.target.value = ''; } @@ -529,7 +533,7 @@ export class ConfirmAddEitComponent implements OnInit { pushObject(fileData, name, type) { - console.log("before push: "+ this.index); + console.log("before push: " + this.index); //this.attachListOver.length++; try { let array = name.split('.'); @@ -537,11 +541,11 @@ export class ConfirmAddEitComponent implements OnInit { this.attachListOver.push( { - AttachmentID: this.attachListOver.length, + AttachmentID: this.attachListOver.length, P_FILE_CONTENT_TYPE: attachType,//type.split('/')[1], P_FILE_DATA: fileData.split(',')[1], P_FILE_NAME: name,//.split('.')[0], - P_TRANSACTION_ID: this.P_TransactionID + P_TRANSACTION_ID: this.P_TransactionID }) } catch (e) { diff --git a/Mohem/src/app/eit/eit.module.ts b/Mohem/src/app/eit/eit.module.ts index 98d5bde0..a42eebc6 100644 --- a/Mohem/src/app/eit/eit.module.ts +++ b/Mohem/src/app/eit/eit.module.ts @@ -14,7 +14,10 @@ import { DatePicker } from '@ionic-native/date-picker/ngx'; import { WorkListAttachViewComponent } from '../notification/work-list-attach-view/work-list-attach-view.component'; import { EitUpdateListComponent } from './eit-update-list/eit-update-list.component'; import { SubmitEitModalComponent } from './submit-eit-modal/submit-eit-modal.component'; - +import { CeiHomepageComponent } from './cei-homepage/cei-homepage.component'; +import { CeiListComponent } from './cei-list/cei-list.component'; +import { AddCeiComponent } from './add-cei/add-cei.component'; +import { ConfirmAddCeiComponent } from './confirm-add-cei/confirm-add-cei.component'; const routes: Routes = [ { @@ -48,7 +51,23 @@ const routes: Routes = [ { path: 'eit-submit-modal', component: SubmitEitModalComponent - } + }, + { + path: 'cei-homepage', + component: CeiHomepageComponent + }, + { + path: 'cei-list', + component: CeiListComponent + }, + { + path: 'add-cei', + component: AddCeiComponent + }, + { + path: 'confirm-cei', + component: ConfirmAddCeiComponent + }, ] } ]; @@ -69,7 +88,11 @@ const routes: Routes = [ ConfirmAddEitComponent, AddAttachComponent, EitUpdateListComponent, - SubmitEitModalComponent + SubmitEitModalComponent, + CeiHomepageComponent, + CeiListComponent, + AddCeiComponent, + ConfirmAddCeiComponent ], entryComponents: [ WorkListAttachViewComponent diff --git a/Mohem/src/app/eit/home/home.component.ts b/Mohem/src/app/eit/home/home.component.ts index 7402a672..b3fd95e5 100644 --- a/Mohem/src/app/eit/home/home.component.ts +++ b/Mohem/src/app/eit/home/home.component.ts @@ -2,6 +2,7 @@ import { CommonService } from 'src/app/hmg-common/services/common/common.service import { Component, OnInit } from '@angular/core'; import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { TerminationServiceService } from 'src/app/termination/service/termination-service.service'; @Component({ selector: 'app-home', @@ -19,7 +20,7 @@ export class HomeComponent implements OnInit { direction: string; pageType: string; - constructor(private cs: CommonService, private ts: TranslatorService) { + constructor(private cs: CommonService, private ts: TranslatorService, public terminationService: TerminationServiceService) { this.direction = TranslatorService.getCurrentLanguageName(); this.menu = this.cs.sharedService.getSharedData('menuEntries', false); this.pageType = this.cs.sharedService.getSharedData('homemenuentries', false); @@ -45,6 +46,11 @@ export class HomeComponent implements OnInit { this.selectedMenu = index; } } + if (page['FUNCTION_NAME'] == 'HR_TERM_SS' || page['FUNCTION_NAME'] == 'HR_TERM_EMP_SS') { + this.cs.sharedService.setSharedData(page, TerminationServiceService.TERMINATION_PAGE); + + this.cs.openTermination(); + } console.log('selected>>>>>>>' + this.selectedMenu); } @@ -59,8 +65,10 @@ export class HomeComponent implements OnInit { this.cs.openEitListPage(); } else if (menuEntry.REQUEST_TYPE === 'BASIC_DETAILS') { this.cs.openProfile('basicDetails'); - } else if (menuEntry.REQUEST_TYPE === 'ADDRESS') { - this.cs.openProfile('address'); + } else if (menuEntry.REQUEST_TYPE === 'ADDRESS' || menuEntry.REQUEST_TYPE === 'PHONE_NUMBERS') { + this.cs.openProfile('contact'); + } else if (menuEntry.REQUEST_TYPE === 'CONTACT') { + this.cs.openProfile('family'); } if (menuEntry.REQUEST_TYPE === 'PAYSLIP') { this.cs.openPayslipPage(); @@ -68,6 +76,9 @@ export class HomeComponent implements OnInit { if (menuEntry.REQUEST_TYPE === 'TIME_CARD') { this.cs.openTimeCardPage(); } + if (menuEntry.REQUEST_TYPE === 'CEI') { + this.cs.openCEIPage(); + } } } diff --git a/Mohem/src/app/eit/models/add.cei.response.ts b/Mohem/src/app/eit/models/add.cei.response.ts new file mode 100644 index 00000000..070c330a --- /dev/null +++ b/Mohem/src/app/eit/models/add.cei.response.ts @@ -0,0 +1,8 @@ +import { Response } from '../../hmg-common/services/models/response'; +import { EitRespModel } from './eit.response.model' + +export class AddCeiResponse extends Response { + public static SHARED_DATA = 'add-cei-response'; + SubmitCEITransactionList: EitRespModel; +} + diff --git a/Mohem/src/app/eit/models/add.eit.response.ts b/Mohem/src/app/eit/models/add.eit.response.ts index b54537a7..c7a18133 100755 --- a/Mohem/src/app/eit/models/add.eit.response.ts +++ b/Mohem/src/app/eit/models/add.eit.response.ts @@ -3,6 +3,7 @@ import { EitRespModel } from './eit.response.model' export class AddEitResponse extends Response { public static SHARED_DATA = 'add-eit-response'; + public static isContact = 'isContact'; SubmitEITTransactionList: EitRespModel; } diff --git a/Mohem/src/app/eit/models/cei.request.ts b/Mohem/src/app/eit/models/cei.request.ts new file mode 100644 index 00000000..7b06f904 --- /dev/null +++ b/Mohem/src/app/eit/models/cei.request.ts @@ -0,0 +1,12 @@ +import { EitTransactionModel } from './eit.transaction.model'; + +export class CeiRequest { + public static SHARED_DATA = 'cei-request'; + public P_MENU_TYPE: string; + public P_SELECTED_EMPLOYEE_NUMBER: string; + public P_FUNCTION_NAME: string; + public P_SELECTED_RESP_ID: Number; + P_CONTACT_RELATIONSHIP_ID: Number; + P_DESC_FLEX_CONTEXT_CODE: string; + EITTransactionTBL: EitTransactionModel[]; +} \ No newline at end of file diff --git a/Mohem/src/app/eit/models/eit.request.ts b/Mohem/src/app/eit/models/eit.request.ts index 51e746a5..cc9d4311 100755 --- a/Mohem/src/app/eit/models/eit.request.ts +++ b/Mohem/src/app/eit/models/eit.request.ts @@ -8,5 +8,4 @@ export class EitRequest { public P_SELECTED_RESP_ID: Number; P_DESC_FLEX_CONTEXT_CODE: string; EITTransactionTBL: EitTransactionModel[]; - } \ No newline at end of file diff --git a/Mohem/src/app/eit/services/eit.service.ts b/Mohem/src/app/eit/services/eit.service.ts index 9063a6ff..4b95bdda 100644 --- a/Mohem/src/app/eit/services/eit.service.ts +++ b/Mohem/src/app/eit/services/eit.service.ts @@ -5,6 +5,7 @@ import { Injectable } from '@angular/core'; import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service'; import { AddEitResponse } from '../models/add.eit.response'; +import { AddCeiResponse } from '../models/add.cei.response'; import { ApproversList } from 'src/app/absence/models/approvers'; import { WorkListButtonRequest } from '../models/NotificationButtonReq'; @@ -16,19 +17,24 @@ export class EitService { /* EIT Services URLs */ public static getMenuEntries = 'Services/ERP.svc/REST/GET_MENU_ENTRIES'; public static getEITTransctions = 'Services/ERP.svc/REST/GET_EIT_TRANSACTIONS'; + public static getCEITransctions = 'Services/ERP.svc/REST/GET_CEI_TRANSACTIONS'; public static getEITDFFStrutre = 'Services/ERP.svc/REST/GET_EIT_DFF_STRUCTURE'; + public static getCEIDFFStrutre = 'Services/ERP.svc/REST/GET_CEI_DFF_STRUCTURE'; public static getSetValue = 'Services/ERP.svc/REST/GET_VALUE_SET_VALUES'; public static getDefaultValue = 'Services/ERP.svc/REST/GET_DEFAULT_VALUE'; public static validateEITTransctions = 'Services/ERP.svc/REST/VALIDATE_EIT_TRANSACTION'; public static submitEit = 'Services/ERP.svc/REST/SUBMIT_EIT_TRANSACTION'; + public static submitCEI = 'Services/ERP.svc/REST/SUBMIT_CEI_TRANSACTION'; public static resubmitEit = 'Services/ERP.svc/REST/RESUBMIT_EIT_TRANSACTION'; public static startEitProcess = 'Services/ERP.svc/REST/START_EIT_APPROVAL_PROCESS'; + public static startCeiProcess = 'Services/ERP.svc/REST/START_CEI_APPROVAL_PROCESS'; public static updateAttach = 'Services/ERP.svc/REST/UPDATE_ATTACHMENT'; public static deleteAttach = 'Services/ERP.svc/REST/DELETE_ATTACHMENT'; public static getApproversList = 'Services/ERP.svc/REST/GET_APPROVERS_LIST'; public static addAttachment = 'Services/ERP.svc/REST/ADD_ATTACHMENT'; public static cancelHRTransaction = 'Services/ERP.svc/REST/CANCEL_HR_TRANSACTION'; public static getAttach = 'Services/ERP.svc/REST/GET_ATTACHMENTS'; + public static getContactInfo = 'Services/ERP.svc/REST/GET_EMPLOYEE_CONTACTS'; constructor(public authService: AuthenticationService, public con: ConnectorService) { } @@ -49,6 +55,13 @@ export class EitService { return this.con.post(EitService.getEITTransctions, request, onError, errorLabel); } + // tslint:disable-next-line: no-shadowed-variable + public getCEITransactionsList(EITTransactionsRequest: EITTransactionsRequest, onError?: any, errorLabel?: string): Observable { + const request = EITTransactionsRequest; + this.authService.authenticateRequest(request); + return this.con.post(EitService.getCEITransctions, request, onError, errorLabel); + } + public submitEit(eit: any, onError?: any, errorLabel?: string): Observable { const request = eit; request.EITTransactionTBLModel = eit.EITTransactionTBL; @@ -56,6 +69,20 @@ export class EitService { return this.con.post(EitService.submitEit, request, onError, errorLabel); } + public submitChildEducation(cei: any, onError?: any, errorLabel?: string): Observable { + const request = cei; + request.EITTransactionTBL = cei.EITTransactionTBL; + this.authService.authenticateRequest(request); + return this.con.post(EitService.submitCEI, request, onError, errorLabel); + } + + public submitCEI(eit: any, onError?: any, errorLabel?: string): Observable { + const request = eit; + request.EITTransactionTBLModel = eit.EITTransactionTBL; + this.authService.authenticateRequest(request); + return this.con.post(EitService.submitEit, request, onError, errorLabel); + } + public validateEITTransaction(validateEITTransactionReq: any, onError?: any, errorLabel?: string): Observable { const request = validateEITTransactionReq; this.authService.authenticateRequest(request); @@ -68,6 +95,12 @@ export class EitService { return this.con.post(EitService.getEITDFFStrutre, request, onError, errorLabel); } + public getCEIDFFStrutre(EITDFFStrutreReq: any, onError?: any, errorLabel?: string): Observable { + const request = EITDFFStrutreReq; + this.authService.authenticateRequest(request); + return this.con.post(EitService.getCEIDFFStrutre, request, onError, errorLabel); + } + public getSetValue(SetValueReq: any, onError?: any, errorLabel?: string): Observable { const request = SetValueReq; this.authService.authenticateRequest(request); @@ -101,6 +134,12 @@ export class EitService { return this.con.post(EitService.startEitProcess, request, onError, errorLabel); } + public startCeiApprovalProcess(eitProcess: any, onError?: any, errorLabel?: string): Observable { + const request = eitProcess; + this.authService.authenticateRequest(request); + return this.con.post(EitService.startCeiProcess, request, onError, errorLabel); + } + public cancelHRTransaction(transactionID: any, onError?: any, errorLabel?: string): Observable { const request = transactionID; this.authService.authenticateRequest(request); @@ -131,4 +170,9 @@ export class EitService { return this.con.post(EitService.resubmitEit, request, onError, errorLabel); } + public getContactInfo(request: any, onError?: any, errorLabel?: string): Observable { + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.P_USER_NAME; + return this.con.post(EitService.getContactInfo, request, onError, errorLabel); + } } diff --git a/Mohem/src/app/erm-channel/home/home.component.ts b/Mohem/src/app/erm-channel/home/home.component.ts index 5bec5386..6d621078 100644 --- a/Mohem/src/app/erm-channel/home/home.component.ts +++ b/Mohem/src/app/erm-channel/home/home.component.ts @@ -60,9 +60,14 @@ export class HomeComponent implements OnInit { }, ( ) => { }, this.ts.trPK('general', 'ok')).subscribe((result) => { - CommonService.SKIP = true; - this.cs.openHome(); - }) + if (this.cs.validResponse(result)){ + this.cs.greenToastPK("erm-channel", "viedo-success"); + CommonService.SKIP = true; + this.cs.openHome(); + }else{ + this.cs.redToastPK("erm-channel", "erm-failed"); + } + }); } } diff --git a/Mohem/src/app/erm-channel/survey/survey.component.ts b/Mohem/src/app/erm-channel/survey/survey.component.ts index b547457b..a5a6d759 100644 --- a/Mohem/src/app/erm-channel/survey/survey.component.ts +++ b/Mohem/src/app/erm-channel/survey/survey.component.ts @@ -52,9 +52,14 @@ export class SurveyComponent implements OnInit { this.authService.saveAdsStatus(request, () => { }, this.ts.trPK('general', 'ok')).subscribe((result) => { - CommonService.SKIP = true; - this.cs.openHome(); - }) + if (this.cs.validResponse(result)){ + this.cs.greenToastPK("erm-channel", "survey-success"); + CommonService.SKIP = true; + this.cs.openHome(); + }else{ + this.cs.redToastPK("erm-channel", "erm-failed"); + } + }); } select(rating) { this.satisfied = rating; diff --git a/Mohem/src/app/hmg-common/hmg-common.module.ts b/Mohem/src/app/hmg-common/hmg-common.module.ts index c0d8c8f9..2b8da3ac 100644 --- a/Mohem/src/app/hmg-common/hmg-common.module.ts +++ b/Mohem/src/app/hmg-common/hmg-common.module.ts @@ -85,32 +85,39 @@ import { ReplacementListComponent } from '../vacation-rule/replacement-list/repl import { FileUploadModule } from 'ng2-file-upload'; import { PdfViewerModule } from 'ng2-pdf-viewer'; import { WorkListAttachViewComponent } from '../notification/work-list-attach-view/work-list-attach-view.component'; -import {Camera} from '@ionic-native/Camera/ngx'; -import {File} from '@ionic-native/file/ngx'; -import {FileUploderProfileComponent} from './ui/file-uploder-profile/file-uploder-profile.component'; +import { Camera } from '@ionic-native/Camera/ngx'; +import { File } from '@ionic-native/file/ngx'; +import { FileUploderProfileComponent } from './ui/file-uploder-profile/file-uploder-profile.component'; import { OpenNativeSettings } from '@ionic-native/open-native-settings/ngx'; import { AccordinCustomComponent } from './ui/accordin-custom/accordin-custom.component'; -import { AccordinTabCustomComponent} from './ui/accordin-custom/accordin-tab-custom/accordin-tab-custom.component' -import {DashboredService} from './services/dashbored/dashbored.service'; -import {NgxGaugeModule} from 'ngx-gauge'; +import { AccordinTabCustomComponent } from './ui/accordin-custom/accordin-tab-custom/accordin-tab-custom.component' +import { DashboredService } from './services/dashbored/dashbored.service'; +import { NgxGaugeModule } from 'ngx-gauge'; import { StatsButtonComponent } from './ui/stats-button/stats-button.component'; import { ServicesButtonComponent } from './ui/services-button/services-button.component'; -import {ConfirmLoginComponent} from '../authentication/confirm-login/confirm-login.component' -import {WelcomeComponent} from './ui/welcome-login/welcome.component' -import {FabButtonComponent} from './ui/fab-button/fab-button.component' +import { ConfirmLoginComponent } from '../authentication/confirm-login/confirm-login.component' +import { WelcomeComponent } from './ui/welcome-login/welcome.component' +import { FabButtonComponent } from './ui/fab-button/fab-button.component' import { AttendScanService } from './services/attend-services/attend-scan.service'; import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx'; import { NgCircleProgressModule } from 'ng-circle-progress'; import { CardFilterComponent } from './ui/card-filter/card-filter.component'; import { EmployeeInformationComponent } from './ui/employee-information/employee-information.component'; import { CircleCalendarComponent } from './ui/circle-calendar/circle-calendar.component'; -import { NgCalendarModule } from 'ionic2-calendar'; +import { NgCalendarModule } from 'ionic2-calendar'; import { DateInfoModalComponent } from './ui/circle-calendar/date-info-modal/date-info-modal.component'; import { ChartModule } from 'primeng/chart'; import { GenericHeaderComponent } from './ui/generic-header/generic-header.component'; import { BackgroundGeolocation } from '@ionic-native/background-geolocation/ngx'; import { AttendanceOptionsComponent } from '../home/attendance-options/attendance-options.component'; import { CardCalendarComponent } from './ui/card-calendar/card-calendar.component'; +import { WorklistSettingComponent } from '../notification/worklist-setting/worklist-setting.component'; +import { SubmitAddressModalComponent } from '../profile/submit-eit-modal/submit-address-modal.component'; +import { FileOpener } from '@ionic-native/file-opener/ngx'; +import { FilePath } from '@ionic-native/file-path/ngx'; +import { FileChooser } from "@ionic-native/file-chooser/ngx"; +import { IOSFilePicker } from '@ionic-native/file-picker/ngx'; +import { SanitizeHtmlPipe } from '../itemforsale/services/domsafe'; @NgModule({ imports: [ @@ -130,6 +137,7 @@ import { CardCalendarComponent } from './ui/card-calendar/card-calendar.componen ], declarations: [ FabButtonComponent, + SanitizeHtmlPipe, WelcomeComponent, NumberRangeComponent, SSpacerComponent, @@ -194,7 +202,9 @@ import { CardCalendarComponent } from './ui/card-calendar/card-calendar.componen Modal, GenericHeaderComponent, AttendanceOptionsComponent, - CardCalendarComponent + CardCalendarComponent, + WorklistSettingComponent, + SubmitAddressModalComponent ], exports: [ FabButtonComponent, @@ -265,7 +275,9 @@ import { CardCalendarComponent } from './ui/card-calendar/card-calendar.componen Modal, GenericHeaderComponent, AttendanceOptionsComponent, - CardCalendarComponent + CardCalendarComponent, + SubmitAddressModalComponent, + SanitizeHtmlPipe, ], providers: [ AttendScanService, @@ -304,9 +316,13 @@ import { CardCalendarComponent } from './ui/card-calendar/card-calendar.componen MenuService, OpenNativeSettings, BarcodeScanner, - BackgroundGeolocation + BackgroundGeolocation, + FileOpener, + FilePath, + FileChooser, + IOSFilePicker ], - entryComponents: [DateInfoModalComponent], + entryComponents: [DateInfoModalComponent, WorklistSettingComponent], }) export class HmgCommonModule { } 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 30002b70..29c24f36 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 @@ -34,7 +34,7 @@ export class AttendScanService { userData: any = {}; public isFakeLocationUsed = false; public isGpsRequired = false; - public collection = 'HMG'; + public collection = 'CS'; constructor(private device: Device, private zbar: ZBar, diff --git a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts index a8eb8067..55367138 100644 --- a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts +++ b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts @@ -134,6 +134,9 @@ export class AuthenticationService { public setPublicFields(request: Request): Request { const isAndroid = this.platform.is('android'); const isIOS = this.platform.is('ios'); + // const userData = this.cs.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA, false); + const userPayrollCode = this.cs.sharedService.getSharedData("projcet-code", false); + const userLegislationCode = this.cs.sharedService.getSharedData("legislation-code", false); let mobileType = ''; if (isAndroid) { mobileType = 'android'; @@ -142,11 +145,18 @@ export class AuthenticationService { } else { mobileType = 'android'; } - request.VersionID = 3.2; - request.Channel = 33; + request.VersionID = 3.6; + request.Channel = 31; request.LanguageID = TranslatorService.getCurrentLanguageCode(); request.MobileType = mobileType; + if (userPayrollCode) { + request.PayrollCodeStr = userPayrollCode; + } + if (userLegislationCode) { + request.LegislationCodeStr = userLegislationCode + } + return request; } public authenticateAndSetPersonalInformation( @@ -218,7 +228,7 @@ export class AuthenticationService { public login(request: LoginRequest, onError: any, errorLabel: string): Observable { this.setPublicFields(request); - request.P_APP_VERSION = "HMG"; + request.P_APP_VERSION = "CS"; return this.con.post(AuthenticationService.login, request, onError, errorLabel); } @@ -475,7 +485,7 @@ export class AuthenticationService { public checkUserAuthentication(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string) : Observable { this.setPublicFields(request); - request.P_APP_VERSION = "HMG"; + request.P_APP_VERSION = "CS"; return this.con.post(AuthenticationService.userChecking, request, onError, errorLabel); } diff --git a/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts b/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts index 387a7d73..68ca3ab7 100644 --- a/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts +++ b/Mohem/src/app/hmg-common/services/authentication/models/smscheck.response.ts @@ -3,6 +3,7 @@ import { Response } from 'src/app/hmg-common/services/models/response'; import { AuthenticatedUser } from './authenticated-user'; import { PrivilageModel } from './privilage-model'; export class SMSCheckResponse extends Response { + BasicMemberInformation: any = {}; AuthenticationTokenID: string; MemberInformationList:AuthenticatedUser[]; Privilege_List:PrivilageModel[]; 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 cac80b88..2a8ae0fd 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -78,6 +78,16 @@ export class CommonService { 'نوفمبر', 'ديسمبر' ]; + public filterKeys = { + 'HRSSA': 0, + 'INVMOA': 0, + 'REQAPPRV': 0, + 'POAPPRV': 0, + 'INVITEM': 0, + "STAMP": 0, + 'ITG': 0, + 'COC': 0 + } private progressLoaders: any[] = []; private loadingProgress: any; @@ -207,7 +217,7 @@ export class CommonService { const toast = await this.toastController.create({ message: message, showCloseButton: true, - position: 'middle', + position: 'top', duration: 2000, closeButtonText: this.ts.trPK('general', 'close') }); @@ -226,7 +236,7 @@ export class CommonService { const toast = await this.toastController.create({ message: message, showCloseButton: true, - position: 'middle', + position: 'top', duration: 2000, color: 'danger', closeButtonText: this.ts.trPK('general', 'close') @@ -237,7 +247,7 @@ export class CommonService { const toast = await this.toastController.create({ message: message, showCloseButton: true, - position: 'middle', + position: 'top', duration: 2000, color: 'success', closeButtonText: this.ts.trPK('general', 'close') @@ -819,6 +829,11 @@ export class CommonService { return '/Date(' + date.getTime() + ')/'; } + public convertDateToJsonDateUpdated(date: Date): string { + const newDate = new Date(date); + return '/Date(' + newDate.getTime() + ')/'; + } + /* date iso format and time is 24 format hh:mm:ss @@ -888,6 +903,11 @@ export class CommonService { return this.getDateTimeISO(date) + ' ' + this.getTimeISO(date); } + public getDateTimeISOFromStringUpdated(dateStr: string): string { + const date = this.evaluteDateAsObject(dateStr); + return this.getDateTimeISO(date); + } + public getCurrentTimeISO(): string { return this.getTimeISO(new Date()); } @@ -1119,9 +1139,15 @@ export class CommonService { public openAddEitPage() { this.nav.navigateForward(['/eit/add-eit']); } + public openAddCEIPage() { + this.nav.navigateForward(['/eit/add-cei']); + } public openConfirmEitPage() { this.nav.navigateForward(['/eit/confirm-add-eit']); } + public openConfirmCEIPage() { + this.nav.navigateForward(['/eit/confirm-cei']); + } public openConfirmBasicDetailsPage() { this.nav.navigateForward(['/profile/confirm-basic']); } @@ -1172,6 +1198,9 @@ export class CommonService { public openMyTeamDetailPage() { this.nav.navigateForward(['/my-team/details']); } + public openSubordinateLeavePage() { + this.nav.navigateForward(['/my-team/subordinate-leave']); + } public openMyRequestPage() { this.nav.navigateForward(['/mowadhafi/my-request']); } @@ -1216,6 +1245,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']); } @@ -1290,6 +1322,16 @@ export class CommonService { public openAddAddress() { this.nav.navigateForward(['/profile/add-address']); } + public openAddContact() { + this.nav.navigateForward(['/profile/contact']); + } + public openAddUpdateContact() { + this.nav.navigateForward(['/profile/add-update-contact']); + } + public confirmContact() { + this.nav.navigateForward(['/profile/confirm-contact']); + } + public openConfirmAddAddress() { this.nav.navigateForward(['/profile/confirm-add-address']); } @@ -1299,12 +1341,45 @@ export class CommonService { public eitUpdate() { this.nav.navigateForward(['/eit/eit-update-list']); } + public openCEIPage() { + this.nav.navigateForward(['/eit/cei-homepage']); + } + public openCEIListPage() { + this.nav.navigateForward(['/eit/cei-list']); + } public openAnnouncement() { this.nav.navigateForward(['/backend-integrations/announcement']); } + public openConcurrentReport() { + this.nav.navigateForward(['/reports/concurrent-report']); + } + public openConcurrentTransaction() { + this.nav.navigateForward(['/reports/transaction-list']); + } + public openTermination() { + this.nav.navigateForward(['/termination/termination-form']); + } + public confirmTermination() { + + this.nav.navigateForward(['/termination/confirm-termination']); + } + public openTransactions() { + + this.nav.navigateForward(['/pending-transaction/home']); + } + + public openItemForSale() { + this.nav.navigateForward('/itemforsale/items'); + } + public openCreateitems() { + this.nav.navigateForward('/itemforsale/home'); + } + public filterItemforSale() { + this.nav.navigateForward('/itemforsale/filter'); + } public navigatePage(path) { this.nav.navigateForward([path]); } @@ -1507,4 +1582,147 @@ export class CommonService { return this.activeType; } + public totalCounter = 0; + getTotalNumberOfWorklistRequest() { + this.totalCounter = parseInt(this.sharedService.getSharedData('total-count', false)); + return this.totalCounter ? this.totalCounter : 0; + } + setTotalNumberOfWorklistRequest() { + if (this.totalCounter > 0) { + this.totalCounter -= 1; + } + this.sharedService.setSharedData(this.totalCounter, 'total-count'); + } + + public setFilterValues(data) { + for (const notification of data) { + + this.filterKeys[notification.ITEM_TYPE] = notification.OPEN_NTF_NUMBER + } + } + + + public filters = [ + { + value: 0, + name: 'HR', + active: false, + color: '#18a169', + key: 'HRSSA', + disable: false, + total: 0 + }, + { + value: 0, + name: 'MR', + active: false, + color: '#3cb9d5', + key: 'INVMOA', + disable: false, + total: 0 + }, + { + value: 0, + name: 'PR', + active: false, + color: '#114475', + key: 'REQAPPRV', + disable: false, + total: 0 + }, + { + value: 0, + name: 'PO', + active: false, + color: '#38c9b3', + key: 'POAPPRV', + disable: false, + total: 0 + }, + { + value: 0, + name: 'ITG', + active: false, + color: '#cc3232', + key: 'ITG', + disable: false, + total: 0 + }, + { + value: 0, + name: 'IC', + active: false, + color: '#9e7e97', + key: 'INVITEM', + disable: false, + total: 0 + }, + { + value: 0, + name: 'STAMP', + active: false, + color: '#ff9800', + key: 'STAMP', + disable: false, + total: 0, + }, + { + value: 0, + name: 'COC', + active: false, + color: '#787299', + key: 'COC', + disable: true, + total: 0, + } + ]; + + public data = { + datasets: [ + { + data: [0, 0, 0, 0, 0, 0, 0, 0], + backgroundColor: [ + '#18a169', + '#3cb9d5', + '#114475', + '#38c9b3', + '#cc3232', + '#9e7e97', + '#ff9800', + '#787299' + ], + borderWidth: 6 + }] + }; + + getFiltersData() { + // for (const notification of openNotificationsArray) { + // if (notification.ITEM_TYPE === 'HRSSA') { + this.filters[0].value = this.filterKeys['HRSSA']; + this.data.datasets[0].data[0] = this.filterKeys['HRSSA']; + // } else if (notification.ITEM_TYPE === 'INVMOA') { + this.filters[1].value = this.filterKeys['INVMOA']; + this.data.datasets[0].data[1] = this.filterKeys['INVMOA']; + // } else if (notification.ITEM_TYPE === 'REQAPPRV') { + this.filters[2].value = this.filterKeys['REQAPPRV']; + this.data.datasets[0].data[2] = this.filterKeys['REQAPPRV']; + // } else if (notification.ITEM_TYPE === 'POAPPRV') { + this.filters[3].value = this.filterKeys['POAPPRV']; + this.data.datasets[0].data[3] = this.filterKeys['POAPPRV']; + // } else if (notification.ITEM_TYPE === 'INVITEM') { + this.filters[5].value = this.filterKeys['INVITEM']; + this.data.datasets[0].data[5] = this.filterKeys['INVITEM']; + // } else if (notification.ITEM_TYPE === 'STAMP') { + this.filters[6].value = this.filterKeys['STAMP']; + this.data.datasets[0].data[6] = this.filterKeys['STAMP']; + + this.filters[7].value = this.filterKeys['COC']; + this.data.datasets[0].data[7] = this.filterKeys['COC']; + + let val = { 'filters': [], 'data': {} }; + val.filters = this.filters; + val.data = this.data; + return val; + } + } diff --git a/Mohem/src/app/hmg-common/services/connector/connector.service.ts b/Mohem/src/app/hmg-common/services/connector/connector.service.ts index dc119ce4..5a1959c6 100644 --- a/Mohem/src/app/hmg-common/services/connector/connector.service.ts +++ b/Mohem/src/app/hmg-common/services/connector/connector.service.ts @@ -25,7 +25,7 @@ export class ConnectorService { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) }; public static retryTimes = 0; - public static timeOut = 120 * 1000; + public static timeOut = 180 * 1000; // public static host = 'https://uat.hmgwebservices.com/'; public static host = 'https://hmgwebservices.com/'; @@ -235,7 +235,7 @@ export class ConnectorService { } return false; } else if (result.ErrorType === 2 || result.ErrorType === 4) { - this.cs.stopLoading(); + this.cs.stopLoading(); } else { this.cs.stopLoading(); if (!fromSMS) { diff --git a/Mohem/src/app/hmg-common/services/menu/models/menu-response.ts b/Mohem/src/app/hmg-common/services/menu/models/menu-response.ts index 1c7a2e1d..0a7cd754 100644 --- a/Mohem/src/app/hmg-common/services/menu/models/menu-response.ts +++ b/Mohem/src/app/hmg-common/services/menu/models/menu-response.ts @@ -2,10 +2,13 @@ import { ListMenu } from './list.menu'; import { MenuEntry } from './menu.entry'; export class MenuResponse { public static SHARED_DATA = 'menu_response'; - public static SHARED_SEL_EMP= 'sel_empolyee'; - public static SHARED_SEL_RESP_ID= 'sel_resp_id'; - public userid:string; - public search:boolean; - public List_Menu:ListMenu; - public GetMenuEntriesList:MenuEntry; + public static MENU_LIST = 'menu_list'; + public static SELECTED_MENU = 'selected_menu'; + public static SHARED_SEL_EMP = 'sel_empolyee'; + public static SHARED_SEL_RESP_ID = 'sel_resp_id'; + public static ITG_COUNTS = 'itg-counts'; + public userid: string; + public search: boolean; + public List_Menu: ListMenu; + public GetMenuEntriesList: MenuEntry; } \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/services/models/request.ts b/Mohem/src/app/hmg-common/services/models/request.ts index 1a9e8fd2..6a16ec13 100644 --- a/Mohem/src/app/hmg-common/services/models/request.ts +++ b/Mohem/src/app/hmg-common/services/models/request.ts @@ -18,6 +18,8 @@ export class Request { public P_MOBILE_NUMBER: string; public P_EMAIL_ADDRESS: string; public P_NOTIFICATION_ID: number; + public PayrollCodeStr: string; + public LegislationCodeStr: string; // public P_LEGISLATION_CODE: string; // public OTP_SendType: number; diff --git a/Mohem/src/app/hmg-common/services/rate/rate.service.ts b/Mohem/src/app/hmg-common/services/rate/rate.service.ts index f9fef5d7..9176bf13 100644 --- a/Mohem/src/app/hmg-common/services/rate/rate.service.ts +++ b/Mohem/src/app/hmg-common/services/rate/rate.service.ts @@ -20,13 +20,13 @@ export class RateService { } - public rateFeature(ratedFeedBack?: any , featureKey: string = RateService.app , delay: number = 2000) { + public rateFeature(ratedFeedBack?: any, featureKey: string = RateService.app, delay: number = 2000) { if (this.isRated(featureKey)) { if (ratedFeedBack) { ratedFeedBack(true); } } else { - setTimeout( () => { + setTimeout(() => { this.startRating(featureKey, ratedFeedBack); }, delay); } @@ -38,7 +38,7 @@ export class RateService { this.appRate.preferences = { displayAppName: this.ts.trPK('general', 'app-name'), promptAgainForEachNewVersion: true, - inAppReview: true, + // inAppReview: true, storeAppURL: { ios: 'com.ejada.hmg', android: 'market://details?id=com.ejada.hmg', @@ -47,7 +47,7 @@ export class RateService { callbacks: { handleNegativeFeedback: () => { this.setAsRated(featureKey); - //this.cs.openFeedback(); + //this.cs.openFeedback(); }, onButtonClicked: (buttonIndex) => { // when user click rate diff --git a/Mohem/src/app/hmg-common/ui/file-uploader/file-uploader.component.html b/Mohem/src/app/hmg-common/ui/file-uploader/file-uploader.component.html index 5e4d2dac..f91aece1 100644 --- a/Mohem/src/app/hmg-common/ui/file-uploader/file-uploader.component.html +++ b/Mohem/src/app/hmg-common/ui/file-uploader/file-uploader.component.html @@ -1,13 +1,40 @@ - - - - {{'general,select-attachment' | translate}} - + -
- -

{{file.name}}

-

-
-
\ No newline at end of file + + + + {{'general,select-attachment' | translate}} + + + + + + + + + + +
+
+
X
+ +
+ +
+
+ +
+
+
+
+ +
+ {{errorMsg}} +
\ No newline at end of file diff --git a/Mohem/src/app/hmg-common/ui/file-uploader/file-uploader.component.scss b/Mohem/src/app/hmg-common/ui/file-uploader/file-uploader.component.scss index 56325173..6b308e7b 100644 --- a/Mohem/src/app/hmg-common/ui/file-uploader/file-uploader.component.scss +++ b/Mohem/src/app/hmg-common/ui/file-uploader/file-uploader.component.scss @@ -2,4 +2,21 @@ width: .7cm; height: .6cm; vertical-align: middle; +} +.closed{ + position: absolute; + right: 0; + font-size: 14px; + color: #fff; + top: -5px; + right: -10px; + font-weight: bolder; + background: red; + padding: 6px; + border-radius: 50%; + text-align: center; + line-height: .7; +} +.image-container{ + margin-top: 10px; } \ No newline at end of file diff --git a/Mohem/src/app/hmg-common/ui/file-uploader/file-uploader.component.ts b/Mohem/src/app/hmg-common/ui/file-uploader/file-uploader.component.ts index 9df5a0c8..fe573455 100644 --- a/Mohem/src/app/hmg-common/ui/file-uploader/file-uploader.component.ts +++ b/Mohem/src/app/hmg-common/ui/file-uploader/file-uploader.component.ts @@ -1,100 +1,288 @@ -import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; -import { CommonService } from 'src/app/hmg-common/services/common/common.service'; -import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; -import { AlertController } from '@ionic/angular'; +import { Component, OnInit, Input, Output, EventEmitter, NgZone } from "@angular/core"; +import { CommonService } from "src/app/hmg-common/services/common/common.service"; +import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service"; +import { AlertController, ActionSheetController, Platform } from "@ionic/angular"; +import { + Camera, + CameraOptions, + PictureSourceType +} from "@ionic-native/Camera/ngx"; +import { FileChooser } from "@ionic-native/file-chooser/ngx"; +import { File } from "@ionic-native/file/ngx"; +import { FilePath } from "@ionic-native/file-path/ngx"; +import { Base64 } from "@ionic-native/base64/ngx"; +import { IOSFilePicker } from '@ionic-native/file-picker/ngx'; +import { Location } from '@angular/common'; +import { DomSanitizer, SafeUrl } from "@angular/platform-browser"; -export interface CustomWindow extends Window { - File: any; - FileReader: any; -} -declare let window: CustomWindow; - @Component({ - selector: 'file-uploader', - templateUrl: './file-uploader.component.html', - styleUrls: ['./file-uploader.component.scss'] + selector: "file-uploader", + templateUrl: "./file-uploader.component.html", + styleUrls: ["./file-uploader.component.scss"] }) export class FileUploaderComponent implements OnInit { @Input() multiupload = false; - @Input() attachmentname = 'attachment-loader'; + @Input() attachmentname = "attachment-loader"; public attachmentData: string; - @Input() maxFileSize = 10 * 1024 * 1024; + public errorMsg: string; + public selectedOpn: number = 1; + public allowdType: any = ["jpg", "jpeg", "png", "gif", "pdf", "doc", "docx"]; + @Input() maxFileSize = 5 * 1024 * 1024; @Output() fileSelected = new EventEmitter(); public inputFiles: any = []; - public attachmentImg = 'assets/icon/attachment.png'; - public deleteImg = 'assets/icon/delete.png'; + public attachmentImg = "assets/icon/attachment.png"; + public deleteImg = "assets/icon/delete.png"; + public nativePath: any; + public actionSheet: any; + public isActionSheetShown: boolean = false; + @Input() selectedAttachment = []; constructor( public cs: CommonService, public ts: TranslatorService, - public alertController: AlertController - ) { - } + public alertController: AlertController, + private cameraController: Camera, + private actionSheetController: ActionSheetController, + private fileChooser: FileChooser, + private file: File, + private filePath: FilePath, + public base64: Base64, + public platform: Platform, + private iOSfilePicker: IOSFilePicker, + public ngzone: NgZone, + public loc: Location, + public sanitizer: DomSanitizer + ) { } ngOnInit() { + this.platform.backButton.subscribeWithPriority(9999, () => { + // You decide what happens + if (this.isActionSheetShown) + this.actionSheet.dismiss(); + else + this.loc.back(); + }); + this.inputFiles = this.selectedAttachment; } - - public loadAttachment(changeEvent) { - const fileInput = this.getFileElement(); - if (this.isFileSupported()) { - if (fileInput.files != null && fileInput.files.length > 0) { - const file = fileInput.files[0]; - const reader = new FileReader(); - if (file.size <= this.maxFileSize) { - reader.onload = (data) => { - if (this.multiupload) { - this.inputFiles.push({name: file.name, data: data.target['result']}); - } else { - this.inputFiles = [{name: file.name, data: data.target['result']}]; - } - this.fileSelected.emit( { - name: file.name , - data: data.target['result'], - inputFiles: this.inputFiles - }); - }; - reader.readAsDataURL(file); - } else { - this.attachmentData = null; - changeEvent.target.value = ''; // remove current selection - this.showFileExceededMaxSize(); - } - } else { - this.attachmentData = null; - } - } + ngOnDestroy(): void { } + async openFile() { + if (this.platform.is('ios')) + this.openiOSActionSheet(); + else + this.openAndroidActionSheet(); + //this.openiOSActionSheet(); - private isFileSupported() { - return (window.FileReader && window.File); } + async openAndroidActionSheet() { + this.actionSheet = await this.actionSheetController.create({ + header: this.ts.trPK("itemforsale", "slect-source-file"), //"Select Image file", - private showFileExceededMaxSize() { - this.cs.presentConfirmDialog( - this.ts.trPK('general', 'large-file'), - () => { - this.openFile(); - }, - () => { - } - ); + buttons: [ + { + text: this.ts.trPK("itemforsale", "from-library"), + handler: () => { + this.takePictureiOS(); + } + }, + { + text: this.ts.trPK("itemforsale", "from-camera"), + handler: () => { + this.takePicture(this.cameraController.PictureSourceType.CAMERA); + } + }, + { + text: this.ts.trPK("general", "cancel"), + role: "cancel" + } + ] + }); + this.isActionSheetShown = true; + await this.actionSheet.present(); } - private getFileElement(): HTMLInputElement { - return document.getElementById(this.attachmentname) as HTMLInputElement; + async openiOSActionSheet() { + this.actionSheet = await this.actionSheetController.create({ + header: this.ts.trPK("itemforsale", "slect-source-file"), //"Select Image file", + buttons: [ + { + text: this.ts.trPK("itemforsale", "from-library"), + handler: () => { + this.takePictureiOS(); + } + }, + { + text: this.ts.trPK("itemforsale", "from-camera"), + handler: () => { + this.takePicture(this.cameraController.PictureSourceType.CAMERA); + } + }, + + { + text: this.ts.trPK("itemforsale", "from-icloud"), + handler: () => { + this.takePicture(this.cameraController.PictureSourceType.PHOTOLIBRARY); + } + }, + { + text: this.ts.trPK("general", "cancel"), + role: "cancel" + } + ] + }); + this.isActionSheetShown = true; + await this.actionSheet.present(); } - public openFile() { - const fileInput = this.getFileElement(); - fileInput.click(); + public takePictureiOS() { + const options: CameraOptions = { + quality: 60, + sourceType: this.cameraController.PictureSourceType.PHOTOLIBRARY, + destinationType: this.cameraController.DestinationType.DATA_URL, + encodingType: this.cameraController.EncodingType.JPEG, + mediaType: this.cameraController.MediaType.PICTURE, + correctOrientation: true, + } + this.cameraController.getPicture(options).then((imageData) => { + const data = "data:image/jpeg;base64," + imageData; + this.pushFiles(this.getFileName(), data); + }, (err) => { + }); } + public deleteFiles(index: number) { this.inputFiles.splice(index, 1); - this.fileSelected.emit( { + this.fileSelected.emit({ name: null, - data: '', + data: "", inputFiles: this.inputFiles }); + this.errorMsg = null; + } + public switchOptions($event) { + this.selectedOpn = $event; + } + public takePicture(sourceType: PictureSourceType) { + const options: CameraOptions = { + quality: 50, + destinationType: this.cameraController.DestinationType.DATA_URL, + encodingType: this.cameraController.EncodingType.JPEG, + sourceType: sourceType, + mediaType: this.cameraController.MediaType.PICTURE, + correctOrientation: true + }; + if (sourceType === this.cameraController.PictureSourceType.PHOTOLIBRARY) { + if (this.platform.is('android')) { + this.fileChooser + .open() + .then(uri => { + this.readFile(uri); + }) + .catch(e => { }); + } else { + this.iOSfilePicker.pickFile(['public.content']).then(uri => { + + let correctPath = uri.substr(0, uri.lastIndexOf('/') + 1); + let currentName = uri.substring(uri.lastIndexOf('/') + 1); + this.nativePath = uri; + + this.file.readAsDataURL("file:///" + correctPath, currentName).then(result => { + this.pushFiles(currentName, result); + }).catch(e => { }); + }).catch(e => { }); + } + } else { + this.cameraController.getPicture(options).then(imageData => { + const data = "data:image/jpeg;base64," + imageData; + this.pushFiles(this.getFileName(), data); + }); + } + } + pushFiles(name, files) { + this.ngzone.run(() => { + if (this.multiupload) { + this.inputFiles.push({ name: name, data: files }); + } else { + this.inputFiles = [{ name: name, data: files }]; + } + this.fileSelected.emit({ + name: name, + data: files, + inputFiles: this.inputFiles + }); + }); + } + readFile(fileUrl: any) { + this.filePath.resolveNativePath(fileUrl).then(filePathResult => { + this.nativePath = filePathResult; + this.file.resolveLocalFilesystemUrl(this.nativePath).then(entry => { + entry.getMetadata(metadata => { + if (metadata.size <= this.maxFileSize) { + this.errorMsg = null; + this.encodeFiles(entry); + } else { + this.errorMsg = this.ts.trPK("general", "large-file"); + } + }, (error) => { + console.log(error) + }); + }); + }); + } + getImgContent(imgFile): SafeUrl { + console.log(imgFile); + return this.sanitizer.bypassSecurityTrustUrl(imgFile); + } + + checkDuplicate(name: string) { + return this.inputFiles.filter(a => { + return a.name === name; + }); + } + encodeFiles(entry) { + let fileName = entry.nativeURL.split('/').pop(); + let path = entry.nativeURL.substring(0, entry.nativeURL.lastIndexOf("/") + 1); + + this.file.readAsDataURL(path, fileName) + .then(base64File => { + }) + .catch((err) => { + console.log('Error reading file', err); + }) + this.base64.encodeFile(this.nativePath).then( + (base64File: string) => { + const type = this.nativePath.substr( + this.nativePath.lastIndexOf(".") + 1 + ); + if (this.allowdType.includes(type.toLowerCase())) { + if (this.checkDuplicate(entry.name).length === 0) { + this.pushFiles(entry.name, base64File); + this.errorMsg = null; + } else { + this.errorMsg = this.ts.trPK("general", "file-name-exist"); + } + } else { + this.attachmentData = null; + this.errorMsg = this.ts.trPK("general", "not-supported"); + } + }, + err => { + console.log(err); + } + ); + } + getFileName() { + const date = new Date().valueOf(); + let text = ""; + const possibleText = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + for (let i = 0; i < 5; i++) { + text += possibleText.charAt( + Math.floor(Math.random() * possibleText.length) + ); + } + const imageName = date + "." + text + ".jpeg"; + return imageName; } } diff --git a/Mohem/src/app/hmg-common/ui/generic-header/generic-header.component.html b/Mohem/src/app/hmg-common/ui/generic-header/generic-header.component.html index 7d62b3c5..40d6516a 100644 --- a/Mohem/src/app/hmg-common/ui/generic-header/generic-header.component.html +++ b/Mohem/src/app/hmg-common/ui/generic-header/generic-header.component.html @@ -30,6 +30,22 @@ -->
+ +
+ +
+
+ + +
+ +
+
+ +
+ +
+
\ No newline at end of file diff --git a/Mohem/src/app/hmg-common/ui/generic-header/generic-header.component.scss b/Mohem/src/app/hmg-common/ui/generic-header/generic-header.component.scss index a8495839..60f1d786 100644 --- a/Mohem/src/app/hmg-common/ui/generic-header/generic-header.component.scss +++ b/Mohem/src/app/hmg-common/ui/generic-header/generic-header.component.scss @@ -23,4 +23,8 @@ } .header-toolbar-new { --background: #269DB8; +} +.setting-conatainer{ + height: 40px !important; + width: 40px !important; } \ No newline at end of file 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 75dc2703..404710f4 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 @@ -1,5 +1,11 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; +import { ModalController } from '@ionic/angular'; +import { WorklistSettingComponent } from 'src/app/notification/worklist-setting/worklist-setting.component'; import { CommonService } from '../../services/common/common.service'; +import { DashboredService } from '../../services/dashbored/dashbored.service'; +import { PerformanceAppraisalResponse } from '../../services/dashbored/performance-appraisal.response'; +import { SharedDataService } from '../../services/shared-data-service/shared-data.service'; +import { TranslatorService } from '../../services/translator/translator.service'; @Component({ selector: 'app-generic-header', @@ -16,10 +22,21 @@ export class GenericHeaderComponent implements OnInit { @Input() updateDirection = false; @Input() headerText = ''; @Input() backLink: string; + @Input() worklistSetting = false; + @Input() performanceEvaluation = false; + @Input() subordinateLeave = false; @Output() trigger = new EventEmitter(); + public appraisalArr: any = []; + public performanceData: any = []; + public close = 'assets/imgs/cancel.png'; - constructor(public common: CommonService) { } + constructor( + public common: CommonService, + public DS: DashboredService, + public sharedData: SharedDataService, + public ts: TranslatorService, + public modalController: ModalController) { } ngOnInit() { if (this.updateDirection) { @@ -35,4 +52,47 @@ export class GenericHeaderComponent implements OnInit { this.trigger.emit(); } + async openNotifictionSetting() { + // const modal = await this.modalController.create({ + // component: WorklistSettingComponent, + // cssClass: 'app-update-modal-css', + // }); + // return await modal.present(); + this.common.openWorklistSettingsPage(); + } + + + public openPerormance() { + this.showPerformanceAppraisal(); + } + + public showPerformanceAppraisal() { + this.DS.getPerformanceAppraisal(() => { + this.showPerformanceAppraisal(); + }).subscribe((result: PerformanceAppraisalResponse) => { + this.handlePerformanceAppraisalResult(result); + }); + } + + private handlePerformanceAppraisalResult(result) { + if (this.common.validResponse(result)) { + if (this.common.hasData(result.GetPerformanceAppraisalList)) { + this.appraisalArr = result.GetPerformanceAppraisalList; + this.performanceData = []; + for (let i = 0; i < this.appraisalArr.length; i++) { + this.performanceData.push({ name: this.appraisalArr[i].APPRAISAL_YEAR, value: parseInt(this.appraisalArr[i].APPRAISAL_SCORE).toFixed() }); + } + console.log('PerformanceAppraisalResponse'); + this.sharedData.setSharedData(this.performanceData, PerformanceAppraisalResponse.PERFORMANCE_DATA); + this.common.openPerformanceevaluation(); + } else { + let msg: string = this.ts.trPK("userProfile", "no-appraisal"); + this.common.presentAlert(msg); + } + } + } + + public openSubordinateLeavePage() { + this.common.openSubordinateLeavePage(); + } } diff --git a/Mohem/src/app/hmg-common/ui/smsdialog/smsdialog.page.ts b/Mohem/src/app/hmg-common/ui/smsdialog/smsdialog.page.ts index 24cc3e4f..64e9872c 100644 --- a/Mohem/src/app/hmg-common/ui/smsdialog/smsdialog.page.ts +++ b/Mohem/src/app/hmg-common/ui/smsdialog/smsdialog.page.ts @@ -18,57 +18,56 @@ import { AlertController } from '@ionic/angular'; styleUrls: ['./smsdialog.page.scss'], }) export class SmsdialogPage implements OnInit { - public timeInSeconds : number ; - public time : number; - public runTimer : boolean; + public timeInSeconds: number; + public time: number; + public runTimer: boolean; public static SHARED_DATA = 'h2o-login-details'; - public hasStarted : boolean; + public hasStarted: boolean; public countryCode: CountryCode; - public hasFinished : boolean; - public remainingTime : number; - public displayTime : string = ""; + public hasFinished: boolean; + public remainingTime: number; + public displayTime: string = ""; // public userData: UserDetailsModel; - public mobile : string; - public country_code : string; - public id : string; - public MobileNumber : string; - public token : string; - public resend : boolean = false; - public smc_code : any; + public mobile: string; + public country_code: string; + public id: string; + public MobileNumber: string; + public token: string; + public resend: boolean = false; + public smc_code: any; constructor(public cs: CommonService, public ts: TranslatorService, public alertController: AlertController, public smsService: SmsReaderService, public sharedData: SharedDataService, - private modalCtrl:ModalController, + private modalCtrl: ModalController, // private navParams: NavParams, - public smsservice: SMSDialogService) { - // this.country_code = this.navParams.get("c_code"); - // this.MobileNumber = this.navParams.get('mobile'); - // this.mobile = this.navParams.get('mobile'); - // this.id = this.navParams.get('id'); - // this.smsservice.sendActivationCode(this.id, this.mobile, - // this.country_code, () => { }, - // this.ts.trPK('general', 'ok')).subscribe((result: SendValidationResponse) => { - // if (this.cs.validResponse(result)) { - // if (result.isSMSSent) { - // this.token = result.LogInTokenID; - // this.initTimer(); - // this.startTimer(); - // } else { - // this.stopSMSMonitoring(); - // } - // } else { - // this.stopSMSMonitoring(); - // } - // }); - } + public smsservice: SMSDialogService) { + // this.country_code = this.navParams.get("c_code"); + // this.MobileNumber = this.navParams.get('mobile'); + // this.mobile = this.navParams.get('mobile'); + // this.id = this.navParams.get('id'); + // this.smsservice.sendActivationCode(this.id, this.mobile, + // this.country_code, () => { }, + // this.ts.trPK('general', 'ok')).subscribe((result: SendValidationResponse) => { + // if (this.cs.validResponse(result)) { + // if (result.isSMSSent) { + // this.token = result.LogInTokenID; + // this.initTimer(); + // this.startTimer(); + // } else { + // this.stopSMSMonitoring(); + // } + // } else { + // this.stopSMSMonitoring(); + // } + // }); + } ngOnInit() { } - closeModal() - { + closeModal() { this.modalCtrl.dismiss(); } @@ -77,8 +76,8 @@ export class SmsdialogPage implements OnInit { } initTimer() { - if (!this.timeInSeconds) { - this.timeInSeconds = 60; + if (!this.timeInSeconds) { + this.timeInSeconds = 60; } this.time = this.timeInSeconds; this.runTimer = false; @@ -87,22 +86,22 @@ export class SmsdialogPage implements OnInit { this.remainingTime = this.timeInSeconds; this.displayTime = this.getSecondsAsDigitalClock(this.remainingTime); } - + startTimer() { this.runTimer = true; this.hasStarted = true; this.resend = false; this.timerTick(); } - + pauseTimer() { this.runTimer = false; } - + resumeTimer() { this.startTimer(); } - + timerTick() { setTimeout(() => { if (!this.runTimer) { return; } @@ -117,7 +116,7 @@ export class SmsdialogPage implements OnInit { } }, 1000); } - + getSecondsAsDigitalClock(inputSeconds: number) { var sec_num = parseInt(inputSeconds.toString(), 10); // don't forget the second param var hours = Math.floor(sec_num / 3600); @@ -132,13 +131,12 @@ export class SmsdialogPage implements OnInit { return minutesString + ':' + secondsString; } - validate() - { + validate() { this.checkSMSActivationCode(this.smc_code); } public presentSMSPasswordDialog() { - + } async presentAlert() { @@ -153,21 +151,20 @@ export class SmsdialogPage implements OnInit { private checkSMSActivationCode(smsCode: string) { this.smsservice.validateActivationCode(this.token, smsCode, - () => {}, this.ts.trPK('settings', 'incorrect_otp')).subscribe((result: Response) => { - if (this.cs.validResponse(result)) { - this.stopSMSMonitoring(); - this.modalCtrl.dismiss(); - SMSDialogService.modal_success = true; - } - }); + () => { }, this.ts.trPK('settings', 'incorrect_otp')).subscribe((result: Response) => { + if (this.cs.validResponse(result)) { + //this.stopSMSMonitoring(); + this.modalCtrl.dismiss(); + SMSDialogService.modal_success = true; + } + }); } public stopSMSMonitoring() { - this.smsService.stopSMSMonitoring(); + this.smsService.stopSMSMonitoring(); } - public ResendOTP() - { + public ResendOTP() { // this.smsservice.sendActivationCode(this.id, this.mobile, // this.country_code, () => { }, // this.ts.trPK('general', 'ok')).subscribe((result: SendValidationResponse) => { diff --git a/Mohem/src/app/hmg-common/ui/stats-button/stats-button.component.scss b/Mohem/src/app/hmg-common/ui/stats-button/stats-button.component.scss index 0663997a..6895ceb4 100644 --- a/Mohem/src/app/hmg-common/ui/stats-button/stats-button.component.scss +++ b/Mohem/src/app/hmg-common/ui/stats-button/stats-button.component.scss @@ -53,3 +53,13 @@ width: 100px; height: 70px; } + +.loader { + position: absolute; + width: 100%; + top: 70px; + left: 2px; + img { + width: 25px; + } +} diff --git a/Mohem/src/app/home/home.page.html b/Mohem/src/app/home/home.page.html index b323351c..f189e43a 100644 --- a/Mohem/src/app/home/home.page.html +++ b/Mohem/src/app/home/home.page.html @@ -10,6 +10,9 @@ +
+ +
{{'general,other-services' | translate}} - + diff --git a/Mohem/src/app/home/home.page.scss b/Mohem/src/app/home/home.page.scss index ba5d461a..f74783fe 100644 --- a/Mohem/src/app/home/home.page.scss +++ b/Mohem/src/app/home/home.page.scss @@ -156,3 +156,14 @@ ion-label{ // text-transform: uppercase; // } // } + + +.loader { + position: absolute; + width: 100%; + top: 70px; + left: 2px; + img { + width: 25px; + } +} \ No newline at end of file diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index 0a882f0f..98b422d6 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -11,6 +11,7 @@ import { Geolocation } from '@ionic-native/geolocation/ngx'; import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx'; import { Device } from '@ionic-native/device/ngx'; import { attendanceSwipeScannerRequest } from './models/attendanceSwipe.Request'; +import { COCRequest } from 'src/app/notification/models/COCRequest'; import { Response } from 'src/app/hmg-common/services/models/response'; import { AttendanceService } from './services/attendance.services'; import { LoginRequest } from '../hmg-common/services/authentication/models/login.request'; @@ -41,7 +42,9 @@ import { NFC, Ndef } from "@ionic-native/nfc/ngx" import { DigitalIdComponent } from '../authentication/digital-id/digital-id.component'; import { FirebaseX } from '@ionic-native/firebase-x/ngx'; import { BusinessCardComponent } from "src/app/authentication/business-card/business-card.component"; - +import * as moment from "moment"; +import { count } from 'console'; +import { HomeComponent } from "src/app/notification/home/home.component"; @Component({ selector: 'app-home', templateUrl: './home.page.html', @@ -68,6 +71,7 @@ export class HomePage implements OnInit { public showVcationRule = false; public isFakeLocationUsed = false; public intervalCountdown: any; + public showLoader = true; public statsButtons = [ { title: this.ts.trPK('attendance-tracking', 'title'), @@ -192,11 +196,11 @@ export class HomePage implements OnInit { spaceBetween: 10 }; this.slideOptsTwo = { - slidesPerView: width > 320 ? 3.2 : 2.5, - spaceBetween: width > 320 ? 10 : 5 + slidesPerView: width > 320 ? 3.2 : 2.5, + spaceBetween: width > 320 ? 10 : 5 }; this.showStaticServices = true; -} + } ionViewWillEnter() { this.common.startLoading(); this.slideSettingsTwo(); @@ -369,10 +373,18 @@ export class HomePage implements OnInit { callDashboardServices() { this.getMenu(); this.setServicesPrivilage(); - this.openNotificationsDashbored(); + if (this.common.getTotalNumberOfWorklistRequest()) { + this.statsButtons[1].statsValue = this.common.getTotalNumberOfWorklistRequest(); + this.showLoader = false; + } else { + this.openNotificationsDashbored(); + } + this.showOpenMissingSwipes(); this.showAttendanceTracking(); - this.getAccrualBalance(); + var accrualBalance = this.common.sharedService.getSharedData('leaveAccrualBalance', false); + if (!accrualBalance) + this.getAccrualBalance(); } public Vacation_Rule() { @@ -408,6 +420,7 @@ export class HomePage implements OnInit { selMenu.List_Menu = item; selMenu.userid = this.userData.EMPLOYEE_NUMBER; this.common.sharedService.setSharedData(selMenu, MenuResponse.SHARED_DATA); + this.common.sharedService.setSharedData(this.menuList, MenuResponse.MENU_LIST); this.getMenuEntries(item); // tslint:disable-next-line: prefer-for-of for (let i = 0; i < this.menuList.length; i++) { @@ -657,14 +670,64 @@ export class HomePage implements OnInit { result, 'worklistNotifications' ); + this.common.setFilterValues(result['GetOpenNotificationsList']); + } else { + this.showLoader = false; + this.common.stopLoading(); } + }, (error) => { + this.showLoader = false; + this.common.stopLoading(); }); } ITGCountAllNotification() { this.workListService.getITGDetails('', '', this.isPostNoLoad).subscribe((result: any) => { - this.statsButtons[1].statsValue = - Math.floor(this.countAllNotification + result.TotalCount); + if (this.common.validResponse(result)) { + this.common.sharedService.setSharedData(result, MenuResponse.ITG_COUNTS); + this.common.filterKeys['ITG'] = result.TotalCount; + this.statsButtons[1].statsValue = Math.floor(this.countAllNotification + result.TotalCount); + this.common.sharedService.setSharedData(this.statsButtons[1].statsValue, 'total-count'); + this.getCOCNotificationCount(); + this.common.stopLoading(); + } else { + this.showLoader = false; + this.common.stopLoading(); + } + }, (error) => { + this.showLoader = false; + this.common.stopLoading(); + }); + } + + getCOCNotificationCount() { + const request = new COCRequest(); + request.ItgPageSize = 1; + request.ItgPageNo = 1; + request.Date = moment(new Date()).format("YYYY-MM-DD"); + + this.workListService.getCOCCount(request, '', '', this.isPostNoLoad).subscribe((result: any) => { + console.log(result); + if (this.common.validResponse(result)) { + const countResult = result.Mohemm_ITG_Pending_Task_ResponseItem; + const totalCount = countResult.escalation + countResult.waitingToClose + countResult.waitingForAcceptance + countResult.extendTATRequest; + this.common.filterKeys['COC'] = totalCount; + + + this.statsButtons[1].statsValue = Math.floor(this.statsButtons[1].statsValue + totalCount); + + this.common.sharedService.setSharedData(this.statsButtons[1].statsValue, 'total-count'); + + this.showLoader = false; + this.common.stopLoading(); + } else { + this.showLoader = false; + this.common.stopLoading(); + } + + + }, (error) => { + this.showLoader = false; this.common.stopLoading(); }); } @@ -749,7 +812,7 @@ export class HomePage implements OnInit { totalTicketsLeft = totalTicketsLeft + accrualBalance.ACCRUAL_NET_ENTITLEMENT; } } - this.statsButtons[4].statsValue = Number(totalTicketsLeft.toFixed(2)); + this.statsButtons[4].statsValue = Number(totalTicketsLeft.toFixed(2)); } }); } @@ -769,7 +832,8 @@ export class HomePage implements OnInit { // this.getDeviceLocation(); this.showAttendanceOptions(); // tslint:disable-next-line: triple-equals - } else if (link == '1') { + } else if (link == '1' && this.showLoader === false) { + this.common.sharedService.setSharedData(this.statsButtons[1].statsValue, 'total-count'); this.common.startLoading(); this.common.openNotificationPage(); // tslint:disable-next-line: triple-equals @@ -795,14 +859,14 @@ export class HomePage implements OnInit { async openBusinessCard() { const modal = await this.modalController.create({ component: BusinessCardComponent, - cssClass: 'digital-id-modal-css' + cssClass: 'business-card-modal-css' }); return await modal.present(); } itemForSale() { - this.common.navigateForward('/itemforsale/items'); + this.common.openItemForSale(); } offersDiscount() { this.common.navigateForward('/offersdiscount/home'); diff --git a/Mohem/src/app/home/wifi-model/wifi-modal.component.ts b/Mohem/src/app/home/wifi-model/wifi-modal.component.ts index cd90f7ce..a7b722b4 100644 --- a/Mohem/src/app/home/wifi-model/wifi-modal.component.ts +++ b/Mohem/src/app/home/wifi-model/wifi-modal.component.ts @@ -55,6 +55,13 @@ export class WifiModalComponent implements OnInit { }, 1000); } + + + async getConnectedBSSID(ssid:string){ + let avaialbleSSID = await this.wifiWizard2.getConnectedBSSID(); + console.log(avaialbleSSID); + } + async startWifiConnection() { const isAndroid = this.platform.is("android"); const isIOS = this.platform.is("ios"); diff --git a/Mohem/src/app/itemforsale/filter/filter.component.html b/Mohem/src/app/itemforsale/filter/filter.component.html new file mode 100644 index 00000000..0e0d674c --- /dev/null +++ b/Mohem/src/app/itemforsale/filter/filter.component.html @@ -0,0 +1,31 @@ + + + +
+ + + + {{key.title}} + + + {{key.title_Ar}} + + +
+
+
+
+ + +
+ + {{ts.trPK('general','apply-filters')}} + +
+
+
\ No newline at end of file diff --git a/Mohem/src/app/itemforsale/filter/filter.component.scss b/Mohem/src/app/itemforsale/filter/filter.component.scss new file mode 100644 index 00000000..2375e2ef --- /dev/null +++ b/Mohem/src/app/itemforsale/filter/filter.component.scss @@ -0,0 +1,38 @@ +ion-label{ + font-size: 14px !important; +} +ion-thumbnail img{ + width: 40px; + height: 40px; + margin: 10px; +} +.active::before{ + position: absolute; + right: 10px; + top: 15px; + padding: 0px; + background: #3cc353; + padding: 3px 2px 1px 3px; + border-radius: 60%; + font-size: 12px; + color: #fff; + content: '✓'; + width: 20px; + height: 20px; + text-align: center; + z-index: 2; +} +ion-item{ + border-bottom: 1px solid #ccc; + --padding-start: 0px; + margin: 0 20px 4px 20px; +} + +.footer-button{ + background: var(--newgreen)!important;border-radius: 10px; --background: transparent; + width: 80%; +} +ion-footer{ + position: fixed; + bottom: 0; +} \ No newline at end of file diff --git a/Mohem/src/app/itemforsale/filter/filter.component.spec.ts b/Mohem/src/app/itemforsale/filter/filter.component.spec.ts new file mode 100644 index 00000000..ff6002ba --- /dev/null +++ b/Mohem/src/app/itemforsale/filter/filter.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FilterComponent } from './filter.component'; + +describe('FilterComponent', () => { + let component: FilterComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ FilterComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(FilterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/itemforsale/filter/filter.component.ts b/Mohem/src/app/itemforsale/filter/filter.component.ts new file mode 100644 index 00000000..ddfdc0ce --- /dev/null +++ b/Mohem/src/app/itemforsale/filter/filter.component.ts @@ -0,0 +1,56 @@ +import { AfterViewInit, Component, OnInit } from '@angular/core'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { ModalController } from '@ionic/angular'; +import { OfferDiscountService } from 'src/app/offersdiscount/services/service'; +import { ItemForSaleService } from '../services/service.service'; +@Component({ + selector: 'app-filter', + templateUrl: './filter.component.html', + styleUrls: ['./filter.component.scss'], +}) +export class FilterComponent implements AfterViewInit { + + segment: any = '1'; + categoriesObj: any; + categories: any = []; + offersData: any = []; + activeClass: any; + tempSearch: any = []; + searchText: String; + public activeKey = {} + direction: any; + + constructor(public ts: TranslatorService, public modalController: ModalController, public cs: CommonService, public offersService: OfferDiscountService) { } + + ngAfterViewInit(): void { + this.direction = TranslatorService.getCurrentDirection(); + this.categories = this.cs.sharedService.getSharedData(OfferDiscountService.categories, false); + + + // this.getOfferDiscount(); + } + + + openDetails(offer) { + // this.cs.sharedService.setSharedData(offer, OfferDiscountService.selected_offers); + + // var related = this.offersData.filter((res) => res.rowID != offer.rowID); + // this.cs.sharedService.setSharedData(related, OfferDiscountService.related_offers); + + // this.cs.navigateForward('/offersdiscount/offer-details'); + } + + + filterOffers(key) { + this.activeKey = key + this.activeClass = key.title; + + } + + + applyFilters() { + this.cs.sharedService.setSharedData(this.activeKey, ItemForSaleService.selected_filters); + this.cs.back(); + } +} diff --git a/Mohem/src/app/itemforsale/home/home.component.html b/Mohem/src/app/itemforsale/home/home.component.html index 4086bfe6..0c53582e 100644 --- a/Mohem/src/app/itemforsale/home/home.component.html +++ b/Mohem/src/app/itemforsale/home/home.component.html @@ -22,7 +22,7 @@
{{ts.trPK('itemforsale','select-category')}}
{{ts.trPK('itemforsale','completed')}}
-
+
@@ -34,7 +34,7 @@
{{ts.trPK('itemforsale','add-details')}}
-
{{step >2 ? "Completed" : "Locked"}}
+
{{step >2 ? ts.trPK('itemforsale','completed') :ts.trPK('itemforsale','locked')}}
@@ -42,9 +42,9 @@
{{ts.trPK('itemforsale','review-sell')}}
-
{{step >3 ? "Completed" : "Locked"}}
+
{{step >3 ? ts.trPK('itemforsale','completed') : ts.trPK('itemforsale','locked')}}
- + @@ -53,85 +53,34 @@
-

What are you offering?

+

{{ts.trPK('itemforsale','offering')}}

- -
+ +
- +
-

Mobile & Tablets

+

{{category.title}}

+

{{category.title_Ar}}

- - -
-
- -
-
-

Cars & Vehicles

-
-
-
- -
-
- -
-
-

Electronic Applicance

-
-
+ - - - -
-
- -
-
-

Furniture & Home Decor

-
-
-
- -
-
- -
-
-

Fashion & beauty

-
-
-
- -
-
- -
-
-

Books, Sports & Hobbies

-
-
-
-
- +
-

Add Details

+

{{ts.trPK('itemforsale','add-details')}}

-

Item Info

+

{{ts.trPK('itemforsale','item-info')}}

- +
@@ -142,77 +91,63 @@ - + -

Item Condition

- - - - +

{{ts.trPK('itemforsale','item-condition')}}

+ - New + {{ts.trPK('itemforsale','new')}} - Used + {{ts.trPK('itemforsale','used')}}
- + + +

{{ts.trPK('itemforsale','region')}}

+ + {{region.regionName}} + + +
+
-

Item Price

+

{{ts.trPK('itemforsale','item-price')}}

- +
-

Item Photos

+

{{ts.trPK('itemforsale','item-photos')}}

- - -
-
-
X
- -
- -
-
- -
-
-
X
- +
+
+ + + +
- -
- - -
-
- - -
- +
-
- - - - +
@@ -222,25 +157,48 @@
-

Furniture Table

+

+ {{selectedCategory.title_Ar}} +

+

+ {{selectedCategory.title}} +

+ - +

{{itemInfo}}

- Consectetur adipiscing elit. Donec blandit diam nulla, non euismod eros efficitur imperdiet. Fusce erat enim, volutpat at enim in, venenatis iaculis risus. + {{itemDescription}}

-

Used

+

{{itemCondition}}

- - + + + + + + +
+
+ + +
+ +
+
+ +
+
+
+
- Selling for

500 SAR

+ {{ts.trPK('itemforsale','selling-for')}}

{{itemPrice}} SAR

- +
@@ -250,8 +208,8 @@
- - cancel + + {{ts.trPK('general','cancel')}}
@@ -260,13 +218,16 @@
- - cancel - + + {{ts.trPK('general','cancel')}} + {{ts.trPK('general','next')}} - - Confirm + + {{ts.trPK('general','confirm')}} + + {{ts.trPK('general','update')}} +
diff --git a/Mohem/src/app/itemforsale/home/home.component.scss b/Mohem/src/app/itemforsale/home/home.component.scss index da69d29b..ff52efa4 100644 --- a/Mohem/src/app/itemforsale/home/home.component.scss +++ b/Mohem/src/app/itemforsale/home/home.component.scss @@ -117,6 +117,10 @@ margin-left:0px margin-right: 0px; left: 40%; } +.md-stepper-horizontal .md-step .md-step-bar-right { + margin-right: 0px; + right: 40%; +} .orange .md-step-bar-left { background:#CC9B14 !important; font-weight: bold; @@ -214,7 +218,7 @@ margin-bottom: 70px; background: #fff; margin: 15px; padding: 10px; - box-shadow: 3px 4px 3px -1px #ccc; + box-shadow: 0px 0px 2px 1px #ccc; border-radius: 20px; } .add-details ion-item{ @@ -246,7 +250,7 @@ position: relative; right: 0; font-size: 14px; color: #fff; - top: -15px; + top: -10px; right: -10px; font-weight: bolder; background: red; @@ -341,3 +345,57 @@ ion-footer{ position: absolute; top: 15px; } +.upload-container{ + display: inline-block; +} +@media screen and (min-width: 325px){ + .fileUpload { + position: relative; + overflow: hidden; + margin: 10px; + + }} + @media screen and (min-width: 1px) and (max-width:320px){ + .fileUpload { + position: relative; + overflow: hidden; + margin: 10px; + + + }} + + .fileUpload input.upload { + position: absolute; + top: 0; + right: 0; + margin: 0; + padding: 0; + font-size: 20px; + cursor: pointer; + opacity: 0; + filter: alpha(opacity=0); + } + + .iconButton .imgSize{ + width: 10px !important; + height: 10px; + } +.close-btn{ + color: red; + font-size: 22px; + position: relative; + top: 5px; +} +ion-radio{ + border: 1px solid; + border-radius: 5px; + color: gray; + height: 20px; + width: 21px; + margin-top: 5px; + +} +.sale-icon .top-icon{ + position: relative; + margin: 5px 8px; +} \ No newline at end of file diff --git a/Mohem/src/app/itemforsale/home/home.component.ts b/Mohem/src/app/itemforsale/home/home.component.ts index ace51a36..bdff62ff 100644 --- a/Mohem/src/app/itemforsale/home/home.component.ts +++ b/Mohem/src/app/itemforsale/home/home.component.ts @@ -1,6 +1,10 @@ import { Component, OnInit } from '@angular/core'; +import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; +import { FileUploader } from 'ng2-file-upload'; +import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { ItemForSaleService } from '../services/service.service'; @Component({ selector: 'app-home', @@ -9,19 +13,303 @@ import { TranslatorService } from 'src/app/hmg-common/services/translator/transl }) export class HomeComponent implements OnInit { step: any = 1; - constructor(public ts: TranslatorService, public cs: CommonService,) { } + categories: any = []; + direction: string; + uploaded: any = []; + public selectedFile: any; + indexLastObj: any = 0; + addAttachRequest: any = []; + selectedPicture = []; + selectedCategory: any; + filterAllowedType: any = [ + "image/jpeg", + "image/png", + "image/jpg", + ]; + itemInfo: string; + itemDescription: string; + itemCondition: string; + itemPrice: any; + regions: any = []; + regionID: any = 1; + editItem: any; + constructor(public ts: TranslatorService, private authService: AuthenticationService, private sanitizer: DomSanitizer, public cs: CommonService, private itemService: ItemForSaleService) { } - ngOnInit() { } + ngOnInit() { + this.direction = TranslatorService.getCurrentDirection(); + this.categories = this.cs.sharedService.getSharedData(ItemForSaleService.CATEGORIES, false); + this.categories.shift(); + this.getRegion(); + this.editItem = this.cs.sharedService.getSharedData(ItemForSaleService.EDIT_ITEMS); + if (this.editItem) { + this.setEditPage(); + } + } + getRegion() { + this.itemService.getRegion({}, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { + this.regions = this.itemService.parser(result); + console.log(this.regions); + }) + } openItem() { - - this.cs.navigateForward('/itemforsale/items'); } - nextStep() { + nextStep(category) { + this.selectedCategory = category; this.step = 2; } openMyAds() { this.cs.navigateForward('/itemforsale/my-ads'); } + onFileSelectedclick(event) { + event.target.value = ''; + } + public uploader: FileUploader = new FileUploader({ + allowedMimeType: [ + "image/jpeg", + "image/png", + "image/jpg", + ], + maxFileSize: 10 * 1024 * 1024, + formatDataFunctionIsAsync: true, + formatDataFunction: async item => { + return new Promise((resolve, reject) => { + resolve({ + name: item._file.name, + length: item._file.size, + contentType: item._file.type, + date: new Date() + }); + }); + } + }); + + + + + // onFileSelected(input) { + // if (!(this.filterAllowedType.indexOf(input.target.files[0].type) > -1)) { + // let msg: string = ""; + // msg = this.ts.trPK("general", "notSupportFile"); + // this.cs.presentAlert(msg); + // return; + // } // todo: show alert that you tried uploading wrong files + // else { + // const file = input.target.files[0]; + // this.selectedFile = input.target.files; + + + // this.getBase64(file).then(data => + // this.pushObject(data, file.name, file.type) + // ); + // } + // } + + // getBase64(file) { + // return new Promise((resolve, reject) => { + // const reader = new FileReader(); + // reader.readAsDataURL(file); + // reader.onload = () => resolve(reader.result); + // reader.onerror = error => reject(error); + // }); + // } + + // pushObject(fileData, name, type) { + + // this.indexLastObj++; + // try { + // let array = name.split("."); + // let attachType: string = array[array.length - 1]; + + // this.addAttachRequest.push({ + // AttachmentID: this.indexLastObj, + // ContentType: 'image/' + attachType, //type.split('/')[1], + // Base64Data: fileData.split(",")[1], + // FileName: name, //.split('.')[0], + + // }); + // } catch (e) { } + // } + + removeFile(objectitem) { + + let objIndex = this.addAttachRequest.findIndex( + item => item.AttachmentID == objectitem.AttachmentID + ); + this.addAttachRequest.splice(objIndex, 1); + } + getImgContent(imgFile): SafeUrl { + + return this.sanitizer.bypassSecurityTrustUrl(imgFile); + } + + createItemForSale() { + + var authUser = this.authService.getAuthenticatedRequest(); + this.cs.startLoading(); + // var request = new FormData(); + // request.append('title', this.itemInfo); + // request.append('title_Ar', this.itemInfo); + // request.append('categoryID', this.selectedCategory.categoryID); + // request.append('description', this.itemDescription); + // request.append('description_Ar', this.itemDescription); + // request.append('employeeNumber', authUser.P_USER_NAME); + // request.append('quotePrice', this.itemPrice); + // request.append('isActive', 'true'); + // request.append('regionID', this.regionID); + // request.append('status', this.itemCondition); + // console.log(this.selectedFile); + // if (this.selectedFile && this.selectedFile !== undefined) { + // request.append('fileColl', this.addAttachRequest.toString()); + // } + // request.append('Channel', authUser.Channel.toString()); + // request.append('LogInToken', authUser.LogInTokenID); + // request.append('Token', authUser.TokenID); + // request.append('EmployeeNumber', authUser.P_USER_NAME); + // request.append('MobileNo', authUser.MobileNumber); + var request = { + "TokenID": authUser.LogInTokenID, "EmployeeNumber": authUser.P_USER_NAME, "ItgImageCollList": this.addAttachRequest, + "ItgTitle": this.itemInfo, + "ItgTitleAr": this.itemInfo, + "ItgCategoryID": this.selectedCategory.categoryID, + "ItgDescription": this.itemDescription, + "ItgDescriptionAr": this.itemDescription, + "ItgQuotePrice": this.itemPrice, + "RegionID": this.regionID, + "ItgIsActive": true, + "ItgStatus": this.itemCondition + } + + this.itemService.createItemForSale(request, () => { }, this.ts.trPK('general', 'retry')).subscribe((result: any) => { + if (this.cs.validResponse(result)) { + this.cs.stopLoading(); + + this.cs.greenToastPK("general", "success-create"); + this.openItem(); + } else { + this.cs.stopLoading(); + this.cs.redToastPK("general", "try-again"); + } + + + }) + } + setEditPage() { + this.step = 2; + this.selectedCategory = { + categoryID: this.editItem.categoryID, + title: this.editItem.categoryTitle, + title_Ar: this.editItem.categoryTitle + } + this.itemInfo = this.editItem.title; + this.itemDescription = this.editItem.description; + this.itemPrice = this.editItem.quotePrice; + this.regionID = this.editItem.regionID; + this.itemCondition = this.editItem.status.toLowerCase(); + this.selectedPicture = this.getAttachment(this.editItem.itemAttachments); + } + getAttachment(itemsArray) { + let item = []; + itemsArray.forEach(element => { + + item.push({ + // attachmentId: element.attachmentId, + // ContentType: element.contentType, + data: 'data:image/png;base64,' + element.content, + name: element.fileName, + + }); + }); + return item; + } + updateItemForSale() { + + var authUser = this.authService.getAuthenticatedRequest(); + this.cs.startLoading(); + var request = new FormData(); + request.append('itemSaleID', this.editItem.itemSaleID); + request.append('title', this.itemInfo); + request.append('title_Ar', this.itemInfo); + request.append('categoryID', this.selectedCategory.categoryID); + request.append('description', this.itemDescription); + request.append('description_Ar', this.itemDescription); + request.append('employeeNumber', authUser.P_USER_NAME); + request.append('quotePrice', this.itemPrice); + request.append('isActive', 'true'); + request.append('regionID', this.regionID); + request.append('status', this.itemCondition); + // console.log(this.selectedFile); + // if (this.selectedFile && this.selectedFile !== undefined) { + // request.append('fileColl', this.selectedFile[0], this.selectedFile[0].name); + // } + request.append('Channel', authUser.Channel.toString()); + request.append('LogInToken', authUser.LogInTokenID); + request.append('Token', authUser.TokenID); + request.append('EmployeeNumber', authUser.P_USER_NAME); + request.append('MobileNo', authUser.MobileNumber); + + + this.itemService.updateItemForSale(request, () => { }, this.ts.trPK('general', 'retry')).subscribe((result: any) => { + if (this.cs.validResponse(result)) { + this.cs.stopLoading(); + + this.cs.greenToastPK("general", "success-create"); + this.openItem(); + } else { + this.cs.stopLoading(); + this.cs.redToastPK("general", "try-again"); + } + + + }) + } + cancelItem() { + if (this.step == 2 || this.step == 3) { + this.step = 1; + } else { + this.cs.back(); + } + + } + validate() { + if (!this.validateChar(this.itemInfo) || !this.itemDescription || !this.itemPrice || !this.itemCondition || this.addAttachRequest.length == 0) { + return false; + } else { + return true; + } + } + validateChar(text) { + var regExp = /^[a-zA-Z]*$/ + if ((!regExp.test(text) && !this.hasArabicCharacters(text)) || !text) { + return false; + } + else { + return true; + } + } + hasArabicCharacters(text) { + var regex = new RegExp("[\u0600-\u06ff]|[\u0750-\u077f]|[\ufb50-\ufc3f]|[\ufe70-\ufefc]"); + return regex.test(text); + } + public attachmentSelected(event: any) { + try { + this.addAttachRequest = event.inputFiles.map((res: any) => { + let array = res.name.split("."); + let attachType: string = array[array.length - 1]; + this.indexLastObj++; + return { AttachmentID: this.indexLastObj, FileName: res.name, Base64Data: res.data.split(",")[1], ContentType: 'image/' + attachType }; + }); + + + + + + + + + + + } catch (e) { } + } } diff --git a/Mohem/src/app/itemforsale/item-details/item-details.component.html b/Mohem/src/app/itemforsale/item-details/item-details.component.html index add7aca6..279a4fc8 100644 --- a/Mohem/src/app/itemforsale/item-details/item-details.component.html +++ b/Mohem/src/app/itemforsale/item-details/item-details.component.html @@ -1,4 +1,4 @@ - +
-
+
- - - - Furniture Table + + + + + + + + {{itemDetails.title}} + {{itemDetails.title_Ar}} - Keep close to Nature's heart... and break clear away, once in awhile, - and climb a mountain or spend a week in the woods. Wash your spirit clean. + {{itemDetails.description}} + {{itemDetails.description_Ar}}
-

New

-

500 SAR

+

{{itemDetails.status}}

+

+ {{itemDetails.quotePrice}} {{itemDetails.currencyCode}} +

@@ -33,9 +41,9 @@ -

Mohammed Imran

-

Posted on 22 April 2020

-

View Profile

+

{{itemDetails.fullName}}

+

{{getDate(itemDetails.created) }}

+
@@ -50,14 +58,15 @@ \ No newline at end of file diff --git a/Mohem/src/app/itemforsale/item-details/item-details.component.scss b/Mohem/src/app/itemforsale/item-details/item-details.component.scss index bcd3e47a..6bcb6c6e 100644 --- a/Mohem/src/app/itemforsale/item-details/item-details.component.scss +++ b/Mohem/src/app/itemforsale/item-details/item-details.component.scss @@ -76,4 +76,9 @@ ion-footer{ margin: 0px; position: relative; left: -10px; +} +.icon-footer-ar{ + margin: 0px; + position: relative; + left: 5px; } \ No newline at end of file diff --git a/Mohem/src/app/itemforsale/item-details/item-details.component.ts b/Mohem/src/app/itemforsale/item-details/item-details.component.ts index cae7ea97..c5257bfb 100644 --- a/Mohem/src/app/itemforsale/item-details/item-details.component.ts +++ b/Mohem/src/app/itemforsale/item-details/item-details.component.ts @@ -1,15 +1,41 @@ import { Component, OnInit } from '@angular/core'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; - +import { ItemForSaleService } from '../services/service.service'; +import * as moment from 'moment'; +import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; +import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-item-details', templateUrl: './item-details.component.html', styleUrls: ['./item-details.component.scss'], }) export class ItemDetailsComponent implements OnInit { - constructor(public ts: TranslatorService, public cs: CommonService,) { } + itemDetails: any; + direction: any; + + constructor(public ts: TranslatorService, public itemService: ItemForSaleService, public route: ActivatedRoute, public cs: CommonService, private sanitizer: DomSanitizer,) { + this.route + .params.subscribe(val => { + setTimeout(() => { + this.ionEnter(); + }, 100); + }); + } + + ngOnInit() { + + } + ionEnter() { + this.direction = TranslatorService.getCurrentDirection(); + this.itemDetails = this.cs.sharedService.getSharedData(ItemForSaleService.ITEMS_SELECTED, false); - ngOnInit() { } + } + getDate(date) { + return moment(date, "YYYY-MM-DD HH:mm:ss").format("DD-MMM-YYYY"); + } + getImgContent(imgFile): SafeUrl { + return this.sanitizer.bypassSecurityTrustUrl(imgFile); + } } diff --git a/Mohem/src/app/itemforsale/itemforsale.module.ts b/Mohem/src/app/itemforsale/itemforsale.module.ts index 6a7aea24..7a868eb0 100644 --- a/Mohem/src/app/itemforsale/itemforsale.module.ts +++ b/Mohem/src/app/itemforsale/itemforsale.module.ts @@ -11,6 +11,8 @@ import { ItemsComponent } from './items/items.component'; import { ItemDetailsComponent } from './item-details/item-details.component'; import { MyAdsComponent } from './my-ads/my-ads.component'; import { HmgCommonModule } from '../hmg-common/hmg-common.module'; +import { ItemForSaleService } from './services/service.service'; +import { FilterComponent } from './filter/filter.component'; const routes: Routes = [ { @@ -32,6 +34,10 @@ const routes: Routes = [ { path: 'my-ads', component: MyAdsComponent + }, + { + path: 'filter', + component: FilterComponent } ], } @@ -45,6 +51,8 @@ const routes: Routes = [ HmgCommonModule, RouterModule.forChild(routes) ], - declarations: [ItemforsalePage, HomeComponent, ItemsComponent, ItemDetailsComponent, MyAdsComponent] + declarations: [ItemforsalePage, HomeComponent, ItemsComponent, ItemDetailsComponent, MyAdsComponent, FilterComponent], + providers: [ItemForSaleService], + }) export class ItemforsalePageModule { } diff --git a/Mohem/src/app/itemforsale/items/items.component.html b/Mohem/src/app/itemforsale/items/items.component.html index bab28e0c..e17dacd4 100644 --- a/Mohem/src/app/itemforsale/items/items.component.html +++ b/Mohem/src/app/itemforsale/items/items.component.html @@ -28,7 +28,7 @@ - + @@ -37,73 +37,49 @@

{{ts.trPK('itemforsale','browse-categories')}}

- +
-
-
-
- -
-
-

Mobile & Tablets

-
-
-
-
-
-
- -
-
-

Cars & Vehicle

-
-
-
-
-
-
- -
-
-

Electronic Appliance

-
-
-
-
-
-
- +
+
+
+
-

Fashion & Beauty

+

{{category.title}}

+

{{category.title_Ar}}

+
- - - +
+ +
+ + + - - - Furniture Table + + + {{item.title}} + {{item.title_Ar}} + - Keep close to Nature's heart... and break -

- Used -

+
{{getDotted(item.description, 60)}}
+
{{getDotted(item.description_Ar, 60)}}
+

{{item.status}}

- 500 SAR + {{item.quotePrice}} {{item.currencyCode}} @@ -114,62 +90,55 @@
- - - - + +
+ + + - Furniture Table - - - - Keep close to Nature's heart... and break -

- New -

- - - - 500 SAR - - - - - - - -
- - +
+

{{ts.trPK('general','empty')}}

+
+ + + +
- + - + + -

Furniture Table

-

- Posted on 24 April 2021 -

-

good condition only 6th month used

+

{{item.title}}

+

{{item.title_Ar}}

+ +

{{getDate(item.created) }}

+ +

{{getDotted(item.description, 30)}}

+

{{getDotted(item.description_Ar, 30)}}

-

Pending Review

+

{{item.status}}

+
- - + +
+
diff --git a/Mohem/src/app/itemforsale/items/items.component.scss b/Mohem/src/app/itemforsale/items/items.component.scss index bcba7e10..f8c6c061 100644 --- a/Mohem/src/app/itemforsale/items/items.component.scss +++ b/Mohem/src/app/itemforsale/items/items.component.scss @@ -7,9 +7,20 @@ background: #259CB8; top: 0; } +.no-dataDiv{ + position: absolute; + left: 0; + right: 0; + margin: auto; +} .header-toolbar{ --background: #259CB8 !important; } +.top{ + position: relative; + margin: 5px 10px; + +} .bottom{ height: 100%; width: 100%; @@ -51,7 +62,10 @@ margin-top: 5px; margin-bottom: 5px; margin-left: 5px; - font-size: 14px; + font-size: 12px; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; } .bottom-icon{ text-overflow: clip; @@ -69,7 +83,8 @@ ion-card-title{ font-weight: bold; font-size: 14px; - padding: 5px + padding: 5px; + height: 40px; } .orange{ color: #CC9B14; @@ -88,9 +103,9 @@ ion-card-content p{ font-weight: bold; } .my-ads ion-item{ - margin: 10px; + margin:0px 10px; --border-radius: 10px; - padding: 15px 10px 0px 10px; + padding: 10px 10px 0px 10px; width: 100%; } .my-ads ion-thumbnail img{ @@ -112,9 +127,10 @@ ion-segment-button{ } ion-segment-button ion-label{ padding: 0; - font-size: 16px; + font-size: 14px; white-space: normal; font-weight: bold; + line-height: 1.1; } .segment-button-checked ion-label{ color: #fff !important; @@ -132,6 +148,7 @@ ion-item h3{ color: #000; font-weight: bold; font-size: 14px; + margin-top:10px; } .yellow{ color:#CC9B14; @@ -145,6 +162,10 @@ ion-item .icon{ position: absolute; right: 0px; } +.edit-ar{ + position: absolute; + left: 0px; +} .fab-button{ position: fixed; bottom: 5%; @@ -155,7 +176,7 @@ ion-item .icon{ --background: #259CB8; } ion-footer{ - position: absolute; + position: fixed; bottom: 0; } ion-footer .footer-button{ @@ -219,4 +240,42 @@ ion-fab-button{ } .grid-row{ margin:10px; +} + +.active .top::before{ + position: absolute; + right: 0px; + top: 2px; + padding: 0px; + background: #3cc353; + padding: 2px 3px 4px 3px; + border-radius: 60%; + font-size: 10px; + color: #fff; + content: '✓'; + width: 12px; + height: 12px; + text-align: center; +} +.space{ + height:100px; +} +.loader{ + display: block; + position: absolute; + margin: auto; + text-align: center; + width: 100%; +} +.loader img{ + display: inline-block; + margin: auto; + width: 25px; + +} +.description-cont{ + min-height: 60px; + height: 65px; + overflow: hidden; + font-size: 14px; } \ No newline at end of file diff --git a/Mohem/src/app/itemforsale/items/items.component.ts b/Mohem/src/app/itemforsale/items/items.component.ts index 73fc2398..a98e1105 100644 --- a/Mohem/src/app/itemforsale/items/items.component.ts +++ b/Mohem/src/app/itemforsale/items/items.component.ts @@ -1,6 +1,12 @@ import { Component, OnInit } from '@angular/core'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { ItemForSaleService } from '../services/service.service'; +import { deepCopy } from '@angular-devkit/core/src/utils/object'; +import * as moment from 'moment'; +import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; +import { ActivatedRoute } from '@angular/router'; +import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; @Component({ selector: 'app-items', @@ -9,17 +15,157 @@ import { TranslatorService } from 'src/app/hmg-common/services/translator/transl }) export class ItemsComponent implements OnInit { segment: any = '1'; - constructor(public ts: TranslatorService, public cs: CommonService,) { } + items: any; + categories: any = []; + direction: string; + activeClass: any; + pageNo: number = 1; + tempSearch: any = []; + itemsByEmployee: any = []; + allCategory = { + categoryID: 0, + content: '', + isActive: true, + title: "All", + title_Ar: "الجميع", + } + constructor(public ts: TranslatorService, public route: ActivatedRoute, private sanitizer: DomSanitizer, public cs: CommonService, private itemService: ItemForSaleService, private authService: AuthenticationService) { + this.route + .params.subscribe(val => { + setTimeout(() => { + this.cs.startLoading(); + var selectedFilter = this.cs.sharedService.getSharedData(ItemForSaleService.selected_filters); + if (selectedFilter) { + this.selectCategory(selectedFilter); + } + else { + this.getItemsCategories(); + this.getItemsByEmployee(); + } + + + }, 100); + }); + + } + - ngOnInit() { } - openDetails() { + ngOnInit() { + this.direction = TranslatorService.getCurrentDirection(); + + } + getItemsCategories() { + + this.itemService.getCategories({}, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { + this.categories = this.itemService.parser(result); + this.categories.unshift(this.allCategory); + this.cs.sharedService.setSharedData(this.categories, ItemForSaleService.CATEGORIES); + }) + this.itemService.getItems({ pageNo: this.pageNo }, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { + this.items = []; + this.items = this.itemService.parser(result); + this.tempSearch = deepCopy(this.items); + console.log(this.tempSearch); + this.cs.stopLoading(); + }) + } + openDetails(selected) { + this.cs.sharedService.setSharedData(selected, ItemForSaleService.ITEMS_SELECTED); this.cs.navigateForward('/itemforsale/items-details'); } segmentChanged(value) { this.segment = value.detail.value; } openSale() { - this.cs.navigateForward('/itemforsale/home'); + this.cs.openCreateitems(); + } + selectCategory(item) { + this.cs.startLoading(); + this.activeClass = item.categoryID; + this.pageNo = 1; + this.itemService.getItems({ pageNo: this.pageNo, ItgCategoryID: item.categoryID }, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { + this.items = []; + this.items = this.itemService.parser(result); + this.tempSearch = deepCopy(this.items); + this.cs.stopLoading(); + }) + } + getDotted(temp: string, valueCount: number) { + temp = this.stripHtml(temp); + return temp.substring(0, valueCount) + " ..."; + } + stripHtml(html) { + var temporalDivElement = document.createElement("div"); + + temporalDivElement.innerHTML = html; + + return temporalDivElement.textContent || temporalDivElement.innerText || ""; } + loadData(event) { + this.pageNo = this.pageNo + 1; + this.itemService.getItems({ pageNo: this.pageNo, categoryID: this.activeClass }, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { + this.items.concat(this.itemService.parser(result)); + this.tempSearch = deepCopy(this.items); + event.target.complete(); + }) + } + search(t) { + if (t === '') { + this.items = this.tempSearch; + } else { + this.items = this.tempSearch.filter((post) => { + if (this.direction == 'ltr') + return (post.title.toLowerCase().indexOf(t.toLowerCase()) > -1); + else + return (post.title_Ar.indexOf(t) > -1); + }); + } + + } + getItemsByEmployee() { + + this.cs.startLoading(); + this.itemService.getItemsByEmployee({}, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { + this.itemsByEmployee = this.itemService.parser(result); + + this.cs.stopLoading(); + console.log(this.itemsByEmployee); + }) + } + + getDate(date) { + return moment(date, "YYYY-MM-DD HH:mm:ss").format("DD-MMM-YYYY"); + } + + getImgContent(imgFile): SafeUrl { + return this.sanitizer.bypassSecurityTrustUrl(imgFile); + } + editItems(items) { + this.cs.sharedService.setSharedData(items, ItemForSaleService.EDIT_ITEMS); + this.cs.openCreateitems(); + } + deleteItems(item) { + var authUser = this.authService.getAuthenticatedRequest(); + this.cs.startLoading(); + var request = new FormData(); + request.append('itemSaleID', item.itemSaleID); + request.append('isActive', 'false'); + request.append('Channel', authUser.Channel.toString()); + request.append('LogInToken', authUser.LogInTokenID); + request.append('Token', authUser.TokenID); + request.append('EmployeeNumber', authUser.P_USER_NAME); + request.append('MobileNo', authUser.MobileNumber); + request.append('employeeNumber', authUser.P_USER_NAME); + this.itemService.updateItemForSale(request, () => { }, this.ts.trPK('general', 'retry')).subscribe((result: any) => { + if (this.cs.validResponse(result)) { + this.cs.greenToastPK('itemforsale', 'item-deleted'); + this.getItemsByEmployee(); + + } + }) + } + openModel() { + this.cs.filterItemforSale(); + } } diff --git a/Mohem/src/app/itemforsale/services/domsafe.ts b/Mohem/src/app/itemforsale/services/domsafe.ts new file mode 100644 index 00000000..79b677ac --- /dev/null +++ b/Mohem/src/app/itemforsale/services/domsafe.ts @@ -0,0 +1,15 @@ +import { Pipe, PipeTransform } from "@angular/core"; +import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; + +@Pipe({ + name: 'sanitizeHTMLPipe' +}) +export class SanitizeHtmlPipe implements PipeTransform { + + constructor(private _sanitizer: DomSanitizer) { + } + + transform(v: string): SafeHtml { + return this._sanitizer.bypassSecurityTrustHtml(v); + } +} \ No newline at end of file diff --git a/Mohem/src/app/itemforsale/services/service.service.spec.ts b/Mohem/src/app/itemforsale/services/service.service.spec.ts new file mode 100644 index 00000000..99221043 --- /dev/null +++ b/Mohem/src/app/itemforsale/services/service.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { ItemForSaleService } from './service.service'; + +describe('ServiceService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: ItemForSaleService = TestBed.get(ItemForSaleService); + expect(service).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/itemforsale/services/service.service.ts b/Mohem/src/app/itemforsale/services/service.service.ts new file mode 100644 index 00000000..222e776c --- /dev/null +++ b/Mohem/src/app/itemforsale/services/service.service.ts @@ -0,0 +1,87 @@ +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; +import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service'; +import { MowadhafiService } from 'src/app/mowadhafi/mowadhafi.service'; + +@Injectable({ + providedIn: 'root' +}) +export class ItemForSaleService { + public static getItemForSale = 'Services/COCWS.svc/REST/Mohemm_ITG_GetItemForSale'; + public static getItemForSaleByEmployee = 'Services/COCWS.svc/REST/Mohemm_ITG_GetItemForSaleByEmployee'; + public static getCategories = 'Services/COCWS.svc/REST/Mohemm_ITG_GetItemSaleCategory'; + public static createItemForSale = 'Services/COCWS.svc/REST/Mohemm_ITG_AddItemForSaleMobile'; + public static updateItemForSale = 'Services/COCWS.svc/REST/Mohemm_ITG_UpdateItemForSale'; + public static getRegion = 'Services/COCWS.svc/REST/Mohemm_ITG_GetRegion'; + public static ITEMS_SELECTED = 'item-selected'; + public static CATEGORIES = 'categories'; + public static EDIT_ITEMS = 'edit-items'; + public static selected_filters = 'selected_filter'; + constructor( + public con: ConnectorService, + private authService: AuthenticationService, + private http: HttpClient + ) { } + public getItems(request: any, onError?: any, errorLabel?: string) { + this.authService.authenticateRequest(request); + request.EmployeeNumber = request.UserName; + request.ItgPageNo = request.pageNo; + request.ItgPageSize = 10; + request.ItgStatus = "Approved"; + return this.con.postNoLoad(ItemForSaleService.getItemForSale, request, onError, errorLabel); + } + + public getCategories(request: any, onError?: any, errorLabel?: string) { + this.authService.authenticateRequest(request); + request.EmployeeNumber = request.UserName; + + return this.con.postNoLoad(ItemForSaleService.getCategories, request, onError, errorLabel); + } + + + + parser(response: any) { + try { + var result = JSON.parse(response.Mohemm_ITG_ResponseItem); + if (result.result) + return result.result.data + else + return {} + } catch (res) { + console.log(res); + } + } + + getItemsByEmployee(request: any, onError?: any, errorLabel?: string) { + this.authService.authenticateRequest(request); + request.EmployeeNumber = request.UserName; + request.ItgEmployeeNumber = request.UserName; //request.UserName; + return this.con.post(ItemForSaleService.getItemForSaleByEmployee, request, onError, errorLabel); + } + getRegion(request: any, onError?: any, errorLabel?: string) { + this.authService.authenticateRequest(request); + request.EmployeeNumber = request.UserName; + request.ItgEmployeeNumber = request.UserName; //request.UserName; + return this.con.post(ItemForSaleService.getRegion, request, onError, errorLabel); + } + + createItemForSale(itemRequest: any, onError?: any, errorLabel?: string) { + const request = itemRequest; + this.authService.authenticateRequest(request); + request.employeeNumber = request.P_USER_NAME; + //return this.http.post(ConnectorService.host + ItemForSaleService.createItemForSale, itemRequest, { + return this.con.post(ItemForSaleService.createItemForSale, request, onError, errorLabel); + //} + //) + } + updateItemForSale(itemRequest: any, onError?: any, errorLabel?: string) { + const request = itemRequest; + this.authService.authenticateRequest(request); + request.employeeNumber = request.P_USER_NAME; + return this.http.post(ConnectorService.host + ItemForSaleService.updateItemForSale, itemRequest, { + + } + ) + } +} diff --git a/Mohem/src/app/mowadhafi/hr-request-form/hr-request-form.component.scss b/Mohem/src/app/mowadhafi/hr-request-form/hr-request-form.component.scss index c0f5006c..60613fd8 100644 --- a/Mohem/src/app/mowadhafi/hr-request-form/hr-request-form.component.scss +++ b/Mohem/src/app/mowadhafi/hr-request-form/hr-request-form.component.scss @@ -526,4 +526,7 @@ select option[data-default] { .button-native { box-shadow: none!important; + } + .gridAH{ + text-align: justify; } \ No newline at end of file diff --git a/Mohem/src/app/mowadhafi/hr-request-form/hr-request-form.component.ts b/Mohem/src/app/mowadhafi/hr-request-form/hr-request-form.component.ts index 70c5c7e0..1ec8c7ed 100644 --- a/Mohem/src/app/mowadhafi/hr-request-form/hr-request-form.component.ts +++ b/Mohem/src/app/mowadhafi/hr-request-form/hr-request-form.component.ts @@ -35,7 +35,7 @@ export class HrRequestFormComponent implements OnInit { public searchKeySelect = 'Complaints'; myColor: string = 'secondary'; public showRequestDetails = false; - public proID = "HMG" + public proID = "CS" public inquiry: string; public HR: string; public complaints: string; @@ -54,9 +54,9 @@ export class HrRequestFormComponent implements OnInit { public sectionDep: any; public projectCode; public SelectedServiceType: any; - public depType: any =""; - public secType: any =""; - public topicType: any =""; + public depType: any = ""; + public secType: any = ""; + public topicType: any = ""; indexLastObj: any; addAttachRequest: any = []; TransactionID: any; @@ -73,17 +73,17 @@ export class HrRequestFormComponent implements OnInit { "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ]; - projctid:any; - employeeNumber:any; - ticketType: any =[]; + projctid: any; + employeeNumber: any; + ticketType: any = []; public direction: string; HRServices = ''; - Complaints=''; - Inquiry=''; - input = document.getElementById ("firstLabel"); - - - + Complaints = ''; + Inquiry = ''; + input = document.getElementById("firstLabel"); + + + constructor( public ts: TranslatorService, public cs: CommonService, @@ -100,20 +100,20 @@ export class HrRequestFormComponent implements OnInit { } ngOnInit() { - this.projectCode = this.cs.sharedService.getSharedData("projcet-code",false); + this.projectCode = this.cs.sharedService.getSharedData("projcet-code", false); this.getTicketTypes(); this.getProject(); - + } - + public isValidForm(): boolean { if (this.depType && this.SelectedServiceType && this.secType && this.topicType) { - return false; + return false; } return true; -} + } onSelectChange(event, type) { @@ -121,20 +121,20 @@ export class HrRequestFormComponent implements OnInit { console.log(value); // this.topicTypeList =[]; // this.sectionTypeList =[]; - if(type==1){ + if (type == 1) { this.depType = value; - this.sectionTypeList =[]; - this.topicTypeList =[]; + this.sectionTypeList = []; + this.topicTypeList = []; this.getDepartmentSections(value); - - }else if(type==2){ + + } else if (type == 2) { this.getSectionTopics(value); - this.topicTypeList =[]; + this.topicTypeList = []; } - - } - onFileSelectedclick(event){ + } + + onFileSelectedclick(event) { event.target.value = ''; } @@ -158,8 +158,8 @@ export class HrRequestFormComponent implements OnInit { }) } handlegetTicketTypesResult(result) { - this.ticketType =result.Mohemm_Itg_TicketTypesList; - + this.ticketType = result.Mohemm_Itg_TicketTypesList; + } ///////////////////////////////////////////////// @@ -177,11 +177,11 @@ export class HrRequestFormComponent implements OnInit { } handlegetProjectResult(result) { this.Projectresult = result.Mohemm_Itg_ProjectsList; - this.projctid=this.Projectresult[0].projectId; + this.projctid = this.Projectresult[0].projectId; this.getProjectDepartments(); } -//////////////////////////////////////////////////// + //////////////////////////////////////////////////// getProjectDepartments() { const request = { EmployeeNumber: "", @@ -204,7 +204,7 @@ export class HrRequestFormComponent implements OnInit { getDepartmentSections(value) { const request = { EmployeeNumber: "", - ItgProjectDepartmentId: value ?value : this.departTypeList.projectDepartmentId, + ItgProjectDepartmentId: value ? value : this.departTypeList.projectDepartmentId, }; @@ -218,11 +218,11 @@ export class HrRequestFormComponent implements OnInit { // this.getSectionTopics(); } - getSectionTopics(value=null) { + getSectionTopics(value = null) { const request = { EmployeeNumber: "", // ItgDepartmentSectionId: this.sectionTypeList.departmentSectionId, - ItgDepartmentSectionId: value ?value : this.sectionTypeList.departmentSectionId, + ItgDepartmentSectionId: value ? value : this.sectionTypeList.departmentSectionId, }; this.MowadhafiService.getSectionTopics(request, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { @@ -238,41 +238,57 @@ export class HrRequestFormComponent implements OnInit { } - /*******************Create Ticket Function*************/ + /*******************Create Ticket Function*************/ CreateTicket() { - - var authUser =this.authService.getAuthenticatedRequest(); + + var authUser = this.authService.getAuthenticatedRequest(); this.cs.startLoading(); - var request = new FormData(); - request.append('ticketTypeId', this.SelectedServiceType); - request.append('projectId', this.projctid); - request.append('departmentId', this.depType); - request.append('sectionId', this.secType); - request.append('sectionTopicId', this.topicType); - request.append('description', this.Description); - console.log("TEST:______") - console.log(this.selectedFile); - if(this.selectedFile && this.selectedFile !== undefined){ - request.append('fileColl', this.selectedFile[0], this.selectedFile[0].name); - } - request.append('employeeNumber', authUser.P_USER_NAME); - request.append('ticketStatus', 'new'); - request.append('channelId', '3'); - request.append('Channel', authUser.Channel.toString()); - request.append('LogInToken', authUser.LogInTokenID); - request.append('Token', authUser.TokenID); - request.append('EmployeeNumber', authUser.P_USER_NAME); - request.append('MobileNo', authUser.MobileNumber); + // var request = new FormData(); + // request.append('ticketTypeId', this.SelectedServiceType); + // request.append('projectId', this.projctid); + // request.append('departmentId', this.depType); + // request.append('sectionId', this.secType); + // request.append('sectionTopicId', this.topicType); + // request.append('description', this.Description); + + // if(this.selectedFile && this.selectedFile !== undefined){ + // request.append('fileColl', this.selectedFile[0], this.selectedFile[0].name); + // } + // request.append('employeeNumber', authUser.P_USER_NAME); + // request.append('ticketStatus', 'new'); + // request.append('channelId', '3'); + // request.append('Channel', authUser.Channel.toString()); + // request.append('LogInToken', authUser.LogInTokenID); + // request.append('Token', authUser.TokenID); + // request.append('EmployeeNumber', authUser.P_USER_NAME); + // request.append('MobileNo', authUser.MobileNumber); + + var request = { + "TokenID": authUser.LogInTokenID, "EmployeeNumber": authUser.P_USER_NAME, "ItgImageCollList": this.addAttachRequest, + "ticketTypeId": this.SelectedServiceType, + "projectId": this.projctid, + "departmentId": this.depType, + "sectionId": this.secType, + "sectionTopicId": this.topicType, + "description": this.Description, + "employeeNumber": authUser.P_USER_NAME, + "ticketStatus": "new", + "channelId": 3, + "Channel": authUser.Channel.toString(), + "LogInToken": authUser.LogInTokenID, + "Token": authUser.TokenID, + "MobileNo": authUser.MobileNumber, + } this.MowadhafiService.getCreateTicket(request, () => { }, this.ts.trPK('general', 'retry')).subscribe((result: any) => { - if(this.cs.validResponse(result)){ + if (this.cs.validResponse(result)) { this.cs.stopLoading(); this.checkERM('After Service Submission'); this.cs.greenToastPK("general", "success-create"); this.cs.openMyRequestPage(); - }else{ + } else { this.cs.stopLoading(); this.cs.redToastPK("general", "try-again"); } @@ -329,7 +345,7 @@ export class HrRequestFormComponent implements OnInit { else { const file = input.target.files[0]; this.selectedFile = input.target.files; - + this.getBase64(file).then(data => this.pushObject(data, file.name, file.type) @@ -348,18 +364,21 @@ export class HrRequestFormComponent implements OnInit { } pushObject(fileData, name, type) { - + this.indexLastObj++; try { let array = name.split("."); let attachType: string = array[array.length - 1]; this.addAttachRequest.push({ - AttachmentID: this.indexLastObj, - P_FILE_CONTENT_TYPE: attachType, //type.split('/')[1], - P_FILE_DATA: fileData.split(",")[1], - P_FILE_NAME: name, //.split('.')[0], - P_TRANSACTION_ID: this.TransactionID + // AttachmentID: this.indexLastObj, + // P_FILE_CONTENT_TYPE: attachType, //type.split('/')[1], + // P_FILE_DATA: fileData.split(",")[1], + // P_FILE_NAME: name, //.split('.')[0], + // P_TRANSACTION_ID: this.TransactionID + Base64Data: fileData.split(",")[1], + FileName: name, + ContentType: 'image/' + attachType }); } catch (e) { } } diff --git a/Mohem/src/app/mowadhafi/hr-request/hr-request.component.scss b/Mohem/src/app/mowadhafi/hr-request/hr-request.component.scss index 3999867e..9a786617 100644 --- a/Mohem/src/app/mowadhafi/hr-request/hr-request.component.scss +++ b/Mohem/src/app/mowadhafi/hr-request/hr-request.component.scss @@ -176,6 +176,7 @@ letter-spacing: -0.64px; color: #2B353E; opacity: 1; + line-height: 20px; } diff --git a/Mohem/src/app/mowadhafi/mowadhafi.service.ts b/Mohem/src/app/mowadhafi/mowadhafi.service.ts index 8976393b..2a34d1d8 100644 --- a/Mohem/src/app/mowadhafi/mowadhafi.service.ts +++ b/Mohem/src/app/mowadhafi/mowadhafi.service.ts @@ -19,7 +19,7 @@ export class MowadhafiService { public static getTicketStatisticsByEmp = 'Services/COCWS.svc/REST/Mohemm_ITG_GetTicketStatisticsByEmployee'; public static getTicketTransaction = 'Services/COCWS.svc/REST/Mohemm_ITG_GetTicketTransaction'; public static getTicketDetails = 'Services/COCWS.svc/REST/Mohemm_ITG_GetTicketDetails'; - public static getCreateTicket = 'Services/COCWS.svc/REST/Mohemm_ITG_CreateTicket'; + public static getCreateTicket = 'Services/COCWS.svc/REST/Mohemm_ITG_CreateTicketMobile'; constructor( public con: ConnectorService, @@ -108,16 +108,17 @@ export class MowadhafiService { const request = absence; this.authService.authenticateRequest(request); request.employeeNumber = request.P_USER_NAME; - const HttpUploadOptions = { - headers: new HttpHeaders({ "Content-Type": "multipart/form-data", }) - } + return this.con.post(MowadhafiService.getCreateTicket, request, onError, errorLabel); + // const HttpUploadOptions = { + // headers: new HttpHeaders({ "Content-Type": "multipart/form-data", }) + // } // return this.con.post(MowadhafiService.getCreateTicket, request, onError, errorLabel); - return this.http.post(ConnectorService.host + MowadhafiService.getCreateTicket, absence, { - // reportProgress: true, - // observe: 'events' - } - ) + //return this.http.post(ConnectorService.host + MowadhafiService.getCreateTicket, absence, { + // reportProgress: true, + // observe: 'events' + //} + // ) } } \ No newline at end of file diff --git a/Mohem/src/app/my-team/details/details.component.ts b/Mohem/src/app/my-team/details/details.component.ts index 4469f7ec..98955dfd 100644 --- a/Mohem/src/app/my-team/details/details.component.ts +++ b/Mohem/src/app/my-team/details/details.component.ts @@ -235,7 +235,7 @@ export class DetailsComponent implements OnInit { ngOnInit() { this.common.startLoading(); this.intializeMemberDetail(); - this.showAttendanceTracking(); + // this.showAttendanceTracking(); // tslint:disable-next-line: max-line-length this.currentMonthName = this.direction === 'en' ? this.common.getMonthName(this.monthIndex) : this.common.getMonthNameAr(this.monthIndex); } @@ -266,6 +266,7 @@ export class DetailsComponent implements OnInit { if (this.activeSegment === 'Attendance') { this.common.startLoading(); this.initAttendance(); + this.showAttendanceTracking(); } else if (this.activeSegment != 'Attendance' && this.activeSegment != 'TeamMembers') { this.activeSegment = 'About'; diff --git a/Mohem/src/app/my-team/home/home.component.html b/Mohem/src/app/my-team/home/home.component.html index 2280064d..0cbb0cef 100644 --- a/Mohem/src/app/my-team/home/home.component.html +++ b/Mohem/src/app/my-team/home/home.component.html @@ -1,5 +1,6 @@ diff --git a/Mohem/src/app/my-team/my-team.module.ts b/Mohem/src/app/my-team/my-team.module.ts index 49925b71..17fa5ede 100644 --- a/Mohem/src/app/my-team/my-team.module.ts +++ b/Mohem/src/app/my-team/my-team.module.ts @@ -10,6 +10,7 @@ import { MyTeamPage } from './my-team.page'; import { HmgCommonModule } from '../hmg-common/hmg-common.module'; import { from } from 'rxjs'; import { WorklistService } from '../notification/service/worklist.service'; +import { SubordinateLeaveComponent } from './subordinate-leave/subordinate-leave.component'; const routes: Routes = [ @@ -28,7 +29,10 @@ const routes: Routes = [ path: 'details-2', component: DetailsComponent }, - + { + path: 'subordinate-leave', + component: SubordinateLeaveComponent + } ] } @@ -44,7 +48,11 @@ const routes: Routes = [ ], providers: [WorklistService], - declarations: [MyTeamPage, HomeComponent, DetailsComponent, + declarations: [ + MyTeamPage, + HomeComponent, + DetailsComponent, + SubordinateLeaveComponent ] }) export class MyTeamPageModule { } diff --git a/Mohem/src/app/my-team/service/my-team.service.ts b/Mohem/src/app/my-team/service/my-team.service.ts index 87507d70..81149b41 100644 --- a/Mohem/src/app/my-team/service/my-team.service.ts +++ b/Mohem/src/app/my-team/service/my-team.service.ts @@ -7,6 +7,7 @@ import { AuthenticationService } from "src/app/hmg-common/services/authenticatio export class MyTeamService { public static EMPLOYEE_SHARED_DATA = 'employee'; public static getMyTeam = 'Services/ERP.svc/REST/GET_EMPLOYEE_SUBORDINATES'; + public static getSubordintesLeaves = 'Services/ERP.svc/REST/GET_SUBORDINATES_LEAVES_TOTAL_VACATIONS'; // public static getSuborinateStatus = 'Services/ERP.svc/REST/GET_SUBORDINATES_ATTD_STATUS'; @@ -20,6 +21,13 @@ export class MyTeamService { return this.con.post(MyTeamService.getMyTeam, request, onError, errorLabel); } + public getEmployeeSubordinatesLeave(absence: any, onError?: any, errorLabel?: string){ + const request = absence; + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.post(MyTeamService.getSubordintesLeaves, request, onError, errorLabel); + } + // public getSuborinatesAttStatus(absence: any, onError?: any, errorLabel?: string){ // const request = absence; // this.authService.authenticateRequest(request); diff --git a/Mohem/src/app/my-team/subordinate-leave/subordinate-leave.component.html b/Mohem/src/app/my-team/subordinate-leave/subordinate-leave.component.html new file mode 100644 index 00000000..8adf1dde --- /dev/null +++ b/Mohem/src/app/my-team/subordinate-leave/subordinate-leave.component.html @@ -0,0 +1,89 @@ + + + + + +
+ + +

{{ts.trPK('myTeam','select-duration')}}

+
+
+ + + + {{ts.trPK('general','from')}} + + + +   + + + + + {{ts.trPK('general','to')}} + + +   + + + + + +
+ +
+ +
+
+
+

+ {{ts.trPK('general','empty')}} +

+
+ +
+
+
+ + +
+
+ + +
+
+
+ +
+ +

{{user.EMPLOYEE_NAME}}

+ {{ts.trPK('general','from')}}: {{getDate(user.DATE_START)}}     + {{ts.trPK('general','to')}}: {{getDate(user.DATE_END)}} +
+ {{ts.trPK('myTeam','no-of-days')}}: {{diffDays(user)}} +
+
+
+
+
+
+
+ +
+ + +
+ {{ts.trPK('general','submit')}} +
+
+ + + + + \ No newline at end of file diff --git a/Mohem/src/app/my-team/subordinate-leave/subordinate-leave.component.scss b/Mohem/src/app/my-team/subordinate-leave/subordinate-leave.component.scss new file mode 100644 index 00000000..6a147428 --- /dev/null +++ b/Mohem/src/app/my-team/subordinate-leave/subordinate-leave.component.scss @@ -0,0 +1,199 @@ +.confirmEitOkButton{ + white-space: normal !important; + text-transform: capitalize !important; + min-height: 45px !important; + min-width: 5px !important; + margin: 8px !important; + --background: #269DB8; + width: 80% !important; + color: white!important; + border-radius: 16px !important; + } + + .team-member-container{ + // background: white; + // border-radius: 100px 20px 20px 100px; + // margin-top: 15px; + // font-family: WorkSans-Regular; + // border: 1px solid #ccc; + // border-radius: 15px; + // padding-bottom: 8px; + background: white; + /* margin-top: 2px; */ + font-family: WorkSans-Regular; + border: 1px solid #ccc; + border-radius: 15px; + padding-bottom: 8px; + padding-top: 9px; + margin-bottom: 7px; +} + +// .user-image-container{ +// position: relative; +// width: 70px; +// height: 70px; +// display: block; +// margin: 0 auto; +// &:before{ +// position: absolute; +// content: ""; +// width: 20px; +// height: 20px; +// border-radius: 20px; +// border: 1px solid white; +// top: 0; +// right: 0; +// background-color: red; +// z-index: 9; +// } +// &.present:before{ +// background-color: green !important; +// } +// } +.user-image{ + // overflow: hidden; + // position: relative; + // display: block; + // width: 100%; + // height: 100%; + // border-radius: 80px; + // border: 1px solid #ccc; + // margin: 0px auto 6px; + + img { + // width: 100%; + // max-height: 100%; + width: 74%; + max-height: 74%; + margin-top: 7px; + margin-left: 6px; + } +} + +.employee-name{ + display: inline-block; + width: 80%; + .name{ + // font-size: 16px; + // color: black; + // // margin: 0; + // width: 100%; + // text-overflow: ellipsis; + // white-space: nowrap; + // overflow: hidden; + // margin-left: -10px; + // margin-top: -5px; + // font-family: 'WorkSans-Bold'; + font-size: 16px; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + margin-left: -10px; + margin-top: -5px; + text-align: left; + font-family: var(--fontFamilyPoppins-SemiBold, inherit); + line-height: 25px; + letter-spacing: -0.64px; + color: #2B353E; + opacity: 1; + } + + .title{ + // font-size: 13px; + // color: #888; + // width: 100%; + // text-overflow: ellipsis; + // white-space: nowrap; + // overflow: hidden; + // display: block; + // margin-left: -10px; + // margin-top: -6px; + // color: black; + font-family: var(--fontFamilyPoppins-SemiBold, inherit); + line-height: 12px; + letter-spacing: -0.56px; + color: #575757; + opacity: 1; + font-size: 14px; + width: 100%; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + margin-left: -10px; + margin-top: -10px; + } +} + +.employee-name-ar{ + display: inline-block; + width: 80%; + .name{ + // font-size: 16px; + // color: black; + // // margin: 0; + // width: 100%; + // text-overflow: ellipsis; + // white-space: nowrap; + // overflow: hidden; + // margin-left: -10px; + // margin-top: -5px; + // font-family: 'WorkSans-Bold'; + font-size: 16px; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + margin-left: -10px; + margin-top: -5px; + text-align: right; + font-family: var(--fontFamilyPoppins-SemiBold, inherit); + line-height: 25px; + letter-spacing: -0.64px; + color: #2B353E; + opacity: 1; + } + + .title{ + // font-size: 13px; + // color: #888; + // width: 100%; + // text-overflow: ellipsis; + // white-space: nowrap; + // overflow: hidden; + // display: block; + // margin-left: -10px; + // margin-top: -6px; + // color: black; + font-family: var(--fontFamilyPoppins-SemiBold, inherit); + line-height: 12px; + letter-spacing: -0.56px; + color: #575757; + opacity: 1; + font-size: 14px; + width: 100%; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: block; + margin-left: -10px; + margin-top: -10px; + } +} +.image-container{ + width: 20%; + display: inline-block; + text-align: center; + vertical-align: top; + margin-top: 5px; +} +.swipe-information{ + color: #888; + font-size: 12px; + border-top: 1px solid #ccc; + padding-top: 6px; + margin-top: 6px; + .check-in { + font-size: 12px; + margin-right: 15px; + } +} \ No newline at end of file diff --git a/Mohem/src/app/my-team/subordinate-leave/subordinate-leave.component.spec.ts b/Mohem/src/app/my-team/subordinate-leave/subordinate-leave.component.spec.ts new file mode 100644 index 00000000..8b69962b --- /dev/null +++ b/Mohem/src/app/my-team/subordinate-leave/subordinate-leave.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SubordinateLeaveComponent } from './subordinate-leave.component'; + +describe('SubordinateLeaveComponent', () => { + let component: SubordinateLeaveComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SubordinateLeaveComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SubordinateLeaveComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/my-team/subordinate-leave/subordinate-leave.component.ts b/Mohem/src/app/my-team/subordinate-leave/subordinate-leave.component.ts new file mode 100644 index 00000000..cdcbd788 --- /dev/null +++ b/Mohem/src/app/my-team/subordinate-leave/subordinate-leave.component.ts @@ -0,0 +1,57 @@ +import { Component, OnInit } from '@angular/core'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { MyTeamService } from '../service/my-team.service'; +import * as moment from 'moment'; + +@Component({ + selector: 'app-subordinate-leave', + templateUrl: './subordinate-leave.component.html', + styleUrls: ['./subordinate-leave.component.scss'], +}) +export class SubordinateLeaveComponent implements OnInit { + public startDate: any; + public endDate: any; + public list = []; + public noData = true; + + constructor( + public ts: TranslatorService, + public common: CommonService, + public myTeamService: MyTeamService, + ) { } + + ngOnInit() {} + + subordinateLeaveList() { + const Sdata = this.common.convertDateToJsonDateUpdated(this.startDate); + const Edata = this.common.convertDateToJsonDateUpdated(this.endDate); + this.myTeamService.getEmployeeSubordinatesLeave({ + P_DATE_FROM: Sdata, + P_DATE_TO: Edata + }, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { + if (this.common.validResponse(result)) { + this.list = result.GetSubordinatesLeavesTotalVacationsList; + this.noData = false; + } + }); + } + + getDate(date) { + const newDate = this.common.localizeDate(new Date(this.common.getDateTimeISOFromStringUpdated(date).split(' ')[0])); + return newDate; + } + diffDays(date) { + const date1 = new Date(this.common.getDateTimeISOFromStringUpdated(date.DATE_START).split(' ')[0]); + const date2 = new Date(this.common.getDateTimeISOFromStringUpdated(date.DATE_END).split(' ')[0]); + const diff = Math.abs(date1.getTime() - date2.getTime()); + const diffDays = Math.ceil(diff / (1000 * 3600 * 24)); + return diffDays; + } + + checkDate() { + if (this.startDate && this.endDate) { + return false; + } else { return true; } + } +} diff --git a/Mohem/src/app/notification/home/home.component.html b/Mohem/src/app/notification/home/home.component.html index fe0b6141..31eda5f2 100644 --- a/Mohem/src/app/notification/home/home.component.html +++ b/Mohem/src/app/notification/home/home.component.html @@ -1,6 +1,7 @@ @@ -10,19 +11,20 @@
{{ts.trPK('work-list','open-analysis')}}
-
- {{newWorkListResponse.length + ITGCount}} {{ts.trPK('work-list','of')}} - {{newWorkListResponse.length}} {{ts.trPK('work-list','of')}} -

{{totalRequestCount}}

-

{{newWorkListResponse[0].NO_OF_ROWS + ITGCount}}

-

{{newWorkListResponse[0].NO_OF_ROWS}}

+
+

{{totalRequestCount}}

+ + {{ts.trPK('work-list','total')}}
{{ts.trPK('work-list','open-reqest')}}
+ - +
- + {{ts.trPK('work-list','clear-search')}} - + {{ts.trPK('work-list','advanced-search')}} @@ -70,7 +72,6 @@
-
@@ -99,9 +100,8 @@
- - + diff --git a/Mohem/src/app/notification/home/home.component.scss b/Mohem/src/app/notification/home/home.component.scss index c1faeb72..b7444c88 100644 --- a/Mohem/src/app/notification/home/home.component.scss +++ b/Mohem/src/app/notification/home/home.component.scss @@ -355,7 +355,7 @@ z-index: 99; ion-col{ background: white; border-radius: 12px; - padding-right: 30px; + // padding-right: 30px; flex: none; ion-icon{ margin-right: 3px; @@ -459,4 +459,10 @@ padding: 10px 30px; } .slideCss{ width: auto !important; +} + +.spinner-custom-class{ + position: absolute; + right: 160px; + top: 100px; } \ No newline at end of file diff --git a/Mohem/src/app/notification/home/home.component.ts b/Mohem/src/app/notification/home/home.component.ts index 89200ab2..0ec194c5 100644 --- a/Mohem/src/app/notification/home/home.component.ts +++ b/Mohem/src/app/notification/home/home.component.ts @@ -11,6 +11,8 @@ import { WorklistAdvancedSearchComponent } from '../worklist-advanced-search/wor import { DatePipe } from '@angular/common'; import { GetOpenNotificationsResponse } from 'src/app/hmg-common/services/dashbored/models/GetOpenNotificationsResponse'; import { DashboredService } from 'src/app/hmg-common/services/dashbored/dashbored.service'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { COCRequest } from '../models/COCRequest'; @Component({ selector: 'app-home', @@ -22,6 +24,7 @@ export class HomeComponent implements OnInit { public static REQUSET_INFO = 'requset_info'; public static ALL_REQUEST = 'all_request'; public static NOTIFICATION_DATA = 'notification_data'; + public static COUNT_CHANGED = 'count_changed'; public static NOTIFICATION_ARR = 'notification_arr'; public static NAMES_ALL_iTEMS = 'names-all-items'; public static IS_ALL_NAME = 'is_all_names'; @@ -66,16 +69,17 @@ export class HomeComponent implements OnInit { public newWorkListResponse = []; public showFormattedData = []; public allFormattedData = []; - public selectedFilter = 'ALL'; + public selectedFilter = 'HR'; public showSearchButton = false; - public itemType = ''; + public itemType = 'HRSSA'; public receivedITGCount = false; - + public countChanged: any = false; public totalHR = 0; public totalPO = 0; public totalPR = 0; public totalMR = 0; public totalIC = 0; + public totalStamp = 0; public showChart = false; @@ -85,30 +89,24 @@ export class HomeComponent implements OnInit { tooltips: { enabled: false }, legend: { display: false } }; - public data = { - datasets: [ - { - data: [0, 0, 0, 0, 0, 0], - backgroundColor: [ - '#18a169', - '#3cb9d5', - '#114475', - '#38c9b3', - '#cc3232', - '#9e7e97' - ], - borderWidth: 5 - }] - }; + // public data = { + // datasets: [ + // { + // data: [0, 0, 0, 0, 0, 0, 0], + // backgroundColor: [ + // '#18a169', + // '#3cb9d5', + // '#114475', + // '#38c9b3', + // '#cc3232', + // '#9e7e97', + // '#ff9800' + // ], + // borderWidth: 6 + // }] + // }; + public data: any; public filters = [ - { - value: 0, - name: 'All', - active: true, - color: '#124375', - key: 'ALL', - disable: false - }, { value: 0, name: 'HR', @@ -156,6 +154,14 @@ export class HomeComponent implements OnInit { color: '#9e7e97', key: 'INVITEM', disable: false + }, + { + value: 0, + name: 'STAMP', + active: false, + color: '#ff9800', + key: 'STAMP', + disable: false } ]; @@ -184,7 +190,7 @@ export class HomeComponent implements OnInit { this.WorkListObj.P_SEARCH_SENT_DATE = ''; this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = ''; this.WorkListObj.P_PAGE_NUM = 0; - this.WorkListObj.P_PAGE_LIMIT = 50; + this.WorkListObj.P_PAGE_LIMIT = 25; } ngOnInit() { @@ -192,8 +198,14 @@ export class HomeComponent implements OnInit { this.isLoading = true; } + + ionViewWillEnter() { - console.log(this.filters); + this.totalRequestCount = this.common.getTotalNumberOfWorklistRequest(); + const values = this.common.getFiltersData(); + this.data = values.data; + this.filters = values.filters; + const loadWorkList = this.common.sharedService.getSharedData('loadWorkList', false); if (loadWorkList) { this.receivedITGCount = false; @@ -205,88 +217,61 @@ export class HomeComponent implements OnInit { } this.currentActiveIndex = 0; this.previousActiveIndex = 0; - this.itemType = ''; - this.selectedFilter = 'ALL'; + this.itemType = 'HRSSA'; + this.selectedFilter = 'HR'; + this.enableFilters(); + this.filters[0].active = true; this.isPostNoLoad = true; - this.disableFilters(); this.resetData(); this.direction = TranslatorService.getCurrentLanguageName(); this.worklistNotifications = this.common.sharedService.getSharedData('worklistNotifications', false); - this.openNotificationsDashboard(); + + var isWorklistChanged = this.common.sharedService.getSharedData(HomeComponent.COUNT_CHANGED); + if (isWorklistChanged) { + this.openNotificationsDashboard() + } + this.openNotificationsDashboardLocal(); } } callWorkListServices() { + // if (this.countChanged) { this.Count(); + // } this.getAllPushNotificationFun(); } - openNotificationsDashboard() { - this.DS.getOpenNotifications('', '', this.isPostNoLoad).subscribe((result: GetOpenNotificationsResponse) => { - if (this.common.validResponse(result)) { - this.worklistNotifications = result; - this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER; - this.common.sharedService.setSharedData(result, 'worklistNotifications'); - this.Details(); - this.callWorkListServices(); - } - }); + openNotificationsDashboardLocal() { + this.Details(); + this.callWorkListServices(); + } assignDataToFilters() { - this.ngZone.run(() => { - this.filters[0].value = this.worklistNotifications.P_OPEN_NTF_NUMBER; - this.filters[1].value = this.totalHR; - this.filters[2].value = this.totalMR; - this.filters[3].value = this.totalPR; - this.filters[4].value = this.totalPO; - this.filters[6].value = this.totalIC; - }); - - - if (this.totalHR === 0) { - this.data.datasets[0].data[0] = 0; - } - - if (this.totalPO === 0) { - this.data.datasets[0].data[1] = 0; - } - - if (this.totalPR === 0) { - this.data.datasets[0].data[2] = 0; - } - - if (this.totalMR === 0) { - this.data.datasets[0].data[3] = 0; - } - - if (this.totalIC === 0) { - this.data.datasets[0].data[5] = 0; - } - const openNotificationsArray = this.worklistNotifications.GetOpenNotificationsList; for (const notification of openNotificationsArray) { if (notification.ITEM_TYPE === 'HRSSA') { - this.filters[1].value = this.totalHR; + this.filters[0].value = notification.OPEN_NTF_NUMBER; this.data.datasets[0].data[0] = notification.OPEN_NTF_NUMBER; } else if (notification.ITEM_TYPE === 'INVMOA') { - this.filters[2].value = this.totalMR; + this.filters[1].value = notification.OPEN_NTF_NUMBER; this.data.datasets[0].data[1] = notification.OPEN_NTF_NUMBER; } else if (notification.ITEM_TYPE === 'REQAPPRV') { - this.filters[3].value = this.totalPR; + this.filters[2].value = notification.OPEN_NTF_NUMBER; this.data.datasets[0].data[2] = notification.OPEN_NTF_NUMBER; } else if (notification.ITEM_TYPE === 'POAPPRV') { - this.filters[4].value = this.totalPO; + this.filters[3].value = notification.OPEN_NTF_NUMBER; this.data.datasets[0].data[3] = notification.OPEN_NTF_NUMBER; } else if (notification.ITEM_TYPE === 'INVITEM') { - this.filters[6].value = this.totalIC; + this.filters[5].value = notification.OPEN_NTF_NUMBER; this.data.datasets[0].data[5] = notification.OPEN_NTF_NUMBER; + } else if (notification.ITEM_TYPE === 'STAMP') { + this.filters[6].value = notification.OPEN_NTF_NUMBER; + this.data.datasets[0].data[6] = notification.OPEN_NTF_NUMBER; } } - // this.data.datasets[0].data[4] = this.ITGCount; this.showChart = true; - // this.common.stopLoading(); this.isLoading = false; } @@ -299,16 +284,46 @@ export class HomeComponent implements OnInit { } } + public initiateNewWorklistData(selectedFilter: any, filterValue: any) { + this.WorkListObj = new WorkListRequest(); + this.WorkListObj.P_NOTIFICATION_TYPE = '1'; + this.WorkListObj.P_SEARCH_FROM_USER = ''; + this.WorkListObj.P_SEARCH_SUBJECT = ''; + this.WorkListObj.P_SEARCH_SENT_DATE = ''; + this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = ''; + this.WorkListObj.P_PAGE_NUM = 0; + this.WorkListObj.P_PAGE_LIMIT = 25; + + if (this.infiniteScroll) { + this.infiniteScroll.complete(); + } + this.itemType = this.selectedFilter; + + this.newWorkListResponse = []; + this.showFormattedData = []; + this.allFormattedData = []; + + if (filterValue > 0) { + this.getAllPushNotificationFun(); + } else { + this.common.stopLoading(); + } + + } + activeFilter(index: number) { - console.log(this.filters); - if (this.currentActiveIndex !== index) { + if (index !== this.currentActiveIndex && index !== 7) { + if (index !== 4) { + this.common.startLoading(); + } this.previousActiveIndex = this.currentActiveIndex; this.currentActiveIndex = index; this.filters[this.previousActiveIndex].active = false; this.filters[this.currentActiveIndex].active = true; this.selectedFilter = this.filters[this.currentActiveIndex].key; + const filterValue = this.filters[this.currentActiveIndex].value; if (this.selectedFilter !== 'ITG') { - this.getFilteredData(this.selectedFilter); + this.initiateNewWorklistData(this.selectedFilter, filterValue); } } } @@ -317,12 +332,14 @@ export class HomeComponent implements OnInit { this.common.openProfile('sideMenu'); } - disableFilters() { + configureFilters() { for (const filter of this.filters) { if (filter.key === this.itemType) { + const index = this.filters.map(function (e) { return e.key; }).indexOf(this.itemType); + this.currentActiveIndex = index; + this.previousActiveIndex = 0; filter.disable = false; filter.active = true; - filter.value = 0; this.selectedFilter = filter.name; } else if (this.itemType === '') { filter.disable = false; @@ -332,17 +349,34 @@ export class HomeComponent implements OnInit { filter.active = false; } } + if (this.itemType === '') { this.filters[0].active = true; } } + + enableFilters() { + this.currentActiveIndex = 0; + this.previousActiveIndex = 0; + for (const filter of this.filters) { + filter.disable = false; + if (filter.key === this.itemType) { + filter.active = true; + } else { + filter.active = false; + } + } + } + async openSearchModal() { const modal = await this.modalController.create({ component: WorklistAdvancedSearchComponent, cssClass: 'advanced-search-modal-custom', backdropDismiss: false, - componentProps: {} + componentProps: { + itemType: this.itemType + } }); modal.onDidDismiss().then(result => { if (result.data) { @@ -358,13 +392,10 @@ export class HomeComponent implements OnInit { this.WorkListObj.P_PAGE_NUM = 1; this.newWorkListResponse = []; this.showFormattedData = []; - this.selectedFilter = 'ALL'; - this.filters[this.currentActiveIndex].active = false; - this.currentActiveIndex = 0; - this.previousActiveIndex = 0; - this.filters[this.currentActiveIndex].active = true; + this.allFormattedData = []; + if (this.itemType !== '') { - this.disableFilters(); + this.configureFilters(); } this.isPostNoLoad = false; this.getAllPushNotificationFun(); @@ -398,21 +429,6 @@ export class HomeComponent implements OnInit { ); } - getFilteredData(filter: string) { - if (filter === 'ALL') { - this.showFormattedData = this.allFormattedData; - } else { - let arrayToFilter; - arrayToFilter = this.newWorkListResponse.filter((workList) => { - return workList.ITEM_TYPE === filter; - }); - const categorizeData = this.categorizeData(arrayToFilter); - this.showFormattedData = this.sortArray(categorizeData); - // const sortData = this.sortArray(arrayToFilter); - // this.showFormattedData = this.categorizeData(sortData); - } - } - checkDateExistance(currentDate: any, formattedData: any) { let existsBefore = false; let index = 0; @@ -429,33 +445,10 @@ export class HomeComponent implements OnInit { }; } - addCountInFilters(workList: any) { - if (workList.ITEM_TYPE === 'HRSSA') { - this.totalHR = this.totalHR + 1; - } else if (workList.ITEM_TYPE === 'POAPPRV') { - this.totalPO = this.totalPO + 1; - } else if (workList.ITEM_TYPE === 'REQAPPRV') { - this.totalPR = this.totalPR + 1; - } else if (workList.ITEM_TYPE === 'INVMOA') { - this.totalMR = this.totalMR + 1; - } else if (workList.ITEM_TYPE === 'INVITEM') { - this.totalIC = this.totalIC + 1; - } - } - categorizeData(arrayToCategorize: any) { - this.ngZone.run(() => { - this.totalHR = 0; - this.totalPO = 0; - this.totalPR = 0; - this.totalMR = 0; - this.totalIC = 0; - }) - const datePipe = new DatePipe('en-US'); const formattedData = []; for (const workList of arrayToCategorize) { - this.addCountInFilters(workList); const currentDate = datePipe.transform(new Date(workList.BEGIN_DATE), 'MMMM dd, y'); const currentObject = { date: '', @@ -486,6 +479,7 @@ export class HomeComponent implements OnInit { } private handleWorkListResult(result: any) { + this.common.stopLoading(); console.log(this.filters); const lastItemIndex = result.length - 1; const lastitem = result[lastItemIndex]; @@ -515,28 +509,25 @@ export class HomeComponent implements OnInit { this.showFormattedData = this.sortArray(categorizedWorkListResponse); this.allFormattedData = this.showFormattedData; this.common.sharedService.setSharedData(this.newWorkListResponse, HomeComponent.NOTIFICATION_ARR); - this.assignDataToFilters(); } } else { this.newWorkListResponse = []; - // this.assignDataToFilters(); if (this.showFormattedData.length === 0) { - this.resetFiltersUI(); + // this.resetFiltersUI(); } this.data.datasets[0].data[4] = this.ITGCount; this.showChart = true; - // this.common.stopLoading(); this.isLoading = false; } } - public resetFiltersUI () { + public resetFiltersUI() { this.ngZone.run(() => { this.filters[0].value = 0; this.filters[1].value = 0; this.filters[2].value = 0; this.filters[3].value = 0; - this.filters[4].value = 0; + this.filters[5].value = 0; this.filters[6].value = 0; this.data.datasets[0].data[0] = 0; @@ -544,11 +535,12 @@ export class HomeComponent implements OnInit { this.data.datasets[0].data[2] = 0; this.data.datasets[0].data[3] = 0; this.data.datasets[0].data[5] = 0; + this.data.datasets[0].data[6] = 0; }); } openNotificationDetail(obj) { - this.common.sharedService.setSharedData(this.selectedFilter, 'selectedFilter'); + this.common.sharedService.setSharedData(this.itemType, 'selectedFilter'); this.common.sharedService.setSharedData(false, 'loadWorkList'); this.common.sharedService.setSharedData(obj, HomeComponent.NOTIFICATION_DATA); if (obj.REQUEST_TYPE === 'PR') { @@ -582,24 +574,19 @@ export class HomeComponent implements OnInit { this.WorkListObj.P_SEARCH_SUBJECT = ''; } - // initializeWorkList() { - - // } - clearSearch() { this.common.startLoading(); - this.isLoading = true; - this.itemType = ''; - this.selectedFilter = 'ALL'; + this.isLoading = false; + this.itemType = 'HRSSA'; + this.selectedFilter = 'HR'; this.isPostNoLoad = true; - this.disableFilters(); + this.enableFilters(); this.resetData(); this.getAllPushNotificationFun(); } doInfinite(infiniteScroll) { if (!this.isReachEnd && this.selectedFilter !== 'ITG') { - this.common.startLoading(); this.WorklistService.getWorkList(this.WorkListObj, '', '', this.isPostNoLoad).subscribe((result) => { if (this.common.validResponse(result)) { this.handleWorkListResult(result.GetWorkList); @@ -619,46 +606,43 @@ 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.countChanged = false; + 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); }); } Details() { - this.workListService.getITGDetails('', '', this.isPostNoLoad) - .subscribe((result: any) => { - this.ITGCount = result.TotalCount; - this.totalRequestCount = this.totalRequestCount + result.TotalCount; - this.data.datasets[0].data[4] = this.ITGCount; - this.filters[5].value = result.TotalCount; - this.receivedITGCount = true; - }); + this.ITGCount = this.common.filterKeys['ITG'];//result.TotalCount; + this.data.datasets[0].data[4] = this.common.filterKeys['ITG'];//this.ITGCount; + this.filters[4].value = this.common.filterKeys['ITG']; + this.receivedITGCount = true; } searchBtn() { @@ -715,4 +699,58 @@ export class HomeComponent implements OnInit { } this.openITG(ITEM, NAME); } + + openNotificationsDashboard() { + this.common.startLoading(); + this.totalRequestCount = 0; + this.DS.getOpenNotifications('', '', false).subscribe((result: GetOpenNotificationsResponse) => { + if (this.common.validResponse(result)) { + const key = 'P_OPEN_NTF_NUMBER'; + // this.totalRequestCount = ; + this.ITGCountAllNotification(result[key]); + this.common.sharedService.setSharedData( + result, + 'worklistNotifications' + ); + + this.common.setFilterValues(result['GetOpenNotificationsList']); + + + } + }); + } + ITGCountAllNotification(count) { + this.workListService.getITGDetails('', '', this.isPostNoLoad).subscribe((result: any) => { + this.common.sharedService.setSharedData(result, MenuResponse.ITG_COUNTS); + this.common.filterKeys['ITG'] = result.TotalCount; + const values = this.common.getFiltersData(); + this.data = values.data; + this.filters = values.filters; + this.totalRequestCount = Math.floor(count + result.TotalCount); + this.common.sharedService.setSharedData(this.totalRequestCount, 'total-count'); + this.getCOCNotificationCount(); + this.common.stopLoading(); + }); + } + getCOCNotificationCount() { + const request = new COCRequest(); + request.ItgPageSize = 1; + request.ItgPageNo = 1; + request.Date = moment(new Date()).format("YYYY-MM-DD"); + + this.workListService.getCOCCount(request, '', '', this.isPostNoLoad).subscribe((result: any) => { + console.log(result); + const countResult = result.Mohemm_ITG_Pending_Task_ResponseItem; + const totalCount = countResult.escalation + countResult.waitingToClose + countResult.waitingForAcceptance + countResult.extendTATRequest; + this.common.filterKeys['COC'] = totalCount; + + + this.totalRequestCount = Math.floor(this.totalRequestCount + totalCount); + + this.common.sharedService.setSharedData(this.totalRequestCount, 'total-count'); + + this.common.stopLoading(); + }); + } + } diff --git a/Mohem/src/app/notification/models/COCRequest.ts b/Mohem/src/app/notification/models/COCRequest.ts new file mode 100644 index 00000000..97e45176 --- /dev/null +++ b/Mohem/src/app/notification/models/COCRequest.ts @@ -0,0 +1,8 @@ +import { Request } from 'src/app/hmg-common/services/models/request'; + +export class COCRequest extends Request { + public ItgPageSize: number; + public ItgPageNo: number; + public Date: string; + public EmployeeNumber: string; +} \ No newline at end of file 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..8c53b0bf 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,9 @@ 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 { COCRequest } from '../models/COCRequest'; + +import { UserItemTypes } from "../models/userItemTypeRequest"; @Injectable() export class WorklistMainService { @@ -30,7 +33,13 @@ 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 getPhoneNotificationBody = "Services/ERP.svc/REST/GET_PHONES_NOTIFICATION_BODY"; + public static getTerminationNotificationBody = "Services/ERP.svc/REST/GET_TERM_NOTIFICATION_BODY"; + public static getContactNotificationBody = "Services/ERP.svc/REST/GET_CONTACT_NOTIFICATION_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 getCEINotificationBody = "Services/ERP.svc/REST/GET_CEI_NOTIFICATION_BODY"; public static getPOItemHistory = "Services/ERP.svc/REST/GET_PO_ITEM_HISTORY"; public static getMOItemHistory = "Services/ERP.svc/REST/GET_MO_ITEM_HISTORY"; public static getNotificationButtons = "Services/ERP.svc/REST/GET_NOTIFICATION_BUTTONS"; @@ -40,7 +49,10 @@ export class WorklistMainService { public static getQutationAnalysisUrl = "Services/ERP.svc/REST/GET_QUOTATION_ANALYSIS"; public static getITGFormTaskCount = 'Services/COCWS.svc/REST/ITGGetTaskCountRequestType'; public static getITGFormTaskDetails = 'Services/COCWS.svc/REST/ITGFormsPendingTasks'; + public static getCOCCount = 'Services/COCWS.svc/REST/Mohemm_ITG_ReviewerAdmin_Pending_Tasks'; 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'; @@ -94,6 +106,21 @@ export class WorklistMainService { ); } + public getCEINotificationBody( + WorkListBodyRequest: any, + onError?: any, + errorLabel?: string + ): Observable { + const request = WorkListBodyRequest; + this.authService.authenticateRequest(request); + return this.api.post( + WorklistMainService.getCEINotificationBody, + request, + onError, + errorLabel + ); + } + public getPRNotificationBody( WorkListBodyRequest: any, onError?: any, @@ -124,6 +151,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, @@ -154,6 +211,52 @@ export class WorklistMainService { ); } + public getPhoneNotificationBody( + WorkListBodyRequest: any, + onError?: any, + errorLabel?: string + ): Observable { + const request = WorkListBodyRequest; + this.authService.authenticateRequest(request); + return this.api.post( + WorklistMainService.getPhoneNotificationBody, + request, + onError, + errorLabel + ); + } + + + public getTerminationNotificationBody( + WorkListBodyRequest: any, + onError?: any, + errorLabel?: string + ): Observable { + const request = WorkListBodyRequest; + this.authService.authenticateRequest(request); + return this.api.post( + WorklistMainService.getTerminationNotificationBody, + request, + onError, + errorLabel + ); + } + + public getContactNotificationBody( + WorkListBodyRequest: any, + onError?: any, + errorLabel?: string + ): Observable { + const request = WorkListBodyRequest; + this.authService.authenticateRequest(request); + return this.api.post( + WorklistMainService.getContactNotificationBody, + request, + onError, + errorLabel + ); + } + public getPOItemHistory( POItemHistoryReq: any, onError?: any, @@ -331,6 +434,28 @@ export class WorklistMainService { } } + public getCOCCount( request: COCRequest, onError?: any, errorLabel?: string, isPostNoLoad = false): Observable { + // const request = new Request(); + console.log(request); + this.authService.authenticateRequest(request); + request.EmployeeNumber = request.UserName; + if (isPostNoLoad) { + return this.api.postNoLoad( + WorklistMainService.getCOCCount, + request, + onError, + errorLabel + ); + } else { + return this.api.post( + WorklistMainService.getCOCCount, + request, + onError, + errorLabel + ); + } + } + public getITGActionRequest(itgrequest:itgRequest,actionURL:string, onError?: any, errorLabel?: string): Observable { this.authService.authenticateRequest(itgrequest); @@ -346,4 +471,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/service/worklist.service.ts b/Mohem/src/app/notification/service/worklist.service.ts index 1673443f..b35b867d 100644 --- a/Mohem/src/app/notification/service/worklist.service.ts +++ b/Mohem/src/app/notification/service/worklist.service.ts @@ -6,6 +6,7 @@ import { WorkListReplacmentEmployeeRequest } from '../models/ReplacmentEmployeeR import { WorkListActionHistoryRequest } from '../models/ActionHistoryReq'; import { WorKListRFCEmployeeResponse } from '../models/RFC-EmployeeRes'; import { WorkListActionHistoryResponse } from '../models/ActionHistoryRes'; +import { Request } from 'src/app/hmg-common/services/models/request'; @Injectable() @@ -16,6 +17,7 @@ export class WorklistService { public static getRFCEmployeeList = 'Services/ERP.svc/REST/GET_RFC_EMPLOYEE_LIST'; public static getActionHistory = 'Services/ERP.svc/REST/GET_ACTION_HISTORY'; public static getFavorite = 'Services/ERP.svc/REST/Mohemm_GetFavoriteReplacements'; + public static getFavoriteWithoutImage = 'Services/ERP.svc/REST/Mohemm_GetFavoriteReplacementsWithoutImage'; public static saveFavorite = 'Services/ERP.svc/REST/Mohemm_ChangeFavoriteReplacements'; constructor( public api: ConnectorService, @@ -53,6 +55,15 @@ export class WorklistService { public getFavorite(req: any, onError?: any, errorLabel?: string): Observable { this.authService.authenticateRequest(req); + console.log(req); + return this.api.post(WorklistService.getFavorite, req, onError, errorLabel); + } + + public getFavoriteByLetter(letter: string, onError?: any, errorLabel?: string): Observable { + const req = new Request(); + this.authService.authenticateRequest(req); + req['ItgFilter'] = letter; + console.log(letter); return this.api.post(WorklistService.getFavorite, req, onError, errorLabel); } public saveFavoriteList(request: any, onError?: any, errorLabel?: string): Observable { @@ -63,6 +74,11 @@ export class WorklistService { return this.api.post(WorklistService.saveFavorite, req, onError, errorLabel); } + public getFavoriteWithoutImage(req: any, onError?: any, errorLabel?: string): Observable { + this.authService.authenticateRequest(req); + return this.api.post(WorklistService.getFavoriteWithoutImage, req, onError, errorLabel); + } + public getFavoriteMyTeam(req: any, onError?: any, errorLabel?: string): Observable { this.authService.authenticateRequest(req); return this.api.post(WorklistService.getFavorite, req, 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..13606458 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}} +
+
@@ -561,7 +566,7 @@ - + Skip 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..fba4d82a 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, @@ -148,28 +149,28 @@ export class WorkListMainItgComponent implements OnInit { return '../assets/imgs/mohemm-action/info.png'; } if (actionName === 'Grant') { - return '../assets/imgs/mohemm-action/info.png'; + return '../assets/imgs/mohemm-action/grant.png'; } if (actionName === 'Delegate') { return '../assets/imgs/mohemm-action/delegate.png'; } if (actionName === 'Answer') { - return '../assets/imgs/mohemm-action/info.png'; + return '../assets/imgs/mohemm-action/answer.png'; } if (actionName === 'Question') { - return '../assets/imgs/mohemm-action/info.png'; + return '../assets/imgs/mohemm-action/question.png'; } if (actionName === 'ReportGenerated') { return '../assets/imgs/mohemm-action/ReportGenerated.png'; } if (actionName === 'Doable') { - return '../assets/imgs/mohemm-action/info.png'; + return '../assets/imgs/mohemm-action/Doable.png'; } if (actionName === 'NotDoable') { - return '../assets/imgs/mohemm-action/info.png'; + return '../assets/imgs/mohemm-action/notDoable.png'; } if (actionName === 'DataCorrected') { - return '../assets/imgs/mohemm-action/info.png'; + return '../assets/imgs/mohemm-action/data-corrected.png'; } } @@ -192,8 +193,14 @@ export class WorkListMainItgComponent implements OnInit { }); } - skip() { + skip(flag?) { // check if the user clicked on all type of request + if (flag != 'skip') { + this.common.setTotalNumberOfWorklistRequest(); + // this.common.assignDataToFilters(this.common.sharedService.getSharedData('worklistNotifications', false), 'ITG'); + if (this.common.filterKeys['ITG'] != 0) + this.common.filterKeys['ITG'] = (this.common.filterKeys['ITG'] - 1) + } if (this.is_all_items_sents) { for (let i = 1; i < this.all_request_names.length; i++) { for (let j = 0; j < this.all_request_names[i].data.length; j++) { @@ -213,6 +220,7 @@ export class WorkListMainItgComponent implements OnInit { } } else if (this.index === this.all_request_names.length) { // if its the end request redirecte to worklist home this.common.sharedService.setSharedData(true, 'loadWorkList'); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); return false; } @@ -228,6 +236,7 @@ export class WorkListMainItgComponent implements OnInit { return; } else { this.common.sharedService.setSharedData(true, 'loadWorkList'); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); return; } @@ -235,6 +244,7 @@ export class WorkListMainItgComponent implements OnInit { } } this.common.sharedService.setSharedData(true, 'loadWorkList'); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); return; } @@ -271,13 +281,17 @@ 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', 'done-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 +305,16 @@ export class WorkListMainItgComponent implements OnInit { this.common.presentAlert(this.ts.trPK('general', 'error-itg')); } else if (result.MessageStatus === 1) { + this.common.greenToastPK('worklist', 'done-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 +332,18 @@ export class WorkListMainItgComponent implements OnInit { } if (result.MessageStatus === 1) { - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'done-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 +356,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', 'done-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 +381,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', 'done-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 +409,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', 'done-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 +438,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', 'done-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 { @@ -470,7 +502,8 @@ export class WorkListMainItgComponent implements OnInit { this.actionService(1, this.commentText); } if (this.actionSelected === 'Delegate') { - this.common.sharedService.setSharedData(info,'selectedEmpInfo'), + this.common.sharedService.setSharedData(info, 'selectedEmpInfo'), + this.common.sharedService.setSharedData('Delegate', 'pressedBtn') this.presentModal(4); } if (this.actionSelected === 'Doable') { @@ -489,6 +522,7 @@ export class WorkListMainItgComponent implements OnInit { this.actionService(2, this.commentText); } if (this.actionSelected === 'RequestInformation') { + this.common.sharedService.setSharedData('RequestInformation', 'pressedBtn') this.presentModal(3); } if (this.actionSelected === 'ReportGenerated') { @@ -509,9 +543,9 @@ export class WorkListMainItgComponent implements OnInit { modal.cssClass = 'replaceRoll-modal'; modal.onDidDismiss() .then((data) => { - if(data.data.empData){ + 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; + this.commentText = data.data.comments ? data.data.comments : null; if (actionNumber === 3) { this.actionService(3, this.commentText); } else if (actionNumber === 4) { @@ -542,8 +576,8 @@ export class WorkListMainItgComponent implements OnInit { returnDateTime(stringDate: string) { let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - let dateArr= allDateTime[0].split('/') - let correctDate = dateArr[1]+'/'+dateArr[0]+'/'+dateArr[2]; + 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]; @@ -568,7 +602,7 @@ export class WorkListMainItgComponent implements OnInit { return this.locale[lang].month_names_short[month]; } - backgroundColor(statusName: string){ + 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': 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 85e6ad39..f54b721a 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,13 +1,12 @@ - - + @@ -60,9 +59,15 @@ --> - {{'replacementRoll, searchBy' | translate}} + + {{ + 'replacementRoll, title' | translate}} + {{ 'worklistMain, request' | translate}} + + {{ 'worklistMain, delegate' | translate}} - + + + +
+ + + +
+ + +
+ + + +
+ +
+ + +

{{'replacementRoll, workflow' | translate}}

+

{{'replacementRoll, favorite' | translate}}

+

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

+

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

+

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

+
+
+
+
+
+
+ + + +
+ +
+
+
+
- - + + +
+ +
+

{{filter}}

+
+ +
+ +
+ +
+

{{filter}}

+
+ +
+ + + -
+
{{'replacementRoll, search-result' | translate}}
@@ -227,8 +301,8 @@
-
+
{{'replacementRoll, favorite' | translate}}
@@ -259,6 +333,25 @@
+
+ +

+ {{'general, fav-showData' | translate}} +

+
+
+
+ +

+ {{'general, fav-noData' | translate}} +

+
+
+
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 9ea7dfa7..be2d6286 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 @@ -1,280 +1,313 @@ +.disabledButton { + opacity: 0.5; +} -.disabledButton{ - opacity:.5; - - } - - .radio-label{ - margin: 4px; - position: relative; - bottom: 4px; - } - ion-radio{ - --color-checked: #269db8; - } - .center{text-align: center;} - .boldTxtNav{ - font-weight: bold; - } - .employee-details{ - display:inline-block; - margin: 10px; - } - .empImgeRep{ - display: inline-block; - height: 40px; - width: 40px; - } - .star-fav{ - float: right; - margin: 10px; - } - .star-fav-left{ - float: left; - margin: 10px 5px; - } - .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;} - - .filterInput{ - border: solid var(--gray) 1px; - border-radius: 21px; - padding-left: 10px !important; - } - .filterInput-ar{ - - border: solid var(--gray) 1px; - border-radius: 21px; - --padding-start: 10px !important; - - } - .square-container{ - width:100%; - clear: both; - } - .square{ - clear: both; - } - .top-radio-row{ - font-size: 12px; - } +.radio-label { + margin: 4px; + position: relative; + bottom: 4px; +} +ion-radio { + --color-checked: #269db8; +} +.center { + text-align: center; +} +.boldTxtNav { + text-align: start; + font-weight: bold; + padding: 12px; +} +.employee-details { + display: inline-block; + margin: 10px; +} +.empImgeRep { + display: inline-block; + height: 40px; + width: 40px; +} +.star-fav { + float: right; + margin: 10px; +} +.star-fav-left { + float: left; + margin: 10px 5px; +} +.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; +} - 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 +.filterInput { + border: solid var(--gray) 1px; + border-radius: 21px; + padding-left: 10px !important; +} +.filterInput-ar { + border: solid var(--gray) 1px; + border-radius: 21px; + --padding-start: 10px !important; +} +.square-container { + width: 100%; + clear: both; +} +.square { + clear: both; +} +.top-radio-row { + font-size: 12px; +} + +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: 0.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; +} + +.isFavLetterActive { + color: #269db8; + display: block; + width: 60%; + float: right; + transition-duration: 0ms; + height: 35px; +} +.vl { + border-left: 2px solid lightgray; + height: 42px; +} +.searchText{ + background: transparent; + color: #269db8; + font-weight: bold; + text-decoration: underline; +} + +.letterDiv{ + font-weight: bold; + width: 10%; + float: right; +} +.letterDivLoop{ + display: block; + width: 60%; + float: right; + transition-duration: 0ms; + height: 35px; +} \ 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 bd1ab765..9426bf97 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 @@ -40,6 +40,16 @@ export class WorkListReplacementItgComponent implements OnInit { public direction = ''; arr = []; delegtedEmp; + isFavoriteLetterActive = false; + getPassActionMode: any; + + public slideOptsOne = { + slidesPerView: 6, + spaceBetween: 5 + }; + + public activeSelectedLetter:string; + constructor(public vacationRuleService: VacationRuleServiceService, public ts: TranslatorService, public cs: CommonService, @@ -54,7 +64,9 @@ export class WorkListReplacementItgComponent implements OnInit { // } ngOnInit() { + this.onChangeSelect1('1'); this.delegtedEmp = this.cs.sharedService.getSharedData('selectedEmpInfo', true); + this.getPassActionMode = this.cs.sharedService.getSharedData('pressedBtn', true); if (this.delegtedEmp === undefined) { if (!this.relatedList || this.relatedList.length === 0 || this.relatedList === undefined) { this.arr = this.cs.sharedService.getSharedData('workflow-user', false); @@ -68,7 +80,7 @@ export class WorkListReplacementItgComponent implements OnInit { this.relatedList.push(lookupObject[i]); } } - this.getFavruite(); + // this.getFavruite(); } else { this.select(this.delegtedEmp, 1); } @@ -164,9 +176,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); @@ -212,6 +226,31 @@ export class WorkListReplacementItgComponent implements OnInit { } } + onChangeSelect1(select) { + let selectValue = select; + 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; + + } + } getPlaceHolder() { return this.searchKeySelect == '1' ? this.ts.trPK('replacementRoll', 'searchbyname') : this.searchKeySelect == '2' ? this.ts.trPK('replacementRoll', 'searchbyusername') : this.ts.trPK('replacementRoll', 'searchbyemail'); } @@ -261,10 +300,10 @@ export class WorkListReplacementItgComponent implements OnInit { const userIndex = this.favoriteUserList.findIndex(x => x['USER_NAME'] === userID); console.log(userIndex); if (userIndex === -1) { - selEmp.IsFavorite = !selEmp.IsFavorite; this.cs.presentConfirmDialog( confirmBoxhtml , () => { + selEmp.IsFavorite = !selEmp.IsFavorite; const request = [ { @@ -306,28 +345,63 @@ export class WorkListReplacementItgComponent implements OnInit { } }); } + + + favLetter = []; + favIsActive = []; + getFavruite() { this.cs.startLoading(); - this.worklistService.getFavorite({}, () => { - + this.worklistService.getFavoriteWithoutImage({}, () => { }).subscribe((result) => { if (this.cs.validResponse(result)) { - this.cs.stopLoading(); - this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList']; - this.favoriteUserList.forEach((obj) => { + // this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList']; + let favList = result['Mohemm_GetFavoriteReplacementsList']; + favList.forEach((obj) => { obj.IsFavorite = true; + this.favLetter.push(obj.EMPLOYEE_DISPLAY_NAME.charAt(0).toUpperCase()); }); - this.relatedList.forEach((obj) => { - if (this.favoriteUserList.some(x => x.USER_NAME === obj.EmployeeID)) { - obj.IsFavorite = true; - } else { - obj.IsFavorite = false; - } + this.favLetter = this.favLetter.filter((elem, index, self) => { + return index === self.indexOf(elem); }); - console.log('enad test'); - console.log(this.relatedList); + if (this.activeSelectedLetter) { + this.selectedLetter(this.activeSelectedLetter); + } else { + this.favLetter.forEach((obj, index) => { + if(this.activeSelectedLetter) {} + if (index === 0) { + // this.selectedLetter(obj); + this.favIsActive.push(true); + } else { + this.favIsActive.push(false); + } + }); + } + console.log(this.favLetter); + console.log(this.favIsActive); } }); + // this.cs.startLoading(); + // this.worklistService.getFavorite({}, () => { + + // }).subscribe((result) => { + // if (this.cs.validResponse(result)) { + // this.cs.stopLoading(); + // this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList']; + // this.favoriteUserList.forEach((obj) => { + // obj.IsFavorite = true; + // }); + // this.relatedList.forEach((obj) => { + // if (this.favoriteUserList.some(x => x.USER_NAME === obj.EmployeeID)) { + // obj.IsFavorite = true; + // } else { + // obj.IsFavorite = false; + // } + // }); + // console.log('enad test'); + // console.log(this.relatedList); + // } + // }); } listOfRealted = []; @@ -365,4 +439,31 @@ export class WorkListReplacementItgComponent implements OnInit { return true; else { return false; } } + + selectedLetter(el) { + this.isFavoriteLetterActive = true; + this.favLetter.forEach((letter, index) => { + if (letter === el) { + this.favIsActive[index] = true; + this.activeSelectedLetter = el; + this.worklistService.getFavoriteByLetter(letter,() => { + }).subscribe((result) => { + if (this.cs.validResponse(result)) { + this.cs.stopLoading(); + this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList']; + this.listOfFav = this.favoriteUserList; + this.favoriteUserList.forEach((obj) => { + obj.IsFavorite = true; + }); + } + }); + } else { + this.favIsActive[index] = false; + } + }); + } + + returnIsActiveFunction(i) { + return this.favIsActive[i]; + } } diff --git a/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.html b/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.html index cd1fb3b3..ef3ff306 100644 --- a/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.html +++ b/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.html @@ -1,14 +1,12 @@ - - - - {{ + + + - @@ -18,9 +16,15 @@ - {{'replacementRoll, searchBy' | translate}} + + {{ + 'replacementRoll, title' | translate}} + {{ 'worklistMain, request' | translate}} + + {{ 'worklistMain, delegate' | translate}} + - + -
+ @@ -80,10 +83,68 @@
+
--> + +
+ + + +
+ + +
+ + + +
+ +
+ + +

{{'replacementRoll, workflow' | translate}}

+

{{'replacementRoll, favorite' | translate}}

+

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

+

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

+

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

+
+
+
+
+
- - + + + +
+ +
+
+
+
+ +
+ +
+

{{filter}}

+
+ +
+ +
+ +
+

{{filter}}

+
+ +
{{"replacementRoll, question" | translate}} : @@ -130,8 +191,8 @@
-
-
+
+
{{'replacementRoll, favorite' | translate}}
@@ -160,10 +221,18 @@
-
+ +
+ +

+ {{'general, fav-showData' | translate}} +

+
+
+
-

- Sorry there is no data +

+ {{'general, fav-noData' | translate}}

diff --git a/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.scss b/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.scss index 7bd616a2..ac20567e 100644 --- a/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.scss +++ b/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.scss @@ -16,7 +16,7 @@ button.item-button.button.button-md.button-clear.button-clear-md { // margin-right: 7%; // width: 100%; // } -.ionItem{ +.ionItem { border: #e4e4e4 solid; /* margin: 6px; */ /* padding: 11px; */ @@ -24,28 +24,24 @@ button.item-button.button.button-md.button-clear.button-clear-md { width: 164px; border-radius: 5px; text-align: center; - } - -.profileImageDiv{ - +.profileImageDiv { z-index: 3; position: relative; top: 0; - } -.profileImage{ - width:60px !important; - +.profileImage { + width: 60px !important; } -.activated{ - border: #209a83 0.02cm solid ; +.activated { + border: #209a83 0.02cm solid; } -.deactivated{ border: #e4e4e4 0.02cm solid; +.deactivated { + border: #e4e4e4 0.02cm solid; } -.repContentDiv{ +.repContentDiv { text-align: center; width: 85%; font-size: 14px; @@ -53,10 +49,9 @@ button.item-button.button.button-md.button-clear.button-clear-md { border-radius: 5px; padding: 20px 8px 8px 8px; margin-top: -9px; - margin-right: -35px - + margin-right: -35px; } -.selIEmpDiv{ +.selIEmpDiv { text-align: right; margin-bottom: -26px; margin-right: 0px; @@ -65,24 +60,23 @@ button.item-button.button.button-md.button-clear.button-clear-md { top: 0; } -.selIEmpImage{ - width:22px !important - +.selIEmpImage { + width: 22px !important; } -.noteInput{ +.noteInput { border: solid var(--gray) 1px; border-radius: 15px; margin: 8px 17px 0px 17px; padding: 10px 2px 10px 2px; } -.filterInput{ +.filterInput { border: solid var(--gray) 1px; border-radius: 21px; padding-left: 10px !important; } -.filterInput-ar{ +.filterInput-ar { // border: solid var(--gray) 1px; // border-radius: 21px; // padding-left: 10px !important; @@ -93,16 +87,15 @@ button.item-button.button.button-md.button-clear.button-clear-md { //margin-left: 123px; // padding-right: 129px; //margin-right: -136px; - } -.filterBtn{ +.filterBtn { background: var(--newgreen); --background: var (--newgreen); border-radius: 50%; height: 60px; width: 60px; } -.filterBtn-ar{ +.filterBtn-ar { // background: var(--newgreen); // --background: var (--newgreen); // border-radius: 50%; @@ -117,25 +110,23 @@ button.item-button.button.button-md.button-clear.button-clear-md { margin-right: 260px; } - - -*{ +* { box-sizing: border-box; } -.square-container{ +.square-container { // padding: 8px; - width:100%; + width: 100%; } -.square{ - // width:calc(100% / 2); - width:100%; - float:left; +.square { + // width:calc(100% / 2); + width: 100%; + float: left; position: relative; // padding-bottom: calc(100% / 2); } -.square .content{ +.square .content { width: calc(100% - 16px) !important; height: calc(100% - 16px) !important; margin: 8px; @@ -149,64 +140,114 @@ button.item-button.button.button-md.button-clear.button-clear-md { // box-shadow: 0 2px 5px rgba(0, 0, 0, 0.26); } -.disabledButton{ - opacity:.5; - +.disabledButton { + opacity: 0.5; } -.radio-label{ +.radio-label { font-size: 9px; - margin: 4px; - position: relative; - bottom: 4px; + margin: 4px; + position: relative; + bottom: 4px; } -ion-radio{ +ion-radio { --color-checked: #269db8; - } -.center{text-align: center;padding: 5px;} -.boldTxtNav{ - font-weight: bold; +} +.center { + text-align: center; padding: 5px; } -.employee-details{ - display:inline-block; +.boldTxtNav { + text-align: start; + font-weight: bold; + padding: 12px; +} +.employee-details { + display: inline-block; margin: 10px; text-overflow: ellipsis; white-space: nowrap; width: 70%; } -.empImgeRep{ +.empImgeRep { display: inline-block; height: 40px; width: 40px; } -.star-fav{ +.star-fav { float: right; margin: 15px 0px 0px 0px; } -.uk-margin{margin: 15px 15px 0px 15px; +.uk-margin { + margin: 15px 15px 0px 15px; font-weight: bold; clear: both; position: relative; - top: 10px;} -.uk-padding{ padding: 20px;} -.uk-padding .employee-details{ + 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; - } + 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; +} +.isFavLetterActive { + // background: #269db8; + // width: 55px; + // border-radius: 60px; + color: #269db8; + display: block; + width: 60%; + float: right; + transition-duration: 0ms; + height: 35px; +} +.vl { + border-left: 2px solid lightgray; + height: 42px; +} +.clearText{ + background: transparent; + color: #D55D5C; + font-weight: bold; + text-decoration: underline; +} +.searchText{ + background: transparent; + color: #269db8; + font-weight: bold; + text-decoration: underline; +} +.filterClass input{ + box-shadow: none !important; + -webkit-box-shadow: none !important; +} + +.letterDiv{ + font-weight: bold; + width: 10%; + float: right; +} +.letterDivLoop{ + display: block; + width: 60%; + float: right; + transition-duration: 0ms; + height: 35px; +} \ No newline at end of file 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..0e2a6346 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 @@ -49,11 +49,20 @@ export class WorkListReplacementRollComponent implements OnInit { arr = []; favoriteUserList: any = []; isFilter = true; + isFavoriteLetterActive = false; + + public slideOptsOne = { + slidesPerView: 6, + spaceBetween: 5 + }; + + public activeSelectedLetter: string; + constructor(public worklistService: WorklistService, private cs: CommonService, public ts: TranslatorService, public workListMainService: WorklistMainService, public modalCtrl: ModalController) { 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); @@ -352,7 +361,7 @@ export class WorkListReplacementRollComponent implements OnInit { // } // }, 5000); - this.cs.openNotificationPage(); + // this.cs.openNotificationPage(); // this.messageSuccess = true; // setTimeout(() => { @@ -433,25 +442,23 @@ export class WorkListReplacementRollComponent implements OnInit { } selectedType; - counter=0; + counter = 0; onChangeSelect(select) { let selectValue = select.detail.value; - if (selectValue == '1') { this.isSelect = true; this.isFilter = true; this.selectedType = 1; this.listOfRealted = this.actionHistory; - if(this.counter > 0) - { - this.actionHistory.forEach((obj, i) => { - if(this.favoriteUserList.find(x => x['USER_NAME'] === obj.USER_NAME)) { - this.actionHistory[i].IsFavorite = true; - }else{ - this.actionHistory[i].IsFavorite = false; - } - }); - } + // if (this.counter > 0) { + this.actionHistory.forEach((obj, i) => { + if (this.favoriteUserList.find(x => x['USER_NAME'] === obj.USER_NAME)) { + this.actionHistory[i].IsFavorite = true; + } else { + this.actionHistory[i].IsFavorite = false; + } + }); + // } this.counter = 1; } else if (selectValue === '4') { // if (this.favoriteUserList.length === 0 || this.favoriteUserList === undefined) { @@ -474,9 +481,9 @@ export class WorkListReplacementRollComponent implements OnInit { this.ReplacementList = []; clearTimeout(this.typingTimer); // this.typingTimer = setTimeout(() => { - // if (this.inputSearch.length > 2) { - this.getreplacmentemployee(); - // } + // if (this.inputSearch.length > 2) { + this.getreplacmentemployee(); + // } // }, 3000); @@ -489,34 +496,60 @@ 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'); } + + favLetter = []; + favIsActive = []; + getFavruite() { this.cs.startLoading(); - this.worklistService.getFavorite({}, () => { - + this.worklistService.getFavoriteWithoutImage({}, () => { }).subscribe((result) => { if (this.cs.validResponse(result)) { - this.cs.stopLoading(); - this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList']; - this.listOfFav = this.favoriteUserList; - this.favoriteUserList.forEach((obj) => { + // this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList']; + let favList = result['Mohemm_GetFavoriteReplacementsList']; + favList.forEach((obj) => { obj.IsFavorite = true; + this.favLetter.push(obj.EMPLOYEE_DISPLAY_NAME.charAt(0).toUpperCase()); + }); + this.favLetter = this.favLetter.filter((elem, index, self) => { + return index === self.indexOf(elem); }); - /**** 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 ****/ + this.favLetter.forEach((obj, index) => { + if (this.activeSelectedLetter) { + this.selectedLetter(this.activeSelectedLetter); + } + if (index === 0) { + // this.selectedLetter(obj); + this.favIsActive.push(true); + } else { + this.favIsActive.push(false); + } + }); + console.log(this.favLetter); + console.log(this.favIsActive); } }); + // this.worklistService.getFavorite({}, () => { + + // }).subscribe((result) => { + // if (this.cs.validResponse(result)) { + // this.cs.stopLoading(); + // this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList']; + // this.listOfFav = this.favoriteUserList; + // this.favoriteUserList.forEach((obj) => { + // obj.IsFavorite = true; + // }); + // } + // }); } + saveUserFavruiteList(request, isFav: boolean) { this.worklistService.saveFavoriteList(request, () => { }).subscribe((result) => { @@ -528,14 +561,10 @@ export class WorkListReplacementRollComponent implements OnInit { } this.getFavruite(); } - }) + }); } setFavorite(selEmp) { - selEmp.EMPLOYEE_DISPLAY_NAME = selEmp.EMPLOYEE_DISPLAY_NAME ? selEmp.EMPLOYEE_DISPLAY_NAME : selEmp.NAME; - selEmp.EMPLOYEE_IMAGE = selEmp.EMPLOYEE_IMAGE ? selEmp.EMPLOYEE_IMAGE : ''; - selEmp.EMAIL_ADDRESS = selEmp.EMAIL_ADDRESS ? selEmp.EMAIL_ADDRESS : ''; - selEmp.IsFavorite = !selEmp.IsFavorite; let confirmBoxhtml = `

Do you want to add ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` in your favorite list


@@ -559,6 +588,10 @@ export class WorkListReplacementRollComponent implements OnInit { this.cs.presentConfirmDialog( confirmBoxhtml , () => { + selEmp.EMPLOYEE_DISPLAY_NAME = selEmp.EMPLOYEE_DISPLAY_NAME ? selEmp.EMPLOYEE_DISPLAY_NAME : selEmp.NAME; + selEmp.EMPLOYEE_IMAGE = selEmp.EMPLOYEE_IMAGE ? selEmp.EMPLOYEE_IMAGE : ''; + selEmp.EMAIL_ADDRESS = selEmp.EMAIL_ADDRESS ? selEmp.EMAIL_ADDRESS : ''; + selEmp.IsFavorite = !selEmp.IsFavorite; const request = [ { @@ -573,6 +606,10 @@ export class WorkListReplacementRollComponent implements OnInit { this.saveUserFavruiteList(request, selEmp.IsFavorite); }, () => { }); } else { + selEmp.EMPLOYEE_DISPLAY_NAME = selEmp.EMPLOYEE_DISPLAY_NAME ? selEmp.EMPLOYEE_DISPLAY_NAME : selEmp.NAME; + selEmp.EMPLOYEE_IMAGE = selEmp.EMPLOYEE_IMAGE ? selEmp.EMPLOYEE_IMAGE : ''; + selEmp.EMAIL_ADDRESS = selEmp.EMAIL_ADDRESS ? selEmp.EMAIL_ADDRESS : ''; + selEmp.IsFavorite = !selEmp.IsFavorite; const request = [ { @@ -591,6 +628,7 @@ export class WorkListReplacementRollComponent implements OnInit { listOfRealted: any = []; listOfFav: any = []; + filterList(event) { const val = event.target.value; if (this.selectedType === 1) { @@ -613,4 +651,35 @@ export class WorkListReplacementRollComponent implements OnInit { return; } } + + selectedLetter(el) { + this.isFavoriteLetterActive = true; + this.favLetter.forEach((letter, index) => { + if (letter === el) { + this.favIsActive[index] = true; + this.activeSelectedLetter = el; + this.worklistService.getFavoriteByLetter(letter, () => { + }).subscribe((result) => { + if (this.cs.validResponse(result)) { + this.cs.stopLoading(); + this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList']; + this.listOfFav = this.favoriteUserList; + this.favoriteUserList.forEach((obj) => { + obj.IsFavorite = true; + }); + } + }); + } else { + this.favIsActive[index] = false; + } + }); + } + + returnIsActiveFunction(i) { + return this.favIsActive[i]; + } + + clearSearchInput() { + this.inputSearch = ''; + } } diff --git a/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.ts b/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.ts index e8e41c87..b18b1bba 100644 --- a/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.ts +++ b/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.ts @@ -7,6 +7,7 @@ import { WorklistService } from '../service/worklist.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { ModalController } from '@ionic/angular'; +import { HomeComponent } from '../home/home.component'; @Component({ selector: 'app-work-list-rfc', @@ -39,7 +40,7 @@ export class WorkListRfcComponent implements OnInit { public ts: TranslatorService, public workListMainService: WorklistMainService, public modalCtrl: ModalController - ) { + ) { this.getPassNotificationDetails = this.cs.sharedService.getSharedData('passNotificationInfo'); this.getpassResAttr = this.cs.sharedService.getSharedData('passResAttr'); @@ -125,7 +126,7 @@ export class WorkListRfcComponent implements OnInit { if (result.MessageStatus == 1) { this.cs.sharedService.setSharedData(true, 'loadWorkList'); - + this.messageSuccess = true; setTimeout(() => { @@ -138,6 +139,7 @@ export class WorkListRfcComponent implements OnInit { }); }, 5000); + this.cs.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.cs.openNotificationPage(); } @@ -178,18 +180,18 @@ export class WorkListRfcComponent implements OnInit { this.modalCtrl.dismiss(); } - select(selectEmp,index){ + select(selectEmp, index) { console.log(selectEmp.USER_NAME); console.log(selectEmp.SEQ); - this.radioButtonValue=selectEmp.USER_NAME + this.radioButtonValue = selectEmp.USER_NAME this.seqNo = selectEmp.SEQ; -////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////// // let emp: any = this.RFCEmployeeListListRes[v]; // this.seqNo = emp.SEQ; // this.radioButtonValue = emp.USER_NAME; - this.active=index; + this.active = index; } } diff --git a/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.html b/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.html index 67b487cc..a185754a 100644 --- a/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.html +++ b/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.html @@ -54,6 +54,7 @@ PR MR IC + STAMP diff --git a/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.ts b/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.ts index 8b9db09f..319c5c60 100644 --- a/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.ts +++ b/Mohem/src/app/notification/worklist-advanced-search/worklist-advanced-search.component.ts @@ -15,7 +15,7 @@ export class WorklistAdvancedSearchComponent implements OnInit { public inputSearch = ''; public selectedValue = ''; public notificationType = ''; - public itemType = ''; + public itemType; public direction: string; constructor( diff --git a/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.html b/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.html index b22aa453..c2161ae3 100644 --- a/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.html +++ b/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.html @@ -435,7 +435,7 @@ {{reqInfo_label}} - + {{'worklistMain, skip' | translate}} 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..1d08ec1f 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 @@ -381,12 +381,12 @@ export class WorklistMainIcComponent implements OnInit { this.common.sharedService.setSharedData(this.notificationButtonRes, "passActionMore"); // console.log("test" + this.notificationButtonRes.length); for (let i = 0; i < this.notificationButtonRes.length; i++) { - if (this.notificationButtonRes[i].BUTTON_ACTION == "APPROVE") { + if (this.notificationButtonRes[i].BUTTON_ACTION == "APPROVE" || this.notificationButtonRes[i].BUTTON_ACTION == "APPROVED") { this.approve_label = this.notificationButtonRes[i].BUTTON_LABEL; this.approveDis = true; } else - if (this.notificationButtonRes[i].BUTTON_ACTION == "REJECT") { + if (this.notificationButtonRes[i].BUTTON_ACTION == "REJECT" || this.notificationButtonRes[i].BUTTON_ACTION == "REJECTED") { this.reject_label = this.notificationButtonRes[i].BUTTON_LABEL; this.rejectDis = true; } else @@ -401,7 +401,7 @@ export class WorklistMainIcComponent implements OnInit { this.closeDis = true; } else if ( - this.notificationButtonRes[i].BUTTON_ACTION != "APPROVE" && this.notificationButtonRes[i].BUTTON_ACTION != "REJECT" && this.notificationButtonRes[i].BUTTON_ACTION != "REQUEST_INFO" && this.notificationButtonRes[i].BUTTON_ACTION != "CLOSE") { + this.notificationButtonRes[i].BUTTON_ACTION != "APPROVE" && this.notificationButtonRes[i].BUTTON_ACTION != "REJECT" && this.notificationButtonRes[i].BUTTON_ACTION != "REQUEST_INFO" && this.notificationButtonRes[i].BUTTON_ACTION != "CLOSE" && this.notificationButtonRes[i].BUTTON_ACTION != "REJECTED" && this.notificationButtonRes[i].BUTTON_ACTION != "APPROVED") { this.moreDisabled = false; } @@ -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', 'done-successfully'); + this.common.setTotalNumberOfWorklistRequest(); setTimeout(() => { - this.messageSuccess = false; - // this.openNotificationsDashboard(); + this.nextNotfification(); - }, 5000); + }, 300); + } else { + this.common.redToastPK('worklist', 'save-error'); } } // valid it } @@ -458,7 +461,7 @@ export class WorklistMainIcComponent implements OnInit { // } // } - public nextNotfification() { + public nextNotfification(flag?) { if (document.getElementById('notificationDynamicFieldsPO') != null) { document.getElementById('notificationDynamicFieldsPO').innerHTML = ''; } @@ -467,6 +470,9 @@ export class WorklistMainIcComponent implements OnInit { let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo); let previousRequest = this.notificationArray[index].REQUEST_TYPE; let previousRequestType = this.notificationArray[index].ITEM_TYPE; + if (this.common.filterKeys[previousRequestType] != 0 && flag != 'skip') + this.common.filterKeys[previousRequestType] = (this.common.filterKeys[previousRequestType] - 1) + index += 1; if (index < this.notificationArray.length) { @@ -477,9 +483,13 @@ export class WorklistMainIcComponent implements OnInit { } else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) { this.checkRequestType(index); } else { + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } else { + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } @@ -1210,13 +1220,17 @@ export class WorklistMainIcComponent implements OnInit { return; } else if (data.data.data == "Success") { // this.openNotificationsDashboard(); - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'done-successfully'); + this.common.setTotalNumberOfWorklistRequest(); setTimeout(() => { - this.messageSuccess = false; + this.nextNotfification(); - }, 2000); + }, 300); // this.nextNotfification(); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); @@ -1272,34 +1286,34 @@ export class WorklistMainIcComponent implements OnInit { this.actionButton(flag); } - returnDateTime(stringDate: string){ + returnDateTime(stringDate: string) { let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - let fullDate = this.transform(stringDate); + let fullDate = this.transform(stringDate); 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]; -}; + }; } diff --git a/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.html b/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.html index 59a8ead5..de2dff5f 100644 --- a/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.html +++ b/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.html @@ -665,7 +665,7 @@ - + {{'worklistMain, skip' | translate}} 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..bfdf25c6 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,16 @@ 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', 'done-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; // this.openNotificationsDashboard(); + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); - }, 5000); + }, 100); + } else { + this.common.redToastPK('worklist', 'save-error'); } } // valid it } @@ -402,7 +406,7 @@ export class WorklistMainMRComponent implements OnInit { // } - public nextNotfification() { + public nextNotfification(flag?) { //let itemExist = false; if (document.getElementById("notificationDynamicFieldsMR") != null) { document.getElementById("notificationDynamicFieldsMR").innerHTML = ""; @@ -411,7 +415,11 @@ export class WorklistMainMRComponent implements OnInit { let itemNo = this.getPassNotificationDetails.ROW_NUM; let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo); let previousRequest = this.notificationArray[index].REQUEST_TYPE; + let previousRequestType = this.notificationArray[index].ITEM_TYPE; + if (this.common.filterKeys[previousRequestType] != 0 && flag != 'skip') + this.common.filterKeys[previousRequestType] = (this.common.filterKeys[previousRequestType] - 1) + index += 1; if (index < this.notificationArray.length) { @@ -422,9 +430,13 @@ export class WorklistMainMRComponent implements OnInit { } else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) { this.checkRequestType(index); } else { + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } else { + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } @@ -1111,13 +1123,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', 'done-successfully'); setTimeout(() => { - this.messageSuccess = false; + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); - }, 2000); + }, 100); // this.nextNotfification(); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); @@ -1147,7 +1162,7 @@ export class WorklistMainMRComponent implements OnInit { if (data.data == 'cancel' || data.data == undefined) { return; } else if (data.data == 'Success') { - // this.openNotificationsDashboard(); + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); } @@ -1218,35 +1233,35 @@ export class WorklistMainMRComponent implements OnInit { this.actionButton(flag); } - returnDateTime(stringDate: string){ + returnDateTime(stringDate: string) { let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - let fullDate = this.transform(stringDate); + let fullDate = this.transform(stringDate); 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]; -}; + }; } diff --git a/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.html b/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.html index 0c4f4e38..bd933831 100644 --- a/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.html +++ b/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.html @@ -633,7 +633,7 @@ {{reqInfo_label}} - + {{'worklistMain, skip' | translate}} 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..f2e79a55 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,14 @@ 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', 'done-successfully'); setTimeout(() => { - this.messageSuccess = false; - // this.openNotificationsDashboard(); + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); - }, 5000); + }, 100); + } else { + this.common.redToastPK('worklist', 'save-error'); } } // valid it } @@ -435,7 +437,7 @@ export class WorklistMainPoComponent implements OnInit { // } // } - public nextNotfification() { + public nextNotfification(flag?) { if (document.getElementById('notificationDynamicFieldsPO') != null) { document.getElementById('notificationDynamicFieldsPO').innerHTML = ''; } @@ -443,7 +445,11 @@ export class WorklistMainPoComponent implements OnInit { let itemNo = this.getPassNotificationDetails.ROW_NUM; let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo); let previousRequest = this.notificationArray[index].REQUEST_TYPE; + let previousRequestType = this.notificationArray[index].ITEM_TYPE; + if (this.common.filterKeys[previousRequestType] != 0 && flag != 'skip') + this.common.filterKeys[previousRequestType] = (this.common.filterKeys[previousRequestType] - 1) + index += 1; if (index < this.notificationArray.length) { @@ -454,9 +460,13 @@ export class WorklistMainPoComponent implements OnInit { } else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) { this.checkRequestType(index); } else { + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } else { + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } @@ -1168,64 +1178,44 @@ export class WorklistMainPoComponent implements OnInit { } async openRepRolModal() { - - this.common.sharedService.setSharedData(this.actionHistoryRes, 'actionHistoryData'); - const modal = await this.modalCtrl.create({ component: WorkListReplacementRollComponent, backdropDismiss: false, - }); modal.cssClass = 'replaceRoll-modal'; - modal.onDidDismiss() .then((data) => { - console.log(data.data); - - if (data.data.data == "cancel" || data.data.data == undefined) { + if (data.data.data === 'cancel' || data.data.data === undefined) { return; - } else if (data.data.data == "Success") { - // this.openNotificationsDashboard(); - this.messageSuccess = true; + } else if (data.data.data === 'Success') { + this.common.greenToastPK('worklist', 'done-successfully'); setTimeout(() => { - this.messageSuccess = false; + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); - }, 2000); - // this.nextNotfification(); - + }, 100); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); return await modal.present(); - - - } async openRFCModal() { - - - - const modal = await this.modalCtrl.create({ component: WorkListRfcComponent, backdropDismiss: false, }); modal.cssClass = 'replaceRoll-modal'; - modal.onDidDismiss() .then((data) => { console.log(data.data); - if (data.data == "cancel" || data.data == undefined) { return; - } else { - - - } + } else { } }); return await modal.present(); @@ -1250,33 +1240,33 @@ export class WorklistMainPoComponent implements OnInit { this.actionButton(flag); } - returnDateTime(stringDate: string){ + returnDateTime(stringDate: string) { let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - let fullDate = this.transform(stringDate); + let fullDate = this.transform(stringDate); 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]; -}; + }; } diff --git a/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.html b/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.html index ccc730ee..69de2e55 100644 --- a/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.html +++ b/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.html @@ -411,7 +411,7 @@ {{reqInfo_label}} - + {{'worklistMain, skip' | translate}} 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..74cc53ce 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,11 @@ export class WorklistMainPRComponent implements OnInit { // tslint:disable-next-line: triple-equals if (result.MessageStatus == 1) { this.common.sharedService.setSharedData(true, 'loadWorkList'); - // show succsfull popup - this.messageSuccess = true; - setTimeout(() => { - this.messageSuccess = false; - }, 5000); - // this.openNotificationsDashboard(); + this.common.greenToastPK('worklist', 'done-successfully'); + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); + } else { + this.common.redToastPK('worklist', 'save-error'); } } // valid it } @@ -427,7 +425,7 @@ export class WorklistMainPRComponent implements OnInit { // } - public nextNotfification() { + public nextNotfification(flag?) { //let itemExist = false; if (document.getElementById("notificationDynamicFieldsPR") != null) { @@ -437,9 +435,12 @@ export class WorklistMainPRComponent implements OnInit { let itemNo = this.getPassNotificationDetails.ROW_NUM; console.log(itemNo); let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo); - console.log(index); - console.log(this.notificationArray); + let previousRequest = this.notificationArray[index].REQUEST_TYPE; + let previousRequestType = this.notificationArray[index].ITEM_TYPE; + if (this.common.filterKeys[previousRequestType] != 0 && flag != 'skip') + this.common.filterKeys[previousRequestType] = (this.common.filterKeys[previousRequestType] - 1) + index += 1; if (index < this.notificationArray.length) { @@ -450,9 +451,13 @@ export class WorklistMainPRComponent implements OnInit { } else if (previousRequest === this.notificationArray[index].REQUEST_TYPE) { this.checkRequestType(index); } else { + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } else { + //this.common.setTotalNumberOfWorklistRequest(true); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } @@ -1111,13 +1116,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', 'done-successfully'); setTimeout(() => { - this.messageSuccess = false; + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); - }, 2000); + }, 100); // this.nextNotfification(); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); @@ -1172,33 +1180,33 @@ export class WorklistMainPRComponent implements OnInit { this.actionButton(flag); } - returnDateTime(stringDate: string){ + returnDateTime(stringDate: string) { let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - let fullDate = this.transform(stringDate); + let fullDate = this.transform(stringDate); 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]; -}; + }; } \ No newline at end of file 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..0bc23f9c 100644 --- a/Mohem/src/app/notification/worklist-main/worklist-main.component.html +++ b/Mohem/src/app/notification/worklist-main/worklist-main.component.html @@ -47,9 +47,25 @@ - -
+ + +
+

{{'worklist, loading'| translate}}

+
+ +
+

{{ 'general, empty' | translate}}

+
+ +
@@ -68,6 +84,165 @@
+ +
+ + +
+ + + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+
+
+
+
+ +
+ + +
+ + + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + + +
+ +
+ + +
+ +
+ + +
+ +
+ + + +
+ + +
+ + +
+ + +
+ + +
+
+
+
+ + + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+
+
+
+
+
+
+
+
{{ts.trPK('worklistMain','employee-on-leave')}} @@ -120,9 +295,21 @@ - + + getPassNotificationDetails?.REQUEST_TYPE == 'ADDRESS' || + getPassNotificationDetails?.REQUEST_TYPE == 'CONTACT' && + getPassNotificationDetails?.REQUEST_TYPE != 'PHONE_NUMBERS' && + getPassNotificationDetails?.REQUEST_TYPE != 'TERMINATION' && + getPassNotificationDetails?.REQUEST_TYPE != 'CEI'"> +
+

{{'worklist, loading'| translate}}

+
+ +
+

{{ 'general, empty' | translate}}

+
@@ -139,7 +326,7 @@ - + @@ -158,8 +345,101 @@
- + + +
+

{{'worklist, loading'| translate}}

+
+ +
+

{{ 'general, empty' | translate}}

+
+
+ + +
+ + + +
+ +
+
+
+
+
+
+
+ + + +
+

{{'worklist, loading'| translate}}

+
+ +
+

{{ 'general, empty' | translate}}

+
+
+ + +
+ + + +
+ +
+
+
+
+
+
+
+ + + +
+

{{'worklist, loading'| translate}}

+
+ +
+

{{ 'general, empty' | translate}}

+
+
+ + +
+ + + +
+ +
+
+
+
+
+
+
+ @@ -541,7 +821,7 @@ {{reqInfo_label}} - + {{'worklistMain, skip' | translate}} 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 fcfaf93e..4b9560b3 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; @@ -88,6 +90,7 @@ export class WorklistMainComponent implements OnInit { newArr: any = []; selEmp: any; subordinatesleaveList: any = []; + allSubordinatesleaveList: any = []; private WorkListSubmitterInfoObj: WorkListSubmitterInfoRequest; submitterInfoRes: any; approveDis: boolean = false; @@ -107,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, @@ -143,6 +148,7 @@ export class WorklistMainComponent implements OnInit { false ); this.selectedFilter = this.common.sharedService.getSharedData('selectedFilter', false); + console.log(this.selectedFilter); if (this.selEmp) { } else { this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => { if (user) { @@ -209,6 +215,8 @@ export class WorklistMainComponent implements OnInit { HomeComponent.NOTIFICATION_DATA, false ); + console.log('/////////////////////////////////////'); + console.log(this.getPassNotificationDetails); this.notificationArray = [] this.subordinatesleaveList = []; @@ -217,7 +225,8 @@ export class WorklistMainComponent implements OnInit { false ); console.log(this.selectedFilter); - if (this.selectedFilter === 'HRSSA') { + if (this.selectedFilter === 'HRSSA' || this.selectedFilter === 'STAMP') { + console.log("ENAD") this.arr_hr_req_only = []; this.sortRequests(); } @@ -276,10 +285,62 @@ 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); + } else if (this.getPassNotificationDetails.REQUEST_TYPE === 'TERMINATION') { + this.getTerminationNotificationDetails(this.WorkListBodyObj); + } else if (this.getPassNotificationDetails.REQUEST_TYPE === 'PHONE_NUMBERS') { + this.getPhoneNotificationDetails(this.WorkListBodyObj); + } else if (this.getPassNotificationDetails.REQUEST_TYPE === 'CONTACT') { + this.getContactNotificationDetails(this.WorkListBodyObj); + } else if (this.getPassNotificationDetails.REQUEST_TYPE === 'CEI') { + this.getCEINotification(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"); + }); + } + + getTerminationNotificationDetails(notificationBodyObj) { + this.worklistMainService + .getTerminationNotificationBody(notificationBodyObj) + .subscribe((result: PRNotificatonBodyResponse) => { + this.handleWorkListBodyResult(result, "TERMINATION"); + }); + } + + getPhoneNotificationDetails(notificationBodyObj) { + this.worklistMainService + .getPhoneNotificationBody(notificationBodyObj) + .subscribe((result: PRNotificatonBodyResponse) => { + this.handleWorkListBodyResult(result, "PHONE_NUMBERS"); + }); + } + + getContactNotificationDetails(notificationBodyObj) { + this.worklistMainService + .getContactNotificationBody(notificationBodyObj) + .subscribe((result: PRNotificatonBodyResponse) => { + this.handleWorkListBodyResult(result, "CONTACT"); + }); + } + getBasicDetailsNotification(notificationBodyObj) { this.worklistMainService .getBasicDetailNotificationBody(notificationBodyObj) @@ -295,6 +356,14 @@ export class WorklistMainComponent implements OnInit { }); } + getCEINotification(notificationBodyObj) { + this.worklistMainService + .getCEINotificationBody(notificationBodyObj) + .subscribe((result: MONotificatonBodyResponse) => { + this.handleWorkListBodyResult(result, "CEI"); + }); + } + getPRNotificationDetails(notificationBodyObj) { this.worklistMainService .getPRNotificationBody(notificationBodyObj) @@ -336,7 +405,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; @@ -367,18 +436,60 @@ export class WorklistMainComponent implements OnInit { this.notificationBodyRes = result.GetAbsenceCollectionNotificationBodyList; } - } else if (Type === "ADDRESS"){ + } else if (Type === "ADDRESS") { + console.log(result.GetAddressNotificationBodyList) if (result.GetAddressNotificationBodyList) { this.notificationBodyRes = - result.GetAddressNotificationBodyList; + result.GetAddressNotificationBodyList; console.log(result); } - } else if (Type === "BASIC_DETAILS"){ + } else if (Type === "BASIC_DETAILS") { if (result.GetBasicDetNtfBodyList) { this.notificationBodyRes = result.GetBasicDetNtfBodyList; - console.log(result); - } + console.log(result); + } + } else if (Type === "CEI") { + if (result.GetCEICollectionNotificationBodyList) { + this.notificationBodyRes = + result.GetCEICollectionNotificationBodyList[0].Collection_Notification; + console.log(result.GetCEICollectionNotificationBodyList[0].Collection_Notification); + } + } + 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); + } + } + else if (Type === "PHONE_NUMBERS") { + if (result.GetPhonesNotificationBodyList) { + this.notificationBodyRes = + result.GetPhonesNotificationBodyList; + console.log(result); + } + } + else if (Type === "TERMINATION") { + if (result.GetTermNotificationBodyList) { + this.notificationBodyRes = + result.GetTermNotificationBodyList; + console.log(result); + } + } + else if (Type === "CONTACT") { + if (result.GetContactNotificationBodyList) { + this.notificationBodyRes = + result.GetContactNotificationBodyList.ContactNotificationBody; + console.log(result); + } } } } //End handleWorkListBodyResult @@ -448,12 +559,14 @@ export class WorklistMainComponent implements OnInit { // this.notificationArray.splice(i, 1); // } // } - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'done-successfully'); + this.common.setTotalNumberOfWorklistRequest(); setTimeout(() => { - this.messageSuccess = false; - // this.openNotificationsDashboard(); this.nextNotfification(); - }, 2000); + }, 300); + } else { + this.common.redToastPK('worklist', 'save-error'); } } // valid it } @@ -483,18 +596,27 @@ export class WorklistMainComponent implements OnInit { // } - public nextNotfification() { + public nextNotfification(flag?) { if (document.getElementById("notificationDynamicFields") != null) { document.getElementById("notificationDynamicFields").innerHTML = ""; } + let itemNo = this.getPassNotificationDetails.ROW_NUM; console.log(itemNo); let index = this.notificationArray.findIndex(x => x.ROW_NUM === itemNo); console.log(index); console.log(this.notificationArray); let previousRequest = this.notificationArray[index].REQUEST_TYPE; - index += 1; + let itemType = this.notificationArray[index].ITEM_TYPE; + if (previousRequest == 'STAMP_MS' || previousRequest == 'STAMP_NS') { + previousRequest = 'STAMP'; + } else { + previousRequest = itemType; + } + if (this.common.filterKeys[previousRequest] != 0 && flag != 'skip') + this.common.filterKeys[previousRequest] = (this.common.filterKeys[previousRequest] - 1) + index += 1; if (index < this.notificationArray.length) { this.activeSegment = 'info'; if (this.selectedFilter === 'ALL') { @@ -508,11 +630,15 @@ export class WorklistMainComponent implements OnInit { this.common.sharedService.setSharedData(this.arr_hr_req_only[requestIndex], HomeComponent.NOTIFICATION_DATA); this.intializeNotificationDetail(); } else { + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + //this.common.setTotalNumberOfWorklistRequest(true); this.common.openNotificationPage(); } } } } else { + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + //this.common.setTotalNumberOfWorklistRequest(true); this.common.openNotificationPage(); } @@ -905,7 +1031,7 @@ export class WorklistMainComponent implements OnInit { let jobTitle = title.split('.'); if (jobTitle && jobTitle.length > 1) { jobName = jobTitle[0] + " " + jobTitle[1]; - }​ + } } else { jobName = ''; } @@ -986,7 +1112,14 @@ export class WorklistMainComponent implements OnInit { public handleSubordinatesLeavesResult(result) { if (this.common.validResponse(result)) { if (this.common.hasData(result.SubordinatesOnLeavesList)) { - this.subordinatesleaveList = result.SubordinatesOnLeavesList; + this.allSubordinatesleaveList = result.SubordinatesOnLeavesList; + // this.subordinatesleaveList.push(this.allSubordinatesleaveList.find( + // el => el.EMPLOYEE_NUMBER !== this.getPassNotificationDetails.SELECTED_EMPLOYEE_NUMBER)); + this.allSubordinatesleaveList.forEach(element => { + if (element.EMPLOYEE_NUMBER !== this.getPassNotificationDetails.SELECTED_EMPLOYEE_NUMBER) { + this.subordinatesleaveList.push(element); + } + }); } } } @@ -1021,12 +1154,16 @@ 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', 'done-successfully'); + this.common.setTotalNumberOfWorklistRequest(); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; this.nextNotfification(); - }, 2000); + }, 300); // this.nextNotfification(); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); return await modal.present(); @@ -1045,6 +1182,7 @@ export class WorklistMainComponent implements OnInit { return; } else if (data.data == "Success") { // this.openNotificationsDashboard(); + this.common.setTotalNumberOfWorklistRequest(); this.nextNotfification(); } }); @@ -1113,41 +1251,48 @@ export class WorklistMainComponent implements OnInit { } sortRequests() { for (let i = 0; i < this.notificationArray.length; i++) { - if (this.notificationArray[i].ITEM_TYPE === 'HRSSA') { + if (this.notificationArray[i].ITEM_TYPE === 'HRSSA' || this.notificationArray[i].ITEM_TYPE === 'STAMP') { this.arr_hr_req_only.push(this.notificationArray[i]); } } console.log(this.arr_hr_req_only); } - returnDateTime(stringDate: string){ + returnDateTime(stringDate: string) { let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - let fullDate = this.transform(stringDate); + let fullDate = this.transform(stringDate); 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]; -} + } + + 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 new file mode 100644 index 00000000..490f2123 --- /dev/null +++ b/Mohem/src/app/notification/worklist-setting/worklist-setting.component.html @@ -0,0 +1,41 @@ + + + {{ 'worklist, worklist-setting' | translate}} + + + + + + + + + +
+

{{ 'worklist, turn-on-notification' | translate}}

+
+
+ + + + +

item type

+
+

FYA

+          +

FYI

+
+ + +

{{data.ITEM_TYPE}}

+
+ +     + +
+
+
+
+ + + {{ 'worklist, save-changes' | translate}} + \ No newline at end of file diff --git a/Mohem/src/app/notification/worklist-setting/worklist-setting.component.scss b/Mohem/src/app/notification/worklist-setting/worklist-setting.component.scss new file mode 100644 index 00000000..927b8dc3 --- /dev/null +++ b/Mohem/src/app/notification/worklist-setting/worklist-setting.component.scss @@ -0,0 +1,7 @@ +.header-toolbar{ + --background: #269DB8; +} + +ion-toggle{ + --background-checked: #269DB8; +} \ No newline at end of file diff --git a/Mohem/src/app/notification/worklist-setting/worklist-setting.component.spec.ts b/Mohem/src/app/notification/worklist-setting/worklist-setting.component.spec.ts new file mode 100644 index 00000000..627b60c6 --- /dev/null +++ b/Mohem/src/app/notification/worklist-setting/worklist-setting.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { WorklistSettingComponent } from './worklist-setting.component'; + +describe('WorklistSettingComponent', () => { + let component: WorklistSettingComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ WorklistSettingComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(WorklistSettingComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/notification/worklist-setting/worklist-setting.component.ts b/Mohem/src/app/notification/worklist-setting/worklist-setting.component.ts new file mode 100644 index 00000000..1521d3e6 --- /dev/null +++ b/Mohem/src/app/notification/worklist-setting/worklist-setting.component.ts @@ -0,0 +1,86 @@ +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', + templateUrl: './worklist-setting.component.html', + styleUrls: ['./worklist-setting.component.scss'], +}) +export class WorklistSettingComponent implements OnInit { + + notificationList = []; + request = []; + isChange = false; + + public direction: string; + + 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; + }); + } + + 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/app/offersdiscount/filter/filter.component.html b/Mohem/src/app/offersdiscount/filter/filter.component.html index f8391b3b..ed6856df 100644 --- a/Mohem/src/app/offersdiscount/filter/filter.component.html +++ b/Mohem/src/app/offersdiscount/filter/filter.component.html @@ -18,7 +18,7 @@ {{key.categoryName_ar}} -
+
diff --git a/Mohem/src/app/offersdiscount/home/home.component.html b/Mohem/src/app/offersdiscount/home/home.component.html index 9c5cadcf..b84354f8 100644 --- a/Mohem/src/app/offersdiscount/home/home.component.html +++ b/Mohem/src/app/offersdiscount/home/home.component.html @@ -33,7 +33,7 @@
-
+
diff --git a/Mohem/src/app/offersdiscount/home/home.component.ts b/Mohem/src/app/offersdiscount/home/home.component.ts index b73c910c..8ee773ac 100644 --- a/Mohem/src/app/offersdiscount/home/home.component.ts +++ b/Mohem/src/app/offersdiscount/home/home.component.ts @@ -5,7 +5,7 @@ import { CommonService } from 'src/app/hmg-common/services/common/common.service import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { OfferDiscountService } from '../services/service'; import { IonInfiniteScroll } from '@ionic/angular'; -import { DomSanitizer} from '@angular/platform-browser'; +import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; @Component({ selector: 'app-home', templateUrl: './home.component.html', @@ -26,14 +26,20 @@ export class HomeComponent implements AfterViewInit { itemCounter = 1; itemType: any; isData = true; - // categories:any = []; + allCategory: any = { + categoryID: 0, + content: '', + isActive: true, + categoryName_en: "All", + categoryName_ar: "الجميع", + } constructor( - public ts: TranslatorService, - public modalController: ModalController, - public cs: CommonService, - public offersService: OfferDiscountService, + public ts: TranslatorService, + public modalController: ModalController, + public cs: CommonService, + public offersService: OfferDiscountService, public route: ActivatedRoute, - private sanitizer: DomSanitizer) { + ) { this.route .params.subscribe(val => { @@ -62,9 +68,11 @@ export class HomeComponent implements AfterViewInit { getCategories() { this.offersService.getCategories({}).subscribe((result) => { this.categories = JSON.parse(result.Mohemm_ITG_ResponseItem).result.data; //result.result.data; - for (let i = 0; i < this.categories.length; i++) { - this.categories[i].content = this.sanitizer.bypassSecurityTrustHtml(this.categories[i].content); - } + //this.allCategory.content = this.sanitizer.bypassSecurityTrustHtml(); + this.categories.unshift(this.allCategory); + // for (let i = 0; i < this.categories.length; i++) { + // this.categories[i].content = this.sanitizer.bypassSecurityTrustHtml(this.categories[i].content); + // } this.cs.sharedService.setSharedData(this.categories, OfferDiscountService.categories); }); } @@ -80,13 +88,13 @@ export class HomeComponent implements AfterViewInit { getOfferDiscount(pageNo?, categoryId?) { this.cs.startLoading(); if (categoryId) { - this.offersService.getOffers({}, () => { }, this.ts.trPK('general', 'retry'),pageNo, categoryId).subscribe((res) => { + this.offersService.getOffers({}, () => { }, this.ts.trPK('general', 'retry'), pageNo, categoryId).subscribe((res) => { var data = JSON.parse(res['Mohemm_ITG_ResponseItem']); this.cs.stopLoading(); if (data['result']) { this.displayOffers(data['result']); this.isData = true; - }else{ + } else { this.isData = false; } }); @@ -94,10 +102,10 @@ export class HomeComponent implements AfterViewInit { this.offersService.getOffers({}, () => { }, this.ts.trPK('general', 'retry')).subscribe((res) => { var data = JSON.parse(res['Mohemm_ITG_ResponseItem']); this.cs.stopLoading(); - if (data['result']){ + if (data['result']) { this.displayOffers(data['result']); this.isData = true; - } else{this.isData = false;} + } else { this.isData = false; } }); } @@ -107,19 +115,25 @@ export class HomeComponent implements AfterViewInit { if (data['data']) { var parseJSON = data['data']; var offers = JSON.parse(parseJSON); - this.offersData = offers; + console.log(offers); + this.offersData = this.filterActiveItems(offers); + console.log(this.offersData); this.tempSearch = this.offersData; } } - + filterActiveItems(offers) { + return offers.filter((res) => { + return res['IsActive'] == 'True'; + }); + } filterOffers(key) { - if(this.direction === 'ltr') { + if (this.direction === 'ltr') { this.activeClass = key.categoryName_en; - }else { + } else { this.activeClass = key.categoryName_ar } this.itemType = key.id; - this.getOfferDiscount(1,this.itemType) + this.getOfferDiscount(1, this.itemType) } checkDate(date) { @@ -142,9 +156,9 @@ export class HomeComponent implements AfterViewInit { search(t) { console.log(this.tempSearch); - if(t === ''){ + if (t === '') { this.offersData = this.tempSearch; - } else{ + } else { this.offersData = this.tempSearch.filter((post) => { return (post.Title.toLowerCase().indexOf(t.toLowerCase()) > -1); }); @@ -172,8 +186,9 @@ export class HomeComponent implements AfterViewInit { console.log(this.itemCounter); this.offersService.getOffers({}, () => { }, this.ts.trPK('general', 'retry'), this.itemCounter, this.itemType).subscribe((res) => { const data = JSON.parse(res['Mohemm_ITG_ResponseItem']); - if (data['result']){ - const allItem = JSON.parse(data.result['data']); + if (data['result']) { + var allItem = JSON.parse(data.result['data']); + allItem = this.filterActiveItems(allItem); if (allItem) { allItem.forEach(element => { this.offersData.push(element); @@ -189,8 +204,9 @@ export class HomeComponent implements AfterViewInit { console.log(this.itemCounter); this.offersService.getOffers({}, () => { }, this.ts.trPK('general', 'retry'), this.itemCounter).subscribe((res) => { const data = JSON.parse(res['Mohemm_ITG_ResponseItem']); - if (data['result']){ - const allItem = JSON.parse(data.result['data']); + if (data['result']) { + var allItem = JSON.parse(data.result['data']); + allItem = this.filterActiveItems(allItem); if (allItem) { allItem.forEach(element => { this.offersData.push(element); diff --git a/Mohem/src/app/offersdiscount/location/location.component.html b/Mohem/src/app/offersdiscount/location/location.component.html new file mode 100644 index 00000000..c7fb1856 --- /dev/null +++ b/Mohem/src/app/offersdiscount/location/location.component.html @@ -0,0 +1,7 @@ + + + +
+ +
+
\ No newline at end of file diff --git a/Mohem/src/app/offersdiscount/location/location.component.scss b/Mohem/src/app/offersdiscount/location/location.component.scss new file mode 100644 index 00000000..70d9ad57 --- /dev/null +++ b/Mohem/src/app/offersdiscount/location/location.component.scss @@ -0,0 +1,4 @@ +#map { + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/Mohem/src/app/offersdiscount/location/location.component.spec.ts b/Mohem/src/app/offersdiscount/location/location.component.spec.ts new file mode 100644 index 00000000..26caad16 --- /dev/null +++ b/Mohem/src/app/offersdiscount/location/location.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { LocationComponent } from './location.component'; + +describe('LocationComponent', () => { + let component: LocationComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ LocationComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(LocationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/offersdiscount/location/location.component.ts b/Mohem/src/app/offersdiscount/location/location.component.ts new file mode 100644 index 00000000..7c899f54 --- /dev/null +++ b/Mohem/src/app/offersdiscount/location/location.component.ts @@ -0,0 +1,79 @@ +import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { HMGUtils } from 'src/app/hmg-common/hmg_utils'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { OfferDiscountService } from '../services/service'; +declare var google; +@Component({ + selector: 'app-location', + templateUrl: './location.component.html', + styleUrls: ['./location.component.scss'], +}) + +export class LocationComponent implements OnInit { + @ViewChild('map') mapContainer: ElementRef; + locations: any = []; + map: any; + offerDetails: any; + constructor(public hmgUtils: HMGUtils, public route: ActivatedRoute, public cs: CommonService) { + this.route + .params.subscribe(val => { + setTimeout(() => { + this.ionEnter(); + }, 100); + }); + } + ionEnter() { + this.locations = this.cs.sharedService.getSharedData(OfferDiscountService.selected_offers, false); + this.offerDetails = this.cs.sharedService.getSharedData(OfferDiscountService.selected_offers, false); + this.displayMap(); + } + ngOnInit() { + + } + displayMap() { + + const map = new google.maps.Map( + document.getElementById("map") as HTMLElement, + { + zoom: 10, + center: { lat: 24.7136, lng: 46.6753 }, + } + ); + + this.setMarkers(map); + + } + setMarkers(map) { + + for (let i = 0; i < this.locations.length; i++) { + const loc = this.locations[i]; + const infoWindow = new google.maps.InfoWindow(); + var marker = new google.maps.Marker({ + position: { lat: loc.latitude, lng: loc.longitude }, + map, + // icon: image, + // shape: shape, + title: this.offerDetails.Title, + + }); + marker.addListener("click", () => { + this.cs.openLocation(loc.latitude, loc.longitude) + }); + } + this.hmgUtils.getCurrentLocation((resp) => { + console.log(resp); + if (resp) { + const latLng = new google.maps.LatLng(resp.latitude, resp.longitude); + const mapOptions = { + center: latLng, + zoom: 17, + mapTypeId: google.maps.MapTypeId.ROADMAP, + myLocation: true + }; + + this.map = new google.maps.Map(this.mapContainer.nativeElement, mapOptions); + }; + }) + } +} diff --git a/Mohem/src/app/offersdiscount/offer-details/offer-details.component.html b/Mohem/src/app/offersdiscount/offer-details/offer-details.component.html index f3a127c8..1d9c3d44 100644 --- a/Mohem/src/app/offersdiscount/offer-details/offer-details.component.html +++ b/Mohem/src/app/offersdiscount/offer-details/offer-details.component.html @@ -11,9 +11,11 @@
-
- - + + + {{details.Title}} {{details.Title_AR}} @@ -44,6 +46,12 @@
+ + + + +

{{ts.trPK('itemforsale','location')}}

+
@@ -84,7 +92,7 @@ - + diff --git a/Mohem/src/app/offersdiscount/offer-details/offer-details.component.scss b/Mohem/src/app/offersdiscount/offer-details/offer-details.component.scss index b487cc9b..5ea4054b 100644 --- a/Mohem/src/app/offersdiscount/offer-details/offer-details.component.scss +++ b/Mohem/src/app/offersdiscount/offer-details/offer-details.component.scss @@ -144,4 +144,9 @@ ion-card{ margin: 2px 0px 5px -3px; font-size: 14px; font-weight: bold; +} +.location-text{ + font-weight: bold; + font-size: 14px; + text-decoration: underline; } \ No newline at end of file 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 20a253b7..ee364abe 100644 --- a/Mohem/src/app/offersdiscount/offer-details/offer-details.component.ts +++ b/Mohem/src/app/offersdiscount/offer-details/offer-details.component.ts @@ -38,9 +38,9 @@ export class OfferDetailsComponent implements OnInit { 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(offerMessage), + message: this.stripHtml(offerMessage), subject: this.stripHtml(offerSubject), files: [this.details.Banner_Image] } @@ -56,4 +56,16 @@ export class OfferDetailsComponent implements OnInit { }, 200); } + openLocation() { + this.cs.navigateForward('/offersdiscount/location'); + } + getLocation() { + this.cs.startLoading(); + this.offersService.getOfferLocation({ OfferId: this.details.rowID }, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { + this.cs.stopLoading(); + result = JSON.parse(result.Mohemm_ITG_ResponseItem).result.data; + this.cs.sharedService.setSharedData(result, OfferDiscountService.selected_offers); + this.openLocation(); + }) + } } diff --git a/Mohem/src/app/offersdiscount/offersdiscount.module.ts b/Mohem/src/app/offersdiscount/offersdiscount.module.ts index c64e20bb..fa0495d4 100644 --- a/Mohem/src/app/offersdiscount/offersdiscount.module.ts +++ b/Mohem/src/app/offersdiscount/offersdiscount.module.ts @@ -11,6 +11,9 @@ import { OfferDetailsComponent } from './offer-details/offer-details.component'; import { HmgCommonModule } from '../hmg-common/hmg-common.module'; import { OfferDiscountService } from './services/service'; import { FilterComponent } from './filter/filter.component'; +import { LocationComponent } from './location/location.component'; +import { ImageModalModule } from '../hmg-common/ui/image-modal/image-modal.module'; + const routes: Routes = [ @@ -30,6 +33,10 @@ const routes: Routes = [ path: 'filter-page', component: FilterComponent }, + { + path: 'location', + component: LocationComponent + }, ], } ]; @@ -42,10 +49,12 @@ const routes: Routes = [ FormsModule, IonicModule, HmgCommonModule, + ImageModalModule, RouterModule.forChild(routes) ], - declarations: [OffersdiscountPage, HomeComponent, OfferDetailsComponent, FilterComponent], + declarations: [OffersdiscountPage, HomeComponent, OfferDetailsComponent, FilterComponent, LocationComponent], entryComponents: [FilterComponent], - providers: [OfferDiscountService, SocialSharing] + providers: [OfferDiscountService, SocialSharing], + }) export class OffersdiscountPageModule { } diff --git a/Mohem/src/app/offersdiscount/services/service.ts b/Mohem/src/app/offersdiscount/services/service.ts index b3bd357f..2a838807 100644 --- a/Mohem/src/app/offersdiscount/services/service.ts +++ b/Mohem/src/app/offersdiscount/services/service.ts @@ -15,8 +15,9 @@ export class OfferDiscountService { public static related_offers = 'related-offers'; public static selected_filters = 'selected-filters'; public static categories = 'categories'; + public static offer_location = 'offer_location'; public static getCategories = 'Services/COCWS.svc/REST/Mohemm_ITG_GetCategories'; - + public static offerLocation = 'Services/COCWS.svc/REST/Mohemm_ITG_OffersLocation'; constructor( public con: ConnectorService, private authService: AuthenticationService, @@ -39,7 +40,7 @@ export class OfferDiscountService { return this.con.postNoLoad(OfferDiscountService.offersDiscountData, request, onError, errorLabel); } - getCategories(request: any, onError?: any, errorLabel?: string): Observable { + getCategories(request: any, onError?: any, errorLabel?: string): Observable { this.authService.authenticateRequest(request); request['EmployeeNumber'] = request.UserName; request['ItgChannelId'] = 3; @@ -56,4 +57,10 @@ export class OfferDiscountService { errorLabel ); } + public getOfferLocation(request: any, onError?: any, errorLabel?: string) { + this.authService.authenticateRequest(request); + request.EmployeeNumber = request.UserName; + + return this.con.postNoLoad(OfferDiscountService.offerLocation, request, onError, errorLabel); + } } \ No newline at end of file diff --git a/Mohem/src/app/payslip/home/home.component.scss b/Mohem/src/app/payslip/home/home.component.scss index 5b6eeb2b..1406aede 100644 --- a/Mohem/src/app/payslip/home/home.component.scss +++ b/Mohem/src/app/payslip/home/home.component.scss @@ -354,6 +354,7 @@ .hrTitle{ margin-left: 11px !important; font-size: 15px !important; + margin-right: 11px !important; } .date{ font-size: 15px !important; diff --git a/Mohem/src/app/pending-transaction/home/home.component.html b/Mohem/src/app/pending-transaction/home/home.component.html new file mode 100644 index 00000000..6ac756a4 --- /dev/null +++ b/Mohem/src/app/pending-transaction/home/home.component.html @@ -0,0 +1,102 @@ + + +
+ + + +
+
+
+
+
+ + +
+ + +
+ +
+
+
+ + + +
+ + {{ 'general,from-date' | translate}} + +
+
+ + +
+ + {{ 'general,to-date' | translate}} + +
+
+
+
+ +
+
+
+ + + + +

{{'general, noData' | translate}}

+
+
+
+ +
{{transaction.CREATION_DATE}}
+ + +

{{'transaction, created-for' | translate}}

+

{{transaction.TRANSACTION_CREATED_FOR}}

+
+ + +
+

{{'transaction, request-type' | translate}}

+

{{transaction.REQUEST_TYPE}}

+
+
+
+
+ +
+
+
+ + +
+ + {{'general, submit' | translate}} + + {{'general, reset' | translate}} +
+
+ diff --git a/Mohem/src/app/pending-transaction/home/home.component.scss b/Mohem/src/app/pending-transaction/home/home.component.scss new file mode 100644 index 00000000..d5c8e7ac --- /dev/null +++ b/Mohem/src/app/pending-transaction/home/home.component.scss @@ -0,0 +1,117 @@ +.display-created{ + display: inline-block; + + color:#000; +} +#containerDiv{ + margin-top:20px; +} +.padding{ + padding-left:5px; + padding-right: 5px; +} +.bold{ + font-weight: bold; + font-size: 16px; +} +.color-black{ + color:#000; +} +.date-en{ + position: absolute; + font-size: 14px; + padding: 10px; + right:0; + width: 100px; + color:#969696; + margin: -8px; +} +.date-ar{ + position: absolute; + font-size: 14px; + padding: 10px; + left: 10px; + width: 100px; + color:#969696; + margin: -8px; +} +.transaction-list{ + margin-top:20px; +} +.date-container{ + margin:0px 20px; +} + +.label{ + font-size: 16px; + // margin-left: 15px; + color: #a2a5a6 !important; + display: block; + overflow: hidden; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + /* font-size: inherit; */ + // text-overflow: ellipsis; + // white-space: nowrap; + white-space: normal; + // padding-top: 10px; + padding: 5px 0px; + padding-left: 10px !important; + margin: 10px auto; + :root[dir="ltr"]{ + font-family: var(--fontFamilySemiBoldEN) !important; + } + :root[dir="rtl"]{ + font-family: var(--fontFamilyIOSAR) !important; + font-weight: bold; + } + + +} + +.Field-en{ + border-radius: 30px; + border: 1px solid #a2a5a6!important; + margin-bottom: 15px; + padding-left: 20px !important; + padding-top: 6px !important; + color: #999999 !important; +} + +.Field-ar{ + border-radius: 30px; + border: 1px solid #a2a5a6!important; + margin-bottom: 20px; + padding-right: 20px !important; + padding-top: 6px !important; + color: #999999 !important; +} +select{ + width: 300px !important; + border: none !important; +} +.padding_date{ + padding-left:5px !important; +} +.date-icon{ + font-size: 20px; + left: -1px; + position: relative; + top: 2px; +} +ion-card{ + padding: 20px 10px 20px 10px; + border-radius: 11px; + box-shadow: 0px 1px 2px 1px #ccc; +} +.display-inline{ + display:inline-block; + +} +.red{ +color:#CA3332; +font-weight: 600; +margin:0px 5px; +} \ No newline at end of file diff --git a/Mohem/src/app/pending-transaction/home/home.component.spec.ts b/Mohem/src/app/pending-transaction/home/home.component.spec.ts new file mode 100644 index 00000000..5ec1377b --- /dev/null +++ b/Mohem/src/app/pending-transaction/home/home.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HomeComponent } from './home.component'; + +describe('HomeComponent', () => { + let component: HomeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HomeComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/pending-transaction/home/home.component.ts b/Mohem/src/app/pending-transaction/home/home.component.ts new file mode 100644 index 00000000..e722d588 --- /dev/null +++ b/Mohem/src/app/pending-transaction/home/home.component.ts @@ -0,0 +1,56 @@ +import { Component, ElementRef, OnInit } from '@angular/core'; +import { EitService } from 'src/app/eit/services/eit.service'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { ServiceService } from '../service/service.service'; + +@Component({ + selector: 'app-home', + templateUrl: './home.component.html', + styleUrls: ['./home.component.scss'], +}) +export class HomeComponent implements OnInit { + public direction: any; + public transactions: any = []; + public selectedTransaction: any; + public dateTo: any; + public dateFrom: any; + public transactionDetails; + constructor(public cs: CommonService, private elementRef: ElementRef, public trServcice: ServiceService, public ts: TranslatorService, public eitService: EitService) { } + + + ngOnInit() { + + + this.getPendingTransaction(); + this.direction = TranslatorService.getCurrentLanguageName(); + + } + getPendingTransaction() { + this.cs.startLoading(); + this.trServcice.getPendingRequests({ + }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { + this.cs.stopLoading(); + this.transactions = response['GetPendingReqFunctionsList']; + }) + } + getPendingRequestDetails() { + this.cs.startLoading(); + this.trServcice.getPendingRequestDetails({ + 'P_FUNCTION_ID': this.selectedTransaction, + 'P_CREATION_DATE_FROM': "/Date(" + Date.parse(this.dateFrom) + '+0300' + ")/", + 'P_CREATION_DATE_TO': "/Date(" + Date.parse(this.dateTo) + '+0300' + ")/", + 'P_PAGE_NUM': 1, + 'P_PAGE_LIMIT': 20, + + }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { + this.cs.stopLoading(); + this.transactionDetails = response['GetPendingReqDetailsList']; + }) + } + isValid() { + if (this.selectedTransaction && this.dateFrom && this.dateTo) + return true; + else return false + } +} diff --git a/Mohem/src/app/pending-transaction/pending-transaction.module.ts b/Mohem/src/app/pending-transaction/pending-transaction.module.ts new file mode 100644 index 00000000..1d95ebc2 --- /dev/null +++ b/Mohem/src/app/pending-transaction/pending-transaction.module.ts @@ -0,0 +1,36 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { Routes, RouterModule } from '@angular/router'; + +import { IonicModule } from '@ionic/angular'; + +import { PendingTransactionPage } from './pending-transaction.page'; +import { HomeComponent } from './home/home.component'; +import { ServiceService } from './service/service.service'; +import { HmgCommonModule } from '../hmg-common/hmg-common.module'; +const routes: Routes = [ + { + path: '', + component: PendingTransactionPage, + children: [ + { + path: 'home', + component: HomeComponent + }, + ] + } +]; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + RouterModule.forChild(routes), + HmgCommonModule + ], + declarations: [PendingTransactionPage, HomeComponent], + providers: [ServiceService] +}) +export class PendingTransactionPageModule { } diff --git a/Mohem/src/app/pending-transaction/pending-transaction.page.html b/Mohem/src/app/pending-transaction/pending-transaction.page.html new file mode 100644 index 00000000..d26b79fd --- /dev/null +++ b/Mohem/src/app/pending-transaction/pending-transaction.page.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Mohem/src/app/pending-transaction/pending-transaction.page.scss b/Mohem/src/app/pending-transaction/pending-transaction.page.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/pending-transaction/pending-transaction.page.spec.ts b/Mohem/src/app/pending-transaction/pending-transaction.page.spec.ts new file mode 100644 index 00000000..b6a16ed9 --- /dev/null +++ b/Mohem/src/app/pending-transaction/pending-transaction.page.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PendingTransactionPage } from './pending-transaction.page'; + +describe('PendingTransactionPage', () => { + let component: PendingTransactionPage; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PendingTransactionPage ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PendingTransactionPage); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/pending-transaction/pending-transaction.page.ts b/Mohem/src/app/pending-transaction/pending-transaction.page.ts new file mode 100644 index 00000000..1377c463 --- /dev/null +++ b/Mohem/src/app/pending-transaction/pending-transaction.page.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-pending-transaction', + templateUrl: './pending-transaction.page.html', + styleUrls: ['./pending-transaction.page.scss'], +}) +export class PendingTransactionPage implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/Mohem/src/app/pending-transaction/service/service.service.spec.ts b/Mohem/src/app/pending-transaction/service/service.service.spec.ts new file mode 100644 index 00000000..d2923aa3 --- /dev/null +++ b/Mohem/src/app/pending-transaction/service/service.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { ServiceService } from './service.service'; + +describe('ServiceService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: ServiceService = TestBed.get(ServiceService); + expect(service).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/pending-transaction/service/service.service.ts b/Mohem/src/app/pending-transaction/service/service.service.ts new file mode 100644 index 00000000..f5521403 --- /dev/null +++ b/Mohem/src/app/pending-transaction/service/service.service.ts @@ -0,0 +1,44 @@ +import { Injectable } from '@angular/core'; +import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service'; + +@Injectable({ + providedIn: 'root' +}) +export class ServiceService { + + + public static GET_PENDING_REQ_FUNCTIONS = 'Services/ERP.svc/REST/GET_PENDING_REQ_FUNCTIONS'; + public static GET_PENDING_REQ_DETAILS = 'Services/ERP.svc/REST/GET_PENDING_REQ_DETAILS'; + constructor( + public con: ConnectorService, + private authService: AuthenticationService, + public cs: CommonService + ) { } + + getPendingRequests(request, onError, errorLabel) { + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.postNoLoad( + ServiceService.GET_PENDING_REQ_FUNCTIONS, + request, + onError, + errorLabel + ); + } + getPendingRequestDetails(request, onError, errorLabel) { + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.postNoLoad( + ServiceService.GET_PENDING_REQ_DETAILS, + request, + onError, + errorLabel + ); + } + + + + +} diff --git a/Mohem/src/app/profile/add-address/add-address.component.html b/Mohem/src/app/profile/add-address/add-address.component.html index b66eab09..695cd8b3 100644 --- a/Mohem/src/app/profile/add-address/add-address.component.html +++ b/Mohem/src/app/profile/add-address/add-address.component.html @@ -21,7 +21,7 @@ - Effective Date + {{'vacation-rule, effectiveDate' | translate}} diff --git a/Mohem/src/app/profile/add-basic-details/add-basic-details.component.html b/Mohem/src/app/profile/add-basic-details/add-basic-details.component.html index ce1335e8..352a55a6 100644 --- a/Mohem/src/app/profile/add-basic-details/add-basic-details.component.html +++ b/Mohem/src/app/profile/add-basic-details/add-basic-details.component.html @@ -10,7 +10,7 @@ - Effective Date + {{'vacation-rule, effectiveDate' | translate}} {{showEffectiveDate}}
diff --git a/Mohem/src/app/profile/add-update-contact/add-update-contact.component.html b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.html new file mode 100644 index 00000000..4a92fa86 --- /dev/null +++ b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.html @@ -0,0 +1,34 @@ + + + + + + + + Effective Date + {{showEffectiveDate}} + +
+
+
+ + {{ts.trPK('submitAbsence','endDate')}} + + +
+ + +
+ + {{'vacation-rule, next-label' | translate}} + +
+
\ No newline at end of file diff --git a/Mohem/src/app/profile/add-update-contact/add-update-contact.component.scss b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.scss new file mode 100644 index 00000000..764fe8af --- /dev/null +++ b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.scss @@ -0,0 +1,52 @@ +.date-container{ + margin:0px 20px; +} + +.label{ + font-size: 16px; + // margin-left: 15px; + color: #a2a5a6 !important; + display: block; + overflow: hidden; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + /* font-size: inherit; */ + // text-overflow: ellipsis; + // white-space: nowrap; + white-space: normal; + // padding-top: 10px; + padding: 5px 0px; + padding-left: 10px !important; + margin: 10px auto; + :root[dir="ltr"]{ + font-family: var(--fontFamilySemiBoldEN) !important; + } + :root[dir="rtl"]{ + font-family: var(--fontFamilyIOSAR) !important; + font-weight: bold; + } + + +} + +.Field-en{ + border-radius: 30px; + border: 1px solid #a2a5a6 !important; + margin-bottom: 0px; + padding-left: 20px !important; + padding-top: 0px !important; + color: #999999 !important; + height: 80px; +} + +.Field-ar{ + border-radius: 30px; + border: 1px solid #a2a5a6!important; + margin-bottom: 20px; + padding-right: 20px !important; + padding-top: 0px !important; + color: #999999 !important; + height:80px +} \ No newline at end of file diff --git a/Mohem/src/app/profile/add-update-contact/add-update-contact.component.spec.ts b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.spec.ts new file mode 100644 index 00000000..d11ca101 --- /dev/null +++ b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AddUpdateContactComponent } from './add-update-contact.component'; + +describe('AddUpdateContactComponent', () => { + let component: AddUpdateContactComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AddUpdateContactComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AddUpdateContactComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/profile/add-update-contact/add-update-contact.component.ts b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.ts new file mode 100644 index 00000000..f8aaf42a --- /dev/null +++ b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.ts @@ -0,0 +1,2134 @@ + +import { EITTransactionsRequest } from 'src/app/eit/models/EITTransactionsReq'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { MenuEntry } from 'src/app/hmg-common/services/menu/models/menu.entry'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { EITNotificatonBodyResponse } from 'src/app/notification/models/EITNotificationBodyRes'; +import { ButtonInput } from 'src/app/uI-elements/button.input'; +import { DateTimeInput } from 'src/app/uI-elements/date-time.input'; +import { DateInput } from 'src/app/uI-elements/date.input'; +import { HiddenInput } from 'src/app/uI-elements/hidden.input'; +import { NumberInput } from 'src/app/uI-elements/number.input'; +import { SelectInput } from 'src/app/uI-elements/select.input'; +import { TextAreaInput } from 'src/app/uI-elements/text-area.input'; +import { TextInput } from 'src/app/uI-elements/text.input'; +import { TimeInput } from 'src/app/uI-elements/time.input'; +import { BasicRequest } from '../models/basic.request'; +import { ProfileService } from '../service/profile.service'; +import * as moment from "moment"; +import { EIT_ACTION } from 'src/app/eit/models/submit.eit.action'; +import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; +import { ModalController } from '@ionic/angular'; +import { DatePicker } from '@ionic-native/date-picker/ngx'; +import { ActivatedRoute } from '@angular/router'; +import { ContactRequest } from '../models/contact.request'; + + + +@Component({ + selector: 'app-add-update-contact', + templateUrl: './add-update-contact.component.html', + styleUrls: ['./add-update-contact.component.scss'], +}) +export class AddUpdateContactComponent implements OnInit { + @ViewChild("containerDiv") containerDiv: ElementRef; + @ViewChild("containerDivTwo") containerDivTwo: ElementRef; + + + getPassNotificationDetails: any; + getPassdirfromNotifiPage: boolean = false; + functionName: string = ""; + menuType: any; + private textArea: TextAreaInput; + private numberInput: NumberInput; + private textInput: TextInput; + private selectInput: SelectInput; + private dateInput: DateInput; + private timeInput: TimeInput; + private datetimeInput: DateTimeInput; + private buttonInput: ButtonInput; + private hiddenInput: HiddenInput; + private eitResponse: any; + private eitDffResponse: any; + private eitColResponse: any; + + private eitVALSettoCall: any = []; + private comtransNo: number = 0; + getPassMnuEntryObj: MenuEntry; + selMenu: MenuResponse; + eitSubmitAction: number = 0; //not submit + private basicRequest: ContactRequest; + private validateEitObj: any = []; + private ExtraObj: any = {}; + private arrValues: any = []; + selEmp: string; + respID: number; + headerTitle: string = ""; + isResubmit: boolean = false; + private updatedValues: any = []; + addEITData: any; + direction: string; + public targetValue: any; + public employeeBasicDetails: any = []; + public mutualBasicDetailsArray: any = []; + public effectiveDate: string; + public showEffectiveDate: string; + public userUpdateData: any; + public isDelete: boolean = false; + public selctedContact: any; + public endDate: any; + constructor( + public modalController: ModalController, + public cs: CommonService, + public ts: TranslatorService, + private profileService: ProfileService, + public datePicker: DatePicker, + public router: ActivatedRoute + ) { + + this.router.queryParams.subscribe(params => { + this.targetValue = params.targetValue; + console.log(this.targetValue); + }); + + var empDetails = this.cs.sharedService.getSharedData(ProfileService.EMP_CONTACT_DETAILS); + this.employeeBasicDetails = empDetails ? empDetails : []; + var isDelete = this.cs.sharedService.getSharedData(ProfileService.REMOVE_CONTACT); + this.isDelete = isDelete ? isDelete : false; + this.selctedContact = this.cs.sharedService.getSharedData(ProfileService.SELCTED_CONTACT, false); + this.direction = TranslatorService.getCurrentLanguageName(); + this.selEmp = this.cs.sharedService.getSharedData( + MenuResponse.SHARED_SEL_EMP, + false + ); + this.respID = this.cs.sharedService.getSharedData( + MenuResponse.SHARED_SEL_RESP_ID, + false + ); + this.selMenu = new MenuResponse(); + this.selMenu = this.cs.sharedService.getSharedData( + MenuResponse.SHARED_DATA, + false + ); + this.addEITData = this.cs.sharedService.getSharedData("AddEITData", false); + console.log("addEITData: " + this.addEITData); + + this.basicRequest = new ContactRequest(); + + ////*new add*///// + /**********resubmit************ */ + this.getPassNotificationDetails = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.NOT_WORKLIST, false);//WARINING + this.getPassdirfromNotifiPage = this.addEITData.dirfromNotificationPage; + if (this.getPassdirfromNotifiPage) { + this.functionName = this.getPassNotificationDetails.FUNCTION_NAME; //;this.getPassNotificationDetails.NOTIFICATION_NAME; + this.menuType = "E"; + this.selEmp = this.getPassNotificationDetails.SELECTED_EMPLOYEE_NUMBER; + this.respID = -999; + this.validateEitObj = this.addEITData.submitEITObjList; + let msg: string = ""; + msg = this.ts.trPK("general", "update-contact"); + this.headerTitle = msg; + } else { + this.getPassMnuEntryObj = this.selMenu.GetMenuEntriesList; + this.comtransNo = this.addEITData.transNo; + this.functionName = this.getPassMnuEntryObj.FUNCTION_NAME; + this.menuType = this.selMenu.List_Menu.MENU_TYPE; + this.validateEitObj = this.addEITData.submitEITObjList; + this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; + this.eitSubmitAction = this.cs.sharedService.getSharedData( + EITTransactionsRequest.SUBMIT_EIT_ACTION + ); + } + } + + ngOnInit() { } + + ngAfterViewInit() { + if (!this.isDelete) + this.getBasicffStructure(); + } + + public getColumnStructure() { + const body = { + P_FUNCTION_NAME: this.functionName, + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_ACTION: this.employeeBasicDetails.length > 0 ? 'UPDATE' : this.isDelete ? 'REMOVE' : 'ADD' + }; + this.profileService.getContactColumnStructure(body).subscribe((result: any) => { + this.handleBasicColStructureResult(result); + }); + } + + private getEitDffStructure() { + const body = { + P_FUNCTION_NAME: this.functionName, + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, + 'P_DESC_FLEX_CONTEXT_CODE': 'HMG_ADD_CONTACT_DETAILS' + }; + this.profileService.getContactDFFStrutre(body).subscribe((result: any) => { + this.handleDffStructureResult(result); + }); + } + handleDffStructureResult(result) { + if (result.GetContactDffStructureList != null) { + + this.eitDffResponse = result.GetContactDffStructureList; + this.drawEitFields(result.GetContactDffStructureList, true); + this.fillBasicDetailsStructure(); + } + } + private getBasicffStructure() { + const body = { + P_FUNCTION_NAME: this.functionName, + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, + P_REQUEST_TYPE: this.getPassMnuEntryObj.REQUEST_TYPE + }; + this.profileService.getBasicDFFStrutre(body).subscribe((result: any) => { + this.handleBasicDffStructureResult(result); + }); + } + + public handleBasicColStructureResult(result) { + if (result.GetContactColsStructureList != null) { + this.eitColResponse = result.GetContactColsStructureList; + // if (this.employeeBasicDetails.length > 0) { + this.getEitDffStructure(); + //} + + this.drawEitFieldsStatic(result.GetContactColsStructureList); + } + } + + public handleBasicDffStructureResult(result) { + if (result.GetBasicDetDffStructureList != null) { + this.getColumnStructure(); + this.eitResponse = result.GetBasicDetDffStructureList; + this.drawEitFields(result.GetBasicDetDffStructureList, false); + + } + } + + private drawEitFieldsStatic(feildsList) { + const containerId = "containerDivTwo"; + this.eitVALSettoCall = []; + for (let i = 0; i < feildsList.length; i++) { + let defaultVal: string = ""; + let defaultValText: string = ""; + + if (feildsList[i].DISPLAY_FLAG != "N") { + //text , date , time + if (feildsList[i].DATATYPE == "VARCHAR2" && feildsList[i].ObjectValuesList === null) { + // character + this.textInput = new TextInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + defaultValText, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else if (feildsList[i].DATATYPE == "VARCHAR2" && feildsList[i].ObjectValuesList !== null) { + this.selectInput = new SelectInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + this.fillStaticDropdownList( + feildsList[i].SEGMENT_NAME, + feildsList[i].ObjectValuesList, + feildsList[i].APPLICATION_COLUMN_NAME + ); + } else if (feildsList[i].DATATYPE == "NUMBER") { + this.numberInput = new NumberInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else if (feildsList[i].DATATYPE == "DATE") { + this.dateInput = new DateInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + + } + } + } + + } + + public getElementsStaticValues(): any { + this.updatedValues = []; //fill updated list + let valuseArr: any = []; + let varcharValue: any = null; + let numbervalue: any = 0; + let dateValue: any = null; + let transNo: number = 1; + let textValue: any; + + for (let i = 0; i < this.eitColResponse.length; i++) { + varcharValue = null; + numbervalue = null; + dateValue = null; + + if (this.eitColResponse[i].DISPLAY_FLAG != "N") { + if (this.eitColResponse[i].ObjectValuesList === null) { + let elem = document.getElementById(this.eitColResponse[i].APPLICATION_COLUMN_NAME) as HTMLInputElement; + let elemVal = elem !== null ? (document.getElementById(this.eitColResponse[i].APPLICATION_COLUMN_NAME) as HTMLInputElement).value : ''; + textValue = elemVal; + + if (this.eitColResponse[i].DATATYPE == "VARCHAR2" || this.eitColResponse[i].DATATYPE == "NUMBER") { + elemVal = elemVal; + } else if (this.eitColResponse[i].DATATYPE == "DATE") { + // date + elemVal = this.cs.reverseFormatDate(elemVal); + } + + if (this.targetValue === 'new') { + if (this.eitColResponse[i].REQUIRED_FLAG == "Y" && !elemVal) { + elem.classList.add("requiredClassElm"); + return false; + } else { + elem.classList.remove("requiredClassElm"); + } + } + + if (this.eitColResponse[i].DATATYPE == "DATE") { + dateValue = elemVal; + } else if (this.eitColResponse[i].DATATYPE == "NUMBER") { + numbervalue = elemVal; + } else { + varcharValue = elemVal; + } + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.eitColResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } else { + let x = document.getElementById(this.eitColResponse[i].APPLICATION_COLUMN_NAME) as HTMLSelectElement; + + let val = x.options[x.selectedIndex] ? x.options[x.selectedIndex].value : null; + let txt = x.options[x.selectedIndex] ? x.options[x.selectedIndex].text : null; + varcharValue = val; + textValue = txt; + + if (x !== null) { + if (this.eitColResponse[i].REQUIRED_FLAG == "Y" && !varcharValue) { + x.classList.add("requiredClassElm"); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + } + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.eitColResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } + } else { + let x = document.getElementById(this.eitColResponse[i].APPLICATION_COLUMN_NAME) as HTMLSelectElement; + let val = x !== null ? x.dataset.colmText : ''; + textValue = x !== null ? x.value : ''; + + if (x !== null) { + if (this.eitResponse[i].REQUIRED_FLAG == "Y" && !val) { + x.classList.add("requiredClassElm"); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + } + + + let staticValueBasicDetail = this.employeeBasicDetails.find( + x => + x.APPLICATION_COLUMN_NAME == + this.eitColResponse[i].APPLICATION_COLUMN_NAME + ); + + if (staticValueBasicDetail) { + if (this.eitColResponse[i].DATATYPE === 'VARCHAR2') { + varcharValue = staticValueBasicDetail.VARCHAR2_VALUE; + } else if (this.eitColResponse[i].DATATYPE === 'DATE') { + dateValue = staticValueBasicDetail.DATE_VALUE; + } else if (this.eitColResponse[i].DATATYPE === 'NUMBER') { + numbervalue = staticValueBasicDetail.NUMBER_VALUE; + } else { + varcharValue = val; + } + } else { + varcharValue = val; + } + + + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.eitColResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } + } + return valuseArr; + } + + private drawEitFields(feildsList, isDff: boolean) { + const containerId = "containerDiv"; + this.eitVALSettoCall = []; + for (let i = 0; i < feildsList.length; i++) { + let defaultVal: string = ""; + let defaultValText: string = ""; + // defaultVal = feildsList[i].E_SERVICES_DV.P_ID_COLUMN_NAME + // ? feildsList[i].E_SERVICES_DV.P_ID_COLUMN_NAME + // : ""; + // defaultValText = feildsList[i].E_SERVICES_DV.P_VALUE_COLUMN_NAME + // ? feildsList[i].E_SERVICES_DV.P_VALUE_COLUMN_NAME + // : ""; + + if (feildsList[i].DISPLAY_FLAG != "N") { + //check if the field should be displayed + if (feildsList[i].VALIDATION_TYPE == "N") { + //text , date , time + if (feildsList[i].FORMAT_TYPE == "C") { + // character + this.textInput = new TextInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + defaultValText, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else if (feildsList[i].FORMAT_TYPE == "N") { + this.numberInput = new NumberInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else if (feildsList[i].FORMAT_TYPE == "X") { + // standard date + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + //constant + this.dateInput = new DateInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + this.cs.reverseFormatDate(defaultVal), + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } else { + this.dateInput = new DateInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } + } else if (feildsList[i].FORMAT_TYPE == "Y") { + // standard date time + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + this.datetimeInput = new DateTimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + this.cs.reverseFormatStandardDate(defaultVal), + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } else { + this.datetimeInput = new DateTimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } + const elem = document.getElementById( + feildsList[i].APPLICATION_COLUMN_NAME + ); + } else if (feildsList[i].FORMAT_TYPE == "I") { + //time + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + this.timeInput = new TimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } else { + this.timeInput = new TimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } + } + } else { + if (feildsList[i].READ_ONLY == "Y") { + this.textInput = new TextInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + defaultValText, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else { + this.selectInput = new SelectInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + if (isDff) { + this.fillDropdownListDff( + feildsList[i].SEGMENT_NAME, + feildsList[i].E_SERVICES_VS, + feildsList[i].E_SERVICES_DV + ); + } else { + this.fillDropdownList( + feildsList[i].SEGMENT_NAME, + feildsList[i].E_SERVICES_VS, + feildsList[i].E_SERVICES_DV + ); + } + } + + } + this.bindHtmlElemEvents( + feildsList[i].APPLICATION_COLUMN_NAME, + feildsList[i] + ); + } else { + this.hiddenInput = new HiddenInput( + defaultVal, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultValText, + containerId + ); + this.bindHtmlElemEvents( + feildsList[i].APPLICATION_COLUMN_NAME, + feildsList[i] + ); + } + } + if (this.validateEitObj && this.validateEitObj.length > 0) { + this.fillEITStructure(); + } + + } + + addFieldToDOM( + fieldObject: any, + fieldId: any, + clickListenerEvent: any, + hasClickListener: boolean + ) { + console.log("AddFieldToDOM"); + const elemDiv = document.createElement("div"); + elemDiv.className = ""; + elemDiv.innerHTML = fieldObject.getTemplate(); + console.log(this.containerDiv.nativeElement); + + this.containerDiv.nativeElement.appendChild(elemDiv); + // document.getElementById('containerDiv').appendChild(elemDiv); + + if (hasClickListener) { + let elem = document.getElementById(fieldId); + elem.addEventListener("click", e => { + clickListenerEvent(e); + e.stopImmediatePropagation(); + }); + } + } + + closeModal() { + this.updatedValues = []; + this.modalController.dismiss(); + } + + public showDateTimePicker(elemID, maxSize) { + let elem = document.getElementById(elemID) as HTMLDivElement; + let date: any; + let value = elem.innerHTML; + if (value) date = moment(value, "YYYY/MM/DD HH:mm:ss").toDate(); + else date = new Date(); + this.datePicker + .show({ + date: date, + is24Hour: true, + mode: "datetime" + }) + .then( + date => { + let dateString: string = moment(date).format("YYYY/MM/DD HH:mm:ss"); + //remove seconds if the maximum size is 17 + if (maxSize == 17) { + elem.innerHTML = dateString.substring(0, 16); + elem.dataset.dtvalue = dateString.substring(0, 16); + } else { + elem.innerHTML = dateString; + elem.dataset.dtvalue = dateString; + } + }, + err => console.log("Error occurred while getting date: ", err) + ); + } + + public showTimePicker(elemID, maxSize) { + let elem = document.getElementById(elemID) as HTMLDivElement; + let date: any; + let value = elem.innerHTML; + if (value) { + let nowDate = moment().format("YYYY/MM/DD") + " " + value; + date = moment(nowDate, "YYYY/MM/DD HH:mm:ss").toDate(); + } else { + date = new Date(); + } + this.datePicker + .show({ + date: date, + is24Hour: true, + mode: "time" + }) + .then( + date => { + let dateString: string = moment(date).format("HH:mm:ss"); + //remove seconds if the maximum size is 5 + if (maxSize == 5) { + elem.innerHTML = dateString.substring(0, 5); + elem.dataset.dtvalue = dateString.substring(0, 5); + } else { + elem.innerHTML = dateString; + elem.dataset.dtvalue = dateString; + } + }, + err => console.log("Error occurred while getting date: ", err) + ); + } + + fillDropdownList(segmentName, optionList: any = [], DV: any = "") { + let elemID: any = ""; + let eitObj: any; + if (optionList.length > 0) { + for (let i = 0; i < this.eitResponse.length; i++) { + if (this.eitResponse[i].SEGMENT_NAME == segmentName) { + eitObj = this.eitResponse[i]; + if ( + this.eitResponse[i].READ_ONLY == "Y" || + this.eitResponse[i].DISPLAY_FLAG == "N" + ) { + return false; + } + elemID = this.eitResponse[i].APPLICATION_COLUMN_NAME; + break; + } + } + let select = document.getElementById(elemID) as HTMLSelectElement; + document.getElementById(elemID).innerHTML = ""; + + if (eitObj.IsEmptyOption && eitObj.REQUIRED_FLAG == "N") { + var firstoption = document.createElement("option"); + firstoption.text = this.ts.trPK("general", "choose"); + firstoption.value = ""; + select.add(firstoption); + } + for (let i = 0; i < optionList.length; i++) { + var option = document.createElement("option"); + option.text = optionList[i].VALUE_COLUMN_NAME; + option.value = optionList[i].ID_COLUMN_NAME; + select.add(option); + } + if (select.dataset.hiddenval) { + select.value = select.dataset.hiddenval; + } else { + select.value = DV.P_ID_COLUMN_NAME; + } + select.disabled = false; + } + } + + fillDropdownListDff(segmentName, optionList: any = [], DV: any = "") { + let elemID: any = ""; + let eitObj: any; + if (optionList.length > 0) { + for (let i = 0; i < this.eitDffResponse.length; i++) { + if (this.eitDffResponse[i].SEGMENT_NAME == segmentName) { + eitObj = this.eitDffResponse[i]; + if ( + this.eitDffResponse[i].READ_ONLY == "Y" || + this.eitDffResponse[i].DISPLAY_FLAG == "N" + ) { + return false; + } + elemID = this.eitDffResponse[i].APPLICATION_COLUMN_NAME; + break; + } + } + let select = document.getElementById(elemID) as HTMLSelectElement; + document.getElementById(elemID).innerHTML = ""; + + if (eitObj.IsEmptyOption && eitObj.REQUIRED_FLAG == "N") { + var firstoption = document.createElement("option"); + firstoption.text = this.ts.trPK("general", "choose"); + firstoption.value = ""; + select.add(firstoption); + } + for (let i = 0; i < optionList.length; i++) { + var option = document.createElement("option"); + option.text = optionList[i].VALUE_COLUMN_NAME; + option.value = optionList[i].ID_COLUMN_NAME; + select.add(option); + } + if (select.dataset.hiddenval) { + select.value = select.dataset.hiddenval; + } else { + select.value = DV.P_ID_COLUMN_NAME; + } + select.disabled = false; + } + } + public fillStaticDropdownList(segmentName, optionList: any = [], elemID: string) { + let eitObj: any; + if (optionList.length > 0) { + let select = document.getElementById(elemID) as HTMLSelectElement; + document.getElementById(elemID).innerHTML = ""; + + for (let i = 0; i < optionList.length; i++) { + var option = document.createElement("option"); + option.text = optionList[i].MEANING; + option.value = optionList[i].CODE; + select.add(option); + } + } + } + + bindHtmlElemEvents(id, obj) { + const elem = document.getElementById(id); + console.log(elem); + console.log(obj); + const elemType = elem.tagName; + let changeEvent = "ionChange"; + + if (elemType == "SELECT") changeEvent = "change"; + + try { + elem.addEventListener(changeEvent, e => { + elem.classList.remove("requiredClassElm"); + if ( + obj.CHILD_SEGMENTS_VS_Splited && + obj.CHILD_SEGMENTS_VS_Splited.length > 0 + ) { + let listArray: any = obj.CHILD_SEGMENTS_VS_Splited; + listArray.forEach(element => { + this.emptyChildElement(element); + this.getValueSet(element); + }); + } + if ( + obj.CHILD_SEGMENTS_DV_Splited && + obj.CHILD_SEGMENTS_DV_Splited.length > 0 + ) { + let listArray: any = obj.CHILD_SEGMENTS_DV_Splited; + listArray.forEach(element => { + this.emptyChildElement(element); + for (let i = 0; i < this.eitResponse.length; i++) { + if (this.eitResponse[i].SEGMENT_NAME == element) { + this.getDefaultValue( + this.eitResponse[i], + this.eitResponse[i].DESC_FLEX_NAME, + this.eitResponse[i].DESC_FLEX_CONTEXT_CODE, + this.eitResponse[i].SEGMENT_NAME, + this.eitResponse[i].PARENT_SEGMENTS_VS_SplitedVS, + this.eitResponse[i].PARENT_SEGMENTS_DV_Splited + ); + } + } + }); + } + return false; + }); + } catch (e) { + console.log(e.status); + } + } + + public getDefaultValue( + obj, + descFlexName, + descFlexContextCode, + segmentName, + parentValue, + ParentsList + ) { + let dependenciesList: any = []; + let parentVal: any = null; + let isStandardDate: boolean = false; + let isStandardTimeDate: boolean = false; + let isStandardTime: boolean = false; + let isHidden: boolean = false; + let isReadOnlyList: boolean = false; + let isSelectElement: boolean = false; + isStandardDate = this.isStandardDate(obj); + isStandardTimeDate = this.isStandardDateTime(obj); + isStandardTime = this.isStandardTime(obj); + if (obj.DISPLAY_FLAG == "N") isHidden = true; + if (obj.VALIDATION_TYPE != "N" && obj.READ_ONLY == "Y") { + isReadOnlyList = true; + } + if (obj.VALIDATION_TYPE != "N" && obj.READ_ONLY == "N") { + isSelectElement = true; + } + + if ( + parentValue != "" && + (obj.VALIDATION_TYPE == "D" || obj.VALIDATION_TYPE == "Y") + ) { + let parvalue = this.getDependenciesParams(parentValue); + if (parvalue && parvalue[0]) parentVal = parvalue[0].ID_COLUMN_NAME; + else { + parentVal = null; + } + if (!parentVal) { + return false; + } + } + if (ParentsList != "") { + if (parentValue) ParentsList.concat(parentValue); + dependenciesList = this.getDependenciesParams(ParentsList); + if (!dependenciesList) { + return false; + } + } + + const body = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, //-999, + P_DESC_FLEX_NAME: descFlexName, + P_DESC_FLEX_CONTEXT_CODE: descFlexContextCode, + P_SEGMENT_NAME: segmentName, + P_PARENT_VALUE: parentVal, + GetValueSetValuesTBL: dependenciesList + }; + + this.profileService.getDefaultValue(body).subscribe((result: any) => { + let elem = this.getElementByName(segmentName); + let obj = this.handleDefaultValueResult(result); + let val = obj.value; + let text = obj.text; + if (val == null) { val = ""; } + if (text == null) { text = ""; } + if (isStandardDate) { + console.log("isStandardDate"); + elem.value = this.cs.reverseFormatDate(val); + } else if (isStandardTimeDate) { + console.log("isStandardTimeDate"); + if (val) { + elem.dataset.dtvalue = this.cs.reverseFormatStandardDate(val); + elem.innerHTML = this.cs.reverseFormatStandardDate(val); + } else { + elem.dataset.dtvalue = ""; + elem.innerHTML = ""; + } + } else if (isStandardTime) { + console.log("isStandardTime"); + if (val) { + elem.dataset.dtvalue = val; + elem.innerHTML = val; + elem.value = val; + } else { + elem.dataset.dtvalue = ""; + elem.innerHTML = ""; + } + } else { + if (isSelectElement) { + let elem = this.getSelectElementByName(segmentName); + elem = document.getElementById(elem), + elem.value = val; + } else { + elem.value = val; + elem.innerText = text; + elem.setAttribute("value", val); + } + } + if (isHidden || isReadOnlyList) { + if (val) elem.dataset.colmText = val; + else elem.dataset.colmText = ""; + elem.value = text; + } + var event = new Event("ionChange"); + elem.dispatchEvent(event); + }); + } + + handleDefaultValueResult(result) { + let data = { + text: result.GetDefaultValueList.P_VALUE_COLUMN_NAME, + value: result.GetDefaultValueList.P_ID_COLUMN_NAME + }; + return data; + } + + callValueSet() { + for (var i = 0; i < this.eitVALSettoCall.length; i++) { + this.getValueSet(this.eitVALSettoCall[i].SEGMENT_NAME); + } + } + + getParentValue(parentValue) { + if (parentValue.length == 0) { + for (let i = 0; i < this.eitResponse.length; i++) { + if (this.eitResponse[i].SEGMENT_NAME == parentValue[0].Name) { + if (this.eitResponse[i].VALIDATION_TYPE == "N") { + let val = (document.getElementById( + this.eitResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + return val; + } else { + let x = document.getElementById( + this.eitResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + if (x.options.length > 0) { + let val = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].value + : null; + return val; + } else { + return ""; + } + } + } + } + } else { + return ""; + } + } + + public getValueSet(segmentName) { + let descFlexName: any = ""; + let descFlexContextCode: any = ""; + let parentValue: any = []; + let ParentsList: any = []; + let parentVal: any = null; + let dependenciesList: any = []; + let validationType: string = ""; + + for (let i = 0; i < this.eitResponse.length; i++) { + if (this.eitResponse[i].SEGMENT_NAME == segmentName) { + descFlexName = this.eitResponse[i].DESC_FLEX_NAME; + descFlexContextCode = this.eitResponse[i].DESC_FLEX_CONTEXT_CODE; + parentValue = this.eitResponse[i].PARENT_SEGMENTS_VS_SplitedVS; + ParentsList = this.eitResponse[i].PARENT_SEGMENTS_VS_SplitedVS; + validationType = this.eitResponse[i].VALIDATION_TYPE; + break; + } + } + if (parentValue != "" && (validationType == "D" || validationType == "Y")) { + let parvalue = this.getDependenciesParams(parentValue); + if (parvalue && parvalue[0]) parentVal = parvalue[0].ID_COLUMN_NAME; + else { + parentVal = null; + } + if (!parentVal) { + return false; + } + } + if (ParentsList != "") { + dependenciesList = this.getDependenciesParams(ParentsList); + if (!dependenciesList) { + return false; + } + } + const body = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, //-999, + P_DESC_FLEX_NAME: descFlexName, + P_DESC_FLEX_CONTEXT_CODE: descFlexContextCode, + P_SEGMENT_NAME: segmentName, + P_PARENT_VALUE: parentVal, + GetValueSetValuesTBL: dependenciesList, + P_PAGE_NUM: 1, + P_PAGE_LIMIT: 1000 + }; + + this.profileService.getSetValue(body).subscribe((result: any) => { + if (result.GetValueSetValuesList != null) { + this.fillDropdownList(segmentName, result.GetValueSetValuesList); + } + }); + let arr: any = []; + return arr; + } + + getDependenciesParams(parentsList) { + let parentArr: any = []; + for (let i = 0; i < parentsList.length; i++) { + for (let j = 0; j < this.eitResponse.length; j++) { + if (this.eitResponse[j].SEGMENT_NAME == parentsList[i].Name) { + if (this.eitResponse[j].DISPLAY_FLAG != "N") { + if (this.eitResponse[j].VALIDATION_TYPE == "N") { + let idColName: string; + let val: any; + if ( + this.eitResponse[j].FORMAT_TYPE == "Y" || + this.eitResponse[j].FORMAT_TYPE == "I" + ) { + //standard date time or //time + let elem = document.getElementById( + this.eitResponse[j].APPLICATION_COLUMN_NAME + ) as HTMLDivElement; + val = elem.dataset.dtvalue; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } + idColName = val; + if (this.eitResponse[j].FORMAT_TYPE == "Y") + idColName = this.cs.formatStandardDate(val); + } else { + val = (document.getElementById( + this.eitResponse[j].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } + idColName = val; + if (this.eitResponse[j].FORMAT_TYPE == "X") { + //date + // idColName = this.cs.formatDate(val); + idColName = this.cs.formatDateNew(val); + } + } + parentArr.push({ + SEGMENT_NAME: this.eitResponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: val, + DESCRIPTION: "", + ID_COLUMN_NAME: idColName, + FLEX_VALUE_SET_NAME: this.eitResponse[j].FLEX_VALUE_SET_NAME + }); + break; + } else { + if (this.eitResponse[j].READ_ONLY != "Y") { + let x = document.getElementById( + this.eitResponse[j].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + let text = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].text + : ""; + let val = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].value + : undefined; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { + } + if (text == undefined) { + text = ""; + } + parentArr.push({ + SEGMENT_NAME: this.eitResponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.eitResponse[j].FLEX_VALUE_SET_NAME + }); + break; + } else { + let x = document.getElementById( + this.eitResponse[j].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let text = x.value; + let val = x.dataset.colmText; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { + } + if (text == undefined) { + text = ""; + } + parentArr.push({ + SEGMENT_NAME: this.eitResponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.eitResponse[j].FLEX_VALUE_SET_NAME + }); + break; + } + } + } else { + let x = document.getElementById( + this.eitResponse[j].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let text = x.value; + let val = x.dataset.colmText; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { + } + if (text == undefined) { + text = ""; + } + parentArr.push({ + SEGMENT_NAME: this.eitResponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.eitResponse[j].FLEX_VALUE_SET_NAME + }); + break; + } + } + } + } + return parentArr; + } + + emptyChildElement(segmentName) { + let elem = this.getElementByName(segmentName); + elem.value = null; + elem.innerHTML = ""; + if ("dtvalue" in elem.dataset) { + elem.dataset.dtvalue = ""; + } + if ("colmText" in elem.dataset) { + elem.dataset.colmText = ""; + } + var event = new Event("change"); + elem.dispatchEvent(event); + elem.classList.remove("requiredClassElm"); + } + + getRequiredFilds() { + for (let i = 0; i < this.eitResponse.length; i++) { + if (this.eitResponse[i].REQUIRED_FLAG == "Y") { + let elemVal = (document.getElementById( + this.eitResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + if (elemVal == "") { + //alert(this.eitResponse[i].SEGMENT_NAME+" is required"); + break; + } + } + } + } + + getElementByName(segmentName) { + let elemID: any = ""; + for (let i = 0; i < this.eitResponse.length; i++) { + if (this.eitResponse[i].SEGMENT_NAME == segmentName) { + elemID = this.eitResponse[i].APPLICATION_COLUMN_NAME; + break; + } + } + return document.getElementById(elemID) as HTMLInputElement; + } + + getSelectElementByName(segmentName) { + let elemID: any = ""; + for (let i = 0; i < this.eitResponse.length; i++) { + if (this.eitResponse[i].SEGMENT_NAME == segmentName) { + elemID = this.eitResponse[i].APPLICATION_COLUMN_NAME; + break; + } + } + return elemID; + } + + isStandardDate(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "X") { + // standard date + if ( + obj.DEFAULT_TYPE == "C" || + obj.DEFAULT_TYPE == "D" || + obj.DEFAULT_TYPE == "P" || + obj.DEFAULT_TYPE == "S" + ) { + //constant + isSt = true; + } + } + return isSt; + } + + isStandardDateTime(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "Y") { + // standard date time + if ( + obj.DEFAULT_TYPE == "C" || + obj.DEFAULT_TYPE == "D" || + obj.DEFAULT_TYPE == "P" || + obj.DEFAULT_TYPE == "S" + ) { + //constant + isSt = true; + } + } + return isSt; + } + + isStandardTime(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "I") { + // standard date time + if ( + obj.DEFAULT_TYPE == "C" || + obj.DEFAULT_TYPE == "D" || + obj.DEFAULT_TYPE == "P" || + obj.DEFAULT_TYPE == "S" + ) { + //constant + isSt = true; + } + } + return isSt; + } + + isStandardDateVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "X") { + // standard date + isSt = true; + // } + } + return isSt; + } + + isStandardDateTimeVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "Y") { + // standard date time + isSt = true; + } + return isSt; + } + + isStandardTimeVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "I") { + // standard time + isSt = true; + } + return isSt; + } + + public customiseDate(date: any) { + let formatedDate = date.slice(0, 9); + let newDate = formatedDate.split("/").reverse(); + const tmp = newDate[2]; + newDate[2] = newDate[1]; + newDate[1] = tmp; + newDate = newDate.join("/"); + newDate = newDate + ' 00:00:00'; + return newDate; + } + + + public fillBasicDetailsStructure() { + + this.mutualBasicDetailsArray = this.eitDffResponse.concat(this.mutualBasicDetailsArray.concat(this.eitResponse, this.eitColResponse)); + + for (let i = 0; i < this.employeeBasicDetails.length; i++) { + let val: any; + if (this.employeeBasicDetails[i].VARCHAR2_VALUE) { + val = this.employeeBasicDetails[i].VARCHAR2_VALUE; + } else if (this.employeeBasicDetails[i].DATE_VALUE) { + val = this.cs.formatDate(this.employeeBasicDetails[i].DATE_VALUE); + if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'EFFECTIVE_DATE') { + this.effectiveDate = this.employeeBasicDetails[i].DATE_VALUE; + this.showEffectiveDate = this.employeeBasicDetails[i].SEGMENT_VALUE_DSP; + } + } else if (this.employeeBasicDetails[i].NUMBER_VALUE) { + val = this.employeeBasicDetails[i].NUMBER_VALUE; + } + const elem = document.getElementById(this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME) as HTMLInputElement; + if (elem) { + if (val) { + let feldDetails = this.mutualBasicDetailsArray.find( + + x => + x.APPLICATION_COLUMN_NAME == + this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME + ); + if (feldDetails) { + let isStandardTime = this.isStandardTimeVal(feldDetails); + if (isStandardTime) { + elem.innerHTML = val; + elem.dataset.dtvalue = val; + } else { + elem.value = val; + elem.setAttribute("value", elem.value); + } + } + } + } + } + } + + fillEITStructure() { + var obj = { peiObjVer: null, peiExtraInfoID: null }; + for (let i = 0; i < this.validateEitObj.length; i++) { + let val: any; + if (this.validateEitObj[i].VARCHAR2_VALUE) + val = this.validateEitObj[i].VARCHAR2_VALUE; + else if (this.validateEitObj[i].DATE_VALUE) + val = this.validateEitObj[i].DATE_VALUE; + else if (this.validateEitObj[i].NUMBER_VALUE) + val = this.validateEitObj[i].NUMBER_VALUE; + const elem = document.getElementById( + this.validateEitObj[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + //obj.transactionNo=this.validateEitObj[i].TRANSACTION_NUMBER; + if (elem) { + if (val) { + let feldDetails = this.eitResponse.find( + x => + x.APPLICATION_COLUMN_NAME == + this.validateEitObj[i].APPLICATION_COLUMN_NAME + ); + if (feldDetails) { + let isStandardDate = this.isStandardDateVal(feldDetails); + let isStandardDateTime = this.isStandardDateTimeVal(feldDetails); + let isStandardTime = this.isStandardTimeVal(feldDetails); + if (isStandardDate) { + elem.value = this.cs.reverseFormatDate(val); + } else if (isStandardDateTime) { + elem.innerHTML = this.cs.reverseFormatStandardDate(val); + elem.dataset.dtvalue = this.cs.reverseFormatStandardDate(val); + } else if (isStandardTime) { + elem.innerHTML = val; + elem.dataset.dtvalue = val; + } else { + elem.value = val; + elem.setAttribute("value", elem.value); + } + if ( + feldDetails.DISPLAY_FLAG == "N" || + (feldDetails.VALIDATION_TYPE != "N" && + feldDetails.READ_ONLY == "Y") + ) { + elem.dataset.colmText = val; + elem.value = this.validateEitObj[i].SEGMENT_VALUE_DSP; + elem.setAttribute("value", elem.value); + } + } + elem.dataset.hiddenval = val; //hide the value to set it after calling get value set + if ( + feldDetails.CHILD_SEGMENTS_VS_Splited && + feldDetails.CHILD_SEGMENTS_VS_Splited.length > 0 + ) { + let listArray: any = feldDetails.CHILD_SEGMENTS_VS_Splited; + listArray.forEach(element => { + this.getValueSet(element); + }); + } + // var event = new Event('change'); + // elem.dispatchEvent(event); + } + } else { + if ( + this.validateEitObj[i].APPLICATION_COLUMN_NAME == + "PEI_OBJECT_VERSION_NUMBER" + ) + obj.peiObjVer = this.validateEitObj[i].NUMBER_VALUE; + else if ( + this.validateEitObj[i].APPLICATION_COLUMN_NAME == "PEI_EXTRA_INFO_ID" + ) + obj.peiExtraInfoID = this.validateEitObj[i].NUMBER_VALUE; + } + } + this.ExtraObj = obj; + } + + public getElementsValues(): any { + this.updatedValues = []; //fill updated list + let valuseArr: any = []; + let varcharValue: any = null; + let numbervalue: any = 0; + let dateValue: any = null; + let transNo: number = 1; + let textValue: any; + // if(this.ExtraObj.transactionNo) + // transNo=this.ExtraObj.transactionNo; + for (let i = 0; i < this.eitResponse.length; i++) { + varcharValue = null; + numbervalue = null; + dateValue = null; + /*********set transaction No of the updated object ********/ + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.eitResponse[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + } + if (this.eitResponse[i].DISPLAY_FLAG != "N") { + if (this.eitResponse[i].VALIDATION_TYPE == "N") { + let elem = document.getElementById( + this.eitResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let elemVal = (document.getElementById( + this.eitResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + textValue = elemVal; + //let elemVal= (document.getElementById(this.eitResponse[i].APPLICATION_COLUMN_NAME)).value; + if ( + this.eitResponse[i].FORMAT_TYPE == "X" && + this.eitResponse[i].DISPLAY_FLAG != "N" + ) { + //date + elemVal = this.cs.formatDate(elemVal); + } else if ( + this.eitResponse[i].FORMAT_TYPE == "Y" && + this.eitResponse[i].DISPLAY_FLAG != "N" + ) { + //standard date time + // elemVal = elem.dataset.dtvalue; + // elemVal = this.cs.formatStandardDate(elemVal); + elemVal = this.cs.formatDate(elemVal); + } else if ( + this.eitResponse[i].FORMAT_TYPE == "I" && + this.eitResponse[i].DISPLAY_FLAG != "N" + ) { + //time + if (elemVal.length > 5) { + elemVal = elemVal.substring(11, 16); + } else { + elemVal = elemVal; + } + } + if (this.eitResponse[i].REQUIRED_FLAG == "Y" && !elemVal) { + elem.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + elem.classList.remove("requiredClassElm"); + } + // if (elemVal != 'null'){ + varcharValue = elemVal; + //} else{ + // elemVal = null; + // } + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.eitResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } else { + let x = document.getElementById( + this.eitResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + if (this.eitResponse[i].READ_ONLY == "Y") { + let text = x.value; + let val = x.dataset.colmText; + varcharValue = val; + textValue = text; + } else { + let val = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].value + : null; + let txt = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].text + : null; + varcharValue = val; + textValue = txt; + } + if (this.eitResponse[i].REQUIRED_FLAG == "Y" && !varcharValue) { + x.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.eitResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } //end else + } else { + let x = document.getElementById( + this.eitResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + let val = x.dataset.colmText; + textValue = x.value; + if (this.eitResponse[i].REQUIRED_FLAG == "Y" && !val) { + x.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + + let staticValueBasicDetail = this.employeeBasicDetails.find( + x => + x.APPLICATION_COLUMN_NAME == + this.eitResponse[i].APPLICATION_COLUMN_NAME + ); + + if (staticValueBasicDetail) { + if (staticValueBasicDetail.DATATYPE === 'VARCHAR2') { + varcharValue = staticValueBasicDetail.VARCHAR2_VALUE; + } else if (staticValueBasicDetail.DATATYPE === 'DATE') { + dateValue = staticValueBasicDetail.DATE_VALUE; + } else if (staticValueBasicDetail.DATATYPE === 'NUMBER') { + numbervalue = staticValueBasicDetail.NUMBER_VALUE; + } else { + if (val) varcharValue = val; + } + } else { + if (val) varcharValue = val; + } + + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.eitResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } + + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.eitResponse[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + if (this.validateEitObj && this.eitSubmitAction == EIT_ACTION.UPDATE) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.eitResponse[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + let y = { + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue, + SEGMENT_VALUE_DSP: textValue, + APPLICATION_COLUMN_NAME: this.eitResponse[i] + .APPLICATION_COLUMN_NAME, + DATATYPE: this.eitResponse[i].DATATYPE, + DESC_FLEX_CONTEXT_CODE: this.eitResponse[i].DESC_FLEX_CONTEXT_CODE, + DESC_FLEX_NAME: this.eitResponse[i].DESC_FLEX_NAME, + DISPLAY_FLAG: this.eitResponse[i].DISPLAY_FLAG, + SEGMENT_NAME: this.eitResponse[i].SEGMENT_NAME, + SEGMENT_PROMPT: this.eitResponse[i].SEGMENT_PROMPT + }; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } + } + } // end for + + if (this.getPassdirfromNotifiPage) { + let updatedObj1 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_ACTION" + ); + let updatedObj2 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_EXTRA_INFO_ID" + ); + let updatedObj3 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_OBJECT_VERSION_NUMBER" + ); + this.updatedValues.push(updatedObj1); + this.updatedValues.push(updatedObj2); + this.updatedValues.push(updatedObj3); + valuseArr = this.fillExtraInformation( + valuseArr, + updatedObj1.VARCHAR2_VALUE, + updatedObj2.NUMBER_VALUE, + updatedObj3.NUMBER_VALUE, + transNo + ); + } else { + if (this.eitSubmitAction == EIT_ACTION.ADD) { + this.updatedValues = this.fillExtraValuesUpdated( + this.updatedValues, + "NEW_ROW", + -1, + 0, + transNo + ); + valuseArr = this.fillExtraInformation( + valuseArr, + "NEW_ROW", + -1, + 0, + transNo + ); + } else if (this.eitSubmitAction == EIT_ACTION.UPDATE) { + valuseArr = this.fillExtraInformation( + valuseArr, + "UPDATE_ROW", + this.ExtraObj.peiExtraInfoID, + this.ExtraObj.peiObjVer, + transNo + ); + } else if (this.eitSubmitAction == EIT_ACTION.DELETE) { + valuseArr = this.fillExtraInformation( + valuseArr, + "DELETE_ROW", + this.ExtraObj.peiExtraInfoID, + this.ExtraObj.peiObjVer, + transNo + ); + } + } + return valuseArr; + } // end getElementsValues + + + public getElementsValuesDff(): any { + this.updatedValues = []; //fill updated list + let valuseArr: any = []; + let varcharValue: any = null; + let numbervalue: any = 0; + let dateValue: any = null; + let transNo: number = 1; + let textValue: any; + // if(this.ExtraObj.transactionNo) + // transNo=this.ExtraObj.transactionNo; + for (let i = 0; i < this.eitDffResponse.length; i++) { + varcharValue = null; + numbervalue = null; + dateValue = null; + /*********set transaction No of the updated object ********/ + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + } + if (this.eitDffResponse[i].DISPLAY_FLAG != "N") { + if (this.eitDffResponse[i].VALIDATION_TYPE == "N") { + let elem = document.getElementById( + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let elemVal = (document.getElementById( + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + textValue = elemVal; + //let elemVal= (document.getElementById(this.eitResponse[i].APPLICATION_COLUMN_NAME)).value; + if ( + this.eitDffResponse[i].FORMAT_TYPE == "X" && + this.eitDffResponse[i].DISPLAY_FLAG != "N" + ) { + //date + elemVal = this.cs.formatDate(elemVal); + } else if ( + this.eitDffResponse[i].FORMAT_TYPE == "Y" && + this.eitDffResponse[i].DISPLAY_FLAG != "N" + ) { + //standard date time + // elemVal = elem.dataset.dtvalue; + // elemVal = this.cs.formatStandardDate(elemVal); + elemVal = this.cs.formatDate(elemVal); + } else if ( + this.eitDffResponse[i].FORMAT_TYPE == "I" && + this.eitDffResponse[i].DISPLAY_FLAG != "N" + ) { + //time + if (elemVal.length > 5) { + elemVal = elemVal.substring(11, 16); + } else { + elemVal = elemVal; + } + } + if (this.eitDffResponse[i].REQUIRED_FLAG == "Y" && !elemVal) { + elem.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + elem.classList.remove("requiredClassElm"); + } + // if (elemVal != 'null'){ + varcharValue = elemVal; + //} else{ + // elemVal = null; + // } + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.eitDffResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } else { + let x = document.getElementById( + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + if (this.eitDffResponse[i].READ_ONLY == "Y") { + let text = x.value; + let val = x.dataset.colmText; + varcharValue = val; + textValue = text; + } else { + let val = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].value + : null; + let txt = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].text + : null; + varcharValue = val; + textValue = txt; + } + if (this.eitDffResponse[i].REQUIRED_FLAG == "Y" && !varcharValue) { + x.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.eitDffResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } //end else + } else { + let x = document.getElementById( + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + let val = x.dataset.colmText; + textValue = x.value; + if (this.eitDffResponse[i].REQUIRED_FLAG == "Y" && !val) { + x.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + + let staticValueBasicDetail = this.employeeBasicDetails.find( + x => + x.APPLICATION_COLUMN_NAME == + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ); + + if (staticValueBasicDetail) { + if (staticValueBasicDetail.DATATYPE === 'VARCHAR2') { + varcharValue = staticValueBasicDetail.VARCHAR2_VALUE; + } else if (staticValueBasicDetail.DATATYPE === 'DATE') { + dateValue = staticValueBasicDetail.DATE_VALUE; + } else if (staticValueBasicDetail.DATATYPE === 'NUMBER') { + numbervalue = staticValueBasicDetail.NUMBER_VALUE; + } else { + if (val) varcharValue = val; + } + } else { + if (val) varcharValue = val; + } + + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.eitDffResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } + + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + if (this.validateEitObj && this.eitSubmitAction == EIT_ACTION.UPDATE) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + let y = { + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue, + SEGMENT_VALUE_DSP: textValue, + APPLICATION_COLUMN_NAME: this.eitDffResponse[i] + .APPLICATION_COLUMN_NAME, + DATATYPE: this.eitDffResponse[i].DATATYPE, + DESC_FLEX_CONTEXT_CODE: this.eitDffResponse[i].DESC_FLEX_CONTEXT_CODE, + DESC_FLEX_NAME: this.eitDffResponse[i].DESC_FLEX_NAME, + DISPLAY_FLAG: this.eitDffResponse[i].DISPLAY_FLAG, + SEGMENT_NAME: this.eitDffResponse[i].SEGMENT_NAME, + SEGMENT_PROMPT: this.eitDffResponse[i].SEGMENT_PROMPT + }; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } + } + } // end for + + if (this.getPassdirfromNotifiPage) { + let updatedObj1 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_ACTION" + ); + let updatedObj2 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_EXTRA_INFO_ID" + ); + let updatedObj3 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_OBJECT_VERSION_NUMBER" + ); + this.updatedValues.push(updatedObj1); + this.updatedValues.push(updatedObj2); + this.updatedValues.push(updatedObj3); + valuseArr = this.fillExtraInformation( + valuseArr, + updatedObj1.VARCHAR2_VALUE, + updatedObj2.NUMBER_VALUE, + updatedObj3.NUMBER_VALUE, + transNo + ); + } else { + if (this.eitSubmitAction == EIT_ACTION.ADD) { + this.updatedValues = this.fillExtraValuesUpdated( + this.updatedValues, + "NEW_ROW", + -1, + 0, + transNo + ); + valuseArr = this.fillExtraInformation( + valuseArr, + "NEW_ROW", + -1, + 0, + transNo + ); + } else if (this.eitSubmitAction == EIT_ACTION.UPDATE) { + valuseArr = this.fillExtraInformation( + valuseArr, + "UPDATE_ROW", + this.ExtraObj.peiExtraInfoID, + this.ExtraObj.peiObjVer, + transNo + ); + } else if (this.eitSubmitAction == EIT_ACTION.DELETE) { + valuseArr = this.fillExtraInformation( + valuseArr, + "DELETE_ROW", + this.ExtraObj.peiExtraInfoID, + this.ExtraObj.peiObjVer, + transNo + ); + } + } + return valuseArr; + } // end getElementsValues + + fillExtraValuesUpdated( + values: any, + peiAction: string, + peiExtraInfoID: number, + peiObjVer: number, + transNo: number + ): any { + let obj1 = { + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: peiAction, + NUMBER_VALUE: null, + DATE_VALUE: null, + SEGMENT_VALUE_DSP: "", + APPLICATION_COLUMN_NAME: "PEI_ACTION", + DATATYPE: "VARCHAR2", + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + SEGMENT_NAME: "", + SEGMENT_PROMPT: "" + }; + let obj2 = { + TRANSACTION_NUMBER: 1, + APPLICATION_COLUMN_NAME: "PEI_OBJECT_VERSION_NUMBER", + VARCHAR2_VALUE: null, + NUMBER_VALUE: peiObjVer, + DATATYPE: "NUMBER", + SEGMENT_VALUE_DSP: "", + DATE_VALUE: null, + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + SEGMENT_NAME: "", + SEGMENT_PROMPT: "" + }; + let obj3 = { + APPLICATION_COLUMN_NAME: "PEI_EXTRA_INFO_ID", + DATATYPE: "NUMBER", + DATE_VALUE: null, + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + NUMBER_VALUE: peiExtraInfoID, + SEGMENT_NAME: "", + SEGMENT_PROMPT: "", + SEGMENT_VALUE_DSP: "", + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: null + }; + values.push(obj1); + values.push(obj2); + values.push(obj3); + return values; + } + + fillExtraInformation( + values: any, + peiAction: string, + peiExtraInfoID: number, + peiObjVer: number, + transNo: number + ): any { + values.push({ + TRANSACTION_NUMBER: transNo, + NAME: "PEI_ACTION", + VARCHAR2_VALUE: peiAction, + NUMBER_VALUE: null, + DATE_VALUE: null + }); + values.push({ + TRANSACTION_NUMBER: transNo, + NAME: "PEI_EXTRA_INFO_ID", + VARCHAR2_VALUE: null, + NUMBER_VALUE: peiExtraInfoID, + DATE_VALUE: null + }); + values.push({ + TRANSACTION_NUMBER: transNo, + NAME: "PEI_OBJECT_VERSION_NUMBER", + VARCHAR2_VALUE: null, + NUMBER_VALUE: peiObjVer, + DATE_VALUE: null + }); + return values; + } + + fixTransactionNo(transactionTBL: any): any[] { + let list: any = []; + let newIndex: number = 1; + let length: number = transactionTBL.length; + if (length > 0) { + for (let i = 0; i < length; i++) { + // let item :any={}; + const item = Object.assign({}, transactionTBL[i]); + let transNo: number = item.TRANSACTION_NUMBER; + let obj: any = item; + if (i == 0) { + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } else { + let prevEl: any = transactionTBL[i - 1].TRANSACTION_NUMBER; + if (transNo == prevEl) { + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } else { + newIndex++; + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } + } + } + } + return list; + } + + public handledetailsResult(result) { + if (this.cs.validResponse(result)) { + this.cs.sharedService.setSharedData(this.basicRequest, BasicRequest.SHARED_DATA); + this.cs.sharedService.setSharedData(result.SubmitContactTransactionList, 'contact-details-response'); + // this.cs.sharedService.setSharedData({ isResubmit: false },"confirmAddEITData"); + this.cs.confirmContact(); + } + } + public calcDay() { + + } + public submitTransaction() { + var allStatisDynamicValues = []; + + + if (this.isDelete) { + allStatisDynamicValues.push({ + TRANSACTION_NUMBER: 1, + NAME: 'DATE_END', + VARCHAR2_VALUE: null, + NUMBER_VALUE: null, + DATE_VALUE: this.cs.formatDate(this.endDate) + }); + } else { + this.arrValues = this.getElementsValues(); + var dffvalues = this.getElementsValuesDff(); + let staticValues = this.getElementsStaticValues(); + allStatisDynamicValues = dffvalues.concat(this.arrValues.concat(staticValues)); + } + if (allStatisDynamicValues) { + this.basicRequest = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.selMenu.List_Menu.MENU_TYPE, + P_SELECTED_RESP_ID: this.respID, + P_FUNCTION_NAME: this.selMenu.GetMenuEntriesList.FUNCTION_NAME, + EITTransactionTBL: allStatisDynamicValues, + P_CONTACT_RELATIONSHIP_ID: this.employeeBasicDetails.length > 0 || this.isDelete ? this.selctedContact['CONTACT_RELATIONSHIP_ID'] : null, + P_ACTION: this.employeeBasicDetails.length > 0 ? 'UPDATE' : this.isDelete ? 'DELETE' : 'ADD' + }; + console.log(this.basicRequest); + + this.profileService.submitContactTransaction(this.basicRequest).subscribe((result: any) => { + this.handledetailsResult(result); + }); + } + } + +} diff --git a/Mohem/src/app/profile/confirm-address/confirm-address.component.ts b/Mohem/src/app/profile/confirm-address/confirm-address.component.ts index 20b0a474..fb51f580 100644 --- a/Mohem/src/app/profile/confirm-address/confirm-address.component.ts +++ b/Mohem/src/app/profile/confirm-address/confirm-address.component.ts @@ -10,6 +10,7 @@ import { SubmitEitModalComponent } from 'src/app/eit/submit-eit-modal/submit-eit import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { HomeComponent } from 'src/app/notification/home/home.component'; import { EITNotificatonBodyResponse } from 'src/app/notification/models/EITNotificationBodyRes'; import { WorkListButtonRequest } from 'src/app/notification/models/NotificationButtonReq'; import { WorkListAttachViewComponent } from 'src/app/notification/work-list-attach-view/work-list-attach-view.component'; @@ -62,7 +63,7 @@ export class ConfirmAddressComponent implements OnInit { indexLastObj: any = 0; filterAllowedType: any = ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']; direction: string; - + isContact: boolean; constructor(public modalController: ModalController, public cs: CommonService, private ts: TranslatorService, private eitService: EitService, public profileService: ProfileService) { this.direction = TranslatorService.getCurrentLanguageName() @@ -98,8 +99,17 @@ export class ConfirmAddressComponent implements OnInit { this.menuType = this.selMenu.List_Menu.MENU_TYPE; this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; this.addrespList = this.cs.sharedService.getSharedData(AddEitResponse.SHARED_DATA, false); - this.itemKey = this.addrespList.SubmitAddressTransactionList.P_ITEM_KEY; - this.P_TransactionID = this.addrespList.SubmitAddressTransactionList.P_TRANSACTION_ID; + + this.isContact = this.cs.sharedService.getSharedData(AddEitResponse.isContact); + if (this.isContact) { + this.itemKey = this.addrespList.SubmitPhonesTransactionList.P_ITEM_KEY; + this.P_TransactionID = this.addrespList.SubmitPhonesTransactionList.P_TRANSACTION_ID; + this.headerTitle = this.ts.trPK('general', 'contact'); + } else { + this.itemKey = this.addrespList.SubmitAddressTransactionList.P_ITEM_KEY; + this.P_TransactionID = this.addrespList.SubmitAddressTransactionList.P_TRANSACTION_ID; + } + this.isDelete = this.isResubmitEIT = this.cs.sharedService.getSharedData('confirmAddEITData', false).isDelete; @@ -153,7 +163,11 @@ export class ConfirmAddressComponent implements OnInit { this.handleAddAttachmentResults(result); }); } else { - this.startEITApprovalProcess(); + if (this.isContact) { + this.startEITContactApprovalProcess(); + } else { + this.startEITApprovalProcess(); + } } // } } @@ -179,7 +193,11 @@ export class ConfirmAddressComponent implements OnInit { } // end for if (this.isTrue == result.AddAttSuccessList.length) { - this.startEITApprovalProcess(); + if (this.isContact) { + this.startEITContactApprovalProcess(); + } else { + this.startEITApprovalProcess(); + } } else { //stope @@ -193,6 +211,24 @@ export class ConfirmAddressComponent implements OnInit { } } + + startEITContactApprovalProcess() { + let request: any = {}; + request.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; + request.P_MENU_TYPE = this.menuType; + request.P_SELECTED_RESP_ID = this.respID; + request.P_TRANSACTION_ID = this.P_TransactionID; + request.P_ITEM_KEY = this.itemKey; + request.P_ACTION_MODE = this.pActionMode; + request.P_COMMENTS = this.eitComments; + this.profileService.startPhoneApprovalProcess( + request). + subscribe((result: any) => { + this.handleResults(result); + }); + } + + startEITApprovalProcess() { let request: any = {}; request.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; @@ -229,12 +265,14 @@ export class ConfirmAddressComponent implements OnInit { if (this.cs.validResponse(result)) { this.isSubmitBtnClicked = true; //if(this.isResubmitEIT==false){ - let msg: string = this.ts.trPK("eit", "approval-message-success"); - this.cs.presentAlert(msg); + // let msg: string = this.ts.trPK("eit", "approval-message-success"); + // this.cs.presentAlert(msg); + this.cs.greenToastPK("eit", "approval-message-success") // } // this.navCtrl.popToRoot(); - + this.cs.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); // this.cs.openHome(); + //this.cs.setTotalNumberOfWorklistRequest(true); this.cs.openNotificationPage(); } } diff --git a/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.component.ts b/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.component.ts index ef49d9e4..8b34d7f4 100644 --- a/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.component.ts +++ b/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.component.ts @@ -15,6 +15,7 @@ import { WorkListButtonRequest } from 'src/app/notification/models/NotificationB import { WorkListAttachViewComponent } from 'src/app/notification/work-list-attach-view/work-list-attach-view.component'; import { ProfileService } from '../service/profile.service'; import { SubmitAddressModalComponent } from '../submit-eit-modal/submit-address-modal.component'; +import { HomeComponent } from 'src/app/notification/home/home.component'; @Component({ selector: 'app-confirm-basic-details', @@ -77,7 +78,7 @@ export class ConfirmBasicDetailsComponent implements OnInit { this.basicRequest = this.cs.sharedService.getSharedData(BasicRequest.SHARED_DATA, false); this.selEmp = this.basicRequest.P_SELECTED_EMPLOYEE_NUMBER; - + this.menuType = this.selMenu.List_Menu.MENU_TYPE; this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; this.basicResponseList = this.cs.sharedService.getSharedData('basic-details-response', false); @@ -87,7 +88,7 @@ export class ConfirmBasicDetailsComponent implements OnInit { // this.isDelete = this.isResubmitEIT = this.cs.sharedService.getSharedData('confirmAddEITData', false).isDelete; this.getApproversList(); - + } getApproversList() { @@ -98,7 +99,7 @@ export class ConfirmBasicDetailsComponent implements OnInit { P_PAGE_LIMIT: 1000 } this.eitService.getApproversList(body).subscribe((result: any) => { - this.handleApproversResult(result); + this.handleApproversResult(result); }); } @@ -191,8 +192,10 @@ export class ConfirmBasicDetailsComponent implements OnInit { handleResults(result) { if (this.cs.validResponse(result)) { this.isSubmitBtnClicked = true; - let msg: string = this.ts.trPK("eit", "approval-message-success"); - this.cs.presentAlert(msg); + // let msg: string = this.ts.trPK("eit", "approval-message-success"); + // this.cs.presentAlert(msg); + this.cs.greenToastPK("eit", "approval-message-success"); + this.cs.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.cs.openNotificationPage(); } } @@ -301,7 +304,7 @@ export class ConfirmBasicDetailsComponent implements OnInit { modal.onDidDismiss() .then((data) => { - }); + }); return await modal.present(); } @@ -430,6 +433,6 @@ export class ConfirmBasicDetailsComponent implements OnInit { } catch (e) { } } - + } diff --git a/Mohem/src/app/profile/confirm-contact/confirm-contact.component.html b/Mohem/src/app/profile/confirm-contact/confirm-contact.component.html new file mode 100644 index 00000000..0505227b --- /dev/null +++ b/Mohem/src/app/profile/confirm-contact/confirm-contact.component.html @@ -0,0 +1,128 @@ + + + + {{headerTitle}} + + + + + + + + + +
{{'general, addAttach' | translate}}
+
+ +
+ +
+
+
+ + + {{ 'general, notAttch' | translate}} + +
+ + +
+ + + + {{attachList.AttachmentID +1 }} . + + + + + {{attachList.P_FILE_NAME }} + + + + + + + +
+ +
+ +
+ + +
+
+ + {{attachRes.FILE_NAME }} + +
+ + + + +
+
+ +
+ + + +
{{'confirmAddEit, comment' | translate}}
+ + + +
+ + +
{{'confirmAddEit, approverList' | translate}}
+
+

{{ 'general, empty' | translate}}

+
+
+ +
+ + +
+
+ +
+
+ + + {{employee.APPROVER}} + + + {{employee.POSITION_TITLE}} + + + +
+
+
+
+
+ +
+ + +
+ + +
+ + {{ 'general, submit' | translate }} +
+
\ No newline at end of file diff --git a/Mohem/src/app/profile/confirm-contact/confirm-contact.component.scss b/Mohem/src/app/profile/confirm-contact/confirm-contact.component.scss new file mode 100644 index 00000000..2ed98379 --- /dev/null +++ b/Mohem/src/app/profile/confirm-contact/confirm-contact.component.scss @@ -0,0 +1,263 @@ +.footer-button { + border-radius: 2px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; + } + + .imgSize { + width: 22px; + height: 22px; + } + + .Header { + font-weight: bold; + color: #1a586d !important; + font-size: 10px; + } + + .tbData { + font-size: 10px; + } + + .btnBack { + background: transparent; + float: right; + } + + .attachmentDiv{ + background: #ffffff; + height: auto; + text-align: center; + padding-top: 1px; + margin: 10px; + border-radius: 15px; + border: 1px solid grey; + } + + .noDataDiv{ + background: #ffffff; + height: 11%; + text-align: center; + padding-top: 1px; + border-radius: 10px; + margin: 10px; + border-radius: 5px; + } + .submitNote{ + background: #ffffff; + height: 80px; + padding-top: 1px; + margin: 10px; + border-radius: 15px; + border: 1px solid grey; + } + + .approvalList{ + --background: #f0efef; + height: auto; + text-align: center; + padding-top: 1px; + border-radius: 10px; + margin: 10px; + border-radius: 5px; + } + + /************************New Design**********************************/ + .notification-list{ + background: none; + background: none; + border-radius: 32px; + ion-item{ + // margin-top: 5px; + // margin-bottom: 5px; + + background-color: transparent; + .item-date{ + width: 100%; + font-size: 16px; + font-weight: bold; + + text-align: start; + padding: 0; + margin: 0; + + position: absolute; + left: 0; + top: 12%; + } + ion-label , [item-end]{ + + white-space: normal; + font-size: 14px; + padding-top: 15%; + // :root[dir="ltr"]{ + // margin-left: 10px; + // } + // :root[dir="rtl"]{ + // margin-right: 10px; + // } + + } + + } + } + + + + + + + .timeline { + position: relative; + margin: 15px 0 0 0; + // border-bottom: solid 1px var(--cusgray); + } + + .timeline:before { + + content: ''; + position: inherit !important; + top: 0; + bottom: 0; + width: 4px; + // background: #e4e4e4; + z-index: 1; + left: 35px; + /* margin-left: -10px; */ + /* z-index: 1; */ + } + + .timeline .timeline-thumb { + + border-radius: 500px; + width: 70px !important; + z-index: 2; + position: absolute; + left: 0px; + // :root[dir="ltr"]{ + // left: 37px; + // } + // :root[dir="rtl"]{ + // right: 37px; + // } + float: right; + top: 9px; + } + + .timeline .timeline-thumb.timeline-icon { + height: 70px; + // text-align: center; + // color: white; + // border: 5px solid #CBD0D3; + // transform: scale(0.2); + } + + + + .timeline .timeline-item { + width: 40px; + + } + + .timeline .timeline-stats { + position: relative; + font-size: 12px; + color: var(--darkgray); + + } + + .empImge{ + border-radius: 50%; + width:100%; + height: 100%; + border: #dedede solid 1px; + + } + .empImgeRep { + border-radius: 50% !important; + width: 80px; + height: 80px; + border: #dedede solid 1px; + } + + .line{ + padding-bottom:87px; + } + + .attachLable{ + position: absolute; + top: 0px; + z-index: 0; + background: #30b8c6; + color: #fff; + border-radius: 50%; + border: 0px; + width: 24px; + height: 24px; + text-align: center; + font-size: 5px; + } + + .removeLable{ + top: 0px; + z-index: 0; + background: #d8252d; + color: #fff; + border-radius: 50%; + border: 0px; + width: 20px; + height: 20px; + text-align: center; + font-size: 5px; + } + + .note-modal { + // width: 90%; + // height: 50%; + // top: 20%; + // left: 5%; + // right: 5%; + // bottom: 5%; + background: rgba(0, 0, 0, 0.5) !important; + padding: 30% 10% !important; + --height: 12cm !important; + // --width: 80% !important; + --border-radius:20px; + + } + .header-toolbar-new{ + --background: #269DB8; + } + .title{ + margin-top: -37px; + margin-left: 85px; + } + .title-ar{ + margin-top: -37px; + margin-right: 101px; + } + .confirmEitOkButton{ + white-space: normal !important; + text-transform: capitalize !important; + min-height: 45px !important; + min-width: 5px !important; + margin: 8px !important; + background-color: #269DB8; + width: 80% !important; + color: white!important; + border-radius: 16px !important; + } + + .approvalTitle-ar{ + font-weight: bold; + font-size: 16px; + text-align: right; + + } + .approvalTitle{ + font-weight: bold; + font-size: 16px; + text-align: left; + } + \ No newline at end of file diff --git a/Mohem/src/app/profile/confirm-contact/confirm-contact.component.spec.ts b/Mohem/src/app/profile/confirm-contact/confirm-contact.component.spec.ts new file mode 100644 index 00000000..6a25647a --- /dev/null +++ b/Mohem/src/app/profile/confirm-contact/confirm-contact.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ConfirmContactComponent } from './confirm-contact.component'; + +describe('ConfirmContactComponent', () => { + let component: ConfirmContactComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ConfirmContactComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ConfirmContactComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/profile/confirm-contact/confirm-contact.component.ts b/Mohem/src/app/profile/confirm-contact/confirm-contact.component.ts new file mode 100644 index 00000000..894fb16e --- /dev/null +++ b/Mohem/src/app/profile/confirm-contact/confirm-contact.component.ts @@ -0,0 +1,438 @@ +import { Component, OnInit } from '@angular/core'; +import { ModalController } from '@ionic/angular'; +import { FileUploader } from 'ng2-file-upload'; +import { AddAttachComponent } from 'src/app/eit/add-attach/add-attach.component'; +import { AddEitResponse } from 'src/app/eit/models/add.eit.response'; +import { BasicRequest } from "../models/basic.request"; +import { NotificationGetAttachResponse } from 'src/app/eit/models/NotificationGetAttachRes'; +import { EitService } from 'src/app/eit/services/eit.service'; +import { SubmitEitModalComponent } from 'src/app/eit/submit-eit-modal/submit-eit-modal.component'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { EITNotificatonBodyResponse } from 'src/app/notification/models/EITNotificationBodyRes'; +import { WorkListButtonRequest } from 'src/app/notification/models/NotificationButtonReq'; +import { WorkListAttachViewComponent } from 'src/app/notification/work-list-attach-view/work-list-attach-view.component'; +import { ProfileService } from '../service/profile.service'; +import { SubmitAddressModalComponent } from '../submit-eit-modal/submit-address-modal.component'; +import { HomeComponent } from 'src/app/notification/home/home.component'; + + +@Component({ + selector: 'app-confirm-contact', + templateUrl: './confirm-contact.component.html', + styleUrls: ['./confirm-contact.component.scss'], +}) +export class ConfirmContactComponent implements OnInit { + + private P_TransactionID: number; + private basicRequest: BasicRequest; + approversList = []; + basicResponseList: any; + eitComments: string = ""; + menuType: string = ""; + selEmp: string = ""; + respID: number; + selMenu: MenuResponse; + getAttachList: any; + attachListDisplay: any = []; + headerTitle: string = ""; + isTrue: any = 0; + attachItems: any; + public isResubmitEIT: boolean = false; + private itemKey: string = ""; + private pActionMode: string = "SUBMIT"; + attachReqObj: WorkListButtonRequest = new WorkListButtonRequest(); + attachmentRes: any; + objIndex1: any; + attachListOver: any = []; + index: any = 0; + getPassNotificationDetails: any; + isSubmitBtnClicked: boolean; + // isDelete: boolean = false; + + /***Add Attchment Vars */ + isUpload: boolean = false; + inQueue: boolean = false; + addAttachmentListReq: any; + attachmentID: number = 0; + addAttachRequest: any = []; + fileData: any; + fileType: any; + dirPage: any; + TransactionID: any; + indexLastObj: any = 0; + filterAllowedType: any = ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']; + direction: string; + + + constructor(public modalController: ModalController, public cs: CommonService, private ts: TranslatorService, private eitService: EitService, public profileService: ProfileService) { + this.direction = TranslatorService.getCurrentLanguageName() + this.isSubmitBtnClicked = false; + this.basicRequest = new BasicRequest(); + } + + ngOnInit() { + this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); + this.selEmp = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_EMP, false); + this.respID = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_RESP_ID, false); + this.basicRequest = this.cs.sharedService.getSharedData(BasicRequest.SHARED_DATA, false); + + this.selEmp = this.basicRequest.P_SELECTED_EMPLOYEE_NUMBER; + + this.menuType = this.selMenu.List_Menu.MENU_TYPE; + this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; + this.basicResponseList = this.cs.sharedService.getSharedData('contact-details-response', false); + console.log(this.basicResponseList); + this.itemKey = this.basicResponseList.P_ITEM_KEY; + this.P_TransactionID = this.basicResponseList.P_TRANSACTION_ID; + // this.isDelete = this.isResubmitEIT = this.cs.sharedService.getSharedData('confirmAddEITData', false).isDelete; + + this.getApproversList(); + + } + + getApproversList() { + let body: any = { + P_TRANSACTION_ID: this.P_TransactionID, + P_AME_TRANSACTION_TYPE: "SSHRMS", + P_PAGE_NUM: 1, + P_PAGE_LIMIT: 1000 + } + this.eitService.getApproversList(body).subscribe((result: any) => { + this.handleApproversResult(result); + }); + } + + handleApproversResult(result) { + if (this.cs.validResponse(result)) { + this.approversList = result.GetApprovesList; + } + } + + startEitApproval() { + if (this.attachListOver) { + let request = { + AddAttachmentList: this.attachListOver + } + + this.eitService.addAttachment( + request). + subscribe((result: any) => { + this.handleAddAttachmentResults(result); + }); + } else { + this.startContactApprovalProcess(); + } + } + + + handleAddAttachmentResults(result) { + + if (this.cs.validResponse(result)) { + this.isTrue = 0; + for (let i = 0; i < result.AddAttSuccessList.length; i++) { + if (!result.AddAttSuccessList[i].AddSuccess) { + this.attachListOver[i].isSuccess = false; + //this.attachItems[i].isSuccess = false; + // if false display cancel button with waring icon or design + }// end if + else { + // if true remove cancel and set isSuccess = true + // this.attachItems[i].isSuccess = true; + this.attachListOver[i].isSuccess = true; + this.isTrue = this.isTrue + 1; //count flag of attach status + } // end else + } // end for + + if (this.isTrue == result.AddAttSuccessList.length) { + this.startContactApprovalProcess(); + } + else { + //stope + let filtered = this.attachListOver.filter(function (el) { return el.isSuccess == true; }); + this.attachListOver = filtered; + let msg: string = ""; + msg = this.ts.trPK("eit", "attach-errorMsg"); + this.cs.presentAlert(msg); + } + } + } + + startContactApprovalProcess() { + let request: any = {}; + request.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; + request.P_MENU_TYPE = this.menuType; + request.P_SELECTED_RESP_ID = this.respID; + request.P_TRANSACTION_ID = this.P_TransactionID; + request.P_ITEM_KEY = this.itemKey; + request.P_ACTION_MODE = this.pActionMode; + request.P_COMMENTS = this.eitComments; + this.profileService.startContactApprovalProcess( + request). + subscribe((result: any) => { + this.handleResults(result); + }); + } + cancelEitProcess() { + let body: any = { + P_TRANSACTION_ID: this.P_TransactionID + } + this.eitService.cancelHRTransaction( + body). + subscribe((result: any) => { + this.handleCancelResults(result); + }); + + } + handleCancelResults(result) { + if (this.cs.validResponse(result)) { + this.isSubmitBtnClicked = false; + } + } + handleResults(result) { + if (this.cs.validResponse(result)) { + this.isSubmitBtnClicked = true; + // let msg: string = this.ts.trPK("eit", "approval-message-success"); + // this.cs.presentAlert(msg); + this.cs.greenToastPK("eit", "approval-message-success"); + this.cs.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + this.cs.openNotificationPage(); + } + } + + async addAttachment(str: boolean, attachItems: any) { + //open the modal with return data + let attachDocID = attachItems.ATTACHED_DOCUMENT_ID; + + this.cs.sharedService.setSharedData(this.P_TransactionID, 'TransactionID'); + this.cs.sharedService.setSharedData(this.attachListOver.length, 'indexLastObj'); + + const modal = await this.modalController.create({ + component: AddAttachComponent + }); + + modal.onDidDismiss() + .then((data) => { + if (data == "cancel" || data == "undefined") { + return; + } else { + if (!str) { + this.updateFile(data, attachDocID); + } else { + console.log(data); + this.attachListDisplay = data.data; + this.attachItems = this.attachListDisplay.map(function (el) { + var o = Object.assign({}, el); + o.isSuccess = false; + return o; + }); + + this.attachListOver = this.attachListOver ? this.attachListOver.concat(this.attachItems) : this.attachItems; + } + } + }); + + return await modal.present(); + } + + /*****submit modal********/ + async openSubmitModal() { + this.cs.sharedService.setSharedData(this.attachListOver, 'submitAttachmentList'); + this.cs.sharedService.setSharedData(this.eitComments, 'eitComments'); + const modal = await this.modalController.create({ + component: SubmitAddressModalComponent, + backdropDismiss: false, + + }); + modal.cssClass = 'note-modal'; + + modal.onDidDismiss() + .then((data) => { + console.log(data.data); + + if (data.data == "cancel" || data.data == undefined) { + return; + } else { + this.startEitApproval(); + } + }); + + return await modal.present(); + } + + + + removeFile(objectitem) { + if (this.attachListOver) { + let index2 = this.attachListOver.findIndex(item => item == objectitem); + if (index2 > -1) { + this.attachListOver.splice(index2, 1); + } + } + if (this.attachmentRes) { + let index3 = this.attachmentRes.findIndex(item => item == objectitem); + if (index3 > -1) { + this.attachmentRes.splice(index3, 1); + } + } + + } + + + getAttachment(NotificationID) { + this.attachReqObj.P_NOTIFICATION_ID = NotificationID; + this.eitService.getAttach(this.attachReqObj). + subscribe((result: NotificationGetAttachResponse) => { + this.handleWorkListAttachResult(result); + }); + } + + handleWorkListAttachResult(result) { + if (this.cs.validResponse(result)) { + if (result.GetAttachementList != null) { + this.attachmentRes = result.GetAttachementList; + } // if result == null + } // valid it + + } + + async OpenAttachFiles(value, Type) { + this.cs.sharedService.setSharedData({ displayData: value, TypeData: Type }, 'WorkListAttachViewPage'); + const modal = await this.modalController.create({ + component: WorkListAttachViewComponent + }); + + modal.onDidDismiss() + .then((data) => { + }); + return await modal.present(); + } + + + delelteFile(attach) { + this.cs.confirmAlertDialog((data) => { + if (data == true) { + this.continueDelete(attach); + } + }, this.ts.trPK('general', 'ok'), () => { + + }, this.ts.trPK('general', 'cancel'), this.ts.trPK('general', 'alert'), this.ts.trPK('eit', 'delete-perm')); + } + + continueDelete(attach) { + let req = { + P_ATTACHED_DOCUMENT_ID: attach.ATTACHED_DOCUMENT_ID + } + this.eitService.deleteAttach(req). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (result.DeleteAttachmentList.P_RETURN_STATUS === "S") { + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); + let msg: string = ""; + msg = this.ts.trPK("eit", "deleteAttach"); + this.cs.presentAlert(msg); + } + } + }); + } + + updateFile(attachList, attachDocID) { + let req = { + P_ATTACHED_DOCUMENT_ID: attachDocID, + P_FILE_DATA: attachList[0].P_FILE_DATA, + P_FILE_NAME: attachList[0].P_FILE_NAME, + P_FILE_CONTENT_TYPE: attachList[0].P_FILE_CONTENT_TYPE + } + this.eitService.updateAttach(req). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (result.MessageStatus == 1) { + let msg: string = ""; + msg = this.ts.trPK("eit", "attachUpdate"); + this.cs.presentAlert(msg); + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); + } + } + }); + } + + + ionViewWillLeave() { + if (this.P_TransactionID && this.isSubmitBtnClicked == false) + this.cancelEitProcess(); + } + + /*******************Add attchement Functions*************/ + + public uploader: FileUploader = new FileUploader({ + allowedMimeType: ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], + maxFileSize: 10 * 1024 * 1024, + formatDataFunctionIsAsync: true, + formatDataFunction: async (item) => { + return new Promise((resolve, reject) => { + resolve({ + name: item._file.name, + length: item._file.size, + contentType: item._file.type, + date: new Date() + }); + }); + } + }); + + + onFileSelectedclick(event) { + event.target.value = ''; + } + + + + onFileSelected(input) { + + if (!(this.filterAllowedType.indexOf(input.target.files[0].type) > -1)) { + let msg: string = ""; + msg = this.ts.trPK("general", "notSupport"); + this.cs.presentAlert(msg); + return + } // todo: show alert that you tried uploading wrong files + + else { + const file = input.target.files[0]; + this.getBase64(file).then( + data => this.pushObject(data, file.name, file.type) + ); + } + } + + + getBase64(file) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = () => resolve(reader.result); + reader.onerror = error => reject(error); + }); + } + + + pushObject(fileData, name, type) { + + console.log("before push: " + this.index); + try { + let array = name.split('.'); + let attachType: string = array[array.length - 1]; + this.attachListOver.push( + { + AttachmentID: this.attachListOver.length, + P_FILE_CONTENT_TYPE: attachType,//type.split('/')[1], + P_FILE_DATA: fileData.split(',')[1], + P_FILE_NAME: name,//.split('.')[0], + P_TRANSACTION_ID: this.P_TransactionID + }) + + } catch (e) { + } + } + +} diff --git a/Mohem/src/app/profile/contact/contact.component.html b/Mohem/src/app/profile/contact/contact.component.html new file mode 100644 index 00000000..8fed9814 --- /dev/null +++ b/Mohem/src/app/profile/contact/contact.component.html @@ -0,0 +1,53 @@ + +
+ + + +
+
+
+
+ +
+

+ {{ts.trPK('general','add-new-row')}} + +

+
+
+
+ + + +
+ + + +
+
+ +
+ + +
+
+
+

{{ts.trPK('general','delete')}}

+
+
+
+
+
+
+ +
+ + {{'userProfile, update' | translate}} + +
+
+ \ No newline at end of file diff --git a/Mohem/src/app/profile/contact/contact.component.scss b/Mohem/src/app/profile/contact/contact.component.scss new file mode 100644 index 00000000..d67acf74 --- /dev/null +++ b/Mohem/src/app/profile/contact/contact.component.scss @@ -0,0 +1,119 @@ +.bold{ + font-weight: bold; + font-size: 16px; +} +#containerDiv{ + + margin: 20px 0px; +} +.padding{ + padding-left:5px; + padding-right: 5px; +} +.color-black{ + color:#000; +} +.date{ + position: absolute; + font-size: 14px; + padding: 10px; + right:0; + width: 100px; + color:#969696; +} +.transaction-list{ + margin-top:20px; +} +.date-container{ + margin:0px 20px; +} +.colBold{ + font-size: 12px; +} +.label{ + font-size: 12px; + // margin-left: 15px; + color: #a2a5a6 !important; + display: block; + overflow: hidden; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + /* font-size: inherit; */ + // text-overflow: ellipsis; + // white-space: nowrap; + white-space: normal; + // padding-top: 10px; + padding: 5px 0px; + padding-left: 10px !important; + margin: 10px auto; + +} + +.Field-en{ + border-radius: 30px; + border: 1px solid #a2a5a6!important; + margin-bottom: 15px; + padding-left: 10px !important; + padding-top: 6px !important; + color: #999999 !important; +} + +.Field-ar{ + border-radius: 30px; + border: 1px solid #a2a5a6!important; + margin-bottom: 20px; + padding-right: 20px !important; + padding-top: 6px !important; + color: #999999 !important; +} +select{ + width: 85% !important; + border: none !important; + position: relative; + bottom: 5px; + background: transparent; +} +.delete-icon{ + position: absolute; + right: 20px; + bottom: -10px; + color: #d60505; + font-weight: bold; +} +.phoneContainer{ + position: relative; + margin-top: 15px; + padding: 20px; + border-radius: 10px; + box-shadow: 0px 0px 3px 0px #ccc +} +.new-row{ + + text-align: center; + color: #259CB8; + font-weight: bold; +} +.add-new-row-card{ + box-shadow: none; + background: #d6d6d652; + border: 1px solid #ccc; +} +.add-icons{ + height: 22px; + width: 22px; + display: inline-flex; + background: #259CB8; + padding: 4px; + border-radius: 5px; + top: 5px; + position: relative; +} +.icons-delete{ + height: 16px; + width: 13px; + + position: relative; + display: inline-block; +} \ No newline at end of file diff --git a/Mohem/src/app/profile/contact/contact.component.spec.ts b/Mohem/src/app/profile/contact/contact.component.spec.ts new file mode 100644 index 00000000..82fb3f20 --- /dev/null +++ b/Mohem/src/app/profile/contact/contact.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ConatactComponent } from './contact.component'; + +describe('ContactComponent', () => { + let component: ConatactComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ConatactComponent], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ConatactComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/profile/contact/contact.component.ts b/Mohem/src/app/profile/contact/contact.component.ts new file mode 100644 index 00000000..e137b838 --- /dev/null +++ b/Mohem/src/app/profile/contact/contact.component.ts @@ -0,0 +1,120 @@ +import { Component, OnInit } from '@angular/core'; +import { AddEitResponse } from 'src/app/eit/models/add.eit.response'; +import { EitRequest } from 'src/app/eit/models/eit.request'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { ProfileService } from '../service/profile.service'; + + +@Component({ + selector: 'app-conatact', + templateUrl: './contact.component.html', + styleUrls: ['./contact.component.scss'], +}) +export class ConatactComponent implements OnInit { + public phoneNumbers: any = []; + public objectValue: any = []; + direction: any; + selEmp: any; + respID: any; + selMenu: any; + submitrequest: any; + constructor(public cs: CommonService, public ts: TranslatorService, public profileService: ProfileService,) { + this.direction = TranslatorService.getCurrentLanguageName(); + this.selEmp = this.cs.sharedService.getSharedData( + MenuResponse.SHARED_SEL_EMP, + false + ); + this.respID = this.cs.sharedService.getSharedData( + MenuResponse.SHARED_SEL_RESP_ID, + false + ); + this.selMenu = new MenuResponse(); + this.selMenu = this.cs.sharedService.getSharedData( + MenuResponse.SHARED_DATA, + false + ); + + } + + + ngOnInit() { + this.phoneNumbers = this.cs.sharedService.getSharedData(ProfileService.EMP_PHONE, false); + this.setIsUpdated(); + this.direction = TranslatorService.getCurrentLanguageName(); + this.getObjectValue(); + } + setIsUpdated() { + this.phoneNumbers.forEach(element => { + element['ACTION'] = 'UPDATE_ROW'; + }); + } + + getObjectValue() { + this.profileService.getObjectValue({ + 'P_OBJECT_TYPE': 'LOOKUP', + 'P_OBJECT_NAME': 'PHONE_TYPE' + }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { + if (this.cs.validResponse(response)) { + console.log(response); + this.objectValue = response['GetObjectValuesList']; + } + }) + } + setIsDeletedStatus() { + this.phoneNumbers.forEach(element => { + if (element['DELETE_ROW'] == true) { + element['ACTION'] = 'DELETE_ROW'; + } + }); + } + updatePhone() { + + this.setIsDeletedStatus(); + console.log(this.phoneNumbers); + this.submitrequest = { + + P_MENU_TYPE: this.selMenu.List_Menu.MENU_TYPE, + P_SELECTED_RESP_ID: this.respID, //this.selMenu.List_Menu.RESP_ID,//-999, + P_FUNCTION_NAME: this.selMenu.GetMenuEntriesList.FUNCTION_NAME, + P_MBL_PHONES_TBL: this.phoneNumbers, + + + + }; + this.profileService.submitPhoneTransaction(this.submitrequest, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { + if (this.cs.validResponse(response)) { + console.log(response); + this.handleSubmitEitResult(response); + } + }) + //} + } + + addNewRow() { + this.phoneNumbers.push({ 'PHONE_NUMBER': '', 'PHONE_TYPE': '', 'ACTION': 'NEW_ROW', 'OBJECT_VERSION_NUMBER': null, 'PHONE_ID': null }) + } + deleteRow(row) { + row['DELETE_ROW'] = true; + // this.phoneNumbers = + // this.phoneNumbers.filter(item => item !== row); + console.log(this.phoneNumbers); + + } + handleSubmitEitResult(result) { + if (this.cs.validResponse(result)) { + this.cs.sharedService.setSharedData( + this.submitrequest, + EitRequest.SHARED_DATA + ); + this.cs.sharedService.setSharedData(result, AddEitResponse.SHARED_DATA); + this.cs.sharedService.setSharedData(true, AddEitResponse.isContact); + this.cs.sharedService.setSharedData( + { isResubmit: false }, + "confirmAddEITData" + ); + this.cs.openConfirmAddAddress(); + } + } +} diff --git a/Mohem/src/app/profile/edit-profile/edit-profile.component.html b/Mohem/src/app/profile/edit-profile/edit-profile.component.html index 86ee5a08..ff85343c 100644 --- a/Mohem/src/app/profile/edit-profile/edit-profile.component.html +++ b/Mohem/src/app/profile/edit-profile/edit-profile.component.html @@ -74,6 +74,7 @@ + diff --git a/Mohem/src/app/profile/home/home.component.html b/Mohem/src/app/profile/home/home.component.html index 96b8ea1b..cd3bbece 100644 --- a/Mohem/src/app/profile/home/home.component.html +++ b/Mohem/src/app/profile/home/home.component.html @@ -37,25 +37,32 @@

+ + +
{{ts.trPK('userProfile','note-part-1')}}
+ {{ts.trPK('userProfile','note-part-2')}}
@@ -123,10 +139,19 @@

{{personalInfo.EMPLOYMENT_CATEGORY_MEANING}}


+

{{ts.trPK('userProfile','phone-no')}}

+ +

{{personalInfo.EMPLOYEE_MOBILE_NUMBER}}

+
+ +

{{ts.trPK('userProfile','busG')}}

@@ -144,7 +169,7 @@ - +

{{ts.trPK('general','basic-details')}}

@@ -184,6 +209,42 @@
+ + + + + + +

{{ts.trPK('userProfile','phone-no')}}

+
+
+ + + + + + + +
+
+
+
+
+
+ +

{{phone.PHONE_TYPE_MEANING}}

+
+

{{phone.PHONE_NUMBER}}

+
+
+
+ +
+
+ +
+
+ @@ -235,7 +296,80 @@
+ + +
+ + + + + +

{{ts.trPK('general','dependent-title')}}

+
+
+ + + + +
+
+
+
+
+ + + +

{{data.CONTACT_NAME}}

+
+ +
+ +

{{ts.trPK('userProfile','update')}}

+
+
+
+ + +

{{data.RELATIONSHIP}}

+
+ +
+ +

{{ts.trPK('userProfile','remove')}}

+
+
+
+
+
+
- -
diff --git a/Mohem/src/app/profile/performance-evaluation/performance-evaluation.component.scss b/Mohem/src/app/profile/performance-evaluation/performance-evaluation.component.scss index c824c8a6..090524b4 100644 --- a/Mohem/src/app/profile/performance-evaluation/performance-evaluation.component.scss +++ b/Mohem/src/app/profile/performance-evaluation/performance-evaluation.component.scss @@ -74,7 +74,8 @@ margin-top: 5px; margin-bottom: 10px; text-align: center; - margin-left: 74px; + // margin-left: 74px; + width: 100%; } .Text-ar{ margin: 0; @@ -167,9 +168,9 @@ } .gauge{ - transform: translate(-24px, -65px); - margin-bottom: -187px; - margin-top: -20px; + // transform: translate(-24px, -65px); + margin-bottom: -140px; + margin-top: -70px; } .gauge-ar{ diff --git a/Mohem/src/app/profile/performance-evaluation/performance-evaluation.component.ts b/Mohem/src/app/profile/performance-evaluation/performance-evaluation.component.ts index a755c831..a3a61872 100644 --- a/Mohem/src/app/profile/performance-evaluation/performance-evaluation.component.ts +++ b/Mohem/src/app/profile/performance-evaluation/performance-evaluation.component.ts @@ -25,7 +25,9 @@ export class PerformanceEvaluationComponent implements OnInit { public length; public direction: string; // public showText:boolean =false; + public appraisalArr: any = []; + public static PERFORMANCE_DATA = 'perAppData'; constructor(public ts: TranslatorService, public cs: CommonService, public DS: DashboredService, @@ -53,21 +55,21 @@ export class PerformanceEvaluationComponent implements OnInit { this.getProfile(); - - this.performanceData = this.cs.sharedService.getSharedData( - PerformanceAppraisalResponse.PERFORMANCE_DATA, - true - ); - console.log(this.performanceData.length); - //i % 2 == 0 - this.length = this.performanceData.length; - - for (let i = 0; i < this.performanceData.length; i++) { - this.performanceData[i].color = this.colorScheme.domain[i]; - console.log(i + ' : ' + this.performanceData[i].name) - - } - console.log(this.performanceData[0].color) + this.showPerformanceAppraisal() + // this.performanceData = this.cs.sharedService.getSharedData( + // PerformanceAppraisalResponse.PERFORMANCE_DATA, + // true + // ); + // console.log(this.performanceData.length); + // //i % 2 == 0 + // this.length = this.performanceData.length; + + // for (let i = 0; i < this.performanceData.length; i++) { + // this.performanceData[i].color = this.colorScheme.domain[i]; + // console.log(i + ' : ' + this.performanceData[i].name) + + // } + // console.log(this.performanceData[0].color) } @@ -90,5 +92,30 @@ export class PerformanceEvaluationComponent implements OnInit { } }); } + public showPerformanceAppraisal() { + this.DS.getPerformanceAppraisal(() => { + this.showPerformanceAppraisal(); + }).subscribe((result: PerformanceAppraisalResponse) => { + this.handlePerformanceAppraisalResult(result); + }); + } + + private handlePerformanceAppraisalResult(result) { + if (this.cs.validResponse(result)) { + if (this.cs.hasData(result.GetPerformanceAppraisalList)) { + this.appraisalArr = result.GetPerformanceAppraisalList; + this.performanceData = []; + for (let i = 0; i < this.appraisalArr.length; i++) { + this.performanceData.push({ name: this.appraisalArr[i].APPRAISAL_YEAR, value: parseInt(this.appraisalArr[i].APPRAISAL_SCORE).toFixed() }); + } + console.log('PerformanceAppraisalResponse'); + this.cs.sharedService.setSharedData(this.performanceData, PerformanceAppraisalResponse.PERFORMANCE_DATA); + this.cs.openPerformanceevaluation(); + } else { + let msg: string = this.ts.trPK("userProfile", "no-appraisal"); + this.cs.presentAlert(msg); + } + } + } } diff --git a/Mohem/src/app/profile/profile.module.ts b/Mohem/src/app/profile/profile.module.ts index 42bd13b9..46faa498 100644 --- a/Mohem/src/app/profile/profile.module.ts +++ b/Mohem/src/app/profile/profile.module.ts @@ -23,6 +23,9 @@ import { ConfirmAddressComponent } from './confirm-address/confirm-address.compo import { SubmitAddressModalComponent } from './submit-eit-modal/submit-address-modal.component'; import { ConfirmBasicDetailsComponent } from './confirm-basic-details/confirm-basic-details.component'; +import { ConatactComponent } from './contact/contact.component'; +import { AddUpdateContactComponent } from './add-update-contact/add-update-contact.component'; +import { ConfirmContactComponent } from './confirm-contact/confirm-contact.component'; const routes: Routes = [ { path: '', @@ -44,6 +47,18 @@ const routes: Routes = [ { path: 'confirm-basic', component: ConfirmBasicDetailsComponent + }, + { + path: 'contact', + component: ConatactComponent + }, + { + path: 'add-update-contact', + component: AddUpdateContactComponent + }, + { + path: 'confirm-contact', + component: ConfirmContactComponent } ], }, @@ -112,11 +127,15 @@ const routes: Routes = [ EditProfileComponent, PerformanceEvaluationComponent, ConfirmAddressComponent, - SubmitAddressModalComponent, + AddBasicDetailsComponent, ConfirmAddressComponent, ConfirmBasicDetailsComponent, - AddBasicDetailsComponent], + ConatactComponent, + AddBasicDetailsComponent, + AddUpdateContactComponent, + ConfirmContactComponent + ], entryComponents: [EditDetailProfileComponent, SubmitAddressModalComponent], providers: [DatePicker] diff --git a/Mohem/src/app/profile/service/profile.service.ts b/Mohem/src/app/profile/service/profile.service.ts index 0feb9512..141d8e04 100644 --- a/Mohem/src/app/profile/service/profile.service.ts +++ b/Mohem/src/app/profile/service/profile.service.ts @@ -19,7 +19,9 @@ export class ProfileService { public static submitEit = 'Services/ERP.svc/REST/SUBMIT_EIT_TRANSACTION'; public static resubmitEit = 'Services/ERP.svc/REST/RESUBMIT_EIT_TRANSACTION'; public static startEitProcess = 'Services/ERP.svc/REST/START_ADDRESS_APPROVAL_PROCESS'; + public static startPhoneProcess = 'Services/ERP.svc/REST/START_PHONES_APPROVAL_PROCESS'; public static startBasicProcess = 'Services/ERP.svc/REST/START_BASIC_DET_APPR_PROCESS'; + public static contactApprovalProcess = 'Services/ERP.svc/REST/START_CONTACT_APPROVAL_PROCESS'; public static updateAttach = 'Services/ERP.svc/REST/UPDATE_ATTACHMENT'; public static deleteAttach = 'Services/ERP.svc/REST/DELETE_ATTACHMENT'; public static getApproversList = 'Services/ERP.svc/REST/GET_APPROVERS_LIST'; @@ -32,11 +34,26 @@ export class ProfileService { public static getDiffStructure = "Services/ERP.svc/REST/GET_ADDRESS_DFF_STRUCTURE"; public static submitAddressTransactions = "Services/ERP.svc/REST/SUBMIT_ADDRESS_TRANSACTION"; public static submitBasicDetailsTransaction = "Services/ERP.svc/REST/SUBMIT_BASIC_DET_TRANSACTION"; + public static submitContactTransaction = 'Services/ERP.svc/REST/SUBMIT_CONTACT_TRANSACTION' + public static getObjectValues = "Services/ERP.svc/REST/GET_OBJECT_VALUES"; + public static getPhoneNumbers = "Services/ERP.svc/REST/GET_EMPLOYEE_PHONES"; + public static submitPhoneTransaction = "Services/ERP.svc/REST/SUBMIT_PHONES_TRANSACTION"; + public static getContactInfo = 'Services/ERP.svc/REST/GET_EMPLOYEE_CONTACTS'; + public static getContactDetails = 'Services/ERP.svc/REST/GET_CONTACT_DETAILS'; + + public static getContactDiffStructure = 'Services/ERP.svc/REST/GET_CONTACT_DFF_STRUCTURE'; + public static getContactCOLStructure = 'Services/ERP.svc/REST/GET_CONTACT_COLS_STRUCTURE'; + public static ADRESS_ENTRIES = 'address-entries'; public static EMP_ADDRESS = 'emp-address'; public static COUNTRY = 'country'; public static SELECTED_STATUS = 'selected-status'; + public static EMP_PHONE = 'emp-phone'; + public static EMP_CONTACT_DETAILS = 'emp-CONTACT_DETAILS'; + public static EMP_CONTACT = 'emp-CONTACT'; + public static SELCTED_CONTACT = 'selcted-CONTACT'; + public static REMOVE_CONTACT = 'remove-CONTACT'; constructor( public con: ConnectorService, public authService: AuthenticationService @@ -117,14 +134,80 @@ export class ProfileService { this.authService.authenticateRequest(request); return this.con.post(ProfileService.submitBasicDetailsTransaction, request, onError, errorLabel); } + public submitContactTransaction(basicDetailsRequest: any, onError?: any, errorLabel?: string): Observable { + const request = basicDetailsRequest; + this.authService.authenticateRequest(request); + return this.con.post(ProfileService.submitContactTransaction, request, onError, errorLabel); + } public startEitApprovalProcess(eitProcess: any, onError?: any, errorLabel?: string): Observable { const request = eitProcess; this.authService.authenticateRequest(request); return this.con.post(ProfileService.startEitProcess, request, onError, errorLabel); } + public startPhoneApprovalProcess(eitProcess: any, onError?: any, errorLabel?: string): Observable { + const request = eitProcess; + this.authService.authenticateRequest(request); + return this.con.post(ProfileService.startPhoneProcess, request, onError, errorLabel); + } + public startBasicDetailsApprovalProcess(basicDetailsProcess: any, onError?: any, errorLabel?: string): Observable { const request = basicDetailsProcess; this.authService.authenticateRequest(request); return this.con.post(ProfileService.startBasicProcess, request, onError, errorLabel); } + + + public startContactApprovalProcess(contactRequest: any, onError?: any, errorLabel?: string): Observable { + const request = contactRequest; + this.authService.authenticateRequest(request); + return this.con.post(ProfileService.contactApprovalProcess, request, onError, errorLabel); + } + public getObjectValue(request: any, onError?: any, errorLabel?: string): Observable { + + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.P_USER_NAME; + return this.con.post(ProfileService.getObjectValues, request, onError, errorLabel); + + } + public getPhoneNumbers(request: any, onError?: any, errorLabel?: string): Observable { + + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.P_USER_NAME; + return this.con.post(ProfileService.getPhoneNumbers, request, onError, errorLabel); + + } + public submitPhoneTransaction(request: any, onError?: any, errorLabel?: string): Observable { + + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.P_USER_NAME; + return this.con.post(ProfileService.submitPhoneTransaction, request, onError, errorLabel); + + } + + public getContactInfo(request: any, onError?: any, errorLabel?: string): Observable { + + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.P_USER_NAME; + return this.con.post(ProfileService.getContactInfo, request, onError, errorLabel); + + } + + public getContactDetails(request: any, onError?: any, errorLabel?: string): Observable { + + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.P_USER_NAME; + return this.con.post(ProfileService.getContactDetails, request, onError, errorLabel); + + } + public getContactDFFStrutre(BASICDFFStrutreReq: any, onError?: any, errorLabel?: string): Observable { + const request = BASICDFFStrutreReq; + this.authService.authenticateRequest(request); + return this.con.post(ProfileService.getContactDiffStructure, request, onError, errorLabel); + } + + public getContactColumnStructure(body: any, onError?: any, errorLabel?: string): Observable { + const request = body; + this.authService.authenticateRequest(request); + return this.con.post(ProfileService.getContactCOLStructure, request, onError, errorLabel); + } } \ No newline at end of file diff --git a/Mohem/src/app/reports/concurrent-report/concurrent-report.component.html b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.html new file mode 100644 index 00000000..75fc66f0 --- /dev/null +++ b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.html @@ -0,0 +1,31 @@ + +
+ + + +
+
+
+ +
+ + {{ 'worklist,template-name' | translate}} + + + {{ program.USER_CONCURRENT_PROGRAM_NAME}} + + +
+
+
+
+ +
+ + +
+ + {{'vacation-rule, next-label' | translate}} +
+
\ No newline at end of file diff --git a/Mohem/src/app/reports/concurrent-report/concurrent-report.component.scss b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.scss new file mode 100644 index 00000000..cd9542a0 --- /dev/null +++ b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.scss @@ -0,0 +1,56 @@ +.main-container{ + padding: 10px; +} +.divider{ + height:20px +} +.check-status{ + color:rgb(0, 0, 134); + text-decoration: underline; + font-weight: 600; +} +.status{ + margin:20px; +} + + +@media screen and (min-width: 300px){ + .CreateBtn{ + --background: var(--newgreen) !important; + background: var(--newgreen) !important; + white-space: normal; + color: var(--light); + text-transform: capitalize; + min-height: 1.0cm; + --border-radius: 7px !important; + border-radius: 7px !important; + --min-height: 1.6cm !important; + width: 315px; + font-family: var(--fontFamilyPoppins-SemiBold, inherit); +}} + +@media screen and (min-width: 1px) and (max-width:290px) { +.CreateBtn{ + --background: var(--newgreen) !important; + background: var(--newgreen) !important; + white-space: normal; + color: var(--light); + text-transform: capitalize; + min-height: 1.0cm; + --border-radius: 7px !important; + border-radius: 7px !important; + --min-height: 1.6cm !important; + width: 257px; + font-family: var(--fontFamilyPoppins-SemiBold, inherit); +}} + +.footer{ + padding: 15px 0px; + background-color: var(--light) !important; + border: 0px !important; + box-shadow: none !important; + -webkit-box-shadow: none; +} +.Btn{ + margin: auto; text-align: center; display: block; +} \ No newline at end of file diff --git a/Mohem/src/app/reports/concurrent-report/concurrent-report.component.spec.ts b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.spec.ts new file mode 100644 index 00000000..102199fe --- /dev/null +++ b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ConcurrentReportComponent } from './concurrent-report.component'; + +describe('ConcurrentReportComponent', () => { + let component: ConcurrentReportComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ConcurrentReportComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ConcurrentReportComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/reports/concurrent-report/concurrent-report.component.ts b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.ts new file mode 100644 index 00000000..8fb275f0 --- /dev/null +++ b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.ts @@ -0,0 +1,1300 @@ +import { Component, ElementRef, OnInit } from '@angular/core'; +import * as moment from 'moment'; +import { EitRequest } from 'src/app/eit/models/eit.request'; +import { EIT_ACTION } from 'src/app/eit/models/submit.eit.action'; +import { EitService } from 'src/app/eit/services/eit.service'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { DateTimeInput } from 'src/app/uI-elements/date-time.input'; +import { DateInput } from 'src/app/uI-elements/date.input'; +import { HiddenInput } from 'src/app/uI-elements/hidden.input'; +import { NumberInput } from 'src/app/uI-elements/number.input'; +import { SelectInput } from 'src/app/uI-elements/select.input'; +import { TextInput } from 'src/app/uI-elements/text.input'; +import { TimeInput } from 'src/app/uI-elements/time.input'; +import { ReportServiceService } from '../report-service.service'; + +@Component({ + selector: 'app-concurrent-report', + templateUrl: './concurrent-report.component.html', + styleUrls: ['./concurrent-report.component.scss'], +}) +export class ConcurrentReportComponent implements OnInit { + public selectedMenu; + public diffStructure = []; + public isUpdate: boolean; + private eitVALSettoCall: any = []; + private textInput; + private numberInput; + private dateInput; + public direction: string; + private datetimeInput; + private timeInput; + private selectInput; + private hiddenInput; + private validateEitObj: any = []; + public menuType: any; + public respID; + public selEmp; + public eitRequest; + public ExtraObj; + + selMenu: MenuResponse; + public functionName; + + public headerTitle; + getPassdirfromNotifiPage: boolean = false; + private validEitTransactionTbl: any = []; + eitSubmitAction: number = 0; + updatedValues: any = []; + comtransNo: any = 1; + programList: any = []; + public template: any; + constructor(public cs: CommonService, private elementRef: ElementRef, public reports: ReportServiceService, public ts: TranslatorService, public eitService: EitService) { } + + ngOnInit() { + this.getPassdirfromNotifiPage = this.cs.sharedService.getSharedData('dirfromNotificationPage'); + this.selectedMenu = this.cs.sharedService.getSharedData(MenuResponse.SELECTED_MENU, false); + this.getConcurrentProgram(); + this.direction = TranslatorService.getCurrentLanguageName(); + // this.effectiveDate = new Date(); + this.functionName = this.selectedMenu.FUNCTION_NAME; + // this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; + } + getConcurrentProgram() { + this.cs.startLoading(); + this.reports.getConcurrentProgram({ + P_REQUEST_GROUP_ID: this.selectedMenu.REQUEST_GROUP_ID + }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { + this.cs.stopLoading(); + this.programList = response.GetConcurrentProgramsList; + + }) + } + getCppDiffStructure(programList) { + this.cs.startLoading(); + this.reports.getCPPDiffStructure({ + P_DESC_FLEX_NAME: programList.CONCURRENT_PROGRAM_NAME + }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { + this.cs.stopLoading(); + this.handleDiffStructure(response); + }) + } + handleDiffStructure(result) { + if (result.GetCcpDffStructureList != null) { + this.diffStructure = result.GetCcpDffStructureList; + this.drawEitFields(result.GetCcpDffStructureList); + if (this.isUpdate) { + //this.submitAbsObjList = this.cs.sharedService.getSharedData(ProfileService.EMP_ADDRESS); + //this.fillAbsStructure(); + } + } + } + private drawEitFields(feildsList) { + const containerId = "containerDiv"; + this.eitVALSettoCall = []; + for (let i = 0; i < feildsList.length; i++) { + let defaultVal = feildsList[i].E_SERVICES_DV.P_ID_COLUMN_NAME + ? feildsList[i].E_SERVICES_DV.P_ID_COLUMN_NAME + : ""; + let defaultValText = feildsList[i].E_SERVICES_DV.P_VALUE_COLUMN_NAME + ? feildsList[i].E_SERVICES_DV.P_VALUE_COLUMN_NAME + : ""; + + + if (feildsList[i].DISPLAY_FLAG != "N") { + //check if the field should be displayed + if (feildsList[i].VALIDATION_TYPE == "N") { + //text , date , time + if (feildsList[i].FORMAT_TYPE == "C") { + // character + this.textInput = new TextInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + defaultValText, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else if (feildsList[i].FORMAT_TYPE == "N") { + // number + this.numberInput = new NumberInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else if (feildsList[i].FORMAT_TYPE == "X") { + // standard date + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + //constant + this.dateInput = new DateInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + this.cs.reverseFormatDate(defaultVal), + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } else { + this.dateInput = new DateInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } + } else if (feildsList[i].FORMAT_TYPE == "Y") { + // standard date time + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + this.datetimeInput = new DateTimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + this.cs.reverseFormatStandardDate(defaultVal), + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } else { + this.datetimeInput = new DateTimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } + const elem = document.getElementById( + feildsList[i].APPLICATION_COLUMN_NAME + ); + } else if (feildsList[i].FORMAT_TYPE == "I") { + //time + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + this.timeInput = new TimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } else { + this.timeInput = new TimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } + } + } else { + if (feildsList[i].READ_ONLY == "Y") { + this.textInput = new TextInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + defaultValText, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else { + this.selectInput = new SelectInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + this.fillDropdownList( + feildsList[i].SEGMENT_NAME, + feildsList[i].E_SERVICES_VS, + feildsList[i].E_SERVICES_DV + ); + } + } + this.bindHtmlElemEvents( + feildsList[i].APPLICATION_COLUMN_NAME, + feildsList[i] + ); + } else { + this.hiddenInput = new HiddenInput( + defaultVal, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultValText, + containerId + ); + this.bindHtmlElemEvents( + feildsList[i].APPLICATION_COLUMN_NAME, + feildsList[i] + ); + } + } + if (this.validateEitObj && this.validateEitObj.length > 0) { + this.fillEITStructure(); + } + } + fillDropdownList(segmentName, optionList: any = [], DV: any = "") { + let elemID: any = ""; + let eitObj: any; + if (optionList.length > 0) { + for (let i = 0; i < this.diffStructure.length; i++) { + if (this.diffStructure[i].SEGMENT_NAME == segmentName) { + eitObj = this.diffStructure[i]; + if ( + this.diffStructure[i].READ_ONLY == "Y" || + this.diffStructure[i].DISPLAY_FLAG == "N" + ) { + return false; + } + elemID = this.diffStructure[i].APPLICATION_COLUMN_NAME; + break; + } + } + let select = document.getElementById(elemID) as HTMLSelectElement; + document.getElementById(elemID).innerHTML = ""; + if (eitObj.IsEmptyOption && eitObj.REQUIRED_FLAG == "N") { + var firstoption = document.createElement("option"); + firstoption.text = this.ts.trPK("general", "choose"); + firstoption.value = ""; + select.add(firstoption); + } + for (let i = 0; i < optionList.length; i++) { + var option = document.createElement("option"); + option.text = optionList[i].VALUE_COLUMN_NAME; + option.value = optionList[i].ID_COLUMN_NAME; + select.add(option); + } + if (select.dataset.hiddenval) { + select.value = select.dataset.hiddenval; + } else { + select.value = DV.P_ID_COLUMN_NAME; + } + select.disabled = false; + } + } + bindHtmlElemEvents(id, obj) { + const elem = document.getElementById(id); + console.log(elem); + console.log(obj); + const elemType = elem.tagName; + let changeEvent = "ionChange"; + + if (elemType == "SELECT") changeEvent = "change"; + + try { + elem.addEventListener(changeEvent, e => { + elem.classList.remove("requiredClassElm"); + if ( + obj.CHILD_SEGMENTS_VS_Splited && + obj.CHILD_SEGMENTS_VS_Splited.length > 0 + ) { + let listArray: any = obj.CHILD_SEGMENTS_VS_Splited; + listArray.forEach(element => { + this.emptyChildElement(element); + this.getValueSet(element); + }); + } + if ( + obj.CHILD_SEGMENTS_DV_Splited && + obj.CHILD_SEGMENTS_DV_Splited.length > 0 + ) { + let listArray: any = obj.CHILD_SEGMENTS_DV_Splited; + listArray.forEach(element => { + this.emptyChildElement(element); + for (let i = 0; i < this.diffStructure.length; i++) { + if (this.diffStructure[i].SEGMENT_NAME == element) { + this.getDefaultValue( + this.diffStructure[i], + this.diffStructure[i].DESC_FLEX_NAME, + this.diffStructure[i].DESC_FLEX_CONTEXT_CODE, + this.diffStructure[i].SEGMENT_NAME, + this.diffStructure[i].PARENT_SEGMENTS_VS_SplitedVS, + this.diffStructure[i].PARENT_SEGMENTS_DV_Splited + ); + } + } + }); + } + return false; + }); + } catch (e) { + console.log(e.status); + } + } + public getDefaultValue( + obj, + descFlexName, + descFlexContextCode, + segmentName, + parentValue, + ParentsList + ) { + let dependenciesList: any = []; + let parentVal: any = null; + let isStandardDate: boolean = false; + let isStandardTimeDate: boolean = false; + let isStandardTime: boolean = false; + let isHidden: boolean = false; + let isReadOnlyList: boolean = false; + let isSelectElement: boolean = false; + isStandardDate = this.isStandardDate(obj); + isStandardTimeDate = this.isStandardDateTime(obj); + isStandardTime = this.isStandardTime(obj); + if (obj.DISPLAY_FLAG == "N") isHidden = true; + if (obj.VALIDATION_TYPE != "N" && obj.READ_ONLY == "Y") { + isReadOnlyList = true; + } + if (obj.VALIDATION_TYPE != "N" && obj.READ_ONLY == "N") { + isSelectElement = true; + } + if ( + parentValue != "" && + (obj.VALIDATION_TYPE == "D" || obj.VALIDATION_TYPE == "Y") + ) { + let parvalue = this.getDependenciesParams(parentValue); + if (parvalue && parvalue[0]) parentVal = parvalue[0].ID_COLUMN_NAME; + else { + parentVal = null; + } + if (!parentVal) { + return false; + } + } + if (ParentsList != "") { + if (parentValue) ParentsList.concat(parentValue); + dependenciesList = this.getDependenciesParams(ParentsList); + if (!dependenciesList) { + return false; + } + } + + const body = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, //-999, + P_DESC_FLEX_NAME: descFlexName, + P_DESC_FLEX_CONTEXT_CODE: descFlexContextCode, + P_SEGMENT_NAME: segmentName, + P_PARENT_VALUE: parentVal, + GetValueSetValuesTBL: dependenciesList + }; + + this.eitService.getDefaultValue(body).subscribe((result: any) => { + let elem = this.getElementByName(segmentName); + let obj = this.handleDefaultValueResult(result); + let val = obj.value; + let text = obj.text; + if (val == null) { val = ""; } + if (text == null) { text = ""; } + if (isStandardDate) { + console.log("isStandardDate"); + elem.value = this.cs.reverseFormatDate(val); + } else if (isStandardTimeDate) { + console.log("isStandardTimeDate"); + if (val) { + elem.dataset.dtvalue = this.cs.reverseFormatStandardDate(val); + elem.innerHTML = this.cs.reverseFormatStandardDate(val); + } else { + elem.dataset.dtvalue = ""; + elem.innerHTML = ""; + } + } else if (isStandardTime) { + console.log("isStandardTime"); + if (val) { + elem.dataset.dtvalue = val; + elem.innerHTML = val; + elem.value = val; + } else { + elem.dataset.dtvalue = ""; + elem.innerHTML = ""; + } + } else { + if (isSelectElement) { + let elem = this.getSelectElementByName(segmentName); + elem = document.getElementById(elem), + elem.value = val; + } else { + elem.value = val; + elem.innerText = text; + elem.setAttribute("value", val); + } + } + if (isHidden || isReadOnlyList) { + if (val) elem.dataset.colmText = val; + else elem.dataset.colmText = ""; + elem.value = text; + } + var event = new Event("ionChange"); + elem.dispatchEvent(event); + }); + } + + handleDefaultValueResult(result) { + let data = { + text: result.GetDefaultValueList.P_VALUE_COLUMN_NAME, + value: result.GetDefaultValueList.P_ID_COLUMN_NAME + }; + return data; + } + getSelectElementByName(segmentName) { + let elemID: any = ""; + for (let i = 0; i < this.diffStructure.length; i++) { + if (this.diffStructure[i].SEGMENT_NAME == segmentName) { + elemID = this.diffStructure[i].APPLICATION_COLUMN_NAME; + break; + } + } + return elemID; + } + getElementByName(segmentName) { + let elemID: any = ""; + for (let i = 0; i < this.diffStructure.length; i++) { + if (this.diffStructure[i].SEGMENT_NAME == segmentName) { + elemID = this.diffStructure[i].APPLICATION_COLUMN_NAME; + break; + } + } + return document.getElementById(elemID) as HTMLInputElement; + } + + fillEITStructure() { + var obj = { peiObjVer: null, peiExtraInfoID: null }; + for (let i = 0; i < this.validateEitObj.length; i++) { + let val: any; + if (this.validateEitObj[i].VARCHAR2_VALUE) + val = this.validateEitObj[i].VARCHAR2_VALUE; + else if (this.validateEitObj[i].DATE_VALUE) + val = this.validateEitObj[i].DATE_VALUE; + else if (this.validateEitObj[i].NUMBER_VALUE) + val = this.validateEitObj[i].NUMBER_VALUE; + const elem = document.getElementById( + this.validateEitObj[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + //obj.transactionNo=this.validateEitObj[i].TRANSACTION_NUMBER; + if (elem) { + if (val) { + let feldDetails = this.diffStructure.find( + x => + x.APPLICATION_COLUMN_NAME == + this.validateEitObj[i].APPLICATION_COLUMN_NAME + ); + if (feldDetails) { + let isStandardDate = this.isStandardDateVal(feldDetails); + let isStandardDateTime = this.isStandardDateTimeVal(feldDetails); + let isStandardTime = this.isStandardTimeVal(feldDetails); + if (isStandardDate) { + elem.value = this.cs.reverseFormatDate(val); + } else if (isStandardDateTime) { + elem.innerHTML = this.cs.reverseFormatStandardDate(val); + elem.dataset.dtvalue = this.cs.reverseFormatStandardDate(val); + } else if (isStandardTime) { + elem.innerHTML = val; + elem.dataset.dtvalue = val; + } else { + elem.value = val; + elem.setAttribute("value", elem.value); + } + if ( + feldDetails.DISPLAY_FLAG == "N" || + (feldDetails.VALIDATION_TYPE != "N" && + feldDetails.READ_ONLY == "Y") + ) { + elem.dataset.colmText = val; + elem.value = this.validateEitObj[i].SEGMENT_VALUE_DSP; + elem.setAttribute("value", elem.value); + } + } + elem.dataset.hiddenval = val; //hide the value to set it after calling get value set + if ( + feldDetails.CHILD_SEGMENTS_VS_Splited && + feldDetails.CHILD_SEGMENTS_VS_Splited.length > 0 + ) { + let listArray: any = feldDetails.CHILD_SEGMENTS_VS_Splited; + listArray.forEach(element => { + this.getValueSet(element); + }); + } + // var event = new Event('change'); + // elem.dispatchEvent(event); + } + } else { + if ( + this.validateEitObj[i].APPLICATION_COLUMN_NAME == + "PEI_OBJECT_VERSION_NUMBER" + ) + obj.peiObjVer = this.validateEitObj[i].NUMBER_VALUE; + else if ( + this.validateEitObj[i].APPLICATION_COLUMN_NAME == "PEI_EXTRA_INFO_ID" + ) + obj.peiExtraInfoID = this.validateEitObj[i].NUMBER_VALUE; + } + } + this.ExtraObj = obj; + } + public getValueSet(segmentName) { + let descFlexName: any = ""; + let descFlexContextCode: any = ""; + let parentValue: any = []; + let ParentsList: any = []; + let parentVal: any = null; + let dependenciesList: any = []; + let validationType: string = ""; + + for (let i = 0; i < this.diffStructure.length; i++) { + if (this.diffStructure[i].SEGMENT_NAME == segmentName) { + descFlexName = this.diffStructure[i].DESC_FLEX_NAME; + descFlexContextCode = this.diffStructure[i].DESC_FLEX_CONTEXT_CODE; + parentValue = this.diffStructure[i].PARENT_SEGMENTS_VS_SplitedVS; + ParentsList = this.diffStructure[i].PARENT_SEGMENTS_VS_SplitedVS; + validationType = this.diffStructure[i].VALIDATION_TYPE; + break; + } + } + if (parentValue != "" && (validationType == "D" || validationType == "Y")) { + let parvalue = this.getDependenciesParams(parentValue); + if (parvalue && parvalue[0]) parentVal = parvalue[0].ID_COLUMN_NAME; + else { + parentVal = null; + } + if (!parentVal) { + return false; + } + } + if (ParentsList != "") { + dependenciesList = this.getDependenciesParams(ParentsList); + if (!dependenciesList) { + return false; + } + } + const body = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, //-999, + P_DESC_FLEX_NAME: descFlexName, + P_DESC_FLEX_CONTEXT_CODE: descFlexContextCode, + P_SEGMENT_NAME: segmentName, + P_PARENT_VALUE: parentVal, + GetValueSetValuesTBL: dependenciesList, + P_PAGE_NUM: 1, + P_PAGE_LIMIT: 1000 + }; + + this.eitService.getSetValue(body).subscribe((result: any) => { + if (result.GetValueSetValuesList != null) { + this.fillDropdownList(segmentName, result.GetValueSetValuesList); + } + }); + let arr: any = []; + return arr; + } + isStandardDateVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "X") { + + isSt = true; + + } + return isSt; + } + + emptyChildElement(segmentName) { + let elem = this.getElementByName(segmentName); + elem.value = null; + elem.innerHTML = ""; + if ("dtvalue" in elem.dataset) { + elem.dataset.dtvalue = ""; + } + if ("colmText" in elem.dataset) { + elem.dataset.colmText = ""; + } + var event = new Event("change"); + elem.dispatchEvent(event); + elem.classList.remove("requiredClassElm"); + } + getDependenciesParams(parentsList) { + let parentArr: any = []; + for (let i = 0; i < parentsList.length; i++) { + for (let j = 0; j < this.diffStructure.length; j++) { + if (this.diffStructure[j].SEGMENT_NAME == parentsList[i].Name) { + if (this.diffStructure[j].DISPLAY_FLAG != "N") { + if (this.diffStructure[j].VALIDATION_TYPE == "N") { + let idColName: string; + let val: any; + if ( + this.diffStructure[j].FORMAT_TYPE == "Y" || + this.diffStructure[j].FORMAT_TYPE == "I" + ) { + //standard date time or //time + let elem = document.getElementById( + this.diffStructure[j].APPLICATION_COLUMN_NAME + ) as HTMLDivElement; + val = elem.dataset.dtvalue; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } + idColName = val; + if (this.diffStructure[j].FORMAT_TYPE == "Y") + idColName = this.cs.formatStandardDate(val); + } else { + val = (document.getElementById( + this.diffStructure[j].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } + idColName = val; + if (this.diffStructure[j].FORMAT_TYPE == "X") { + //date + // idColName = this.cs.formatDate(val); + idColName = this.cs.formatDateNew(val); + } + } + parentArr.push({ + SEGMENT_NAME: this.diffStructure[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: val, + DESCRIPTION: "", + ID_COLUMN_NAME: idColName, + FLEX_VALUE_SET_NAME: this.diffStructure[j].FLEX_VALUE_SET_NAME + }); + break; + } else { + if (this.diffStructure[j].READ_ONLY != "Y") { + let x = document.getElementById( + this.diffStructure[j].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + let text = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].text + : ""; + let val = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].value + : undefined; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { + } + if (text == undefined) { + text = ""; + } + parentArr.push({ + SEGMENT_NAME: this.diffStructure[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.diffStructure[j].FLEX_VALUE_SET_NAME + }); + break; + } else { + let x = document.getElementById( + this.diffStructure[j].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let text = x.value; + let val = x.dataset.colmText; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { + } + if (text == undefined) { + text = ""; + } + parentArr.push({ + SEGMENT_NAME: this.diffStructure[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.diffStructure[j].FLEX_VALUE_SET_NAME + }); + break; + } + } + } else { + let x = document.getElementById( + this.diffStructure[j].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let text = x.value; + let val = x.dataset.colmText; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { + } + if (text == undefined) { + text = ""; + } + parentArr.push({ + SEGMENT_NAME: this.diffStructure[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.diffStructure[j].FLEX_VALUE_SET_NAME + }); + break; + } + } + } + } + return parentArr; + } + + isStandardTimeVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "I") { + // standard time + //if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant + isSt = true; + //} + } + return isSt; + } + isStandardDateTimeVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "Y") { + // standard date time + //if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant + isSt = true; + //} + } + return isSt; + } + + isStandardDateTime(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "Y") { + // standard date time + if ( + obj.DEFAULT_TYPE == "C" || + obj.DEFAULT_TYPE == "D" || + obj.DEFAULT_TYPE == "P" || + obj.DEFAULT_TYPE == "S" + ) { + //constant + isSt = true; + } + } + return isSt; + } + isStandardTime(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "I") { + // standard date time + if ( + obj.DEFAULT_TYPE == "C" || + obj.DEFAULT_TYPE == "D" || + obj.DEFAULT_TYPE == "P" || + obj.DEFAULT_TYPE == "S" + ) { + //constant + isSt = true; + } + } + return isSt; + } + + isStandardDate(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "X") { + // standard date + if ( + obj.DEFAULT_TYPE == "C" || + obj.DEFAULT_TYPE == "D" || + obj.DEFAULT_TYPE == "P" || + obj.DEFAULT_TYPE == "S" + ) { + //constant + isSt = true; + } + } + return isSt; + } + + fixTransactionNo(): any[] { + const list: any = []; + let newIndex = 1; + const length: number = this.validEitTransactionTbl.length; + for (let i = 0; i < length; i++) { + // let item :any={}; + const item = Object.assign({}, this.validEitTransactionTbl[i]); + const transNo: number = item.TRANSACTION_NUMBER; + const obj: any = item; + if (i == 0) { + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } else { + const prevEl: any = this.validEitTransactionTbl[i - 1].TRANSACTION_NUMBER; + if (transNo == prevEl) { + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } else { + newIndex++; + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } + } + } + return list; + } + removeItems(transNo) { + const list = []; + for (let i = 0; i < this.validEitTransactionTbl.length; i++) { + if (this.validEitTransactionTbl[i].TRANSACTION_NUMBER != transNo) { + list.push(this.validEitTransactionTbl[i]); + } + } + this.validEitTransactionTbl = list; + } + submitTransaction() { + // (this.elementRef.nativeElement.querySelectorAll( + // "ion-item" + // ) as HTMLElement[]).forEach(x => { + // x.classList.add("ng-touched"); + // x.classList.remove("ng-untouched"); + // }); + + // let arrValues = this.getElementsValues(); + + // if (arrValues) { + // if (!this.startDate || !this.endDate) { + // //this.common.showRequiredMsg(); + // return false; + // } + // let Sdata = moment(this.startDate).format("MM/DD/YYYY"); + // let Edata = moment(this.endDate).format("MM/DD/YYYY"); + + this.eitRequest = new EitRequest(); + const list: any = this.getElementsValues(); + this.eitRequest.EITTransactionTBL = list; + this.eitRequest.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; + this.eitRequest.P_MENU_TYPE = this.selectedMenu.MENU_TYPE; + this.eitRequest.P_SELECTED_RESP_ID = -999;// this.selectedMenu.RESP_ID; // this.selMenu.List_Menu.RESP_ID,//-999, + this.eitRequest.P_FUNCTION_NAME = this.functionName; + this.eitRequest.P_DESC_FLEX_NAME = this.template.CONCURRENT_PROGRAM_NAME; + // this.reportSubmitRequest = {} + this.cs.startLoading(); + this.reports + .submitTransaction(this.eitRequest, {}, this.ts.trPK('general', 'retry')) + .subscribe((result: any) => { + + this.handleSubmit(result); + }); + } + + + + private handleSubmit(result) { + + if (this.cs.validResponse(result)) { + //call another API to check the response; + this.checkStatus(result); + + + } + } + checkStatus(result) { + var request: any = {}; + request.P_USER_NAME = this.selEmp; + request.P_MENU_TYPE = this.selectedMenu.MENU_TYPE; + request.P_SELECTED_RESP_ID = -999; + request.P_FUNCTION_NAME = this.functionName; + request.P_DESC_FLEX_NAME = this.template.CONCURRENT_PROGRAM_NAME; + + this.reports.getTransaction(this.eitRequest, {}, this.ts.trPK('general', 'retry')).subscribe((result: any) => { + this.cs.stopLoading(); + this.cs.sharedService.setSharedData(result['GetCcpTransactionsList_New'], ReportServiceService.TRANSACTION_LIST); + this.cs.sharedService.setSharedData(this.template, ReportServiceService.TEMPLATE); + this.cs.openConcurrentTransaction(); + }); + } + public getElementsValues(): any { + this.updatedValues = []; //fill updated list + let valuseArr: any = []; + let varcharValue: any = null; + let numbervalue: any = 0; + let dateValue: any = null; + let transNo: number = this.comtransNo; + let textValue: any; + // if(this.ExtraObj.transactionNo) + // transNo=this.ExtraObj.transactionNo; + for (let i = 0; i < this.diffStructure.length; i++) { + varcharValue = null; + numbervalue = null; + dateValue = null; + /*********set transaction No of the updated object ********/ + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.diffStructure[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + } + if (this.diffStructure[i].DISPLAY_FLAG != "N") { + if (this.diffStructure[i].VALIDATION_TYPE == "N") { + let elem = document.getElementById( + this.diffStructure[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let elemVal = (document.getElementById( + this.diffStructure[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + textValue = elemVal; + //let elemVal= (document.getElementById(this.eitResponse[i].APPLICATION_COLUMN_NAME)).value; + if ( + this.diffStructure[i].FORMAT_TYPE == "X" && + this.diffStructure[i].DISPLAY_FLAG != "N" + ) { + //date + elemVal = this.cs.formatDate(elemVal); + } else if ( + this.diffStructure[i].FORMAT_TYPE == "Y" && + this.diffStructure[i].DISPLAY_FLAG != "N" + ) { + //standard date time + // elemVal = elem.dataset.dtvalue; + // elemVal = this.cs.formatStandardDate(elemVal); + elemVal = this.cs.formatDate(elemVal); + } else if ( + this.diffStructure[i].FORMAT_TYPE == "I" && + this.diffStructure[i].DISPLAY_FLAG != "N" + ) { + //time + if (elemVal.length > 5) { + elemVal = elemVal.substring(11, 16); + } else { + elemVal = elemVal; + } + } + if (this.diffStructure[i].REQUIRED_FLAG == "Y" && !elemVal) { + elem.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + elem.classList.remove("requiredClassElm"); + } + // if (elemVal != 'null'){ + varcharValue = elemVal; + //} else{ + // elemVal = null; + // } + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.diffStructure[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } else { + let x = document.getElementById( + this.diffStructure[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + if (this.diffStructure[i].READ_ONLY == "Y") { + let text = x.value; + let val = x.dataset.colmText; + varcharValue = val; + textValue = text; + } else { + let val = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].value + : null; + let txt = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].text + : null; + varcharValue = val; + textValue = txt; + } + if (this.diffStructure[i].REQUIRED_FLAG == "Y" && !varcharValue) { + x.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.diffStructure[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } //end else + } else { + let x = document.getElementById( + this.diffStructure[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + let val = x.dataset.colmText; + textValue = x.value; + if (this.diffStructure[i].REQUIRED_FLAG == "Y" && !val) { + x.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + if (val) varcharValue = val; + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.diffStructure[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } + + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.diffStructure[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + if (this.validateEitObj && this.eitSubmitAction == EIT_ACTION.UPDATE) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.diffStructure[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + let y = { + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue, + SEGMENT_VALUE_DSP: textValue, + APPLICATION_COLUMN_NAME: this.diffStructure[i] + .APPLICATION_COLUMN_NAME, + DATATYPE: this.diffStructure[i].DATATYPE, + DESC_FLEX_CONTEXT_CODE: this.diffStructure[i].DESC_FLEX_CONTEXT_CODE, + DESC_FLEX_NAME: this.diffStructure[i].DESC_FLEX_NAME, + DISPLAY_FLAG: this.diffStructure[i].DISPLAY_FLAG, + SEGMENT_NAME: this.diffStructure[i].SEGMENT_NAME, + SEGMENT_PROMPT: this.diffStructure[i].SEGMENT_PROMPT + }; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } + } + } // end for + + if (this.getPassdirfromNotifiPage) { + let updatedObj1 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_ACTION" + ); + let updatedObj2 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_EXTRA_INFO_ID" + ); + let updatedObj3 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_OBJECT_VERSION_NUMBER" + ); + this.updatedValues.push(updatedObj1); + this.updatedValues.push(updatedObj2); + this.updatedValues.push(updatedObj3); + valuseArr = this.fillExtraInformation( + valuseArr, + updatedObj1.VARCHAR2_VALUE, + updatedObj2.NUMBER_VALUE, + updatedObj3.NUMBER_VALUE, + transNo + ); + } else { + if (this.eitSubmitAction == EIT_ACTION.ADD) { + this.updatedValues = this.fillExtraValuesUpdated( + this.updatedValues, + "NEW_ROW", + -1, + 0, + transNo + ); + valuseArr = this.fillExtraInformation( + valuseArr, + "NEW_ROW", + -1, + 0, + transNo + ); + } else if (this.eitSubmitAction == EIT_ACTION.UPDATE) { + valuseArr = this.fillExtraInformation( + valuseArr, + "UPDATE_ROW", + this.ExtraObj.peiExtraInfoID, + this.ExtraObj.peiObjVer, + transNo + ); + } else if (this.eitSubmitAction == EIT_ACTION.DELETE) { + valuseArr = this.fillExtraInformation( + valuseArr, + "DELETE_ROW", + this.ExtraObj.peiExtraInfoID, + this.ExtraObj.peiObjVer, + transNo + ); + } + } + return valuseArr; + } // end getElementsValues + fillExtraInformation( + values: any, + peiAction: string, + peiExtraInfoID: number, + peiObjVer: number, + transNo: number + ): any { + values.push({ + TRANSACTION_NUMBER: transNo, + NAME: "PEI_ACTION", + VARCHAR2_VALUE: peiAction, + NUMBER_VALUE: null, + DATE_VALUE: null + }); + values.push({ + TRANSACTION_NUMBER: transNo, + NAME: "PEI_EXTRA_INFO_ID", + VARCHAR2_VALUE: null, + NUMBER_VALUE: peiExtraInfoID, + DATE_VALUE: null + }); + values.push({ + TRANSACTION_NUMBER: transNo, + NAME: "PEI_OBJECT_VERSION_NUMBER", + VARCHAR2_VALUE: null, + NUMBER_VALUE: peiObjVer, + DATE_VALUE: null + }); + return values; + } + fillExtraValuesUpdated( + values: any, + peiAction: string, + peiExtraInfoID: number, + peiObjVer: number, + transNo: number + ): any { + let obj1 = { + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: peiAction, + NUMBER_VALUE: null, + DATE_VALUE: null, + SEGMENT_VALUE_DSP: "", + APPLICATION_COLUMN_NAME: "PEI_ACTION", + DATATYPE: "VARCHAR2", + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + SEGMENT_NAME: "", + SEGMENT_PROMPT: "" + }; + let obj2 = { + TRANSACTION_NUMBER: 1, + APPLICATION_COLUMN_NAME: "PEI_OBJECT_VERSION_NUMBER", + VARCHAR2_VALUE: null, + NUMBER_VALUE: peiObjVer, + DATATYPE: "NUMBER", + SEGMENT_VALUE_DSP: "", + DATE_VALUE: null, + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + SEGMENT_NAME: "", + SEGMENT_PROMPT: "" + }; + let obj3 = { + APPLICATION_COLUMN_NAME: "PEI_EXTRA_INFO_ID", + DATATYPE: "NUMBER", + DATE_VALUE: null, + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + NUMBER_VALUE: peiExtraInfoID, + SEGMENT_NAME: "", + SEGMENT_PROMPT: "", + SEGMENT_VALUE_DSP: "", + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: null + }; + values.push(obj1); + values.push(obj2); + values.push(obj3); + return values; + } + selectTemplates() { + this.elementRef + .nativeElement.querySelectorAll('#containerDiv')[0].innerHTML = ''; + this.getCppDiffStructure(this.template); + } + refreshStatus() { + + } +} diff --git a/Mohem/src/app/reports/report-service.service.spec.ts b/Mohem/src/app/reports/report-service.service.spec.ts new file mode 100644 index 00000000..dbf6efe5 --- /dev/null +++ b/Mohem/src/app/reports/report-service.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { ReportServiceService } from './report-service.service'; + +describe('ReportServiceService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: ReportServiceService = TestBed.get(ReportServiceService); + expect(service).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/reports/report-service.service.ts b/Mohem/src/app/reports/report-service.service.ts new file mode 100644 index 00000000..9196cb2c --- /dev/null +++ b/Mohem/src/app/reports/report-service.service.ts @@ -0,0 +1,76 @@ +import { Injectable } from '@angular/core'; +import { AuthenticationService } from '../hmg-common/services/authentication/authentication.service'; +import { CommonService } from '../hmg-common/services/common/common.service'; +import { ConnectorService } from '../hmg-common/services/connector/connector.service'; + +@Injectable({ + providedIn: 'root' +}) +export class ReportServiceService { + public static GET_CONCURRENT_PROGRAM = 'Services/ERP.svc/REST/GET_CONCURRENT_PROGRAMS'; + public static GET_CPP_DIFF_STRUCTURE = 'Services/ERP.svc/REST/GET_CCP_DFF_STRUCTURE'; + public static SUBMIT_CPP_REQUEST = 'Services/ERP.svc/REST/SUBMIT_CCP_TRANSACTION'; + public static SUBMIT_CPP_TRANSACTION = 'Services/ERP.svc/REST/GET_CCP_TRANSACTIONS'; + public static GET_CCP_OUTPUT = 'Services/ERP.svc/REST/GET_CCP_OUTPUT'; + + public static TRANSACTION_LIST = 'transaction-list'; + public static TEMPLATE = 'template'; + constructor( + public con: ConnectorService, + private authService: AuthenticationService, + public cs: CommonService + ) { } + + getConcurrentProgram(request, onError, errorLabel) { + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.postNoLoad( + ReportServiceService.GET_CONCURRENT_PROGRAM, + request, + onError, + errorLabel + ); + } + getCPPDiffStructure(request, onError, errorLabel) { + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.postNoLoad( + ReportServiceService.GET_CPP_DIFF_STRUCTURE, + request, + onError, + errorLabel + ); + } + submitTransaction(request, onError, errorLabel) { + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.postNoLoad( + ReportServiceService.SUBMIT_CPP_REQUEST, + request, + onError, + errorLabel + ); + } + getTransaction(request, onError, errorLabel) { + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.postNoLoad( + ReportServiceService.SUBMIT_CPP_TRANSACTION, + request, + onError, + errorLabel + ); + } + + getCppOutput(request, onError, errorLabel) { + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.postNoLoad( + ReportServiceService.GET_CCP_OUTPUT, + request, + onError, + errorLabel + ); + } + +} diff --git a/Mohem/src/app/reports/reports.module.ts b/Mohem/src/app/reports/reports.module.ts new file mode 100644 index 00000000..0fc1953d --- /dev/null +++ b/Mohem/src/app/reports/reports.module.ts @@ -0,0 +1,43 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { Routes, RouterModule } from '@angular/router'; + +import { IonicModule } from '@ionic/angular'; + +import { ReportsPage } from './reports.page'; +import { ConcurrentReportComponent } from './concurrent-report/concurrent-report.component'; +import { ReportServiceService } from './report-service.service'; +import { HmgCommonModule } from '../hmg-common/hmg-common.module'; +import { TransactionListComponent } from './transaction-list/transaction-list.component'; + + +const routes: Routes = [ + { + path: '', + component: ReportsPage, + children: [ + { + path: 'concurrent-report', + component: ConcurrentReportComponent + }, + { + path: 'transaction-list', + component: TransactionListComponent + }, + ], + } +]; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + RouterModule.forChild(routes), + HmgCommonModule + ], + declarations: [ReportsPage, ConcurrentReportComponent, TransactionListComponent], + providers: [ReportServiceService] +}) +export class ReportsPageModule { } diff --git a/Mohem/src/app/reports/reports.page.html b/Mohem/src/app/reports/reports.page.html new file mode 100644 index 00000000..67cbe279 --- /dev/null +++ b/Mohem/src/app/reports/reports.page.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Mohem/src/app/reports/reports.page.scss b/Mohem/src/app/reports/reports.page.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/reports/reports.page.spec.ts b/Mohem/src/app/reports/reports.page.spec.ts new file mode 100644 index 00000000..94e66db4 --- /dev/null +++ b/Mohem/src/app/reports/reports.page.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ReportsPage } from './reports.page'; + +describe('ReportsPage', () => { + let component: ReportsPage; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ReportsPage ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ReportsPage); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/reports/reports.page.ts b/Mohem/src/app/reports/reports.page.ts new file mode 100644 index 00000000..13faa7bd --- /dev/null +++ b/Mohem/src/app/reports/reports.page.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-reports', + templateUrl: './reports.page.html', + styleUrls: ['./reports.page.scss'], +}) +export class ReportsPage implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/Mohem/src/app/reports/transaction-list/transaction-list.component.html b/Mohem/src/app/reports/transaction-list/transaction-list.component.html new file mode 100644 index 00000000..cfffd088 --- /dev/null +++ b/Mohem/src/app/reports/transaction-list/transaction-list.component.html @@ -0,0 +1,48 @@ + +
+ + + +
+
+
+ +
+ +
+ +
{{getDate(transaction.REQUEST_DATE)}}
+ + +
+

{{'transaction, request-id' | translate}}

+

+ {{transaction.REQUEST_ID}} +

+
+

{{'transaction, phase' | translate}}

+

{{transaction.CCP_PHASE}}

+
+ + +
+

{{'transaction,program-name' | translate}}

+

{{transaction.CONCURRENT_PROGRAM_NAME}}

+
+
+ + +
+

{{'transaction,output' | translate}}

+

+

+
+ +
+
+ +
+ +
+ +
diff --git a/Mohem/src/app/reports/transaction-list/transaction-list.component.scss b/Mohem/src/app/reports/transaction-list/transaction-list.component.scss new file mode 100644 index 00000000..8e18b14f --- /dev/null +++ b/Mohem/src/app/reports/transaction-list/transaction-list.component.scss @@ -0,0 +1,146 @@ +.display-created{ + display: inline-block; + margin:2px; + color:#000; +} +#containerDiv{ + margin-top:20px; +} +.padding{ + padding-left:5px; + padding-right: 5px; +} +.bold{ + font-weight: bold; + font-size: 16px; +} +.color-black{ + color:#000; +} +.date{ + position: absolute; + font-size: 14px; + padding: 10px; + right:0; + width: 100px; + color:#969696; +} +.date_ar{ + position: absolute; + font-size: 14px; + padding: 10px; + left:0; + width: 100px; + color:#969696; +} +.transaction-list{ + margin-top:20px; +} +.date-container{ + margin:0px 20px; +} + +.label{ + font-size: 16px; + // margin-left: 15px; + color: #a2a5a6 !important; + display: block; + overflow: hidden; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + /* font-size: inherit; */ + // text-overflow: ellipsis; + // white-space: nowrap; + white-space: normal; + // padding-top: 10px; + padding: 5px 0px; + padding-left: 10px !important; + margin: 10px auto; + :root[dir="ltr"]{ + font-family: var(--fontFamilySemiBoldEN) !important; + } + :root[dir="rtl"]{ + font-family: var(--fontFamilyIOSAR) !important; + font-weight: bold; + } + + +} + +.Field-en{ + border-radius: 30px; + border: 1px solid #a2a5a6!important; + margin-bottom: 15px; + padding-left: 20px !important; + padding-top: 6px !important; + color: #999999 !important; +} + +.Field-ar{ + border-radius: 30px; + border: 1px solid #a2a5a6!important; + margin-bottom: 20px; + padding-right: 20px !important; + padding-top: 6px !important; + color: #999999 !important; +} +select{ + width: 300px !important; + border: none !important; +} +.padding_date{ + padding-left:5px !important; +} +.date-icon{ + font-size: 20px; + left: -1px; + position: relative; + top: 2px; +} +ion-card{ + padding:10px; + border-radius: 11px; + box-shadow: 0px 1px 2px 1px #ccc; +} +.display-inline{ + display:inline-block; + +} +.red{ +color:#CA3332; +font-weight: 600; +margin:0px 5px; +overflow: hidden; + width: 90%; + white-space: nowrap; + text-overflow: ellipsis; +} +.inline-display{ + display: inline-block; + font-weight: 600; + padding-left:8px; +} +.download{ + font-size: 26px; + margin: 0px 10px; + position: relative; + top: 5px; + color: #CA3332; +} +.refresh{ + font-size: 22px; + margin: 0px 10px; + position: relative; + top: 5px; + color: #CA3332; +} +.disabled-icon{ + pointer-events: none; + opacity: .5; +} +.output-container{ + position: relative; + bottom: 10px; +} \ No newline at end of file diff --git a/Mohem/src/app/reports/transaction-list/transaction-list.component.spec.ts b/Mohem/src/app/reports/transaction-list/transaction-list.component.spec.ts new file mode 100644 index 00000000..9a3a75e7 --- /dev/null +++ b/Mohem/src/app/reports/transaction-list/transaction-list.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TransactionListComponent } from './transaction-list.component'; + +describe('TransactionListComponent', () => { + let component: TransactionListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TransactionListComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TransactionListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/reports/transaction-list/transaction-list.component.ts b/Mohem/src/app/reports/transaction-list/transaction-list.component.ts new file mode 100644 index 00000000..53449f9d --- /dev/null +++ b/Mohem/src/app/reports/transaction-list/transaction-list.component.ts @@ -0,0 +1,103 @@ +import { Component, ElementRef, OnInit } from '@angular/core'; +import { File } from '@ionic-native/file/ngx'; +import { Platform } from '@ionic/angular'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { ReportServiceService } from '../report-service.service'; +import { FileOpener } from '@ionic-native/file-opener/ngx'; +@Component({ + selector: 'app-transaction-list', + templateUrl: './transaction-list.component.html', + styleUrls: ['./transaction-list.component.scss'], +}) +export class TransactionListComponent implements OnInit { + transactionList: any = []; + selectedMenu: any; + template: any; + direction: any; + constructor(public cs: CommonService, private elementRef: ElementRef, public reports: ReportServiceService, public ts: TranslatorService, private platform: Platform, private file: File, private opener: FileOpener, + ) { } + + ngOnInit() { + this.selectedMenu = this.cs.sharedService.getSharedData(MenuResponse.SELECTED_MENU, false); + this.transactionList = this.cs.sharedService.getSharedData(ReportServiceService.TRANSACTION_LIST, false); + this.template = this.cs.sharedService.getSharedData(ReportServiceService.TEMPLATE, false); + this.direction = TranslatorService.getCurrentDirection(); + } + getDate(date) { + return this.cs.evaluteDate(date); + } + getCppOutput(transaction) { + var request: any = { + P_REQUEST_ID: transaction['REQUEST_ID'] + }; + this.cs.startLoading(); + this.reports.getCppOutput(request, {}, this.ts.trPK('general', 'retry')).subscribe((result: any) => { + this.saveAndOpenPdf(result.GetCcpOutputList['P_OUTPUT_FILE'], 'report.pdf'); + + console.log(result); + this.cs.stopLoading(); + + }); + } + // saveAndOpenPdf(pdf: string, filename: string) { + + // const linkSource = `data:application/pdf;base64,${pdf}`; + // const downloadLink = document.createElement("a"); + // const fileName = "report.pdf"; + // downloadLink.href = linkSource; + // downloadLink.download = fileName; + // downloadLink.click(); + + // } + + saveAndOpenPdf(pdf: string, filename: string) { + const writeDirectory = this.platform.is('ios') ? this.file.dataDirectory : this.file.externalDataDirectory; + this.file.writeFile(writeDirectory, filename, this.convertBase64ToBlob(pdf, 'data:application/pdf;base64'), { replace: true }) + .then(() => { + this.opener.open(writeDirectory + filename, 'application/pdf') + .catch(() => { + console.log('Error opening pdf file'); + }); + }) + .catch(() => { + console.error('Error writing pdf file'); + }); + } + + convertBase64ToBlob(b64Data, contentType): Blob { + contentType = contentType || ''; + const sliceSize = 512; + b64Data = b64Data.replace(/^[^,]+,/, ''); + b64Data = b64Data.replace(/\s/g, ''); + const byteCharacters = window.atob(b64Data); + const byteArrays = []; + for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) { + const slice = byteCharacters.slice(offset, offset + sliceSize); + const byteNumbers = new Array(slice.length); + for (let i = 0; i < slice.length; i++) { + byteNumbers[i] = slice.charCodeAt(i); + } + const byteArray = new Uint8Array(byteNumbers); + byteArrays.push(byteArray); + } + return new Blob(byteArrays, { type: contentType }); + } + refresh(transaction) { + var request: any = { + P_REQUEST_ID: transaction['REQUEST_ID'] + }; + this.cs.startLoading(); + var request: any = {}; + request.P_MENU_TYPE = this.selectedMenu.MENU_TYPE; + request.P_SELECTED_RESP_ID = -999; + request.P_FUNCTION_NAME = this.selectedMenu.FUNCTION_NAME; + request.P_DESC_FLEX_NAME = this.template.CONCURRENT_PROGRAM_NAME; + + this.reports.getTransaction(request, {}, this.ts.trPK('general', 'retry')).subscribe((result: any) => { + this.cs.stopLoading(); + this.transactionList = result['GetCcpTransactionsList_New']; + }); + } +} diff --git a/Mohem/src/app/termination/confirm-termination/confirm-termination.component.html b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.html new file mode 100644 index 00000000..d7e4b690 --- /dev/null +++ b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.html @@ -0,0 +1,123 @@ + + + + + + + + +
{{'general, addAttach' | translate}}
+
+ +
+ +
+
+
+ + + {{ 'general, notAttch' | translate}} + +
+ + +
+ + + + {{attachList.AttachmentID +1 }} . + + + + + {{attachList.P_FILE_NAME }} + + + + + + + +
+ +
+ +
+ + +
+
+ + {{attachRes.FILE_NAME }} + +
+ + + + +
+
+ +
+ + + +
{{'confirmAddEit, comment' | translate}}
+ + + +
+ + +
{{'confirmAddEit, approverList' | translate}}
+
+

{{ 'general, empty' | translate}}

+
+
+ +
+ + +
+
+ +
+
+ + + {{employee.APPROVER}} + + + {{employee.POSITION_TITLE}} + + + +
+
+
+
+
+ +
+ + +
+ + +
+ + {{ 'general, submit' | translate }} +
+
\ No newline at end of file diff --git a/Mohem/src/app/termination/confirm-termination/confirm-termination.component.scss b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.scss new file mode 100644 index 00000000..2ed98379 --- /dev/null +++ b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.scss @@ -0,0 +1,263 @@ +.footer-button { + border-radius: 2px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; + } + + .imgSize { + width: 22px; + height: 22px; + } + + .Header { + font-weight: bold; + color: #1a586d !important; + font-size: 10px; + } + + .tbData { + font-size: 10px; + } + + .btnBack { + background: transparent; + float: right; + } + + .attachmentDiv{ + background: #ffffff; + height: auto; + text-align: center; + padding-top: 1px; + margin: 10px; + border-radius: 15px; + border: 1px solid grey; + } + + .noDataDiv{ + background: #ffffff; + height: 11%; + text-align: center; + padding-top: 1px; + border-radius: 10px; + margin: 10px; + border-radius: 5px; + } + .submitNote{ + background: #ffffff; + height: 80px; + padding-top: 1px; + margin: 10px; + border-radius: 15px; + border: 1px solid grey; + } + + .approvalList{ + --background: #f0efef; + height: auto; + text-align: center; + padding-top: 1px; + border-radius: 10px; + margin: 10px; + border-radius: 5px; + } + + /************************New Design**********************************/ + .notification-list{ + background: none; + background: none; + border-radius: 32px; + ion-item{ + // margin-top: 5px; + // margin-bottom: 5px; + + background-color: transparent; + .item-date{ + width: 100%; + font-size: 16px; + font-weight: bold; + + text-align: start; + padding: 0; + margin: 0; + + position: absolute; + left: 0; + top: 12%; + } + ion-label , [item-end]{ + + white-space: normal; + font-size: 14px; + padding-top: 15%; + // :root[dir="ltr"]{ + // margin-left: 10px; + // } + // :root[dir="rtl"]{ + // margin-right: 10px; + // } + + } + + } + } + + + + + + + .timeline { + position: relative; + margin: 15px 0 0 0; + // border-bottom: solid 1px var(--cusgray); + } + + .timeline:before { + + content: ''; + position: inherit !important; + top: 0; + bottom: 0; + width: 4px; + // background: #e4e4e4; + z-index: 1; + left: 35px; + /* margin-left: -10px; */ + /* z-index: 1; */ + } + + .timeline .timeline-thumb { + + border-radius: 500px; + width: 70px !important; + z-index: 2; + position: absolute; + left: 0px; + // :root[dir="ltr"]{ + // left: 37px; + // } + // :root[dir="rtl"]{ + // right: 37px; + // } + float: right; + top: 9px; + } + + .timeline .timeline-thumb.timeline-icon { + height: 70px; + // text-align: center; + // color: white; + // border: 5px solid #CBD0D3; + // transform: scale(0.2); + } + + + + .timeline .timeline-item { + width: 40px; + + } + + .timeline .timeline-stats { + position: relative; + font-size: 12px; + color: var(--darkgray); + + } + + .empImge{ + border-radius: 50%; + width:100%; + height: 100%; + border: #dedede solid 1px; + + } + .empImgeRep { + border-radius: 50% !important; + width: 80px; + height: 80px; + border: #dedede solid 1px; + } + + .line{ + padding-bottom:87px; + } + + .attachLable{ + position: absolute; + top: 0px; + z-index: 0; + background: #30b8c6; + color: #fff; + border-radius: 50%; + border: 0px; + width: 24px; + height: 24px; + text-align: center; + font-size: 5px; + } + + .removeLable{ + top: 0px; + z-index: 0; + background: #d8252d; + color: #fff; + border-radius: 50%; + border: 0px; + width: 20px; + height: 20px; + text-align: center; + font-size: 5px; + } + + .note-modal { + // width: 90%; + // height: 50%; + // top: 20%; + // left: 5%; + // right: 5%; + // bottom: 5%; + background: rgba(0, 0, 0, 0.5) !important; + padding: 30% 10% !important; + --height: 12cm !important; + // --width: 80% !important; + --border-radius:20px; + + } + .header-toolbar-new{ + --background: #269DB8; + } + .title{ + margin-top: -37px; + margin-left: 85px; + } + .title-ar{ + margin-top: -37px; + margin-right: 101px; + } + .confirmEitOkButton{ + white-space: normal !important; + text-transform: capitalize !important; + min-height: 45px !important; + min-width: 5px !important; + margin: 8px !important; + background-color: #269DB8; + width: 80% !important; + color: white!important; + border-radius: 16px !important; + } + + .approvalTitle-ar{ + font-weight: bold; + font-size: 16px; + text-align: right; + + } + .approvalTitle{ + font-weight: bold; + font-size: 16px; + text-align: left; + } + \ No newline at end of file diff --git a/Mohem/src/app/termination/confirm-termination/confirm-termination.component.spec.ts b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.spec.ts new file mode 100644 index 00000000..c9818fc1 --- /dev/null +++ b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ConfirmTerminationComponent } from './confirm-termination.component'; + +describe('ConfirmTerminationComponent', () => { + let component: ConfirmTerminationComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ConfirmTerminationComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ConfirmTerminationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/termination/confirm-termination/confirm-termination.component.ts b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.ts new file mode 100644 index 00000000..c0de3bb0 --- /dev/null +++ b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.ts @@ -0,0 +1,433 @@ +import { Component, OnInit } from '@angular/core'; +import { ModalController } from '@ionic/angular'; +import { FileUploader } from 'ng2-file-upload'; +import { AddAttachComponent } from 'src/app/eit/add-attach/add-attach.component'; +import { NotificationGetAttachResponse } from 'src/app/eit/models/NotificationGetAttachRes'; +import { EitService } from 'src/app/eit/services/eit.service'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { HomeComponent } from 'src/app/notification/home/home.component'; +import { WorkListButtonRequest } from 'src/app/notification/models/NotificationButtonReq'; +import { WorkListAttachViewComponent } from 'src/app/notification/work-list-attach-view/work-list-attach-view.component'; +import { BasicRequest } from 'src/app/profile/models/basic.request'; +import { SubmitAddressModalComponent } from 'src/app/profile/submit-eit-modal/submit-address-modal.component'; +import { TerminationServiceService } from '../service/termination-service.service'; + +@Component({ + selector: 'app-confirm-termination', + templateUrl: './confirm-termination.component.html', + styleUrls: ['./confirm-termination.component.scss'], +}) +export class ConfirmTerminationComponent implements OnInit { + + + private P_TransactionID: number; + + approversList = []; + responseList: any; + eitComments: string = ""; + menuType: string = ""; + selEmp: string = ""; + respID: number; + selMenu: MenuResponse; + getAttachList: any; + attachListDisplay: any = []; + headerTitle: string = ""; + isTrue: any = 0; + attachItems: any; + public isResubmitEIT: boolean = false; + private itemKey: string = ""; + private pActionMode: string = "SUBMIT"; + attachReqObj: WorkListButtonRequest = new WorkListButtonRequest(); + attachmentRes: any; + objIndex1: any; + attachListOver: any = []; + index: any = 0; + getPassNotificationDetails: any; + isSubmitBtnClicked: boolean; + // isDelete: boolean = false; + + /***Add Attchment Vars */ + isUpload: boolean = false; + inQueue: boolean = false; + addAttachmentListReq: any; + attachmentID: number = 0; + addAttachRequest: any = []; + fileData: any; + fileType: any; + dirPage: any; + TransactionID: any; + indexLastObj: any = 0; + filterAllowedType: any = ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']; + direction: string; + + + constructor(public modalController: ModalController, public cs: CommonService, private ts: TranslatorService, private eitService: EitService, public terminationService: TerminationServiceService) { + this.direction = TranslatorService.getCurrentLanguageName() + this.isSubmitBtnClicked = false; + + } + + ngOnInit() { + this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); + this.selEmp = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_EMP, false); + this.respID = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_RESP_ID, false); + + + this.menuType = this.selMenu.List_Menu.MENU_TYPE; + this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; + this.responseList = this.cs.sharedService.getSharedData(TerminationServiceService.SHARED_DATA, false); + this.itemKey = this.responseList.P_ITEM_KEY; + this.P_TransactionID = this.responseList.P_TRANSACTION_ID; + // this.isDelete = this.isResubmitEIT = this.cs.sharedService.getSharedData('confirmAddEITData', false).isDelete; + + this.getApproversList(); + + } + + getApproversList() { + let body: any = { + P_TRANSACTION_ID: this.P_TransactionID, + P_AME_TRANSACTION_TYPE: "SSHRMS", + P_PAGE_NUM: 1, + P_PAGE_LIMIT: 1000 + } + this.eitService.getApproversList(body).subscribe((result: any) => { + this.handleApproversResult(result); + }); + } + + handleApproversResult(result) { + if (this.cs.validResponse(result)) { + this.approversList = result.GetApprovesList; + } + } + + startEitApproval() { + if (this.attachListOver) { + let request = { + AddAttachmentList: this.attachListOver + } + + this.eitService.addAttachment( + request). + subscribe((result: any) => { + this.handleAddAttachmentResults(result); + }); + } else { + this.startApprovalProcess(); + } + } + + + handleAddAttachmentResults(result) { + + if (this.cs.validResponse(result)) { + this.isTrue = 0; + for (let i = 0; i < result.AddAttSuccessList.length; i++) { + if (!result.AddAttSuccessList[i].AddSuccess) { + this.attachListOver[i].isSuccess = false; + //this.attachItems[i].isSuccess = false; + // if false display cancel button with waring icon or design + }// end if + else { + // if true remove cancel and set isSuccess = true + // this.attachItems[i].isSuccess = true; + this.attachListOver[i].isSuccess = true; + this.isTrue = this.isTrue + 1; //count flag of attach status + } // end else + } // end for + + if (this.isTrue == result.AddAttSuccessList.length) { + this.startApprovalProcess(); + } + else { + //stope + let filtered = this.attachListOver.filter(function (el) { return el.isSuccess == true; }); + this.attachListOver = filtered; + let msg: string = ""; + msg = this.ts.trPK("eit", "attach-errorMsg"); + this.cs.presentAlert(msg); + } + } + } + + startApprovalProcess() { + let request: any = {}; + + request.P_MENU_TYPE = this.menuType; + request.P_SELECTED_RESP_ID = this.respID; + request.P_TRANSACTION_ID = this.P_TransactionID; + request.P_ITEM_KEY = this.itemKey; + request.P_ACTION_MODE = this.pActionMode; + request.P_COMMENTS = this.eitComments; + this.terminationService.startApprovalProcess( + request). + subscribe((result: any) => { + this.handleResults(result); + }); + } + cancelEitProcess() { + let body: any = { + P_TRANSACTION_ID: this.P_TransactionID + } + this.eitService.cancelHRTransaction( + body). + subscribe((result: any) => { + this.handleCancelResults(result); + }); + + } + handleCancelResults(result) { + if (this.cs.validResponse(result)) { + this.isSubmitBtnClicked = false; + } + } + handleResults(result) { + if (this.cs.validResponse(result)) { + this.isSubmitBtnClicked = true; + // let msg: string = this.ts.trPK("eit", "approval-message-success"); + // this.cs.presentAlert(msg); + this.cs.greenToastPK("eit", "approval-message-success"); + this.cs.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); + this.cs.openNotificationPage(); + } + } + + async addAttachment(str: boolean, attachItems: any) { + //open the modal with return data + let attachDocID = attachItems.ATTACHED_DOCUMENT_ID; + + this.cs.sharedService.setSharedData(this.P_TransactionID, 'TransactionID'); + this.cs.sharedService.setSharedData(this.attachListOver.length, 'indexLastObj'); + + const modal = await this.modalController.create({ + component: AddAttachComponent + }); + + modal.onDidDismiss() + .then((data) => { + if (data == "cancel" || data == "undefined") { + return; + } else { + if (!str) { + this.updateFile(data, attachDocID); + } else { + console.log(data); + this.attachListDisplay = data.data; + this.attachItems = this.attachListDisplay.map(function (el) { + var o = Object.assign({}, el); + o.isSuccess = false; + return o; + }); + + this.attachListOver = this.attachListOver ? this.attachListOver.concat(this.attachItems) : this.attachItems; + } + } + }); + + return await modal.present(); + } + + /*****submit modal********/ + async openSubmitModal() { + this.cs.sharedService.setSharedData(this.attachListOver, 'submitAttachmentList'); + this.cs.sharedService.setSharedData(this.eitComments, 'eitComments'); + const modal = await this.modalController.create({ + component: SubmitAddressModalComponent, + backdropDismiss: false, + + }); + modal.cssClass = 'note-modal'; + + modal.onDidDismiss() + .then((data) => { + console.log(data.data); + + if (data.data == "cancel" || data.data == undefined) { + return; + } else { + this.startEitApproval(); + } + }); + + return await modal.present(); + } + + + + removeFile(objectitem) { + if (this.attachListOver) { + let index2 = this.attachListOver.findIndex(item => item == objectitem); + if (index2 > -1) { + this.attachListOver.splice(index2, 1); + } + } + if (this.attachmentRes) { + let index3 = this.attachmentRes.findIndex(item => item == objectitem); + if (index3 > -1) { + this.attachmentRes.splice(index3, 1); + } + } + + } + + + getAttachment(NotificationID) { + this.attachReqObj.P_NOTIFICATION_ID = NotificationID; + this.eitService.getAttach(this.attachReqObj). + subscribe((result: NotificationGetAttachResponse) => { + this.handleWorkListAttachResult(result); + }); + } + + handleWorkListAttachResult(result) { + if (this.cs.validResponse(result)) { + if (result.GetAttachementList != null) { + this.attachmentRes = result.GetAttachementList; + } // if result == null + } // valid it + + } + + async OpenAttachFiles(value, Type) { + this.cs.sharedService.setSharedData({ displayData: value, TypeData: Type }, 'WorkListAttachViewPage'); + const modal = await this.modalController.create({ + component: WorkListAttachViewComponent + }); + + modal.onDidDismiss() + .then((data) => { + }); + return await modal.present(); + } + + + delelteFile(attach) { + this.cs.confirmAlertDialog((data) => { + if (data == true) { + this.continueDelete(attach); + } + }, this.ts.trPK('general', 'ok'), () => { + + }, this.ts.trPK('general', 'cancel'), this.ts.trPK('general', 'alert'), this.ts.trPK('eit', 'delete-perm')); + } + + continueDelete(attach) { + let req = { + P_ATTACHED_DOCUMENT_ID: attach.ATTACHED_DOCUMENT_ID + } + this.eitService.deleteAttach(req). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (result.DeleteAttachmentList.P_RETURN_STATUS === "S") { + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); + let msg: string = ""; + msg = this.ts.trPK("eit", "deleteAttach"); + this.cs.presentAlert(msg); + } + } + }); + } + + updateFile(attachList, attachDocID) { + let req = { + P_ATTACHED_DOCUMENT_ID: attachDocID, + P_FILE_DATA: attachList[0].P_FILE_DATA, + P_FILE_NAME: attachList[0].P_FILE_NAME, + P_FILE_CONTENT_TYPE: attachList[0].P_FILE_CONTENT_TYPE + } + this.eitService.updateAttach(req). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (result.MessageStatus == 1) { + let msg: string = ""; + msg = this.ts.trPK("eit", "attachUpdate"); + this.cs.presentAlert(msg); + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); + } + } + }); + } + + + ionViewWillLeave() { + if (this.P_TransactionID && this.isSubmitBtnClicked == false) + this.cancelEitProcess(); + } + + /*******************Add attchement Functions*************/ + + public uploader: FileUploader = new FileUploader({ + allowedMimeType: ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], + maxFileSize: 10 * 1024 * 1024, + formatDataFunctionIsAsync: true, + formatDataFunction: async (item) => { + return new Promise((resolve, reject) => { + resolve({ + name: item._file.name, + length: item._file.size, + contentType: item._file.type, + date: new Date() + }); + }); + } + }); + + + onFileSelectedclick(event) { + event.target.value = ''; + } + + + + onFileSelected(input) { + + if (!(this.filterAllowedType.indexOf(input.target.files[0].type) > -1)) { + let msg: string = ""; + msg = this.ts.trPK("general", "notSupport"); + this.cs.presentAlert(msg); + return + } // todo: show alert that you tried uploading wrong files + + else { + const file = input.target.files[0]; + this.getBase64(file).then( + data => this.pushObject(data, file.name, file.type) + ); + } + } + + + getBase64(file) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = () => resolve(reader.result); + reader.onerror = error => reject(error); + }); + } + + + pushObject(fileData, name, type) { + + console.log("before push: " + this.index); + try { + let array = name.split('.'); + let attachType: string = array[array.length - 1]; + this.attachListOver.push( + { + AttachmentID: this.attachListOver.length, + P_FILE_CONTENT_TYPE: attachType,//type.split('/')[1], + P_FILE_DATA: fileData.split(',')[1], + P_FILE_NAME: name,//.split('.')[0], + P_TRANSACTION_ID: this.P_TransactionID + }) + + } catch (e) { + } + } + + +} diff --git a/Mohem/src/app/termination/service/termination-service.service.spec.ts b/Mohem/src/app/termination/service/termination-service.service.spec.ts new file mode 100644 index 00000000..f9172295 --- /dev/null +++ b/Mohem/src/app/termination/service/termination-service.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { TerminationServiceService } from './termination-service.service'; + +describe('TerminationServiceService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: TerminationServiceService = TestBed.get(TerminationServiceService); + expect(service).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/termination/service/termination-service.service.ts b/Mohem/src/app/termination/service/termination-service.service.ts new file mode 100644 index 00000000..5f2d94e1 --- /dev/null +++ b/Mohem/src/app/termination/service/termination-service.service.ts @@ -0,0 +1,63 @@ +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; +import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service'; + +@Injectable({ + providedIn: 'root' +}) +export class TerminationServiceService { + + public static GET_TERM_COLS_STRUCTURE = 'Services/ERP.svc/REST/GET_TERM_COLS_STRUCTURE'; + public static GET_TERM_DIFF_STRUCTURE = 'Services/ERP.svc/REST/GET_TERM_DFF_STRUCTURE'; + public static SUBMIT_TRANSACTION = 'Services/ERP.svc/REST/SUBMIT_TERM_TRANSACTION'; + public static START_APPORVAL = 'Services/ERP.svc/REST/START_TERM_APPROVAL_PROCESS'; + public static TERMINATION_PAGE = 'termination-page'; + public static SHARED_DATA = 'termination-submit-data'; + constructor( + public con: ConnectorService, + private authService: AuthenticationService, + public cs: CommonService + ) { } + getTerminationColStructure(request, onError, errorLabel) { + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.postNoLoad( + TerminationServiceService.GET_TERM_COLS_STRUCTURE, + request, + onError, + errorLabel + ); + } + getTermDiffStructure(request, onError, errorLabel) { + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.postNoLoad( + TerminationServiceService.GET_TERM_DIFF_STRUCTURE, + request, + onError, + errorLabel + ); + } + submitTransation(request, onError, errorLabel) { + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.postNoLoad( + TerminationServiceService.SUBMIT_TRANSACTION, + request, + onError, + errorLabel + ); + } + public startApprovalProcess(basicDetailsProcess: any, onError?: any, errorLabel?: string): Observable { + const request = basicDetailsProcess; + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.post(TerminationServiceService.START_APPORVAL, request, onError, errorLabel); + } + + + + +} diff --git a/Mohem/src/app/termination/termination-form/termination-form.component.html b/Mohem/src/app/termination/termination-form/termination-form.component.html new file mode 100644 index 00000000..8525da97 --- /dev/null +++ b/Mohem/src/app/termination/termination-form/termination-form.component.html @@ -0,0 +1,19 @@ + +
+ + + +
+
+
+
+
+
+
+ + +
+ + {{'vacation-rule, next-label' | translate}} +
+
\ No newline at end of file diff --git a/Mohem/src/app/termination/termination-form/termination-form.component.scss b/Mohem/src/app/termination/termination-form/termination-form.component.scss new file mode 100644 index 00000000..652b0f19 --- /dev/null +++ b/Mohem/src/app/termination/termination-form/termination-form.component.scss @@ -0,0 +1,44 @@ +#containerDiv{ + margin:15px; +} + +@media screen and (min-width: 300px){ + .CreateBtn{ + --background: var(--newgreen) !important; + background: var(--newgreen) !important; + white-space: normal; + color: var(--light); + text-transform: capitalize; + min-height: 1.0cm; + --border-radius: 7px !important; + border-radius: 7px !important; + --min-height: 1.6cm !important; + width: 315px; + font-family: var(--fontFamilyPoppins-SemiBold, inherit); +}} + +@media screen and (min-width: 1px) and (max-width:290px) { +.CreateBtn{ + --background: var(--newgreen) !important; + background: var(--newgreen) !important; + white-space: normal; + color: var(--light); + text-transform: capitalize; + min-height: 1.0cm; + --border-radius: 7px !important; + border-radius: 7px !important; + --min-height: 1.6cm !important; + width: 257px; + font-family: var(--fontFamilyPoppins-SemiBold, inherit); +}} + +.footer{ + padding: 15px 0px; + background-color: var(--light) !important; + border: 0px !important; + box-shadow: none !important; + -webkit-box-shadow: none; +} +.Btn{ + margin: auto; text-align: center; display: block; +} \ No newline at end of file diff --git a/Mohem/src/app/termination/termination-form/termination-form.component.spec.ts b/Mohem/src/app/termination/termination-form/termination-form.component.spec.ts new file mode 100644 index 00000000..bb916661 --- /dev/null +++ b/Mohem/src/app/termination/termination-form/termination-form.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TerminationFormComponent } from './termination-form.component'; + +describe('TerminationFormComponent', () => { + let component: TerminationFormComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TerminationFormComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TerminationFormComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/termination/termination-form/termination-form.component.ts b/Mohem/src/app/termination/termination-form/termination-form.component.ts new file mode 100644 index 00000000..a874077e --- /dev/null +++ b/Mohem/src/app/termination/termination-form/termination-form.component.ts @@ -0,0 +1,1465 @@ +import { Component, ElementRef, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +import * as moment from 'moment'; +import { EITTransactionsRequest } from 'src/app/eit/models/EITTransactionsReq'; +import { EIT_ACTION } from 'src/app/eit/models/submit.eit.action'; +import { EitService } from 'src/app/eit/services/eit.service'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { DateTimeInput } from 'src/app/uI-elements/date-time.input'; +import { DateInput } from 'src/app/uI-elements/date.input'; +import { HiddenInput } from 'src/app/uI-elements/hidden.input'; +import { NumberInput } from 'src/app/uI-elements/number.input'; +import { SelectInput } from 'src/app/uI-elements/select.input'; +import { TextInput } from 'src/app/uI-elements/text.input'; +import { TimeInput } from 'src/app/uI-elements/time.input'; + +import { TerminationServiceService } from '../service/termination-service.service'; + + +@Component({ + selector: 'app-termination-form', + templateUrl: './termination-form.component.html', + styleUrls: ['./termination-form.component.scss'], +}) +export class TerminationFormComponent implements OnInit { + public selectedMenu; + public diffStructure = []; + public termColStructure = []; + public isUpdate: boolean; + private eitVALSettoCall: any = []; + private textInput; + private numberInput; + private dateInput; + public direction: string; + private datetimeInput; + private timeInput; + private selectInput; + private hiddenInput; + private validateEitObj: any = []; + public menuType: any; + public respID; + public selEmp; + public eitRequest; + private ExtraObj: any = {}; + private arrValues: any = []; + selMenu: MenuResponse; + private country; + private updatedValues; + private effectiveDate; + private comtransNo; + private reportSubmitRequest = {}; + getPassdirfromNotifiPage: boolean = false; + private startDate; + private endDate; + private targetValue; + public eitSubmitAction; + constructor(public cs: CommonService, private elementRef: ElementRef, public terminationFormService: TerminationServiceService, public ts: TranslatorService, public eitService: EitService, public router: ActivatedRoute) { + this.router.queryParams.subscribe(params => { + this.targetValue = params.targetValue; + console.log(this.targetValue); + }); + + } + + ngOnInit() { + this.getPassdirfromNotifiPage = this.cs.sharedService.getSharedData('dirfromNotificationPage'); + this.selectedMenu = this.cs.sharedService.getSharedData(TerminationServiceService.TERMINATION_PAGE, false); + this.getTerminationCol(); + this.direction = TranslatorService.getCurrentLanguageName(); + this.effectiveDate = new Date(); + this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); + this.eitSubmitAction = this.cs.sharedService.getSharedData( + EITTransactionsRequest.SUBMIT_EIT_ACTION + ); + } + getTerminationCol() { + this.cs.startLoading(); + this.terminationFormService.getTerminationColStructure({ + P_FUNCTION_NAME: this.selectedMenu.P_FUNCTION_NAME + }, () => { + + }, this.ts.trPK('general', 'retry')).subscribe((response) => { + this.termColStructure = response['GetTermColsStructureList']; + this.drawEitFieldsStatic(this.termColStructure); + this.getTermDiffStructure(); + }) + } + getTermDiffStructure() { + this.terminationFormService.getTermDiffStructure({ + P_DESC_FLEX_CONTEXT_CODE: null, + P_FUNCTION_NAME: this.selectedMenu.FUNCTION_NAME + }, () => { + this.cs.back(); + }, this.ts.trPK('general', 'retry')).subscribe((response) => { + this.cs.stopLoading(); + this.handleDiffStructure(response); + }) + } + handleDiffStructure(result) { + if (result.GetTermDffStructureList != null) { + this.diffStructure = result.GetTermDffStructureList; + this.drawEitFields(result.GetTermDffStructureList); + if (this.isUpdate) { + //this.submitAbsObjList = this.cs.sharedService.getSharedData(ProfileService.EMP_ADDRESS); + //this.fillAbsStructure(); + } + } + } + private drawEitFields(feildsList) { + const containerId = "containerDiv"; + this.eitVALSettoCall = []; + for (let i = 0; i < feildsList.length; i++) { + let defaultVal: string = ""; + let defaultValText: string = ""; + + if (feildsList[i].DISPLAY_FLAG != "N") { + //check if the field should be displayed + if (feildsList[i].VALIDATION_TYPE == "N") { + //text , date , time + if (feildsList[i].FORMAT_TYPE == "C") { + // character + this.textInput = new TextInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + defaultValText, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else if (feildsList[i].FORMAT_TYPE == "N") { + // number + this.numberInput = new NumberInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else if (feildsList[i].FORMAT_TYPE == "X") { + // standard date + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + //constant + this.dateInput = new DateInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + this.cs.reverseFormatDate(defaultVal), + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } else { + this.dateInput = new DateInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } + } else if (feildsList[i].FORMAT_TYPE == "Y") { + // standard date time + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + this.datetimeInput = new DateTimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + this.cs.reverseFormatStandardDate(defaultVal), + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } else { + this.datetimeInput = new DateTimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } + const elem = document.getElementById( + feildsList[i].APPLICATION_COLUMN_NAME + ); + } else if (feildsList[i].FORMAT_TYPE == "I") { + //time + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + this.timeInput = new TimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } else { + this.timeInput = new TimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } + } + } else { + if (feildsList[i].READ_ONLY == "Y") { + this.textInput = new TextInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + defaultValText, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else { + this.selectInput = new SelectInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + this.fillDropdownList( + feildsList[i].SEGMENT_NAME, + feildsList[i].E_SERVICES_VS, + feildsList[i].E_SERVICES_DV + ); + } + } + this.bindHtmlElemEvents( + feildsList[i].APPLICATION_COLUMN_NAME, + feildsList[i] + ); + } else { + this.hiddenInput = new HiddenInput( + defaultVal, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultValText, + containerId + ); + this.bindHtmlElemEvents( + feildsList[i].APPLICATION_COLUMN_NAME, + feildsList[i] + ); + } + } + if (this.validateEitObj && this.validateEitObj.length > 0) { + this.fillEITStructure(); + } + } + fillDropdownList(segmentName, optionList: any = [], DV: any = "") { + let elemID: any = ""; + let eitObj: any; + if (optionList.length > 0) { + for (let i = 0; i < this.diffStructure.length; i++) { + if (this.diffStructure[i].SEGMENT_NAME == segmentName) { + eitObj = this.diffStructure[i]; + if ( + this.diffStructure[i].READ_ONLY == "Y" || + this.diffStructure[i].DISPLAY_FLAG == "N" + ) { + return false; + } + elemID = this.diffStructure[i].APPLICATION_COLUMN_NAME; + break; + } + } + let select = document.getElementById(elemID) as HTMLSelectElement; + document.getElementById(elemID).innerHTML = ""; + if (eitObj.IsEmptyOption && eitObj.REQUIRED_FLAG == "N") { + var firstoption = document.createElement("option"); + firstoption.text = this.ts.trPK("general", "choose"); + firstoption.value = ""; + select.add(firstoption); + } + for (let i = 0; i < optionList.length; i++) { + var option = document.createElement("option"); + option.text = optionList[i].VALUE_COLUMN_NAME; + option.value = optionList[i].ID_COLUMN_NAME; + select.add(option); + } + if (select.dataset.hiddenval) { + select.value = select.dataset.hiddenval; + } else { + select.value = DV.P_ID_COLUMN_NAME; + } + select.disabled = false; + } + } + bindHtmlElemEvents(id, obj) { + const elem = document.getElementById(id); + console.log(elem); + console.log(obj); + const elemType = elem.tagName; + let changeEvent = "ionChange"; + + if (elemType == "SELECT") changeEvent = "change"; + + try { + elem.addEventListener(changeEvent, e => { + elem.classList.remove("requiredClassElm"); + if ( + obj.CHILD_SEGMENTS_VS_Splited && + obj.CHILD_SEGMENTS_VS_Splited.length > 0 + ) { + let listArray: any = obj.CHILD_SEGMENTS_VS_Splited; + listArray.forEach(element => { + this.emptyChildElement(element); + this.getValueSet(element); + }); + } + if ( + obj.CHILD_SEGMENTS_DV_Splited && + obj.CHILD_SEGMENTS_DV_Splited.length > 0 + ) { + let listArray: any = obj.CHILD_SEGMENTS_DV_Splited; + listArray.forEach(element => { + this.emptyChildElement(element); + for (let i = 0; i < this.diffStructure.length; i++) { + if (this.diffStructure[i].SEGMENT_NAME == element) { + this.getDefaultValue( + this.diffStructure[i], + this.diffStructure[i].DESC_FLEX_NAME, + this.diffStructure[i].DESC_FLEX_CONTEXT_CODE, + this.diffStructure[i].SEGMENT_NAME, + this.diffStructure[i].PARENT_SEGMENTS_VS_SplitedVS, + this.diffStructure[i].PARENT_SEGMENTS_DV_Splited + ); + } + } + }); + } + return false; + }); + } catch (e) { + console.log(e.status); + } + } + public getDefaultValue( + obj, + descFlexName, + descFlexContextCode, + segmentName, + parentValue, + ParentsList + ) { + let dependenciesList: any = []; + let parentVal: any = null; + let isStandardDate: boolean = false; + let isStandardTimeDate: boolean = false; + let isStandardTime: boolean = false; + let isHidden: boolean = false; + let isReadOnlyList: boolean = false; + let isSelectElement: boolean = false; + isStandardDate = this.isStandardDate(obj); + isStandardTimeDate = this.isStandardDateTime(obj); + isStandardTime = this.isStandardTime(obj); + if (obj.DISPLAY_FLAG == "N") isHidden = true; + if (obj.VALIDATION_TYPE != "N" && obj.READ_ONLY == "Y") { + isReadOnlyList = true; + } + if (obj.VALIDATION_TYPE != "N" && obj.READ_ONLY == "N") { + isSelectElement = true; + } + if ( + parentValue != "" && + (obj.VALIDATION_TYPE == "D" || obj.VALIDATION_TYPE == "Y") + ) { + let parvalue = this.getDependenciesParams(parentValue); + if (parvalue && parvalue[0]) parentVal = parvalue[0].ID_COLUMN_NAME; + else { + parentVal = null; + } + if (!parentVal) { + return false; + } + } + if (ParentsList != "") { + if (parentValue) ParentsList.concat(parentValue); + dependenciesList = this.getDependenciesParams(ParentsList); + if (!dependenciesList) { + return false; + } + } + + const body = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, //-999, + P_DESC_FLEX_NAME: descFlexName, + P_DESC_FLEX_CONTEXT_CODE: descFlexContextCode, + P_SEGMENT_NAME: segmentName, + P_PARENT_VALUE: parentVal, + GetValueSetValuesTBL: dependenciesList + }; + + this.eitService.getDefaultValue(body).subscribe((result: any) => { + let elem = this.getElementByName(segmentName); + let obj = this.handleDefaultValueResult(result); + let val = obj.value; + let text = obj.text; + if (val == null) { val = ""; } + if (text == null) { text = ""; } + if (isStandardDate) { + console.log("isStandardDate"); + elem.value = this.cs.reverseFormatDate(val); + } else if (isStandardTimeDate) { + console.log("isStandardTimeDate"); + if (val) { + elem.dataset.dtvalue = this.cs.reverseFormatStandardDate(val); + elem.innerHTML = this.cs.reverseFormatStandardDate(val); + } else { + elem.dataset.dtvalue = ""; + elem.innerHTML = ""; + } + } else if (isStandardTime) { + console.log("isStandardTime"); + if (val) { + elem.dataset.dtvalue = val; + elem.innerHTML = val; + elem.value = val; + } else { + elem.dataset.dtvalue = ""; + elem.innerHTML = ""; + } + } else { + if (isSelectElement) { + let elem = this.getSelectElementByName(segmentName); + elem = document.getElementById(elem), + elem.value = val; + } else { + elem.value = val; + elem.innerText = text; + elem.setAttribute("value", val); + } + } + if (isHidden || isReadOnlyList) { + if (val) elem.dataset.colmText = val; + else elem.dataset.colmText = ""; + elem.value = text; + } + var event = new Event("ionChange"); + elem.dispatchEvent(event); + }); + } + + handleDefaultValueResult(result) { + let data = { + text: result.GetDefaultValueList.P_VALUE_COLUMN_NAME, + value: result.GetDefaultValueList.P_ID_COLUMN_NAME + }; + return data; + } + getSelectElementByName(segmentName) { + let elemID: any = ""; + for (let i = 0; i < this.diffStructure.length; i++) { + if (this.diffStructure[i].SEGMENT_NAME == segmentName) { + elemID = this.diffStructure[i].APPLICATION_COLUMN_NAME; + break; + } + } + return elemID; + } + getElementByName(segmentName) { + let elemID: any = ""; + for (let i = 0; i < this.diffStructure.length; i++) { + if (this.diffStructure[i].SEGMENT_NAME == segmentName) { + elemID = this.diffStructure[i].APPLICATION_COLUMN_NAME; + break; + } + } + return document.getElementById(elemID) as HTMLInputElement; + } + + fillEITStructure() { + var obj = { peiObjVer: null, peiExtraInfoID: null }; + for (let i = 0; i < this.validateEitObj.length; i++) { + let val: any; + if (this.validateEitObj[i].VARCHAR2_VALUE) + val = this.validateEitObj[i].VARCHAR2_VALUE; + else if (this.validateEitObj[i].DATE_VALUE) + val = this.validateEitObj[i].DATE_VALUE; + else if (this.validateEitObj[i].NUMBER_VALUE) + val = this.validateEitObj[i].NUMBER_VALUE; + const elem = document.getElementById( + this.validateEitObj[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + //obj.transactionNo=this.validateEitObj[i].TRANSACTION_NUMBER; + if (elem) { + if (val) { + let feldDetails = this.diffStructure.find( + x => + x.APPLICATION_COLUMN_NAME == + this.validateEitObj[i].APPLICATION_COLUMN_NAME + ); + if (feldDetails) { + let isStandardDate = this.isStandardDateVal(feldDetails); + let isStandardDateTime = this.isStandardDateTimeVal(feldDetails); + let isStandardTime = this.isStandardTimeVal(feldDetails); + if (isStandardDate) { + elem.value = this.cs.reverseFormatDate(val); + } else if (isStandardDateTime) { + elem.innerHTML = this.cs.reverseFormatStandardDate(val); + elem.dataset.dtvalue = this.cs.reverseFormatStandardDate(val); + } else if (isStandardTime) { + elem.innerHTML = val; + elem.dataset.dtvalue = val; + } else { + elem.value = val; + elem.setAttribute("value", elem.value); + } + if ( + feldDetails.DISPLAY_FLAG == "N" || + (feldDetails.VALIDATION_TYPE != "N" && + feldDetails.READ_ONLY == "Y") + ) { + elem.dataset.colmText = val; + elem.value = this.validateEitObj[i].SEGMENT_VALUE_DSP; + elem.setAttribute("value", elem.value); + } + } + elem.dataset.hiddenval = val; //hide the value to set it after calling get value set + if ( + feldDetails.CHILD_SEGMENTS_VS_Splited && + feldDetails.CHILD_SEGMENTS_VS_Splited.length > 0 + ) { + let listArray: any = feldDetails.CHILD_SEGMENTS_VS_Splited; + listArray.forEach(element => { + this.getValueSet(element); + }); + } + // var event = new Event('change'); + // elem.dispatchEvent(event); + } + } else { + if ( + this.validateEitObj[i].APPLICATION_COLUMN_NAME == + "PEI_OBJECT_VERSION_NUMBER" + ) + obj.peiObjVer = this.validateEitObj[i].NUMBER_VALUE; + else if ( + this.validateEitObj[i].APPLICATION_COLUMN_NAME == "PEI_EXTRA_INFO_ID" + ) + obj.peiExtraInfoID = this.validateEitObj[i].NUMBER_VALUE; + } + } + this.ExtraObj = obj; + } + public getValueSet(segmentName) { + let descFlexName: any = ""; + let descFlexContextCode: any = ""; + let parentValue: any = []; + let ParentsList: any = []; + let parentVal: any = null; + let dependenciesList: any = []; + let validationType: string = ""; + + for (let i = 0; i < this.diffStructure.length; i++) { + if (this.diffStructure[i].SEGMENT_NAME == segmentName) { + descFlexName = this.diffStructure[i].DESC_FLEX_NAME; + descFlexContextCode = this.diffStructure[i].DESC_FLEX_CONTEXT_CODE; + parentValue = this.diffStructure[i].PARENT_SEGMENTS_VS_SplitedVS; + ParentsList = this.diffStructure[i].PARENT_SEGMENTS_VS_SplitedVS; + validationType = this.diffStructure[i].VALIDATION_TYPE; + break; + } + } + if (parentValue != "" && (validationType == "D" || validationType == "Y")) { + let parvalue = this.getDependenciesParams(parentValue); + if (parvalue && parvalue[0]) parentVal = parvalue[0].ID_COLUMN_NAME; + else { + parentVal = null; + } + if (!parentVal) { + return false; + } + } + if (ParentsList != "") { + dependenciesList = this.getDependenciesParams(ParentsList); + if (!dependenciesList) { + return false; + } + } + const body = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, //-999, + P_DESC_FLEX_NAME: descFlexName, + P_DESC_FLEX_CONTEXT_CODE: descFlexContextCode, + P_SEGMENT_NAME: segmentName, + P_PARENT_VALUE: parentVal, + GetValueSetValuesTBL: dependenciesList, + P_PAGE_NUM: 1, + P_PAGE_LIMIT: 1000 + }; + + this.eitService.getSetValue(body).subscribe((result: any) => { + if (result.GetValueSetValuesList != null) { + this.fillDropdownList(segmentName, result.GetValueSetValuesList); + } + }); + let arr: any = []; + return arr; + } + isStandardDateVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "X") { + + isSt = true; + + } + return isSt; + } + + emptyChildElement(segmentName) { + let elem = this.getElementByName(segmentName); + elem.value = null; + elem.innerHTML = ""; + if ("dtvalue" in elem.dataset) { + elem.dataset.dtvalue = ""; + } + if ("colmText" in elem.dataset) { + elem.dataset.colmText = ""; + } + var event = new Event("change"); + elem.dispatchEvent(event); + elem.classList.remove("requiredClassElm"); + } + getDependenciesParams(parentsList) { + let parentArr: any = []; + for (let i = 0; i < parentsList.length; i++) { + for (let j = 0; j < this.diffStructure.length; j++) { + if (this.diffStructure[j].SEGMENT_NAME == parentsList[i].Name) { + if (this.diffStructure[j].DISPLAY_FLAG != "N") { + if (this.diffStructure[j].VALIDATION_TYPE == "N") { + let idColName: string; + let val: any; + if ( + this.diffStructure[j].FORMAT_TYPE == "Y" || + this.diffStructure[j].FORMAT_TYPE == "I" + ) { + //standard date time or //time + let elem = document.getElementById( + this.diffStructure[j].APPLICATION_COLUMN_NAME + ) as HTMLDivElement; + val = elem.dataset.dtvalue; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } + idColName = val; + if (this.diffStructure[j].FORMAT_TYPE == "Y") + idColName = this.cs.formatStandardDate(val); + } else { + val = (document.getElementById( + this.diffStructure[j].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } + idColName = val; + if (this.diffStructure[j].FORMAT_TYPE == "X") { + //date + // idColName = this.cs.formatDate(val); + idColName = this.cs.formatDateNew(val); + } + } + parentArr.push({ + SEGMENT_NAME: this.diffStructure[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: val, + DESCRIPTION: "", + ID_COLUMN_NAME: idColName, + FLEX_VALUE_SET_NAME: this.diffStructure[j].FLEX_VALUE_SET_NAME + }); + break; + } else { + if (this.diffStructure[j].READ_ONLY != "Y") { + let x = document.getElementById( + this.diffStructure[j].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + let text = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].text + : ""; + let val = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].value + : undefined; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { + } + if (text == undefined) { + text = ""; + } + parentArr.push({ + SEGMENT_NAME: this.diffStructure[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.diffStructure[j].FLEX_VALUE_SET_NAME + }); + break; + } else { + let x = document.getElementById( + this.diffStructure[j].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let text = x.value; + let val = x.dataset.colmText; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { + } + if (text == undefined) { + text = ""; + } + parentArr.push({ + SEGMENT_NAME: this.diffStructure[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.diffStructure[j].FLEX_VALUE_SET_NAME + }); + break; + } + } + } else { + let x = document.getElementById( + this.diffStructure[j].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let text = x.value; + let val = x.dataset.colmText; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { + } + if (text == undefined) { + text = ""; + } + parentArr.push({ + SEGMENT_NAME: this.diffStructure[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.diffStructure[j].FLEX_VALUE_SET_NAME + }); + break; + } + } + } + } + return parentArr; + } + + isStandardTimeVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "I") { + // standard time + //if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant + isSt = true; + //} + } + return isSt; + } + isStandardDateTimeVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "Y") { + // standard date time + //if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant + isSt = true; + //} + } + return isSt; + } + + isStandardDateTime(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "Y") { + // standard date time + if ( + obj.DEFAULT_TYPE == "C" || + obj.DEFAULT_TYPE == "D" || + obj.DEFAULT_TYPE == "P" || + obj.DEFAULT_TYPE == "S" + ) { + //constant + isSt = true; + } + } + return isSt; + } + isStandardTime(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "I") { + // standard date time + if ( + obj.DEFAULT_TYPE == "C" || + obj.DEFAULT_TYPE == "D" || + obj.DEFAULT_TYPE == "P" || + obj.DEFAULT_TYPE == "S" + ) { + //constant + isSt = true; + } + } + return isSt; + } + + isStandardDate(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "X") { + // standard date + if ( + obj.DEFAULT_TYPE == "C" || + obj.DEFAULT_TYPE == "D" || + obj.DEFAULT_TYPE == "P" || + obj.DEFAULT_TYPE == "S" + ) { + //constant + isSt = true; + } + } + return isSt; + } + + validateTransaction() { + (this.elementRef.nativeElement.querySelectorAll( + "ion-item" + ) as HTMLElement[]).forEach(x => { + x.classList.add("ng-touched"); + x.classList.remove("ng-untouched"); + }); + + + var arrValues = this.getElementsValues(); + let staticValues = this.getElementsStaticValues(); + let allStatisDynamicValues = arrValues.concat(staticValues); + if (arrValues) { + + this.reportSubmitRequest = { + + P_MENU_TYPE: this.selMenu.List_Menu.MENU_TYPE, + P_SELECTED_RESP_ID: -999, + P_FUNCTION_NAME: this.selMenu.GetMenuEntriesList.FUNCTION_NAME, + EITTransactionTBL: allStatisDynamicValues, + + }; + this.cs.startLoading(); + this.terminationFormService + .submitTransation(this.reportSubmitRequest, {}, this.ts.trPK('general', 'retry')) + .subscribe((result: any) => { + this.handleSubmit(result); + }); + } + } + + + private handleSubmit(result) { + if (this.cs.validResponse(result)) { + this.cs.sharedService.setSharedData(result['SubmitTermTransactionList'], TerminationServiceService.SHARED_DATA); + this.cs.stopLoading(); + this.cs.confirmTermination(); + } + } + + + public getElementsValues(): any { + this.updatedValues = []; //fill updated list + let valuseArr: any = []; + let varcharValue: any = null; + let numbervalue: any = 0; + let dateValue: any = null; + let transNo: number = 1; + let textValue: any; + // if(this.ExtraObj.transactionNo) + // transNo=this.ExtraObj.transactionNo; + for (let i = 0; i < this.diffStructure.length; i++) { + varcharValue = null; + numbervalue = null; + dateValue = null; + /*********set transaction No of the updated object ********/ + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.diffStructure[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + } + if (this.diffStructure[i].DISPLAY_FLAG != "N") { + if (this.diffStructure[i].VALIDATION_TYPE == "N") { + let elem = document.getElementById( + this.diffStructure[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let elemVal = (document.getElementById( + this.diffStructure[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + textValue = elemVal; + //let elemVal= (document.getElementById(this.eitResponse[i].APPLICATION_COLUMN_NAME)).value; + if ( + this.diffStructure[i].FORMAT_TYPE == "X" && + this.diffStructure[i].DISPLAY_FLAG != "N" + ) { + //date + elemVal = this.cs.formatDate(elemVal); + } else if ( + this.diffStructure[i].FORMAT_TYPE == "Y" && + this.diffStructure[i].DISPLAY_FLAG != "N" + ) { + //standard date time + // elemVal = elem.dataset.dtvalue; + // elemVal = this.cs.formatStandardDate(elemVal); + elemVal = this.cs.formatDate(elemVal); + } else if ( + this.diffStructure[i].FORMAT_TYPE == "I" && + this.diffStructure[i].DISPLAY_FLAG != "N" + ) { + //time + if (elemVal.length > 5) { + elemVal = elemVal.substring(11, 16); + } else { + elemVal = elemVal; + } + } + if (this.diffStructure[i].REQUIRED_FLAG == "Y" && !elemVal) { + elem.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + elem.classList.remove("requiredClassElm"); + } + // if (elemVal != 'null'){ + varcharValue = elemVal; + //} else{ + // elemVal = null; + // } + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.diffStructure[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } else { + let x = document.getElementById( + this.diffStructure[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + if (this.diffStructure[i].READ_ONLY == "Y") { + let text = x.value; + let val = x.dataset.colmText; + varcharValue = val; + textValue = text; + } else { + let val = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].value + : null; + let txt = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].text + : null; + varcharValue = val; + textValue = txt; + } + if (this.diffStructure[i].REQUIRED_FLAG == "Y" && !varcharValue) { + x.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.diffStructure[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } //end else + } else { + let x = document.getElementById( + this.diffStructure[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + let val = x.dataset.colmText; + textValue = x.value; + if (this.diffStructure[i].REQUIRED_FLAG == "Y" && !val) { + x.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + } + + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.diffStructure[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + if (this.validateEitObj && this.eitSubmitAction == EIT_ACTION.UPDATE) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.diffStructure[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + let y = { + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue, + SEGMENT_VALUE_DSP: textValue, + APPLICATION_COLUMN_NAME: this.diffStructure[i] + .APPLICATION_COLUMN_NAME, + DATATYPE: this.diffStructure[i].DATATYPE, + DESC_FLEX_CONTEXT_CODE: this.diffStructure[i].DESC_FLEX_CONTEXT_CODE, + DESC_FLEX_NAME: this.diffStructure[i].DESC_FLEX_NAME, + DISPLAY_FLAG: this.diffStructure[i].DISPLAY_FLAG, + SEGMENT_NAME: this.diffStructure[i].SEGMENT_NAME, + SEGMENT_PROMPT: this.diffStructure[i].SEGMENT_PROMPT + }; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } + } + } // end for + + if (this.getPassdirfromNotifiPage) { + let updatedObj1 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_ACTION" + ); + let updatedObj2 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_EXTRA_INFO_ID" + ); + let updatedObj3 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_OBJECT_VERSION_NUMBER" + ); + this.updatedValues.push(updatedObj1); + this.updatedValues.push(updatedObj2); + this.updatedValues.push(updatedObj3); + valuseArr = this.fillExtraInformation( + valuseArr, + updatedObj1.VARCHAR2_VALUE, + updatedObj2.NUMBER_VALUE, + updatedObj3.NUMBER_VALUE, + transNo + ); + } else { + if (this.eitSubmitAction == EIT_ACTION.ADD) { + this.updatedValues = this.fillExtraValuesUpdated( + this.updatedValues, + "NEW_ROW", + -1, + 0, + transNo + ); + valuseArr = this.fillExtraInformation( + valuseArr, + "NEW_ROW", + -1, + 0, + transNo + ); + } else if (this.eitSubmitAction == EIT_ACTION.UPDATE) { + valuseArr = this.fillExtraInformation( + valuseArr, + "UPDATE_ROW", + this.ExtraObj.peiExtraInfoID, + this.ExtraObj.peiObjVer, + transNo + ); + } else if (this.eitSubmitAction == EIT_ACTION.DELETE) { + valuseArr = this.fillExtraInformation( + valuseArr, + "DELETE_ROW", + this.ExtraObj.peiExtraInfoID, + this.ExtraObj.peiObjVer, + transNo + ); + } + } + return valuseArr; + } // end getElementsValues + + fillExtraValuesUpdated( + values: any, + peiAction: string, + peiExtraInfoID: number, + peiObjVer: number, + transNo: number + ): any { + let obj1 = { + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: peiAction, + NUMBER_VALUE: null, + DATE_VALUE: null, + SEGMENT_VALUE_DSP: "", + APPLICATION_COLUMN_NAME: "PEI_ACTION", + DATATYPE: "VARCHAR2", + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + SEGMENT_NAME: "", + SEGMENT_PROMPT: "" + }; + let obj2 = { + TRANSACTION_NUMBER: 1, + APPLICATION_COLUMN_NAME: "PEI_OBJECT_VERSION_NUMBER", + VARCHAR2_VALUE: null, + NUMBER_VALUE: peiObjVer, + DATATYPE: "NUMBER", + SEGMENT_VALUE_DSP: "", + DATE_VALUE: null, + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + SEGMENT_NAME: "", + SEGMENT_PROMPT: "" + }; + let obj3 = { + APPLICATION_COLUMN_NAME: "PEI_EXTRA_INFO_ID", + DATATYPE: "NUMBER", + DATE_VALUE: null, + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + NUMBER_VALUE: peiExtraInfoID, + SEGMENT_NAME: "", + SEGMENT_PROMPT: "", + SEGMENT_VALUE_DSP: "", + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: null + }; + values.push(obj1); + values.push(obj2); + values.push(obj3); + return values; + } + + fillExtraInformation( + values: any, + peiAction: string, + peiExtraInfoID: number, + peiObjVer: number, + transNo: number + ): any { + values.push({ + TRANSACTION_NUMBER: transNo, + NAME: "PEI_ACTION", + VARCHAR2_VALUE: peiAction, + NUMBER_VALUE: null, + DATE_VALUE: null + }); + values.push({ + TRANSACTION_NUMBER: transNo, + NAME: "PEI_EXTRA_INFO_ID", + VARCHAR2_VALUE: null, + NUMBER_VALUE: peiExtraInfoID, + DATE_VALUE: null + }); + values.push({ + TRANSACTION_NUMBER: transNo, + NAME: "PEI_OBJECT_VERSION_NUMBER", + VARCHAR2_VALUE: null, + NUMBER_VALUE: peiObjVer, + DATE_VALUE: null + }); + return values; + } + + fixTransactionNo(transactionTBL: any): any[] { + let list: any = []; + let newIndex: number = 1; + let length: number = transactionTBL.length; + if (length > 0) { + for (let i = 0; i < length; i++) { + // let item :any={}; + const item = Object.assign({}, transactionTBL[i]); + let transNo: number = item.TRANSACTION_NUMBER; + let obj: any = item; + if (i == 0) { + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } else { + let prevEl: any = transactionTBL[i - 1].TRANSACTION_NUMBER; + if (transNo == prevEl) { + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } else { + newIndex++; + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } + } + } + } + return list; + } + + private drawEitFieldsStatic(feildsList) { + const containerId = "containerDivTwo"; + this.eitVALSettoCall = []; + for (let i = 0; i < feildsList.length; i++) { + let defaultVal: string = ""; + let defaultValText: string = ""; + + if (feildsList[i].DISPLAY_FLAG != "N") { + //text , date , time + if (feildsList[i].DATATYPE == "VARCHAR2" && feildsList[i].ObjectValuesList === null) { + // character + this.textInput = new TextInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + defaultValText, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else if (feildsList[i].DATATYPE == "VARCHAR2" && feildsList[i].ObjectValuesList !== null) { + this.selectInput = new SelectInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + this.fillStaticDropdownList( + feildsList[i].SEGMENT_NAME, + feildsList[i].ObjectValuesList, + feildsList[i].APPLICATION_COLUMN_NAME + ); + } else if (feildsList[i].DATATYPE == "NUMBER") { + this.numberInput = new NumberInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else if (feildsList[i].DATATYPE == "DATE") { + this.dateInput = new DateInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + + } + } + } + + } + + public fillStaticDropdownList(segmentName, optionList: any = [], elemID: string) { + let eitObj: any; + if (optionList.length > 0) { + let select = document.getElementById(elemID) as HTMLSelectElement; + document.getElementById(elemID).innerHTML = ""; + + for (let i = 0; i < optionList.length; i++) { + var option = document.createElement("option"); + option.text = optionList[i].MEANING; + option.value = optionList[i].CODE; + select.add(option); + } + } + } + + public getElementsStaticValues(): any { + this.updatedValues = []; //fill updated list + let valuseArr: any = []; + let varcharValue: any = null; + let numbervalue: any = 0; + let dateValue: any = null; + let transNo: number = 1; + let textValue: any; + + for (let i = 0; i < this.termColStructure.length; i++) { + varcharValue = null; + numbervalue = null; + dateValue = null; + + if (this.termColStructure[i].DISPLAY_FLAG != "N") { + if (this.termColStructure[i].ObjectValuesList === null) { + let elem = document.getElementById(this.termColStructure[i].APPLICATION_COLUMN_NAME) as HTMLInputElement; + let elemVal = elem !== null ? (document.getElementById(this.termColStructure[i].APPLICATION_COLUMN_NAME) as HTMLInputElement).value : ''; + textValue = elemVal; + + if (this.termColStructure[i].DATATYPE == "VARCHAR2" || this.termColStructure[i].DATATYPE == "NUMBER") { + elemVal = elemVal; + } else if (this.termColStructure[i].DATATYPE == "DATE") { + // date + elemVal = this.cs.formatDate(elemVal); + } + + if (this.targetValue === 'new') { + if (this.termColStructure[i].REQUIRED_FLAG == "Y" && !elemVal) { + elem.classList.add("requiredClassElm"); + return false; + } else { + elem.classList.remove("requiredClassElm"); + } + } + + if (this.termColStructure[i].DATATYPE == "DATE") { + dateValue = elemVal; + } else if (this.termColStructure[i].DATATYPE == "NUMBER") { + numbervalue = elemVal; + } else { + varcharValue = elemVal; + } + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.termColStructure[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } else { + let x = document.getElementById(this.termColStructure[i].APPLICATION_COLUMN_NAME) as HTMLSelectElement; + + let val = x.options && x.options[x.selectedIndex] ? x.options[x.selectedIndex].value : null; + let txt = x.options && x.options[x.selectedIndex] ? x.options[x.selectedIndex].text : null; + varcharValue = val; + textValue = txt; + + if (x !== null) { + if (this.termColStructure[i].REQUIRED_FLAG == "Y" && !varcharValue) { + x.classList.add("requiredClassElm"); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + } + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.termColStructure[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } + } else { + let x = document.getElementById(this.termColStructure[i].APPLICATION_COLUMN_NAME) as HTMLSelectElement; + let val = x !== null ? x.dataset.colmText : ''; + textValue = x !== null ? x.value : ''; + + if (x !== null) { + if (this.termColStructure[i].REQUIRED_FLAG == "Y" && !val) { + x.classList.add("requiredClassElm"); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + } + varcharValue = val; + + + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.termColStructure[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } + } + return valuseArr; + } + public customiseDate(date: any) { + let formatedDate = date.slice(0, 9); + let newDate = formatedDate.split("/").reverse(); + const tmp = newDate[2]; + newDate[2] = newDate[1]; + newDate[1] = tmp; + newDate = newDate.join("/"); + newDate = newDate + ' 00:00:00'; + return newDate; + } +} diff --git a/Mohem/src/app/termination/termination.module.ts b/Mohem/src/app/termination/termination.module.ts new file mode 100644 index 00000000..7302cb97 --- /dev/null +++ b/Mohem/src/app/termination/termination.module.ts @@ -0,0 +1,46 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { Routes, RouterModule } from '@angular/router'; + +import { IonicModule } from '@ionic/angular'; + +import { TerminationPage } from './termination.page'; +import { TerminationFormComponent } from './termination-form/termination-form.component'; +import { TerminationServiceService } from './service/termination-service.service'; +import { HmgCommonModule } from '../hmg-common/hmg-common.module'; +import { ConfirmTerminationComponent } from './confirm-termination/confirm-termination.component'; +import { SubmitAddressModalComponent } from '../profile/submit-eit-modal/submit-address-modal.component'; + + +const routes: Routes = [ + { + path: '', + component: TerminationPage, + children: [ + { + path: 'termination-form', + component: TerminationFormComponent + }, + { + path: 'confirm-termination', + component: ConfirmTerminationComponent + }, + + ], + } +]; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + RouterModule.forChild(routes), + HmgCommonModule + ], + declarations: [TerminationPage, TerminationFormComponent, ConfirmTerminationComponent], + providers: [TerminationServiceService], + entryComponents: [SubmitAddressModalComponent] +}) +export class TerminationPageModule { } diff --git a/Mohem/src/app/termination/termination.page.html b/Mohem/src/app/termination/termination.page.html new file mode 100644 index 00000000..67cbe279 --- /dev/null +++ b/Mohem/src/app/termination/termination.page.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Mohem/src/app/termination/termination.page.scss b/Mohem/src/app/termination/termination.page.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/termination/termination.page.spec.ts b/Mohem/src/app/termination/termination.page.spec.ts new file mode 100644 index 00000000..04fa359a --- /dev/null +++ b/Mohem/src/app/termination/termination.page.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TerminationPage } from './termination.page'; + +describe('TerminationPage', () => { + let component: TerminationPage; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TerminationPage ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TerminationPage); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/termination/termination.page.ts b/Mohem/src/app/termination/termination.page.ts new file mode 100644 index 00000000..f821ad78 --- /dev/null +++ b/Mohem/src/app/termination/termination.page.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-termination', + templateUrl: './termination.page.html', + styleUrls: ['./termination.page.scss'], +}) +export class TerminationPage implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/Mohem/src/app/time-card/time-card-details/time-card-details.component.scss b/Mohem/src/app/time-card/time-card-details/time-card-details.component.scss index ef433546..5cd0e320 100644 --- a/Mohem/src/app/time-card/time-card-details/time-card-details.component.scss +++ b/Mohem/src/app/time-card/time-card-details/time-card-details.component.scss @@ -852,7 +852,7 @@ $actionBtnSize : 36px; font-size: 18px; } span{ - font-size: 11px; + font-size: 9px; } } } diff --git a/Mohem/src/app/time-card/time-card-details/time-card-details.component.ts b/Mohem/src/app/time-card/time-card-details/time-card-details.component.ts index 638d68e0..98f15742 100644 --- a/Mohem/src/app/time-card/time-card-details/time-card-details.component.ts +++ b/Mohem/src/app/time-card/time-card-details/time-card-details.component.ts @@ -184,7 +184,7 @@ export class TimeCardDetailsComponent implements OnInit { { data: [this.absentDays, this.attendedDays], backgroundColor: [ - '#269DB8', + '#292F42', '#269DB8' ], borderWidth: 2 diff --git a/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.html b/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.html index 15900c2a..3d8f1032 100644 --- a/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.html +++ b/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.html @@ -33,9 +33,9 @@
- + +
diff --git a/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.ts b/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.ts index eeef7508..acc38009 100644 --- a/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.ts +++ b/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.ts @@ -26,7 +26,7 @@ import { WorkListReplacementRollComponent } from 'src/app/notification/work-list }) export class VacationTypeComponent implements OnInit { ruleTypeList: any; - index: any; + index = 'noType'; vactionRuleSelected:any =-1; notificationTypeSelected: number; notification_list: any; //// @@ -165,13 +165,11 @@ export class VacationTypeComponent implements OnInit { } - vacationRuleSel(event){ - this.vactionRuleSelected=event.detail.value; + vacationRuleSel(){ + this.vactionRuleSelected = this.index; if(this.notificationTypeShow){ - //this.notificationTypeShow = false this.notificationTypeShow = false this.notifTypeSelP2 = "*"; - //this.part3show = false } if (this.createVacationRuleShow){ this.createVacationRuleShow = false @@ -180,11 +178,6 @@ export class VacationTypeComponent implements OnInit { } - - - - - console.log("event: "+ event.detail.value); } notificationSel(event){ diff --git a/Mohem/src/assets/icon/bar-chart-outline.svg b/Mohem/src/assets/icon/bar-chart-outline.svg new file mode 100644 index 00000000..d17a6598 --- /dev/null +++ b/Mohem/src/assets/icon/bar-chart-outline.svg @@ -0,0 +1 @@ +Bar Chart \ No newline at end of file diff --git a/Mohem/src/assets/icon/bar-chart.svg b/Mohem/src/assets/icon/bar-chart.svg new file mode 100644 index 00000000..7a070f16 --- /dev/null +++ b/Mohem/src/assets/icon/bar-chart.svg @@ -0,0 +1 @@ +Bar Chart \ No newline at end of file diff --git a/Mohem/src/assets/icon/blank.svg b/Mohem/src/assets/icon/blank.svg new file mode 100644 index 00000000..458383af --- /dev/null +++ b/Mohem/src/assets/icon/blank.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/Mohem/src/assets/icon/green.svg b/Mohem/src/assets/icon/green.svg new file mode 100644 index 00000000..635949a6 --- /dev/null +++ b/Mohem/src/assets/icon/green.svg @@ -0,0 +1,3 @@ + + + diff --git a/Mohem/src/assets/icon/select-all.svg b/Mohem/src/assets/icon/select-all.svg new file mode 100644 index 00000000..f053110b --- /dev/null +++ b/Mohem/src/assets/icon/select-all.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Mohem/src/assets/icon/settings-not.svg b/Mohem/src/assets/icon/settings-not.svg new file mode 100644 index 00000000..e05313cb --- /dev/null +++ b/Mohem/src/assets/icon/settings-not.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/Mohem/src/assets/icon/yellow.svg b/Mohem/src/assets/icon/yellow.svg new file mode 100644 index 00000000..e146cb79 --- /dev/null +++ b/Mohem/src/assets/icon/yellow.svg @@ -0,0 +1,3 @@ + + + diff --git a/Mohem/src/assets/imgs/hr-request.png b/Mohem/src/assets/imgs/hr-request.png new file mode 100644 index 00000000..c905603b Binary files /dev/null and b/Mohem/src/assets/imgs/hr-request.png differ diff --git a/Mohem/src/assets/imgs/mohemm-action/Doable-old.png b/Mohem/src/assets/imgs/mohemm-action/Doable-old.png new file mode 100644 index 00000000..46d08d07 Binary files /dev/null and b/Mohem/src/assets/imgs/mohemm-action/Doable-old.png differ diff --git a/Mohem/src/assets/imgs/mohemm-action/Doable.png b/Mohem/src/assets/imgs/mohemm-action/Doable.png new file mode 100644 index 00000000..36d8fb25 Binary files /dev/null and b/Mohem/src/assets/imgs/mohemm-action/Doable.png differ diff --git a/Mohem/src/assets/imgs/mohemm-action/More-2.png b/Mohem/src/assets/imgs/mohemm-action/More-2.png new file mode 100644 index 00000000..925f6ea5 Binary files /dev/null and b/Mohem/src/assets/imgs/mohemm-action/More-2.png differ diff --git a/Mohem/src/assets/imgs/mohemm-action/More.png b/Mohem/src/assets/imgs/mohemm-action/More.png index 925f6ea5..005e24ba 100644 Binary files a/Mohem/src/assets/imgs/mohemm-action/More.png and b/Mohem/src/assets/imgs/mohemm-action/More.png differ diff --git a/Mohem/src/assets/imgs/mohemm-action/Skip-2.png b/Mohem/src/assets/imgs/mohemm-action/Skip-2.png new file mode 100644 index 00000000..03b3c23f Binary files /dev/null and b/Mohem/src/assets/imgs/mohemm-action/Skip-2.png differ diff --git a/Mohem/src/assets/imgs/mohemm-action/Skip.png b/Mohem/src/assets/imgs/mohemm-action/Skip.png index 03b3c23f..17e38cb3 100644 Binary files a/Mohem/src/assets/imgs/mohemm-action/Skip.png and b/Mohem/src/assets/imgs/mohemm-action/Skip.png differ diff --git a/Mohem/src/assets/imgs/mohemm-action/answer.png b/Mohem/src/assets/imgs/mohemm-action/answer.png new file mode 100644 index 00000000..b73bed66 Binary files /dev/null and b/Mohem/src/assets/imgs/mohemm-action/answer.png differ diff --git a/Mohem/src/assets/imgs/mohemm-action/data-corrected (2).png b/Mohem/src/assets/imgs/mohemm-action/data-corrected (2).png new file mode 100644 index 00000000..5d6dfd2a Binary files /dev/null and b/Mohem/src/assets/imgs/mohemm-action/data-corrected (2).png differ diff --git a/Mohem/src/assets/imgs/mohemm-action/data-corrected (3).png b/Mohem/src/assets/imgs/mohemm-action/data-corrected (3).png new file mode 100644 index 00000000..40525d72 Binary files /dev/null and b/Mohem/src/assets/imgs/mohemm-action/data-corrected (3).png differ diff --git a/Mohem/src/assets/imgs/mohemm-action/data-corrected.png b/Mohem/src/assets/imgs/mohemm-action/data-corrected.png new file mode 100644 index 00000000..a05cd2bc Binary files /dev/null and b/Mohem/src/assets/imgs/mohemm-action/data-corrected.png differ diff --git a/Mohem/src/assets/imgs/mohemm-action/doable-2-old.png b/Mohem/src/assets/imgs/mohemm-action/doable-2-old.png new file mode 100644 index 00000000..36d8fb25 Binary files /dev/null and b/Mohem/src/assets/imgs/mohemm-action/doable-2-old.png differ diff --git a/Mohem/src/assets/imgs/mohemm-action/info-old.png b/Mohem/src/assets/imgs/mohemm-action/info-old.png new file mode 100644 index 00000000..7d37568e Binary files /dev/null and b/Mohem/src/assets/imgs/mohemm-action/info-old.png differ diff --git a/Mohem/src/assets/imgs/mohemm-action/info.png b/Mohem/src/assets/imgs/mohemm-action/info.png index 7d37568e..7d8f16c6 100644 Binary files a/Mohem/src/assets/imgs/mohemm-action/info.png and b/Mohem/src/assets/imgs/mohemm-action/info.png differ diff --git a/Mohem/src/assets/imgs/mohemm-action/notDoable-old.png b/Mohem/src/assets/imgs/mohemm-action/notDoable-old.png new file mode 100644 index 00000000..557ea6d3 Binary files /dev/null and b/Mohem/src/assets/imgs/mohemm-action/notDoable-old.png differ diff --git a/Mohem/src/assets/imgs/mohemm-action/notDoable.png b/Mohem/src/assets/imgs/mohemm-action/notDoable.png new file mode 100644 index 00000000..017070f5 Binary files /dev/null and b/Mohem/src/assets/imgs/mohemm-action/notDoable.png differ diff --git a/Mohem/src/assets/imgs/my-request.png b/Mohem/src/assets/imgs/my-request.png new file mode 100644 index 00000000..7fdc5539 Binary files /dev/null and b/Mohem/src/assets/imgs/my-request.png differ diff --git a/Mohem/src/assets/imgs/no-images.png b/Mohem/src/assets/imgs/no-images.png new file mode 100644 index 00000000..e4578a12 Binary files /dev/null and b/Mohem/src/assets/imgs/no-images.png differ diff --git a/Mohem/src/assets/imgs/pending-transaction.png b/Mohem/src/assets/imgs/pending-transaction.png new file mode 100644 index 00000000..d252ad43 Binary files /dev/null and b/Mohem/src/assets/imgs/pending-transaction.png differ diff --git a/Mohem/src/assets/imgs/profile-icons/family-g.svg b/Mohem/src/assets/imgs/profile-icons/family-g.svg new file mode 100644 index 00000000..553b6086 --- /dev/null +++ b/Mohem/src/assets/imgs/profile-icons/family-g.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/Mohem/src/assets/imgs/profile-icons/family.svg b/Mohem/src/assets/imgs/profile-icons/family.svg new file mode 100644 index 00000000..7bc06a07 --- /dev/null +++ b/Mohem/src/assets/imgs/profile-icons/family.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index 077e6689..1b044530 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -176,6 +176,46 @@ "check-user-text3": { "en": "will be sent to your mobile number", "ar": "سيتم ارساله الى رقم هاتفك" + }, + "current-password-validation":{ + "en":"Do not use a current password.", + "ar":"لا تستخدم كلمة المرور الحالية." + }, + "lowercase-password-validation":{ + "en":"At least one lowercase.", + "ar":"حرف صغير واحد على الأقل." + }, + "uppercase-password-validation":{ + "en":"At least one uppercase.", + "ar":"حرف كبير واحد على الأقل." + }, + "letter-password-validation":{ + "en":"At least one Letter.", + "ar":"حرف واحد على الأقل." + }, + "numerica-password-validation":{ + "en":"At least one numeric.", + "ar":"رقم واحد على الأقل." + }, + "min-password-validation":{ + "en":"Minimum 8 characters.", + "ar":"8 أحرف على الأقل." + }, + "repeating-password-validation":{ + "en":"Do not add repeating letters.", + "ar":"لا تقم بإضافة أحرف متكررة." + }, + "special-character-password-validation":{ + "en":"It should contain a special character.", + "ar":"يجب أن يحتوي على طابع خاص." + }, + "not-match-password-validation":{ + "en":"Confirm Password does not match.", + "ar":"تأكيد كلمة المرور لا يتطابق." + }, + "contain-username-password-validation":{ + "en":"The password should not contain the user name.", + "ar":"يجب ألا تحتوي كلمة المرور على اسم المستخدم." } }, "verificationcode": { @@ -209,6 +249,50 @@ } }, "general": { + "fav-showData": { + "en": "Please select an alphabet to see your favourites", + "ar": "الرجاء تحديد الأبجدية لرؤية المفضلة لديك" + }, + "fav-noData": { + "en": "No data available for favourites", + "ar": "لا توجد بيانات متاحة للمفضلة" + }, + "concurrent-report": { + "en": "Concurrent Report", + "ar": "تقرير متزامن" + }, + "update-contact": { + "en": "Update contact information", + "ar": "تحديث معلومات الاتصال" + }, + "dependent-title": { + "en": "Dependents", + "ar": "المعالين" + }, + "add-new-row": { + "en": "Add new row", + "ar": "أضف صفًا جديدًا" + }, + "contact": { + "en": "Phone Number", + "ar": "رقم الهاتف" + }, + "from-date": { + "en": "From Date", + "ar": "من التاريخ" + }, + "to-date": { + "en": "To Date", + "ar": "حتى الآن" + }, + "termination": { + "en": "Termination", + "ar": "نهاية" + }, + "pending-transaction": { + "en": "Pending Transactions", + "ar": "المعاملات المعلقة" + }, "huawei-plugin-issue": { "en": "Error while initializing Huawei Location Plugin", "ar": "خطأ أثناء تهيئة Huawei Location Plugin" @@ -1049,7 +1133,7 @@ "en": " Select the type of change you want to make.", "ar": " حدد نوع التغيير الذي تريد القيام به." }, - "try-again":{ + "try-again": { "en": "somthing went wrong please try again later", "ar": "حدث خطا الرجاء المحاولة لاحقا" }, @@ -1061,13 +1145,13 @@ "en": "Update Now", "ar": "تحديث الان" }, - "success-create":{ + "success-create": { "en": "Request has been submitted successfully", "ar": "تم تقديم الطلب بنجاح" }, - "business-card":{ - "en":"Business Card", - "ar":"بطاقة العمل" + "business-card": { + "en": "View Business Card", + "ar": "عرض بطاقة العمل" } }, "home": { @@ -1268,16 +1352,16 @@ "ar": "الوصف" }, "MyHR-request": { - "en": "MY HR REQUEST", - "ar": "طلباتي" + "en": "Mowadhafhi Request", + "ar": "طلب Mowadhafhi" }, "createHR-Request": { - "en": "CREATE HR REQUEST", - "ar": "انشاء طلب" + "en": "Create Mowadhafhi Request", + "ar": "انشاء Mowadhafhi طلب" }, "HR-Request": { - "en": "HR Request", - "ar": "HR طلبات" + "en": "Mowadhafhi", + "ar": "Mowadhafhi" }, "performance-evaluation": { "en": "Performance Evaluation", @@ -1434,6 +1518,54 @@ "postal-code": { "en": "Postal Code", "ar": "الرمز البريدي" + }, + "contact-details": { + "en": "Contact Details", + "ar": "بيانات المتصل" + }, + "family-members": { + "en": "Family Members", + "ar": "أفراد الأسرة" + }, + "profile-compitation": { + "en": "Profile Completions", + "ar": "استكمال الملف الشخصي" + }, + "work": { + "en": "Work", + "ar": "العمل" + }, + "update": { + "en": "Update", + "ar": "تعديل" + }, + "remove": { + "en": "Remove", + "ar": "حذف" + }, + "update-msg": { + "en": "Are you sure you want to update this member ?", + "ar": "هل انت متاكد من تعديل هذا العضو؟" + }, + "remove-msg": { + "en": "Are you sure you want to remove this member?", + "ar": "هل أنت متأكد أنك تريد إزالة هذا العضو؟" + }, + "update-confirm": { + "en": "member updated successfully", + "ar": "تم تعديل البيانات بنجاح" + }, + "remove-confirm": { + "en": "member removed successfully", + "ar": "تم حذف البيانات بنجاح" + }, + "note-part-1": { + "en": "Add or update information about your beneficiaries of dependants.", + "ar": "قم بإضافة أو تحديث المعلومات حول المستفيدين من المعالين." + }, + "note-part-2": { + "en": "Note: People you enter here become dependants or beneficiaries only after you complete benefits enrollment.", + "ar": "ملاحظة: الأشخاص الذين تدخلهم هنا يصبحون معالين أو مستفيدين فقط بعد إكمال تسجيل المزايا." } }, "changePassword": { @@ -1501,6 +1633,10 @@ } }, "vacation-rule": { + "effectiveDate": { + "en": "Effective Date", + "ar": "تاريخ الفعالية" + }, "vacationRule": { "en": "Vacation Rule", "ar": "الإنابة بالإجازات" @@ -1806,6 +1942,10 @@ "tickets-balance": { "en": "Ticket Balance", "ar": "رصيد التذاكر" + }, + "selectType": { + "en": "Select Type", + "ar": "اختر النوع" } }, "accrualBalances": { @@ -1878,6 +2018,18 @@ "team-stats": { "en": "Team Statistics", "ar": "إحصائيات الفريق" + }, + "subordinate-leave": { + "en": "Subordinate Leave", + "ar": "إجازة التابعيين" + }, + "select-duration": { + "en": "Select Duration", + "ar": "اختر الفترة" + }, + "no-of-days": { + "en": "No. of days", + "ar": "عدد الايام" } }, "searchForReplacment": { @@ -1982,6 +2134,18 @@ "submit": { "en": "Are you sure you want to submit?", "ar": "هل انت متاكد من ارسال الطلب؟" + }, + "cei": { + "en": "child Education", + "ar": "تعليم الطفل" + }, + "relationship-start-date": { + "en": "Relationship Start Date", + "ar": "" + }, + "relationship-end-date": { + "en": "Relationship End Date", + "ar": "" } }, "submitAbsence": { @@ -2261,23 +2425,22 @@ "en": "Favorite", "ar": "مفضل" }, - "workflow":{ - "en":"WorkFlow", - "ar":"سير العمل" + "workflow": { + "en": "WorkFlow", + "ar": "سير العمل" }, - "employee-id":{ - "en":"Employee ID", - "ar":"هوية الموظف" + "employee-id": { + "en": "Employee ID", + "ar": "هوية الموظف" }, - "employee-email":{ - "en":"Employee Email", - "ar":"البريد الإلكتروني للموظف" + "employee-email": { + "en": "Employee Email", + "ar": "البريد الإلكتروني للموظف" }, - "employee-name":{ - "en":"Employee Name", - "ar":"اسم الموظف" + "employee-name": { + "en": "Employee Name", + "ar": "اسم الموظف" } - }, "worklist": { "view": { @@ -2483,6 +2646,42 @@ "urgent": { "en": "Urgent", "ar": "عاجل" + }, + "worklist-setting": { + "en": "WORKLIST SETTINGS", + "ar": "اعدادات اشعارات" + }, + "turn-on-notification": { + "en": "Turn on notification for", + "ar": "تفعيل الاشعارات " + }, + "save-changes": { + "en": "Save Changes", + "ar": "حفظ التغيرات" + }, + "loading": { + "en": "Loading", + "ar": "يتم التحميل" + }, + "save-successfully": { + "ar": "تم حفظ التغيير بنجاح", + "en": "Your change has been saved successfully" + }, + "done-successfully": { + "ar": "تم تنفيذ الإجراء الخاص بك بنجاح!", + "en": "Your action has been executed 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": { @@ -3054,10 +3253,70 @@ } }, "itemforsale": { + "slect-source-file": { + "en": "Select source file", + "ar": "حدد مصدر الملف" + }, + "from-camera": { + "en": "Use Camera", + "ar": "استخدام الكاميرا" + }, + "from-library": { + "en": "From Library", + "ar": "من ملفات الجهاز" + }, + "from-icloud": { + "en": "From iCloud Drive", + "ar": "من iCloud Drive" + }, + "warning": { + "en": "This ad will be valid for 2 week after approval", + "ar": "هذا الإعلان ساري المفعول لمدة أسبوعين بعد الموافقة" + }, + "item-deleted": { + "en": "Item deleted successfully", + "ar": "تم حذف العنصر بنجاح" + }, + "locked": { + "en": "Locked", + "ar": "مقفل" + }, "title": { "en": "Item for sale", "ar": "سلعه للبيع" }, + "region": { + "en": "Region", + "ar": "منطقة" + }, + "selling-for": { + "en": "Selling for", + "ar": "بيع مقابل" + }, + "item-condition": { + "en": "Item condition", + "ar": "حالة السلعة" + }, + "new": { + "en": "New", + "ar": "جديد" + }, + "used": { + "en": "Used", + "ar": "تستخدم" + }, + "item-price": { + "en": "Item Price", + "ar": "سعر السلعة" + }, + "item-photos": { + "en": "Item Photos", + "ar": "صور البند" + }, + "offering": { + "en": "What are you offering?", + "ar": "ما الذي تعرضه؟" + }, "related-offers": { "en": "Related offers", "ar": "العروض ذات الصلة" @@ -3086,6 +3345,10 @@ "en": "Add Details", "ar": "أضف التفاصيل" }, + "item-info": { + "en": "Item Info", + "ar": "معلومات العنصر" + }, "review-sell": { "en": "Review & Sell", "ar": "مراجعة وبيع" @@ -3097,6 +3360,10 @@ "offersdiscount": { "en": "Offers & Discount", "ar": "العروض والخصومات" + }, + "location": { + "en": "Offer Location", + "ar": "عرض الموقع" } }, "attendance-tracking": { @@ -3235,6 +3502,56 @@ "give-comments": { "en": "Please give us a comments", "ar": "من فضلك اعطنا تعليقات" + }, + "survey-success": { + "en": "Your survey has been submitted successfully", + "ar": "تم تقديم الاستبيان الخاص بك بنجاح" + }, + "erm-failed": { + "en": "Something went wrong please try again", + "ar": "حدث خطأ ما. أعد المحاولة من فضلك" + }, + "viedo-success": { + "en": "Thank you for watching this video", + "ar": "شكرا لك على مشاهدة هذا الفيديو" + } + }, + "transaction": { + "created-for": { + "en": "Created for", + "ar": "خلقت ل" + }, + "created-date": { + "en": "Created Date", + "ar": "تاريخ الإنشاء" + }, + "request-type": { + "en": "Request type", + "ar": "نوع الطلب" + }, + "request-generated": { + "en": "Your Request for report has been sent to the server, click below link to check status", + "ar": "تم إرسال طلبك عن التقرير إلى الخادم، انقر فوق الرابط أدناه للتحقق من الحالة" + }, + "check-status": { + "en": "Refresh", + "ar": "ينعش" + }, + "phase": { + "en": "Phase", + "ar": "مرحلة" + }, + "program-name": { + "en": "Program Name", + "ar": "إسم البرنامج" + }, + "request-id": { + "en": "Request ID", + "ar": "طلب معرف" + }, + "output": { + "en": "Output", + "ar": "انتاج" } } } \ No newline at end of file diff --git a/Mohem/src/index.html b/Mohem/src/index.html index 2150180d..3d607717 100644 --- a/Mohem/src/index.html +++ b/Mohem/src/index.html @@ -11,6 +11,8 @@ + diff --git a/Mohem/src/theme/styles.scss b/Mohem/src/theme/styles.scss index 2d06bd96..e5217a79 100644 --- a/Mohem/src/theme/styles.scss +++ b/Mohem/src/theme/styles.scss @@ -1176,7 +1176,7 @@ border:0px } .logoHeader { - max-width: 130%; + max-width: 70%; width: 130%; border: 0px; } @@ -1561,6 +1561,15 @@ table.monthview-datetable th small { position: absolute; display: block; } + .business-card-modal-css .modal-wrapper{ + height: 500px; + width: 300px; + top: 50%; + position: absolute; + display: block; + margin-top: -250px; + } + .app-update-modal-css .modal-wrapper{ border-radius: 0px !important; } @@ -1617,3 +1626,27 @@ ion-segment-button { .top-filter svg { margin-top: 15px !important; } + +.disabledField{ + opacity: .5; + pointer-events: none; +} + +.filterClass input{ + box-shadow: none !important; + -webkit-box-shadow: none !important; + } + .select-alert .alert-radio-label{ + + font-size: 12px !important; + } + .modal-image-viewer-landscape { + --height: 35% !important; + --width: 90% !important; + --border-radius: 0.4cm; + } + .modal-image-viewer-portrait { + --height: 45% !important; + --width: 60% !important; + --border-radius: 0.4cm; + } \ No newline at end of file