diff --git a/Mohem/src/app/app-routing.module.ts b/Mohem/src/app/app-routing.module.ts index b4b5da86..6a82720c 100644 --- a/Mohem/src/app/app-routing.module.ts +++ b/Mohem/src/app/app-routing.module.ts @@ -1,42 +1,43 @@ -import { NgModule } from '@angular/core'; -import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; +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: 'sit', loadChildren: './sit/sit.module#SitPageModule' } - -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' } - - - - -]; - -@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/hmg-common/services/common/common.service.ts b/Mohem/src/app/hmg-common/services/common/common.service.ts index cac80b88..ca30feb5 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -1116,12 +1116,21 @@ export class CommonService { public openEitListPage() { this.nav.navigateForward(['/eit/eit-list']); } + public openSitListPage() { + this.nav.navigateForward(['/sit/sit-list']); + } public openAddEitPage() { this.nav.navigateForward(['/eit/add-eit']); } + public openAddSitPage() { + this.nav.navigateForward(['/sit/add-sit']); + } public openConfirmEitPage() { this.nav.navigateForward(['/eit/confirm-add-eit']); } + public openConfirmSitPage() { + this.nav.navigateForward(['/sit/confirm-add-sit']); + } public openConfirmBasicDetailsPage() { this.nav.navigateForward(['/profile/confirm-basic']); } @@ -1165,6 +1174,9 @@ export class CommonService { public openEITPage() { this.nav.navigateForward(['/eit/homepage']); } + public openSITPage() { + this.nav.navigateForward(['/sit/homepage']); + } public openMyTeamPage() { console.log('someeeeeeee'); this.nav.navigateForward(['/my-team/home']); @@ -1299,6 +1311,9 @@ export class CommonService { public eitUpdate() { this.nav.navigateForward(['/eit/eit-update-list']); } + public sitUpdate() { + this.nav.navigateForward(['/sit/sit-update-list']); + } public openAnnouncement() { this.nav.navigateForward(['/backend-integrations/announcement']); } diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index 8a0a8063..885de8ea 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -697,8 +697,8 @@ export class HomePage implements OnInit { this.common.sharedService.setSharedData(selMenu, MenuResponse.SHARED_DATA); if (subMenu.REQUEST_TYPE === 'ABSENCE') { this.common.openAbsencePage(); - } else if (subMenu.REQUEST_TYPE === 'EIT') { - this.common.openEitListPage(); + } else if (subMenu.REQUEST_TYPE === 'SIT') { + this.common.openSitListPage(); } else if (subMenu.REQUEST_TYPE === 'PAYSLIP') { this.common.openPayslipPage(); } else if (subMenu.MENU_ENTRY_TYPE === 'MENU') { diff --git a/Mohem/src/app/sit/add-attach/add-attach.component.html b/Mohem/src/app/sit/add-attach/add-attach.component.html new file mode 100644 index 00000000..6bd3f873 --- /dev/null +++ b/Mohem/src/app/sit/add-attach/add-attach.component.html @@ -0,0 +1,77 @@ + + + + {{'general, addAttach' | translate}} + + + + + + + + + + + + + + + + + + +
{{'general, addAttach' | translate}}
+
+ +
+
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + +
+ + {{'general, ok' | translate}} +
+
\ No newline at end of file diff --git a/Mohem/src/app/sit/add-attach/add-attach.component.scss b/Mohem/src/app/sit/add-attach/add-attach.component.scss new file mode 100644 index 00000000..12e9f077 --- /dev/null +++ b/Mohem/src/app/sit/add-attach/add-attach.component.scss @@ -0,0 +1,20 @@ +.inputfile { + width: 0.1px; + height: 0.1px; + opacity: 0; + overflow: hidden; + position: absolute; + width: 40px; + height: 40px; + // z-index: -1; + } + + .imgSize { + width: 22px; + height: 22px; + } + .Header { + font-weight: bold; + color: #1a586d; + } + \ No newline at end of file diff --git a/Mohem/src/app/sit/add-attach/add-attach.component.spec.ts b/Mohem/src/app/sit/add-attach/add-attach.component.spec.ts new file mode 100644 index 00000000..d0646cb7 --- /dev/null +++ b/Mohem/src/app/sit/add-attach/add-attach.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AddAttachComponent } from './add-attach.component'; + +describe('AddAttachComponent', () => { + let component: AddAttachComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AddAttachComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AddAttachComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/sit/add-attach/add-attach.component.ts b/Mohem/src/app/sit/add-attach/add-attach.component.ts new file mode 100644 index 00000000..3a093ab4 --- /dev/null +++ b/Mohem/src/app/sit/add-attach/add-attach.component.ts @@ -0,0 +1,173 @@ +import { AddEitResponse } from './../models/add.eit.response'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { Component, OnInit } from '@angular/core'; +import { FileUploader } from 'ng2-file-upload'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { ModalController } from '@ionic/angular'; + + +@Component({ + selector: 'app-add-attach', + templateUrl: './add-attach.component.html', + styleUrls: ['./add-attach.component.scss'], +}) +export class AddAttachComponent implements OnInit { + + private eitResponse: any;//AddEitResponse=new AddEitResponse(); + isUpload: boolean = false; + inQueue: boolean = false; + addAttachmentListReq: any; + attachmentID: number = 0; + addAttachRequest: any = []; + fileData: any; + fileType: any; + index: any = 1; + dirPage: any; + TransactionID: any; + indexLastObj: any = 0; + filterAllowedType: any = ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']; + + + constructor(public cs: CommonService, public ts: TranslatorService, public modalCtrl: ModalController) { + this.eitResponse = this.cs.sharedService.getSharedData(AddEitResponse.SHARED_DATA, false); + this.TransactionID = this.cs.sharedService.getSharedData('TransactionID', false); + this.indexLastObj = this.cs.sharedService.getSharedData('indexLastObj', false); + + // console.log("this.TransactionID : "+ this.TransactionID); + this.isUpload = false; + } + + ngOnInit() { } + + public uploader: FileUploader = new FileUploader({ + allowedMimeType: ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], + maxFileSize: 10 * 1024 * 1024, + formatDataFunctionIsAsync: true, + formatDataFunction: async (item) => { + return new Promise((resolve, reject) => { + resolve({ + name: item._file.name, + length: item._file.size, + contentType: item._file.type, + date: new Date() + }); + }); + } + }); + + public hasBaseDropZoneOver: boolean = false; + public hasAnotherDropZoneOver: boolean = false; + + public fileOverBase(e: any): void { + this.hasBaseDropZoneOver = e; + } + + public fileOverAnother(e: any): void { + this.hasAnotherDropZoneOver = e; + } + + OkBtnModal() { + let fileCount: number = this.uploader.queue.length; + if (fileCount > 0) { + let data: any = this.addAttachRequest; + // this.viewCtrl.dismiss(data); + + this.modalCtrl.dismiss(data); + + } + else { + let msg: string = ""; + msg = this.ts.trPK("general", "noFileSelect"); + this.cs.presentAlert(msg); + return; + } + } // end ok button + + closeBtnModal() { + // this.viewCtrl.dismiss("cancel"); + this.modalCtrl.dismiss("cancel"); + + } + + onFileSelected(input) { + + // this.uploader.onWhenAddingFileFailed = function (item: any, filter: any, options: any){ + + if (!(this.filterAllowedType.indexOf(input.target.files[0].type) > -1)) { + let msg: string = ""; + msg = this.ts.trPK("general", "notSupport"); + this.cs.presentAlert(msg); + return + } // todo: show alert that you tried uploading wrong files + + else { + + const file = input.target.files[0]; + + // console.log(file); + + //var encoded = Base64.encode(file); + this.getBase64(file).then( + data => this.pushObject(data, file.name, file.type) + ); + + // } + // }; + + } + } + + + getBase64(file) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = () => resolve(reader.result); + reader.onerror = error => reject(error); + }); + } + + + pushObject(fileData, name, type) { + + // console.log("before push: "+ this.index); + this.indexLastObj++; + try { + let array = name.split('.'); + let attachType: string = array[array.length - 1]; + + this.addAttachRequest.push( + { + AttachmentID: this.indexLastObj, + P_FILE_CONTENT_TYPE: attachType,//type.split('/')[1], + P_FILE_DATA: fileData.split(',')[1], + P_FILE_NAME: name,//.split('.')[0], + P_TRANSACTION_ID: this.TransactionID + }) + + } catch (e) { + + } + + + //console.log("after push: "+ this.index); + // return this.addAttachRequest + } + + + removeFile(objectitem) { + + let objIndex1 = this.uploader.queue.findIndex(item => item == objectitem); + this.uploader.queue.splice(objIndex1, 1); + let objIndex = this.addAttachRequest.findIndex(item => item.AttachmentID == objectitem.AttachmentID); + this.addAttachRequest.splice(objIndex, 1); + // this.addAttachRequest =this.addAttachRequest.filter(item => item.AttachmentID !== objectitem.AttachmentID); + + } + + + + + +} + diff --git a/Mohem/src/app/sit/add-sit/add-sit.component.html b/Mohem/src/app/sit/add-sit/add-sit.component.html new file mode 100644 index 00000000..9b604048 --- /dev/null +++ b/Mohem/src/app/sit/add-sit/add-sit.component.html @@ -0,0 +1,42 @@ + + + + + + + + +
+
+
+ + +
+ + {{'vacation-rule, next-label' | translate}} +
+
\ No newline at end of file diff --git a/Mohem/src/app/sit/add-sit/add-sit.component.scss b/Mohem/src/app/sit/add-sit/add-sit.component.scss new file mode 100644 index 00000000..29af2c8c --- /dev/null +++ b/Mohem/src/app/sit/add-sit/add-sit.component.scss @@ -0,0 +1,40 @@ +.footer-button { + border-radius: 2px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; + } + + ion-label { + color: var(--customnavy) !important; + } + + .daynamicForm-Label { + font-size: 16px; + color: #a2a5a6 !important; + display: block; + overflow: hidden; + -webkit-flex: 1; + flex: 1; + font-size: inherit; + white-space: normal; + padding: 5px 0px; + margin: 10px auto; + padding-left: 10px; + } + + + .header-toolbar-new{ + --background: #29B5BF; + } + .addEitOkButton{ + white-space: normal !important; + text-transform: capitalize !important; + min-height: 45px !important; + min-width: 5px !important; + margin: 8px !important; + background-color: #29B5BF; + width: 80% !important; + color: white!important; + border-radius: 16px !important; + } \ No newline at end of file diff --git a/Mohem/src/app/sit/add-sit/add-sit.component.spec.ts b/Mohem/src/app/sit/add-sit/add-sit.component.spec.ts new file mode 100644 index 00000000..b8c629b4 --- /dev/null +++ b/Mohem/src/app/sit/add-sit/add-sit.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AddSitComponent } from './add-sit.component'; + +describe('AddSitComponent', () => { + let component: AddSitComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AddSitComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AddSitComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/sit/add-sit/add-sit.component.ts b/Mohem/src/app/sit/add-sit/add-sit.component.ts new file mode 100644 index 00000000..a89f064a --- /dev/null +++ b/Mohem/src/app/sit/add-sit/add-sit.component.ts @@ -0,0 +1,1610 @@ +import { CommonService } from "src/app/hmg-common/services/common/common.service"; +import { Component, OnInit, ViewChild, ElementRef } from "@angular/core"; +import { MenuEntry } from "src/app/hmg-common/services/menu/models/menu.entry"; +import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response"; +import { EitRequest } from "../models/eit.request"; +import { ModalController } from "@ionic/angular"; +import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service"; +import { EITTransactionsRequest } from "../models/EITTransactionsReq"; +import { EitService } from "../services/eit.service"; +import { TextAreaInput } from "src/app/uI-elements/text-area.input"; +import { NumberInput } from "src/app/uI-elements/number.input"; +import { TextInput } from "src/app/uI-elements/text.input"; +import { SelectInput } from "src/app/uI-elements/select.input"; +import { DateInput } from "src/app/uI-elements/date.input"; +import { TimeInput } from "src/app/uI-elements/time.input"; +import { DateTimeInput } from "src/app/uI-elements/date-time.input"; +import { ButtonInput } from "src/app/uI-elements/button.input"; +import { HiddenInput } from "src/app/uI-elements/hidden.input"; +import * as moment from "moment"; +import { DatePicker } from "@ionic-native/date-picker/ngx"; +import { EIT_ACTION } from "../models/submit.eit.action"; +import { AddEitResponse } from "../models/add.eit.response"; +import { element } from '@angular/core/src/render3'; +// import { EITNotificatonBodyResponse } from 'src/app/notification/models/EITNotificationBodyRes'; +import { EITNotificatonBodyResponse } from "../models/EITNotificationBodyRes"; +@Component({ + selector: 'app-add-sit', + templateUrl: './add-sit.component.html', + styleUrls: ['./add-sit.component.scss'], +}) +export class AddSitComponent implements OnInit { + @ViewChild("containerDiv") containerDiv: ElementRef; + + ////*new add*///// + getPassNotificationDetails: any; + getPassdirfromNotifiPage: boolean = false; + functionName: string = ""; + menuType: any; + ///////////////// + + private textArea: TextAreaInput; + private numberInput: NumberInput; + private textInput: TextInput; + private selectInput: SelectInput; + private dateInput: DateInput; + private timeInput: TimeInput; + private datetimeInput: DateTimeInput; + private buttonInput: ButtonInput; + private hiddenInput: HiddenInput; + private eitResponse: any; + + private eitVALSettoCall: any = []; + private comtransNo: number = 0; + // private parentChilds: any[]; + getPassMnuEntryObj: MenuEntry; + selMenu: MenuResponse; + eitSubmitAction: number = 0; //not submit + private eitRequest: EitRequest; + private validateEitObj: any = []; + private ExtraObj: any = {}; + private arrValues: any = []; + selEmp: string; + respID: number; + headerTitle: string = ""; + isResubmit: boolean = false; + //private updatedNotObject:any=[]; + private updatedValues: any = []; + addEITData: any; + direction:string; + + constructor( + public modalController: ModalController, + public cs: CommonService, + private ts: TranslatorService, + private eitService: EitService, + public datePicker: DatePicker + ) { + 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); + console.log("dirfromNotificationPage: " + this.addEITData.dirfromNotificationPage); + + this.eitRequest = new EitRequest(); + + // this.buttonInput = new ButtonInput('btnSubmit', 'Submit', 'containerDiv', 'Y'); + + ////*new add*///// + /**********resubmit************ */ + this.getPassNotificationDetails = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.NOT_WORKLIST, false);//WARINING + this.getPassdirfromNotifiPage = this.addEITData.dirfromNotificationPage; + if (this.getPassdirfromNotifiPage) { + this.functionName = this.getPassNotificationDetails.FUNCTION_NAME; //;this.getPassNotificationDetails.NOTIFICATION_NAME; + this.menuType = "E"; + this.selEmp = this.getPassNotificationDetails.SELECTED_EMPLOYEE_NUMBER; + this.respID = -999; + this.validateEitObj = this.addEITData.submitEITObjList; + // this.eitSubmitAction=this.getPassNotificationDetails.EIT_ACTION; + let msg: string = ""; + msg = this.ts.trPK("eit", "update-title"); + this.headerTitle = msg; + } else { + this.getPassMnuEntryObj = this.selMenu.GetMenuEntriesList; + this.comtransNo = this.addEITData.transNo; + this.functionName = this.getPassMnuEntryObj.FUNCTION_NAME; + this.menuType = this.selMenu.List_Menu.MENU_TYPE; + this.validateEitObj = this.addEITData.submitEITObjList; + this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; + this.eitSubmitAction = this.cs.sharedService.getSharedData( + EITTransactionsRequest.SUBMIT_EIT_ACTION + ); + } + } + + ngOnInit() {} + + ngAfterViewInit() { + console.log("ngAfterViewInit"); + // console.log(this.containerDiv.nativeElement); + this.getEitDffStructure(); + // this.addFieldToDOM(this.buttonInput, 'btnSubmit', this.cs.presentAlert('Clicked!'), true) + } + + private getEitDffStructure() { + const body = { + P_FUNCTION_NAME: this.functionName, + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID + // P_USER_NAME:this.userName + }; + this.eitService.getEITDFFStrutre(body).subscribe((result: any) => { + this.handleEitDffStructureResult(result); + }); + } + + handleEitDffStructureResult(result) { + if (result.GetSITDFFStructureList != null) { + this.eitResponse = result.GetSITDFFStructureList; + this.drawEitFields(result.GetSITDFFStructureList); + } + } + + 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 + // if(feildsList[i].DEFAULT_TYPE=="C"||feildsList[i].DEFAULT_TYPE==""){// default type constant + this.textInput = new TextInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + defaultValText, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + // }else if(feildsList[i].DEFAULT_TYPE=="P"||feildsList[i].DEFAULT_TYPE=="S"){// profile/ sql + // this.textInput = new TextInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,this.getDefaultValue(feildsList[i].DESC_FLEX_NAME,feildsList[i].DESC_FLEX_CONTEXT_CODE,feildsList[i].SEGMENT_NAME,feildsList[i].PARENT_SEGMENTS_VS_SplitedVS,feildsList[i].PARENT_SEGMENTS_DV_Splited),containerId,feildsList[i].MOBILE_ENABLED); + // } + } else if (feildsList[i].FORMAT_TYPE == "N") { + // number + // if(feildsList[i].DEFAULT_TYPE=="C"||feildsList[i].DEFAULT_TYPE==""){ + this.numberInput = new NumberInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + // }else if(feildsList[i].DEFAULT_TYPE=="P"||feildsList[i].DEFAULT_TYPE=="S"){ + // this.numberInput = new NumberInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,this.getDefaultValue(feildsList[i].DESC_FLEX_NAME,feildsList[i].DESC_FLEX_CONTEXT_CODE,feildsList[i].SEGMENT_NAME,feildsList[i].PARENT_SEGMENTS_VS_SplitedVS,feildsList[i].PARENT_SEGMENTS_DV_Splited),containerId,feildsList[i].MOBILE_ENABLED); + // } + } else if (feildsList[i].FORMAT_TYPE == "X") { + // standard date + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + //constant + this.dateInput = new DateInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + this.cs.reverseFormatDate(defaultVal), + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } else { + this.dateInput = new DateInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } + // else if(feildsList[i].DEFAULT_TYPE=="D"){//current date + // // this.dateInput = new DateInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,"currentDate",containerId,feildsList[i].MOBILE_ENABLED); + // this.dateInput = new DateInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,defaultVal,containerId,feildsList[i].MOBILE_ENABLED); + + // }else if(feildsList[i].DEFAULT_TYPE=="P"||feildsList[i].DEFAULT_TYPE=="S"){// sql and profile + // this.dateInput = new DateInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,this.getDefaultValue(feildsList[i].DESC_FLEX_NAME,feildsList[i].DESC_FLEX_CONTEXT_CODE,feildsList[i].SEGMENT_NAME,feildsList[i].PARENT_SEGMENTS_VS_SplitedVS,feildsList[i].PARENT_SEGMENTS_DV_Splited),containerId,feildsList[i].MOBILE_ENABLED); + // } + } else if (feildsList[i].FORMAT_TYPE == "Y") { + // standard date time + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + this.datetimeInput = new DateTimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + this.cs.reverseFormatStandardDate(defaultVal), + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } else { + this.datetimeInput = new DateTimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } + const elem = document.getElementById( + feildsList[i].APPLICATION_COLUMN_NAME + ); + // elem.addEventListener("click", e => { + // if (feildsList[i].MOBILE_ENABLED != "Y") return false; + // this.showDateTimePicker( + // feildsList[i].APPLICATION_COLUMN_NAME, + // feildsList[i].MAXIMUM_SIZE + // ); + // e.stopImmediatePropagation(); + // }); + // else if(feildsList[i].DEFAULT_TYPE=="D"){ + // this.datetimeInput = new DateTimeInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,"currentDateTime",containerId,feildsList[i].MOBILE_ENABLED); + // }else if(feildsList[i].DEFAULT_TYPE=="P"||feildsList[i].DEFAULT_TYPE=="S"){ + // this.datetimeInput = new DateTimeInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,this.getDefaultValue(feildsList[i].DESC_FLEX_NAME,feildsList[i].DESC_FLEX_CONTEXT_CODE,feildsList[i].SEGMENT_NAME,feildsList[i].PARENT_SEGMENTS_VS_SplitedVS,feildsList[i].PARENT_SEGMENTS_DV_Splited),containerId,feildsList[i].MOBILE_ENABLED); + // } + } else if (feildsList[i].FORMAT_TYPE == "I") { + //time + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + this.timeInput = new TimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } else { + this.timeInput = new TimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } + } + } else { + if (feildsList[i].READ_ONLY == "Y") { + this.textInput = new TextInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + defaultValText, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else { + // dropdown list missing open in differnt page + //check this validation since he doesnt check the other default_type + //if(feildsList[i].DEFAULT_TYPE=="P" || feildsList[i].DEFAULT_TYPE=="S"){ + this.selectInput = new SelectInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + // }else{ + // this.selectInput = new SelectInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,"",containerId,feildsList[i].MOBILE_ENABLED); + // } + // this.getValueSet(feildsList[i].SEGMENT_NAME); + this.fillDropdownList( + feildsList[i].SEGMENT_NAME, + feildsList[i].E_SERVICES_VS, + feildsList[i].E_SERVICES_DV + ); + // this.eitVALSettoCall.push(feildsList[i]); + } + } + //const elem = document.getElementById(feildsList[i].APPLICATION_COLUMN_NAME); + //elem.addEventListener("click", (e) => { + // this.getValueSet(feildsList[i].SEGMENT_NAME); + // e.stopImmediatePropagation(); + // }); + this.bindHtmlElemEvents( + feildsList[i].APPLICATION_COLUMN_NAME, + feildsList[i] + ); + } else { + // if(feildsList[i].VALIDATION_TYPE=="N"){ + this.hiddenInput = new HiddenInput( + defaultVal, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultValText, + containerId + ); + // }else{ + // this.selectInput = new SelectInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,defaultVal,containerId,feildsList[i].MOBILE_ENABLED,feildsList[i].DISPLAY_FLAG); + // this.fillDropdownList(feildsList[i].SEGMENT_NAME,feildsList[i].E_SERVICES_VS,feildsList[i].E_SERVICES_DV); + // } + this.bindHtmlElemEvents( + feildsList[i].APPLICATION_COLUMN_NAME, + feildsList[i] + ); + } + } + // this.callValueSet(); + // let msg:string=""; + // msg=this.translate.translate("confirmAddEit.start"); + // this.buttonInput = new ButtonInput("EIT_Btn_Submit", this.translate.translate('general.submit'), containerId, ""); + // const elem = document.getElementById("EIT_Btn_Submit"); + // elem.addEventListener("click", (e) => { + // this.validateEITTransaction(); + // }); + if (this.validateEitObj && this.validateEitObj.length > 0) { + this.fillEITStructure(); + } + } + + addFieldToDOM( + fieldObject: any, + fieldId: any, + clickListenerEvent: any, + hasClickListener: boolean + ) { + console.log("AddFieldToDOM"); + const elemDiv = document.createElement("div"); + elemDiv.className = ""; + elemDiv.innerHTML = fieldObject.getTemplate(); + console.log(this.containerDiv.nativeElement); + + this.containerDiv.nativeElement.appendChild(elemDiv); + // document.getElementById('containerDiv').appendChild(elemDiv); + + if (hasClickListener) { + let elem = document.getElementById(fieldId); + elem.addEventListener("click", e => { + clickListenerEvent(e); + e.stopImmediatePropagation(); + }); + } + } + + closeModal() { + console.log("closeModal"); + this.updatedValues = []; + this.modalController.dismiss(); + } + + public showDateTimePicker(elemID, maxSize) { + let elem = document.getElementById(elemID) as HTMLDivElement; + let date: any; + let value = elem.innerHTML; + if (value) date = moment(value, "YYYY/MM/DD HH:mm:ss").toDate(); + else date = new Date(); + this.datePicker + .show({ + date: date, + is24Hour: true, + mode: "datetime" + }) + .then( + date => { + let dateString: string = moment(date).format("YYYY/MM/DD HH:mm:ss"); + //remove seconds if the maximum size is 17 + if (maxSize == 17) { + elem.innerHTML = dateString.substring(0, 16); + elem.dataset.dtvalue = dateString.substring(0, 16); + } else { + elem.innerHTML = dateString; + elem.dataset.dtvalue = dateString; + } + //elem.innerHTML = dateString; + // elem.dataset.dtvalue = dateString; + }, + err => console.log("Error occurred while getting date: ", err) + ); + } + public showTimePicker(elemID, maxSize) { + let elem = document.getElementById(elemID) as HTMLDivElement; + let date: any; + let value = elem.innerHTML; + if (value) { + let nowDate = moment().format("YYYY/MM/DD") + " " + value; + date = moment(nowDate, "YYYY/MM/DD HH:mm:ss").toDate(); + } else { + date = new Date(); + } + this.datePicker + .show({ + date: date, + is24Hour: true, + mode: "time" + }) + .then( + date => { + let dateString: string = moment(date).format("HH:mm:ss"); + //remove seconds if the maximum size is 5 + if (maxSize == 5) { + elem.innerHTML = dateString.substring(0, 5); + elem.dataset.dtvalue = dateString.substring(0, 5); + } else { + elem.innerHTML = dateString; + elem.dataset.dtvalue = dateString; + } + }, + err => console.log("Error occurred while getting date: ", err) + ); + } + + fillDropdownList(segmentName, optionList: any = [], DV: any = "") { + let elemID: any = ""; + let eitObj: any; + if (optionList.length > 0) { + for (let i = 0; i < this.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 = ""; + + // for(let i = select.options.length - 1 ; i >= 0 ; i--) + // { + // select.remove(i); + // } + if (eitObj.IsEmptyOption && eitObj.REQUIRED_FLAG == "N") { + var firstoption = document.createElement("option"); + firstoption.text = this.ts.trPK("general", "choose"); + firstoption.value = ""; + select.add(firstoption); + } + for (let i = 0; i < optionList.length; i++) { + var option = document.createElement("option"); + option.text = optionList[i].VALUE_COLUMN_NAME; + option.value = optionList[i].ID_COLUMN_NAME; + select.add(option); + } + if (select.dataset.hiddenval) { + select.value = select.dataset.hiddenval; + //select.dataset.hiddenval=""; + } else { + select.value = DV.P_ID_COLUMN_NAME; + } + select.disabled = false; + } + } + + bindHtmlElemEvents(id, obj) { + const elem = document.getElementById(id); + console.log(elem); + console.log(obj); + const elemType = elem.tagName; + let changeEvent = "ionChange"; + + if (elemType == "SELECT") changeEvent = "change"; + + try { + // elem.addEventListener("change", (e) => { + elem.addEventListener(changeEvent, e => { + //console.log("elem change "+elem.id); + //let x=e.currentTarget as HTMLInputElement; + //let isEmpty:boolean=false; + // if(!x.value) + // isEmpty=true; + //emptyChildElement + elem.classList.remove("requiredClassElm"); + if ( + obj.CHILD_SEGMENTS_VS_Splited && + obj.CHILD_SEGMENTS_VS_Splited.length > 0 + ) { + let listArray: any = obj.CHILD_SEGMENTS_VS_Splited; + listArray.forEach(element => { + //if(isEmpty) + this.emptyChildElement(element); + // else + this.getValueSet(element); + }); + } + if ( + obj.CHILD_SEGMENTS_DV_Splited && + obj.CHILD_SEGMENTS_DV_Splited.length > 0 + ) { + let listArray: any = obj.CHILD_SEGMENTS_DV_Splited; + listArray.forEach(element => { + // if(isEmpty){ + this.emptyChildElement(element); + // }else{ + for (let i = 0; i < this.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; + // e.stopImmediatePropagation(); + }); + } catch (e) { + console.log(e.status); + } + } + + public getDefaultValue( + obj, + descFlexName, + descFlexContextCode, + segmentName, + parentValue, + ParentsList + ) { + let dependenciesList: any = []; + let parentVal: any = null; + let isStandardDate: boolean = false; + let isStandardTimeDate: boolean = false; + let isStandardTime: boolean = false; + let isHidden: boolean = false; + let isReadOnlyList: boolean = false; + let isSelectElement: boolean = false; + isStandardDate = this.isStandardDate(obj); + isStandardTimeDate = this.isStandardDateTime(obj); + isStandardTime = this.isStandardTime(obj); + if (obj.DISPLAY_FLAG == "N") isHidden = true; + if (obj.VALIDATION_TYPE != "N" && obj.READ_ONLY == "Y") { + isReadOnlyList = true; + } + if (obj.VALIDATION_TYPE != "N" && obj.READ_ONLY == "N") { + isSelectElement = true; + } + //if(parentValue!=""){ parentVal= this.getDependenciesParams(parentValue)[0].ID_COLUMN_NAME;} + //if(ParentsList!=""){dependenciesList =this.getDependenciesParams(ParentsList); } + + if ( + parentValue != "" && + (obj.VALIDATION_TYPE == "D" || obj.VALIDATION_TYPE == "Y") + ) { + let parvalue = this.getDependenciesParams(parentValue); + if (parvalue && parvalue[0]) parentVal = parvalue[0].ID_COLUMN_NAME; + else { + parentVal = null; + } + if (!parentVal) { + return false; + } + } + if (ParentsList != "") { + if (parentValue) ParentsList.concat(parentValue); + dependenciesList = this.getDependenciesParams(ParentsList); + if (!dependenciesList) { + return false; + } + } + + //if (dependenciesList==false){return false}; + const body = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, //-999, + P_DESC_FLEX_NAME: descFlexName, + P_DESC_FLEX_CONTEXT_CODE: descFlexContextCode, + P_SEGMENT_NAME: segmentName, + P_PARENT_VALUE: parentVal, + GetValueSetValuesTBL: dependenciesList + }; + + this.eitService.getDefaultValue(body).subscribe((result: any) => { + let elem = this.getElementByName(segmentName); + // console.log(elem); + // if(elem.dataset.hiddenval){ + // elem.dataset.hiddenval=""; + // return false; + // } + let obj = this.handleDefaultValueResult(result); + let val = obj.value; + let text = obj.text; + if (val==null){val="";} + if (text==null){text="";} + if (isStandardDate) { + console.log("isStandardDate"); + elem.value = this.cs.reverseFormatDate(val); + } else if (isStandardTimeDate) { + console.log("isStandardTimeDate"); + if (val) { + elem.dataset.dtvalue = this.cs.reverseFormatStandardDate(val); + elem.innerHTML = this.cs.reverseFormatStandardDate(val); + } else { + elem.dataset.dtvalue = ""; + elem.innerHTML = ""; + } + } else if (isStandardTime) { + console.log("isStandardTime"); + if (val) { + elem.dataset.dtvalue = val; + elem.innerHTML = val; + elem.value=val; + } else { + elem.dataset.dtvalue = ""; + elem.innerHTML = ""; + } + } else { + if (isSelectElement) { + let elem = this.getSelectElementByName(segmentName); + elem = document.getElementById(elem), + //alert(elem.length); + // var firstoption = document.createElement("option"); + // firstoption.text = text; + // firstoption.value = val; + // elem.add(firstoption); + elem.value = val; + //elem.text=text; + + }else{ + // console.log("else - " + elem.value); + elem.value = val; + elem.innerText = text; + elem.setAttribute("value", val); + // console.log("else - " + elem.value); + } + } + if (isHidden || isReadOnlyList) { + if (val) elem.dataset.colmText = val; + else elem.dataset.colmText = ""; + elem.value = text; + } + var event = new Event("ionChange"); + elem.dispatchEvent(event); + }); + } + + handleDefaultValueResult(result) { + let data = { + text: result.GetDefaultValueList.P_VALUE_COLUMN_NAME, + value: result.GetDefaultValueList.P_ID_COLUMN_NAME + }; + return data; + } + + callValueSet() { + for (var i = 0; i < this.eitVALSettoCall.length; i++) { + this.getValueSet(this.eitVALSettoCall[i].SEGMENT_NAME); + } + } + + getParentValue(parentValue) { + if (parentValue.length == 0) { + for (let i = 0; i < this.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.eitService.getSetValue(body).subscribe((result: any) => { + if (result.GetValueSetValuesList != null) { + this.fillDropdownList(segmentName, result.GetValueSetValuesList); + } + }); + let arr: any = []; + return arr; + } + + getDependenciesParams(parentsList) { + let parentArr: any = []; + for (let i = 0; i < parentsList.length; i++) { + for (let j = 0; j < this.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 + // if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant + isSt = true; + // } + } + return isSt; + } + isStandardDateTimeVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "Y") { + // standard date time + //if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant + isSt = true; + //} + } + return isSt; + } + isStandardTimeVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "I") { + // standard time + //if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant + isSt = true; + //} + } + return isSt; + } + + fillEITStructure() { + var obj = { peiObjVer: null, peiExtraInfoID: null }; + for (let i = 0; i < this.validateEitObj.length; i++) { + let val: any; + if (this.validateEitObj[i].VARCHAR2_VALUE) + val = this.validateEitObj[i].VARCHAR2_VALUE; + else if (this.validateEitObj[i].DATE_VALUE) + val = this.validateEitObj[i].DATE_VALUE; + else if (this.validateEitObj[i].NUMBER_VALUE) + val = this.validateEitObj[i].NUMBER_VALUE; + const elem = document.getElementById( + this.validateEitObj[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + //obj.transactionNo=this.validateEitObj[i].TRANSACTION_NUMBER; + if (elem) { + if (val) { + let feldDetails = this.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 = this.comtransNo; + 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"); + } + 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; + } + + submitEit() { + let list = this.eitRequest.EITTransactionTBL; + this.eitRequest.EITTransactionTBL = this.fixTransactionNo(list); + this.eitService + .submitEit(this.eitRequest) + .subscribe((result: AddEitResponse) => { + this.handleSubmitEitResult(result); + }); + } + + fixTransactionNo(transactionTBL: any): any[] { + let list: any = []; + let newIndex: number = 1; + let length: number = transactionTBL.length; + if (length > 0) { + for (let i = 0; i < length; i++) { + // let item :any={}; + const item = Object.assign({}, transactionTBL[i]); + let transNo: number = item.TRANSACTION_NUMBER; + let obj: any = item; + if (i == 0) { + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } else { + let prevEl: any = transactionTBL[i - 1].TRANSACTION_NUMBER; + if (transNo == prevEl) { + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } else { + newIndex++; + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } + } + } + } + return list; + } + handleSubmitEitResult(result) { + if (this.cs.validResponse(result)) { + this.cs.sharedService.setSharedData( + this.eitRequest, + EitRequest.SHARED_DATA + ); + this.cs.sharedService.setSharedData(result, AddEitResponse.SHARED_DATA); + //this.addrespList=result.SubmitEITTransactionList; + // this.itemKey=this.addrespList.P_ITEM_KEY; + // this.P_TransactionID=result.SubmitEITTransactionList.P_TRANSACTION_ID; + // this.sharedData.setSharedData(result,AddEitResponse.SHARED_DATA); + + // // this.sharedData.setSharedData(result.SubmitEITTransactionList.P_TRANSACTION_ID,"TransactionIDResubmit"); + // // this.sharedData.setSharedData(this.eitRequest,EitRequest.SHARED_DATA); + + this.cs.sharedService.setSharedData( + { isResubmit: false }, + "confirmAddEITData" + ); + this.cs.openConfirmSitPage(); + // this.navCtrl.push("ConfirmAddEitPage", { isResubmit: false }); + } + } + + validateEITTransaction() { + // let EITTransactionValues:any= []; + + this.arrValues = this.getElementsValues(); + if (this.arrValues) { + this.eitRequest = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, //this.selMenu.List_Menu.RESP_ID,//-999, + P_FUNCTION_NAME: this.functionName, + P_DESC_FLEX_CONTEXT_CODE: this.eitResponse[0].DESC_FLEX_CONTEXT_CODE, + EITTransactionTBL: this.arrValues + }; + + // this.eitService + // .validateEITTransaction(this.eitRequest) + // .subscribe((result: any) => { + this.handleEITValidateTr(); + // }); + } + } + private handleEITValidateTr() { + // let data: any = { eitRequest: {}, updated: [] }; + // if (this.cs.validResponse(result)) { + // public static SHARED_DATA = 'login-request'; + this.cs.sharedService.setSharedData( + this.eitRequest, + EitRequest.SHARED_DATA + ); + if (this.getPassdirfromNotifiPage) { + let data: any = { eitRequest: {}, updated: [] }; + data.eitRequest = this.eitRequest; + data.updated = this.updatedValues; + // this.viewCtrl.dismiss(data); + this.modalController.dismiss(data); + // this.closemodal(); + } else { + this.submitEit(); + // this.navCtrl.push("ConfirmAddEitPage"); + // data = { eitRequest: {}, updated: [] }; + // data.eitRequest = this.eitRequest; + // data.updated = this.updatedValues; + // this.viewCtrl.dismiss(data); + } + // } else { + // this.updatedValues = []; + // data = { eitRequest: {}, updated: [] }; + // } + } +} + diff --git a/Mohem/src/app/sit/confirm-add-sit/confirm-add-sit.component.html b/Mohem/src/app/sit/confirm-add-sit/confirm-add-sit.component.html new file mode 100644 index 00000000..a3a64748 --- /dev/null +++ b/Mohem/src/app/sit/confirm-add-sit/confirm-add-sit.component.html @@ -0,0 +1,267 @@ + + + + {{headerTitle}} + + + + + + + + + +
{{'general, addAttach' | translate}}
+
+ +
+ +
+
+
+ + + {{ 'general, notAttch' | translate}} + +
+ + +
+ + + + {{attachList.AttachmentID +1 }} . + + + + + {{attachList.P_FILE_NAME }} + + + + + + + + +
+ +
+ +
+ + +
+
+ + {{attachRes.FILE_NAME }} + +
+ + + + + + + +
+
+ +
+ + + +
{{'confirmAddEit, comment' | translate}}
+ + + + +
+ + +
{{'confirmAddEit, approverList' | translate}}
+
+

{{ 'general, empty' | translate}}

+
+
+ +
+ + +
+
+ +
+
+ + + {{employee.APPROVER}} + + + {{employee.POSITION_TITLE}} + + + +
+
+
+
+
+ +
+ + + + + +
+ + +
+ + {{ (isDelete ? 'general, delete' : 'general, submit') | translate }} +
+
\ No newline at end of file diff --git a/Mohem/src/app/sit/confirm-add-sit/confirm-add-sit.component.scss b/Mohem/src/app/sit/confirm-add-sit/confirm-add-sit.component.scss new file mode 100644 index 00000000..bd1c1bdc --- /dev/null +++ b/Mohem/src/app/sit/confirm-add-sit/confirm-add-sit.component.scss @@ -0,0 +1,263 @@ +.footer-button { + border-radius: 2px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; + } + + .imgSize { + width: 22px; + height: 22px; + } + + .Header { + font-weight: bold; + color: #1a586d !important; + font-size: 10px; + } + + .tbData { + font-size: 10px; + } + + .btnBack { + background: transparent; + float: right; + } + + .attachmentDiv{ + background: #ffffff; + height: auto; + text-align: center; + padding-top: 1px; + margin: 10px; + border-radius: 15px; + border: 1px solid grey; + } + + .noDataDiv{ + background: #ffffff; + height: 11%; + text-align: center; + padding-top: 1px; + border-radius: 10px; + margin: 10px; + border-radius: 5px; + } + .submitNote{ + background: #ffffff; + height: 80px; + padding-top: 1px; + margin: 10px; + border-radius: 15px; + border: 1px solid grey; + } + + .approvalList{ + --background: #f0efef; + height: auto; + text-align: center; + padding-top: 1px; + border-radius: 10px; + margin: 10px; + border-radius: 5px; + } + + /************************New Design**********************************/ + .notification-list{ + background: none; + background: none; + border-radius: 32px; + ion-item{ + // margin-top: 5px; + // margin-bottom: 5px; + + background-color: transparent; + .item-date{ + width: 100%; + font-size: 16px; + font-weight: bold; + + text-align: start; + padding: 0; + margin: 0; + + position: absolute; + left: 0; + top: 12%; + } + ion-label , [item-end]{ + + white-space: normal; + font-size: 14px; + padding-top: 15%; + // :root[dir="ltr"]{ + // margin-left: 10px; + // } + // :root[dir="rtl"]{ + // margin-right: 10px; + // } + + } + + } + } + + + + + + + .timeline { + position: relative; + margin: 15px 0 0 0; + // border-bottom: solid 1px var(--cusgray); + } + + .timeline:before { + + content: ''; + position: inherit !important; + top: 0; + bottom: 0; + width: 4px; + // background: #e4e4e4; + z-index: 1; + left: 35px; + /* margin-left: -10px; */ + /* z-index: 1; */ + } + + .timeline .timeline-thumb { + + border-radius: 500px; + width: 70px !important; + z-index: 2; + position: absolute; + left: 0px; + // :root[dir="ltr"]{ + // left: 37px; + // } + // :root[dir="rtl"]{ + // right: 37px; + // } + float: right; + top: 9px; + } + + .timeline .timeline-thumb.timeline-icon { + height: 70px; + // text-align: center; + // color: white; + // border: 5px solid #CBD0D3; + // transform: scale(0.2); + } + + + + .timeline .timeline-item { + width: 40px; + + } + + .timeline .timeline-stats { + position: relative; + font-size: 12px; + color: var(--darkgray); + + } + + .empImge{ + border-radius: 50%; + width:100%; + height: 100%; + border: #dedede solid 1px; + + } + .empImgeRep { + border-radius: 50% !important; + width: 80px; + height: 80px; + border: #dedede solid 1px; + } + + .line{ + padding-bottom:87px; + } + + .attachLable{ + position: absolute; + top: 0px; + z-index: 0; + background: #30b8c6; + color: #fff; + border-radius: 50%; + border: 0px; + width: 24px; + height: 24px; + text-align: center; + font-size: 5px; + } + + .removeLable{ + top: 0px; + z-index: 0; + background: #d8252d; + color: #fff; + border-radius: 50%; + border: 0px; + width: 20px; + height: 20px; + text-align: center; + font-size: 5px; + } + + .note-modal { + // width: 90%; + // height: 50%; + // top: 20%; + // left: 5%; + // right: 5%; + // bottom: 5%; + background: rgba(0, 0, 0, 0.5) !important; + padding: 30% 10% !important; + --height: 12cm !important; + // --width: 80% !important; + --border-radius:20px; + + } + .header-toolbar-new{ + --background: #29B5BF; + } + .title{ + margin-top: -37px; + margin-left: 85px; + } + .title-ar{ + margin-top: -37px; + margin-right: 101px; + } + .confirmEitOkButton{ + white-space: normal !important; + text-transform: capitalize !important; + min-height: 45px !important; + min-width: 5px !important; + margin: 8px !important; + background-color: #29B5BF; + width: 80% !important; + color: white!important; + border-radius: 16px !important; + } + + .approvalTitle-ar{ + font-weight: bold; + font-size: 16px; + text-align: right; + + } + .approvalTitle{ + font-weight: bold; + font-size: 16px; + text-align: left; + } + \ No newline at end of file diff --git a/Mohem/src/app/sit/confirm-add-sit/confirm-add-sit.component.spec.ts b/Mohem/src/app/sit/confirm-add-sit/confirm-add-sit.component.spec.ts new file mode 100644 index 00000000..5a44ed71 --- /dev/null +++ b/Mohem/src/app/sit/confirm-add-sit/confirm-add-sit.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ConfirmAddSitComponent } from './confirm-add-sit.component'; + +describe('ConfirmAddSitComponent', () => { + let component: ConfirmAddSitComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ConfirmAddSitComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ConfirmAddSitComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/sit/confirm-add-sit/confirm-add-sit.component.ts b/Mohem/src/app/sit/confirm-add-sit/confirm-add-sit.component.ts new file mode 100644 index 00000000..efe286ca --- /dev/null +++ b/Mohem/src/app/sit/confirm-add-sit/confirm-add-sit.component.ts @@ -0,0 +1,568 @@ +import { WorkListAttachViewComponent } from './../../notification/work-list-attach-view/work-list-attach-view.component'; +import { AddAttachComponent } from './../add-attach/add-attach.component'; +import { NotificationGetAttachResponse } from './../models/NotificationGetAttachRes'; +import { EITNotificatonBodyResponse } from './../models/EITNotificationBodyRes'; +import { WorkListButtonRequest } from './../models/NotificationButtonReq'; +import { ApproversList } from './../../absence/models/approvers'; +import { EitRequest } from './../models/eit.request'; +import { Component, OnInit } from '@angular/core'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { ModalController } from '@ionic/angular'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { EitService } from '../services/eit.service'; +import { AddEitResponse } from '../models/add.eit.response'; +import { FileUploader } from 'ng2-file-upload'; +import { SubmitSitModalComponent } from '../submit-sit-modal/submit-sit-modal.component'; + +@Component({ + selector: 'app-confirm-add-sit', + templateUrl: './confirm-add-sit.component.html', + styleUrls: ['./confirm-add-sit.component.scss'], +}) +export class ConfirmAddSitComponent implements OnInit { + + private P_TransactionID: number; + private eitRequest: EitRequest; + approversList = []; + addrespList: any;//EitRespModel; + eitComments: string = ""; + menuType: string = ""; + selEmp: string = ""; + respID: number; + selMenu: MenuResponse; + getAttachList: any; + attachListDisplay: any = []; + headerTitle: string = ""; + isTrue: any = 0; + attachItems: any; + public isResubmitEIT: boolean = false; + private itemKey: string = ""; + private pActionMode: string = "SUBMIT"; + attachReqObj: WorkListButtonRequest = new WorkListButtonRequest(); + attachmentRes: any; + objIndex1: any; + attachListOver: any = []; + index: any = 0; + getPassNotificationDetails: any; + isSubmitBtnClicked: boolean; + isDelete: boolean = false; + + /***Add Attchment Vars */ + isUpload: boolean = false; + inQueue: boolean = false; + addAttachmentListReq: any; + attachmentID: number = 0; + addAttachRequest: any = []; + fileData: any; + fileType: any; + dirPage: any; + TransactionID: any; + indexLastObj: any = 0; + filterAllowedType: any = ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']; + direction: string; + + + constructor(public modalController: ModalController, public cs: CommonService, private ts: TranslatorService, private eitService: EitService) { + this.direction = TranslatorService.getCurrentLanguageName() + this.isSubmitBtnClicked = false; + this.eitRequest = new EitRequest(); + } + + ngOnInit() { + // console.log('ionViewDidLoad ConfirmAddEitPage'); + // let selMenu:MenuResponse=new MenuResponse(); + this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); + this.selEmp = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_EMP, false); + this.respID = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_RESP_ID, false); + this.eitRequest = this.cs.sharedService.getSharedData(EitRequest.SHARED_DATA, false); + this.isResubmitEIT = this.cs.sharedService.getSharedData('confirmAddEITData', false).isResubmit; + if (this.isResubmitEIT) { + this.getPassNotificationDetails = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.NOT_WORKLIST, false); //WARINING ** + // console.log("this.getPassNotificationDetails: " + this.getPassNotificationDetails); + this.P_TransactionID = this.cs.sharedService.getSharedData("TransactionIDResubmit", true); + // let notification = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.NOT_WORKLIST, true); + + this.itemKey = this.getPassNotificationDetails.ITEM_KEY; + this.pActionMode = "RESUBMIT"; + this.menuType = "E"; + this.respID = -999; + this.selEmp = this.eitRequest.P_SELECTED_EMPLOYEE_NUMBER; + this.getApproversList(); + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); + let msg: string = ""; + msg = this.ts.trPK("eit", "update-title"); + this.headerTitle = msg; + } else { + this.menuType = this.selMenu.List_Menu.MENU_TYPE; + this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; + this.addrespList = this.cs.sharedService.getSharedData(AddEitResponse.SHARED_DATA); + this.itemKey = this.addrespList.SubmitSITTransactionList.P_ITEM_KEY; + this.P_TransactionID = this.addrespList.SubmitSITTransactionList.P_TRANSACTION_ID; + this.isDelete = this.isResubmitEIT = this.cs.sharedService.getSharedData('confirmAddEITData', false).isDelete; + + + this.getApproversList(); + // this.confirmAddEit.submitEit(this.eitRequest).subscribe((result: AddEitResponse) => { + // this.handleSubmitEitResult(result); + // }); + } + } + + getApproversList() { + let body: any = { + P_TRANSACTION_ID: this.P_TransactionID, + P_AME_TRANSACTION_TYPE: "SSHRMS", + P_PAGE_NUM: 1, + P_PAGE_LIMIT: 1000 + } + this.eitService.getApproversList( + body). + subscribe((result: any) => { + this.handleApproversResult(result); + }); + } + + handleApproversResult(result) { + if (this.cs.validResponse(result)) { + this.approversList = result.GetApprovesList; + // console.log("approvers List" + this.approversList); + } + } + + startEitApproval() { + //first call add attach inside success call submit + // if(this.isResubmitEIT){ + // this.startEITApprovalProcess(); + // }else{ + // let listToAdd:any=[]; + if (this.attachListOver) { + // this.attachListOver.forEach(element => { + // if(element.toAdd==true) + // listToAdd.push(element); + // }); + + let request = { + AddAttachmentList: this.attachListOver + } + + this.eitService.addAttachment( + request). + subscribe((result: any) => { + this.handleAddAttachmentResults(result); + }); + } else { + this.startEITApprovalProcess(); + } + // } + } + + + handleAddAttachmentResults(result) { + + if (this.cs.validResponse(result)) { + //this.isUpload=true; + this.isTrue = 0; + for (let i = 0; i < result.AddAttSuccessList.length; i++) { + if (!result.AddAttSuccessList[i].AddSuccess) { + this.attachListOver[i].isSuccess = false; + //this.attachItems[i].isSuccess = false; + // if false display cancel button with waring icon or design + }// end if + else { + // if true remove cancel and set isSuccess = true + // this.attachItems[i].isSuccess = true; + this.attachListOver[i].isSuccess = true; + this.isTrue = this.isTrue + 1; //count flag of attach status + } // end else + } // end for + + if (this.isTrue == result.AddAttSuccessList.length) { + this.startEITApprovalProcess(); + } + else { + //stope + let filtered = this.attachListOver.filter(function (el) { return el.isSuccess == true; }); + this.attachListOver = filtered; + let msg: string = ""; + msg = this.ts.trPK("eit", "attach-errorMsg"); + this.cs.presentAlert(msg); + // this.cs.presentAlert("fail to upload some attach file"); + } + } + } + + startEITApprovalProcess() { + let request: any = {}; + request.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; + request.P_MENU_TYPE = this.menuType; + request.P_SELECTED_RESP_ID = this.respID; + request.P_TRANSACTION_ID = this.P_TransactionID; + request.P_ITEM_KEY = this.itemKey; + request.P_ACTION_MODE = this.pActionMode; + request.P_COMMENTS = this.eitComments; + this.eitService.startEitApprovalProcess( + request). + subscribe((result: any) => { + this.handleResults(result); + }); + } + cancelEitProcess() { + let body: any = { + P_TRANSACTION_ID: this.P_TransactionID + } + this.eitService.cancelHRTransaction( + body). + subscribe((result: any) => { + this.handleCancelResults(result); + }); + + } + handleCancelResults(result) { + if (this.cs.validResponse(result)) { + this.isSubmitBtnClicked = false; + // this.navCtrl.popToRoot(); + } + } + handleResults(result) { + if (this.cs.validResponse(result)) { + this.isSubmitBtnClicked = true; + //if(this.isResubmitEIT==false){ + let msg: string = this.ts.trPK("eit", "approval-message-success"); + this.cs.presentAlert(msg); + // } + // this.navCtrl.popToRoot(); + + // this.cs.openHome(); + this.cs.openNotificationPage(); + } + } + + // addAttachment(){ + // this.navCtrl.push('AddAttachPage'); + + + // } + + async addAttachment(str: boolean, attachItems: any) { + // console.log("inside attach modal"); + //open the modal with return data + let attachDocID = attachItems.ATTACHED_DOCUMENT_ID; + + this.cs.sharedService.setSharedData( this.P_TransactionID, 'TransactionID'); + this.cs.sharedService.setSharedData(this.attachListOver.length, 'indexLastObj'); + + const modal = await this.modalController.create({ + component: AddAttachComponent + }); + + modal.onDidDismiss() + .then((data) => { + if (data == "cancel" || data == "undefined") { + return; + } else { + if (!str) { + + // this.attachItems = data.map(function(el) { + // var o = Object.assign({}, el); + // o.isSuccess = false; + // return o; + // }) + // this.objIndex1 =this.attachmentRes.findIndex(item => item == attachItems); //to use it in remove attach + //.ATTACHED_DOCUMENT_ID + this.updateFile(data, attachDocID); + } else { + console.log(data); + this.attachListDisplay = data.data; + this.attachItems = this.attachListDisplay.map(function (el) { + var o = Object.assign({}, el); + o.isSuccess = false; + return o; + }); + + this.attachListOver = this.attachListOver ? this.attachListOver.concat(this.attachItems) : this.attachItems; + // this.attachListOver = this.attachListDisplay; + } + // this.attachListDisplay=data; + + // this.attachItems = this.attachListDisplay.map(function(el) { + // var o = Object.assign({}, el); + // o.isSuccess = false; + // return o; + // }) + } + }); + + return await modal.present(); + } + + /*****submit modal********/ + async openSubmitModal() { + this.cs.sharedService.setSharedData( this.attachListOver, 'submitAttachmentList'); + this.cs.sharedService.setSharedData(this.eitComments, 'eitComments'); + const modal = await this.modalController.create({ + component: SubmitSitModalComponent, + backdropDismiss: false, + + }); + modal.cssClass = 'note-modal'; + + modal.onDidDismiss() + .then((data) => { + console.log(data.data); + + if (data.data == "cancel" || data.data == undefined) { + return; + } else { + this.startEitApproval(); + } + }); + + return await modal.present(); + + + + + } + + + + removeFile(objectitem) { + + + // if (this.attachItems) { + // let index1 = this.attachItems.findIndex(item => item == objectitem); + // if (index1 > -1) { + + // this.attachItems.splice(index1, 1); + // } + // this.attachListDisplay =this.attachListDisplay.filter(item => item.AttachmentID !== objectitem.AttachmentID); + // } + if (this.attachListOver) { + let index2 = this.attachListOver.findIndex(item => item == objectitem); + if (index2 > -1) { + this.attachListOver.splice(index2, 1); + } + //this.attachListOver =this.attachListOver.filter(item => item.AttachmentID !== objectitem.AttachmentID); + } + if (this.attachmentRes) { + + let index3 = this.attachmentRes.findIndex(item => item == objectitem); + if (index3 > -1) { + + this.attachmentRes.splice(index3, 1); + } + } + + } + + + getAttachment(NotificationID) { + + this.attachReqObj.P_NOTIFICATION_ID = NotificationID; + + this.eitService.getAttach(this.attachReqObj). + subscribe((result: NotificationGetAttachResponse) => { + this.handleWorkListAttachResult(result); + }); + } + + handleWorkListAttachResult(result) { + if (this.cs.validResponse(result)) { + // this.sharedData.setSharedData(result, WorKListResponse.SHARED_DATA); + if (result.GetAttachementList != null) { + this.attachmentRes = result.GetAttachementList; + } // if result == null + } // valid it + + } + + async OpenAttachFiles(value, Type) { + // let modal: Modal = this.modalCtrl.create('WorkListAttachViewPage', { displayData: value, TypeData: Type }); + // modal.present(); + + this.cs.sharedService.setSharedData({ displayData: value, TypeData: Type }, 'WorkListAttachViewPage'); + const modal = await this.modalController.create({ + component: WorkListAttachViewComponent + }); + + modal.onDidDismiss() + .then((data) => { + }); + + return await modal.present(); + } + + + delelteFile(attach) { + // let alert = this.cs.confirmAlertDialog(this.translate.translate('general.deletePerm')); + + this.cs.confirmAlertDialog((data) => { + if (data == true) { + this.continueDelete(attach); + } + }, this.ts.trPK('general', 'ok'), () => { + + }, this.ts.trPK('general', 'cancel'), this.ts.trPK('general', 'alert'), this.ts.trPK('eit', 'delete-perm')); + + // alert.onDidDismiss((data) => { + // if (data == true) { + // this.continueDelete(attach); + // } + // }); + + + } + continueDelete(attach) { + // console.log("trst" + attach.ATTACHED_DOCUMENT_ID); + let req = { + P_ATTACHED_DOCUMENT_ID: attach.ATTACHED_DOCUMENT_ID + } + this.eitService.deleteAttach(req). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (result.DeleteAttachmentList.P_RETURN_STATUS === "S") { + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); + let msg: string = ""; + msg = this.ts.trPK("eit", "deleteAttach"); + this.cs.presentAlert(msg); + //this.cs.presentAlert("Success" ); + } + } + }); + } + + updateFile(attachList, attachDocID) { + //console.log("updateFile" + attachDocID.ATTACHED_DOCUMENT_ID); + let req = { + P_ATTACHED_DOCUMENT_ID: attachDocID, + P_FILE_DATA: attachList[0].P_FILE_DATA, + P_FILE_NAME: attachList[0].P_FILE_NAME, + P_FILE_CONTENT_TYPE: attachList[0].P_FILE_CONTENT_TYPE + } + this.eitService.updateAttach(req). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (result.MessageStatus == 1) { + let msg: string = ""; + msg = this.ts.trPK("eit", "attachUpdate"); + this.cs.presentAlert(msg); + // this.cs.presentAlert("updated attach successfully" ); + + //flag to disable update and enable remove + // this.removeFile(attachList); + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); + } + } // val + }); + } + + + ionViewWillLeave() { + if (this.P_TransactionID && this.isSubmitBtnClicked == false) + this.cancelEitProcess(); + } + + /*******************Add attchement Functions*************/ + + public uploader: FileUploader = new FileUploader({ + allowedMimeType: ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], + maxFileSize: 10 * 1024 * 1024, + formatDataFunctionIsAsync: true, + formatDataFunction: async (item) => { + return new Promise((resolve, reject) => { + resolve({ + name: item._file.name, + length: item._file.size, + contentType: item._file.type, + date: new Date() + }); + }); + } + }); + + + onFileSelectedclick(event){ + event.target.value = ''; + } + + + + onFileSelected(input) { + + // this.uploader.onWhenAddingFileFailed = function (item: any, filter: any, options: any){ + + if (!(this.filterAllowedType.indexOf(input.target.files[0].type) > -1)) { + let msg: string = ""; + msg = this.ts.trPK("general", "notSupport"); + this.cs.presentAlert(msg); + return + } // todo: show alert that you tried uploading wrong files + + else { + + const file = input.target.files[0]; + + // console.log(file); + + //var encoded = Base64.encode(file); + this.getBase64(file).then( + data => this.pushObject(data, file.name, file.type) + ); + + // } + // }; + + } + } + + + getBase64(file) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = () => resolve(reader.result); + reader.onerror = error => reject(error); + }); + } + + + pushObject(fileData, name, type) { + + console.log("before push: "+ this.index); + //this.attachListOver.length++; + try { + let array = name.split('.'); + let attachType: string = array[array.length - 1]; + + this.attachListOver.push( + { + AttachmentID: this.attachListOver.length, + P_FILE_CONTENT_TYPE: attachType,//type.split('/')[1], + P_FILE_DATA: fileData.split(',')[1], + P_FILE_NAME: name,//.split('.')[0], + P_TRANSACTION_ID: this.P_TransactionID + }) + + } catch (e) { + + } + + + //console.log("after push: "+ this.index); + // return this.addAttachRequest + } + + + // removeFile(objectitem) { + + // let objIndex1 = this.uploader.queue.findIndex(item => item == objectitem); + // this.uploader.queue.splice(objIndex1, 1); + // let objIndex = this.addAttachRequest.findIndex(item => item.AttachmentID == objectitem.AttachmentID); + // this.addAttachRequest.splice(objIndex, 1); + // // this.addAttachRequest =this.addAttachRequest.filter(item => item.AttachmentID !== objectitem.AttachmentID); + + // } + + +} diff --git a/Mohem/src/app/sit/home/home.component.html b/Mohem/src/app/sit/home/home.component.html new file mode 100644 index 00000000..17ee0d5c --- /dev/null +++ b/Mohem/src/app/sit/home/home.component.html @@ -0,0 +1,87 @@ + + + + + + + + + + + + + +
+ + {{menuItem.PROMPT}} + + + + + +
+ + + + +  {{subPage.PROMPT}} + + + + + +
+
+ +
+
+ + + + + + + + + + +
+ + {{menuItem.PROMPT}} + + + + + + +
+ + + + +  {{subPage.PROMPT}} + + + + + + +
+
+ +
+
+ +
\ No newline at end of file diff --git a/Mohem/src/app/sit/home/home.component.scss b/Mohem/src/app/sit/home/home.component.scss new file mode 100644 index 00000000..6568c30f --- /dev/null +++ b/Mohem/src/app/sit/home/home.component.scss @@ -0,0 +1,95 @@ +ion-item.custCollabs.item.item-block.item-md, +ion-item.custCollabs.item.item-block.item-ios { + padding: 0px; +} + +.ion-item-styling { + color: black; + line-height: 2; + margin: 8px 2px; + min-height: 40px; + background-color: #ffffff; + border-bottom: 1px solid #c8c8c8; +} + +.header-toolbar-new{ + --background: #29B5BF; +} + +ion-item.item.item-block { + .item-inner { + border: 0px !important; + padding: 0px !important; + } + + ion-item.childItem.item.item-block { + padding: 0px 5px; + width: 100%; + ion-label.label.label-md, + ion-label.label.label-ios { + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; + border-bottom: 1px solid #e4e5e7; + border-radius: 0px; + color: #000000; + } + } + + ion-col.menu-name.col { + padding: 0px; + } + + div.selectedDiv { + background: #209a83; + color: #ffffff; + padding: 0px 10px; + min-height: 40px; + } + div.notSelected { + padding: 0px 10px; + } + // ion-label.label.label-md, + // ion-label.label.label-ios { +} + +ion-icon::before { + line-height: 2; +} +.arrow-down{ + position: absolute; + top: 0; + right:0; +} +// .list-md > .item-block:last-child .item-inner, +// .list-ios > .item-block:last-child .item-inner{ + +// border-bottom: 1px solid #dedede; +// } + +.span-arrow-en{ + float: right; + font-size: 25px; + color: grey; + transform: rotate(0deg); +} + +.span-arrow-ar{ + float: left; + font-size: 25px; + color: grey; + transform: rotate(180deg); +} + +.arrow-forward{ + float: right; + font-size: 25px; + color: grey; +} +.arrow-forward-ar{ + float: left; + font-size: 25px; + color: grey; + -webkit-transform: rotate(180deg); + transform: rotate(180deg); +} \ No newline at end of file diff --git a/Mohem/src/app/sit/home/home.component.spec.ts b/Mohem/src/app/sit/home/home.component.spec.ts new file mode 100644 index 00000000..5ec1377b --- /dev/null +++ b/Mohem/src/app/sit/home/home.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HomeComponent } from './home.component'; + +describe('HomeComponent', () => { + let component: HomeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HomeComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/sit/home/home.component.ts b/Mohem/src/app/sit/home/home.component.ts new file mode 100644 index 00000000..83e5157d --- /dev/null +++ b/Mohem/src/app/sit/home/home.component.ts @@ -0,0 +1,75 @@ +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { Component, OnInit } from '@angular/core'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; + +@Component({ + selector: 'app-home', + templateUrl: './home.component.html', + styleUrls: ['./home.component.scss'], +}) +export class HomeComponent implements OnInit { + + menu: any; + pages: any; + headerTitle: string; + selMenu: MenuResponse = new MenuResponse(); + // Selected Side Menu + selectedMenu: any; + direction: string; + pageType: string; + + constructor(private cs: CommonService, private ts: TranslatorService) { + this.direction = TranslatorService.getCurrentLanguageName(); + this.menu = this.cs.sharedService.getSharedData('menuEntries', false); + this.pageType = this.cs.sharedService.getSharedData('homemenuentries', false); + this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); + const title: string = this.ts.trPK('eit', 'my-requests'); + this.headerTitle = this.menu.PROMPT ? this.menu.PROMPT : title; + } + + ngOnInit() { } + + openPage(page, index) { + console.log(page + "index" + index); + // Reset the content nav to have just this page + // we wouldn't want the back button to show in this scenario + if (page.children.length === 0) { + this.goToRequest(page); + } else { + if (this.selectedMenu === 0) { + this.selectedMenu = -1; + } else if (this.selectedMenu !== -1) { + this.selectedMenu = -1; + } else { + this.selectedMenu = index; + } + } + console.log('selected>>>>>>>' + this.selectedMenu); + } + + goToRequest(menuEntry) { + let selMenu: MenuResponse = new MenuResponse(); + selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); + selMenu.GetMenuEntriesList = menuEntry; + this.cs.sharedService.setSharedData(selMenu, MenuResponse.SHARED_DATA); + if (menuEntry.REQUEST_TYPE === 'ABSENCE') { + this.cs.openAbsencePage(); + } else if (menuEntry.REQUEST_TYPE === 'EIT') { + this.cs.openEitListPage(); + } else if (menuEntry.REQUEST_TYPE === 'SIT') { + this.cs.openSitListPage(); + } else if (menuEntry.REQUEST_TYPE === 'BASIC_DETAILS') { + this.cs.openProfile('basicDetails'); + } else if (menuEntry.REQUEST_TYPE === 'ADDRESS') { + this.cs.openProfile('address'); + } + if (menuEntry.REQUEST_TYPE === 'PAYSLIP') { + this.cs.openPayslipPage(); + } + if (menuEntry.REQUEST_TYPE === 'TIME_CARD') { + this.cs.openTimeCardPage(); + } + } + +} diff --git a/Mohem/src/app/sit/models/EITNotificationBodyItems.ts b/Mohem/src/app/sit/models/EITNotificationBodyItems.ts new file mode 100644 index 00000000..4c1bf836 --- /dev/null +++ b/Mohem/src/app/sit/models/EITNotificationBodyItems.ts @@ -0,0 +1,18 @@ +export class EITNotificationBodyItems { + public TRANSACTION_NUMBER :number; + public DESC_FLEX_NAME : string; + public ACTION : string; + public EXTRA_INFO_ID :number; + public DESC_FLEX_CONTEXT_COD : string; + public APPLICATION_COLUMN_NAME : string; + public SEGMENT_SEQ_NUM :number; + public DATATYPE : string; + public SEGMENT_NAME : string; + public VARCHAR2_VALUE : string; + public SEGMENT_PROMPT : string; + public NUMBER_VALUE :number; + public SEGMENT_VALUE_DSP : string; + public DATE_VALUE : string ; + public PREV_SEGMENT_VALUE_DSP : string; + public DISPLAY_FLAG : string ; +} \ No newline at end of file diff --git a/Mohem/src/app/sit/models/EITNotificationBodyRes.ts b/Mohem/src/app/sit/models/EITNotificationBodyRes.ts new file mode 100644 index 00000000..f6051d5d --- /dev/null +++ b/Mohem/src/app/sit/models/EITNotificationBodyRes.ts @@ -0,0 +1,8 @@ +import { EITNotificationBodyItems } from './EITNotificationBodyItems'; +import { Response } from '../../hmg-common/services/models/response'; + +export class EITNotificatonBodyResponse extends Response { +public static SHARED_DATA = 'Notif_BODY_List'; +public static NOT_WORKLIST = 'Notif_WORK_LOST'; +public EITNotificationBodyItems: EITNotificationBodyItems []; +} \ No newline at end of file diff --git a/Mohem/src/app/sit/models/EITTransactionsReq.ts b/Mohem/src/app/sit/models/EITTransactionsReq.ts new file mode 100644 index 00000000..b7921767 --- /dev/null +++ b/Mohem/src/app/sit/models/EITTransactionsReq.ts @@ -0,0 +1,13 @@ +import { Request } from '../../hmg-common/services/models/request'; + +export class EITTransactionsRequest extends Request{ +public static SUBMIT_EIT_ACTION='submit-eit-action'; +public static SHARED_DATA='submit_eit_obj'; +public P_PAGE_NUM : Number; +public P_PAGE_LIMIT : Number; +public P_MENU_TYPE:String; +public P_SELECTED_EMPLOYEE_NUMBER:String; +public P_FUNCTION_NAME:String; +public P_SELECTED_RESP_ID : Number; + +} \ No newline at end of file diff --git a/Mohem/src/app/sit/models/NotificationButtonReq.ts b/Mohem/src/app/sit/models/NotificationButtonReq.ts new file mode 100644 index 00000000..908ddc4f --- /dev/null +++ b/Mohem/src/app/sit/models/NotificationButtonReq.ts @@ -0,0 +1,6 @@ +import { Request } from '../../hmg-common/services/models/request'; + +export class WorkListButtonRequest extends Request{ + //public static SHARED_DATA = ''; + public P_NOTIFICATION_ID :any; +} \ No newline at end of file diff --git a/Mohem/src/app/sit/models/NotificationGetAttachRes.ts b/Mohem/src/app/sit/models/NotificationGetAttachRes.ts new file mode 100644 index 00000000..109fe921 --- /dev/null +++ b/Mohem/src/app/sit/models/NotificationGetAttachRes.ts @@ -0,0 +1,21 @@ +import { Response } from '../../hmg-common/services/models/response'; + +export class NotificationGetAttachResponse extends Response { +public static SHARED_DATA = ''; +public SEQ_NUM = 0;// Int +public FILE_NAME = '';//String +public FILE_DATA = '';//base64 +public PK1_VALUE = '';//String +public PK2_VALUE = '';//String +public PK3_VALUE = '';//String +public PK4_VALUE = '';//String +public FILE_CONTENT_TYPE = '';//String +public ATTACHED_DOCUMENT_ID = 0;//Int +public DOCUMENT_ID = 0;//Int +public CATEGORY_ID = 0;//Int +public DATATYPE_ID = 0;//Int +public ENTITY_NAME = '';//String +public FILE_ID = 0;//Int +public PK5_VALUE = '';//String + +} \ No newline at end of file diff --git a/Mohem/src/app/sit/models/add.eit.response.ts b/Mohem/src/app/sit/models/add.eit.response.ts new file mode 100644 index 00000000..b54537a7 --- /dev/null +++ b/Mohem/src/app/sit/models/add.eit.response.ts @@ -0,0 +1,8 @@ +import { Response } from '../../hmg-common/services/models/response'; +import { EitRespModel } from './eit.response.model' + +export class AddEitResponse extends Response { + public static SHARED_DATA = 'add-eit-response'; + SubmitEITTransactionList: EitRespModel; +} + diff --git a/Mohem/src/app/sit/models/eit-address.request.ts b/Mohem/src/app/sit/models/eit-address.request.ts new file mode 100644 index 00000000..0c5c0c07 --- /dev/null +++ b/Mohem/src/app/sit/models/eit-address.request.ts @@ -0,0 +1,15 @@ + +import { EitTransactionModel } from './eit.transaction.model'; + +export class EitAddressRequest { + public static SHARED_DATA = 'eit-request'; + public P_MENU_TYPE: string; + public P_SELECTED_EMPLOYEE_NUMBER: string; + public P_FUNCTION_NAME: string; + public P_SELECTED_RESP_ID: Number; + P_DESC_FLEX_CONTEXT_CODE: string; + EITTransactionTBL: EitTransactionModel[]; + P_COUNTRY_CODE: string; + P_EFFECTIVE_DATE: string; + P_ACTION: string; +} \ No newline at end of file diff --git a/Mohem/src/app/sit/models/eit.request.ts b/Mohem/src/app/sit/models/eit.request.ts new file mode 100644 index 00000000..51e746a5 --- /dev/null +++ b/Mohem/src/app/sit/models/eit.request.ts @@ -0,0 +1,12 @@ +import { EitTransactionModel } from './eit.transaction.model'; + +export class EitRequest { + public static SHARED_DATA = 'eit-request'; + public P_MENU_TYPE: string; + public P_SELECTED_EMPLOYEE_NUMBER: string; + public P_FUNCTION_NAME: string; + public P_SELECTED_RESP_ID: Number; + P_DESC_FLEX_CONTEXT_CODE: string; + EITTransactionTBL: EitTransactionModel[]; + +} \ No newline at end of file diff --git a/Mohem/src/app/sit/models/eit.response.model.ts b/Mohem/src/app/sit/models/eit.response.model.ts new file mode 100644 index 00000000..bd6f4a5d --- /dev/null +++ b/Mohem/src/app/sit/models/eit.response.model.ts @@ -0,0 +1,6 @@ +export class EitRespModel { + P_ITEM_KEY: string; + P_RETURN_MSG:string; + P_RETURN_STATUS:string; + P_TRANSACTION_ID:number; +} \ No newline at end of file diff --git a/Mohem/src/app/sit/models/eit.transaction.model.ts b/Mohem/src/app/sit/models/eit.transaction.model.ts new file mode 100644 index 00000000..aa65466a --- /dev/null +++ b/Mohem/src/app/sit/models/eit.transaction.model.ts @@ -0,0 +1,7 @@ +export class EitTransactionModel { + TRANSACTION_NUMBER: number; + NUMBER_VALUE: number; + NAME: string; + DATE_VALUE: string; + VARCHAR2_VALUE: string; +} \ No newline at end of file diff --git a/Mohem/src/app/sit/models/submit.eit.action.ts b/Mohem/src/app/sit/models/submit.eit.action.ts new file mode 100644 index 00000000..80b4cb28 --- /dev/null +++ b/Mohem/src/app/sit/models/submit.eit.action.ts @@ -0,0 +1,6 @@ +// tslint:disable-next-line:class-name +export enum EIT_ACTION { + ADD = 1, + DELETE = 2, + UPDATE=3 +} diff --git a/Mohem/src/app/sit/services/eit.service.spec.ts b/Mohem/src/app/sit/services/eit.service.spec.ts new file mode 100644 index 00000000..49f0d55b --- /dev/null +++ b/Mohem/src/app/sit/services/eit.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { EitService } from './eit.service'; + +describe('EitService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: EitService = TestBed.get(EitService); + expect(service).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/sit/services/eit.service.ts b/Mohem/src/app/sit/services/eit.service.ts new file mode 100644 index 00000000..312e9e26 --- /dev/null +++ b/Mohem/src/app/sit/services/eit.service.ts @@ -0,0 +1,134 @@ +import { NotificationGetAttachResponse } from './../models/NotificationGetAttachRes'; +import { EITTransactionsRequest } from './../models/EITTransactionsReq'; +import { Observable } from 'rxjs'; +import { Injectable } from '@angular/core'; +import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; +import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service'; +import { AddEitResponse } from '../models/add.eit.response'; +import { ApproversList } from 'src/app/absence/models/approvers'; +import { WorkListButtonRequest } from '../models/NotificationButtonReq'; + +@Injectable({ + providedIn: 'root' +}) +export class EitService { + + /* EIT Services URLs */ + public static getMenuEntries = 'Services/ERP.svc/REST/GET_MENU_ENTRIES'; + public static getEITTransctions = 'Services/ERP.svc/REST/GET_SIT_TRANSACTIONS'; + public static getEITDFFStrutre = 'Services/ERP.svc/REST/GET_SIT_DFF_STRUCTURE'; + public static getSetValue = 'Services/ERP.svc/REST/GET_VALUE_SET_VALUES'; + public static getDefaultValue = 'Services/ERP.svc/REST/GET_DEFAULT_VALUE'; + public static validateEITTransctions = 'Services/ERP.svc/REST/VALIDATE_SIT_TRANSACTION'; + public static submitEit = 'Services/ERP.svc/REST/SUBMIT_SIT_TRANSACTION'; + public static resubmitEit = 'Services/ERP.svc/REST/RESUBMIT_SIT_TRANSACTION'; + public static startEitProcess = 'Services/ERP.svc/REST/START_SIT_APPROVAL_PROCESS'; + public static updateAttach = 'Services/ERP.svc/REST/UPDATE_ATTACHMENT'; + public static deleteAttach = 'Services/ERP.svc/REST/DELETE_ATTACHMENT'; + public static getApproversList = 'Services/ERP.svc/REST/GET_APPROVERS_LIST'; + public static addAttachment = 'Services/ERP.svc/REST/ADD_ATTACHMENT'; + public static cancelHRTransaction = 'Services/ERP.svc/REST/CANCEL_HR_TRANSACTION'; + public static getAttach = 'Services/ERP.svc/REST/GET_ATTACHMENTS'; + + constructor(public authService: AuthenticationService, public con: ConnectorService) { } + + public getMenuEntries(menuEntries: any, onError?: any, errorLabel?: string, isPostNoLoad = false): Observable { + const request = menuEntries; + this.authService.authenticateRequest(request); + if (isPostNoLoad) { + return this.con.postNoLoad(EitService.getMenuEntries, request, onError, errorLabel); + } else { + return this.con.post(EitService.getMenuEntries, request, onError, errorLabel); + } + } + + // tslint:disable-next-line: no-shadowed-variable + public getEITTransactionsList(EITTransactionsRequest: EITTransactionsRequest, onError?: any, errorLabel?: string): Observable { + const request = EITTransactionsRequest; + this.authService.authenticateRequest(request); + return this.con.post(EitService.getEITTransctions, request, onError, errorLabel); + } + + public submitEit(eit: any, onError?: any, errorLabel?: string): Observable { + const request = eit; + request.EITTransactionTBLModel = eit.EITTransactionTBL; + this.authService.authenticateRequest(request); + return this.con.post(EitService.submitEit, request, onError, errorLabel); + } + + public validateEITTransaction(validateEITTransactionReq: any, onError?: any, errorLabel?: string): Observable { + const request = validateEITTransactionReq; + this.authService.authenticateRequest(request); + return this.con.post(EitService.validateEITTransctions, request, onError, errorLabel); + } + + public getEITDFFStrutre(EITDFFStrutreReq: any, onError?: any, errorLabel?: string): Observable { + const request = EITDFFStrutreReq; + this.authService.authenticateRequest(request); + return this.con.post(EitService.getEITDFFStrutre, request, onError, errorLabel); + } + + public getSetValue(SetValueReq: any, onError?: any, errorLabel?: string): Observable { + const request = SetValueReq; + this.authService.authenticateRequest(request); + return this.con.post(EitService.getSetValue, request, onError, errorLabel); + } + + public getDefaultValue(DefaultValueReq: any, onError?: any, errorLabel?: string): Observable { + const request = DefaultValueReq; + this.authService.authenticateRequest(request); + return this.con.post(EitService.getDefaultValue, request, onError, errorLabel); + } + + public getApproversList(abProcess: any, onError?: any, errorLabel?: string): Observable { + const request = abProcess; + request.P_AME_TRANSACTION_TYPE = 'SSHRMS'; + request.P_PAGE_NUM = 1; + request.P_PAGE_LIMIT = 1000; // check later on + this.authService.authenticateRequest(request); + return this.con.post(EitService.getApproversList, request, onError, errorLabel); + } + + public addAttachment(addAttachrequest: any, onError?: any, errorLabel?: string): Observable { + const request = addAttachrequest; + this.authService.authenticateRequest(request); + return this.con.post(EitService.addAttachment, request, onError, errorLabel); + } + + public startEitApprovalProcess(eitProcess: any, onError?: any, errorLabel?: string): Observable { + const request = eitProcess; + this.authService.authenticateRequest(request); + return this.con.post(EitService.startEitProcess, request, onError, errorLabel); + } + + public cancelHRTransaction(transactionID: any, onError?: any, errorLabel?: string): Observable { + const request = transactionID; + this.authService.authenticateRequest(request); + return this.con.post(EitService.cancelHRTransaction, request, onError, errorLabel); + } + + public getAttach(getAttachReq: WorkListButtonRequest, onError?: any, errorLabel?: string): Observable { + const request = getAttachReq; + this.authService.authenticateRequest(request); + return this.con.post(EitService.getAttach, request, onError, errorLabel); + } + + public deleteAttach(delteAttachReq: any, onError?: any, errorLabel?: string): Observable { + const request = delteAttachReq; + this.authService.authenticateRequest(request); + return this.con.post(EitService.deleteAttach, request, onError, errorLabel); + } + + public updateAttach(updateAttachReq: any, onError?: any, errorLabel?: string): Observable { + const request = updateAttachReq; + this.authService.authenticateRequest(request); + return this.con.post(EitService.updateAttach, request, onError, errorLabel); + } + + public reSubmitEit(eit: any, onError?: any, errorLabel?: string): Observable { + const request = eit; + this.authService.authenticateRequest(request); + return this.con.post(EitService.resubmitEit, request, onError, errorLabel); + } + +} diff --git a/Mohem/src/app/sit/sit-list/sit-list.component.html b/Mohem/src/app/sit/sit-list/sit-list.component.html new file mode 100644 index 00000000..1a5cdeca --- /dev/null +++ b/Mohem/src/app/sit/sit-list/sit-list.component.html @@ -0,0 +1,259 @@ + + + + +
+ +
+ + + +

{{ts.trPK('absenceList','tickets-balance')}}

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

{{'general, noData' | translate}}

+
+ +
+ +
+ + + + + + +
+ +
+ +
+ + + + + +
+ +
+
+
+
+ +
+
+
+ +
+
+ +
+
+ + + + +
+
+ + + + + + \ No newline at end of file diff --git a/Mohem/src/app/sit/sit-list/sit-list.component.scss b/Mohem/src/app/sit/sit-list/sit-list.component.scss new file mode 100644 index 00000000..749fd900 --- /dev/null +++ b/Mohem/src/app/sit/sit-list/sit-list.component.scss @@ -0,0 +1,335 @@ +.footer-button { + border-radius: 2px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; + } + + .datetime{ + // text-align: center; + // font-family: WorkSans-Bold; + // margin-left: 111px; + text-align: center; + font-family: WorkSans-Bold; + margin-left: 47px; + margin-top: -19px; + + } + .iconCalendar{ + // margin-left: -241px; + // margin-top: 5px; + margin-left: 30px !important; + width: 22% !important; + height: 26px !important; + margin-top: -69px !important; + margin-bottom: 20px !important; + } + h4 { + font-size: 2.2rem; + text-align: center; + color: #000000; + } + .grids{ + border-radius: 20px !important; + background: white; + padding-left: 1px; + padding-right: 1px; + margin: 13px; + padding-top: 0px; + padding-bottom: 3px; + padding-left: 13px; + padding-right: 13px; + border: 1px solid #cac8c8; + } + + .bgcolor { + + color: white; + border-top-right-radius: 19px; + border-top-left-radius: 15px; + padding-top: 1; + padding-bottom: 0; + margin-top: 0; + margin-bottom: 0; + /* border-radius: 12px !important; */ + background: #29B5BF; + border-bottom: 1px solid #a7a4a4; + border-top: 1px solid #cac8c8; + margin-left: -13px; + margin-right: -13px; + } + .colEit{ + border-right: 1px solid #cac8c8; + border-bottom-left-radius: -10px !important; + padding-top: 8px; + padding-bottom: 8px; + margin-left: 18px; + font-size: 12px !important; + } + + .header-div { + + background-color: #29B5BF; + text-transform: capitalize; + height: 160px; + // position: relative; + display: block; + margin-bottom: -28px; + } + + .header-toolbar-new{ + --background: #29B5BF; + } + + .addClass{ + background-color: #29B5BF; + width: 80px; + height: 80px; + right: 8%; + position: fixed; + color: white; + bottom: 5%; + border-radius: 50%; + z-index: 999; + -webkit-box-shadow: 2px -1px 13px 0px rgba(0,0,0,0.59); + -moz-box-shadow: 2px -1px 13px 0px rgba(0,0,0,0.59); + box-shadow: 2px -1px 13px 0px rgba(0,0,0,0.59); + } + + .contentEit:before { + position: absolute; + content: ""; + // background: #29B5BF; + height: 140px; + width: 100%; + left: 0; + top: 0px; + z-index: 1; + } + + .hrClass{ + border-width: 0; + box-sizing: content-box; + border-bottom: 1px solid #e6e6e6; + background: #fff !important; + height: 1px; + } + + //////////////////////////////// + .content:before { + position: absolute; + content: ""; + background: #29B5BF; + height: 140px; + width: 100%; + left: 0; + top: 0px; + z-index: 1; + } + + + .colorBG{ + --background: #f0efef; + } + + .Title{ + text-align: center; + color: white; + margin-top: -33px; + font-size: 17px; + } + .title{ + text-align: center; + color: black; + margin-top: 5px; + font-size: 17px; + } + .today-graph{ + display: block !important; + height: 196px; + width: 365px; + /* padding-left: 51px; */ + margin-left: 28px !important; + } + + .headerGrid{ + // background-color: white !important; + // border: 1px solid #cac8c8 !important; + // border-radius: 20px !important; + // padding-top: 28px; + // padding-bottom: 53px; + // margin-left: 9px; + // margin-right: 13px; + // margin-top: -94px; + // margin-bottom: 10px; + background-color: white !important; + border: 1px solid #cac8c8 !important; + /* padding-top: 28px; */ + padding-bottom: 53px; + padding-top: -30px; + margin-left: 13px; + margin-right: 13px; + /* margin-top: -86px; */ + margin-bottom: 10px; + position: relative; + z-index: 1; + border-radius: 20px; + margin-top: 17px; + } + .result-graph{ + font-size: 14px; + margin-left: -48px; + margin-right: 3px; + margin-bottom: -30px; + + + + } + + .green-label{ + font-size: 15px !important; + margin-left: 7px !important; + margin-right: 42px; + } + .green-label-ar{ + font-size: 15px !important; + margin-left: 7px !important; + margin-right: 15px; + } + .blue-label{ + font-size: 15px !important; + margin-left: 7px !important; + margin-right: 13px; + } + .light-label{ + font-size: 15px !important; + margin-left: 7px !important; + margin-right: -26px; + } + .light-label-ar{ + font-size: 15px !important; + margin-right: 7px !important; + margin-left: -26px; + } + + .light-dote{ + background-color: #3CB9D5; + width: 12px; + height: 12px; + border-radius: 50% !important; + display: inline-block; + } + .blue-dote{ + + background-color: #29B5BF; + width: 12px; + height: 12px; + border-radius: 50% !important; + display: inline-block; + } + .green-dote{ + background-color: #1FA269; + width: 12px; + height: 12px; + border-radius: 50% !important; + display: inline-block; + margin-right: -1px; + } + .col{ + text-align: right; + } + + .gridService{ + + /* margin-top: 87px; */ + border-radius: 10px; + /* margin-bottom: -49px; */ + margin-left: 14px; + margin-right: 14px; + + } + .columns{ + margin: 3px; + margin-bottom: 13px; + background: white; + border-radius: 27px; + padding-left: 30px; + padding-right: 6px; + padding-top: 19px; + padding-bottom: 8px; + border: 1px solid #cac8c8 !important; + } + + + .service{ + font-size: 22px; + color: black; + letter-spacing: 1px; + font-weight: bold; + } + .services{ + + font-size: 12px; + color: black; + } + + .adult-dote{ + background-color: #3CB9D5; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-left: -17px; + margin-right: 5px; + } + + .adult-dote-ar{ + background-color: #3CB9D5; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-right: 0px; + margin-left: 5px; + } + .child-dote{ + + background-color: #29B5BF; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-left: -17px; + margin-right: 5px; + } + .child-dote-ar{ + background-color: #29B5BF; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-right: 1px; + margin-left: 5px; + } + .infants-dote{ + background-color: #1FA269; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-left: -17px; + margin-right: 5px; + // margin-bottom: 6px; + } + + .infants-dote-ar{ + background-color: #1FA269; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-right: 1px; + margin-left: 5px; + } + + \ No newline at end of file diff --git a/Mohem/src/app/sit/sit-list/sit-list.component.spec.ts b/Mohem/src/app/sit/sit-list/sit-list.component.spec.ts new file mode 100644 index 00000000..20cce98d --- /dev/null +++ b/Mohem/src/app/sit/sit-list/sit-list.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SitListComponent } from './sit-list.component'; + +describe('SitListComponent', () => { + let component: SitListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SitListComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SitListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/sit/sit-list/sit-list.component.ts b/Mohem/src/app/sit/sit-list/sit-list.component.ts new file mode 100644 index 00000000..b99be8dc --- /dev/null +++ b/Mohem/src/app/sit/sit-list/sit-list.component.ts @@ -0,0 +1,610 @@ +import { AddSitComponent } from './../add-sit/add-sit.component'; +import { ModalController } from '@ionic/angular'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { EitRequest } from './../models/eit.request'; +import { EITTransactionsRequest } from './../models/EITTransactionsReq'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { Component, OnInit } from '@angular/core'; +import { EitService } from '../services/eit.service'; +import { EIT_ACTION } from '../models/submit.eit.action'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { AddEitResponse } from '../models/add.eit.response'; +import { AccrualService } from 'src/app/accrual-balances/services/accrual.service'; +import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; +import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user'; + +@Component({ + selector: 'app-sit-list', + templateUrl: './sit-list.component.html', + styleUrls: ['./sit-list.component.scss'], +}) +export class SitListComponent implements OnInit { + Sdate: any; + emp_no: any; + balance:any; + //////////////up + P_PAGE_NUM: number; + P_PAGE_LIMIT: number; + IsReachEnd = false; + userName: any; + isDelete = false; + getResEITTransactionList: any = []; + eitAddedList: any = []; + getPassMnuEntryObj: any; + selMenu: MenuResponse = new MenuResponse(); + EITTransactionsListObj: EITTransactionsRequest = new EITTransactionsRequest(); + selEmp: string; + respID: number; + transactionNo = 0; + menuType = ''; + public functionName = ''; + private eitRequest: EitRequest; + private eitTransactionTbl: any = []; + private validEitTransactionTbl: any = []; + private desxFlexCode = ''; + private selectedIndex: number; + private pAction = 0; + public headerTitle = ''; + data: any; + accrualNetInfants: any; + accrualUNetChild: any; + accrualNetAdult: any; + + public options = { + cutoutPercentage: 80, + tooltips: { enabled: false }, + legend: { display: false }}; + gaugeType = 'full'; + accrualBalancesList: any; + common: any; + direction: string; + // gaugeValue = 11.200; + // gaugeLabel = ""; + + // tslint:disable-next-line: max-line-length + constructor(private cs: CommonService, private EITService: EitService, public ts: TranslatorService, + private modalCtrl: ModalController, public accrualService: AccrualService, public authService:AuthenticationService,) { + this.direction = TranslatorService.getCurrentLanguageName(); + this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); + this.selEmp = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_EMP, false); + this.respID = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_RESP_ID, false); + this.getPassMnuEntryObj = this.selMenu.GetMenuEntriesList; + this.menuType = this.selMenu.List_Menu.MENU_TYPE; + this.transactionNo = 0; + this.functionName = this.getPassMnuEntryObj.FUNCTION_NAME; + this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; + this.validEitTransactionTbl = []; + this.P_PAGE_NUM = 1; + this.P_PAGE_LIMIT = 50; + } + + ngOnInit() { + ///////////// + this.Sdate = new Date().toISOString(); + this.getUserDetails(); + ////////////////up + this.getEITTransactions(); + + this.accrualBalancesList = this.cs.sharedService.getSharedData('tickitsbalance', false); + // accrualNetInfants + // accrualUNetChild + // accrualNetAdult + // if(this.accrualBalancesList){ + // this.accrualNetAdult = this.accrualBalancesList[1].ACCRUAL_NET_ENTITLEMENT; + // this.accrualUNetChild = this.accrualBalancesList[2].ACCRUAL_NET_ENTITLEMENT; + // this. accrualNetInfants = this.accrualBalancesList[3].ACCRUAL_NET_ENTITLEMENT; + // } + this.data = { + // labels: ['earingTotal', 'deductionTotal'], + datasets: [ + { data: [this.accrualNetInfants, this.accrualUNetChild, this.accrualNetAdult], + backgroundColor: [ + '#1FA269', + '#29B5BF', + '#3CB9D5', ], + borderWidth: 2 + } + ] + }; + } + + getUserDetails(){ + this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => { + if (user) { + // this.emp_no=user.EMPLOYEE_NUMBER; + + } + }); + } + // public getAccrualBalance() { + // if (this.Sdate) { + // let today = new Date(this.Sdate); + // let day = today.getDate(); + // let month = today.getMonth() + 1; + // let year = today.getFullYear(); + // let todayDate = month + '/' + day + '/' + year; + // let effectiveDate = todayDate; + // const request = { + // P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + // P_EFFECTIVE_DATE: effectiveDate + // }; + // this.accrualService + // .getAccrualBalances(request) + // .subscribe((result: any) => { + // this.handleAccrualResult(result); + // }); + // } + // } + handleAccrualResult(result) { + if (this.cs.validResponse(result)) { + this.balance=result.GetAccrualBalancesList; + this.accrualNetAdult = this.balance[1].ACCRUAL_NET_ENTITLEMENT; + this.accrualUNetChild = this.balance[2].ACCRUAL_NET_ENTITLEMENT; + this. accrualNetInfants = this.balance[3].ACCRUAL_NET_ENTITLEMENT; + } + } + /////////////////////////////////// + + getEITTransactions() { + this.IsReachEnd = false; + this.EITTransactionsListObj.P_PAGE_LIMIT = this.P_PAGE_LIMIT; + this.EITTransactionsListObj.P_PAGE_NUM = this.P_PAGE_NUM; + this.EITTransactionsListObj.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; + this.EITTransactionsListObj.P_SELECTED_RESP_ID = this.respID; + this.EITTransactionsListObj.P_MENU_TYPE = this.selMenu.List_Menu.MENU_TYPE; + this.EITTransactionsListObj.P_FUNCTION_NAME = this.getPassMnuEntryObj.FUNCTION_NAME; + this.EITService.getEITTransactionsList(this.EITTransactionsListObj). + subscribe((result: any) => { + this.handleEITTransactionsResult(result); + }); + } + + handleEITTransactionsResult(result) { + if (this.cs.validResponse(result)) { + if (this.cs.hasData(result.GetSITTransactionList)) { + this.getResEITTransactionList = result.GetSITTransactionList; + this.P_PAGE_NUM++; + this.EITTransactionsListObj.P_PAGE_NUM = this.P_PAGE_NUM; + const lastItemIndex = this.getResEITTransactionList.length - 1; + if (result.GetSITTransactionList[lastItemIndex] && result.GetSITTransactionList[lastItemIndex].Collection_Transaction[0]) { + const lastitem = result.GetSITTransactionList[lastItemIndex].Collection_Transaction[0]; + // tslint:disable-next-line: triple-equals + if (lastitem.NO_OF_ROWS == lastitem.ROW_NUM) { + this.IsReachEnd = true; + } else { + this.IsReachEnd = false; + } + } + } + } + } + + doInfinite(infiniteScroll) { + if (!this.IsReachEnd) { + + this.EITService.getEITTransactionsList(this.EITTransactionsListObj). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (this.cs.hasData(result.GetSITTransactionList)) { + this.P_PAGE_NUM++; + this.EITTransactionsListObj.P_PAGE_NUM = this.P_PAGE_NUM; + result.GetSITTransactionList.forEach(vr => { + console.log(vr.length); + if(vr.length && vr.length != 0){ + if (vr.Collection_Transaction[0].ROW_NUM == vr.Collection_Transaction[0].NO_OF_ROWS) { + this.IsReachEnd = true; + } else { + this.IsReachEnd = false; + } + this.getResEITTransactionList.push(vr); + } + }); + } else { + this.IsReachEnd = true; + } + } + // this.P_PAGE_NUM++; + if (infiniteScroll) { + infiniteScroll.target.complete(); + } + }, (Error) => console.log(Error), () => infiniteScroll.target.complete()); + } else { + if (infiniteScroll) { + infiniteScroll.target.complete(); + } + } + } + + addEITRrq(i?) { + this.pAction = EIT_ACTION.ADD; + // this.sharedData.setSharedData(this.getResEITTransactionList[i].Collection_Transaction,EITTransactionsRequest.SHARED_DATA); + this.cs.sharedService.setSharedData(this.pAction, EITTransactionsRequest.SUBMIT_EIT_ACTION); + // this.navCtrl.push("AddEitPage"); + // this.openEit(i); + this.openEitNew(i); + } + updateEITRrq(i) { + this.pAction = EIT_ACTION.UPDATE; + this.cs.sharedService.setSharedData(this.getResEITTransactionList[i].Collection_Transaction, EITTransactionsRequest.SHARED_DATA); + this.cs.sharedService.setSharedData(this.pAction, EITTransactionsRequest.SUBMIT_EIT_ACTION); + // this.fillEitTransactionTable(i); + // this.navCtrl.push("AddEitPage"); + // this.openEit(i); + this.openEitNew(i); + } + deleteEIT(i) { + this.deleteEITRrq(i); + // let alert=this.common.showConfirmMsg(this.translate.translate('requestEit.deleteReq')); + // alert.onDidDismiss((data) => { + // if(data==true){ + // this.deleteEITRrq(i); + // } + // }); + } + + deleteEITRrq(i) { + const list: any = this.getResEITTransactionList[i]; + // tslint:disable-next-line: triple-equals + if (list.statusID != 2) { + this.selectedIndex = i; + // if(this.transactionNo==0) + this.transactionNo++; + this.pAction = EIT_ACTION.DELETE; + // this.sharedData.setSharedData(this.getResEITTransactionList[i].Collection_Transaction,EITTransactionsRequest.SHARED_DATA); + // this.sharedData.setSharedData(EIT_ACTION.DELETE,EITTransactionsRequest.SUBMIT_EIT_ACTION); + this.fillEitTransactionTable(i); + this.validateEITTransaction(); + // this.submitEit(); + // this.navCtrl.push("AddEitPage"); + } else { + let msg = ''; + msg = this.ts.trPK('general', 'attemptDel'); + this.cs.presentAlert(msg); + + // alert("You are attempting to delete a row that has already been deleted."); + } + } + openEitNew(index) { + let item: any = []; + if (this.pAction == EIT_ACTION.UPDATE) { + item = this.getResEITTransactionList[index].Collection_Transaction; + } + this.transactionNo++; + // tslint:disable-next-line: max-line-length + this.cs.sharedService.setSharedData({ dirfromNotificationPage: false, submitEITObjList: item, transNo: this.transactionNo }, 'AddEITData'); + this.cs.openAddSitPage(); + // this.navCtrl.push('AddEitPage', { dirfromNotificationPage: false, submitEITObjList: item, transNo: this.transactionNo }); + } + async openEit(index) { + let item: any = []; + // tslint:disable-next-line: triple-equals + if (this.pAction == EIT_ACTION.UPDATE) { + item = this.getResEITTransactionList[index].Collection_Transaction; + } + this.transactionNo++; + // tslint:disable-next-line: max-line-length + this.cs.sharedService.setSharedData({ dirfromNotificationPage: false, submitEITObjList: item, transNo: this.transactionNo }, 'AddEITData'); + const modalPage = await this.modalCtrl.create({ + component: AddSitComponent + }); + // modalPage.present(); + + modalPage.onDidDismiss() + .then((data: any) => { + if (data) { + // this.transactionNo++; + // this.updatedData=this.updatedData?this.updatedData.concat(data.updated):data.updated; + // this.notificationBodyRes[index].Collection_Transaction=data.updated; + this.selectedIndex = index; + this.desxFlexCode = data.eitRequest.P_DESC_FLEX_CONTEXT_CODE; + // tslint:disable-next-line: triple-equals + if (this.pAction == EIT_ACTION.ADD) { + index = this.eitAddedList.length + 1; + const status = this.ts.trPK('eit', '.added'); + const statusID = EIT_ACTION.ADD; + const obj = { status, statusID, Collection_Transaction: data.updated }; + this.eitAddedList.push(obj); + } else { + const status = this.ts.trPK('eit', '.updated'); + const statusID = EIT_ACTION.UPDATE; + this.getResEITTransactionList[this.selectedIndex].status = status; + this.getResEITTransactionList[this.selectedIndex].statusID = statusID; + } + this.updateTransactionList(data.eitRequest.EITTransactionTBL, false); + } else { + // tslint:disable-next-line: triple-equals + if (this.transactionNo != 0) { + this.transactionNo--; + } + } + }); + + modalPage.present(); + // modalPage.onDidDismiss(data => { + // if (data) { + // // this.transactionNo++; + // //this.updatedData=this.updatedData?this.updatedData.concat(data.updated):data.updated; + // // this.notificationBodyRes[index].Collection_Transaction=data.updated; + // this.selectedIndex = index; + // this.desxFlexCode = data.eitRequest.P_DESC_FLEX_CONTEXT_CODE; + // if (this.pAction == EIT_ACTION.ADD) { + // index = this.eitAddedList.length + 1; + // let status = this.ts.trPK("eit", ".added"); + // let statusID = EIT_ACTION.ADD; + // let obj = { status: status, statusID: statusID, Collection_Transaction: data.updated }; + // this.eitAddedList.push(obj); + // } else { + // let status = this.ts.trPK("eit", ".updated"); + // let statusID = EIT_ACTION.UPDATE; + // this.getResEITTransactionList[this.selectedIndex].status = status; + // this.getResEITTransactionList[this.selectedIndex].statusID = statusID; + // } + // this.updateTransactionList(data.eitRequest.EITTransactionTBL, false); + // } else { + // if (this.transactionNo != 0) + // this.transactionNo--; + // } + // }); + + + + } + fillEitTransactionTable(index) { + let obj = { peiObjVer: null, peiExtraInfoID: null }; + const list: any = this.getResEITTransactionList[index].Collection_Transaction; + let valuseArr: any = []; + // tslint:disable-next-line: prefer-for-of + for (let i = 0; i < list.length; i++) { + const item = list[i]; + // tslint:disable-next-line: triple-equals + // tslint:disable-next-line: max-line-length + if (item.APPLICATION_COLUMN_NAME != 'PEI_ACTION' && item.APPLICATION_COLUMN_NAME != 'PEI_EXTRA_INFO_ID' && item.APPLICATION_COLUMN_NAME != 'PEI_OBJECT_VERSION_NUMBER') { + this.desxFlexCode = item.DESC_FLEX_CONTEXT_CODE; + // tslint:disable-next-line: triple-equals + if (item.DATE_VALUE == '') { + item.DATE_VALUE = null; + } + valuseArr.push( + { + TRANSACTION_NUMBER: this.transactionNo, + NAME: item.APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: item.VARCHAR2_VALUE, + NUMBER_VALUE: item.NUMBER_VALUE, + DATE_VALUE: item.DATE_VALUE, + } + ); + } else { + if (item.APPLICATION_COLUMN_NAME == 'PEI_OBJECT_VERSION_NUMBER') { + obj.peiObjVer = item.NUMBER_VALUE; + } + else if (item.APPLICATION_COLUMN_NAME == 'PEI_EXTRA_INFO_ID') { + obj.peiExtraInfoID = item.NUMBER_VALUE; + } + } + + }// end for + // } + valuseArr = this.fillExtraInformation(valuseArr, 'DELETE_ROW', obj.peiExtraInfoID, obj.peiObjVer, this.transactionNo); + this.eitTransactionTbl = valuseArr; + } + + 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; + } + + submitEit() { + this.eitRequest = new EitRequest(); + const list: any = this.fixTransactionNo(); + this.eitRequest.EITTransactionTBL = list; + this.eitRequest.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; + this.eitRequest.P_MENU_TYPE = this.menuType; + this.eitRequest.P_SELECTED_RESP_ID = this.respID; // this.selMenu.List_Menu.RESP_ID,//-999, + this.eitRequest.P_FUNCTION_NAME = this.functionName; + this.eitRequest.P_DESC_FLEX_CONTEXT_CODE = this.desxFlexCode; + + this.EITService.submitEit(this.eitRequest).subscribe((result: AddEitResponse) => { + this.handleSubmitEitResult(result); + }); + } + handleSubmitEitResult(result) { + if (this.cs.validResponse(result)) { + this.cs.sharedService.setSharedData(this.eitRequest, EitRequest.SHARED_DATA); + this.cs.sharedService.setSharedData(result, AddEitResponse.SHARED_DATA); + // this.addrespList=result.SubmitEITTransactionList; + // this.itemKey=this.addrespList.P_ITEM_KEY; + // this.P_TransactionID=result.SubmitEITTransactionList.P_TRANSACTION_ID; + // this.sharedData.setSharedData(result,AddEitResponse.SHARED_DATA); + + // //this.cs.sharedService.setSharedData(result.SubmitEITTransactionList.P_TRANSACTION_ID,"TransactionIDResubmit"); + // // this.sharedData.setSharedData(this.eitRequest,EitRequest.SHARED_DATA); + this.cs.sharedService.setSharedData({ isResubmit: false, isDelete: this.isDelete }, 'confirmAddEITData'); + this.cs.openConfirmSitPage(); + // this.navCtrl.push("ConfirmAddEitPage", { isResubmit: false, isDelete: this.isDelete }); + } + } + validateEITTransaction() { + this.isDelete = false; + this.eitRequest = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, + P_FUNCTION_NAME: this.functionName, + P_DESC_FLEX_CONTEXT_CODE: this.desxFlexCode, + EITTransactionTBL: this.eitTransactionTbl + }; + + this.EITService.validateEITTransaction(this.eitRequest).subscribe((result: any) => { + this.handleEITValidateTr(result); + }); + } + private handleEITValidateTr(result) { + if (this.cs.validResponse(result)) { + // public static SHARED_DATA = 'login-request'; + // this.sharedData.setSharedData(this.eitRequest, EitRequest.SHARED_DATA); + const status = this.ts.trPK('eit', '.deleted'); + const statusID = EIT_ACTION.DELETE; + this.isDelete = true; + this.getResEITTransactionList[this.selectedIndex].status = status; + this.getResEITTransactionList[this.selectedIndex].statusID = statusID; + this.updateTransactionList(this.eitTransactionTbl, false); + this.submitEit(); + } else { + if (this.transactionNo != 0) { + this.transactionNo--; + } + } + } + updateTransactionList(list, isRemove) { + // let newlist = this.validEitTransactionTbl.map(a => a.NAME='PEI_EXTRA_INFO_ID'); + let isAnewRow = false; + let updateDelTransNo: number; + if (this.cs.hasData(this.validEitTransactionTbl)) { + this.validEitTransactionTbl.forEach(element => { + if (element.NAME == 'PEI_EXTRA_INFO_ID') { + if (element.NUMBER_VALUE == -1) { + isAnewRow = true; + return; + } + } + }); + } + list.forEach(element => { + // NAME=PEI_EXTRA_INFO_ID + // const index = this.validEitTransactionTbl.findIndex(x => x.TRANSACTION_NUMBER === element.TRANSACTION_NUMBER); + // let newlist = this.validEitTransactionTbl.map(a => a.NAME==='PEI_EXTRA_INFO_ID'); + if (isAnewRow == true) { + const index: number = this.validEitTransactionTbl.findIndex(x => x.TRANSACTION_NUMBER === element.TRANSACTION_NUMBER); + // if(index!=-1) + // this.validEitTransactionTbl.splice(index, 1); + } else { + const index: number = this.validEitTransactionTbl.findIndex(x => x.NAME === 'PEI_EXTRA_INFO_ID' && x.NUMBER_VALUE === element.NUMBER_VALUE); + if (index != -1) { + // this.validEitTransactionTbl.splice(index, 1); + if (!updateDelTransNo) { + updateDelTransNo = this.validEitTransactionTbl[index].TRANSACTION_NUMBER; + } + } + } + + }); + if (updateDelTransNo) { + this.removeItems(updateDelTransNo); + } + if (isRemove == false) { + this.validEitTransactionTbl = this.validEitTransactionTbl ? this.validEitTransactionTbl.concat(list) : list; + } + } + + fixTransactionNo(): any[] { + const list: any = []; + let newIndex = 1; + const length: number = this.validEitTransactionTbl.length; + for (let i = 0; i < length; i++) { + // let item :any={}; + const item = Object.assign({}, this.validEitTransactionTbl[i]); + const transNo: number = item.TRANSACTION_NUMBER; + const obj: any = item; + if (i == 0) { + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } else { + const prevEl: any = this.validEitTransactionTbl[i - 1].TRANSACTION_NUMBER; + if (transNo == prevEl) { + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } else { + newIndex++; + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } + } + } + return list; + } + removeItems(transNo) { + const list = []; + for (let i = 0; i < this.validEitTransactionTbl.length; i++) { + if (this.validEitTransactionTbl[i].TRANSACTION_NUMBER != transNo) { + list.push(this.validEitTransactionTbl[i]); + } + } + this.validEitTransactionTbl = list; + } + removeAddedItem(index) { + const list = []; + let item: any = []; + for (let i = 0; i < this.eitAddedList.length; i++) { + if (i != index) { + list.push(this.eitAddedList[i]); + } + } + item = this.eitAddedList[index]; + this.eitAddedList = list; + this.removeItems(item.Collection_Transaction[0].TRANSACTION_NUMBER); + } + + +////////////////////////// +// getUserDetails(){ +// this.authService.loadAuthenticatedUser().subscribe((user: AuthenticatedUser) => { +// if (user) { +// this.emp_no=user.EMPLOYEE_NUMBER; + +// } +// }); +// } +// public getAccrualBalance() { +// if (this.Sdate) { +// let today = new Date(this.Sdate); +// let day = today.getDate(); +// let month = today.getMonth() + 1; +// let year = today.getFullYear(); +// let todayDate = month + '/' + day + '/' + year; +// let effectiveDate = todayDate; +// const request = { +// P_SELECTED_EMPLOYEE_NUMBER: this.emp_no, +// P_EFFECTIVE_DATE: effectiveDate +// }; +// this.accrualService +// .getAccrualBalances(request) +// .subscribe((result: any) => { +// this.handleAccrualResult(result); +// }); +// } +// } +// handleAccrualResult(result) { +// if (this.cs.validResponse(result)) { +// this.balance=result.GetAccrualBalancesList; +// } +// } +} +////////////////////////////////up + + + + diff --git a/Mohem/src/app/sit/sit-update-list/sit-update-list.component.html b/Mohem/src/app/sit/sit-update-list/sit-update-list.component.html new file mode 100644 index 00000000..fdd40b5c --- /dev/null +++ b/Mohem/src/app/sit/sit-update-list/sit-update-list.component.html @@ -0,0 +1,61 @@ + + + + {{'eit, update-title' | translate}} + + + + + +
+ + + +
{{'worklistMain, notfDetails' | translate}}
+ + +
+
+ + + +
+ + + +
+ + + + +
+ +
+ +
+
+
+ +
+ + + + +
+ + + +
+
+
+ + +
+ + {{ 'general, next' | translate }} +
+
\ No newline at end of file diff --git a/Mohem/src/app/sit/sit-update-list/sit-update-list.component.scss b/Mohem/src/app/sit/sit-update-list/sit-update-list.component.scss new file mode 100644 index 00000000..841b9670 --- /dev/null +++ b/Mohem/src/app/sit/sit-update-list/sit-update-list.component.scss @@ -0,0 +1,17 @@ +.addEitOkButton{ + white-space: normal !important; + text-transform: capitalize !important; + min-height: 45px !important; + min-width: 5px !important; + margin: 8px !important; + background-color: #29B5BF; + width: 80% !important; + color: white!important; + border-radius: 16px !important; + } + + .editIconDiv{ + right: 10px; + position: absolute; + top: 10px; + } \ No newline at end of file diff --git a/Mohem/src/app/sit/sit-update-list/sit-update-list.component.spec.ts b/Mohem/src/app/sit/sit-update-list/sit-update-list.component.spec.ts new file mode 100644 index 00000000..4dae0866 --- /dev/null +++ b/Mohem/src/app/sit/sit-update-list/sit-update-list.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SitUpdateListComponent } from './sit-update-list.component'; + +describe('SitUpdateListComponent', () => { + let component: SitUpdateListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SitUpdateListComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SitUpdateListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/sit/sit-update-list/sit-update-list.component.ts b/Mohem/src/app/sit/sit-update-list/sit-update-list.component.ts new file mode 100644 index 00000000..ff244d2d --- /dev/null +++ b/Mohem/src/app/sit/sit-update-list/sit-update-list.component.ts @@ -0,0 +1,136 @@ +import { AddSitComponent } from './../add-sit/add-sit.component'; +import { ModalController } from '@ionic/angular'; +import { EitRequest } from './../models/eit.request'; +import { Component, OnInit } from '@angular/core'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { EITNotificatonBodyResponse } from '../models/EITNotificationBodyRes'; +import { EitService } from '../services/eit.service'; + +@Component({ + selector: 'app-sit-update-list', + templateUrl: './sit-update-list.component.html', + styleUrls: ['./sit-update-list.component.scss'], +}) +export class SitUpdateListComponent implements OnInit { + + public notificationBodyRes: any = {}; + private updatedData: any = []; + private updatedItem: any; + private itemKey: string = ""; + private notificationId: number; + private selEmp: string; + private functionName: string; + private eitTransactionTbl: any = []; + private eitRequest: EitRequest; + private descFlex: string; + + constructor(public cs: CommonService, public eitService: EitService, public modalController: ModalController) { + this.notificationBodyRes = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.SHARED_DATA, false); + let notification = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.NOT_WORKLIST, false); + this.itemKey = notification.ITEM_KEY; + this.notificationId = notification.NOTIFICATION_ID; + this.functionName = notification.FUNCTION_NAME; + this.selEmp = notification.SELECTED_EMPLOYEE_NUMBER; + this.descFlex = notification.DESC_FLEX_CONTEXT_CODE; + this.fillEitTransactionTable(); + } + + ngOnInit() { console.log("ngOnInit");} + + async updateEitNot(index) { + let item = this.notificationBodyRes[index].Collection_Notification; + this.cs.sharedService.setSharedData({ dirfromNotificationPage: true, submitEITObjList: item }, 'AddEITData') + const modal = await this.modalController.create({ + component: AddSitComponent + }); + + modal.onDidDismiss() + .then((data: any) => { + // console.log("data" + data); + // console.log("data" + data.data.updated); + // console.log("data" + data.data.eitRequest.EITTransactionTBL); + + + + if(data.data == undefined) + { + return; + } + else if (data.data) { + this.updatedData = this.updatedData ? this.updatedData.concat(data.data.updated) : data.data.updated; + this.notificationBodyRes[index].Collection_Notification = data.data.updated; + this.updateTransactionList(data.data.eitRequest.EITTransactionTBL); + } + }); + + return await modal.present(); + } + + updateTransactionList(list) { + list.forEach(element => { + const index = this.eitTransactionTbl.findIndex(x => x.TRANSACTION_NUMBER === element.TRANSACTION_NUMBER); + if (index != -1) + this.eitTransactionTbl.splice(index, 1); + }); + this.eitTransactionTbl = this.eitTransactionTbl ? this.eitTransactionTbl.concat(list) : list; + } + + resubmitEit() { + this.eitRequest = new EitRequest(); + this.eitRequest.EITTransactionTBL = this.eitTransactionTbl; + this.eitRequest.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; + this.eitRequest.P_MENU_TYPE = "E"; + this.eitRequest.P_SELECTED_RESP_ID = -999; + this.eitRequest.P_FUNCTION_NAME = this.functionName; + this.eitRequest.P_DESC_FLEX_CONTEXT_CODE = this.descFlex; + let body = { + P_NOTIFICATION_ID: this.notificationId, + P_ITEM_KEY: this.itemKey, + EITTransactionTBL: this.eitTransactionTbl + } + this.eitService.reSubmitEit(body).subscribe((result: any) => { + this.handleResubmitEit(result); + }); + } + + handleResubmitEit(result) { + if (this.cs.validResponse(result)) { + this.cs.sharedService.setSharedData(result.ResubmitEITTransactionList.P_TRANSACTION_ID, "TransactionIDResubmit"); + this.cs.sharedService.setSharedData(this.eitRequest, EitRequest.SHARED_DATA); + this.cs.sharedService.setSharedData({ isResubmit: true }, 'confirmAddEITData'); + this.cs.openConfirmSitPage(); + } + } + + fillEitTransactionTable() { + let valuseArr: any = []; + let varcharValue: any = null; + let numbervalue: any = 0; + let dateValue: any = null; + let transNo: number = 1; + let textValue = ""; + // if(this.ExtraObj.transactionNo) + // transNo=this.ExtraObj.transactionNo; + for (let j = 0; j < this.notificationBodyRes.length; j++) { + let list = this.notificationBodyRes[j].Collection_Notification; + for (let i = 0; i < list.length; i++) { + let item = list[i]; + varcharValue = null; + numbervalue = null; + dateValue = null; + valuseArr.push( + { + TRANSACTION_NUMBER: item.TRANSACTION_NUMBER, + NAME: item.APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: item.VARCHAR2_VALUE, + NUMBER_VALUE: item.NUMBER_VALUE, + DATE_VALUE: item.DATE_VALUE, + } + ) + }// end for + } + this.eitTransactionTbl = valuseArr; + } + +} + diff --git a/Mohem/src/app/sit/sit.module.ts b/Mohem/src/app/sit/sit.module.ts new file mode 100644 index 00000000..a897b266 --- /dev/null +++ b/Mohem/src/app/sit/sit.module.ts @@ -0,0 +1,81 @@ +import { AddAttachComponent } from './add-attach/add-attach.component'; +import { ConfirmAddSitComponent } from './confirm-add-sit/confirm-add-sit.component'; +import { AddSitComponent } from './add-sit/add-sit.component'; +import { HmgCommonModule } from 'src/app/hmg-common/hmg-common.module'; +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { Routes, RouterModule } from '@angular/router'; +import { IonicModule } from '@ionic/angular'; +import { SitPage } from './sit.page'; +import { HomeComponent } from './home/home.component'; +import { SitListComponent } from './sit-list/sit-list.component'; +import { DatePicker } from '@ionic-native/date-picker/ngx'; +import { WorkListAttachViewComponent } from '../notification/work-list-attach-view/work-list-attach-view.component'; +import { SitUpdateListComponent } from './sit-update-list/sit-update-list.component'; +import { SubmitSitModalComponent } from './submit-sit-modal/submit-sit-modal.component'; + + +const routes: Routes = [ + { + path: '', + component: SitPage, + children: [ + { + path: 'homepage', + component: HomeComponent + }, + { + path: 'sit-list', + component: SitListComponent + }, + { + path: 'add-sit', + component: AddSitComponent + }, + { + path: 'confirm-add-sit', + component: ConfirmAddSitComponent + }, + { + path: 'add-attach', + component: AddAttachComponent + }, + { + path: 'sit-update-list', + component: SitUpdateListComponent + }, + { + path: 'sit-submit-modal', + component: SubmitSitModalComponent + } + ] + } +]; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + HmgCommonModule, + RouterModule.forChild(routes) + ], + declarations: [ + SitPage, + HomeComponent, + SitListComponent, + AddSitComponent, + ConfirmAddSitComponent, + AddAttachComponent, + SitUpdateListComponent, + SubmitSitModalComponent + ], + entryComponents: [ + WorkListAttachViewComponent + ], + providers: [ + DatePicker + ] +}) +export class SitPageModule { } \ No newline at end of file diff --git a/Mohem/src/app/sit/sit.page.html b/Mohem/src/app/sit/sit.page.html new file mode 100644 index 00000000..67cbe279 --- /dev/null +++ b/Mohem/src/app/sit/sit.page.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Mohem/src/app/sit/sit.page.scss b/Mohem/src/app/sit/sit.page.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/sit/sit.page.spec.ts b/Mohem/src/app/sit/sit.page.spec.ts new file mode 100644 index 00000000..56a2f600 --- /dev/null +++ b/Mohem/src/app/sit/sit.page.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SitPage } from './sit.page'; + +describe('SitPage', () => { + let component: SitPage; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SitPage ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SitPage); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/sit/sit.page.ts b/Mohem/src/app/sit/sit.page.ts new file mode 100644 index 00000000..50d94858 --- /dev/null +++ b/Mohem/src/app/sit/sit.page.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-sit', + templateUrl: './sit.page.html', + styleUrls: ['./sit.page.scss'], +}) +export class SitPage implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/Mohem/src/app/sit/submit-sit-modal/submit-sit-modal.component.html b/Mohem/src/app/sit/submit-sit-modal/submit-sit-modal.component.html new file mode 100644 index 00000000..4bbf7b6b --- /dev/null +++ b/Mohem/src/app/sit/submit-sit-modal/submit-sit-modal.component.html @@ -0,0 +1,39 @@ + + + + + +

{{'eit,confirmation' | translate}}

+ +
+
+ {{'eit,no-attachment' | translate}} +
+
+ {{'eit,no-note' | translate}} +
+
+ + + + + {{'eit,submit' | translate}} + {{ts.trPK('general','ok')}} + + + + + {{ts.trPK('general','cancel')}} + + + + +
+ \ No newline at end of file diff --git a/Mohem/src/app/sit/submit-sit-modal/submit-sit-modal.component.scss b/Mohem/src/app/sit/submit-sit-modal/submit-sit-modal.component.scss new file mode 100644 index 00000000..3dabecd5 --- /dev/null +++ b/Mohem/src/app/sit/submit-sit-modal/submit-sit-modal.component.scss @@ -0,0 +1,53 @@ +.rowBtn{ + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; +} + +.Header{ + color: black !important; + font-size: 25px !important; + font-weight: bold !important;; + margin: 0; + text-align: center; + margin-bottom: 20px; +} + +.labelRadio{ + color: black !important; + font-weight: bold !important; + padding-bottom: 20px; +} + +.labelcheck{ + color: red !important; + font-weight: bold !important; + margin-bottom: 10px; +} + +.submitOkButton{ + white-space: normal !important; + text-transform: capitalize !important; + min-height: 45px !important; + min-width: 5px !important; + margin: 8px !important; + --background:: #29B5BF; + width: 100% !important; + color: white!important; + border-radius: 16px !important; +} +.submitCancelButton{ + white-space: normal !important; + text-transform: capitalize !important; + min-height: 45px !important; + min-width: 5px !important; + margin: 8px !important; + --background:: #29B5BF; + width: 100% !important; + color: white!important; + border-radius: 16px !important; +} + + + diff --git a/Mohem/src/app/sit/submit-sit-modal/submit-sit-modal.component.spec.ts b/Mohem/src/app/sit/submit-sit-modal/submit-sit-modal.component.spec.ts new file mode 100644 index 00000000..70df563a --- /dev/null +++ b/Mohem/src/app/sit/submit-sit-modal/submit-sit-modal.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SubmitSitModalComponent } from './submit-sit-modal.component'; + +describe('SubmitSitModalComponent', () => { + let component: SubmitSitModalComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SubmitSitModalComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SubmitSitModalComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/sit/submit-sit-modal/submit-sit-modal.component.ts b/Mohem/src/app/sit/submit-sit-modal/submit-sit-modal.component.ts new file mode 100644 index 00000000..4e6f8e82 --- /dev/null +++ b/Mohem/src/app/sit/submit-sit-modal/submit-sit-modal.component.ts @@ -0,0 +1,36 @@ +import { Component, OnInit } from '@angular/core'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { ModalController } from '@ionic/angular'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; + +@Component({ + selector: 'app-submit-sit-modal', + templateUrl: './submit-sit-modal.component.html', + styleUrls: ['./submit-sit-modal.component.scss'], +}) +export class SubmitSitModalComponent implements OnInit { + submitAttachmentList :any =[]; + eitComments: string; + constructor( public ts: TranslatorService,private modalCtrl: ModalController, private cs: CommonService){ + this.submitAttachmentList = this.cs.sharedService.getSharedData('submitAttachmentList', false); + this.eitComments = this.cs.sharedService.getSharedData('eitComments', false); + } + + ngOnInit() { + console.log("modal"); + //this.actionBtns = this.cs.sharedService.getSharedData("passActionMore" , false); + console.log("modal"); + + } + closeModal() { + this.modalCtrl.dismiss(); + } + + + OkBtnModal() { + let data = "ok"; + this.modalCtrl.dismiss(data); + } + +} +