concorrent report changes

MOHEMM-Q3-DEV-LATEST
Sultan Khan 3 years ago
parent c7de4250fe
commit df7c53059e

@ -357,7 +357,8 @@ export class AppComponent implements OnInit {
}
oepnMyRequest(menu) {
this.cs.sharedService.setSharedData(menu, MenuResponse.SELECTED_MENU);
this.cs.openConcurrentReport();
// this.cs.openConcurrentReport();
this.cs.openConcurrentTransactionsHome();
this.menu.toggle();
}
oepnTransaction() {

@ -145,7 +145,7 @@ export class AuthenticationService {
} else {
mobileType = 'android';
}
request.VersionID = 3.5;
request.VersionID = 3.6;
request.Channel = 31;
request.LanguageID = TranslatorService.getCurrentLanguageCode();
request.MobileType = mobileType;
@ -495,7 +495,7 @@ export class AuthenticationService {
return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel);
}
public checkSMS(request: SMSCheckRequest, onError: any, errorLabel: string, fromSMS = false )
public checkSMS(request: SMSCheckRequest, onError: any, errorLabel: string, fromSMS = false)
: Observable<SMSCheckResponse> {
this.setPublicFields(request);
return this.con.post(AuthenticationService.smsCheck, request, onError, errorLabel, fromSMS);

@ -1358,6 +1358,10 @@ export class CommonService {
this.nav.navigateForward(['/reports/transaction-list']);
}
public openConcurrentTransactionsHome() {
this.nav.navigateForward(['/reports/transactions']);
}
public openTermination() {
this.nav.navigateForward(['/termination/termination-form']);

@ -301,15 +301,6 @@ export class HomeComponent implements OnInit {
return { AttachmentID: this.indexLastObj, FileName: res.name, Base64Data: res.data.split(",")[1], ContentType: 'image/' + attachType };
});
} catch (e) { }
}
}

@ -49,7 +49,7 @@ export class AddBasicDetailsComponent implements OnInit {
private hiddenInput: HiddenInput;
private eitResponse: any;
private eitColResponse: any;
private eitVALSettoCall: any = [];
private comtransNo: number = 0;
getPassMnuEntryObj: MenuEntry;
@ -65,7 +65,7 @@ export class AddBasicDetailsComponent implements OnInit {
isResubmit: boolean = false;
private updatedValues: any = [];
addEITData: any;
direction:string;
direction: string;
public targetValue: any;
public employeeBasicDetails: any = [];
public mutualBasicDetailsArray: any = [];
@ -135,7 +135,7 @@ export class AddBasicDetailsComponent implements OnInit {
}
}
ngOnInit() {}
ngOnInit() { }
ngAfterViewInit() {
this.getEitDffStructure();
@ -171,7 +171,7 @@ export class AddBasicDetailsComponent implements OnInit {
this.drawEitFieldsStatic(result.GetBasicDetColsStructureList);
}
}
public handleBasicDffStructureResult(result) {
if (result.GetBasicDetDffStructureList != null) {
this.getColumnStructure();
@ -188,59 +188,59 @@ export class AddBasicDetailsComponent implements OnInit {
let defaultValText: string = "";
if (feildsList[i].DISPLAY_FLAG != "N") {
//text , date , time
if (feildsList[i].DATATYPE == "VARCHAR2" && feildsList[i].ObjectValuesList === null) {
// character
this.textInput = new TextInput(
feildsList[i].SEGMENT_PROMPT,
feildsList[i].APPLICATION_COLUMN_NAME,
defaultVal,
containerId,
defaultValText,
feildsList[i].MOBILE_ENABLED,
feildsList[i].DISPLAY_FLAG,
feildsList[i].REQUIRED_FLAG
);
} else if (feildsList[i].DATATYPE == "VARCHAR2" && feildsList[i].ObjectValuesList !== null) {
this.selectInput = new SelectInput(
feildsList[i].SEGMENT_PROMPT,
feildsList[i].APPLICATION_COLUMN_NAME,
defaultVal,
containerId,
feildsList[i].MOBILE_ENABLED,
feildsList[i].DISPLAY_FLAG,
feildsList[i].REQUIRED_FLAG
);
this.fillStaticDropdownList(
feildsList[i].SEGMENT_NAME,
feildsList[i].ObjectValuesList,
feildsList[i].APPLICATION_COLUMN_NAME
);
} else if (feildsList[i].DATATYPE == "NUMBER") {
this.numberInput = new NumberInput(
feildsList[i].SEGMENT_PROMPT,
feildsList[i].APPLICATION_COLUMN_NAME,
defaultVal,
containerId,
feildsList[i].MOBILE_ENABLED,
feildsList[i].DISPLAY_FLAG,
feildsList[i].REQUIRED_FLAG
);
} else if (feildsList[i].DATATYPE == "DATE" && this.targetValue === 'new') {
this.dateInput = new DateInput(
feildsList[i].SEGMENT_PROMPT,
feildsList[i].APPLICATION_COLUMN_NAME,
"",
containerId,
feildsList[i].MOBILE_ENABLED,
feildsList[i].DISPLAY_FLAG,
feildsList[i].REQUIRED_FLAG,
this.direction
);
//text , date , time
if (feildsList[i].DATATYPE == "VARCHAR2" && feildsList[i].ObjectValuesList === null) {
// character
this.textInput = new TextInput(
feildsList[i].SEGMENT_PROMPT,
feildsList[i].APPLICATION_COLUMN_NAME,
defaultVal,
containerId,
defaultValText,
feildsList[i].MOBILE_ENABLED,
feildsList[i].DISPLAY_FLAG,
feildsList[i].REQUIRED_FLAG
);
} else if (feildsList[i].DATATYPE == "VARCHAR2" && feildsList[i].ObjectValuesList !== null) {
this.selectInput = new SelectInput(
feildsList[i].SEGMENT_PROMPT,
feildsList[i].APPLICATION_COLUMN_NAME,
defaultVal,
containerId,
feildsList[i].MOBILE_ENABLED,
feildsList[i].DISPLAY_FLAG,
feildsList[i].REQUIRED_FLAG
);
this.fillStaticDropdownList(
feildsList[i].SEGMENT_NAME,
feildsList[i].ObjectValuesList,
feildsList[i].APPLICATION_COLUMN_NAME
);
} else if (feildsList[i].DATATYPE == "NUMBER") {
this.numberInput = new NumberInput(
feildsList[i].SEGMENT_PROMPT,
feildsList[i].APPLICATION_COLUMN_NAME,
defaultVal,
containerId,
feildsList[i].MOBILE_ENABLED,
feildsList[i].DISPLAY_FLAG,
feildsList[i].REQUIRED_FLAG
);
} else if (feildsList[i].DATATYPE == "DATE" && this.targetValue === 'new') {
this.dateInput = new DateInput(
feildsList[i].SEGMENT_PROMPT,
feildsList[i].APPLICATION_COLUMN_NAME,
"",
containerId,
feildsList[i].MOBILE_ENABLED,
feildsList[i].DISPLAY_FLAG,
feildsList[i].REQUIRED_FLAG,
this.direction
);
}
}
}
}
this.fillBasicDetailsStructure();
}
@ -251,7 +251,7 @@ export class AddBasicDetailsComponent implements OnInit {
let numbervalue: any = 0;
let dateValue: any = null;
let transNo: number = 1;
let textValue : any;
let textValue: any;
for (let i = 0; i < this.eitColResponse.length; i++) {
varcharValue = null;
@ -260,10 +260,10 @@ export class AddBasicDetailsComponent implements OnInit {
if (this.eitColResponse[i].DISPLAY_FLAG != "N") {
if (this.eitColResponse[i].ObjectValuesList === null) {
let elem = document.getElementById( this.eitColResponse[i].APPLICATION_COLUMN_NAME) as HTMLInputElement;
let elemVal = elem !== null ? (document.getElementById( this.eitColResponse[i].APPLICATION_COLUMN_NAME ) as HTMLInputElement).value : '';
let elem = document.getElementById(this.eitColResponse[i].APPLICATION_COLUMN_NAME) as HTMLInputElement;
let elemVal = elem !== null ? (document.getElementById(this.eitColResponse[i].APPLICATION_COLUMN_NAME) as HTMLInputElement).value : '';
textValue = elemVal;
if (this.eitColResponse[i].DATATYPE == "VARCHAR2" || this.eitColResponse[i].DATATYPE == "NUMBER") {
elemVal = elemVal;
} else if (this.eitColResponse[i].DATATYPE == "DATE" && this.targetValue === 'new') {
@ -272,7 +272,7 @@ export class AddBasicDetailsComponent implements OnInit {
} 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) {
@ -301,11 +301,11 @@ export class AddBasicDetailsComponent implements OnInit {
} else {
let x = document.getElementById(this.eitColResponse[i].APPLICATION_COLUMN_NAME) as HTMLSelectElement;
let val = x.options[x.selectedIndex] ? x.options[x.selectedIndex].value : null;
let txt = x.options[x.selectedIndex] ? x.options[x.selectedIndex].text : null;
varcharValue = val;
textValue = txt;
let val = x.options[x.selectedIndex] ? x.options[x.selectedIndex].value : null;
let txt = x.options[x.selectedIndex] ? x.options[x.selectedIndex].text : null;
varcharValue = val;
textValue = txt;
if (x !== null) {
if (this.eitColResponse[i].REQUIRED_FLAG == "Y" && !varcharValue) {
x.classList.add("requiredClassElm");
@ -323,7 +323,7 @@ export class AddBasicDetailsComponent implements OnInit {
DATE_VALUE: dateValue
});
}
} else {
} else {
let x = document.getElementById(this.eitColResponse[i].APPLICATION_COLUMN_NAME) as HTMLSelectElement;
let val = x !== null ? x.dataset.colmText : '';
textValue = x !== null ? x.value : '';
@ -815,8 +815,8 @@ export class AddBasicDetailsComponent implements OnInit {
let obj = this.handleDefaultValueResult(result);
let val = obj.value;
let text = obj.text;
if (val==null){val="";}
if (text==null){text="";}
if (val == null) { val = ""; }
if (text == null) { text = ""; }
if (isStandardDate) {
console.log("isStandardDate");
elem.value = this.cs.reverseFormatDate(val);
@ -834,7 +834,7 @@ export class AddBasicDetailsComponent implements OnInit {
if (val) {
elem.dataset.dtvalue = val;
elem.innerHTML = val;
elem.value=val;
elem.value = val;
} else {
elem.dataset.dtvalue = "";
elem.innerHTML = "";
@ -843,11 +843,11 @@ export class AddBasicDetailsComponent implements OnInit {
if (isSelectElement) {
let elem = this.getSelectElementByName(segmentName);
elem = document.getElementById(elem),
elem.value = val;
elem.value = val;
} else {
elem.value = val;
elem.innerText = text;
elem.setAttribute("value", val);
elem.value = val;
elem.innerText = text;
elem.setAttribute("value", val);
}
}
if (isHidden || isReadOnlyList) {
@ -1234,7 +1234,7 @@ export class AddBasicDetailsComponent implements OnInit {
}
public customiseDate(date: any) {
let formatedDate = date.slice(0,9);
let formatedDate = date.slice(0, 9);
let newDate = formatedDate.split("/").reverse();
const tmp = newDate[2];
newDate[2] = newDate[1];
@ -1248,7 +1248,7 @@ export class AddBasicDetailsComponent implements OnInit {
public fillBasicDetailsStructure() {
this.mutualBasicDetailsArray = this.mutualBasicDetailsArray.concat(this.eitResponse, this.eitColResponse);
for (let i = 0; i < this.employeeBasicDetails.length; i++) {
let val: any;
if (this.employeeBasicDetails[i].VARCHAR2_VALUE) {
@ -1256,13 +1256,13 @@ export class AddBasicDetailsComponent implements OnInit {
} 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.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(
@ -1367,7 +1367,7 @@ export class AddBasicDetailsComponent implements OnInit {
let numbervalue: any = 0;
let dateValue: any = null;
let transNo: number = 1;
let textValue : any;
let textValue: any;
// if(this.ExtraObj.transactionNo)
// transNo=this.ExtraObj.transactionNo;
for (let i = 0; i < this.eitResponse.length; i++) {
@ -1413,11 +1413,11 @@ export class AddBasicDetailsComponent implements OnInit {
this.eitResponse[i].DISPLAY_FLAG != "N"
) {
//time
if(elemVal.length>5){
elemVal = elemVal.substring(11, 16);
}else{
elemVal = elemVal;
}
if (elemVal.length > 5) {
elemVal = elemVal.substring(11, 16);
} else {
elemVal = elemVal;
}
}
if (this.eitResponse[i].REQUIRED_FLAG == "Y" && !elemVal) {
elem.classList.add("requiredClassElm");
@ -1426,11 +1426,11 @@ export class AddBasicDetailsComponent implements OnInit {
} else {
elem.classList.remove("requiredClassElm");
}
// if (elemVal != 'null'){
varcharValue = elemVal;
// if (elemVal != 'null'){
varcharValue = elemVal;
//} else{
// elemVal = null;
// }
// elemVal = null;
// }
valuseArr.push({
TRANSACTION_NUMBER: transNo,
NAME: this.eitResponse[i].APPLICATION_COLUMN_NAME,
@ -1759,15 +1759,15 @@ export class AddBasicDetailsComponent implements OnInit {
P_SELECTED_RESP_ID: this.respID,
P_FUNCTION_NAME: this.selMenu.GetMenuEntriesList.FUNCTION_NAME,
EITTransactionTBL: allStatisDynamicValues,
P_ACTION_TYPE: this.targetValue === 'correct' ? 'CORRECT' : 'CHANGE'
P_ACTION_TYPE: this.targetValue === 'correct' ? 'CORRECT' : 'CHANGE'
};
console.log(this.basicRequest);
this.profileService.submitBasicDetailsTransaction(this.basicRequest).subscribe((result: any) => {
this.handleBasicdetailsResult(result);
this.handleBasicdetailsResult(result);
});
}
}
}

@ -10,6 +10,7 @@ import { ConcurrentReportComponent } from './concurrent-report/concurrent-report
import { ReportServiceService } from './report-service.service';
import { HmgCommonModule } from '../hmg-common/hmg-common.module';
import { TransactionListComponent } from './transaction-list/transaction-list.component';
import { TransactionsComponent } from './transactions/transactions.component';
const routes: Routes = [
@ -25,6 +26,10 @@ const routes: Routes = [
path: 'transaction-list',
component: TransactionListComponent
},
{
path: 'transactions',
component: TransactionsComponent
},
],
}
];
@ -37,7 +42,7 @@ const routes: Routes = [
RouterModule.forChild(routes),
HmgCommonModule
],
declarations: [ReportsPage, ConcurrentReportComponent, TransactionListComponent],
declarations: [ReportsPage, ConcurrentReportComponent, TransactionListComponent, TransactionsComponent],
providers: [ReportServiceService]
})
export class ReportsPageModule { }

@ -0,0 +1,69 @@
<ion-content>
<div class="head-title">
<app-generic-header showImage="false" showBack="true" [headerText]="'general,concurrent-report' | translate">
</app-generic-header>
</div>
<div class="header"></div>
<div class="bottom"></div>
<div class="main-container">
<ion-item>
<ion-label>{{ 'worklist,template-name' | translate}}</ion-label>
<ion-select [(ngModel)]="template" (ionChange)="selectTemplates()" [placeholder]="'general,select' | translate"
[okText]="'general,ok' | translate" [cancelText]="'general,cancel' | translate" class="concorrent-select large-ion-select">
<ion-select-option *ngFor="let program of programList" [value]="program">
{{ program.USER_CONCURRENT_PROGRAM_NAME}}</ion-select-option></ion-select>
</ion-item>
<div *ngIf="transactionList && transactionList.length>0" class="transaction-list">
<ion-card *ngFor="let transaction of transactionList">
<div [ngClass]="direction =='rtl' ? 'date_ar' :'date'" >{{getDate(transaction.REQUEST_DATE)}}</div>
<ion-label class="ion-text-wrap">
<ion-text color="primary">
<div>
<p class="display-created" >{{'transaction, request-id' | translate}}</p>
<P class="inline-display">
{{transaction.REQUEST_ID}}
</P>
</div>
<p class="display-created" >{{'transaction, phase' | translate}}</p>
<p class="display-created bold padding">{{transaction.CCP_PHASE}}</p>
</ion-text>
<ion-text color="secondary">
<div class="name-container">
<p class="color-black display-inline">{{'transaction,program-name' | translate}}</p>
<p class="display-inline red">{{transaction.CONCURRENT_PROGRAM_NAME}}</p>
</div>
</ion-text>
<div class="output-container" >
<p class="color-black display-inline">{{'transaction,output' | translate}}</p>
<p class="display-inline" (click)="getCppOutput(transaction)" [ngClass]="transaction.CCP_PHASE =='Running' || transaction.CCP_PHASE =='Pending'? 'disabled-icon' : '' " ><ion-icon name="download" class="download"></ion-icon></p>
<p class="display-inline" (click)="refresh(transaction)" *ngIf="transaction.CCP_PHASE =='Running' || transaction.CCP_PHASE =='Pending'"><ion-icon name="refresh" class="refresh" > </ion-icon></p>
</div>
</ion-label>
</ion-card>
</div>
<div class="no-dataDiv"
*ngIf="transactionList && transactionList.length ==0">
<ion-row>
<img class="empty-data" src="../assets/imgs/box.png" />
</ion-row>
<h4> {{'general, noData' | translate}}</h4>
</div>
</div>
</ion-content>
<ion-footer class="footer">
<div class="Btn">
<ion-button class="CreateBtn" color="customnavy" ion-button (click)="createTransaction()">
{{'vacation-rule, create-request' | translate}}</ion-button>
</div>
</ion-footer>

@ -0,0 +1,213 @@
.display-created {
display: inline-block;
margin: 2px;
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;
}
.date_ar {
position: absolute;
font-size: 14px;
padding: 10px;
left: 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;
}
@media screen and (min-width: 300px) {
.CreateBtn {
--background: var(--newgreen) !important;
background: var(--newgreen) !important;
white-space: normal;
color: var(--light);
text-transform: capitalize;
min-height: 1.0cm;
--border-radius: 7px !important;
border-radius: 7px !important;
--min-height: 1.6cm !important;
width: 315px;
font-family: var(--fontFamilyPoppins-SemiBold, inherit);
}
}
@media screen and (min-width: 1px) and (max-width:290px) {
.CreateBtn {
--background: var(--newgreen) !important;
background: var(--newgreen) !important;
white-space: normal;
color: var(--light);
text-transform: capitalize;
min-height: 1.0cm;
--border-radius: 7px !important;
border-radius: 7px !important;
--min-height: 1.6cm !important;
width: 257px;
font-family: var(--fontFamilyPoppins-SemiBold, inherit);
}
}
.footer {
padding: 15px 0px;
background-color: var(--light) !important;
border: 0px !important;
box-shadow: none !important;
-webkit-box-shadow: none;
}
.Btn {
margin: auto;
text-align: center;
display: block;
}

@ -0,0 +1,27 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TransactionsComponent } from './transactions.component';
describe('TransactionsComponent', () => {
let component: TransactionsComponent;
let fixture: ComponentFixture<TransactionsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TransactionsComponent ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TransactionsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,126 @@
import { Component, ElementRef, OnInit } from '@angular/core';
import { FileOpener } from '@ionic-native/file-opener/ngx';
import { File } from '@ionic-native/file/ngx';
import { Platform } from '@ionic/angular';
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-transactions',
templateUrl: './transactions.component.html',
styleUrls: ['./transactions.component.scss'],
})
export class TransactionsComponent implements OnInit {
transactionList: any = [];
selectedMenu: any;
template: any;
direction: any;
programList: any = [];
constructor(public cs: CommonService, private elementRef: ElementRef, public reports: ReportServiceService, public ts: TranslatorService, private platform: Platform, private file: File, private opener: FileOpener,
) { }
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);
this.direction = TranslatorService.getCurrentDirection();
this.getConcurrentProgram();
}
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) => {
this.saveAndOpenPdf(result.GetCcpOutputList['P_OUTPUT_FILE'], 'report.pdf');
console.log(result);
this.cs.stopLoading();
});
}
// saveAndOpenPdf(pdf: string, filename: string) {
// const linkSource = `data:application/pdf;base64,${pdf}`;
// const downloadLink = document.createElement("a");
// const fileName = "report.pdf";
// downloadLink.href = linkSource;
// downloadLink.download = fileName;
// downloadLink.click();
// }
saveAndOpenPdf(pdf: string, filename: string) {
const writeDirectory = this.platform.is('ios') ? this.file.dataDirectory : this.file.externalDataDirectory;
this.file.writeFile(writeDirectory, filename, this.convertBase64ToBlob(pdf, 'data:application/pdf;base64'), { replace: true })
.then(() => {
this.opener.open(writeDirectory + filename, 'application/pdf')
.catch(() => {
console.log('Error opening pdf file');
});
})
.catch(() => {
console.error('Error writing pdf file');
});
}
convertBase64ToBlob(b64Data, contentType): Blob {
contentType = contentType || '';
const sliceSize = 512;
b64Data = b64Data.replace(/^[^,]+,/, '');
b64Data = b64Data.replace(/\s/g, '');
const byteCharacters = window.atob(b64Data);
const byteArrays = [];
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
const slice = byteCharacters.slice(offset, offset + sliceSize);
const byteNumbers = new Array(slice.length);
for (let i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
const byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
return new Blob(byteArrays, { type: contentType });
}
refresh() {
// 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'];
});
}
getConcurrentProgram() {
this.cs.startLoading();
this.reports.getConcurrentProgram({
P_REQUEST_GROUP_ID: this.selectedMenu.REQUEST_GROUP_ID
}, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => {
this.cs.stopLoading();
this.programList = response.GetConcurrentProgramsList;
})
}
selectTemplates() {
// this.elementRef
// .nativeElement.querySelectorAll('#containerDiv')[0].innerHTML = '';
this.refresh();
}
createTransaction() {
this.cs.openConcurrentReport();
}
}
Loading…
Cancel
Save