diff --git a/Mohem/src/app/app.component.html b/Mohem/src/app/app.component.html index 78c03ae2..47c87d50 100644 --- a/Mohem/src/app/app.component.html +++ b/Mohem/src/app/app.component.html @@ -47,7 +47,7 @@ - + {{ts.trPK('userProfile','HR-Request')}} @@ -57,7 +57,7 @@ - + {{menu.MENU_NAME}} @@ -67,7 +67,7 @@ - + {{ts.trPK('general','pending-transaction')}} diff --git a/Mohem/src/app/eit/add-cei/add-cei.component.html b/Mohem/src/app/eit/add-cei/add-cei.component.html new file mode 100644 index 00000000..bda6751d --- /dev/null +++ b/Mohem/src/app/eit/add-cei/add-cei.component.html @@ -0,0 +1,3 @@ +

+ add-cei works! +

diff --git a/Mohem/src/app/eit/add-cei/add-cei.component.scss b/Mohem/src/app/eit/add-cei/add-cei.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/eit/add-cei/add-cei.component.spec.ts b/Mohem/src/app/eit/add-cei/add-cei.component.spec.ts new file mode 100644 index 00000000..fa819bbd --- /dev/null +++ b/Mohem/src/app/eit/add-cei/add-cei.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AddCeiComponent } from './add-cei.component'; + +describe('AddCeiComponent', () => { + let component: AddCeiComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AddCeiComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AddCeiComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/eit/add-cei/add-cei.component.ts b/Mohem/src/app/eit/add-cei/add-cei.component.ts new file mode 100644 index 00000000..de223c5d --- /dev/null +++ b/Mohem/src/app/eit/add-cei/add-cei.component.ts @@ -0,0 +1,14 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-add-cei', + templateUrl: './add-cei.component.html', + styleUrls: ['./add-cei.component.scss'], +}) +export class AddCeiComponent implements OnInit { + + constructor() { } + + ngOnInit() {} + +} diff --git a/Mohem/src/app/eit/cei-homepage/cei-homepage.component.html b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.html new file mode 100644 index 00000000..69b119b1 --- /dev/null +++ b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.html @@ -0,0 +1,3 @@ +

+ cei-homepage works! +

diff --git a/Mohem/src/app/eit/cei-homepage/cei-homepage.component.scss b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/eit/cei-homepage/cei-homepage.component.spec.ts b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.spec.ts new file mode 100644 index 00000000..3ebdf92c --- /dev/null +++ b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CeiHomepageComponent } from './cei-homepage.component'; + +describe('CeiHomepageComponent', () => { + let component: CeiHomepageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CeiHomepageComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CeiHomepageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/eit/cei-homepage/cei-homepage.component.ts b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.ts new file mode 100644 index 00000000..3a70a668 --- /dev/null +++ b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.ts @@ -0,0 +1,14 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-cei-homepage', + templateUrl: './cei-homepage.component.html', + styleUrls: ['./cei-homepage.component.scss'], +}) +export class CeiHomepageComponent implements OnInit { + + constructor() { } + + ngOnInit() {} + +} diff --git a/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.html b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.html new file mode 100644 index 00000000..f31f1941 --- /dev/null +++ b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.html @@ -0,0 +1,3 @@ +

+ confirm-add-cei works! +

diff --git a/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.scss b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.spec.ts b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.spec.ts new file mode 100644 index 00000000..2cf5f990 --- /dev/null +++ b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ConfirmAddCeiComponent } from './confirm-add-cei.component'; + +describe('ConfirmAddCeiComponent', () => { + let component: ConfirmAddCeiComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ConfirmAddCeiComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ConfirmAddCeiComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.ts b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.ts new file mode 100644 index 00000000..f9a1a620 --- /dev/null +++ b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.ts @@ -0,0 +1,14 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-confirm-add-cei', + templateUrl: './confirm-add-cei.component.html', + styleUrls: ['./confirm-add-cei.component.scss'], +}) +export class ConfirmAddCeiComponent implements OnInit { + + constructor() { } + + ngOnInit() {} + +} diff --git a/Mohem/src/app/eit/home/home.component.ts b/Mohem/src/app/eit/home/home.component.ts index d145686f..05bd9d7d 100644 --- a/Mohem/src/app/eit/home/home.component.ts +++ b/Mohem/src/app/eit/home/home.component.ts @@ -46,7 +46,7 @@ export class HomeComponent implements OnInit { this.selectedMenu = index; } } - if (page['FUNCTION_NAME'] == 'HR_TERM_EMP_SS') { + if (page['FUNCTION_NAME'] == 'HR_TERM_SS') { this.cs.sharedService.setSharedData(page, TerminationServiceService.TERMINATION_PAGE); this.cs.openTermination(); diff --git a/Mohem/src/app/hmg-common/hmg-common.module.ts b/Mohem/src/app/hmg-common/hmg-common.module.ts index 447e5d00..d0b4fd8d 100644 --- a/Mohem/src/app/hmg-common/hmg-common.module.ts +++ b/Mohem/src/app/hmg-common/hmg-common.module.ts @@ -85,26 +85,26 @@ import { ReplacementListComponent } from '../vacation-rule/replacement-list/repl import { FileUploadModule } from 'ng2-file-upload'; import { PdfViewerModule } from 'ng2-pdf-viewer'; import { WorkListAttachViewComponent } from '../notification/work-list-attach-view/work-list-attach-view.component'; -import {Camera} from '@ionic-native/Camera/ngx'; -import {File} from '@ionic-native/file/ngx'; -import {FileUploderProfileComponent} from './ui/file-uploder-profile/file-uploder-profile.component'; +import { Camera } from '@ionic-native/Camera/ngx'; +import { File } from '@ionic-native/file/ngx'; +import { FileUploderProfileComponent } from './ui/file-uploder-profile/file-uploder-profile.component'; import { OpenNativeSettings } from '@ionic-native/open-native-settings/ngx'; import { AccordinCustomComponent } from './ui/accordin-custom/accordin-custom.component'; -import { AccordinTabCustomComponent} from './ui/accordin-custom/accordin-tab-custom/accordin-tab-custom.component' -import {DashboredService} from './services/dashbored/dashbored.service'; -import {NgxGaugeModule} from 'ngx-gauge'; +import { AccordinTabCustomComponent } from './ui/accordin-custom/accordin-tab-custom/accordin-tab-custom.component' +import { DashboredService } from './services/dashbored/dashbored.service'; +import { NgxGaugeModule } from 'ngx-gauge'; import { StatsButtonComponent } from './ui/stats-button/stats-button.component'; import { ServicesButtonComponent } from './ui/services-button/services-button.component'; -import {ConfirmLoginComponent} from '../authentication/confirm-login/confirm-login.component' -import {WelcomeComponent} from './ui/welcome-login/welcome.component' -import {FabButtonComponent} from './ui/fab-button/fab-button.component' +import { ConfirmLoginComponent } from '../authentication/confirm-login/confirm-login.component' +import { WelcomeComponent } from './ui/welcome-login/welcome.component' +import { FabButtonComponent } from './ui/fab-button/fab-button.component' import { AttendScanService } from './services/attend-services/attend-scan.service'; import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx'; import { NgCircleProgressModule } from 'ng-circle-progress'; import { CardFilterComponent } from './ui/card-filter/card-filter.component'; import { EmployeeInformationComponent } from './ui/employee-information/employee-information.component'; import { CircleCalendarComponent } from './ui/circle-calendar/circle-calendar.component'; -import { NgCalendarModule } from 'ionic2-calendar'; +import { NgCalendarModule } from 'ionic2-calendar'; import { DateInfoModalComponent } from './ui/circle-calendar/date-info-modal/date-info-modal.component'; import { ChartModule } from 'primeng/chart'; import { GenericHeaderComponent } from './ui/generic-header/generic-header.component'; @@ -112,6 +112,7 @@ import { BackgroundGeolocation } from '@ionic-native/background-geolocation/ngx' import { AttendanceOptionsComponent } from '../home/attendance-options/attendance-options.component'; import { CardCalendarComponent } from './ui/card-calendar/card-calendar.component'; import { WorklistSettingComponent } from '../notification/worklist-setting/worklist-setting.component'; +import { SubmitAddressModalComponent } from '../profile/submit-eit-modal/submit-address-modal.component'; @NgModule({ imports: [ @@ -196,7 +197,8 @@ import { WorklistSettingComponent } from '../notification/worklist-setting/workl GenericHeaderComponent, AttendanceOptionsComponent, CardCalendarComponent, - WorklistSettingComponent + WorklistSettingComponent, + SubmitAddressModalComponent ], exports: [ FabButtonComponent, @@ -267,7 +269,8 @@ import { WorklistSettingComponent } from '../notification/worklist-setting/workl Modal, GenericHeaderComponent, AttendanceOptionsComponent, - CardCalendarComponent + CardCalendarComponent, + SubmitAddressModalComponent ], providers: [ AttendScanService, 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 738456eb..899f60e9 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -1299,6 +1299,9 @@ export class CommonService { public openAddUpdateContact() { this.nav.navigateForward(['/profile/add-update-contact']); } + public confirmContact() { + this.nav.navigateForward(['/profile/confirm-contact']); + } public openConfirmAddAddress() { this.nav.navigateForward(['/profile/confirm-add-address']); @@ -1316,14 +1319,29 @@ export class CommonService { this.nav.navigateForward(['/reports/concurrent-report']); } + public openConcurrentTransaction() { + + this.nav.navigateForward(['/reports/transaction-list']); + } public openTermination() { this.nav.navigateForward(['/termination/termination-form']); } + public confirmTermination() { + + this.nav.navigateForward(['/termination/confirm-termination']); + } public openTransactions() { this.nav.navigateForward(['/pending-transaction/home']); } + + public openItemForSale() { + this.nav.navigateForward('/itemforsale/items'); + } + public openCreateitems() { + this.nav.navigateForward('/itemforsale/home'); + } public navigatePage(path) { this.nav.navigateForward([path]); } diff --git a/Mohem/src/app/hmg-common/services/connector/connector.service.ts b/Mohem/src/app/hmg-common/services/connector/connector.service.ts index 62631565..70a9d157 100644 --- a/Mohem/src/app/hmg-common/services/connector/connector.service.ts +++ b/Mohem/src/app/hmg-common/services/connector/connector.service.ts @@ -27,8 +27,8 @@ export class ConnectorService { public static retryTimes = 0; public static timeOut = 120 * 1000; - public static host = 'https://uat.hmgwebservices.com/'; - // public static host = 'https://hmgwebservices.com/'; + // public static host = 'https://uat.hmgwebservices.com/'; + public static host = 'https://hmgwebservices.com/'; constructor(public httpClient: HttpClient, public cs: CommonService, diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index b1a09ba3..f75eadf0 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -803,7 +803,7 @@ export class HomePage implements OnInit { itemForSale() { - this.common.navigateForward('/itemforsale/items'); + this.common.openItemForSale(); } offersDiscount() { this.common.navigateForward('/offersdiscount/home'); diff --git a/Mohem/src/app/itemforsale/home/home.component.html b/Mohem/src/app/itemforsale/home/home.component.html index 4086bfe6..0a8a604c 100644 --- a/Mohem/src/app/itemforsale/home/home.component.html +++ b/Mohem/src/app/itemforsale/home/home.component.html @@ -53,85 +53,34 @@
-

What are you offering?

+

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

- -
+ +
- +
-

Mobile & Tablets

+

{{category.title}}

+

{{category.title_Ar}}

- - -
-
- -
-
-

Cars & Vehicles

-
-
-
- -
-
- -
-
-

Electronic Applicance

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

Furniture & Home Decor

-
-
-
- -
-
- -
-
-

Fashion & beauty

-
-
-
- -
-
- -
-
-

Books, Sports & Hobbies

-
-
-
-
- +
-

Add Details

+

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

-

Item Info

+

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

- +
@@ -142,77 +91,78 @@ - + -

Item Condition

- - - - +

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

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

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

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

Item Price

+

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

- +
-

Item Photos

+

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

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

Furniture Table

+

+ {{selectedCategory.title_Ar}} +

+

+ {{selectedCategory.title}} +

+ - +

{{itemInfo}}

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

-

Used

+

{{itemCondition}}

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

500 SAR

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

{{itemPrice}} SAR

- +
@@ -251,7 +224,7 @@
- cancel + {{ts.trPK('general','cancel')}}
@@ -260,13 +233,16 @@
- - cancel + + {{ts.trPK('general','cancel')}} {{ts.trPK('general','next')}} - - Confirm + + {{ts.trPK('general','confirm')}} + + {{ts.trPK('general','update')}} +
diff --git a/Mohem/src/app/itemforsale/home/home.component.scss b/Mohem/src/app/itemforsale/home/home.component.scss index da69d29b..f01790d6 100644 --- a/Mohem/src/app/itemforsale/home/home.component.scss +++ b/Mohem/src/app/itemforsale/home/home.component.scss @@ -214,7 +214,7 @@ margin-bottom: 70px; background: #fff; margin: 15px; padding: 10px; - box-shadow: 3px 4px 3px -1px #ccc; + box-shadow: 0px 0px 2px 1px #ccc; border-radius: 20px; } .add-details ion-item{ @@ -246,7 +246,7 @@ position: relative; right: 0; font-size: 14px; color: #fff; - top: -15px; + top: -10px; right: -10px; font-weight: bolder; background: red; @@ -341,3 +341,44 @@ ion-footer{ position: absolute; top: 15px; } +.upload-container{ + display: inline-block; +} +@media screen and (min-width: 325px){ + .fileUpload { + position: relative; + overflow: hidden; + margin: 10px; + + }} + @media screen and (min-width: 1px) and (max-width:320px){ + .fileUpload { + position: relative; + overflow: hidden; + margin: 10px; + + + }} + + .fileUpload input.upload { + position: absolute; + top: 0; + right: 0; + margin: 0; + padding: 0; + font-size: 20px; + cursor: pointer; + opacity: 0; + filter: alpha(opacity=0); + } + + .iconButton .imgSize{ + width: 10px !important; + height: 10px; + } +.close-btn{ + color: red; + font-size: 22px; + position: relative; + top: 5px; +} \ No newline at end of file diff --git a/Mohem/src/app/itemforsale/home/home.component.ts b/Mohem/src/app/itemforsale/home/home.component.ts index 7ddeddbe..d53d5627 100644 --- a/Mohem/src/app/itemforsale/home/home.component.ts +++ b/Mohem/src/app/itemforsale/home/home.component.ts @@ -1,4 +1,7 @@ import { Component, OnInit } from '@angular/core'; +import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; +import { FileUploader } from 'ng2-file-upload'; +import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { ItemForSaleService } from '../services/service.service'; @@ -10,22 +13,227 @@ import { ItemForSaleService } from '../services/service.service'; }) export class HomeComponent implements OnInit { step: any = 1; - constructor(public ts: TranslatorService, public cs: CommonService, private itemService: ItemForSaleService) { } + categories: any = []; + direction: string; + uploaded: any = []; + public selectedFile: any; + indexLastObj: any; + addAttachRequest: any = []; + selectedCategory: any; + filterAllowedType: any = [ + "image/jpeg", + "image/png", + "image/jpg", + ]; + itemInfo: string; + itemDescription: string; + itemCondition: string; + itemPrice: any; + regions: any = []; + regionID: any = 1; + editItem: any; + constructor(public ts: TranslatorService, private authService: AuthenticationService, private sanitizer: DomSanitizer, public cs: CommonService, private itemService: ItemForSaleService) { } ngOnInit() { - - + this.direction = TranslatorService.getCurrentDirection(); + this.categories = this.cs.sharedService.getSharedData(ItemForSaleService.CATEGORIES, false); + this.getRegion(); + this.editItem = this.cs.sharedService.getSharedData(ItemForSaleService.EDIT_ITEMS); + if (this.editItem) { + this.setEditPage(); + } + } + getRegion() { + this.itemService.getRegion({}, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { + this.regions = this.itemService.parser(result); + console.log(this.regions); + }) } openItem() { - - this.cs.navigateForward('/itemforsale/items'); } - nextStep() { + nextStep(category) { + this.selectedCategory = category; this.step = 2; } openMyAds() { this.cs.navigateForward('/itemforsale/my-ads'); } + onFileSelectedclick(event) { + event.target.value = ''; + } + public uploader: FileUploader = new FileUploader({ + allowedMimeType: [ + "image/jpeg", + "image/png", + "image/jpg", + ], + maxFileSize: 10 * 1024 * 1024, + formatDataFunctionIsAsync: true, + formatDataFunction: async item => { + return new Promise((resolve, reject) => { + resolve({ + name: item._file.name, + length: item._file.size, + contentType: item._file.type, + date: new Date() + }); + }); + } + }); + + + + + onFileSelected(input) { + if (!(this.filterAllowedType.indexOf(input.target.files[0].type) > -1)) { + let msg: string = ""; + msg = this.ts.trPK("general", "notSupportFile"); + this.cs.presentAlert(msg); + return; + } // todo: show alert that you tried uploading wrong files + else { + const file = input.target.files[0]; + this.selectedFile = input.target.files; + + + this.getBase64(file).then(data => + this.pushObject(data, file.name, file.type) + ); + } + } + + getBase64(file) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = () => resolve(reader.result); + reader.onerror = error => reject(error); + }); + } + + pushObject(fileData, name, type) { + + this.indexLastObj++; + try { + let array = name.split("."); + let attachType: string = array[array.length - 1]; + + this.addAttachRequest.push({ + AttachmentID: this.indexLastObj, + P_FILE_CONTENT_TYPE: attachType, //type.split('/')[1], + P_FILE_DATA: fileData.split(",")[1], + P_FILE_NAME: name, //.split('.')[0], + + }); + } catch (e) { } + } + + 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); + } + getImgContent(imgFile): SafeUrl { + return this.sanitizer.bypassSecurityTrustUrl(imgFile); + } + + createItemForSale() { + + var authUser = this.authService.getAuthenticatedRequest(); + this.cs.startLoading(); + var request = new FormData(); + request.append('title', this.itemInfo); + request.append('title_Ar', this.itemInfo); + request.append('categoryID', this.selectedCategory.categoryID); + request.append('description', this.itemDescription); + request.append('description_Ar', this.itemDescription); + request.append('employeeNumber', authUser.P_USER_NAME); + request.append('quotePrice', this.itemPrice); + request.append('isActive', 'true'); + request.append('regionID', this.regionID); + request.append('status', this.itemCondition); + console.log(this.selectedFile); + if (this.selectedFile && this.selectedFile !== undefined) { + request.append('fileColl', this.addAttachRequest.toString()); + } + request.append('Channel', authUser.Channel.toString()); + request.append('LogInToken', authUser.LogInTokenID); + request.append('Token', authUser.TokenID); + request.append('EmployeeNumber', authUser.P_USER_NAME); + request.append('MobileNo', authUser.MobileNumber); + + + this.itemService.createItemForSale(request, () => { }, this.ts.trPK('general', 'retry')).subscribe((result: any) => { + if (this.cs.validResponse(result)) { + this.cs.stopLoading(); + + this.cs.greenToastPK("general", "success-create"); + this.openItem(); + } else { + this.cs.stopLoading(); + this.cs.redToastPK("general", "try-again"); + } + + + }) + } + setEditPage() { + this.step = 2; + this.selectedCategory = { + categoryID: this.editItem.categoryID, + title: this.editItem.categoryTitle, + title_Ar: this.editItem.categoryTitle + } + this.itemInfo = this.editItem.title; + this.itemDescription = this.editItem.description; + this.itemPrice = this.editItem.quotePrice; + this.regionID = this.editItem.regionID; + this.itemCondition = this.editItem.status.toLowerCase(); + } + updateItemForSale() { + + var authUser = this.authService.getAuthenticatedRequest(); + this.cs.startLoading(); + var request = new FormData(); + request.append('itmeSaleID', this.editItem.itemSaleID); + request.append('title', this.itemInfo); + request.append('title_Ar', this.itemInfo); + request.append('categoryID', this.selectedCategory.categoryID); + request.append('description', this.itemDescription); + request.append('description_Ar', this.itemDescription); + request.append('employeeNumber', authUser.P_USER_NAME); + request.append('quotePrice', this.itemPrice); + request.append('isActive', 'true'); + request.append('regionID', this.regionID); + request.append('status', this.itemCondition); + console.log(this.selectedFile); + if (this.selectedFile && this.selectedFile !== undefined) { + request.append('fileColl', this.selectedFile[0], this.selectedFile[0].name); + } + request.append('Channel', authUser.Channel.toString()); + request.append('LogInToken', authUser.LogInTokenID); + request.append('Token', authUser.TokenID); + request.append('EmployeeNumber', authUser.P_USER_NAME); + request.append('MobileNo', authUser.MobileNumber); + + + this.itemService.updateItemForSale(request, () => { }, this.ts.trPK('general', 'retry')).subscribe((result: any) => { + if (this.cs.validResponse(result)) { + this.cs.stopLoading(); + + this.cs.greenToastPK("general", "success-create"); + this.openItem(); + } else { + this.cs.stopLoading(); + this.cs.redToastPK("general", "try-again"); + } + + + }) + } } diff --git a/Mohem/src/app/itemforsale/item-details/item-details.component.html b/Mohem/src/app/itemforsale/item-details/item-details.component.html index 1618761d..016dbdb3 100644 --- a/Mohem/src/app/itemforsale/item-details/item-details.component.html +++ b/Mohem/src/app/itemforsale/item-details/item-details.component.html @@ -1,4 +1,4 @@ - +
-
+
+ diff --git a/Mohem/src/app/itemforsale/items/items.component.scss b/Mohem/src/app/itemforsale/items/items.component.scss index d83c0aa4..f98ef940 100644 --- a/Mohem/src/app/itemforsale/items/items.component.scss +++ b/Mohem/src/app/itemforsale/items/items.component.scss @@ -7,6 +7,12 @@ background: #259CB8; top: 0; } +.no-dataDiv{ + position: absolute; + left: 0; + right: 0; + margin: auto; +} .header-toolbar{ --background: #259CB8 !important; } diff --git a/Mohem/src/app/itemforsale/items/items.component.ts b/Mohem/src/app/itemforsale/items/items.component.ts index b077547c..43ccf0e9 100644 --- a/Mohem/src/app/itemforsale/items/items.component.ts +++ b/Mohem/src/app/itemforsale/items/items.component.ts @@ -5,6 +5,7 @@ import { ItemForSaleService } from '../services/service.service'; import { deepCopy } from '@angular-devkit/core/src/utils/object'; import * as moment from 'moment'; import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; +import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-items', @@ -13,29 +14,41 @@ import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; }) export class ItemsComponent implements OnInit { segment: any = '1'; - items: any = []; + items: any; categories: any = []; direction: string; activeClass: any; pageNo: number = 1; tempSearch: any = []; itemsByEmployee: any = []; - constructor(public ts: TranslatorService, private sanitizer: DomSanitizer, public cs: CommonService, private itemService: ItemForSaleService) { } + constructor(public ts: TranslatorService, public route: ActivatedRoute, private sanitizer: DomSanitizer, public cs: CommonService, private itemService: ItemForSaleService) { + this.route + .params.subscribe(val => { + setTimeout(() => { + this.cs.startLoading(); + this.getItemsCategories(); + this.getItemsByEmployee(); + }, 100); + }); + + } ngOnInit() { this.direction = TranslatorService.getCurrentDirection(); - this.getItemsCategories(); - this.getItemsByEmployee(); + } getItemsCategories() { + this.itemService.getCategories({}, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { this.categories = this.itemService.parser(result); - console.log(this.categories); + this.cs.sharedService.setSharedData(this.categories, ItemForSaleService.CATEGORIES); }) this.itemService.getItems({ pageNo: this.pageNo }, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { + this.items = []; this.items = this.itemService.parser(result); this.tempSearch = deepCopy(this.items); + this.cs.stopLoading(); }) } openDetails(selected) { @@ -46,12 +59,17 @@ export class ItemsComponent implements OnInit { this.segment = value.detail.value; } openSale() { - this.cs.navigateForward('/itemforsale/home'); + this.cs.openCreateitems(); } selectCategory(item) { - - this.activeClass = item.categoryID - + this.cs.startLoading(); + this.activeClass = item.categoryID; + this.itemService.getItems({ pageNo: this.pageNo, ItgCategoryID: item.categoryID }, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { + this.items = []; + this.items = this.itemService.parser(result); + this.tempSearch = deepCopy(this.items); + this.cs.stopLoading(); + }) } getDotted(temp: string, valueCount: number) { temp = this.stripHtml(temp); @@ -66,7 +84,7 @@ export class ItemsComponent implements OnInit { } loadData(event) { this.pageNo = this.pageNo + 1; - this.itemService.getItems({ pageNo: this.pageNo }, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { + this.itemService.getItems({ pageNo: this.pageNo, categoryID: this.activeClass }, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { this.items.concat(this.itemService.parser(result)); this.tempSearch = deepCopy(this.items); event.target.complete(); @@ -88,12 +106,15 @@ export class ItemsComponent implements OnInit { } getItemsByEmployee() { - + this.cs.startLoading(); this.itemService.getItemsByEmployee({}, () => { }, this.ts.trPK('general', 'retry')).subscribe((result) => { this.itemsByEmployee = this.itemService.parser(result); + + this.cs.stopLoading(); console.log(this.itemsByEmployee); }) } + getDate(date) { return moment(date, "YYYY-MM-DD HH:mm:ss").format("DD-MMM-YYYY"); } @@ -101,4 +122,9 @@ export class ItemsComponent implements OnInit { getImgContent(imgFile): SafeUrl { return this.sanitizer.bypassSecurityTrustUrl(imgFile); } + editItems(items) { + this.cs.sharedService.setSharedData(items, ItemForSaleService.EDIT_ITEMS); + this.cs.openCreateitems(); + } + } diff --git a/Mohem/src/app/itemforsale/services/service.service.ts b/Mohem/src/app/itemforsale/services/service.service.ts index 14b246c1..54339928 100644 --- a/Mohem/src/app/itemforsale/services/service.service.ts +++ b/Mohem/src/app/itemforsale/services/service.service.ts @@ -1,6 +1,8 @@ +import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service'; +import { MowadhafiService } from 'src/app/mowadhafi/mowadhafi.service'; @Injectable({ providedIn: 'root' @@ -9,11 +11,16 @@ export class ItemForSaleService { public static getItemForSale = 'Services/COCWS.svc/REST/Mohemm_ITG_GetItemForSale'; public static getItemForSaleByEmployee = 'Services/COCWS.svc/REST/Mohemm_ITG_GetItemForSaleByEmployee'; public static getCategories = 'Services/COCWS.svc/REST/Mohemm_ITG_GetItemSaleCategory'; + public static createItemForSale = 'Services/COCWS.svc/REST/Mohemm_ITG_AddItemForSale'; + public static updateItemForSale = 'Services/COCWS.svc/REST/Mohemm_ITG_UpdateItemForSale'; + public static getRegion = 'Services/COCWS.svc/REST/Mohemm_ITG_GetRegion'; public static ITEMS_SELECTED = 'item-selected'; - + public static CATEGORIES = 'categories'; + public static EDIT_ITEMS = 'edit-items'; constructor( public con: ConnectorService, - private authService: AuthenticationService + private authService: AuthenticationService, + private http: HttpClient ) { } public getItems(request: any, onError?: any, errorLabel?: string) { this.authService.authenticateRequest(request); @@ -21,14 +28,14 @@ export class ItemForSaleService { request.ItgPageNo = request.pageNo; request.ItgPageSize = 10; request.ItgStatus = "Approved"; - return this.con.post(ItemForSaleService.getItemForSale, request, onError, errorLabel); + return this.con.postNoLoad(ItemForSaleService.getItemForSale, request, onError, errorLabel); } public getCategories(request: any, onError?: any, errorLabel?: string) { this.authService.authenticateRequest(request); request.EmployeeNumber = request.UserName; - return this.con.post(ItemForSaleService.getCategories, request, onError, errorLabel); + return this.con.postNoLoad(ItemForSaleService.getCategories, request, onError, errorLabel); } parser(response: any) { try { @@ -45,7 +52,32 @@ export class ItemForSaleService { getItemsByEmployee(request: any, onError?: any, errorLabel?: string) { this.authService.authenticateRequest(request); request.EmployeeNumber = request.UserName; - request.ItgEmployeeNumber = 111209; + request.ItgEmployeeNumber = request.UserName; //request.UserName; return this.con.post(ItemForSaleService.getItemForSaleByEmployee, request, onError, errorLabel); } + getRegion(request: any, onError?: any, errorLabel?: string) { + this.authService.authenticateRequest(request); + request.EmployeeNumber = request.UserName; + request.ItgEmployeeNumber = request.UserName; //request.UserName; + return this.con.post(ItemForSaleService.getRegion, request, onError, errorLabel); + } + + createItemForSale(itemRequest: any, onError?: any, errorLabel?: string) { + const request = itemRequest; + this.authService.authenticateRequest(request); + request.employeeNumber = request.P_USER_NAME; + return this.http.post(ConnectorService.host + ItemForSaleService.createItemForSale, itemRequest, { + + } + ) + } + updateItemForSale(itemRequest: any, onError?: any, errorLabel?: string) { + const request = itemRequest; + this.authService.authenticateRequest(request); + request.employeeNumber = request.P_USER_NAME; + return this.http.post(ConnectorService.host + ItemForSaleService.updateItemForSale, itemRequest, { + + } + ) + } } diff --git a/Mohem/src/app/pending-transaction/home/home.component.scss b/Mohem/src/app/pending-transaction/home/home.component.scss index f2672ac2..1f4f2512 100644 --- a/Mohem/src/app/pending-transaction/home/home.component.scss +++ b/Mohem/src/app/pending-transaction/home/home.component.scss @@ -24,6 +24,7 @@ right:0; width: 100px; color:#969696; + margin: -8px; } .transaction-list{ margin-top:20px; diff --git a/Mohem/src/app/profile/add-update-contact/add-update-contact.component.html b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.html index 967ce56e..4a92fa86 100644 --- a/Mohem/src/app/profile/add-update-contact/add-update-contact.component.html +++ b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.html @@ -14,14 +14,21 @@ class="dependent-title" Effective Date {{showEffectiveDate}} -
+
+ + {{ts.trPK('submitAbsence','endDate')}} + +
- + {{'vacation-rule, next-label' | translate}} +
\ No newline at end of file diff --git a/Mohem/src/app/profile/add-update-contact/add-update-contact.component.scss b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.scss index e69de29b..764fe8af 100644 --- a/Mohem/src/app/profile/add-update-contact/add-update-contact.component.scss +++ b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.scss @@ -0,0 +1,52 @@ +.date-container{ + margin:0px 20px; +} + +.label{ + font-size: 16px; + // margin-left: 15px; + color: #a2a5a6 !important; + display: block; + overflow: hidden; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + /* font-size: inherit; */ + // text-overflow: ellipsis; + // white-space: nowrap; + white-space: normal; + // padding-top: 10px; + padding: 5px 0px; + padding-left: 10px !important; + margin: 10px auto; + :root[dir="ltr"]{ + font-family: var(--fontFamilySemiBoldEN) !important; + } + :root[dir="rtl"]{ + font-family: var(--fontFamilyIOSAR) !important; + font-weight: bold; + } + + +} + +.Field-en{ + border-radius: 30px; + border: 1px solid #a2a5a6 !important; + margin-bottom: 0px; + padding-left: 20px !important; + padding-top: 0px !important; + color: #999999 !important; + height: 80px; +} + +.Field-ar{ + border-radius: 30px; + border: 1px solid #a2a5a6!important; + margin-bottom: 20px; + padding-right: 20px !important; + padding-top: 0px !important; + color: #999999 !important; + height:80px +} \ No newline at end of file diff --git a/Mohem/src/app/profile/add-update-contact/add-update-contact.component.ts b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.ts index ac441f89..0005fcd2 100644 --- a/Mohem/src/app/profile/add-update-contact/add-update-contact.component.ts +++ b/Mohem/src/app/profile/add-update-contact/add-update-contact.component.ts @@ -50,6 +50,7 @@ export class AddUpdateContactComponent implements OnInit { private buttonInput: ButtonInput; private hiddenInput: HiddenInput; private eitResponse: any; + private eitDffResponse: any; private eitColResponse: any; private eitVALSettoCall: any = []; @@ -75,7 +76,8 @@ export class AddUpdateContactComponent implements OnInit { public showEffectiveDate: string; public userUpdateData: any; public isDelete: boolean = false; - + public selctedContact: any; + public endDate: any; constructor( public modalController: ModalController, public cs: CommonService, @@ -92,9 +94,9 @@ export class AddUpdateContactComponent implements OnInit { var empDetails = this.cs.sharedService.getSharedData(ProfileService.EMP_CONTACT_DETAILS); this.employeeBasicDetails = empDetails ? empDetails : []; - - //this.employeeBasicDetails = this.cs.sharedService.getSharedData('employeeDetails', false); - + var isDelete = this.cs.sharedService.getSharedData(ProfileService.REMOVE_CONTACT); + this.isDelete = isDelete ? isDelete : false; + this.selctedContact = this.cs.sharedService.getSharedData(ProfileService.SELCTED_CONTACT, false); this.direction = TranslatorService.getCurrentLanguageName(); this.selEmp = this.cs.sharedService.getSharedData( MenuResponse.SHARED_SEL_EMP, @@ -143,8 +145,8 @@ export class AddUpdateContactComponent implements OnInit { ngOnInit() { } ngAfterViewInit() { - - this.getBasicffStructure(); + if (!this.isDelete) + this.getBasicffStructure(); } public getColumnStructure() { @@ -164,12 +166,20 @@ export class AddUpdateContactComponent implements OnInit { P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, P_MENU_TYPE: this.menuType, P_SELECTED_RESP_ID: this.respID, - + 'P_DESC_FLEX_CONTEXT_CODE': 'HMG_ADD_CONTACT_DETAILS' }; this.profileService.getContactDFFStrutre(body).subscribe((result: any) => { - this.handleBasicDffStructureResult(result); + this.handleDffStructureResult(result); }); } + handleDffStructureResult(result) { + if (result.GetContactDffStructureList != null) { + + this.eitDffResponse = result.GetContactDffStructureList; + this.drawEitFields(result.GetContactDffStructureList, true); + this.fillBasicDetailsStructure(); + } + } private getBasicffStructure() { const body = { P_FUNCTION_NAME: this.functionName, @@ -186,9 +196,9 @@ export class AddUpdateContactComponent implements OnInit { public handleBasicColStructureResult(result) { if (result.GetContactColsStructureList != null) { this.eitColResponse = result.GetContactColsStructureList; - if (this.employeeBasicDetails.length > 0) { - this.getEitDffStructure(); - } + // if (this.employeeBasicDetails.length > 0) { + this.getEitDffStructure(); + //} this.drawEitFieldsStatic(result.GetContactColsStructureList); } @@ -198,7 +208,8 @@ export class AddUpdateContactComponent implements OnInit { if (result.GetBasicDetDffStructureList != null) { this.getColumnStructure(); this.eitResponse = result.GetBasicDetDffStructureList; - this.drawEitFields(result.GetBasicDetDffStructureList); + this.drawEitFields(result.GetBasicDetDffStructureList, false); + } } @@ -248,7 +259,7 @@ export class AddUpdateContactComponent implements OnInit { feildsList[i].DISPLAY_FLAG, feildsList[i].REQUIRED_FLAG ); - } else if (feildsList[i].DATATYPE == "DATE" && this.targetValue === 'new') { + } else if (feildsList[i].DATATYPE == "DATE") { this.dateInput = new DateInput( feildsList[i].SEGMENT_PROMPT, feildsList[i].APPLICATION_COLUMN_NAME, @@ -263,7 +274,7 @@ export class AddUpdateContactComponent implements OnInit { } } } - this.fillBasicDetailsStructure(); + } public getElementsStaticValues(): any { @@ -288,12 +299,9 @@ export class AddUpdateContactComponent implements OnInit { if (this.eitColResponse[i].DATATYPE == "VARCHAR2" || this.eitColResponse[i].DATATYPE == "NUMBER") { elemVal = elemVal; - } else if (this.eitColResponse[i].DATATYPE == "DATE" && this.targetValue === 'new') { + } else if (this.eitColResponse[i].DATATYPE == "DATE") { // date - elemVal = this.cs.formatDate(elemVal); - } else if (this.eitColResponse[i].DATATYPE == "DATE" && this.targetValue === 'correct') { - // date - elemVal = this.customiseDate(this.effectiveDate); + elemVal = this.cs.reverseFormatDate(elemVal); } if (this.targetValue === 'new') { @@ -394,7 +402,7 @@ export class AddUpdateContactComponent implements OnInit { return valuseArr; } - private drawEitFields(feildsList) { + private drawEitFields(feildsList, isDff: boolean) { const containerId = "containerDiv"; this.eitVALSettoCall = []; for (let i = 0; i < feildsList.length; i++) { @@ -550,12 +558,21 @@ export class AddUpdateContactComponent implements OnInit { feildsList[i].DISPLAY_FLAG, feildsList[i].REQUIRED_FLAG ); - this.fillDropdownList( - feildsList[i].SEGMENT_NAME, - feildsList[i].E_SERVICES_VS, - feildsList[i].E_SERVICES_DV - ); + if (isDff) { + this.fillDropdownListDff( + feildsList[i].SEGMENT_NAME, + feildsList[i].E_SERVICES_VS, + feildsList[i].E_SERVICES_DV + ); + } else { + this.fillDropdownList( + feildsList[i].SEGMENT_NAME, + feildsList[i].E_SERVICES_VS, + feildsList[i].E_SERVICES_DV + ); + } } + } this.bindHtmlElemEvents( feildsList[i].APPLICATION_COLUMN_NAME, @@ -577,6 +594,7 @@ export class AddUpdateContactComponent implements OnInit { if (this.validateEitObj && this.validateEitObj.length > 0) { this.fillEITStructure(); } + } addFieldToDOM( @@ -709,6 +727,46 @@ export class AddUpdateContactComponent implements OnInit { } } + fillDropdownListDff(segmentName, optionList: any = [], DV: any = "") { + let elemID: any = ""; + let eitObj: any; + if (optionList.length > 0) { + for (let i = 0; i < this.eitDffResponse.length; i++) { + if (this.eitDffResponse[i].SEGMENT_NAME == segmentName) { + eitObj = this.eitDffResponse[i]; + if ( + this.eitDffResponse[i].READ_ONLY == "Y" || + this.eitDffResponse[i].DISPLAY_FLAG == "N" + ) { + return false; + } + elemID = this.eitDffResponse[i].APPLICATION_COLUMN_NAME; + break; + } + } + let select = document.getElementById(elemID) as HTMLSelectElement; + document.getElementById(elemID).innerHTML = ""; + + if (eitObj.IsEmptyOption && eitObj.REQUIRED_FLAG == "N") { + var firstoption = document.createElement("option"); + firstoption.text = this.ts.trPK("general", "choose"); + firstoption.value = ""; + select.add(firstoption); + } + for (let i = 0; i < optionList.length; i++) { + var option = document.createElement("option"); + option.text = optionList[i].VALUE_COLUMN_NAME; + option.value = optionList[i].ID_COLUMN_NAME; + select.add(option); + } + if (select.dataset.hiddenval) { + select.value = select.dataset.hiddenval; + } else { + select.value = DV.P_ID_COLUMN_NAME; + } + select.disabled = false; + } + } public fillStaticDropdownList(segmentName, optionList: any = [], elemID: string) { let eitObj: any; if (optionList.length > 0) { @@ -1270,14 +1328,14 @@ export class AddUpdateContactComponent implements OnInit { public fillBasicDetailsStructure() { - this.mutualBasicDetailsArray = this.mutualBasicDetailsArray.concat(this.eitResponse, this.eitColResponse); + this.mutualBasicDetailsArray = this.eitDffResponse.concat(this.mutualBasicDetailsArray.concat(this.eitResponse, this.eitColResponse)); for (let i = 0; i < this.employeeBasicDetails.length; i++) { let val: any; if (this.employeeBasicDetails[i].VARCHAR2_VALUE) { val = this.employeeBasicDetails[i].VARCHAR2_VALUE; } else if (this.employeeBasicDetails[i].DATE_VALUE) { - val = this.customiseDate(this.employeeBasicDetails[i].DATE_VALUE); + val = this.cs.formatDate(this.employeeBasicDetails[i].DATE_VALUE); if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'EFFECTIVE_DATE') { this.effectiveDate = this.employeeBasicDetails[i].DATE_VALUE; this.showEffectiveDate = this.employeeBasicDetails[i].SEGMENT_VALUE_DSP; @@ -1289,6 +1347,7 @@ export class AddUpdateContactComponent implements OnInit { if (elem) { if (val) { let feldDetails = this.mutualBasicDetailsArray.find( + x => x.APPLICATION_COLUMN_NAME == this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME @@ -1646,6 +1705,270 @@ export class AddUpdateContactComponent implements OnInit { return valuseArr; } // end getElementsValues + + public getElementsValuesDff(): any { + this.updatedValues = []; //fill updated list + let valuseArr: any = []; + let varcharValue: any = null; + let numbervalue: any = 0; + let dateValue: any = null; + let transNo: number = 1; + let textValue: any; + // if(this.ExtraObj.transactionNo) + // transNo=this.ExtraObj.transactionNo; + for (let i = 0; i < this.eitDffResponse.length; i++) { + varcharValue = null; + numbervalue = null; + dateValue = null; + /*********set transaction No of the updated object ********/ + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + } + if (this.eitDffResponse[i].DISPLAY_FLAG != "N") { + if (this.eitDffResponse[i].VALIDATION_TYPE == "N") { + let elem = document.getElementById( + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let elemVal = (document.getElementById( + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + textValue = elemVal; + //let elemVal= (document.getElementById(this.eitResponse[i].APPLICATION_COLUMN_NAME)).value; + if ( + this.eitDffResponse[i].FORMAT_TYPE == "X" && + this.eitDffResponse[i].DISPLAY_FLAG != "N" + ) { + //date + elemVal = this.cs.formatDate(elemVal); + } else if ( + this.eitDffResponse[i].FORMAT_TYPE == "Y" && + this.eitDffResponse[i].DISPLAY_FLAG != "N" + ) { + //standard date time + // elemVal = elem.dataset.dtvalue; + // elemVal = this.cs.formatStandardDate(elemVal); + elemVal = this.cs.formatDate(elemVal); + } else if ( + this.eitDffResponse[i].FORMAT_TYPE == "I" && + this.eitDffResponse[i].DISPLAY_FLAG != "N" + ) { + //time + if (elemVal.length > 5) { + elemVal = elemVal.substring(11, 16); + } else { + elemVal = elemVal; + } + } + if (this.eitDffResponse[i].REQUIRED_FLAG == "Y" && !elemVal) { + elem.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + elem.classList.remove("requiredClassElm"); + } + // if (elemVal != 'null'){ + varcharValue = elemVal; + //} else{ + // elemVal = null; + // } + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.eitDffResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } else { + let x = document.getElementById( + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + if (this.eitDffResponse[i].READ_ONLY == "Y") { + let text = x.value; + let val = x.dataset.colmText; + varcharValue = val; + textValue = text; + } else { + let val = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].value + : null; + let txt = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].text + : null; + varcharValue = val; + textValue = txt; + } + if (this.eitDffResponse[i].REQUIRED_FLAG == "Y" && !varcharValue) { + x.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.eitDffResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } //end else + } else { + let x = document.getElementById( + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + let val = x.dataset.colmText; + textValue = x.value; + if (this.eitDffResponse[i].REQUIRED_FLAG == "Y" && !val) { + x.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + + let staticValueBasicDetail = this.employeeBasicDetails.find( + x => + x.APPLICATION_COLUMN_NAME == + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ); + + if (staticValueBasicDetail) { + if (staticValueBasicDetail.DATATYPE === 'VARCHAR2') { + varcharValue = staticValueBasicDetail.VARCHAR2_VALUE; + } else if (staticValueBasicDetail.DATATYPE === 'DATE') { + dateValue = staticValueBasicDetail.DATE_VALUE; + } else if (staticValueBasicDetail.DATATYPE === 'NUMBER') { + numbervalue = staticValueBasicDetail.NUMBER_VALUE; + } else { + if (val) varcharValue = val; + } + } else { + if (val) varcharValue = val; + } + + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.eitDffResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } + + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + if (this.validateEitObj && this.eitSubmitAction == EIT_ACTION.UPDATE) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.eitDffResponse[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + let y = { + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue, + SEGMENT_VALUE_DSP: textValue, + APPLICATION_COLUMN_NAME: this.eitDffResponse[i] + .APPLICATION_COLUMN_NAME, + DATATYPE: this.eitDffResponse[i].DATATYPE, + DESC_FLEX_CONTEXT_CODE: this.eitDffResponse[i].DESC_FLEX_CONTEXT_CODE, + DESC_FLEX_NAME: this.eitDffResponse[i].DESC_FLEX_NAME, + DISPLAY_FLAG: this.eitDffResponse[i].DISPLAY_FLAG, + SEGMENT_NAME: this.eitDffResponse[i].SEGMENT_NAME, + SEGMENT_PROMPT: this.eitDffResponse[i].SEGMENT_PROMPT + }; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } + } + } // end for + + if (this.getPassdirfromNotifiPage) { + let updatedObj1 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_ACTION" + ); + let updatedObj2 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_EXTRA_INFO_ID" + ); + let updatedObj3 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_OBJECT_VERSION_NUMBER" + ); + this.updatedValues.push(updatedObj1); + this.updatedValues.push(updatedObj2); + this.updatedValues.push(updatedObj3); + valuseArr = this.fillExtraInformation( + valuseArr, + updatedObj1.VARCHAR2_VALUE, + updatedObj2.NUMBER_VALUE, + updatedObj3.NUMBER_VALUE, + transNo + ); + } else { + if (this.eitSubmitAction == EIT_ACTION.ADD) { + this.updatedValues = this.fillExtraValuesUpdated( + this.updatedValues, + "NEW_ROW", + -1, + 0, + transNo + ); + valuseArr = this.fillExtraInformation( + valuseArr, + "NEW_ROW", + -1, + 0, + transNo + ); + } else if (this.eitSubmitAction == EIT_ACTION.UPDATE) { + valuseArr = this.fillExtraInformation( + valuseArr, + "UPDATE_ROW", + this.ExtraObj.peiExtraInfoID, + this.ExtraObj.peiObjVer, + transNo + ); + } else if (this.eitSubmitAction == EIT_ACTION.DELETE) { + valuseArr = this.fillExtraInformation( + valuseArr, + "DELETE_ROW", + this.ExtraObj.peiExtraInfoID, + this.ExtraObj.peiObjVer, + transNo + ); + } + } + return valuseArr; + } // end getElementsValues + fillExtraValuesUpdated( values: any, peiAction: string, @@ -1761,20 +2084,35 @@ export class AddUpdateContactComponent implements OnInit { return list; } - public handleBasicdetailsResult(result) { + public handledetailsResult(result) { if (this.cs.validResponse(result)) { this.cs.sharedService.setSharedData(this.basicRequest, BasicRequest.SHARED_DATA); - this.cs.sharedService.setSharedData(result.SubmitBasicDetTransactionList, 'basic-details-response'); + this.cs.sharedService.setSharedData(result.SubmitContactTransactionList, 'contact-details-response'); // this.cs.sharedService.setSharedData({ isResubmit: false },"confirmAddEITData"); - this.cs.openConfirmBasicDetailsPage(); + this.cs.confirmContact(); } } + public calcDay() { - public submitBasicDetailsTransaction() { - this.arrValues = this.getElementsValues(); - let staticValues = this.getElementsStaticValues(); - let allStatisDynamicValues = this.arrValues.concat(staticValues); + } + public submitTransaction() { + var allStatisDynamicValues = []; + + if (this.isDelete) { + allStatisDynamicValues.push({ + TRANSACTION_NUMBER: 1, + NAME: 'DATE_END', + VARCHAR2_VALUE: null, + NUMBER_VALUE: null, + DATE_VALUE: this.cs.formatDate(this.endDate) + }); + } else { + this.arrValues = this.getElementsValues(); + var dffvalues = this.getElementsValuesDff(); + let staticValues = this.getElementsStaticValues(); + allStatisDynamicValues = dffvalues.concat(this.arrValues.concat(staticValues)); + } if (allStatisDynamicValues) { this.basicRequest = { P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, @@ -1782,13 +2120,13 @@ export class AddUpdateContactComponent implements OnInit { P_SELECTED_RESP_ID: this.respID, P_FUNCTION_NAME: this.selMenu.GetMenuEntriesList.FUNCTION_NAME, EITTransactionTBL: allStatisDynamicValues, - P_CONTACT_RELATIONSHIP_ID: null, - P_ACTION_TYPE: this.employeeBasicDetails.length > 0 ? 'UPDATE' : this.isDelete ? 'REMOVE' : 'ADD' + P_CONTACT_RELATIONSHIP_ID: this.employeeBasicDetails.length > 0 || this.isDelete ? this.selctedContact['CONTACT_RELATIONSHIP_ID'] : null, + P_ACTION: this.employeeBasicDetails.length > 0 ? 'UPDATE' : this.isDelete ? 'DELETE' : 'ADD' }; console.log(this.basicRequest); this.profileService.submitContactTransaction(this.basicRequest).subscribe((result: any) => { - this.handleBasicdetailsResult(result); + this.handledetailsResult(result); }); } } diff --git a/Mohem/src/app/profile/confirm-contact/confirm-contact.component.html b/Mohem/src/app/profile/confirm-contact/confirm-contact.component.html new file mode 100644 index 00000000..0505227b --- /dev/null +++ b/Mohem/src/app/profile/confirm-contact/confirm-contact.component.html @@ -0,0 +1,128 @@ + + + + {{headerTitle}} + + + + + + + + + +
{{'general, addAttach' | translate}}
+
+ +
+ +
+
+
+ + + {{ 'general, notAttch' | translate}} + +
+ + +
+ + + + {{attachList.AttachmentID +1 }} . + + + + + {{attachList.P_FILE_NAME }} + + + + + + + +
+ +
+ +
+ + +
+
+ + {{attachRes.FILE_NAME }} + +
+ + + + +
+
+ +
+ + + +
{{'confirmAddEit, comment' | translate}}
+ + + +
+ + +
{{'confirmAddEit, approverList' | translate}}
+
+

{{ 'general, empty' | translate}}

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

{{data.RELATIONSHIP}}

-
+

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

diff --git a/Mohem/src/app/profile/home/home.component.ts b/Mohem/src/app/profile/home/home.component.ts index d9f61f5b..1a82b12a 100644 --- a/Mohem/src/app/profile/home/home.component.ts +++ b/Mohem/src/app/profile/home/home.component.ts @@ -451,28 +451,41 @@ export class HomeComponent implements OnInit { // this.cs.presentAlert(this.ts.trPK('general', 'error-itg')); this.cs.presentConfirmDialog(this.ts.trPK('userProfile', 'update-msg'), () => { - this.profileService.getContactDetails({ - P_MENU_TYPE: "E", - P_SELECTED_RESP_ID: -999, - P_CONTACT_RELATIONSHIP_ID: contact['CONTACT_RELATIONSHIP_ID'] - }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { - if (this.cs.validResponse(response)) { - this.familyMemberDataDetails = response['GetEmployeeContactDetailsList']; - this.cs.sharedService.setSharedData(this.familyMemberDataDetails, ProfileService.EMP_CONTACT_DETAILS); - this.allowEdit('add-update-contact'); - - - } - }) - this.cs.greenToastPK("userProfile", "update-confirm"); + this.updateContact(contact); + //this.cs.greenToastPK("userProfile", "update-confirm"); }); } - RemoveFunction() { + RemoveFunction(contact) { + this.cs.sharedService.setSharedData(contact, ProfileService.SELCTED_CONTACT); + this.cs.sharedService.setSharedData({ dirfromNotificationPage: false, submitEITObjList: undefined, transNo: this.transactionNo }, 'AddEITData'); + + + let selMenu: MenuResponse = new MenuResponse(); + selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); + selMenu.GetMenuEntriesList = this.dependentDetails; + this.cs.sharedService.setSharedData(selMenu, MenuResponse.SHARED_DATA); + this.cs.presentConfirmDialog(this.ts.trPK('userProfile', 'remove-msg'), () => { - this.cs.redToastPK("userProfile", "remove-confirm"); + this.cs.sharedService.setSharedData(true, ProfileService.REMOVE_CONTACT); + this.cs.openAddUpdateContact(); }); } + updateContact(contact) { + this.profileService.getContactDetails({ + P_MENU_TYPE: "E", + P_SELECTED_RESP_ID: -999, + P_CONTACT_RELATIONSHIP_ID: contact['CONTACT_RELATIONSHIP_ID'] + }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { + if (this.cs.validResponse(response)) { + this.familyMemberDataDetails = response['GetContactDetailsList']; + this.cs.sharedService.setSharedData(this.familyMemberDataDetails, ProfileService.EMP_CONTACT_DETAILS); + this.cs.sharedService.setSharedData(contact, ProfileService.SELCTED_CONTACT); + this.allowEdit('add-update-contact'); + + } + }) + } } diff --git a/Mohem/src/app/profile/models/contact.request.ts b/Mohem/src/app/profile/models/contact.request.ts index 7646184e..3a62ce32 100644 --- a/Mohem/src/app/profile/models/contact.request.ts +++ b/Mohem/src/app/profile/models/contact.request.ts @@ -8,5 +8,5 @@ export class ContactRequest { public P_SELECTED_RESP_ID: Number; public P_CONTACT_RELATIONSHIP_ID: number; EITTransactionTBL: EitTransactionModel[]; - P_ACTION_TYPE: string; + P_ACTION: string; } \ No newline at end of file diff --git a/Mohem/src/app/profile/profile.module.ts b/Mohem/src/app/profile/profile.module.ts index 2ae8004b..46faa498 100644 --- a/Mohem/src/app/profile/profile.module.ts +++ b/Mohem/src/app/profile/profile.module.ts @@ -25,6 +25,7 @@ import { SubmitAddressModalComponent } from './submit-eit-modal/submit-address-m import { ConfirmBasicDetailsComponent } from './confirm-basic-details/confirm-basic-details.component'; import { ConatactComponent } from './contact/contact.component'; import { AddUpdateContactComponent } from './add-update-contact/add-update-contact.component'; +import { ConfirmContactComponent } from './confirm-contact/confirm-contact.component'; const routes: Routes = [ { path: '', @@ -54,6 +55,10 @@ const routes: Routes = [ { path: 'add-update-contact', component: AddUpdateContactComponent + }, + { + path: 'confirm-contact', + component: ConfirmContactComponent } ], }, @@ -122,13 +127,14 @@ const routes: Routes = [ EditProfileComponent, PerformanceEvaluationComponent, ConfirmAddressComponent, - SubmitAddressModalComponent, + AddBasicDetailsComponent, ConfirmAddressComponent, ConfirmBasicDetailsComponent, ConatactComponent, AddBasicDetailsComponent, - AddUpdateContactComponent + AddUpdateContactComponent, + ConfirmContactComponent ], entryComponents: [EditDetailProfileComponent, SubmitAddressModalComponent], diff --git a/Mohem/src/app/profile/service/profile.service.ts b/Mohem/src/app/profile/service/profile.service.ts index d298bbc7..141d8e04 100644 --- a/Mohem/src/app/profile/service/profile.service.ts +++ b/Mohem/src/app/profile/service/profile.service.ts @@ -21,6 +21,7 @@ export class ProfileService { public static startEitProcess = 'Services/ERP.svc/REST/START_ADDRESS_APPROVAL_PROCESS'; public static startPhoneProcess = 'Services/ERP.svc/REST/START_PHONES_APPROVAL_PROCESS'; public static startBasicProcess = 'Services/ERP.svc/REST/START_BASIC_DET_APPR_PROCESS'; + public static contactApprovalProcess = 'Services/ERP.svc/REST/START_CONTACT_APPROVAL_PROCESS'; public static updateAttach = 'Services/ERP.svc/REST/UPDATE_ATTACHMENT'; public static deleteAttach = 'Services/ERP.svc/REST/DELETE_ATTACHMENT'; public static getApproversList = 'Services/ERP.svc/REST/GET_APPROVERS_LIST'; @@ -51,6 +52,8 @@ export class ProfileService { public static EMP_PHONE = 'emp-phone'; public static EMP_CONTACT_DETAILS = 'emp-CONTACT_DETAILS'; public static EMP_CONTACT = 'emp-CONTACT'; + public static SELCTED_CONTACT = 'selcted-CONTACT'; + public static REMOVE_CONTACT = 'remove-CONTACT'; constructor( public con: ConnectorService, public authService: AuthenticationService @@ -153,6 +156,12 @@ export class ProfileService { return this.con.post(ProfileService.startBasicProcess, request, onError, errorLabel); } + + public startContactApprovalProcess(contactRequest: any, onError?: any, errorLabel?: string): Observable { + const request = contactRequest; + this.authService.authenticateRequest(request); + return this.con.post(ProfileService.contactApprovalProcess, request, onError, errorLabel); + } public getObjectValue(request: any, onError?: any, errorLabel?: string): Observable { this.authService.authenticateRequest(request); diff --git a/Mohem/src/app/reports/concurrent-report/concurrent-report.component.html b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.html index c622715f..d44a33ba 100644 --- a/Mohem/src/app/reports/concurrent-report/concurrent-report.component.html +++ b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.html @@ -20,6 +20,7 @@
+ diff --git a/Mohem/src/app/reports/concurrent-report/concurrent-report.component.scss b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.scss index 71cba989..168df521 100644 --- a/Mohem/src/app/reports/concurrent-report/concurrent-report.component.scss +++ b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.scss @@ -3,4 +3,12 @@ } .divider{ height:20px +} +.check-status{ + color:rgb(0, 0, 134); + text-decoration: underline; + font-weight: 600; +} +.status{ + margin:20px; } \ No newline at end of file diff --git a/Mohem/src/app/reports/concurrent-report/concurrent-report.component.ts b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.ts index 7e6d9844..e42896c1 100644 --- a/Mohem/src/app/reports/concurrent-report/concurrent-report.component.ts +++ b/Mohem/src/app/reports/concurrent-report/concurrent-report.component.ts @@ -39,6 +39,7 @@ export class ConcurrentReportComponent implements OnInit { public selEmp; public eitRequest; public ExtraObj; + selMenu: MenuResponse; public functionName; @@ -93,8 +94,13 @@ export class ConcurrentReportComponent implements OnInit { const containerId = "containerDiv"; this.eitVALSettoCall = []; for (let i = 0; i < feildsList.length; i++) { - let defaultVal: string = ""; - let defaultValText: string = ""; + let defaultVal = feildsList[i].E_SERVICES_DV.P_ID_COLUMN_NAME + ? feildsList[i].E_SERVICES_DV.P_ID_COLUMN_NAME + : ""; + let defaultValText = feildsList[i].E_SERVICES_DV.P_VALUE_COLUMN_NAME + ? feildsList[i].E_SERVICES_DV.P_VALUE_COLUMN_NAME + : ""; + if (feildsList[i].DISPLAY_FLAG != "N") { //check if the field should be displayed @@ -926,26 +932,37 @@ export class ConcurrentReportComponent implements OnInit { this.reports .submitTransaction(this.eitRequest, {}, this.ts.trPK('general', 'retry')) .subscribe((result: any) => { - this.cs.stopLoading(); - this.handleSubmitAbsence(result); + + this.handleSubmit(result); }); } - private handleSubmitAbsence(result) { + private handleSubmit(result) { + if (this.cs.validResponse(result)) { - if (this.getPassdirfromNotifiPage) { - //this.cs.sharedService.setSharedData(result.ResubmitAbsenceTransactionList.P_TRANSACTION_ID, AbsenceResponse.SHARED_DATA); - this.cs.openConfirmAbsece(); + //call another API to check the response; + this.checkStatus(result); - } else { - //this.cs.sharedService.setSharedData(result.SumbitAbsenceTransactionList.P_TRANSACTION_ID, AbsenceResponse.SHARED_DATA); - this.cs.openConfirmAbsece(); - } } } + checkStatus(result) { + var request: any = {}; + request.P_USER_NAME = this.selEmp; + request.P_MENU_TYPE = this.selectedMenu.MENU_TYPE; + request.P_SELECTED_RESP_ID = -999; + request.P_FUNCTION_NAME = this.functionName; + request.P_DESC_FLEX_NAME = this.template.CONCURRENT_PROGRAM_NAME; + + this.reports.getTransaction(this.eitRequest, {}, this.ts.trPK('general', 'retry')).subscribe((result: any) => { + this.cs.stopLoading(); + this.cs.sharedService.setSharedData(result['GetCcpTransactionsList_New'], ReportServiceService.TRANSACTION_LIST); + this.cs.sharedService.setSharedData(this.template, ReportServiceService.TEMPLATE); + this.cs.openConcurrentTransaction(); + }); + } public getElementsValues(): any { this.updatedValues = []; //fill updated list let valuseArr: any = []; @@ -1276,5 +1293,7 @@ export class ConcurrentReportComponent implements OnInit { .nativeElement.querySelectorAll('#containerDiv')[0].innerHTML = ''; this.getCppDiffStructure(this.template); } + refreshStatus() { + } } diff --git a/Mohem/src/app/reports/report-service.service.ts b/Mohem/src/app/reports/report-service.service.ts index d8356223..9196cb2c 100644 --- a/Mohem/src/app/reports/report-service.service.ts +++ b/Mohem/src/app/reports/report-service.service.ts @@ -9,7 +9,12 @@ import { ConnectorService } from '../hmg-common/services/connector/connector.ser export class ReportServiceService { public static GET_CONCURRENT_PROGRAM = 'Services/ERP.svc/REST/GET_CONCURRENT_PROGRAMS'; public static GET_CPP_DIFF_STRUCTURE = 'Services/ERP.svc/REST/GET_CCP_DFF_STRUCTURE'; - public static SUBMIT_CPP_REQUEST = 'Services/ERP.svc/REST/SUBMIT_CCP_TRANSACTION' + public static SUBMIT_CPP_REQUEST = 'Services/ERP.svc/REST/SUBMIT_CCP_TRANSACTION'; + public static SUBMIT_CPP_TRANSACTION = 'Services/ERP.svc/REST/GET_CCP_TRANSACTIONS'; + public static GET_CCP_OUTPUT = 'Services/ERP.svc/REST/GET_CCP_OUTPUT'; + + public static TRANSACTION_LIST = 'transaction-list'; + public static TEMPLATE = 'template'; constructor( public con: ConnectorService, private authService: AuthenticationService, @@ -46,4 +51,26 @@ export class ReportServiceService { errorLabel ); } + getTransaction(request, onError, errorLabel) { + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.postNoLoad( + ReportServiceService.SUBMIT_CPP_TRANSACTION, + request, + onError, + errorLabel + ); + } + + getCppOutput(request, onError, errorLabel) { + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.postNoLoad( + ReportServiceService.GET_CCP_OUTPUT, + request, + onError, + errorLabel + ); + } + } diff --git a/Mohem/src/app/reports/reports.module.ts b/Mohem/src/app/reports/reports.module.ts index 41be692b..0fc1953d 100644 --- a/Mohem/src/app/reports/reports.module.ts +++ b/Mohem/src/app/reports/reports.module.ts @@ -9,6 +9,7 @@ import { ReportsPage } from './reports.page'; import { ConcurrentReportComponent } from './concurrent-report/concurrent-report.component'; import { ReportServiceService } from './report-service.service'; import { HmgCommonModule } from '../hmg-common/hmg-common.module'; +import { TransactionListComponent } from './transaction-list/transaction-list.component'; const routes: Routes = [ @@ -20,7 +21,10 @@ const routes: Routes = [ path: 'concurrent-report', component: ConcurrentReportComponent }, - + { + path: 'transaction-list', + component: TransactionListComponent + }, ], } ]; @@ -33,7 +37,7 @@ const routes: Routes = [ RouterModule.forChild(routes), HmgCommonModule ], - declarations: [ReportsPage, ConcurrentReportComponent], + declarations: [ReportsPage, ConcurrentReportComponent, TransactionListComponent], providers: [ReportServiceService] }) export class ReportsPageModule { } diff --git a/Mohem/src/app/reports/transaction-list/transaction-list.component.html b/Mohem/src/app/reports/transaction-list/transaction-list.component.html new file mode 100644 index 00000000..af807b32 --- /dev/null +++ b/Mohem/src/app/reports/transaction-list/transaction-list.component.html @@ -0,0 +1,48 @@ + +
+ + + +
+
+
+ +
+ +
+ +
{{getDate(transaction.REQUEST_DATE)}}
+ + +
+

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

+

+ {{transaction.REQUEST_ID}} +

+
+

{{'transaction, phase' | translate}}

+

{{transaction.CCP_PHASE}}

+
+ + +
+

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

+

{{transaction.CONCURRENT_PROGRAM_NAME}}

+
+
+ + +
+

{{'transaction,output' | translate}}

+

+

+
+ +
+
+ +
+ +
+ +
diff --git a/Mohem/src/app/reports/transaction-list/transaction-list.component.scss b/Mohem/src/app/reports/transaction-list/transaction-list.component.scss new file mode 100644 index 00000000..0f29d1fd --- /dev/null +++ b/Mohem/src/app/reports/transaction-list/transaction-list.component.scss @@ -0,0 +1,138 @@ +.display-created{ + display: inline-block; + + color:#000; +} +#containerDiv{ + margin-top:20px; +} +.padding{ + padding-left:5px; + padding-right: 5px; +} +.bold{ + font-weight: bold; + font-size: 16px; +} +.color-black{ + color:#000; +} +.date{ + position: absolute; + font-size: 14px; + padding: 10px; + right:0; + width: 100px; + color:#969696; +} +.transaction-list{ + margin-top:20px; +} +.date-container{ + margin:0px 20px; +} + +.label{ + font-size: 16px; + // margin-left: 15px; + color: #a2a5a6 !important; + display: block; + overflow: hidden; + -webkit-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + /* font-size: inherit; */ + // text-overflow: ellipsis; + // white-space: nowrap; + white-space: normal; + // padding-top: 10px; + padding: 5px 0px; + padding-left: 10px !important; + margin: 10px auto; + :root[dir="ltr"]{ + font-family: var(--fontFamilySemiBoldEN) !important; + } + :root[dir="rtl"]{ + font-family: var(--fontFamilyIOSAR) !important; + font-weight: bold; + } + + +} + +.Field-en{ + border-radius: 30px; + border: 1px solid #a2a5a6!important; + margin-bottom: 15px; + padding-left: 20px !important; + padding-top: 6px !important; + color: #999999 !important; +} + +.Field-ar{ + border-radius: 30px; + border: 1px solid #a2a5a6!important; + margin-bottom: 20px; + padding-right: 20px !important; + padding-top: 6px !important; + color: #999999 !important; +} +select{ + width: 300px !important; + border: none !important; +} +.padding_date{ + padding-left:5px !important; +} +.date-icon{ + font-size: 20px; + left: -1px; + position: relative; + top: 2px; +} +ion-card{ + padding:10px; + border-radius: 11px; + box-shadow: 0px 1px 2px 1px #ccc; +} +.display-inline{ + display:inline-block; + +} +.red{ +color:#CA3332; +font-weight: 600; +margin:0px 5px; +overflow: hidden; + width: 90%; + white-space: nowrap; + text-overflow: ellipsis; +} +.inline-display{ + display: inline-block; + font-weight: 600; + padding-left:8px; +} +.download{ + font-size: 26px; + margin: 0px 10px; + position: relative; + top: 5px; + color: #CA3332; +} +.refresh{ + font-size: 22px; + margin: 0px 10px; + position: relative; + top: 5px; + color: #CA3332; +} +.disabled-icon{ + pointer-events: none; + opacity: .5; +} +.output-container{ + position: relative; + bottom: 10px; +} \ No newline at end of file diff --git a/Mohem/src/app/reports/transaction-list/transaction-list.component.spec.ts b/Mohem/src/app/reports/transaction-list/transaction-list.component.spec.ts new file mode 100644 index 00000000..9a3a75e7 --- /dev/null +++ b/Mohem/src/app/reports/transaction-list/transaction-list.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TransactionListComponent } from './transaction-list.component'; + +describe('TransactionListComponent', () => { + let component: TransactionListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TransactionListComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TransactionListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/reports/transaction-list/transaction-list.component.ts b/Mohem/src/app/reports/transaction-list/transaction-list.component.ts new file mode 100644 index 00000000..56d0aa06 --- /dev/null +++ b/Mohem/src/app/reports/transaction-list/transaction-list.component.ts @@ -0,0 +1,55 @@ +import { copyStyles } from '@angular/animations/browser/src/util'; +import { Component, ElementRef, OnInit } from '@angular/core'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { ReportServiceService } from '../report-service.service'; + +@Component({ + selector: 'app-transaction-list', + templateUrl: './transaction-list.component.html', + styleUrls: ['./transaction-list.component.scss'], +}) +export class TransactionListComponent implements OnInit { + transactionList: any = []; + selectedMenu: any; + template: any; + constructor(public cs: CommonService, private elementRef: ElementRef, public reports: ReportServiceService, public ts: TranslatorService,) { } + + ngOnInit() { + this.selectedMenu = this.cs.sharedService.getSharedData(MenuResponse.SELECTED_MENU, false); + this.transactionList = this.cs.sharedService.getSharedData(ReportServiceService.TRANSACTION_LIST, false); + this.template = this.cs.sharedService.getSharedData(ReportServiceService.TEMPLATE, false); + } + getDate(date) { + return this.cs.evaluteDate(date); + } + getCppOutput(transaction) { + var request: any = { + P_REQUEST_ID: transaction['REQUEST_ID'] + }; + this.cs.startLoading(); + this.reports.getCppOutput(request, {}, this.ts.trPK('general', 'retry')).subscribe((result: any) => { + + console.log(result); + this.cs.stopLoading(); + + }); + } + refresh(transaction) { + var request: any = { + P_REQUEST_ID: transaction['REQUEST_ID'] + }; + this.cs.startLoading(); + var request: any = {}; + request.P_MENU_TYPE = this.selectedMenu.MENU_TYPE; + request.P_SELECTED_RESP_ID = -999; + request.P_FUNCTION_NAME = this.selectedMenu.FUNCTION_NAME; + request.P_DESC_FLEX_NAME = this.template.CONCURRENT_PROGRAM_NAME; + + this.reports.getTransaction(request, {}, this.ts.trPK('general', 'retry')).subscribe((result: any) => { + this.cs.stopLoading(); + this.transactionList = result['GetCcpTransactionsList_New']; + }); + } +} diff --git a/Mohem/src/app/termination/confirm-termination/confirm-termination.component.html b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.html new file mode 100644 index 00000000..d7e4b690 --- /dev/null +++ b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.html @@ -0,0 +1,123 @@ + + + + + + + + +
{{'general, addAttach' | translate}}
+
+ +
+ +
+
+
+ + + {{ 'general, notAttch' | translate}} + +
+ + +
+ + + + {{attachList.AttachmentID +1 }} . + + + + + {{attachList.P_FILE_NAME }} + + + + + + + +
+ +
+ +
+ + +
+
+ + {{attachRes.FILE_NAME }} + +
+ + + + +
+
+ +
+ + + +
{{'confirmAddEit, comment' | translate}}
+ + + +
+ + +
{{'confirmAddEit, approverList' | translate}}
+
+

{{ 'general, empty' | translate}}

+
+
+ +
+ + +
+
+ +
+
+ + + {{employee.APPROVER}} + + + {{employee.POSITION_TITLE}} + + + +
+
+
+
+
+ +
+ + +
+ + +
+ + {{ 'general, submit' | translate }} +
+
\ No newline at end of file diff --git a/Mohem/src/app/termination/confirm-termination/confirm-termination.component.scss b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.scss new file mode 100644 index 00000000..2ed98379 --- /dev/null +++ b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.scss @@ -0,0 +1,263 @@ +.footer-button { + border-radius: 2px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; + } + + .imgSize { + width: 22px; + height: 22px; + } + + .Header { + font-weight: bold; + color: #1a586d !important; + font-size: 10px; + } + + .tbData { + font-size: 10px; + } + + .btnBack { + background: transparent; + float: right; + } + + .attachmentDiv{ + background: #ffffff; + height: auto; + text-align: center; + padding-top: 1px; + margin: 10px; + border-radius: 15px; + border: 1px solid grey; + } + + .noDataDiv{ + background: #ffffff; + height: 11%; + text-align: center; + padding-top: 1px; + border-radius: 10px; + margin: 10px; + border-radius: 5px; + } + .submitNote{ + background: #ffffff; + height: 80px; + padding-top: 1px; + margin: 10px; + border-radius: 15px; + border: 1px solid grey; + } + + .approvalList{ + --background: #f0efef; + height: auto; + text-align: center; + padding-top: 1px; + border-radius: 10px; + margin: 10px; + border-radius: 5px; + } + + /************************New Design**********************************/ + .notification-list{ + background: none; + background: none; + border-radius: 32px; + ion-item{ + // margin-top: 5px; + // margin-bottom: 5px; + + background-color: transparent; + .item-date{ + width: 100%; + font-size: 16px; + font-weight: bold; + + text-align: start; + padding: 0; + margin: 0; + + position: absolute; + left: 0; + top: 12%; + } + ion-label , [item-end]{ + + white-space: normal; + font-size: 14px; + padding-top: 15%; + // :root[dir="ltr"]{ + // margin-left: 10px; + // } + // :root[dir="rtl"]{ + // margin-right: 10px; + // } + + } + + } + } + + + + + + + .timeline { + position: relative; + margin: 15px 0 0 0; + // border-bottom: solid 1px var(--cusgray); + } + + .timeline:before { + + content: ''; + position: inherit !important; + top: 0; + bottom: 0; + width: 4px; + // background: #e4e4e4; + z-index: 1; + left: 35px; + /* margin-left: -10px; */ + /* z-index: 1; */ + } + + .timeline .timeline-thumb { + + border-radius: 500px; + width: 70px !important; + z-index: 2; + position: absolute; + left: 0px; + // :root[dir="ltr"]{ + // left: 37px; + // } + // :root[dir="rtl"]{ + // right: 37px; + // } + float: right; + top: 9px; + } + + .timeline .timeline-thumb.timeline-icon { + height: 70px; + // text-align: center; + // color: white; + // border: 5px solid #CBD0D3; + // transform: scale(0.2); + } + + + + .timeline .timeline-item { + width: 40px; + + } + + .timeline .timeline-stats { + position: relative; + font-size: 12px; + color: var(--darkgray); + + } + + .empImge{ + border-radius: 50%; + width:100%; + height: 100%; + border: #dedede solid 1px; + + } + .empImgeRep { + border-radius: 50% !important; + width: 80px; + height: 80px; + border: #dedede solid 1px; + } + + .line{ + padding-bottom:87px; + } + + .attachLable{ + position: absolute; + top: 0px; + z-index: 0; + background: #30b8c6; + color: #fff; + border-radius: 50%; + border: 0px; + width: 24px; + height: 24px; + text-align: center; + font-size: 5px; + } + + .removeLable{ + top: 0px; + z-index: 0; + background: #d8252d; + color: #fff; + border-radius: 50%; + border: 0px; + width: 20px; + height: 20px; + text-align: center; + font-size: 5px; + } + + .note-modal { + // width: 90%; + // height: 50%; + // top: 20%; + // left: 5%; + // right: 5%; + // bottom: 5%; + background: rgba(0, 0, 0, 0.5) !important; + padding: 30% 10% !important; + --height: 12cm !important; + // --width: 80% !important; + --border-radius:20px; + + } + .header-toolbar-new{ + --background: #269DB8; + } + .title{ + margin-top: -37px; + margin-left: 85px; + } + .title-ar{ + margin-top: -37px; + margin-right: 101px; + } + .confirmEitOkButton{ + white-space: normal !important; + text-transform: capitalize !important; + min-height: 45px !important; + min-width: 5px !important; + margin: 8px !important; + background-color: #269DB8; + width: 80% !important; + color: white!important; + border-radius: 16px !important; + } + + .approvalTitle-ar{ + font-weight: bold; + font-size: 16px; + text-align: right; + + } + .approvalTitle{ + font-weight: bold; + font-size: 16px; + text-align: left; + } + \ No newline at end of file diff --git a/Mohem/src/app/termination/confirm-termination/confirm-termination.component.spec.ts b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.spec.ts new file mode 100644 index 00000000..c9818fc1 --- /dev/null +++ b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ConfirmTerminationComponent } from './confirm-termination.component'; + +describe('ConfirmTerminationComponent', () => { + let component: ConfirmTerminationComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ConfirmTerminationComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ConfirmTerminationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/termination/confirm-termination/confirm-termination.component.ts b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.ts new file mode 100644 index 00000000..be177d0f --- /dev/null +++ b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.ts @@ -0,0 +1,430 @@ +import { Component, OnInit } from '@angular/core'; +import { ModalController } from '@ionic/angular'; +import { FileUploader } from 'ng2-file-upload'; +import { AddAttachComponent } from 'src/app/eit/add-attach/add-attach.component'; +import { NotificationGetAttachResponse } from 'src/app/eit/models/NotificationGetAttachRes'; +import { EitService } from 'src/app/eit/services/eit.service'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { WorkListButtonRequest } from 'src/app/notification/models/NotificationButtonReq'; +import { WorkListAttachViewComponent } from 'src/app/notification/work-list-attach-view/work-list-attach-view.component'; +import { BasicRequest } from 'src/app/profile/models/basic.request'; +import { SubmitAddressModalComponent } from 'src/app/profile/submit-eit-modal/submit-address-modal.component'; +import { TerminationServiceService } from '../service/termination-service.service'; + +@Component({ + selector: 'app-confirm-termination', + templateUrl: './confirm-termination.component.html', + styleUrls: ['./confirm-termination.component.scss'], +}) +export class ConfirmTerminationComponent implements OnInit { + + + private P_TransactionID: number; + + approversList = []; + responseList: any; + eitComments: string = ""; + menuType: string = ""; + selEmp: string = ""; + respID: number; + selMenu: MenuResponse; + getAttachList: any; + attachListDisplay: any = []; + headerTitle: string = ""; + isTrue: any = 0; + attachItems: any; + public isResubmitEIT: boolean = false; + private itemKey: string = ""; + private pActionMode: string = "SUBMIT"; + attachReqObj: WorkListButtonRequest = new WorkListButtonRequest(); + attachmentRes: any; + objIndex1: any; + attachListOver: any = []; + index: any = 0; + getPassNotificationDetails: any; + isSubmitBtnClicked: boolean; + // isDelete: boolean = false; + + /***Add Attchment Vars */ + isUpload: boolean = false; + inQueue: boolean = false; + addAttachmentListReq: any; + attachmentID: number = 0; + addAttachRequest: any = []; + fileData: any; + fileType: any; + dirPage: any; + TransactionID: any; + indexLastObj: any = 0; + filterAllowedType: any = ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']; + direction: string; + + + constructor(public modalController: ModalController, public cs: CommonService, private ts: TranslatorService, private eitService: EitService, public terminationService: TerminationServiceService) { + this.direction = TranslatorService.getCurrentLanguageName() + this.isSubmitBtnClicked = false; + + } + + ngOnInit() { + this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); + this.selEmp = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_EMP, false); + this.respID = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_RESP_ID, false); + + + this.menuType = this.selMenu.List_Menu.MENU_TYPE; + this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; + this.responseList = this.cs.sharedService.getSharedData(TerminationServiceService.SHARED_DATA, false); + this.itemKey = this.responseList.P_ITEM_KEY; + this.P_TransactionID = this.responseList.P_TRANSACTION_ID; + // this.isDelete = this.isResubmitEIT = this.cs.sharedService.getSharedData('confirmAddEITData', false).isDelete; + + this.getApproversList(); + + } + + getApproversList() { + let body: any = { + P_TRANSACTION_ID: this.P_TransactionID, + P_AME_TRANSACTION_TYPE: "SSHRMS", + P_PAGE_NUM: 1, + P_PAGE_LIMIT: 1000 + } + this.eitService.getApproversList(body).subscribe((result: any) => { + this.handleApproversResult(result); + }); + } + + handleApproversResult(result) { + if (this.cs.validResponse(result)) { + this.approversList = result.GetApprovesList; + } + } + + startEitApproval() { + if (this.attachListOver) { + let request = { + AddAttachmentList: this.attachListOver + } + + this.eitService.addAttachment( + request). + subscribe((result: any) => { + this.handleAddAttachmentResults(result); + }); + } else { + this.startApprovalProcess(); + } + } + + + handleAddAttachmentResults(result) { + + if (this.cs.validResponse(result)) { + this.isTrue = 0; + for (let i = 0; i < result.AddAttSuccessList.length; i++) { + if (!result.AddAttSuccessList[i].AddSuccess) { + this.attachListOver[i].isSuccess = false; + //this.attachItems[i].isSuccess = false; + // if false display cancel button with waring icon or design + }// end if + else { + // if true remove cancel and set isSuccess = true + // this.attachItems[i].isSuccess = true; + this.attachListOver[i].isSuccess = true; + this.isTrue = this.isTrue + 1; //count flag of attach status + } // end else + } // end for + + if (this.isTrue == result.AddAttSuccessList.length) { + this.startApprovalProcess(); + } + else { + //stope + let filtered = this.attachListOver.filter(function (el) { return el.isSuccess == true; }); + this.attachListOver = filtered; + let msg: string = ""; + msg = this.ts.trPK("eit", "attach-errorMsg"); + this.cs.presentAlert(msg); + } + } + } + + startApprovalProcess() { + let request: any = {}; + + request.P_MENU_TYPE = this.menuType; + request.P_SELECTED_RESP_ID = this.respID; + request.P_TRANSACTION_ID = this.P_TransactionID; + request.P_ITEM_KEY = this.itemKey; + request.P_ACTION_MODE = this.pActionMode; + request.P_COMMENTS = this.eitComments; + this.terminationService.startApprovalProcess( + request). + subscribe((result: any) => { + this.handleResults(result); + }); + } + cancelEitProcess() { + let body: any = { + P_TRANSACTION_ID: this.P_TransactionID + } + this.eitService.cancelHRTransaction( + body). + subscribe((result: any) => { + this.handleCancelResults(result); + }); + + } + handleCancelResults(result) { + if (this.cs.validResponse(result)) { + this.isSubmitBtnClicked = false; + } + } + handleResults(result) { + if (this.cs.validResponse(result)) { + this.isSubmitBtnClicked = true; + let msg: string = this.ts.trPK("eit", "approval-message-success"); + this.cs.presentAlert(msg); + this.cs.openNotificationPage(); + } + } + + async addAttachment(str: boolean, attachItems: any) { + //open the modal with return data + let attachDocID = attachItems.ATTACHED_DOCUMENT_ID; + + this.cs.sharedService.setSharedData(this.P_TransactionID, 'TransactionID'); + this.cs.sharedService.setSharedData(this.attachListOver.length, 'indexLastObj'); + + const modal = await this.modalController.create({ + component: AddAttachComponent + }); + + modal.onDidDismiss() + .then((data) => { + if (data == "cancel" || data == "undefined") { + return; + } else { + if (!str) { + this.updateFile(data, attachDocID); + } else { + console.log(data); + this.attachListDisplay = data.data; + this.attachItems = this.attachListDisplay.map(function (el) { + var o = Object.assign({}, el); + o.isSuccess = false; + return o; + }); + + this.attachListOver = this.attachListOver ? this.attachListOver.concat(this.attachItems) : this.attachItems; + } + } + }); + + return await modal.present(); + } + + /*****submit modal********/ + async openSubmitModal() { + this.cs.sharedService.setSharedData(this.attachListOver, 'submitAttachmentList'); + this.cs.sharedService.setSharedData(this.eitComments, 'eitComments'); + const modal = await this.modalController.create({ + component: SubmitAddressModalComponent, + backdropDismiss: false, + + }); + modal.cssClass = 'note-modal'; + + modal.onDidDismiss() + .then((data) => { + console.log(data.data); + + if (data.data == "cancel" || data.data == undefined) { + return; + } else { + this.startEitApproval(); + } + }); + + return await modal.present(); + } + + + + removeFile(objectitem) { + if (this.attachListOver) { + let index2 = this.attachListOver.findIndex(item => item == objectitem); + if (index2 > -1) { + this.attachListOver.splice(index2, 1); + } + } + if (this.attachmentRes) { + let index3 = this.attachmentRes.findIndex(item => item == objectitem); + if (index3 > -1) { + this.attachmentRes.splice(index3, 1); + } + } + + } + + + getAttachment(NotificationID) { + this.attachReqObj.P_NOTIFICATION_ID = NotificationID; + this.eitService.getAttach(this.attachReqObj). + subscribe((result: NotificationGetAttachResponse) => { + this.handleWorkListAttachResult(result); + }); + } + + handleWorkListAttachResult(result) { + if (this.cs.validResponse(result)) { + if (result.GetAttachementList != null) { + this.attachmentRes = result.GetAttachementList; + } // if result == null + } // valid it + + } + + async OpenAttachFiles(value, Type) { + this.cs.sharedService.setSharedData({ displayData: value, TypeData: Type }, 'WorkListAttachViewPage'); + const modal = await this.modalController.create({ + component: WorkListAttachViewComponent + }); + + modal.onDidDismiss() + .then((data) => { + }); + return await modal.present(); + } + + + delelteFile(attach) { + this.cs.confirmAlertDialog((data) => { + if (data == true) { + this.continueDelete(attach); + } + }, this.ts.trPK('general', 'ok'), () => { + + }, this.ts.trPK('general', 'cancel'), this.ts.trPK('general', 'alert'), this.ts.trPK('eit', 'delete-perm')); + } + + continueDelete(attach) { + let req = { + P_ATTACHED_DOCUMENT_ID: attach.ATTACHED_DOCUMENT_ID + } + this.eitService.deleteAttach(req). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (result.DeleteAttachmentList.P_RETURN_STATUS === "S") { + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); + let msg: string = ""; + msg = this.ts.trPK("eit", "deleteAttach"); + this.cs.presentAlert(msg); + } + } + }); + } + + updateFile(attachList, attachDocID) { + let req = { + P_ATTACHED_DOCUMENT_ID: attachDocID, + P_FILE_DATA: attachList[0].P_FILE_DATA, + P_FILE_NAME: attachList[0].P_FILE_NAME, + P_FILE_CONTENT_TYPE: attachList[0].P_FILE_CONTENT_TYPE + } + this.eitService.updateAttach(req). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (result.MessageStatus == 1) { + let msg: string = ""; + msg = this.ts.trPK("eit", "attachUpdate"); + this.cs.presentAlert(msg); + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); + } + } + }); + } + + + ionViewWillLeave() { + if (this.P_TransactionID && this.isSubmitBtnClicked == false) + this.cancelEitProcess(); + } + + /*******************Add attchement Functions*************/ + + public uploader: FileUploader = new FileUploader({ + allowedMimeType: ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], + maxFileSize: 10 * 1024 * 1024, + formatDataFunctionIsAsync: true, + formatDataFunction: async (item) => { + return new Promise((resolve, reject) => { + resolve({ + name: item._file.name, + length: item._file.size, + contentType: item._file.type, + date: new Date() + }); + }); + } + }); + + + onFileSelectedclick(event) { + event.target.value = ''; + } + + + + onFileSelected(input) { + + if (!(this.filterAllowedType.indexOf(input.target.files[0].type) > -1)) { + let msg: string = ""; + msg = this.ts.trPK("general", "notSupport"); + this.cs.presentAlert(msg); + return + } // todo: show alert that you tried uploading wrong files + + else { + const file = input.target.files[0]; + this.getBase64(file).then( + data => this.pushObject(data, file.name, file.type) + ); + } + } + + + getBase64(file) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = () => resolve(reader.result); + reader.onerror = error => reject(error); + }); + } + + + pushObject(fileData, name, type) { + + console.log("before push: " + this.index); + try { + let array = name.split('.'); + let attachType: string = array[array.length - 1]; + this.attachListOver.push( + { + AttachmentID: this.attachListOver.length, + P_FILE_CONTENT_TYPE: attachType,//type.split('/')[1], + P_FILE_DATA: fileData.split(',')[1], + P_FILE_NAME: name,//.split('.')[0], + P_TRANSACTION_ID: this.P_TransactionID + }) + + } catch (e) { + } + } + + +} diff --git a/Mohem/src/app/termination/service/termination-service.service.ts b/Mohem/src/app/termination/service/termination-service.service.ts index d980c9d3..5f2d94e1 100644 --- a/Mohem/src/app/termination/service/termination-service.service.ts +++ b/Mohem/src/app/termination/service/termination-service.service.ts @@ -1,4 +1,5 @@ import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service'; @@ -10,8 +11,10 @@ export class TerminationServiceService { public static GET_TERM_COLS_STRUCTURE = 'Services/ERP.svc/REST/GET_TERM_COLS_STRUCTURE'; public static GET_TERM_DIFF_STRUCTURE = 'Services/ERP.svc/REST/GET_TERM_DFF_STRUCTURE'; + public static SUBMIT_TRANSACTION = 'Services/ERP.svc/REST/SUBMIT_TERM_TRANSACTION'; + public static START_APPORVAL = 'Services/ERP.svc/REST/START_TERM_APPROVAL_PROCESS'; public static TERMINATION_PAGE = 'termination-page'; - + public static SHARED_DATA = 'termination-submit-data'; constructor( public con: ConnectorService, private authService: AuthenticationService, @@ -37,4 +40,24 @@ export class TerminationServiceService { errorLabel ); } + submitTransation(request, onError, errorLabel) { + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.postNoLoad( + TerminationServiceService.SUBMIT_TRANSACTION, + request, + onError, + errorLabel + ); + } + public startApprovalProcess(basicDetailsProcess: any, onError?: any, errorLabel?: string): Observable { + const request = basicDetailsProcess; + this.authService.authenticateRequest(request); + request.P_SELECTED_EMPLOYEE_NUMBER = request.UserName; + return this.con.post(TerminationServiceService.START_APPORVAL, request, onError, errorLabel); + } + + + + } diff --git a/Mohem/src/app/termination/termination-form/termination-form.component.html b/Mohem/src/app/termination/termination-form/termination-form.component.html index f8fa6523..11071910 100644 --- a/Mohem/src/app/termination/termination-form/termination-form.component.html +++ b/Mohem/src/app/termination/termination-form/termination-form.component.html @@ -7,6 +7,7 @@
+
diff --git a/Mohem/src/app/termination/termination-form/termination-form.component.scss b/Mohem/src/app/termination/termination-form/termination-form.component.scss index e69de29b..746e3d4f 100644 --- a/Mohem/src/app/termination/termination-form/termination-form.component.scss +++ b/Mohem/src/app/termination/termination-form/termination-form.component.scss @@ -0,0 +1,3 @@ +#containerDiv{ + margin:15px; +} \ No newline at end of file diff --git a/Mohem/src/app/termination/termination-form/termination-form.component.ts b/Mohem/src/app/termination/termination-form/termination-form.component.ts index f175165a..a7082c9c 100644 --- a/Mohem/src/app/termination/termination-form/termination-form.component.ts +++ b/Mohem/src/app/termination/termination-form/termination-form.component.ts @@ -1,6 +1,9 @@ import { Component, ElementRef, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; import * as moment from 'moment'; +import { EITTransactionsRequest } from 'src/app/eit/models/EITTransactionsReq'; +import { EIT_ACTION } from 'src/app/eit/models/submit.eit.action'; import { EitService } from 'src/app/eit/services/eit.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; @@ -12,6 +15,7 @@ import { NumberInput } from 'src/app/uI-elements/number.input'; import { SelectInput } from 'src/app/uI-elements/select.input'; import { TextInput } from 'src/app/uI-elements/text.input'; import { TimeInput } from 'src/app/uI-elements/time.input'; + import { TerminationServiceService } from '../service/termination-service.service'; @@ -50,7 +54,15 @@ export class TerminationFormComponent implements OnInit { getPassdirfromNotifiPage: boolean = false; private startDate; private endDate; - constructor(public cs: CommonService, private elementRef: ElementRef, public terminationFormService: TerminationServiceService, public ts: TranslatorService, public eitService: EitService) { } + private targetValue; + public eitSubmitAction; + constructor(public cs: CommonService, private elementRef: ElementRef, public terminationFormService: TerminationServiceService, public ts: TranslatorService, public eitService: EitService, public router: ActivatedRoute) { + this.router.queryParams.subscribe(params => { + this.targetValue = params.targetValue; + console.log(this.targetValue); + }); + + } ngOnInit() { this.getPassdirfromNotifiPage = this.cs.sharedService.getSharedData('dirfromNotificationPage'); @@ -58,13 +70,18 @@ export class TerminationFormComponent implements OnInit { this.getTerminationCol(); this.direction = TranslatorService.getCurrentLanguageName(); this.effectiveDate = new Date(); + this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); + this.eitSubmitAction = this.cs.sharedService.getSharedData( + EITTransactionsRequest.SUBMIT_EIT_ACTION + ); } getTerminationCol() { + this.cs.startLoading(); this.terminationFormService.getTerminationColStructure({ P_FUNCTION_NAME: this.selectedMenu.P_FUNCTION_NAME }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { - this.termColStructure = response; - console.log(response); + this.termColStructure = response['GetTermColsStructureList']; + this.drawEitFieldsStatic(this.termColStructure); this.getTermDiffStructure(); }) } @@ -73,15 +90,14 @@ export class TerminationFormComponent implements OnInit { P_DESC_FLEX_CONTEXT_CODE: null, P_FUNCTION_NAME: this.selectedMenu.FUNCTION_NAME }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { - console.log("Diff Structure"); - console.log(response); + this.cs.stopLoading(); this.handleDiffStructure(response); }) } handleDiffStructure(result) { - if (result.GetCcpDffStructureList != null) { - this.diffStructure = result.GetCcpDffStructureList; - this.drawEitFields(result.GetCcpDffStructureList); + if (result.GetTermDffStructureList != null) { + this.diffStructure = result.GetTermDffStructureList; + this.drawEitFields(result.GetTermDffStructureList); if (this.isUpdate) { //this.submitAbsObjList = this.cs.sharedService.getSharedData(ProfileService.EMP_ADDRESS); //this.fillAbsStructure(); @@ -859,7 +875,7 @@ export class TerminationFormComponent implements OnInit { return isSt; } - validateAbcenseTransaction() { + validateTransaction() { (this.elementRef.nativeElement.querySelectorAll( "ion-item" ) as HTMLElement[]).forEach(x => { @@ -867,71 +883,73 @@ export class TerminationFormComponent implements OnInit { x.classList.remove("ng-untouched"); }); - let arrValues = this.getElementsValues(); + var arrValues = this.getElementsValues(); + let staticValues = this.getElementsStaticValues(); + let allStatisDynamicValues = arrValues.concat(staticValues); if (arrValues) { - if (!this.startDate || !this.endDate) { - //this.common.showRequiredMsg(); - return false; - } - let Sdata = moment(this.startDate).format("MM/DD/YYYY"); - let Edata = moment(this.endDate).format("MM/DD/YYYY"); - this.reportSubmitRequest = {} - // this.reports - // .submitTransaction(this.reportSubmitRequest, {}, this.ts.trPK('general', 'retry')) - // .subscribe((result: any) => { - // this.handleSubmitAbsence(result); - // }); + + this.reportSubmitRequest = { + + P_MENU_TYPE: this.selMenu.List_Menu.MENU_TYPE, + P_SELECTED_RESP_ID: -999, + P_FUNCTION_NAME: this.selMenu.GetMenuEntriesList.FUNCTION_NAME, + EITTransactionTBL: allStatisDynamicValues, + + }; + this.cs.startLoading(); + this.terminationFormService + .submitTransation(this.reportSubmitRequest, {}, this.ts.trPK('general', 'retry')) + .subscribe((result: any) => { + this.handleSubmit(result); + }); } } - private handleSubmitAbsence(result) { + private handleSubmit(result) { if (this.cs.validResponse(result)) { - if (this.getPassdirfromNotifiPage) { - //this.cs.sharedService.setSharedData(result.ResubmitAbsenceTransactionList.P_TRANSACTION_ID, AbsenceResponse.SHARED_DATA); - this.cs.openConfirmAbsece(); + this.cs.sharedService.setSharedData(result['SubmitTermTransactionList'], TerminationServiceService.SHARED_DATA); + this.cs.stopLoading(); + this.cs.confirmTermination(); + } + } - } else { - //this.cs.sharedService.setSharedData(result.SumbitAbsenceTransactionList.P_TRANSACTION_ID, AbsenceResponse.SHARED_DATA); - this.cs.openConfirmAbsece(); - } - } - } getElementsValues() { - //this.updatedValues=[];//fill updated list + public getElementsValues(): any { + this.updatedValues = []; //fill updated list let valuseArr: any = []; let varcharValue: any = null; let numbervalue: any = 0; let dateValue: any = null; - let textValue = ""; - let key: string = ""; - let obj: any = {}; + let transNo: number = 1; + let textValue: any; + // if(this.ExtraObj.transactionNo) + // transNo=this.ExtraObj.transactionNo; for (let i = 0; i < this.diffStructure.length; i++) { varcharValue = null; numbervalue = null; dateValue = null; + /*********set transaction No of the updated object ********/ + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.diffStructure[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + } if (this.diffStructure[i].DISPLAY_FLAG != "N") { if (this.diffStructure[i].VALIDATION_TYPE == "N") { let elem = document.getElementById( this.diffStructure[i].APPLICATION_COLUMN_NAME ) as HTMLInputElement; - let elemVal = ""; - if (elem.classList.contains('onic-date')) { - elemVal = (document.getElementById( - this.diffStructure[i].APPLICATION_COLUMN_NAME - ) as HTMLInputElement).value; - if (elemVal) { - elemVal = moment(elemVal).format("YYYY/MM/DD hh:mm:ss"); - } - - } else { - elemVal = (document.getElementById( - this.diffStructure[i].APPLICATION_COLUMN_NAME - ) as HTMLInputElement).value; - } + let elemVal = (document.getElementById( + this.diffStructure[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; textValue = elemVal; - + //let elemVal= (document.getElementById(this.eitResponse[i].APPLICATION_COLUMN_NAME)).value; if ( this.diffStructure[i].FORMAT_TYPE == "X" && this.diffStructure[i].DISPLAY_FLAG != "N" @@ -943,25 +961,39 @@ export class TerminationFormComponent implements OnInit { this.diffStructure[i].DISPLAY_FLAG != "N" ) { //standard date time - elemVal = elem.dataset.dtvalue; - // elemVal = this.common.formatStandardDate(elemVal); + // elemVal = elem.dataset.dtvalue; + // elemVal = this.cs.formatStandardDate(elemVal); + elemVal = this.cs.formatDate(elemVal); } else if ( this.diffStructure[i].FORMAT_TYPE == "I" && this.diffStructure[i].DISPLAY_FLAG != "N" ) { //time - elemVal = elem.dataset.dtvalue; + if (elemVal.length > 5) { + elemVal = elemVal.substring(11, 16); + } else { + elemVal = elemVal; + } } if (this.diffStructure[i].REQUIRED_FLAG == "Y" && !elemVal) { elem.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); return false; } else { elem.classList.remove("requiredClassElm"); } - if (elemVal) varcharValue = elemVal; - key = "P_" + this.diffStructure[i].APPLICATION_COLUMN_NAME; - // obj = {}; - obj[key] = varcharValue; + // if (elemVal != 'null'){ + varcharValue = elemVal; + //} else{ + // elemVal = null; + // } + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.diffStructure[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); } else { let x = document.getElementById( this.diffStructure[i].APPLICATION_COLUMN_NAME @@ -981,20 +1013,21 @@ export class TerminationFormComponent implements OnInit { varcharValue = val; textValue = txt; } - if ( - this.diffStructure[i].REQUIRED_FLAG == "Y" && - !varcharValue - ) { + if (this.diffStructure[i].REQUIRED_FLAG == "Y" && !varcharValue) { x.classList.add("requiredClassElm"); - // this.common.showRequiredMsg(); + //this.common.showRequiredMsg(); return false; } else { x.classList.remove("requiredClassElm"); } - key = "P_" + this.diffStructure[i].APPLICATION_COLUMN_NAME; - //obj = {}; - obj[key] = varcharValue; + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.diffStructure[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); } //end else } else { let x = document.getElementById( @@ -1002,23 +1035,427 @@ export class TerminationFormComponent implements OnInit { ) as HTMLSelectElement; let val = x.dataset.colmText; textValue = x.value; - if (this.diffStructure[i].REQUIRED_FLAG == "Y" && !varcharValue) { + if (this.diffStructure[i].REQUIRED_FLAG == "Y" && !val) { x.classList.add("requiredClassElm"); - // this.common.showRequiredMsg(); + //this.common.showRequiredMsg(); return false; } else { x.classList.remove("requiredClassElm"); } - if (val) varcharValue = val; - key = "P_" + this.diffStructure[i].APPLICATION_COLUMN_NAME; - //obj = {}; - obj[key] = varcharValue; + } + + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.diffStructure[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + if (this.validateEitObj && this.eitSubmitAction == EIT_ACTION.UPDATE) { + let updatedObj = this.validateEitObj.find( + x => + x.APPLICATION_COLUMN_NAME == + this.diffStructure[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + let y = { + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue, + SEGMENT_VALUE_DSP: textValue, + APPLICATION_COLUMN_NAME: this.diffStructure[i] + .APPLICATION_COLUMN_NAME, + DATATYPE: this.diffStructure[i].DATATYPE, + DESC_FLEX_CONTEXT_CODE: this.diffStructure[i].DESC_FLEX_CONTEXT_CODE, + DESC_FLEX_NAME: this.diffStructure[i].DESC_FLEX_NAME, + DISPLAY_FLAG: this.diffStructure[i].DISPLAY_FLAG, + SEGMENT_NAME: this.diffStructure[i].SEGMENT_NAME, + SEGMENT_PROMPT: this.diffStructure[i].SEGMENT_PROMPT + }; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } } } // end for - valuseArr.push(obj); + if (this.getPassdirfromNotifiPage) { + let updatedObj1 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_ACTION" + ); + let updatedObj2 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_EXTRA_INFO_ID" + ); + let updatedObj3 = this.validateEitObj.find( + x => x.APPLICATION_COLUMN_NAME === "PEI_OBJECT_VERSION_NUMBER" + ); + this.updatedValues.push(updatedObj1); + this.updatedValues.push(updatedObj2); + this.updatedValues.push(updatedObj3); + valuseArr = this.fillExtraInformation( + valuseArr, + updatedObj1.VARCHAR2_VALUE, + updatedObj2.NUMBER_VALUE, + updatedObj3.NUMBER_VALUE, + transNo + ); + } else { + if (this.eitSubmitAction == EIT_ACTION.ADD) { + this.updatedValues = this.fillExtraValuesUpdated( + this.updatedValues, + "NEW_ROW", + -1, + 0, + transNo + ); + valuseArr = this.fillExtraInformation( + valuseArr, + "NEW_ROW", + -1, + 0, + transNo + ); + } else if (this.eitSubmitAction == EIT_ACTION.UPDATE) { + valuseArr = this.fillExtraInformation( + valuseArr, + "UPDATE_ROW", + this.ExtraObj.peiExtraInfoID, + this.ExtraObj.peiObjVer, + transNo + ); + } else if (this.eitSubmitAction == EIT_ACTION.DELETE) { + valuseArr = this.fillExtraInformation( + valuseArr, + "DELETE_ROW", + this.ExtraObj.peiExtraInfoID, + this.ExtraObj.peiObjVer, + transNo + ); + } + } return valuseArr; + } // end getElementsValues + + fillExtraValuesUpdated( + values: any, + peiAction: string, + peiExtraInfoID: number, + peiObjVer: number, + transNo: number + ): any { + let obj1 = { + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: peiAction, + NUMBER_VALUE: null, + DATE_VALUE: null, + SEGMENT_VALUE_DSP: "", + APPLICATION_COLUMN_NAME: "PEI_ACTION", + DATATYPE: "VARCHAR2", + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + SEGMENT_NAME: "", + SEGMENT_PROMPT: "" + }; + let obj2 = { + TRANSACTION_NUMBER: 1, + APPLICATION_COLUMN_NAME: "PEI_OBJECT_VERSION_NUMBER", + VARCHAR2_VALUE: null, + NUMBER_VALUE: peiObjVer, + DATATYPE: "NUMBER", + SEGMENT_VALUE_DSP: "", + DATE_VALUE: null, + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + SEGMENT_NAME: "", + SEGMENT_PROMPT: "" + }; + let obj3 = { + APPLICATION_COLUMN_NAME: "PEI_EXTRA_INFO_ID", + DATATYPE: "NUMBER", + DATE_VALUE: null, + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + NUMBER_VALUE: peiExtraInfoID, + SEGMENT_NAME: "", + SEGMENT_PROMPT: "", + SEGMENT_VALUE_DSP: "", + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: null + }; + values.push(obj1); + values.push(obj2); + values.push(obj3); + return values; } + fillExtraInformation( + values: any, + peiAction: string, + peiExtraInfoID: number, + peiObjVer: number, + transNo: number + ): any { + values.push({ + TRANSACTION_NUMBER: transNo, + NAME: "PEI_ACTION", + VARCHAR2_VALUE: peiAction, + NUMBER_VALUE: null, + DATE_VALUE: null + }); + values.push({ + TRANSACTION_NUMBER: transNo, + NAME: "PEI_EXTRA_INFO_ID", + VARCHAR2_VALUE: null, + NUMBER_VALUE: peiExtraInfoID, + DATE_VALUE: null + }); + values.push({ + TRANSACTION_NUMBER: transNo, + NAME: "PEI_OBJECT_VERSION_NUMBER", + VARCHAR2_VALUE: null, + NUMBER_VALUE: peiObjVer, + DATE_VALUE: null + }); + return values; + } + + fixTransactionNo(transactionTBL: any): any[] { + let list: any = []; + let newIndex: number = 1; + let length: number = transactionTBL.length; + if (length > 0) { + for (let i = 0; i < length; i++) { + // let item :any={}; + const item = Object.assign({}, transactionTBL[i]); + let transNo: number = item.TRANSACTION_NUMBER; + let obj: any = item; + if (i == 0) { + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } else { + let prevEl: any = transactionTBL[i - 1].TRANSACTION_NUMBER; + if (transNo == prevEl) { + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } else { + newIndex++; + obj.TRANSACTION_NUMBER = newIndex; + list.push(obj); + } + } + } + } + return list; + } + private drawEitFieldsStatic(feildsList) { + const containerId = "containerDivTwo"; + this.eitVALSettoCall = []; + for (let i = 0; i < feildsList.length; i++) { + let defaultVal: string = ""; + let defaultValText: string = ""; + + if (feildsList[i].DISPLAY_FLAG != "N") { + //text , date , time + if (feildsList[i].DATATYPE == "VARCHAR2" && feildsList[i].ObjectValuesList === null) { + // character + this.textInput = new TextInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + defaultValText, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else if (feildsList[i].DATATYPE == "VARCHAR2" && feildsList[i].ObjectValuesList !== null) { + this.selectInput = new SelectInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + this.fillStaticDropdownList( + feildsList[i].SEGMENT_NAME, + feildsList[i].ObjectValuesList, + feildsList[i].APPLICATION_COLUMN_NAME + ); + } else if (feildsList[i].DATATYPE == "NUMBER") { + this.numberInput = new NumberInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else if (feildsList[i].DATATYPE == "DATE") { + this.dateInput = new DateInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + + } + } + } + + } + + public fillStaticDropdownList(segmentName, optionList: any = [], elemID: string) { + let eitObj: any; + if (optionList.length > 0) { + let select = document.getElementById(elemID) as HTMLSelectElement; + document.getElementById(elemID).innerHTML = ""; + + for (let i = 0; i < optionList.length; i++) { + var option = document.createElement("option"); + option.text = optionList[i].MEANING; + option.value = optionList[i].CODE; + select.add(option); + } + } + } + + public getElementsStaticValues(): any { + this.updatedValues = []; //fill updated list + let valuseArr: any = []; + let varcharValue: any = null; + let numbervalue: any = 0; + let dateValue: any = null; + let transNo: number = 1; + let textValue: any; + + for (let i = 0; i < this.termColStructure.length; i++) { + varcharValue = null; + numbervalue = null; + dateValue = null; + + if (this.termColStructure[i].DISPLAY_FLAG != "N") { + if (this.termColStructure[i].ObjectValuesList === null) { + let elem = document.getElementById(this.termColStructure[i].APPLICATION_COLUMN_NAME) as HTMLInputElement; + let elemVal = elem !== null ? (document.getElementById(this.termColStructure[i].APPLICATION_COLUMN_NAME) as HTMLInputElement).value : ''; + textValue = elemVal; + + if (this.termColStructure[i].DATATYPE == "VARCHAR2" || this.termColStructure[i].DATATYPE == "NUMBER") { + elemVal = elemVal; + } else if (this.termColStructure[i].DATATYPE == "DATE") { + // date + elemVal = this.cs.formatDate(elemVal); + } + + if (this.targetValue === 'new') { + if (this.termColStructure[i].REQUIRED_FLAG == "Y" && !elemVal) { + elem.classList.add("requiredClassElm"); + return false; + } else { + elem.classList.remove("requiredClassElm"); + } + } + + if (this.termColStructure[i].DATATYPE == "DATE") { + dateValue = elemVal; + } else if (this.termColStructure[i].DATATYPE == "NUMBER") { + numbervalue = elemVal; + } else { + varcharValue = elemVal; + } + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.termColStructure[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } else { + let x = document.getElementById(this.termColStructure[i].APPLICATION_COLUMN_NAME) as HTMLSelectElement; + + let val = x.options && x.options[x.selectedIndex] ? x.options[x.selectedIndex].value : null; + let txt = x.options && x.options[x.selectedIndex] ? x.options[x.selectedIndex].text : null; + varcharValue = val; + textValue = txt; + + if (x !== null) { + if (this.termColStructure[i].REQUIRED_FLAG == "Y" && !varcharValue) { + x.classList.add("requiredClassElm"); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + } + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.termColStructure[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } + } else { + let x = document.getElementById(this.termColStructure[i].APPLICATION_COLUMN_NAME) as HTMLSelectElement; + let val = x !== null ? x.dataset.colmText : ''; + textValue = x !== null ? x.value : ''; + + if (x !== null) { + if (this.termColStructure[i].REQUIRED_FLAG == "Y" && !val) { + x.classList.add("requiredClassElm"); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + } + varcharValue = val; + + + + valuseArr.push({ + TRANSACTION_NUMBER: transNo, + NAME: this.termColStructure[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } + } + return valuseArr; + } + public customiseDate(date: any) { + let formatedDate = date.slice(0, 9); + let newDate = formatedDate.split("/").reverse(); + const tmp = newDate[2]; + newDate[2] = newDate[1]; + newDate[1] = tmp; + newDate = newDate.join("/"); + newDate = newDate + ' 00:00:00'; + return newDate; + } } diff --git a/Mohem/src/app/termination/termination.module.ts b/Mohem/src/app/termination/termination.module.ts index aadbde53..7302cb97 100644 --- a/Mohem/src/app/termination/termination.module.ts +++ b/Mohem/src/app/termination/termination.module.ts @@ -9,6 +9,8 @@ import { TerminationPage } from './termination.page'; import { TerminationFormComponent } from './termination-form/termination-form.component'; import { TerminationServiceService } from './service/termination-service.service'; import { HmgCommonModule } from '../hmg-common/hmg-common.module'; +import { ConfirmTerminationComponent } from './confirm-termination/confirm-termination.component'; +import { SubmitAddressModalComponent } from '../profile/submit-eit-modal/submit-address-modal.component'; const routes: Routes = [ @@ -20,6 +22,10 @@ const routes: Routes = [ path: 'termination-form', component: TerminationFormComponent }, + { + path: 'confirm-termination', + component: ConfirmTerminationComponent + }, ], } @@ -33,7 +39,8 @@ const routes: Routes = [ RouterModule.forChild(routes), HmgCommonModule ], - declarations: [TerminationPage, TerminationFormComponent], - providers: [TerminationServiceService] + declarations: [TerminationPage, TerminationFormComponent, ConfirmTerminationComponent], + providers: [TerminationServiceService], + entryComponents: [SubmitAddressModalComponent] }) export class TerminationPageModule { } diff --git a/Mohem/src/assets/imgs/hr-request.png b/Mohem/src/assets/imgs/hr-request.png new file mode 100644 index 00000000..c905603b Binary files /dev/null and b/Mohem/src/assets/imgs/hr-request.png differ diff --git a/Mohem/src/assets/imgs/my-request.png b/Mohem/src/assets/imgs/my-request.png new file mode 100644 index 00000000..7fdc5539 Binary files /dev/null and b/Mohem/src/assets/imgs/my-request.png differ diff --git a/Mohem/src/assets/imgs/pending-transaction.png b/Mohem/src/assets/imgs/pending-transaction.png new file mode 100644 index 00000000..d252ad43 Binary files /dev/null and b/Mohem/src/assets/imgs/pending-transaction.png differ diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index 89df168a..6d68cc24 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -1496,12 +1496,12 @@ "ar": "حذف" }, "update-msg": { - "en": "Are you sure you want update this member ?", + "en": "Are you sure you want to update this member ?", "ar": "هل انت متاكد من تعديل هذا العضو؟" }, "remove-msg": { - "en": "Are you sure you want rmove this member ?", - "ar": "هل انت متاكد من حذف هذا العضو ؟" + "en": "Are you sure you want to remove this member?", + "ar": "هل أنت متأكد أنك تريد إزالة هذا العضو؟" }, "update-confirm": { "en": "member updated successfully", @@ -3173,10 +3173,46 @@ } }, "itemforsale": { + "warning": { + "en": "This ad will be valid for 2 week after approval", + "ar": "هذا الإعلان ساري المفعول لمدة أسبوعين بعد الموافقة" + }, "title": { "en": "Item for sale", "ar": "سلعه للبيع" }, + "region": { + "en": "Region", + "ar": "منطقة" + }, + "selling-for": { + "en": "Selling for", + "ar": "بيع مقابل" + }, + "item-condition": { + "en": "Item condition", + "ar": "حالة السلعة" + }, + "new": { + "en": "New", + "ar": "جديد" + }, + "used": { + "en": "Used", + "ar": "تستخدم" + }, + "item-price": { + "en": "Item Price", + "ar": "سعر السلعة" + }, + "item-photos": { + "en": "Item Photos", + "ar": "صور البند" + }, + "offering": { + "en": "What are you offering?", + "ar": "ما الذي تعرضه؟" + }, "related-offers": { "en": "Related offers", "ar": "العروض ذات الصلة" @@ -3205,6 +3241,10 @@ "en": "Add Details", "ar": "أضف التفاصيل" }, + "item-info": { + "en": "Item Info", + "ar": "معلومات العنصر" + }, "review-sell": { "en": "Review & Sell", "ar": "مراجعة وبيع" @@ -3368,6 +3408,30 @@ "request-type": { "en": "Request type", "ar": "نوع الطلب" + }, + "request-generated": { + "en": "Your Request for resport has been sent to the server, click below link to check status", + "ar": "تم إرسال طلبك عن التقرير إلى الخادم، انقر فوق الرابط أدناه للتحقق من الحالة" + }, + "check-status": { + "en": "Refresh", + "ar": "ينعش" + }, + "phase": { + "en": "Phase", + "ar": "مرحلة" + }, + "program-name": { + "en": "Program Name", + "ar": "إسم البرنامج" + }, + "request-id": { + "en": "Request ID", + "ar": "طلب معرف" + }, + "output": { + "en": "Output", + "ar": "انتاج" } } } \ No newline at end of file diff --git a/Mohem/src/theme/styles.scss b/Mohem/src/theme/styles.scss index 73c0b0a2..b6e1b729 100644 --- a/Mohem/src/theme/styles.scss +++ b/Mohem/src/theme/styles.scss @@ -1626,3 +1626,8 @@ ion-segment-button { .top-filter svg { margin-top: 15px !important; } + +.disabledField{ + opacity: .5; + pointer-events: none; +} \ No newline at end of file