From 061c740c55e29db412112a6d3650450053cab9b3 Mon Sep 17 00:00:00 2001 From: ashwaq Date: Mon, 28 Oct 2019 10:49:33 +0300 Subject: [PATCH] Add payslip + Fix vacation rule --- Mohem/src/app/app-routing.module.ts | 4 +- Mohem/src/app/eit/home/home.component.ts | 3 + .../services/common/common.service.ts | 10 + .../file-uploder-profile.component.ts | 58 +++-- Mohem/src/app/home/home.page.html | 7 + Mohem/src/app/home/home.page.ts | 8 + .../deductions/deductions.component.html | 33 +++ .../deductions/deductions.component.scss | 0 .../deductions/deductions.component.spec.ts | 27 +++ .../deductions/deductions.component.ts | 51 ++++ .../payslip/earnings/earnings.component.html | 35 +++ .../payslip/earnings/earnings.component.scss | 0 .../earnings/earnings.component.spec.ts | 27 +++ .../payslip/earnings/earnings.component.ts | 51 ++++ .../src/app/payslip/home/home.component.html | 221 ++++++++++++++++++ .../src/app/payslip/home/home.component.scss | 0 .../app/payslip/home/home.component.spec.ts | 27 +++ Mohem/src/app/payslip/home/home.component.ts | 137 +++++++++++ Mohem/src/app/payslip/model/payslipRequest.ts | 4 + Mohem/src/app/payslip/payslip.module.ts | 47 ++++ Mohem/src/app/payslip/payslip.page.html | 3 + Mohem/src/app/payslip/payslip.page.scss | 0 Mohem/src/app/payslip/payslip.page.spec.ts | 27 +++ Mohem/src/app/payslip/payslip.page.ts | 15 ++ .../payslip/service/payslip.service.spec.ts | 12 + .../app/payslip/service/payslip.service.ts | 54 +++++ Mohem/src/app/uI-elements/select.input.ts | 13 +- .../create-vacation-rule.component.html | 8 +- .../create-vacation-rule.component.ts | 190 +++++++++++++-- .../service/vacation-rule-service.service.ts | 8 +- Mohem/src/assets/localization/i18n.json | 90 ++++++- 31 files changed, 1125 insertions(+), 45 deletions(-) create mode 100644 Mohem/src/app/payslip/deductions/deductions.component.html create mode 100644 Mohem/src/app/payslip/deductions/deductions.component.scss create mode 100644 Mohem/src/app/payslip/deductions/deductions.component.spec.ts create mode 100644 Mohem/src/app/payslip/deductions/deductions.component.ts create mode 100644 Mohem/src/app/payslip/earnings/earnings.component.html create mode 100644 Mohem/src/app/payslip/earnings/earnings.component.scss create mode 100644 Mohem/src/app/payslip/earnings/earnings.component.spec.ts create mode 100644 Mohem/src/app/payslip/earnings/earnings.component.ts create mode 100644 Mohem/src/app/payslip/home/home.component.html create mode 100644 Mohem/src/app/payslip/home/home.component.scss create mode 100644 Mohem/src/app/payslip/home/home.component.spec.ts create mode 100644 Mohem/src/app/payslip/home/home.component.ts create mode 100644 Mohem/src/app/payslip/model/payslipRequest.ts create mode 100644 Mohem/src/app/payslip/payslip.module.ts create mode 100644 Mohem/src/app/payslip/payslip.page.html create mode 100644 Mohem/src/app/payslip/payslip.page.scss create mode 100644 Mohem/src/app/payslip/payslip.page.spec.ts create mode 100644 Mohem/src/app/payslip/payslip.page.ts create mode 100644 Mohem/src/app/payslip/service/payslip.service.spec.ts create mode 100644 Mohem/src/app/payslip/service/payslip.service.ts diff --git a/Mohem/src/app/app-routing.module.ts b/Mohem/src/app/app-routing.module.ts index 11b5d4ea..849be2c9 100644 --- a/Mohem/src/app/app-routing.module.ts +++ b/Mohem/src/app/app-routing.module.ts @@ -16,7 +16,9 @@ const routes: Routes = [ { 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: 'my-subordinate', loadChildren: './my-subordinate/my-subordinate.module#MySubordinatePageModule' }, + { path: 'payslip', loadChildren: './payslip/payslip.module#PayslipPageModule' } + ]; diff --git a/Mohem/src/app/eit/home/home.component.ts b/Mohem/src/app/eit/home/home.component.ts index c0665342..686b5c0d 100644 --- a/Mohem/src/app/eit/home/home.component.ts +++ b/Mohem/src/app/eit/home/home.component.ts @@ -52,6 +52,9 @@ export class HomeComponent implements OnInit { } else if (menuEntry.REQUEST_TYPE == 'EIT') { this.cs.openEitListPage(); } + if (menuEntry.REQUEST_TYPE =='PAYSLIP'){ + this.cs.openPayslipPage(); + } } } 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 0357c466..9f8940f1 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -1004,6 +1004,16 @@ export class CommonService { public openChangeImagePage() { this.nav.navigateForward(["/profile/profileImg"]); } + public openPayslipPage() { + this.nav.navigateForward(["/payslip/home"]); + } + public openEarningsPage() { + this.nav.navigateForward(["/payslip/Earnings"]); + } + public openDeductionsPage() { + this.nav.navigateForward(["/payslip/Deductions"]); + } + public reload(url: string, from: string) { console.log("force reload called from:" + from); // window.location.reload(); diff --git a/Mohem/src/app/hmg-common/ui/file-uploder-profile/file-uploder-profile.component.ts b/Mohem/src/app/hmg-common/ui/file-uploder-profile/file-uploder-profile.component.ts index 4a17f31b..06364263 100644 --- a/Mohem/src/app/hmg-common/ui/file-uploder-profile/file-uploder-profile.component.ts +++ b/Mohem/src/app/hmg-common/ui/file-uploder-profile/file-uploder-profile.component.ts @@ -6,6 +6,7 @@ import { FilePath } from "@ionic-native/file-path/ngx"; import { File } from "@ionic-native/file/ngx"; import { TranslatorService } from '../../services/translator/translator.service'; import { Base64 } from "@ionic-native/base64/ngx"; +import { DevicePermissionsService } from '../../services/device-permissions/device-permissions.service'; // import { Chooser } from '@ionic-native/chooser'; @Component({ @@ -24,10 +25,12 @@ export class FileUploderProfileComponent implements OnInit { public image: string; public attachmentImg = 'assets/icon/attachment.png'; public deleteImg = 'assets/icon/delete.png'; + public defultProfile = '../../../../assets/imgs/profile.png'; public selectedImage:any; public nativePath: any; public errorMsg:any; public allowdType: any = ["jpg", "jpeg", "png"]; + camera: boolean constructor( public cameraController:Camera, @@ -39,6 +42,8 @@ export class FileUploderProfileComponent implements OnInit { private file: File, public ts: TranslatorService, public base64:Base64, + private permissions: DevicePermissionsService + // private chooser: Chooser @@ -59,17 +64,30 @@ export class FileUploderProfileComponent implements OnInit { //selected attach //need convert //insert or display + + private permissionsToOpenCamera() { + this.permissions.requestCameraAutherization().then(granted => { + this.camera = granted as boolean; + if (this.camera) { + this.openFile(); + } + } + ); + } + + async openFile(){ const actionSheet = await this.actionSheetCtrl.create({ header: 'Change Profile Photo', - buttons: [{ - text: 'Delete Current Image', - role: 'destructive', - icon: 'trash', - handler: () => { - console.log('Delete clicked'); - } - }, { + buttons: [{ + // text: 'Delete Current Image', + // role: 'destructive', + // icon: 'trash', + // handler: () => { + // console.log('Delete clicked'); + // this.deleteCurrent(); + // } + // },{ text: 'Take Photo', icon: 'camera', handler: () => { @@ -123,6 +141,8 @@ export class FileUploderProfileComponent implements OnInit { public deleteCurrent(){ // send empty image //this.onimgLoad.emit(""); + console.log("deleteCurrent"); + this.encodeFiles(this.defultProfile); } @@ -143,21 +163,21 @@ export class FileUploderProfileComponent implements OnInit { } encodeFiles(entry) { - - this.base64.encodeFile(this.nativePath).then( + alert("encodeFiles") + this.base64.encodeFile(entry).then( (base64File: string) => { - const type = this.nativePath.substr( - this.nativePath.lastIndexOf(".") + 1 - ); + // const type = this.nativePath.substr( + // this.nativePath.lastIndexOf(".") + 1 + // ); - console.log("base64File 1" + base64File); + alert("base64File 1" + base64File); - if (this.allowdType.includes(type.toLowerCase())) { - } else { - this.attachmentData = null; - this.errorMsg = this.ts.trPK("general", "not-supported"); - } + // if (this.allowdType.includes(type.toLowerCase())) { + // } else { + // this.attachmentData = null; + // this.errorMsg = this.ts.trPK("general", "not-supported"); + // } }, err => { console.log(err); diff --git a/Mohem/src/app/home/home.page.html b/Mohem/src/app/home/home.page.html index 917b961e..82d0a99b 100644 --- a/Mohem/src/app/home/home.page.html +++ b/Mohem/src/app/home/home.page.html @@ -72,6 +72,13 @@

{{ts.trPK('changePassword','changePassword')}}

+ + + + + + + +
{{ts.trPK('payslip','payroll-info')}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + +
{{ts.trPK('payslip','summary-payment')}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
{{ts.trPK('payslip','payment-information')}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + \ No newline at end of file diff --git a/Mohem/src/app/payslip/home/home.component.scss b/Mohem/src/app/payslip/home/home.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/payslip/home/home.component.spec.ts b/Mohem/src/app/payslip/home/home.component.spec.ts new file mode 100644 index 00000000..5ec1377b --- /dev/null +++ b/Mohem/src/app/payslip/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/payslip/home/home.component.ts b/Mohem/src/app/payslip/home/home.component.ts new file mode 100644 index 00000000..2c11be94 --- /dev/null +++ b/Mohem/src/app/payslip/home/home.component.ts @@ -0,0 +1,137 @@ +import { Component, OnInit } from '@angular/core'; +import {PayslipService} from '../service/payslip.service' +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service'; +@Component({ + selector: 'app-home', + templateUrl: './home.component.html', + styleUrls: ['./home.component.scss'], +}) +export class HomeComponent implements OnInit { + selEmp: string; + respID: number; + selMenu: MenuResponse; + GetPayslipList:any=''; + GetSummaryOfPaymentList:any=''; + GetPaymentInformationList:any=''; + showPaySlip:any=[]; + ActionContextID:any; + public static ACTION_CONTEXT_ID = "passActionContectID"; + + constructor( + public payslipService:PayslipService, + public ts: TranslatorService, + public common: CommonService, + public sharedData: SharedDataService, + ) {} + + ngOnInit() { + console.log("test"); + + this.selEmp = this.common.sharedService.getSharedData( + MenuResponse.SHARED_SEL_EMP, + false + ); + console.log(" this.selEmp" + this.selEmp); + this.respID = this.common.sharedService.getSharedData( + MenuResponse.SHARED_SEL_RESP_ID, + false + ); + console.log(" this.respID" + this.respID); + + this.selMenu = new MenuResponse(); + this.selMenu = this.common.sharedService.getSharedData( + MenuResponse.SHARED_DATA, + false + ); + console.log(" this.selMenu" + this.selMenu); + + + this.getPayslip(); + } + + getPayslip(){ + const request = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp,//'125346',//this.selEmp, + P_MENU_TYPE: this.selMenu.List_Menu.MENU_TYPE,// 'E',//this.selMenu.List_Menu.MENU_TYPE, + P_SELECTED_RESP_ID:this.respID//"-999" //this.respID, + // P_PAGE_NUM: this.P_PAGE_NUM, + // P_PAGE_LIMIT: this.P_PAGE_LIMIT + }; + + this.payslipService.getPayslip(request, ()=> {} , this.ts.trPK('general', 'retry')).subscribe((result)=> + { + this.handleRespondGetPayslipResult(result); + } + ); + } + + handleRespondGetPayslipResult(result){ + + if (result.GetPayslipList != null) { + this.GetPayslipList = result.GetPayslipList; + + } + + } + + // showPaymentInfo + showInfo(event){ + console.log(event.detail.value); + const index = parseInt(event.detail.value); + this.showPaySlip =this.GetPayslipList[index]; + this.ActionContextID=this.GetPayslipList[index].ACTION_CONTEXT_ID; + this.common.sharedService.setSharedData(this.ActionContextID,HomeComponent.ACTION_CONTEXT_ID); + this.getSummeryOfPayment(this.ActionContextID); + this.getPaymentInfo(this.ActionContextID) + + } + + getSummeryOfPayment(ActionContextID){ + const request = { + P_ACTION_CONTEXT_ID: ActionContextID, + }; + + this.payslipService.getSummeryOFPayment(request, ()=> {} , this.ts.trPK('general', 'retry')).subscribe((result)=> + { + this.handleSummeryOfPaymentResult(result); + } + ); + } + + handleSummeryOfPaymentResult(result){ + if (result.GetSummaryOfPaymentList != null) { + this.GetSummaryOfPaymentList = result.GetSummaryOfPaymentList[0]; + } + } + + +getPaymentInfo(ActionContextID){ + const request = { + P_ACTION_CONTEXT_ID: ActionContextID, + }; + + this.payslipService.getPaymentInfo(request, ()=> {} , this.ts.trPK('general', 'retry')).subscribe((result)=> + { + this.handleGetPaymentInfoResult(result); + } + ); +} + +handleGetPaymentInfoResult(result){ + if (result.GetPaymentInformationList != null) { + this.GetPaymentInformationList = result.GetPaymentInformationList[0]; + } +} + +openEarings(){ + this.common.openEarningsPage(); + +} +openDeductions(){ + this.common.openDeductionsPage(); +} + +} diff --git a/Mohem/src/app/payslip/model/payslipRequest.ts b/Mohem/src/app/payslip/model/payslipRequest.ts new file mode 100644 index 00000000..d52ea82c --- /dev/null +++ b/Mohem/src/app/payslip/model/payslipRequest.ts @@ -0,0 +1,4 @@ +// import { Request } from './request'; +// export class PayslipRequest extends Request{ + +// } diff --git a/Mohem/src/app/payslip/payslip.module.ts b/Mohem/src/app/payslip/payslip.module.ts new file mode 100644 index 00000000..be74137e --- /dev/null +++ b/Mohem/src/app/payslip/payslip.module.ts @@ -0,0 +1,47 @@ +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 {EarningsComponent}from './earnings/earnings.component' +import {DeductionsComponent} from './deductions/deductions.component' +import { PayslipPage } from './payslip.page'; +import {HomeComponent} from './home/home.component' +const routes: Routes = [ + { + path: '', + component: PayslipPage, + children: [ + { + path: 'home', + component: HomeComponent + }, + { + path: 'Deductions', + component: DeductionsComponent + }, + { + path: 'Earnings', + component: EarningsComponent + }, + ] + } +]; + + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + RouterModule.forChild(routes) + ], + providers:[ + HomeComponent, + EarningsComponent, + DeductionsComponent + ], + declarations: [PayslipPage,HomeComponent,EarningsComponent,DeductionsComponent] +}) +export class PayslipPageModule {} diff --git a/Mohem/src/app/payslip/payslip.page.html b/Mohem/src/app/payslip/payslip.page.html new file mode 100644 index 00000000..67cbe279 --- /dev/null +++ b/Mohem/src/app/payslip/payslip.page.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Mohem/src/app/payslip/payslip.page.scss b/Mohem/src/app/payslip/payslip.page.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/payslip/payslip.page.spec.ts b/Mohem/src/app/payslip/payslip.page.spec.ts new file mode 100644 index 00000000..bb5488ad --- /dev/null +++ b/Mohem/src/app/payslip/payslip.page.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PayslipPage } from './payslip.page'; + +describe('PayslipPage', () => { + let component: PayslipPage; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PayslipPage ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PayslipPage); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/payslip/payslip.page.ts b/Mohem/src/app/payslip/payslip.page.ts new file mode 100644 index 00000000..15744cfa --- /dev/null +++ b/Mohem/src/app/payslip/payslip.page.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-payslip', + templateUrl: './payslip.page.html', + styleUrls: ['./payslip.page.scss'], +}) +export class PayslipPage implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/Mohem/src/app/payslip/service/payslip.service.spec.ts b/Mohem/src/app/payslip/service/payslip.service.spec.ts new file mode 100644 index 00000000..68d1bbde --- /dev/null +++ b/Mohem/src/app/payslip/service/payslip.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { PayslipService } from './payslip.service'; + +describe('PayslipService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: PayslipService = TestBed.get(PayslipService); + expect(service).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/payslip/service/payslip.service.ts b/Mohem/src/app/payslip/service/payslip.service.ts new file mode 100644 index 00000000..ffa2c87c --- /dev/null +++ b/Mohem/src/app/payslip/service/payslip.service.ts @@ -0,0 +1,54 @@ +import { Injectable } from '@angular/core'; +import { ConnectorService } from '../../hmg-common/services/connector/connector.service'; +import { AuthenticationService } from '../../hmg-common/services/authentication/authentication.service'; +import { Observable } from 'node_modules_/@angular/cli/node_modules/rxjs'; + +@Injectable({ + providedIn: 'root' +}) +export class PayslipService { + public static getPayslip ="Services/ERP.svc/REST/GET_PAYSLIP"; + public static getSummaryOFPayment ="Services/ERP.svc/REST/GET_SUMMARY_OF_PAYMENT"; + public static getPaymentInfo ="Services/ERP.svc/REST/GET_PAYMENT_INFORMATION"; + public static getEarnings ="Services/ERP.svc/REST/GET_EARNINGS"; + public static getDeduction ="Services/ERP.svc/REST/GET_DEDUCTIONS"; + + constructor( + public api: ConnectorService, + public authService: AuthenticationService, + ) { } + + +public getPayslip(PayslipRequest: any, onError?: any,errorLabel?: string): Observable { + const request = PayslipRequest; + this.authService.authenticateRequest(request); + return this.api.post(PayslipService.getPayslip,request,onError,errorLabel); +} +public getSummeryOFPayment(PayslipRequest: any, onError?: any,errorLabel?: string): Observable { + const request = PayslipRequest; + this.authService.authenticateRequest(request); + return this.api.post(PayslipService.getSummaryOFPayment,request,onError,errorLabel); +} + +public getPaymentInfo(PayslipRequest: any, onError?: any,errorLabel?: string): Observable { + const request = PayslipRequest; + this.authService.authenticateRequest(request); + return this.api.post(PayslipService.getPaymentInfo,request,onError,errorLabel); +} +public getEarings(PayslipRequest: any, onError?: any,errorLabel?: string): Observable { + const request = PayslipRequest; + this.authService.authenticateRequest(request); + return this.api.post(PayslipService.getEarnings,request,onError,errorLabel); +} + +public getDeduction(PayslipRequest: any, onError?: any,errorLabel?: string): Observable { + const request = PayslipRequest; + this.authService.authenticateRequest(request); + return this.api.post(PayslipService.getDeduction,request,onError,errorLabel); +} + + + +} + + diff --git a/Mohem/src/app/uI-elements/select.input.ts b/Mohem/src/app/uI-elements/select.input.ts index ce0666c4..ea1346c7 100644 --- a/Mohem/src/app/uI-elements/select.input.ts +++ b/Mohem/src/app/uI-elements/select.input.ts @@ -23,11 +23,14 @@ export class SelectInput extends UiElement { if (this.disabled == "N") { this.disabled = "disabled" } else { this.disabled = "" } if (this.hidden == "N") { this.hidden = "display:none;" } else { this.hidden = "" } const template = - "
" + - "" + - "" + - "
"; + "
" + + " " + + " "+ + "
"; + + // "" + // "" + this.label + "" + diff --git a/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.html b/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.html index e405f6e5..e7dc61b3 100644 --- a/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.html +++ b/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.html @@ -1,8 +1,14 @@ - + + + + + + + {{ 'vacation-rule, create-vacation-rule' | translate}} diff --git a/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.ts b/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.ts index 1dc9db38..238f5e77 100644 --- a/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.ts +++ b/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.ts @@ -54,6 +54,8 @@ export class CreateVacationRuleComponent implements OnInit { SelAction: string = ""; hideForwordEmployee: any; exampleJsonObject: any; + wFLookUpList:any; + GetRespondAttributeValueList:any; private numberInput: NumberInput; private textInput: TextInput; private selectInput: SelectInput; @@ -182,24 +184,58 @@ export class CreateVacationRuleComponent implements OnInit { msg = this.ts.trPK('vacation-rule', 'fillSDate'); // this.common.showAlert(msg); this.cs.presentAlert(msg); + } else if (this.selEmployeeID == undefined) { + msg = this.ts.trPK('vacation-rule', 'fillReplacement'); + // this.common.showAlert(msg); + this.cs.presentAlert(msg); } else { - var responseAttrDic = this.exampleJsonObject; + // var responseAttrDic = this.exampleJsonObject;//haroon + var responseAttrDic =this.RespondAttributeList; // Ashwaq this.P_RESPOND_ATTRIBUTES_TBL = []; for (let key in responseAttrDic) { let obj: any = {}; - obj.ATTRIBUTE_NAME = key; + //obj.ATTRIBUTE_NAME = key;haroon + obj.ATTRIBUTE_NAME =responseAttrDic[key].ATTRIBUTE_NAME;//ashwaq to get ATTRIBUTE_NAME + if (typeof responseAttrDic[key] === "number") { - obj.ATTRIBUTE_NUMBER_VALUE = responseAttrDic[key]; + // obj.ATTRIBUTE_NUMBER_VALUE = responseAttrDic[key];haroon + obj.ATTRIBUTE_NUMBER_VALUE = (document.getElementById(responseAttrDic[key].ATTRIBUTE_NAME) as HTMLInputElement).value; + } // else if (isDate(responseAttrDic[key])) { // obj.ATTRIBUTE_DATE_VALUE = responseAttrDic[key]; // } else { - obj.ATTRIBUTE_TEXT_VALUE = responseAttrDic[key]; + //obj.ATTRIBUTE_TEXT_VALUE = responseAttrDic[key];//haroon + obj.ATTRIBUTE_TEXT_VALUE =(document.getElementById(responseAttrDic[key].ATTRIBUTE_NAME) as HTMLInputElement).value; + } this.P_RESPOND_ATTRIBUTES_TBL.push(obj); } + + + // for (let key in responseAttrDic) { + // let obj: any = {}; + // obj.ATTRIBUTE_NAME = key; + // if (typeof responseAttrDic[key] === "number") { + // // obj.ATTRIBUTE_NUMBER_VALUE = responseAttrDic[key]; + // obj.ATTRIBUTE_NUMBER_VALUE = (document.getElementById(responseAttrDic[key].ATTRIBUTE_NAME) as HTMLInputElement).value; + // } + // else if (responseAttrDic[key].ATTRIBUTE_TYPE == "VARCHAR2") { + // obj.ATTRIBUTE_TEXT_VALUE = (document.getElementById(responseAttrDic[key].ATTRIBUTE_NAME) as HTMLInputElement).value; + // } + // // else if (isDate(responseAttrDic[key])) { + // // obj.ATTRIBUTE_DATE_VALUE = responseAttrDic[key]; + // // } + // else { + // obj.ATTRIBUTE_TEXT_VALUE = (document.getElementById(responseAttrDic[key].ATTRIBUTE_NAME) as HTMLInputElement).value;//responseAttrDic[key]; + // } + // this.P_RESPOND_ATTRIBUTES_TBL.push(obj); + // } let repUserName = this.selEmployeeID; + if(repUserName == null || repUserName ==""){ + + } if (this.hideForwordEmployee && this.hideForwordEmployee.ATTRIBUTE_NAME) { let obj: any = {}; repUserName = ""; @@ -249,7 +285,7 @@ export class CreateVacationRuleComponent implements OnInit { this.vacationRuleRequest = request; this.vacationRuleService.createVacationRule(request, () => { - this.ApplyFunc(); + //this.ApplyFunc(); }, this.ts.trPK('general', 'retry')).subscribe((result) => { if (this.cs.validResponse(result)) { console.log(result); @@ -442,8 +478,9 @@ export class CreateVacationRuleComponent implements OnInit { this.hideForwordEmployee = result.RespondRolesList[0]; } - if (result.RespondAttributesList){ + if (result.RespondAttributesList) { //this.schemaNotific = JSON.parse(result.P_Schema); + ////////************************************** */ this.createVacationDynamicFields(result.RespondAttributesList); } this.reverseAction(); @@ -457,17 +494,29 @@ export class CreateVacationRuleComponent implements OnInit { } } - createVacationDynamicFields(RespondAttributesList){ + createVacationDynamicFields(RespondAttributesList) { + console.log("createVacationDynamicFields"); const containerId = 'CVDynamicFields'; - for(let i=0;i 0) { + this.GetRespondAttributeValueList=result.GetRespondAttributeValueList; let resp_val: any = result.GetRespondAttributeValueList[0].P_ATTRIBUTE_NAME; let Emp_ID: any = result.GetRespondAttributeValueList[0].P_ATTRIBUTE_TEXT_VALUE; let valueList = result.GetRespondAttributeValueList; @@ -509,6 +559,9 @@ export class CreateVacationRuleComponent implements OnInit { obj[valueList[i].P_ATTRIBUTE_NAME] = valueList[i].P_ATTRIBUTE_TEXT_VALUE; } this.exampleJsonObject = obj; + //Call set value of responsed attribute + // this.createVacationDynamicFields(this.exampleJsonObject);//ashwaq + this.setRespondAttributeValue(); // this.exampleJsonObject = new Map(valueList.map(obj => [ obj., obj.P_ATTRIBUTE_TEXT_VALUE ])); } } @@ -586,5 +639,110 @@ export class CreateVacationRuleComponent implements OnInit { return pAction; } } + getWFLookUp(resAttrFormat: any, ATTRIBUTE_NAME) { + + const request = { + P_LOOKUP_TYPE: resAttrFormat, + } + + this.vacationRuleService.getLookup(request, () => { }, this.ts.trPK('general', 'retry')).subscribe( + (result: any) => { + if (this.cs.validResponse(result)) { + // console.log("Lookup result "+ result); + + this.wFLookUpList=result.WFLookUpList + this.fillDropdownList(result.WFLookUpList, ATTRIBUTE_NAME); + } else { + this.cs.presentAlert(result.ErrorEndUserMessage); + } + }); + + } + + + // handleGetLookupResult(result, ATTRIBUTE_FORMAT, attributeID) { + // //set the value + // console.log("handleGetLookupResult"); + // let obj : any=[]; + // obj=result. + + // // for (let i = 0; i < result.length; i++) { + + // // obj[i] = result[i].LOOKUP_MEANING; + // // } + // //this.selectInput = new SelectInput(val1, val2,obj[0], containerId,"","",""); + // this.fillDropdownList(obj,attributeID); + + // } + + + + + + + fillDropdownList(optionList: any = [],attributeID) { + let elemID: any = attributeID; + let eitObj: any; + + if (optionList.length > 0) { + + let select = document.getElementById(elemID) as HTMLSelectElement; + document.getElementById(elemID).innerHTML = ""; + + + 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].LOOKUP_MEANING; + option.value = optionList[i].LOOKUP_CODE; + select.add(option); + + } + + select.disabled = false; + } + + } + + +setRespondAttributeValue(){ + + for (let i = 0; i < this.RespondAttributeList.length; i++) { + if(this.RespondAttributeList[i].ATTRIBUTE_NAME == this.GetRespondAttributeValueList[i].P_ATTRIBUTE_NAME){ + if (this.RespondAttributeList[i].ATTRIBUTE_TYPE == "VARCHAR2") { + console.log("1"); + let x = (document.getElementById(this.RespondAttributeList[i].ATTRIBUTE_NAME)) as HTMLInputElement; + x.value=this.GetRespondAttributeValueList[i].P_ATTRIBUTE_NUMBER_VALUE; + } else if (this.RespondAttributeList[i].ATTRIBUTE_TYPE == "LOOKUP") { + console.log("2"); + //call create WF_LOOKUPP_ATTRIBUTE_NAME + //call there or when the got response from responsedAtt + + let x = (document.getElementById(this.RespondAttributeList[i].ATTRIBUTE_NAME)) as HTMLSelectElement; + if(this.wFLookUpList){ + let index= this.wFLookUpList.findIndex(x => x.LOOKUP_CODE == this.GetRespondAttributeValueList[i].P_ATTRIBUTE_TEXT_VALUE); + console.log("Hel: "+ index); + x.options[index+1].selected=true; + + } + + } else if (this.RespondAttributeList[i].ATTRIBUTE_TYPE == "DATE") { + console.log("3"); + + } else if (this.RespondAttributeList[i].ATTRIBUTE_TYPE == "NUMBER") { + console.log("4"); + let x = (document.getElementById(this.RespondAttributeList[i].ATTRIBUTE_NAME)) as HTMLInputElement; + x.value=this.GetRespondAttributeValueList[i].P_ATTRIBUTE_NUMBER_VALUE; + + } + }//end if + } } + + +}// end class \ No newline at end of file diff --git a/Mohem/src/app/vacation-rule/service/vacation-rule-service.service.ts b/Mohem/src/app/vacation-rule/service/vacation-rule-service.service.ts index 03b7a670..6c451369 100644 --- a/Mohem/src/app/vacation-rule/service/vacation-rule-service.service.ts +++ b/Mohem/src/app/vacation-rule/service/vacation-rule-service.service.ts @@ -28,7 +28,7 @@ export class VacationRuleServiceService { public static notificationReassign = 'Services/ERP.svc/REST/GET_NOTIFICATION_REASSIGN_MODE'; public static getRespondAttributeValues = 'Services/ERP.svc/REST/GET_RESPOND_ATTRIBUTE_VALUE'; public static getReplacmentEmployeeList = 'Services/ERP.svc/REST/GET_REPLACEMENT_LIST'; - + public static getLookup='Services/ERP.svc/REST/GET_WF_LOOKUP'; constructor(public authService: AuthenticationService, public con: ConnectorService) { } @@ -91,4 +91,10 @@ export class VacationRuleServiceService { this.authService.authenticateRequest(request); return this.con.post(VacationRuleServiceService.deleteVacationRule, request, onError, errorLabel); } + + public getLookup (getLookupRequest :any,onError,errorLabel){ + const request =getLookupRequest; + this.authService.authenticateRequest(request); + return this.con.post(VacationRuleServiceService.getLookup,request,onError,errorLabel); + } } diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index 4b18e08b..37798853 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -762,8 +762,8 @@ "ar":"مسح" }, "choose":{ - "en":"", - "ar":"" + "en":"choose", + "ar":"أختر" }, "confirmation":{ "en":"Confirmation", @@ -1019,6 +1019,10 @@ "en": "Please fill action field", "ar": "يرجى ملء حقل العمل" }, + "fillReplacement": { + "en": "Please select a replacement ", + "ar": "يرجى إختيار بديل" + }, "deliver": { "en": "Deliver notifications to me regardless of any general rules", "ar": "تسليم الإخطارات لي بغض النظر عن أي قواعد عامة" @@ -1641,5 +1645,87 @@ "en":"Action is required", "ar":"اختر حركة" } + }, + "payslip": { + "title":{ + "en": "payslip", + "ar":"كشف الراتب" + }, + "end-date":{ + "en": "Peroid End Date", + "ar":" تاريخ بداية الفترة" + }, + "start-date":{ + "en": "Peroid Start Date", + "ar":" تاريخ نهاية الفترة" + }, + "peroid-name":{ + "en": "Peroid Name", + "ar":"اسم الفترة " + }, + "deductions-Amount":{ + "en": "Total Deductions Amount", + "ar":"قيمة الخصومات " + }, + "deductions-percentage":{ + "en": "Total Deductions Percentage", + "ar":"نسبة الخصومات " + }, + "earings-Amount":{ + "en": "Total Earings Amount", + "ar":"قيمة الربح " + }, + "earings-percentage":{ + "en": "Total Earings Percentage", + "ar":"نسبة الربح " + }, + "pay-Amount":{ + "en": "Total Pay Amount", + "ar":"قيمة الأجر " + }, + "pay-percentage":{ + "en": "Total Pay Percentage", + "ar":"نسبة الأجر " + }, + "payment-method":{ + "en": "Payment Method Name", + "ar":"اسم عملية الدفع " + }, + "bank-name":{ + "en": "Bank Name", + "ar":"اسم البنك " + }, + "branch-name":{ + "en": "Branch Name", + "ar":"اسم الفرع " + }, + "account-no":{ + "en": "Account NO.", + "ar":"رقم الحساب " + }, + "amount":{ + "en": "Amount", + "ar":" القيمة" + }, + "earnings":{ + "en": "Earnings", + "ar":"أرباح " + }, + "deductions":{ + "en": "Deductions", + "ar":"الخصومات " + }, + "payment-information":{ + "en": "Payment Information", + "ar":"معلةمات الدفع " + }, + "summary-payment":{ + "en": "Summary of Payment", + "ar":"ملخص الدفع " + }, + "payroll-info":{ + "en": "Payroll Processing Information", + "ar":"معلومات كشف الراتب " + } } } \ No newline at end of file