diff --git a/Mohem/src/app/app-routing.module.ts b/Mohem/src/app/app-routing.module.ts index ce2095cd..c6a651c9 100644 --- a/Mohem/src/app/app-routing.module.ts +++ b/Mohem/src/app/app-routing.module.ts @@ -1,46 +1,47 @@ -import { NgModule } from '@angular/core'; -import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; - - -const routes: Routes = [ - { path: '', redirectTo: 'authentication/login', pathMatch: 'full' }, - { - path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule' - }, - { path: 'home', loadChildren: './home/home.module#HomePageModule' }, - { path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' }, - { path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' }, - { path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' }, - { path: 'my-team', loadChildren: './my-team/my-team.module#MyTeamPageModule' }, - { path: 'attendance', loadChildren: './attendance/attendance.module#AttendancePageModule' }, - { path: 'eit', loadChildren: './eit/eit.module#EITPageModule' }, - { path: 'absence', loadChildren: './absence/absence.module#AbsencePageModule' }, - { path: 'notification', loadChildren: './notification/notification.module#NotificationPageModule' }, - { path: 'my-specialist', loadChildren: './my-specialist/my-specialist.module#MySpecialistPageModule' }, - { path: 'my-subordinate', loadChildren: './my-subordinate/my-subordinate.module#MySubordinatePageModule' }, - { path: 'time-card', loadChildren: './time-card/time-card.module#TimeCardPageModule' }, - { path: 'payslip', loadChildren: './payslip/payslip.module#PayslipPageModule' }, - { path: 'attendance-tracking', loadChildren: './attendance-tracking/attendance-tracking.module#AttendanceTrackingPageModule' }, - { path: 'itemforsale', loadChildren: './itemforsale/itemforsale.module#ItemforsalePageModule' }, - { 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: 'reports', loadChildren: './reports/reports.module#ReportsPageModule' }, - { path: 'concurrent-report', loadChildren: './reports/concurrent-report/concurrent-report.module#ConcurrentReportPageModule' }, +import { NgModule } from '@angular/core'; +import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; + + +const routes: Routes = [ + { path: '', redirectTo: 'authentication/login', pathMatch: 'full' }, + { + path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule' + }, + { path: 'home', loadChildren: './home/home.module#HomePageModule' }, + { path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' }, + { path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' }, + { path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' }, + { path: 'my-team', loadChildren: './my-team/my-team.module#MyTeamPageModule' }, + { path: 'attendance', loadChildren: './attendance/attendance.module#AttendancePageModule' }, + { path: 'eit', loadChildren: './eit/eit.module#EITPageModule' }, + { path: 'absence', loadChildren: './absence/absence.module#AbsencePageModule' }, + { path: 'notification', loadChildren: './notification/notification.module#NotificationPageModule' }, + { path: 'my-specialist', loadChildren: './my-specialist/my-specialist.module#MySpecialistPageModule' }, + { path: 'my-subordinate', loadChildren: './my-subordinate/my-subordinate.module#MySubordinatePageModule' }, + { path: 'time-card', loadChildren: './time-card/time-card.module#TimeCardPageModule' }, + { path: 'payslip', loadChildren: './payslip/payslip.module#PayslipPageModule' }, + { path: 'attendance-tracking', loadChildren: './attendance-tracking/attendance-tracking.module#AttendanceTrackingPageModule' }, + { path: 'itemforsale', loadChildren: './itemforsale/itemforsale.module#ItemforsalePageModule' }, + { 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: 'reports', loadChildren: './reports/reports.module#ReportsPageModule' }, + { path: 'termination', loadChildren: './termination/termination.module#TerminationPageModule' }, { path: 'pending-transaction', loadChildren: './pending-transaction/pending-transaction.module#PendingTransactionPageModule' } - - - - -]; - -@NgModule({ - imports: [ - /*RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules}),*/ - RouterModule.forRoot(routes), - ], - exports: [RouterModule] -}) -export class AppRoutingModule { } + + + + +]; + +@NgModule({ + imports: [ + /*RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules}),*/ + RouterModule.forRoot(routes), + ], + exports: [RouterModule] +}) +export class AppRoutingModule { } 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/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/hmg-common/services/common/common.service.ts b/Mohem/src/app/hmg-common/services/common/common.service.ts index c3ca3b8a..a9f6cf0d 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -1290,6 +1290,13 @@ 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 openConfirmAddAddress() { this.nav.navigateForward(['/profile/confirm-add-address']); } 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 a6f466e6..1618761d 100644 --- a/Mohem/src/app/itemforsale/item-details/item-details.component.html +++ b/Mohem/src/app/itemforsale/item-details/item-details.component.html @@ -12,9 +12,13 @@
- - - + + + + + + {{itemDetails.title}} {{itemDetails.title_Ar}} 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 f326a1ad..64fe825a 100644 --- a/Mohem/src/app/itemforsale/item-details/item-details.component.ts +++ b/Mohem/src/app/itemforsale/item-details/item-details.component.ts @@ -3,6 +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 { ItemForSaleService } from '../services/service.service'; import * as moment from 'moment'; +import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; @Component({ selector: 'app-item-details', templateUrl: './item-details.component.html', @@ -12,7 +13,7 @@ export class ItemDetailsComponent implements OnInit { itemDetails: any = {}; direction: any; - constructor(public ts: TranslatorService, public cs: CommonService,) { } + constructor(public ts: TranslatorService, public cs: CommonService, private sanitizer: DomSanitizer,) { } ngOnInit() { this.direction = TranslatorService.getCurrentDirection(); @@ -22,5 +23,7 @@ export class ItemDetailsComponent implements OnInit { 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/items/items.component.html b/Mohem/src/app/itemforsale/items/items.component.html index 3334792c..732b701b 100644 --- a/Mohem/src/app/itemforsale/items/items.component.html +++ b/Mohem/src/app/itemforsale/items/items.component.html @@ -62,8 +62,8 @@ - - + + {{item.title}} {{item.title_Ar}} diff --git a/Mohem/src/app/itemforsale/items/items.component.ts b/Mohem/src/app/itemforsale/items/items.component.ts index a8ddc4a3..b077547c 100644 --- a/Mohem/src/app/itemforsale/items/items.component.ts +++ b/Mohem/src/app/itemforsale/items/items.component.ts @@ -4,6 +4,7 @@ import { TranslatorService } from 'src/app/hmg-common/services/translator/transl 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'; @Component({ selector: 'app-items', @@ -19,7 +20,7 @@ export class ItemsComponent implements OnInit { pageNo: number = 1; tempSearch: any = []; itemsByEmployee: any = []; - constructor(public ts: TranslatorService, public cs: CommonService, private itemService: ItemForSaleService) { } + constructor(public ts: TranslatorService, private sanitizer: DomSanitizer, public cs: CommonService, private itemService: ItemForSaleService) { } ngOnInit() { @@ -96,4 +97,8 @@ export class ItemsComponent implements OnInit { 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/pending-transaction/home/home.component.html b/Mohem/src/app/pending-transaction/home/home.component.html index 5169ef68..2f577610 100644 --- a/Mohem/src/app/pending-transaction/home/home.component.html +++ b/Mohem/src/app/pending-transaction/home/home.component.html @@ -8,54 +8,57 @@
+
- - {{ 'general,select' | translate}} - - - {{ transaction.FUNCTION_PROMPT}} - - +
+ + +
+
- - -
+ + +
+ {{ 'general,from-date' | translate}} -
- - -
+ + +
+ {{ 'general,to-date' | translate}} -
- +
@@ -67,20 +70,22 @@
- +
{{transaction.CREATION_DATE}}
-

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

+

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

{{transaction.TRANSACTION_CREATED_FOR}}

-

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

-

{{transaction.REQUEST_TYPE}}

+
+

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

+

{{transaction.REQUEST_TYPE}}

+
-
+
@@ -88,7 +93,10 @@
- + {{'general, submit' | translate}} + + {{'general, reset' | translate}}
-
\ No newline at end of file + + diff --git a/Mohem/src/app/pending-transaction/home/home.component.scss b/Mohem/src/app/pending-transaction/home/home.component.scss index 17285bed..f2672ac2 100644 --- a/Mohem/src/app/pending-transaction/home/home.component.scss +++ b/Mohem/src/app/pending-transaction/home/home.component.scss @@ -3,23 +3,105 @@ 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: 12px; + font-size: 14px; padding: 10px; right: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: 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.ts b/Mohem/src/app/pending-transaction/home/home.component.ts index 51d218e8..e722d588 100644 --- a/Mohem/src/app/pending-transaction/home/home.component.ts +++ b/Mohem/src/app/pending-transaction/home/home.component.ts @@ -37,7 +37,7 @@ export class HomeComponent implements OnInit { getPendingRequestDetails() { this.cs.startLoading(); this.trServcice.getPendingRequestDetails({ - 'P_FUNCTION_ID': this.selectedTransaction.FUNCTION_ID, + '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, 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..967ce56e --- /dev/null +++ b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.html @@ -0,0 +1,27 @@ + + + + + + + + Effective Date + {{showEffectiveDate}} + +
+
+
+
+ + +
+ + {{'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..e69de29b 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..ac441f89 --- /dev/null +++ b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.ts @@ -0,0 +1,1796 @@ + +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 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; + + constructor( + public modalController: ModalController, + public cs: CommonService, + private 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 : []; + + //this.employeeBasicDetails = this.cs.sharedService.getSharedData('employeeDetails', 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() { + + 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, + + }; + this.profileService.getContactDFFStrutre(body).subscribe((result: any) => { + this.handleBasicDffStructureResult(result); + }); + } + 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); + } + } + + 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 = []; + 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 + ); + 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; + } + } + + 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.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++) { + 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 + + 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 handleBasicdetailsResult(result) { + if (this.cs.validResponse(result)) { + 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(); + } + } + + 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_CONTACT_RELATIONSHIP_ID: null, + P_ACTION_TYPE: this.employeeBasicDetails.length > 0 ? 'UPDATE' : this.isDelete ? 'REMOVE' : 'ADD' + }; + console.log(this.basicRequest); + + this.profileService.submitContactTransaction(this.basicRequest).subscribe((result: any) => { + this.handleBasicdetailsResult(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..f84248f9 100644 --- a/Mohem/src/app/profile/confirm-address/confirm-address.component.ts +++ b/Mohem/src/app/profile/confirm-address/confirm-address.component.ts @@ -62,7 +62,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 +98,16 @@ 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; + } 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 +161,11 @@ export class ConfirmAddressComponent implements OnInit { this.handleAddAttachmentResults(result); }); } else { - this.startEITApprovalProcess(); + if (this.isContact) { + this.startEITContactApprovalProcess(); + } else { + this.startEITApprovalProcess(); + } } // } } @@ -179,7 +191,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 +209,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; 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..ba2a4760 --- /dev/null +++ b/Mohem/src/app/profile/contact/contact.component.scss @@ -0,0 +1,118 @@ +.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; +} +.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/home/home.component.html b/Mohem/src/app/profile/home/home.component.html index fc9399c8..49d292bc 100644 --- a/Mohem/src/app/profile/home/home.component.html +++ b/Mohem/src/app/profile/home/home.component.html @@ -51,10 +51,10 @@ {{ts.trPK('general','basic-details')}}
- +
- - + + {{ts.trPK('userProfile','contact-details')}}
@@ -147,10 +147,10 @@

{{personalInfo.EMPLOYEE_MOBILE_NUMBER}}

- +
@@ -209,7 +209,7 @@ - + @@ -219,26 +219,27 @@
- + - +
+
+
-

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

+

{{phone.PHONE_TYPE_MEANING}}

-

0567845661

+

{{phone.PHONE_NUMBER}}

+

- -

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

-
-

4922

-
+
+
+ @@ -322,17 +323,32 @@ --> +
+ + + + + +

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

+
+
-
+ + + + + + +
-

{{data.name}}

+

{{data.CONTACT_NAME}}

-
+

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

@@ -340,7 +356,7 @@ -

{{data.relation}}

+

{{data.RELATIONSHIP}}

diff --git a/Mohem/src/app/profile/home/home.component.ts b/Mohem/src/app/profile/home/home.component.ts index ffe60075..d9f61f5b 100644 --- a/Mohem/src/app/profile/home/home.component.ts +++ b/Mohem/src/app/profile/home/home.component.ts @@ -21,18 +21,7 @@ import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-respo export class HomeComponent implements OnInit { public familyMemberData = [ - { - name: 'test', - relation: 'Father' - }, - { - name: 'test 1', - relation: 'Son' - }, - { - name: 'test 2', - relation: 'daughter' - }, + ] public direction: string; @@ -57,6 +46,7 @@ export class HomeComponent implements OnInit { public menuEntries: any; public basicDetailsSubMenu: any; public addressSubMenu: any; + public dependentDetails: any; public transactionNo = 0; public address: any; public street: any; @@ -68,7 +58,10 @@ export class HomeComponent implements OnInit { public employeeAdress: any = []; public jobName: any; public profileProgress = 84; - + public contactSegment: boolean = false; + public phoneNumbers: any = []; + public objectLists: any = []; + public familyMemberDataDetails: any = []; constructor( public ts: TranslatorService, public cs: CommonService, @@ -119,10 +112,12 @@ export class HomeComponent implements OnInit { ngOnInit() { this.getProfile(); + this.menuEntries = this.cs.sharedService.getSharedData('menuEntries', false); if (this.menuEntries) { this.setMenuEntries(); } + } public setMenuEntries() { @@ -143,6 +138,9 @@ export class HomeComponent implements OnInit { if (personalInfoNestedChildren[k].REQUEST_TYPE === 'ADDRESS') { this.addressSubMenu = personalInfoNestedChildren[k]; } + if (personalInfoNestedChildren[k].REQUEST_TYPE === 'CONTACT') { + this.dependentDetails = personalInfoNestedChildren[k]; + } } } } @@ -157,6 +155,9 @@ export class HomeComponent implements OnInit { if (menuEntriesLocalArray[i].REQUEST_TYPE === 'ADDRESS') { this.addressSubMenu = menuEntriesLocalArray[i]; } + if (menuEntriesLocalArray[i].REQUEST_TYPE === 'CONTACT') { + this.dependentDetails = menuEntriesLocalArray[i]; + } } } console.log(this.basicDetailsSubMenu); @@ -164,14 +165,15 @@ export class HomeComponent implements OnInit { } public getProfile() { - console.log('getProfile'); + this.authService .loadAuthenticatedUser() .subscribe((user: AuthenticatedUser) => { if (user) { console.log(user); this.personalInfo = user; - + this.getPhoneNumbers(); + this.getContactInfo(); let jobTitle = user.POSITION_NAME.split('.'); if (jobTitle && jobTitle.length > 1) { this.jobName = jobTitle[0] + " " + jobTitle[1]; @@ -287,6 +289,7 @@ export class HomeComponent implements OnInit { this.editBasic = false; this.editAddress = false; this.familyMemberSegment = false; + this.contactSegment = false; break; case "basic": this.personalInfoSegment = false; @@ -295,6 +298,7 @@ export class HomeComponent implements OnInit { this.editBasic = false; this.editAddress = false; this.familyMemberSegment = false; + this.contactSegment = false; break; case "address": this.personalInfoSegment = false; @@ -303,6 +307,7 @@ export class HomeComponent implements OnInit { this.editBasic = false; this.editAddress = false; this.familyMemberSegment = false; + this.contactSegment = false; break; case "family": this.personalInfoSegment = false; @@ -311,6 +316,16 @@ export class HomeComponent implements OnInit { this.editBasic = false; this.editAddress = false; this.familyMemberSegment = true; + this.contactSegment = false; + break; + case "contact": + this.personalInfoSegment = false; + this.basicDetailsSegment = false; + this.addressSegment = false; + this.editBasic = false; + this.editAddress = false; + this.familyMemberSegment = false; + this.contactSegment = true; break; } } @@ -319,7 +334,7 @@ export class HomeComponent implements OnInit { let selMenu: MenuResponse = new MenuResponse(); selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); - selMenu.GetMenuEntriesList = allowVal === 'basic' ? this.basicDetailsSubMenu : this.addressSubMenu; + selMenu.GetMenuEntriesList = allowVal === 'basic' ? this.basicDetailsSubMenu : allowVal === 'add-update-contact' ? this.dependentDetails : this.addressSubMenu; this.cs.sharedService.setSharedData(selMenu, MenuResponse.SHARED_DATA); if (allowVal === 'basic') { @@ -327,6 +342,13 @@ export class HomeComponent implements OnInit { // tslint:disable-next-line: max-line-length this.cs.sharedService.setSharedData({ dirfromNotificationPage: false, submitEITObjList: undefined, transNo: this.transactionNo }, 'AddEITData'); this.openAddBasicDetails(); + } else if (allowVal == 'contact') { + + this.openContact() + } else if ('add-update-contact') { + this.transactionNo++; + this.cs.sharedService.setSharedData({ dirfromNotificationPage: false, submitEITObjList: undefined, transNo: this.transactionNo }, 'AddEITData'); + this.cs.openAddUpdateContact(); } else { this.openAddAddress(); } @@ -385,7 +407,9 @@ export class HomeComponent implements OnInit { this.cs.openAddAddress(); } } - + public openContact() { + this.cs.openAddContact(); + } public openAddBasicDetails() { if (this.basicDetailsSubMenu && this.basicDetailsSubMenu.UPDATE_BUTTON === 'Y') { this.presentModal('basicDetails'); @@ -393,26 +417,53 @@ export class HomeComponent implements OnInit { this.cs.openAddBasicDetails('correct'); } } - public editPhone() { - this.getObjectValues(); - } - public createPhone() { + + getPhoneNumbers() { + this.cs.startLoading(); + this.profileService.getPhoneNumbers({ + P_MENU_TYPE: "E", + P_SELECTED_RESP_ID: -999 + }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { + if (this.cs.validResponse(response)) { + this.cs.stopLoading(); + this.phoneNumbers = response['GetEmployeePhonesList']; + this.cs.sharedService.setSharedData(this.phoneNumbers, ProfileService.EMP_PHONE); + } + }) } - getObjectValues() { - this.profileService.getObjectValue({ - P_OBJECT_TYPE: 'LOOKUP', - P_OBJECT_NAME: 'PHONE_TYPE' + getContactInfo() { + this.profileService.getContactInfo({ + P_MENU_TYPE: "E", + P_SELECTED_RESP_ID: -999 }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { - console.log(response); + if (this.cs.validResponse(response)) { + this.familyMemberData = response['GetEmployeeContactsList']; + this.cs.sharedService.setSharedData(this.familyMemberData, ProfileService.EMP_CONTACT); + } }) + } - updateFunction() { + + updateFunction(contact) { // this.cs.presentAlert(this.ts.trPK('general', 'error-itg')); this.cs.presentConfirmDialog(this.ts.trPK('userProfile', 'update-msg'), () => { + this.profileService.getContactDetails({ + P_MENU_TYPE: "E", + P_SELECTED_RESP_ID: -999, + P_CONTACT_RELATIONSHIP_ID: contact['CONTACT_RELATIONSHIP_ID'] + }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { + if (this.cs.validResponse(response)) { + this.familyMemberDataDetails = response['GetEmployeeContactDetailsList']; + this.cs.sharedService.setSharedData(this.familyMemberDataDetails, ProfileService.EMP_CONTACT_DETAILS); + this.allowEdit('add-update-contact'); + + + } + }) this.cs.greenToastPK("userProfile", "update-confirm"); }); } @@ -422,5 +473,6 @@ export class HomeComponent implements OnInit { this.cs.redToastPK("userProfile", "remove-confirm"); }); } + } diff --git a/Mohem/src/app/profile/models/contact.request.ts b/Mohem/src/app/profile/models/contact.request.ts new file mode 100644 index 00000000..7646184e --- /dev/null +++ b/Mohem/src/app/profile/models/contact.request.ts @@ -0,0 +1,12 @@ +import { EitTransactionModel } from './eit.transaction.model'; + +export class ContactRequest { + public static SHARED_DATA = 'basic-request'; + public P_MENU_TYPE: string; + public P_SELECTED_EMPLOYEE_NUMBER: string; + public P_FUNCTION_NAME: string; + public P_SELECTED_RESP_ID: Number; + public P_CONTACT_RELATIONSHIP_ID: number; + EITTransactionTBL: EitTransactionModel[]; + P_ACTION_TYPE: string; +} \ No newline at end of file diff --git a/Mohem/src/app/profile/profile.module.ts b/Mohem/src/app/profile/profile.module.ts index 42bd13b9..2ae8004b 100644 --- a/Mohem/src/app/profile/profile.module.ts +++ b/Mohem/src/app/profile/profile.module.ts @@ -23,6 +23,8 @@ 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'; const routes: Routes = [ { path: '', @@ -44,6 +46,14 @@ const routes: Routes = [ { path: 'confirm-basic', component: ConfirmBasicDetailsComponent + }, + { + path: 'contact', + component: ConatactComponent + }, + { + path: 'add-update-contact', + component: AddUpdateContactComponent } ], }, @@ -116,7 +126,10 @@ const routes: Routes = [ AddBasicDetailsComponent, ConfirmAddressComponent, ConfirmBasicDetailsComponent, - AddBasicDetailsComponent], + ConatactComponent, + AddBasicDetailsComponent, + AddUpdateContactComponent + ], 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 a16ccf89..d298bbc7 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 startPhoneProcess = 'Services/ERP.svc/REST/START_PHONES_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'; @@ -32,11 +33,24 @@ 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'; constructor( public con: ConnectorService, public authService: AuthenticationService @@ -117,11 +131,22 @@ 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); @@ -135,4 +160,45 @@ export class ProfileService { 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.ts b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.ts index 1c583432..7e6d9844 100644 --- a/Mohem/src/app/reports/concurrent-report/concurrent-report.component.ts +++ b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.ts @@ -922,9 +922,11 @@ export class ConcurrentReportComponent implements OnInit { 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.cs.stopLoading(); this.handleSubmitAbsence(result); }); } diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index 772a02e7..24bbab1f 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -213,6 +213,22 @@ "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": "من التاريخ" @@ -1455,53 +1471,53 @@ "en": "Postal Code", "ar": "الرمز البريدي" }, - "contact-details":{ - "en":"Contact Details", - "ar":"بيانات المتصل" + "contact-details": { + "en": "Contact Details", + "ar": "بيانات المتصل" }, - "family-members":{ - "en":"Family Members", - "ar":"أفراد الأسرة" + "family-members": { + "en": "Family Members", + "ar": "أفراد الأسرة" }, - "profile-compitation":{ - "en":"Profile Completions", - "ar":"استكمال الملف الشخصي" + "profile-compitation": { + "en": "Profile Completions", + "ar": "استكمال الملف الشخصي" }, - "work":{ - "en":"Work", - "ar":"العمل" + "work": { + "en": "Work", + "ar": "العمل" }, - "update":{ - "en":"Update", - "ar":"تعديل" + "update": { + "en": "Update", + "ar": "تعديل" }, - "remove":{ - "en":"Remove", - "ar":"حذف" + "remove": { + "en": "Remove", + "ar": "حذف" }, - "update-msg":{ - "en":"Are you sure you want update this member ?", - "ar":"هل انت متاكد من تعديل هذا العضو؟" + "update-msg": { + "en": "Are you sure you want update this member ?", + "ar": "هل انت متاكد من تعديل هذا العضو؟" }, - "remove-msg":{ - "en":"Are you sure you want rmove this member ?", - "ar":"هل انت متاكد من حذف هذا العضو ؟" + "remove-msg": { + "en": "Are you sure you want rmove this member ?", + "ar": "هل انت متاكد من حذف هذا العضو ؟" }, - "update-confirm":{ - "en":"member updated successfully", - "ar":"تم تعديل البيانات بنجاح" + "update-confirm": { + "en": "member updated successfully", + "ar": "تم تعديل البيانات بنجاح" }, - "remove-confirm":{ - "en":"member removed 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-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":"ملاحظة: الأشخاص الذين تدخلهم هنا يصبحون معالين أو مستفيدين فقط بعد إكمال تسجيل المزايا." + "note-part-2": { + "en": "Note: People you enter here become dependants or beneficiaries only after you complete benefits enrollment.", + "ar": "ملاحظة: الأشخاص الذين تدخلهم هنا يصبحون معالين أو مستفيدين فقط بعد إكمال تسجيل المزايا." } }, "changePassword": { @@ -2555,17 +2571,17 @@ "en": "Urgent", "ar": "عاجل" }, - "worklist-setting":{ - "en":"WORKLIST SETTINGS", - "ar":"اعدادات اشعارات" + "worklist-setting": { + "en": "WORKLIST SETTINGS", + "ar": "اعدادات اشعارات" }, - "turn-on-notification":{ - "en":"Turn on notification for", - "ar":"تفعيل الاشعارات " + "turn-on-notification": { + "en": "Turn on notification for", + "ar": "تفعيل الاشعارات " }, - "save-changes":{ - "en":"Save Changes", - "ar":"حفظ التغيرات" + "save-changes": { + "en": "Save Changes", + "ar": "حفظ التغيرات" } }, "worklistMain": { diff --git a/Mohem/webpack.config.js b/Mohem/webpack.config.js new file mode 100644 index 00000000..8e27fdec --- /dev/null +++ b/Mohem/webpack.config.js @@ -0,0 +1,15 @@ +module.exports = { + module: { + rules: [ + { + test: /\.*pdfjs-dist.*$/, + use: { + loader: 'babel-loader', + options: { + presets: ['@babel/preset-env'] + } + } + } + ] + } +}; \ No newline at end of file