diff --git a/Mohem/src/app/app.component.ts b/Mohem/src/app/app.component.ts index 3f24ffbf..40b54e26 100644 --- a/Mohem/src/app/app.component.ts +++ b/Mohem/src/app/app.component.ts @@ -9,9 +9,10 @@ import { PushService } from '../../src/app/hmg-common/services/push/push.service import { LazyLoadingService } from './hmg-common/services/lazy-loading/lazy-loading.service'; import { DomSanitizer } from '@angular/platform-browser'; import { SplashScreen } from '@ionic-native/splash-screen/ngx'; -import { Router } from '@angular/router'; +import { Router, NavigationEnd } from '@angular/router'; import { DigitalIdComponent } from './authentication/digital-id/digital-id.component'; import { checkAndUpdatePureExpressionInline } from '@angular/core/src/view/pure_expression'; +import { FirebaseX } from '@ionic-native/firebase-x/ngx'; @Component({ selector: 'app-root', @@ -56,6 +57,7 @@ export class AppComponent implements OnInit { public router: Router, public modalController: ModalController, public nav: NavController, + public firebasex: FirebaseX ) { this.events.subscribe('img-change', displayImg => { console.log('app compont: ' + displayImg); @@ -83,6 +85,7 @@ export class AppComponent implements OnInit { this.ts.loadResources(() => { this.isIOS = this.platform.is('ios') ? true : false; this.initializeDirection(); + this.monitorAnalytics(); this.start = true; if (this.isIOS) { this.monitUrlChange(); @@ -105,6 +108,24 @@ export class AppComponent implements OnInit { }); } + public monitorAnalytics() { + this.router.events.subscribe((val) => { + if (val instanceof NavigationEnd) { + const lastIndex = val.urlAfterRedirects.lastIndexOf('/'); + const currentPageName = val.urlAfterRedirects.substr(lastIndex + 1); + this.setScreenNameAnalytics(currentPageName); + } + }); + } + + public setScreenNameAnalytics(currentPageName: string) { + try { + this.firebasex.setScreenName(currentPageName).then((result)=>{ + console.log(result); + }); + } catch (Error) { } + } + private startReceivingPushService() { this.pushService.startReceiving(); setTimeout(() => { 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 c62a99f8..cba9d334 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -1090,6 +1090,9 @@ export class CommonService { public openConfirmEitPage() { this.nav.navigateForward(['/eit/confirm-add-eit']); } + public openConfirmBasicDetailsPage() { + this.nav.navigateForward(['/profile/confirm-basic']); + } public openHome() { this.nav.navigateRoot(['/home']); } @@ -1116,8 +1119,13 @@ export class CommonService { public openEditProfile() { this.nav.navigateForward(['/profile/editprofile']); } - public openAddBasicDetails() { - this.nav.navigateForward(['/profile/addBasicDetails']); + public openAddBasicDetails(target: string) { + const navigationExtras: NavigationExtras = { + queryParams: { + targetValue: target + } + }; + this.nav.navigateForward(['/profile/addBasicDetails'], navigationExtras); } public openAccuralPage() { this.nav.navigateForward(['/accrual-balances/home']); 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 a1e05362..4320e42f 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 @@ -37,7 +37,7 @@ {{'replacementRoll, searchBy' | translate}} - + {{'addAttach, name' | translate}} @@ -50,6 +50,10 @@ {{'general, email' | translate}} + + + {{'replacementRoll, favorite' | translate}} + @@ -92,7 +96,7 @@
- +
@@ -101,7 +105,7 @@ - + {{employee.EMPLOYEE_DISPLAY_NAME}} @@ -119,11 +123,11 @@
- + -
+
{{'replacementRoll, favorite' | translate}}
@@ -150,10 +154,9 @@
-
Transaction Successful
-
+
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 bf94ef38..58101d5d 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 @@ -62,4 +62,6 @@ .square{ clear: both; } - \ No newline at end of file + .top-radio-row{ + font-size: 12px; + } \ No newline at end of file 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 28a21eb2..ad44b1fb 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 @@ -19,7 +19,7 @@ {{'replacementRoll, searchBy' | translate}} - + {{'addAttach, name' | translate}} @@ -32,6 +32,11 @@ {{'general, email' | translate}} + + + {{'replacementRoll, favorite' | translate}} + + @@ -59,7 +64,7 @@
-
+
{{'replacementRoll, related' | translate}}
@@ -84,7 +89,7 @@

-
+
{{'replacementRoll, favorite' | translate}}
@@ -94,7 +99,7 @@
- + {{employee.EMPLOYEE_DISPLAY_NAME}} @@ -135,9 +140,9 @@
- +
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 66791851..ee794132 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 @@ -197,4 +197,6 @@ ion-radio{ float: left; margin: 10px 5px; } - \ No newline at end of file + .top-radio-row{ + font-size: 12px; + } \ No newline at end of file diff --git a/Mohem/src/app/offersdiscount/home/home.component.ts b/Mohem/src/app/offersdiscount/home/home.component.ts index 7a7fc8c0..3290aa8c 100644 --- a/Mohem/src/app/offersdiscount/home/home.component.ts +++ b/Mohem/src/app/offersdiscount/home/home.component.ts @@ -49,11 +49,12 @@ export class HomeComponent implements AfterViewInit { this.direction = TranslatorService.getCurrentDirection(); console.log(this.direction); let activeClass = this.cs.sharedService.getSharedData(OfferDiscountService.selected_filters); - if (activeClass) { - this.filterOffers(activeClass); - } - this.getCategories(); + // if (activeClass) { + // this.filterOffers(activeClass); + // } + this.getCategories(); + this.tempSearch = JSON.parse(JSON.stringify(this.offersData)); } getCategories() { this.offersService.getCategories({}).subscribe((result) => { diff --git a/Mohem/src/app/offersdiscount/services/service.ts b/Mohem/src/app/offersdiscount/services/service.ts index 8904ef33..7aae3117 100644 --- a/Mohem/src/app/offersdiscount/services/service.ts +++ b/Mohem/src/app/offersdiscount/services/service.ts @@ -10,6 +10,7 @@ export class OfferDiscountService { public static offersDiscountData = 'Services/COCWS.svc/REST/GetOfferDiscountsConfigData'; public static getSuborinateStatus = 'Services/ERP.svc/REST/GET_SUBORDINATES_ATTD_STATUS'; + public static categoryList = 'Services/COCWS.svc/REST/Mohemm_ITG_GetCategories'; public static selected_offers = 'selected-offers'; public static related_offers = 'related-offers'; public static selected_filters = 'selected-filters'; 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 e4082aa9..ce1335e8 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 @@ -1,20 +1,3 @@ - - + + Effective Date + {{showEffectiveDate}} +
+
- + {{'vacation-rule, next-label' | translate}}
\ No newline at end of file diff --git a/Mohem/src/app/profile/add-basic-details/add-basic-details.component.scss b/Mohem/src/app/profile/add-basic-details/add-basic-details.component.scss index 9b59e3d3..a6dbf815 100644 --- a/Mohem/src/app/profile/add-basic-details/add-basic-details.component.scss +++ b/Mohem/src/app/profile/add-basic-details/add-basic-details.component.scss @@ -37,4 +37,9 @@ 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/profile/add-basic-details/add-basic-details.component.ts b/Mohem/src/app/profile/add-basic-details/add-basic-details.component.ts index 5592e376..2e1f8ea0 100644 --- a/Mohem/src/app/profile/add-basic-details/add-basic-details.component.ts +++ b/Mohem/src/app/profile/add-basic-details/add-basic-details.component.ts @@ -22,6 +22,8 @@ import { EIT_ACTION } from "../models/submit.eit.action"; import { AddEitResponse } from "../models/add.eit.response"; import { element } from '@angular/core/src/render3'; import { EITNotificatonBodyResponse } from "../models/EITNotificationBodyRes"; +import { ActivatedRoute } from '@angular/router'; + @Component({ selector: 'app-add-basic-details', templateUrl: './add-basic-details.component.html', @@ -29,14 +31,13 @@ import { EITNotificatonBodyResponse } from "../models/EITNotificationBodyRes"; }) export class AddBasicDetailsComponent implements OnInit { @ViewChild("containerDiv") containerDiv: ElementRef; + @ViewChild("containerDivTwo") containerDivTwo: ElementRef; + - ////*new add*///// getPassNotificationDetails: any; getPassdirfromNotifiPage: boolean = false; functionName: string = ""; menuType: any; - ///////////////// - private textArea: TextAreaInput; private numberInput: NumberInput; private textInput: TextInput; @@ -47,7 +48,8 @@ export class AddBasicDetailsComponent implements OnInit { private buttonInput: ButtonInput; private hiddenInput: HiddenInput; private eitResponse: any; - + private eitColResponse: any; + private eitVALSettoCall: any = []; private comtransNo: number = 0; getPassMnuEntryObj: MenuEntry; @@ -64,6 +66,11 @@ export class AddBasicDetailsComponent implements OnInit { private updatedValues: any = []; addEITData: any; direction:string; + public targetValue: any; + public employeeBasicDetails: any = []; + public mutualBasicDetailsArray: any = []; + public effectiveDate: string; + public showEffectiveDate: string; constructor( @@ -71,8 +78,18 @@ export class AddBasicDetailsComponent implements OnInit { public cs: CommonService, private ts: TranslatorService, private profileService: ProfileService, - public datePicker: DatePicker + public datePicker: DatePicker, + public router: ActivatedRoute ) { + + this.router.queryParams.subscribe(params => { + this.targetValue = params.targetValue; + console.log(this.targetValue); + }); + + this.employeeBasicDetails = this.cs.sharedService.getSharedData('employeeDetails', false); + console.log(this.employeeBasicDetails); + this.direction = TranslatorService.getCurrentLanguageName(); this.selEmp = this.cs.sharedService.getSharedData( MenuResponse.SHARED_SEL_EMP, @@ -89,7 +106,6 @@ export class AddBasicDetailsComponent implements OnInit { ); this.addEITData = this.cs.sharedService.getSharedData("AddEITData", false); console.log("addEITData: " + this.addEITData); - // console.log("dirfromNotificationPage: " + this.addEITData.dirfromNotificationPage); this.basicRequest = new BasicRequest(); @@ -122,9 +138,7 @@ export class AddBasicDetailsComponent implements OnInit { ngOnInit() {} ngAfterViewInit() { - // this.getEitDffStructure(); - this.getColumnStructure(); - + this.getEitDffStructure(); } public getColumnStructure() { @@ -153,18 +167,210 @@ export class AddBasicDetailsComponent implements OnInit { public handleBasicColStructureResult(result) { if (result.GetBasicDetColsStructureList != null) { - this.eitResponse = result.GetBasicDetColsStructureList; - this.drawEitFields(result.GetBasicDetColsStructureList); + this.eitColResponse = result.GetBasicDetColsStructureList; + this.drawEitFieldsStatic(result.GetBasicDetColsStructureList); } } public handleBasicDffStructureResult(result) { if (result.GetBasicDetDffStructureList != null) { + this.getColumnStructure(); this.eitResponse = result.GetBasicDetDffStructureList; this.drawEitFields(result.GetBasicDetDffStructureList); } } + 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.targetValue === 'new') { + 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 + ); + + } + } + } + this.fillBasicDetailsStructure(); + } + + 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" && this.targetValue === 'new') { + // date + elemVal = this.cs.formatDate(elemVal); + } else if (this.eitColResponse[i].DATATYPE == "DATE" && this.targetValue === 'correct') { + // date + elemVal = this.customiseDate(this.effectiveDate); + } + + 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) { const containerId = "containerDiv"; this.eitVALSettoCall = []; @@ -375,7 +581,6 @@ export class AddBasicDetailsComponent implements OnInit { } closeModal() { - console.log("closeModal"); this.updatedValues = []; this.modalController.dismiss(); } @@ -407,6 +612,7 @@ export class AddBasicDetailsComponent implements OnInit { err => console.log("Error occurred while getting date: ", err) ); } + public showTimePicker(elemID, maxSize) { let elem = document.getElementById(elemID) as HTMLDivElement; let date: any; @@ -480,6 +686,21 @@ export class AddBasicDetailsComponent implements OnInit { } } + 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); @@ -949,6 +1170,7 @@ export class AddBasicDetailsComponent implements OnInit { } return isSt; } + isStandardDateTime(obj: any): boolean { let isSt: boolean = false; if (obj.FORMAT_TYPE == "Y") { @@ -965,6 +1187,7 @@ export class AddBasicDetailsComponent implements OnInit { } return isSt; } + isStandardTime(obj: any): boolean { let isSt: boolean = false; if (obj.FORMAT_TYPE == "I") { @@ -986,33 +1209,82 @@ export class AddBasicDetailsComponent implements OnInit { 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; } + 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.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.customiseDate(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++) { @@ -1094,7 +1366,7 @@ export class AddBasicDetailsComponent implements OnInit { let varcharValue: any = null; let numbervalue: any = 0; let dateValue: any = null; - let transNo: number = this.comtransNo; + let transNo: number = 1; let textValue : any; // if(this.ExtraObj.transactionNo) // transNo=this.ExtraObj.transactionNo; @@ -1214,7 +1486,28 @@ export class AddBasicDetailsComponent implements OnInit { } else { x.classList.remove("requiredClassElm"); } - if (val) varcharValue = val; + + 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, @@ -1384,6 +1677,7 @@ export class AddBasicDetailsComponent implements OnInit { values.push(obj3); return values; } + fillExtraInformation( values: any, peiAction: string, @@ -1415,16 +1709,6 @@ export class AddBasicDetailsComponent implements OnInit { return values; } - submitEit() { - let list = this.basicRequest.EITTransactionTBL; - this.basicRequest.EITTransactionTBL = this.fixTransactionNo(list); - this.profileService - .submitEit(this.basicRequest) - .subscribe((result: AddEitResponse) => { - this.handleSubmitEitResult(result); - }); - } - fixTransactionNo(transactionTBL: any): any[] { let list: any = []; let newIndex: number = 1; @@ -1453,78 +1737,37 @@ export class AddBasicDetailsComponent implements OnInit { } return list; } - handleSubmitEitResult(result) { + + public handleBasicdetailsResult(result) { if (this.cs.validResponse(result)) { - this.cs.sharedService.setSharedData( - this.basicRequest, - BasicRequest.SHARED_DATA - ); - this.cs.sharedService.setSharedData(result, AddEitResponse.SHARED_DATA); - //this.addrespList=result.SubmitEITTransactionList; - // this.itemKey=this.addrespList.P_ITEM_KEY; - // this.P_TransactionID=result.SubmitEITTransactionList.P_TRANSACTION_ID; - // this.sharedData.setSharedData(result,AddEitResponse.SHARED_DATA); - - // // this.sharedData.setSharedData(result.SubmitEITTransactionList.P_TRANSACTION_ID,"TransactionIDResubmit"); - // // this.sharedData.setSharedData(this.eitRequest,EitRequest.SHARED_DATA); - - this.cs.sharedService.setSharedData( - { isResubmit: false }, - "confirmAddEITData" - ); - this.cs.openConfirmEitPage(); - // this.navCtrl.push("ConfirmAddEitPage", { isResubmit: false }); + this.cs.sharedService.setSharedData(this.basicRequest, BasicRequest.SHARED_DATA); + this.cs.sharedService.setSharedData(result.SubmitBasicDetTransactionList, 'basic-details-response'); + // this.cs.sharedService.setSharedData({ isResubmit: false },"confirmAddEITData"); + this.cs.openConfirmBasicDetailsPage(); } } - // validateEITTransaction() { - // // let EITTransactionValues:any= []; - - // this.arrValues = this.getElementsValues(); - // if (this.arrValues) { - // this.basicRequest = { - // P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, - // P_MENU_TYPE: this.menuType, - // P_SELECTED_RESP_ID: this.respID, //this.selMenu.List_Menu.RESP_ID,//-999, - // P_FUNCTION_NAME: this.functionName, - // P_DESC_FLEX_CONTEXT_CODE: this.eitResponse[0].DESC_FLEX_CONTEXT_CODE, - // EITTransactionTBL: this.arrValues - // }; - - // this.eitService - // .validateEITTransaction(this.eitRequest) - // .subscribe((result: any) => { - // this.handleEITValidateTr(result); - // }); - // } - // } - // private handleEITValidateTr(result) { - // let data: any = { eitRequest: {}, updated: [] }; - // if (this.cs.validResponse(result)) { - // // public static SHARED_DATA = 'login-request'; - // this.cs.sharedService.setSharedData( - // this.eitRequest, - // EitRequest.SHARED_DATA - // ); - // if (this.getPassdirfromNotifiPage) { - // let data: any = { eitRequest: {}, updated: [] }; - // data.eitRequest = this.eitRequest; - // data.updated = this.updatedValues; - // // this.viewCtrl.dismiss(data); - // this.modalController.dismiss(data); - // // this.closemodal(); - // } else { - // this.submitEit(); - // // this.navCtrl.push("ConfirmAddEitPage"); - // // data = { eitRequest: {}, updated: [] }; - // // data.eitRequest = this.eitRequest; - // // data.updated = this.updatedValues; - // // this.viewCtrl.dismiss(data); - // } - // } else { - // this.updatedValues = []; - // data = { eitRequest: {}, updated: [] }; - // } - // } + public submitBasicDetailsTransaction() { + this.arrValues = this.getElementsValues(); + let staticValues = this.getElementsStaticValues(); + let allStatisDynamicValues = 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_ACTION_TYPE: this.targetValue === 'correct' ? 'CORRECT' : 'CHANGE' + }; + console.log(this.basicRequest); + + this.profileService.submitBasicDetailsTransaction(this.basicRequest).subscribe((result: any) => { + this.handleBasicdetailsResult(result); + }); + } + } + } diff --git a/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.component.html b/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.component.html index 4e678a53..5a222666 100644 --- a/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.component.html +++ b/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.component.html @@ -1,3 +1,128 @@ -

- confirm-basic-details works! -

+ + + + {{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/profile/confirm-basic-details/confirm-basic-details.component.scss b/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.component.scss index e69de29b..2ed98379 100644 --- a/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.component.scss +++ b/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.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-basic-details/confirm-basic-details.component.ts b/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.component.ts index 97213ee6..ef49d9e4 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 @@ -1,4 +1,20 @@ 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'; @Component({ selector: 'app-confirm-basic-details', @@ -7,8 +23,413 @@ import { Component, OnInit } from '@angular/core'; }) export class ConfirmBasicDetailsComponent implements OnInit { - constructor() { } + 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; - ngOnInit() {} + /***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('basic-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.startBasicDetailsApprovalProcess(); + } + } + + + 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.startBasicDetailsApprovalProcess(); + } + 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); + } + } + } + + startBasicDetailsApprovalProcess() { + 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.startBasicDetailsApprovalProcess( + 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.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/home/home.component.html b/Mohem/src/app/profile/home/home.component.html index ccef838c..962a1fdb 100644 --- a/Mohem/src/app/profile/home/home.component.html +++ b/Mohem/src/app/profile/home/home.component.html @@ -196,8 +196,7 @@ - + diff --git a/Mohem/src/app/profile/home/home.component.ts b/Mohem/src/app/profile/home/home.component.ts index 68ca831a..626c7b98 100644 --- a/Mohem/src/app/profile/home/home.component.ts +++ b/Mohem/src/app/profile/home/home.component.ts @@ -165,6 +165,7 @@ export class HomeComponent implements OnInit { this.profileService.getEmployeeBasicDetails(body).subscribe((result: any) => { if (this.cs.validResponse(result)) { this.employeeBasicDetails = result.GetEmployeeBasicDetailsList; + this.cs.sharedService.setSharedData(this.employeeBasicDetails, 'employeeDetails'); console.log(this.employeeBasicDetails); for (let i = 0; i < this.employeeBasicDetails.length; i++) { if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'FULL_NAME') { @@ -280,7 +281,7 @@ export class HomeComponent implements OnInit { this.transactionNo++; // tslint:disable-next-line: max-line-length this.cs.sharedService.setSharedData({ dirfromNotificationPage: false, submitEITObjList: undefined, transNo: this.transactionNo }, 'AddEITData'); - this.cs.openAddBasicDetails(); + this.openAddBasicDetails(); } else { this.openAddAddress(); } @@ -297,7 +298,7 @@ export class HomeComponent implements OnInit { } } - async presentModal() { + async presentModal(source: string) { const modal = await this.modalController.create({ component: EditDetailProfileComponent, cssClass: 'my-custom-modal-css' @@ -307,14 +308,18 @@ export class HomeComponent implements OnInit { .then((data) => { console.log(data); this.cs.sharedService.setSharedData(data.data, ProfileService.SELECTED_STATUS); - if (data.data && data.data.data == 1) { + if (data.data && data.data.data == 1 && source === 'address') { this.cs.sharedService.setSharedData(this.addressSubMenu, ProfileService.ADRESS_ENTRIES); this.cs.sharedService.setSharedData(this.employeeAdress, ProfileService.EMP_ADDRESS); this.cs.sharedService.setSharedData(this.country, ProfileService.COUNTRY); this.cs.openAddAddress(); - } else if (data.data && data.data.data == 2) { + } else if (data.data && data.data.data == 2 && source === 'address') { this.cs.openAddAddress(); + } else if (data.data && data.data.data == 1 && source === 'basicDetails') { + this.cs.openAddBasicDetails('correct'); + } else if (data.data && data.data.data == 2 && source === 'basicDetails') { + this.cs.openAddBasicDetails('new'); } @@ -327,14 +332,19 @@ export class HomeComponent implements OnInit { } public openAddAddress() { - if (this.addressSubMenu && this.addressSubMenu.UPDATE_BUTTON === 'Y') { - - this.presentModal(); + this.presentModal('address'); } else { this.cs.openAddAddress(); } + } + public openAddBasicDetails() { + if (this.basicDetailsSubMenu && this.basicDetailsSubMenu.UPDATE_BUTTON === 'Y') { + this.presentModal('basicDetails'); + } else { + this.cs.openAddBasicDetails('correct'); + } } } diff --git a/Mohem/src/app/profile/models/basic.request.ts b/Mohem/src/app/profile/models/basic.request.ts index a93d7d01..68f183ec 100644 --- a/Mohem/src/app/profile/models/basic.request.ts +++ b/Mohem/src/app/profile/models/basic.request.ts @@ -6,6 +6,7 @@ export class BasicRequest { public P_SELECTED_EMPLOYEE_NUMBER: string; public P_FUNCTION_NAME: string; public P_SELECTED_RESP_ID: Number; - P_DESC_FLEX_CONTEXT_CODE: string; + // P_DESC_FLEX_CONTEXT_CODE: string; EITTransactionTBL: EitTransactionModel[]; + P_ACTION_TYPE: string; } \ No newline at end of file diff --git a/Mohem/src/app/profile/service/profile.service.ts b/Mohem/src/app/profile/service/profile.service.ts index 470bef1d..0feb9512 100644 --- a/Mohem/src/app/profile/service/profile.service.ts +++ b/Mohem/src/app/profile/service/profile.service.ts @@ -19,6 +19,7 @@ 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 startBasicProcess = 'Services/ERP.svc/REST/START_BASIC_DET_APPR_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'; @@ -28,8 +29,9 @@ export class ProfileService { public static getEmployeeAddress = "Services/ERP.svc/REST/GET_EMPLOYEE_ADDRESS"; public static getCountries = "Services/ERP.svc/REST/GET_COUNTRIES"; - public static getDiffStructure = "Services/ERP.svc/REST/GET_ADDRESS_DFF_STRUCTURE" - public static submitAddressTransactions = "Services/ERP.svc/REST/SUBMIT_ADDRESS_TRANSACTION" + 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 ADRESS_ENTRIES = 'address-entries'; public static EMP_ADDRESS = 'emp-address'; @@ -110,9 +112,19 @@ export class ProfileService { this.authService.authenticateRequest(request); return this.con.post(ProfileService.submitAddressTransactions, request, onError, errorLabel); } + public submitBasicDetailsTransaction(basicDetailsRequest: any, onError?: any, errorLabel?: string): Observable { + const request = basicDetailsRequest; + this.authService.authenticateRequest(request); + return this.con.post(ProfileService.submitBasicDetailsTransaction, 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 startBasicDetailsApprovalProcess(basicDetailsProcess: any, onError?: any, errorLabel?: string): Observable { + const request = basicDetailsProcess; + this.authService.authenticateRequest(request); + return this.con.post(ProfileService.startBasicProcess, request, onError, errorLabel); + } } \ No newline at end of file