fixed basic details issue

MOHEMM-SFH-COLORS
umasoodch 4 years ago
parent 23eb5652e8
commit ded927bf6a

@ -113,7 +113,6 @@ export class AppComponent implements OnInit {
if (val instanceof NavigationEnd) {
const lastIndex = val.urlAfterRedirects.lastIndexOf('/');
const currentPageName = val.urlAfterRedirects.substr(lastIndex + 1);
console.log(currentPageName + ' umarrrrrrrr');
this.setScreenNameAnalytics(currentPageName);
}
});

@ -1090,6 +1090,9 @@ export class CommonService {
public openConfirmEitPage() {
this.nav.navigateForward(['/eit/confirm-add-eit']);
}
public openConfirmBasicDetailsPage() {
this.nav.navigateForward(['/profile/confirm-basic']);
}
public openHome() {
this.nav.navigateRoot(['/home']);
}

@ -9,9 +9,9 @@
<ion-content padding>
<ion-item class="country dynamicField" lines="none" *ngIf="targetValue === 'correct'">
<ion-item class="country dynamicField" lines="none" *ngIf="targetValue === 'correct' && showEffectiveDate">
<ion-label>Effective Date</ion-label>
<ion-label>17-Mar-2017</ion-label>
<ion-label>{{showEffectiveDate}}</ion-label>
</ion-item>
<div #containerDiv id="containerDiv">
<div #containerDivTwo id="containerDivTwo"></div>

@ -69,6 +69,8 @@ export class AddBasicDetailsComponent implements OnInit {
public targetValue: any;
public employeeBasicDetails: any = [];
public mutualBasicDetailsArray: any = [];
public effectiveDate: string;
public showEffectiveDate: string;
constructor(
@ -248,7 +250,7 @@ export class AddBasicDetailsComponent implements OnInit {
let varcharValue: any = null;
let numbervalue: any = 0;
let dateValue: any = null;
let transNo: number = this.comtransNo;
let transNo: number = 1;
let textValue : any;
for (let i = 0; i < this.eitColResponse.length; i++) {
@ -262,12 +264,15 @@ export class AddBasicDetailsComponent implements OnInit {
let elemVal = elem !== null ? (document.getElementById( this.eitColResponse[i].APPLICATION_COLUMN_NAME ) as HTMLInputElement).value : '';
textValue = elemVal;
if ((this.eitColResponse[i].DATATYPE == "VARCHAR2" || this.eitColResponse[i].DATATYPE == "NUMBER") && this.eitColResponse[i].ObjectValuesList === null) {
if (this.eitColResponse[i].DATATYPE == "VARCHAR2" || this.eitColResponse[i].DATATYPE == "NUMBER") {
elemVal = elemVal;
} else if (this.eitColResponse[i].DATATYPE == "DATE" && this.targetValue === 'new') {
// date
elemVal = this.cs.formatDate(elemVal);
}
} else if (this.eitColResponse[i].DATATYPE == "DATE" && this.targetValue === 'correct') {
// date
elemVal = this.customiseDate(this.effectiveDate);
}
if (this.targetValue === 'new') {
if (this.eitColResponse[i].REQUIRED_FLAG == "Y" && !elemVal) {
@ -278,7 +283,13 @@ export class AddBasicDetailsComponent implements OnInit {
}
}
varcharValue = elemVal;
if (this.eitColResponse[i].DATATYPE == "DATE") {
dateValue = elemVal;
} else if (this.eitColResponse[i].DATATYPE == "NUMBER") {
numbervalue = elemVal;
} else {
varcharValue = elemVal;
}
valuseArr.push({
TRANSACTION_NUMBER: transNo,
@ -326,7 +337,28 @@ export class AddBasicDetailsComponent implements OnInit {
}
}
if (val) varcharValue = val;
let staticValueBasicDetail = this.employeeBasicDetails.find(
x =>
x.APPLICATION_COLUMN_NAME ==
this.eitColResponse[i].APPLICATION_COLUMN_NAME
);
if (staticValueBasicDetail) {
if (this.eitColResponse[i].DATATYPE === 'VARCHAR2') {
varcharValue = staticValueBasicDetail.VARCHAR2_VALUE;
} else if (this.eitColResponse[i].DATATYPE === 'DATE') {
dateValue = staticValueBasicDetail.DATE_VALUE;
} else if (this.eitColResponse[i].DATATYPE === 'NUMBER') {
numbervalue = staticValueBasicDetail.NUMBER_VALUE;
} else {
varcharValue = val;
}
} else {
varcharValue = val;
}
valuseArr.push({
TRANSACTION_NUMBER: transNo,
NAME: this.eitColResponse[i].APPLICATION_COLUMN_NAME,
@ -1177,7 +1209,6 @@ export class AddBasicDetailsComponent implements OnInit {
let isSt: boolean = false;
if (obj.FORMAT_TYPE == "X") {
// standard date
// if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant
isSt = true;
// }
}
@ -1188,9 +1219,7 @@ export class AddBasicDetailsComponent implements OnInit {
let isSt: boolean = false;
if (obj.FORMAT_TYPE == "Y") {
// standard date time
//if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant
isSt = true;
//}
}
return isSt;
}
@ -1199,16 +1228,13 @@ export class AddBasicDetailsComponent implements OnInit {
let isSt: boolean = false;
if (obj.FORMAT_TYPE == "I") {
// standard time
//if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant
isSt = true;
//}
}
return isSt;
}
public customiseDate(date: any) {
let formatedDate = date.replace(/\//g, '/');
formatedDate = formatedDate.replace(/ 00:00:00/g, '');
let formatedDate = date.slice(0,9);
let newDate = formatedDate.split("/").reverse();
const tmp = newDate[2];
newDate[2] = newDate[1];
@ -1220,22 +1246,23 @@ export class AddBasicDetailsComponent implements OnInit {
public fillBasicDetailsStructure() {
console.log(this.eitResponse);
console.log(this.eitColResponse);
this.mutualBasicDetailsArray = this.mutualBasicDetailsArray.concat(this.eitResponse, this.eitColResponse);
console.log(this.mutualBasicDetailsArray);
for (let i = 0; i < this.employeeBasicDetails.length; i++) {
let val: any;
if (this.employeeBasicDetails[i].VARCHAR2_VALUE)
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);
this.employeeBasicDetails[i].DATE_VALUE
else if (this.employeeBasicDetails[i].NUMBER_VALUE)
} else if (this.employeeBasicDetails[i].DATE_VALUE) {
val = this.customiseDate(this.employeeBasicDetails[i].DATE_VALUE);
if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'EFFECTIVE_DATE') {
this.effectiveDate = this.employeeBasicDetails[i].DATE_VALUE;
this.showEffectiveDate = this.employeeBasicDetails[i].SEGMENT_VALUE_DSP;
}
} else if (this.employeeBasicDetails[i].NUMBER_VALUE) {
val = this.employeeBasicDetails[i].NUMBER_VALUE;
const elem = document.getElementById(
this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME
) as HTMLInputElement;
}
const elem = document.getElementById( this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME ) as HTMLInputElement;
if (elem) {
if (val) {
let feldDetails = this.mutualBasicDetailsArray.find(
@ -1339,7 +1366,7 @@ export class AddBasicDetailsComponent implements OnInit {
let varcharValue: any = null;
let numbervalue: any = 0;
let dateValue: any = null;
let transNo: number = this.comtransNo;
let transNo: number = 1;
let textValue : any;
// if(this.ExtraObj.transactionNo)
// transNo=this.ExtraObj.transactionNo;
@ -1459,7 +1486,28 @@ export class AddBasicDetailsComponent implements OnInit {
} else {
x.classList.remove("requiredClassElm");
}
if (val) varcharValue = val;
let staticValueBasicDetail = this.employeeBasicDetails.find(
x =>
x.APPLICATION_COLUMN_NAME ==
this.eitResponse[i].APPLICATION_COLUMN_NAME
);
if (staticValueBasicDetail) {
if (staticValueBasicDetail.DATATYPE === 'VARCHAR2') {
varcharValue = staticValueBasicDetail.VARCHAR2_VALUE;
} else if (staticValueBasicDetail.DATATYPE === 'DATE') {
dateValue = staticValueBasicDetail.DATE_VALUE;
} else if (staticValueBasicDetail.DATATYPE === 'NUMBER') {
numbervalue = staticValueBasicDetail.NUMBER_VALUE;
} else {
if (val) varcharValue = val;
}
} else {
if (val) varcharValue = val;
}
valuseArr.push({
TRANSACTION_NUMBER: transNo,
NAME: this.eitResponse[i].APPLICATION_COLUMN_NAME,
@ -1661,16 +1709,6 @@ export class AddBasicDetailsComponent implements OnInit {
return values;
}
submitEit() {
let list = this.basicRequest.EITTransactionTBL;
this.basicRequest.EITTransactionTBL = this.fixTransactionNo(list);
this.profileService
.submitEit(this.basicRequest)
.subscribe((result: AddEitResponse) => {
this.handleSubmitEitResult(result);
});
}
fixTransactionNo(transactionTBL: any): any[] {
let list: any = [];
let newIndex: number = 1;
@ -1700,36 +1738,20 @@ export class AddBasicDetailsComponent implements OnInit {
return list;
}
handleSubmitEitResult(result) {
public handleBasicdetailsResult(result) {
if (this.cs.validResponse(result)) {
this.cs.sharedService.setSharedData(
this.basicRequest,
BasicRequest.SHARED_DATA
);
this.cs.sharedService.setSharedData(result, AddEitResponse.SHARED_DATA);
//this.addrespList=result.SubmitEITTransactionList;
// this.itemKey=this.addrespList.P_ITEM_KEY;
// this.P_TransactionID=result.SubmitEITTransactionList.P_TRANSACTION_ID;
// this.sharedData.setSharedData(result,AddEitResponse.SHARED_DATA);
// // this.sharedData.setSharedData(result.SubmitEITTransactionList.P_TRANSACTION_ID,"TransactionIDResubmit");
// // this.sharedData.setSharedData(this.eitRequest,EitRequest.SHARED_DATA);
this.cs.sharedService.setSharedData(
{ isResubmit: false },
"confirmAddEITData"
);
this.cs.openConfirmEitPage();
// this.navCtrl.push("ConfirmAddEitPage", { isResubmit: false });
this.cs.sharedService.setSharedData(this.basicRequest, BasicRequest.SHARED_DATA);
this.cs.sharedService.setSharedData(result.SubmitBasicDetTransactionList, 'basic-details-response');
// this.cs.sharedService.setSharedData({ isResubmit: false },"confirmAddEITData");
this.cs.openConfirmBasicDetailsPage();
}
}
public submitBasicDetailsTransaction() {
// let EITTransactionValues:any= [];
this.arrValues = this.getElementsValues();
let staticValues = this.getElementsStaticValues();
let allStatisDynamicValues = this.arrValues.concat(staticValues);
if (allStatisDynamicValues) {
this.basicRequest = {
P_SELECTED_EMPLOYEE_NUMBER: this.selEmp,
@ -1737,44 +1759,15 @@ export class AddBasicDetailsComponent implements OnInit {
P_SELECTED_RESP_ID: this.respID,
P_FUNCTION_NAME: this.selMenu.GetMenuEntriesList.FUNCTION_NAME,
EITTransactionTBL: allStatisDynamicValues,
// P_EFFECTIVE_DATE: moment(this.effectiveDate).format('DD-MMM-YYYY'),
P_ACTION: this.targetValue === 'correct' ? 'CORRECT' : 'CHANGE'
P_ACTION_TYPE: this.targetValue === 'correct' ? 'CORRECT' : 'CHANGE'
};
console.log(this.basicRequest);
// this.eitService
// .validateEITTransaction(this.eitRequest)
// .subscribe((result: any) => {
// this.handleEITValidateTr(result);
// });
this.profileService.submitBasicDetailsTransaction(this.basicRequest).subscribe((result: any) => {
this.handleBasicdetailsResult(result);
});
}
}
// private handleEITValidateTr(result) {
// let data: any = { eitRequest: {}, updated: [] };
// if (this.cs.validResponse(result)) {
// // public static SHARED_DATA = 'login-request';
// this.cs.sharedService.setSharedData(
// this.eitRequest,
// EitRequest.SHARED_DATA
// );
// if (this.getPassdirfromNotifiPage) {
// let data: any = { eitRequest: {}, updated: [] };
// data.eitRequest = this.eitRequest;
// data.updated = this.updatedValues;
// // this.viewCtrl.dismiss(data);
// this.modalController.dismiss(data);
// // this.closemodal();
// } else {
// this.submitEit();
// // this.navCtrl.push("ConfirmAddEitPage");
// // data = { eitRequest: {}, updated: [] };
// // data.eitRequest = this.eitRequest;
// // data.updated = this.updatedValues;
// // this.viewCtrl.dismiss(data);
// }
// } else {
// this.updatedValues = [];
// data = { eitRequest: {}, updated: [] };
// }
// }
}

@ -1,3 +1,128 @@
<p>
confirm-basic-details works!
</p>
<ion-header>
<ion-toolbar class="header-toolbar-new">
<nav-buttons></nav-buttons>
<ion-title [ngClass]=" direction === 'en' ? 'title' : 'title-ar'" color="light">{{headerTitle}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<!-------------------------------Start New design ---------------------------------------->
<ion-grid>
<ion-row style="margin-top: 20px;margin-left: 12px;">
<ion-col>
<div size="10" [ngClass]=" direction === 'en' ? 'approvalTitle' : 'approvalTitle-ar'" >{{'general, addAttach' | translate}}</div>
</ion-col>
<ion-col style="padding-left: 7%;" size="2">
<div class="fileDiv">
<input end class="inputfile" style="margin-top: 10px;z-index: 99999;position: absolute;opacity: 0;" type="file" ng2FileSelect [uploader]="uploader"
(change)="onFileSelected($event)" (click)="onFileSelectedclick($event)" />
<label end for="file" class="attachLable">
<ion-icon style="font-size: 22px;" name="add"></ion-icon>
</label></div>
</ion-col>
</ion-row>
<ion-item class="attachmentDiv" *ngIf="attachListOver?.length == 0">
<ion-img style="height: 26px;width:100%;margin-top:12px" src="../assets/imgs/attach-icon.png"></ion-img>
<ion-label style="margin-top: -24px;" position="floating" class="boldTxtNav">{{ 'general, notAttch' | translate}}</ion-label>
</ion-item>
</ion-grid>
<ion-grid class="attachmentDiv" *ngIf="attachListOver?.length > 0">
<div *ngFor="let attachList of attachListOver ; let i = index">
<ion-row>
<ion-col size="1">
<ion-label style="color: black !important;">
{{attachList.AttachmentID +1 }} .
</ion-label>
</ion-col>
<ion-col style="text-align: left;" size="10">
<ion-label style="color: blue !important;" (click)="OpenAttachFiles(attachList.P_FILE_DATA,attachList.P_FILE_CONTENT_TYPE)">
{{attachList.P_FILE_NAME }}
</ion-label>
</ion-col>
<ion-col size="1">
<button float-end [disabled]="attachList.isSuccess" class="attachImgBtn removeLable"
(click)="removeFile(attachList)">
<ion-icon style="font-size:22px;margin-left:-7px;margin-top:-2px;" name="close"></ion-icon>
</button>
</ion-col>
</ion-row>
</div>
</ion-grid>
<ion-grid *ngIf="attachmentRes?.length > 0">
<div *ngFor="let attachRes of attachmentRes">
<ion-row>
<ion-col col-8>
<div> <img float-start class="attachImg" src="../assets/imgs/file.png">
</div>
<ion-label>
{{attachRes.FILE_NAME }} </ion-label>
</ion-col>
<ion-col col-4>
<button float-end class="attachImgBtn"
(click)="OpenAttachFiles(attachRes.FILE_DATA,attachRes.FILE_CONTENT_TYPE)">
<img class="attachImg" src="../assets/imgs/view.png">
</button>
<button float-end [disabled]="!isResubmitEIT" class="attachImgBtn" (click)="delelteFile(attachRes)"><img
class="attachImg" src="../assets/imgs/deletegray.png"></button>
</ion-col>
</ion-row>
</div>
</ion-grid>
<ion-grid class="">
<div [ngClass]=" direction === 'en' ? 'approvalTitle' : 'approvalTitle-ar'">{{'confirmAddEit, comment' | translate}}</div>
<ion-item class="submitNote" lines="none">
<ion-textarea type="text" [(ngModel)]="eitComments"></ion-textarea>
</ion-item>
</ion-grid>
<ion-grid class="approvalList">
<div [ngClass]=" direction === 'en' ? 'approvalTitle' : 'approvalTitle-ar'">{{'confirmAddEit, approverList' | translate}}</div>
<div class="noDataDiv" *ngIf="approversList?.length == 0">
<p>{{ 'general, empty' | translate}}</p>
</div>
<div style="background-color: white;border-radius: 32px;border: 1px solid #c8c4c4;" *ngIf="approversList?.length > 0">
<ion-list class="notification-list ">
<div class="timeline">
<ion-item style="padding-left: 4%;" *ngFor="let employee of approversList">
<div class="timeline-item" slot="start">
<div [class]="direction == 'en'? 'timeline-thumb-en timeline-icon': 'timeline-thumb-ar timeline-icon'">
<img *ngIf="employee.EMPLOYEE_IMAGE" class="empImge"
[src]="'data:image/png;base64,'+employee.EMPLOYEE_IMAGE">
<img *ngIf="employee.EMPLOYEE_IMAGE == null" class="empImge"
src="../assets/imgs/profile.png"> </div>
</div>
<ion-col>
<ion-label style="color:black !important ;font-weight: bold;padding-top: 0%;">
{{employee.APPROVER}}
</ion-label>
<ion-label style="color:black !important ;padding-top: 4%;">
{{employee.POSITION_TITLE}}
</ion-label>
</ion-col>
<div class="line"></div>
</ion-item>
</div>
</ion-list>
</div>
</ion-grid>
</ion-content>
<ion-footer>
<div class="centerDiv">
<ion-button class="confirmEitOkButton" color="customnavy" ion-button (click)="openSubmitModal()">
{{ (isDelete ? 'general, delete' : 'general, submit') | translate }}</ion-button>
</div>
</ion-footer>

@ -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;
}

@ -1,4 +1,20 @@
import { Component, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { FileUploader } from 'ng2-file-upload';
import { AddAttachComponent } from 'src/app/eit/add-attach/add-attach.component';
import { AddEitResponse } from 'src/app/eit/models/add.eit.response';
import { BasicRequest } from "../models/basic.request";
import { NotificationGetAttachResponse } from 'src/app/eit/models/NotificationGetAttachRes';
import { EitService } from 'src/app/eit/services/eit.service';
import { SubmitEitModalComponent } from 'src/app/eit/submit-eit-modal/submit-eit-modal.component';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { EITNotificatonBodyResponse } from 'src/app/notification/models/EITNotificationBodyRes';
import { WorkListButtonRequest } from 'src/app/notification/models/NotificationButtonReq';
import { WorkListAttachViewComponent } from 'src/app/notification/work-list-attach-view/work-list-attach-view.component';
import { ProfileService } from '../service/profile.service';
import { SubmitAddressModalComponent } from '../submit-eit-modal/submit-address-modal.component';
@Component({
selector: 'app-confirm-basic-details',
@ -7,8 +23,413 @@ import { Component, OnInit } from '@angular/core';
})
export class ConfirmBasicDetailsComponent implements OnInit {
constructor() { }
private P_TransactionID: number;
private basicRequest: BasicRequest;
approversList = [];
basicResponseList: any;
eitComments: string = "";
menuType: string = "";
selEmp: string = "";
respID: number;
selMenu: MenuResponse;
getAttachList: any;
attachListDisplay: any = [];
headerTitle: string = "";
isTrue: any = 0;
attachItems: any;
public isResubmitEIT: boolean = false;
private itemKey: string = "";
private pActionMode: string = "SUBMIT";
attachReqObj: WorkListButtonRequest = new WorkListButtonRequest();
attachmentRes: any;
objIndex1: any;
attachListOver: any = [];
index: any = 0;
getPassNotificationDetails: any;
isSubmitBtnClicked: boolean;
// isDelete: boolean = false;
ngOnInit() {}
/***Add Attchment Vars */
isUpload: boolean = false;
inQueue: boolean = false;
addAttachmentListReq: any;
attachmentID: number = 0;
addAttachRequest: any = [];
fileData: any;
fileType: any;
dirPage: any;
TransactionID: any;
indexLastObj: any = 0;
filterAllowedType: any = ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'];
direction: string;
constructor(public modalController: ModalController, public cs: CommonService, private ts: TranslatorService, private eitService: EitService, public profileService: ProfileService) {
this.direction = TranslatorService.getCurrentLanguageName()
this.isSubmitBtnClicked = false;
this.basicRequest = new BasicRequest();
}
ngOnInit() {
this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false);
this.selEmp = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_EMP, false);
this.respID = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_RESP_ID, false);
this.basicRequest = this.cs.sharedService.getSharedData(BasicRequest.SHARED_DATA, false);
this.selEmp = this.basicRequest.P_SELECTED_EMPLOYEE_NUMBER;
this.menuType = this.selMenu.List_Menu.MENU_TYPE;
this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT;
this.basicResponseList = this.cs.sharedService.getSharedData('basic-details-response', false);
console.log(this.basicResponseList);
this.itemKey = this.basicResponseList.P_ITEM_KEY;
this.P_TransactionID = this.basicResponseList.P_TRANSACTION_ID;
// this.isDelete = this.isResubmitEIT = this.cs.sharedService.getSharedData('confirmAddEITData', false).isDelete;
this.getApproversList();
}
getApproversList() {
let body: any = {
P_TRANSACTION_ID: this.P_TransactionID,
P_AME_TRANSACTION_TYPE: "SSHRMS",
P_PAGE_NUM: 1,
P_PAGE_LIMIT: 1000
}
this.eitService.getApproversList(body).subscribe((result: any) => {
this.handleApproversResult(result);
});
}
handleApproversResult(result) {
if (this.cs.validResponse(result)) {
this.approversList = result.GetApprovesList;
}
}
startEitApproval() {
if (this.attachListOver) {
let request = {
AddAttachmentList: this.attachListOver
}
this.eitService.addAttachment(
request).
subscribe((result: any) => {
this.handleAddAttachmentResults(result);
});
} else {
this.startBasicDetailsApprovalProcess();
}
}
handleAddAttachmentResults(result) {
if (this.cs.validResponse(result)) {
this.isTrue = 0;
for (let i = 0; i < result.AddAttSuccessList.length; i++) {
if (!result.AddAttSuccessList[i].AddSuccess) {
this.attachListOver[i].isSuccess = false;
//this.attachItems[i].isSuccess = false;
// if false display cancel button with waring icon or design
}// end if
else {
// if true remove cancel and set isSuccess = true
// this.attachItems[i].isSuccess = true;
this.attachListOver[i].isSuccess = true;
this.isTrue = this.isTrue + 1; //count flag of attach status
} // end else
} // end for
if (this.isTrue == result.AddAttSuccessList.length) {
this.startBasicDetailsApprovalProcess();
}
else {
//stope
let filtered = this.attachListOver.filter(function (el) { return el.isSuccess == true; });
this.attachListOver = filtered;
let msg: string = "";
msg = this.ts.trPK("eit", "attach-errorMsg");
this.cs.presentAlert(msg);
}
}
}
startBasicDetailsApprovalProcess() {
let request: any = {};
request.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp;
request.P_MENU_TYPE = this.menuType;
request.P_SELECTED_RESP_ID = this.respID;
request.P_TRANSACTION_ID = this.P_TransactionID;
request.P_ITEM_KEY = this.itemKey;
request.P_ACTION_MODE = this.pActionMode;
request.P_COMMENTS = this.eitComments;
this.profileService.startBasicDetailsApprovalProcess(
request).
subscribe((result: any) => {
this.handleResults(result);
});
}
cancelEitProcess() {
let body: any = {
P_TRANSACTION_ID: this.P_TransactionID
}
this.eitService.cancelHRTransaction(
body).
subscribe((result: any) => {
this.handleCancelResults(result);
});
}
handleCancelResults(result) {
if (this.cs.validResponse(result)) {
this.isSubmitBtnClicked = false;
}
}
handleResults(result) {
if (this.cs.validResponse(result)) {
this.isSubmitBtnClicked = true;
let msg: string = this.ts.trPK("eit", "approval-message-success");
this.cs.presentAlert(msg);
this.cs.openNotificationPage();
}
}
async addAttachment(str: boolean, attachItems: any) {
//open the modal with return data
let attachDocID = attachItems.ATTACHED_DOCUMENT_ID;
this.cs.sharedService.setSharedData(this.P_TransactionID, 'TransactionID');
this.cs.sharedService.setSharedData(this.attachListOver.length, 'indexLastObj');
const modal = await this.modalController.create({
component: AddAttachComponent
});
modal.onDidDismiss()
.then((data) => {
if (data == "cancel" || data == "undefined") {
return;
} else {
if (!str) {
this.updateFile(data, attachDocID);
} else {
console.log(data);
this.attachListDisplay = data.data;
this.attachItems = this.attachListDisplay.map(function (el) {
var o = Object.assign({}, el);
o.isSuccess = false;
return o;
});
this.attachListOver = this.attachListOver ? this.attachListOver.concat(this.attachItems) : this.attachItems;
}
}
});
return await modal.present();
}
/*****submit modal********/
async openSubmitModal() {
this.cs.sharedService.setSharedData(this.attachListOver, 'submitAttachmentList');
this.cs.sharedService.setSharedData(this.eitComments, 'eitComments');
const modal = await this.modalController.create({
component: SubmitAddressModalComponent,
backdropDismiss: false,
});
modal.cssClass = 'note-modal';
modal.onDidDismiss()
.then((data) => {
console.log(data.data);
if (data.data == "cancel" || data.data == undefined) {
return;
} else {
this.startEitApproval();
}
});
return await modal.present();
}
removeFile(objectitem) {
if (this.attachListOver) {
let index2 = this.attachListOver.findIndex(item => item == objectitem);
if (index2 > -1) {
this.attachListOver.splice(index2, 1);
}
}
if (this.attachmentRes) {
let index3 = this.attachmentRes.findIndex(item => item == objectitem);
if (index3 > -1) {
this.attachmentRes.splice(index3, 1);
}
}
}
getAttachment(NotificationID) {
this.attachReqObj.P_NOTIFICATION_ID = NotificationID;
this.eitService.getAttach(this.attachReqObj).
subscribe((result: NotificationGetAttachResponse) => {
this.handleWorkListAttachResult(result);
});
}
handleWorkListAttachResult(result) {
if (this.cs.validResponse(result)) {
if (result.GetAttachementList != null) {
this.attachmentRes = result.GetAttachementList;
} // if result == null
} // valid it
}
async OpenAttachFiles(value, Type) {
this.cs.sharedService.setSharedData({ displayData: value, TypeData: Type }, 'WorkListAttachViewPage');
const modal = await this.modalController.create({
component: WorkListAttachViewComponent
});
modal.onDidDismiss()
.then((data) => {
});
return await modal.present();
}
delelteFile(attach) {
this.cs.confirmAlertDialog((data) => {
if (data == true) {
this.continueDelete(attach);
}
}, this.ts.trPK('general', 'ok'), () => {
}, this.ts.trPK('general', 'cancel'), this.ts.trPK('general', 'alert'), this.ts.trPK('eit', 'delete-perm'));
}
continueDelete(attach) {
let req = {
P_ATTACHED_DOCUMENT_ID: attach.ATTACHED_DOCUMENT_ID
}
this.eitService.deleteAttach(req).
subscribe((result: any) => {
if (this.cs.validResponse(result)) {
if (result.DeleteAttachmentList.P_RETURN_STATUS === "S") {
this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID);
let msg: string = "";
msg = this.ts.trPK("eit", "deleteAttach");
this.cs.presentAlert(msg);
}
}
});
}
updateFile(attachList, attachDocID) {
let req = {
P_ATTACHED_DOCUMENT_ID: attachDocID,
P_FILE_DATA: attachList[0].P_FILE_DATA,
P_FILE_NAME: attachList[0].P_FILE_NAME,
P_FILE_CONTENT_TYPE: attachList[0].P_FILE_CONTENT_TYPE
}
this.eitService.updateAttach(req).
subscribe((result: any) => {
if (this.cs.validResponse(result)) {
if (result.MessageStatus == 1) {
let msg: string = "";
msg = this.ts.trPK("eit", "attachUpdate");
this.cs.presentAlert(msg);
this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID);
}
}
});
}
ionViewWillLeave() {
if (this.P_TransactionID && this.isSubmitBtnClicked == false)
this.cancelEitProcess();
}
/*******************Add attchement Functions*************/
public uploader: FileUploader = new FileUploader({
allowedMimeType: ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
maxFileSize: 10 * 1024 * 1024,
formatDataFunctionIsAsync: true,
formatDataFunction: async (item) => {
return new Promise((resolve, reject) => {
resolve({
name: item._file.name,
length: item._file.size,
contentType: item._file.type,
date: new Date()
});
});
}
});
onFileSelectedclick(event) {
event.target.value = '';
}
onFileSelected(input) {
if (!(this.filterAllowedType.indexOf(input.target.files[0].type) > -1)) {
let msg: string = "";
msg = this.ts.trPK("general", "notSupport");
this.cs.presentAlert(msg);
return
} // todo: show alert that you tried uploading wrong files
else {
const file = input.target.files[0];
this.getBase64(file).then(
data => this.pushObject(data, file.name, file.type)
);
}
}
getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});
}
pushObject(fileData, name, type) {
console.log("before push: " + this.index);
try {
let array = name.split('.');
let attachType: string = array[array.length - 1];
this.attachListOver.push(
{
AttachmentID: this.attachListOver.length,
P_FILE_CONTENT_TYPE: attachType,//type.split('/')[1],
P_FILE_DATA: fileData.split(',')[1],
P_FILE_NAME: name,//.split('.')[0],
P_TRANSACTION_ID: this.P_TransactionID
})
} catch (e) {
}
}
}

@ -8,5 +8,5 @@ export class BasicRequest {
public P_SELECTED_RESP_ID: Number;
// P_DESC_FLEX_CONTEXT_CODE: string;
EITTransactionTBL: EitTransactionModel[];
P_ACTION: string;
P_ACTION_TYPE: string;
}

@ -19,6 +19,7 @@ export class ProfileService {
public static submitEit = 'Services/ERP.svc/REST/SUBMIT_EIT_TRANSACTION';
public static resubmitEit = 'Services/ERP.svc/REST/RESUBMIT_EIT_TRANSACTION';
public static startEitProcess = 'Services/ERP.svc/REST/START_ADDRESS_APPROVAL_PROCESS';
public static startBasicProcess = 'Services/ERP.svc/REST/START_BASIC_DET_APPR_PROCESS';
public static updateAttach = 'Services/ERP.svc/REST/UPDATE_ATTACHMENT';
public static deleteAttach = 'Services/ERP.svc/REST/DELETE_ATTACHMENT';
public static getApproversList = 'Services/ERP.svc/REST/GET_APPROVERS_LIST';
@ -28,8 +29,9 @@ export class ProfileService {
public static getEmployeeAddress = "Services/ERP.svc/REST/GET_EMPLOYEE_ADDRESS";
public static getCountries = "Services/ERP.svc/REST/GET_COUNTRIES";
public static getDiffStructure = "Services/ERP.svc/REST/GET_ADDRESS_DFF_STRUCTURE"
public static submitAddressTransactions = "Services/ERP.svc/REST/SUBMIT_ADDRESS_TRANSACTION"
public static getDiffStructure = "Services/ERP.svc/REST/GET_ADDRESS_DFF_STRUCTURE";
public static submitAddressTransactions = "Services/ERP.svc/REST/SUBMIT_ADDRESS_TRANSACTION";
public static submitBasicDetailsTransaction = "Services/ERP.svc/REST/SUBMIT_BASIC_DET_TRANSACTION";
public static ADRESS_ENTRIES = 'address-entries';
public static EMP_ADDRESS = 'emp-address';
@ -110,9 +112,19 @@ export class ProfileService {
this.authService.authenticateRequest(request);
return this.con.post(ProfileService.submitAddressTransactions, request, onError, errorLabel);
}
public submitBasicDetailsTransaction(basicDetailsRequest: any, onError?: any, errorLabel?: string): Observable<any> {
const request = basicDetailsRequest;
this.authService.authenticateRequest(request);
return this.con.post(ProfileService.submitBasicDetailsTransaction, request, onError, errorLabel);
}
public startEitApprovalProcess(eitProcess: any, onError?: any, errorLabel?: string): Observable<any> {
const request = eitProcess;
this.authService.authenticateRequest(request);
return this.con.post(ProfileService.startEitProcess, request, onError, errorLabel);
}
public startBasicDetailsApprovalProcess(basicDetailsProcess: any, onError?: any, errorLabel?: string): Observable<any> {
const request = basicDetailsProcess;
this.authService.authenticateRequest(request);
return this.con.post(ProfileService.startBasicProcess, request, onError, errorLabel);
}
}
Loading…
Cancel
Save