Merge branch 'MOHEMM-Q3-DEV-LATEST' into enad-pre-live

enad-pre-live
umasoodch 4 years ago
commit 0811ae3f22

@ -35,6 +35,7 @@
"@ionic-native/device": "^5.18.0",
"@ionic-native/diagnostic": "^5.18.0",
"@ionic-native/file": "^5.18.0",
"@ionic-native/file-opener": "^5.36.0",
"@ionic-native/file-path": "^5.18.0",
"@ionic-native/fingerprint-aio": "^5.18.0",
"@ionic-native/firebase-x": "^5.34.0",
@ -81,6 +82,7 @@
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-dialogs": "^2.0.2",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-file-opener2": "^3.0.5",
"cordova-plugin-filepath": "^1.5.6",
"cordova-plugin-fingerprint-aio": "^3.0.0",
"cordova-plugin-firebasex": "^13.0.0",
@ -236,6 +238,9 @@
},
"cordova-plugin-sms-retriever-manager": {
"PLAY_SERVICES_VERSION": "15.0.1"
},
"cordova-plugin-file-opener2": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
}
},
"platforms": [
@ -243,4 +248,4 @@
"ios"
]
}
}
}

@ -35,7 +35,14 @@
{{ts.trPK('userProfile','title')}}
</ion-label>
</ion-item>
<ion-item (click)="performanceEvaluation()">
<ion-thumbnail slot="start" class="menu-thumb">
<img style= "height: 24px !important;" src="../assets/icon/bar-chart.svg" item-left>
</ion-thumbnail>
<ion-label class="profile">
{{ts.trPK('userProfile','performance-evaluation')}}
</ion-label>
</ion-item>
<ion-item [hidden]="TeamFlag!='true'" (click)="openMyTeamPage()">
<ion-thumbnail slot="start" class="menu-thumb">
<img style= "height: 14px !important;" src="../assets/imgs/my_team_icon.png" item-left>

@ -271,7 +271,10 @@ export class AppComponent implements OnInit {
this.cs.openProfile('sideMenu');
this.menu.toggle();
}
public performanceEvaluation() {
this.cs.openPerformanceevaluation();
this.menu.toggle();
}
public openNotification() {
this.cs.openNotificationPage();
this.menu.toggle();

@ -41,10 +41,10 @@
minLength="8" min="8">
</ion-input>
</ion-item>
<ion-item lines='none'>
<img class="item-icon" src="../assets/icon/yellow.svg" item-start />
<ion-label><p>{{recentPasswordNote.text}}</p></ion-label>
<img class="item-icon " src="../assets/imgs/req info.svg" item-start />
<ion-label><p class="info">{{recentPasswordNote.text}}</p></ion-label>
</ion-item>
<ion-item lines='none'>
<img class="item-icon" [src]="checkerFuncation(1)" item-start />

@ -33,3 +33,7 @@
opacity:.5;
}
.info{
color: #000;
font-weight: bold;
}

@ -36,47 +36,55 @@ export class ChangePasswordComponent implements OnInit {
public recentPasswordNote = {
yellowImg: '../assets/icon/yellow.svg',
text: 'Do not user recent password'
text: 'Do not user recent password',
};
public isLowerCase = {
blankImg: '../assets/icon/blank.svg',
greenImg: '../assets/icon/green.svg',
redImg: '../assets/imgs/close.svg',
text: 'At least one lowercase',
isMatch: false
};
public isUpperCase = {
blankImg: '../assets/icon/blank.svg',
greenImg: '../assets/icon/green.svg',
redImg: '../assets/imgs/close.svg',
text: 'At least one uppdercase',
isMatch: false
};
public isHasDigit = {
blankImg: '../assets/icon/blank.svg',
greenImg: '../assets/icon/green.svg',
redImg: '../assets/imgs/close.svg',
text: 'At least one nomeric',
isMatch: false
};
public isMinLength = {
blankImg: '../assets/icon/blank.svg',
greenImg: '../assets/icon/green.svg',
redImg: '../assets/imgs/close.svg',
text: 'Minimum 8 characters',
isMatch: false
};
public isRepeatedLetter = {
blankImg: '../assets/icon/blank.svg',
greenImg: '../assets/icon/green.svg',
redImg: '../assets/imgs/close.svg',
text: 'Do not add repeating letters',
isMatch: false
};
public isContainSpecialChar = {
blankImg: '../assets/icon/blank.svg',
greenImg: '../assets/icon/green.svg',
redImg: '../assets/imgs/close.svg',
text: 'It should contain special character',
isMatch: false
};
public confirmMatchNew = {
blankImg: '../assets/icon/blank.svg',
greenImg: '../assets/icon/green.svg',
redImg: '../assets/imgs/close.svg',
text: 'Confirm Password does not match.',
isMatch: false
};
@ -244,7 +252,7 @@ export class ChangePasswordComponent implements OnInit {
return this.isLowerCase.greenImg;
} else {
this.isLowerCase.isMatch = false;
return this.isLowerCase.blankImg;
return this.isLowerCase.redImg;
}
case 2:
if (/[A-Z]/.test(this.P_NEW_PASSWORD)) {
@ -252,7 +260,7 @@ export class ChangePasswordComponent implements OnInit {
return this.isUpperCase.greenImg;
} else {
this.isUpperCase.isMatch = false;
return this.isUpperCase.blankImg;
return this.isUpperCase.redImg;
}
case 3:
if (/[0-9]/.test(this.P_NEW_PASSWORD)) {
@ -260,7 +268,7 @@ export class ChangePasswordComponent implements OnInit {
return this.isHasDigit.greenImg;
} else {
this.isHasDigit.isMatch = false;
return this.isHasDigit.blankImg;
return this.isHasDigit.redImg;
}
case 4:
if (this.P_NEW_PASSWORD.length >= 8) {
@ -268,12 +276,12 @@ export class ChangePasswordComponent implements OnInit {
return this.isMinLength.greenImg;
} else {
this.isMinLength.isMatch = false;
return this.isMinLength.blankImg;
return this.isMinLength.redImg;
}
case 5:
if (/([a-z])\1/i.test(this.P_NEW_PASSWORD)) {
this.isRepeatedLetter.isMatch = false;
return this.isRepeatedLetter.blankImg;
return this.isRepeatedLetter.redImg;
} else {
this.isRepeatedLetter.isMatch = true;
return this.isRepeatedLetter.greenImg;
@ -284,14 +292,14 @@ export class ChangePasswordComponent implements OnInit {
return this.isContainSpecialChar.greenImg;
} else {
this.isContainSpecialChar.isMatch = false;
return this.isContainSpecialChar.blankImg;
return this.isContainSpecialChar.redImg;
}
case 7:
if (this.P_NEW_PASSWORD !== this.P_Confirm_NEW_PASSWORD) {
this.confirmMatchNew.isMatch = true;
return this.confirmMatchNew.blankImg;
} else {
this.confirmMatchNew.isMatch = false;
return this.confirmMatchNew.redImg;
} else {
this.confirmMatchNew.isMatch = true;
return this.confirmMatchNew.greenImg;
}
}
@ -302,7 +310,7 @@ export class ChangePasswordComponent implements OnInit {
disabledSubmitBtn() {
if (this.isLowerCase.isMatch && this.isUpperCase.isMatch && this.isHasDigit.isMatch && this.isMinLength.isMatch
&& this.isRepeatedLetter.isMatch && this.P_NEW_PASSWORD !== '' && this.NEW_PASSWORD
&& this.Confirm_NEW_PASSWORD && this.OLD_PASSWORD && this.isContainSpecialChar) {
&& this.Confirm_NEW_PASSWORD && this.OLD_PASSWORD && this.isContainSpecialChar.isMatch && this.confirmMatchNew.isMatch) {
return false;
} else { return true; }
}

@ -61,7 +61,7 @@ export class CheckUserComponent implements OnInit {
private checkUserResult: CheckUserAuthenticationResponse;
private sendSMSForForgotPassword() {
public sendSMSForForgotPassword() {
this.cs.startLoading();
let changePwdObj= new LoginRequest();
// changePwdObj.MobileNumber= this.checkUserResult.BasicMemberInformation.P_MOBILE_NUMBER;

@ -41,8 +41,8 @@
</ion-item>
<ion-item lines='none'>
<img class="item-icon" src="../assets/icon/yellow.svg" item-start />
<ion-label><p>{{recentPasswordNote.text}}</p></ion-label>
<img class="item-icon" src="../assets/imgs/req info.svg" item-start />
<ion-label><p class="info">{{recentPasswordNote.text}}</p></ion-label>
</ion-item>
<ion-item lines='none'>
<img class="item-icon" [src]="checkerFuncation(1)" item-start />
@ -81,7 +81,7 @@
<ion-footer>
<div class="centerDiv">
<button [disabled]="disabledSubmitBtn()"
[ngClass]=" disabledSubmitBtn() ? 'disabledButton' : '' "
[ngClass]="disabledSubmitBtn() ? 'disabledButton' : 'enable' "
class="button-login" ion-button (click)="forgotpassword()">{{ts.trPK('login','changepassword')}}</button>
</div>
</ion-footer>

@ -2,4 +2,7 @@
opacity:.5;
}
.info{
color: #000;
font-weight: bold;
}

@ -23,48 +23,55 @@ export class ForgotComponent implements OnInit {
public P_USER_NAME: string;
public logo = "assets/icon/login/lock.png";
public recentPasswordNote = {
yellowImg: '../assets/icon/yellow.svg',
yellowImg: '../assets/imgs/mohemm-action/info.png',
text: 'Do not user recent password'
};
public isLowerCase = {
blankImg: '../assets/icon/blank.svg',
greenImg: '../assets/icon/green.svg',
redImg: '../assets/imgs/close.svg',
text: 'At least one lowercase',
isMatch: false
};
public isUpperCase = {
blankImg: '../assets/icon/blank.svg',
greenImg: '../assets/icon/green.svg',
redImg: '../assets/imgs/close.svg',
text: 'At least one uppdercase',
isMatch: false
};
public isHasDigit = {
blankImg: '../assets/icon/blank.svg',
greenImg: '../assets/icon/green.svg',
redImg: '../assets/imgs/close.svg',
text: 'At least one nomeric',
isMatch: false
};
public isMinLength = {
blankImg: '../assets/icon/blank.svg',
greenImg: '../assets/icon/green.svg',
redImg: '../assets/imgs/close.svg',
text: 'Minimum 8 characters',
isMatch: false
};
public isRepeatedLetter = {
blankImg: '../assets/icon/blank.svg',
greenImg: '../assets/icon/green.svg',
redImg: '../assets/imgs/close.svg',
text: 'Do not add repeating letters',
isMatch: false
};
public isContainSpecialChar = {
blankImg: '../assets/icon/blank.svg',
greenImg: '../assets/icon/green.svg',
redImg: '../assets/imgs/close.svg',
text: 'It should contain special character',
isMatch: false
};
public confirmMatchNew = {
blankImg: '../assets/icon/blank.svg',
greenImg: '../assets/icon/green.svg',
redImg: '../assets/imgs/close.svg',
text: 'Confirm Password does not match.',
isMatch: false
};
@ -157,7 +164,7 @@ export class ForgotComponent implements OnInit {
return this.isLowerCase.greenImg;
} else {
this.isLowerCase.isMatch = false;
return this.isLowerCase.blankImg;
return this.isLowerCase.redImg;
}
case 2:
if (/[A-Z]/.test(this.P_NEW_PASSWORD)) {
@ -165,7 +172,7 @@ export class ForgotComponent implements OnInit {
return this.isUpperCase.greenImg;
} else {
this.isUpperCase.isMatch = false;
return this.isUpperCase.blankImg;
return this.isUpperCase.redImg;
}
case 3:
if (/[0-9]/.test(this.P_NEW_PASSWORD)) {
@ -173,7 +180,7 @@ export class ForgotComponent implements OnInit {
return this.isHasDigit.greenImg;
} else {
this.isHasDigit.isMatch = false;
return this.isHasDigit.blankImg;
return this.isHasDigit.redImg;
}
case 4:
if (this.P_NEW_PASSWORD.length >= 8) {
@ -181,12 +188,12 @@ export class ForgotComponent implements OnInit {
return this.isMinLength.greenImg;
} else {
this.isMinLength.isMatch = false;
return this.isMinLength.blankImg;
return this.isMinLength.redImg;
}
case 5:
if (/([a-z])\1/i.test(this.P_NEW_PASSWORD)) {
this.isRepeatedLetter.isMatch = false;
return this.isRepeatedLetter.blankImg;
return this.isRepeatedLetter.redImg;
} else {
this.isRepeatedLetter.isMatch = true;
return this.isRepeatedLetter.greenImg;
@ -197,14 +204,14 @@ export class ForgotComponent implements OnInit {
return this.isContainSpecialChar.greenImg;
} else {
this.isContainSpecialChar.isMatch = false;
return this.isContainSpecialChar.blankImg;
return this.isContainSpecialChar.redImg;
}
case 7:
if (this.P_NEW_PASSWORD !== this.P_Confirm_NEW_PASSWORD) {
this.confirmMatchNew.isMatch = true;
return this.confirmMatchNew.blankImg;
} else {
this.confirmMatchNew.isMatch = false;
return this.confirmMatchNew.redImg;
} else {
this.confirmMatchNew.isMatch = true;
return this.confirmMatchNew.greenImg;
}
}
@ -213,9 +220,9 @@ export class ForgotComponent implements OnInit {
disabledSubmitBtn() {
if (this.isLowerCase.isMatch && this.isUpperCase.isMatch && this.isHasDigit.isMatch && this.isMinLength.isMatch
&& this.isRepeatedLetter.isMatch && this.P_NEW_PASSWORD !== '' && this.P_NEW_PASSWORD
&& this.P_Confirm_NEW_PASSWORD && this.isContainSpecialChar) {
return false;
&& this.isRepeatedLetter.isMatch && this.P_NEW_PASSWORD !== '' && this.P_NEW_PASSWORD
&& this.P_Confirm_NEW_PASSWORD && this.isContainSpecialChar && this.confirmMatchNew.isMatch) {
return false;
} else { return true; }
}
}
}

@ -113,7 +113,7 @@ import { AttendanceOptionsComponent } from '../home/attendance-options/attendanc
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';
import { FileOpener } from '@ionic-native/file-opener/ngx';
@NgModule({
imports: [
CommonModule,
@ -309,7 +309,8 @@ import { SubmitAddressModalComponent } from '../profile/submit-eit-modal/submit-
MenuService,
OpenNativeSettings,
BarcodeScanner,
BackgroundGeolocation
BackgroundGeolocation,
FileOpener
],
entryComponents: [DateInfoModalComponent, WorklistSettingComponent],
})

@ -25,10 +25,10 @@ export class ConnectorService {
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
};
public static retryTimes = 0;
public static timeOut = 120 * 1000;
public static timeOut = 180 * 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,

@ -31,8 +31,8 @@
</ion-col>
<ion-col *ngIf="worklistSetting" [size]="2" style="padding: 0;" (click)="openNotifictionSetting()">
<div class="profile-image-container">
<ion-icon name='settings' style="width: 30px;height: 30px;margin-top: 5px; color: white;"></ion-icon>
<div class="profile-image-container setting-conatainer">
<ion-icon src="../assets/icon/settings-not.svg" style="width: 30px;height: 30px;margin-top: 5px; color: white;"></ion-icon>
</div>
</ion-col>

@ -23,4 +23,8 @@
}
.header-toolbar-new {
--background: #269DB8;
}
.setting-conatainer{
height: 40px !important;
width: 40px !important;
}

@ -60,7 +60,7 @@
<ion-col size="4" *ngFor="let category of categories">
<div class="sale-icon" (click)="nextStep(category)">
<div class="top">
<div class="top" [innerHTML]="category.content | sanitizeHTMLPipe" >
<div class="top-icon" [innerHTML]="category.content | sanitizeHTMLPipe" >
</div>
<div class="bottom-icon">
<p *ngIf="direction == 'ltr'">{{category.title}}</p>

@ -394,4 +394,8 @@ ion-radio{
width: 21px;
margin-top: 5px;
}
.sale-icon .top-icon{
position: relative;
margin: 5px 8px;
}

@ -131,7 +131,7 @@
</ion-col>
<ion-col>
<!-- <img class="icon" src="assets/imgs/itemsforsale/delete.svg" /> -->
<img class="icon" *ngIf="item.status!='Approved'" src="assets/imgs/itemsforsale/delete.svg" (click)="deleteItems(item)"/>
<img [class]="direction =='ltr' ? 'icon edit' : 'icon edit-ar'" src="assets/imgs/itemsforsale/edit.svg" (click)="editItems(item)" />
</ion-col>
</ion-row>

@ -18,6 +18,8 @@
}
.top{
position: relative;
margin: 5px 10px;
}
.bottom{
height: 100%;

@ -6,6 +6,7 @@ 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';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
@Component({
selector: 'app-items',
@ -21,7 +22,7 @@ export class ItemsComponent implements OnInit {
pageNo: number = 1;
tempSearch: any = [];
itemsByEmployee: any = [];
constructor(public ts: TranslatorService, public route: ActivatedRoute, 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, private authService: AuthenticationService) {
this.route
.params.subscribe(val => {
setTimeout(() => {
@ -128,5 +129,24 @@ export class ItemsComponent implements OnInit {
this.cs.sharedService.setSharedData(items, ItemForSaleService.EDIT_ITEMS);
this.cs.openCreateitems();
}
deleteItems(item) {
var authUser = this.authService.getAuthenticatedRequest();
this.cs.startLoading();
var request = new FormData();
request.append('itemSaleID', item.itemSaleID);
request.append('isActive', 'false');
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);
request.append('employeeNumber', authUser.P_USER_NAME);
this.itemService.updateItemForSale(request, () => { }, this.ts.trPK('general', 'retry')).subscribe((result: any) => {
if (this.cs.validResponse(result)) {
this.cs.greenToastPK('itemforsale', 'item-deleted');
this.getItemsByEmployee();
}
})
}
}

@ -1,4 +1,4 @@
<app-generic-header performanceEvaluation='true' showBack="true" [headerText]="'userProfile,title' | translate">
<app-generic-header showBack="true" [headerText]="'userProfile,title' | translate">
</app-generic-header>
<ion-content class="colorBG" *ngIf="personalInfo">

@ -28,9 +28,7 @@ export class HomeComponent implements OnInit {
public setImage: any;
public user_image: any = '../assets/imgs/profile.png';
public personalInfo: any;
public appraisalArr: any = [];
public performanceData: any = [];
public static PERFORMANCE_DATA = 'perAppData';
public personalInfoSegment = false;
public familyMemberSegment = false;
public basicDetailsSegment = false;
@ -257,35 +255,8 @@ export class HomeComponent implements OnInit {
this.cs.openProfile('sideMenu');
}
public openPerormance() {
this.showPerformanceAppraisal();
}
public showPerformanceAppraisal() {
this.DS.getPerformanceAppraisal(() => {
this.showPerformanceAppraisal();
}).subscribe((result: PerformanceAppraisalResponse) => {
this.handlePerformanceAppraisalResult(result);
});
}
private handlePerformanceAppraisalResult(result) {
if (this.cs.validResponse(result)) {
if (this.cs.hasData(result.GetPerformanceAppraisalList)) {
this.appraisalArr = result.GetPerformanceAppraisalList;
this.performanceData = [];
for (let i = 0; i < this.appraisalArr.length; i++) {
this.performanceData.push({ name: this.appraisalArr[i].APPRAISAL_YEAR, value: parseInt(this.appraisalArr[i].APPRAISAL_SCORE).toFixed() });
}
console.log('PerformanceAppraisalResponse');
this.sharedData.setSharedData(this.performanceData, PerformanceAppraisalResponse.PERFORMANCE_DATA);
this.cs.openPerformanceevaluation();
} else {
let msg: string = this.ts.trPK("userProfile", "no-appraisal");
this.cs.presentAlert(msg);
}
}
}
public selectedSegment(segmentData) {
switch (segmentData) {

@ -25,7 +25,9 @@ export class PerformanceEvaluationComponent implements OnInit {
public length;
public direction: string;
// public showText:boolean =false;
public appraisalArr: any = [];
public static PERFORMANCE_DATA = 'perAppData';
constructor(public ts: TranslatorService,
public cs: CommonService,
public DS: DashboredService,
@ -53,21 +55,21 @@ export class PerformanceEvaluationComponent implements OnInit {
this.getProfile();
this.performanceData = this.cs.sharedService.getSharedData(
PerformanceAppraisalResponse.PERFORMANCE_DATA,
true
);
console.log(this.performanceData.length);
//i % 2 == 0
this.length = this.performanceData.length;
for (let i = 0; i < this.performanceData.length; i++) {
this.performanceData[i].color = this.colorScheme.domain[i];
console.log(i + ' : ' + this.performanceData[i].name)
}
console.log(this.performanceData[0].color)
this.showPerformanceAppraisal()
// this.performanceData = this.cs.sharedService.getSharedData(
// PerformanceAppraisalResponse.PERFORMANCE_DATA,
// true
// );
// console.log(this.performanceData.length);
// //i % 2 == 0
// this.length = this.performanceData.length;
// for (let i = 0; i < this.performanceData.length; i++) {
// this.performanceData[i].color = this.colorScheme.domain[i];
// console.log(i + ' : ' + this.performanceData[i].name)
// }
// console.log(this.performanceData[0].color)
}
@ -90,5 +92,30 @@ export class PerformanceEvaluationComponent implements OnInit {
}
});
}
public showPerformanceAppraisal() {
this.DS.getPerformanceAppraisal(() => {
this.showPerformanceAppraisal();
}).subscribe((result: PerformanceAppraisalResponse) => {
this.handlePerformanceAppraisalResult(result);
});
}
private handlePerformanceAppraisalResult(result) {
if (this.cs.validResponse(result)) {
if (this.cs.hasData(result.GetPerformanceAppraisalList)) {
this.appraisalArr = result.GetPerformanceAppraisalList;
this.performanceData = [];
for (let i = 0; i < this.appraisalArr.length; i++) {
this.performanceData.push({ name: this.appraisalArr[i].APPRAISAL_YEAR, value: parseInt(this.appraisalArr[i].APPRAISAL_SCORE).toFixed() });
}
console.log('PerformanceAppraisalResponse');
this.cs.sharedService.setSharedData(this.performanceData, PerformanceAppraisalResponse.PERFORMANCE_DATA);
this.cs.openPerformanceevaluation();
} else {
let msg: string = this.ts.trPK("userProfile", "no-appraisal");
this.cs.presentAlert(msg);
}
}
}
}

@ -35,7 +35,7 @@
<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)"><ion-icon name="refresh" class="refresh"></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>

@ -1,10 +1,11 @@
import { copyStyles } from '@angular/animations/browser/src/util';
import { Component, ElementRef, OnInit } from '@angular/core';
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';
import { FileOpener } from '@ionic-native/file-opener/ngx';
@Component({
selector: 'app-transaction-list',
templateUrl: './transaction-list.component.html',
@ -14,7 +15,8 @@ export class TransactionListComponent implements OnInit {
transactionList: any = [];
selectedMenu: any;
template: any;
constructor(public cs: CommonService, private elementRef: ElementRef, public reports: ReportServiceService, public ts: TranslatorService,) { }
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);
@ -30,12 +32,56 @@ export class TransactionListComponent implements OnInit {
};
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(transaction) {
var request: any = {
P_REQUEST_ID: transaction['REQUEST_ID']

@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" width="246.681" height="274.06" viewBox="0 0 246.681 274.06">
<g id="alarm" transform="translate(-25.575)">
<path id="Path_90" data-name="Path 90" d="M130.375,122.483a17.332,17.332,0,1,0,17.332-17.332A17.352,17.352,0,0,0,130.375,122.483Z" transform="translate(-48.703 -48.867)" fill="#fff"/>
<path id="Path_91" data-name="Path 91" d="M99,147.208A73.429,73.429,0,1,0,25.575,73.779,73.512,73.512,0,0,0,99,147.208ZM50.375,65.75H66.6a33.392,33.392,0,0,1,9.3-16.037L67.641,35.37l13.918-8.009L89.8,41.689a33.222,33.222,0,0,1,18.4,0l8.244-14.327,13.918,8.009-8.253,14.343a33.392,33.392,0,0,1,9.3,16.037h16.22V81.808h-16.22a33.389,33.389,0,0,1-9.3,16.037l8.253,14.343L116.449,120.2l-8.244-14.327a33.222,33.222,0,0,1-18.4,0L81.559,120.2l-13.918-8.009,8.253-14.343a33.392,33.392,0,0,1-9.3-16.037H50.375Z" transform="translate(0 -0.163)" fill="#fff"/>
<path id="Path_92" data-name="Path 92" d="M250.211,475.758a31.558,31.558,0,0,0,58.244,0Z" transform="translate(-104.394 -221.098)" fill="#fff"/>
<path id="Path_93" data-name="Path 93" d="M171.916,412.266h96.42l-.014.143h49.122V395.977l-22.837-23.132H145.646l-22.837,23.132v16.431H171.93Z" transform="translate(-45.187 -173.271)" fill="#fff"/>
<path id="Path_94" data-name="Path 94" d="M313.567,264.493h-85.69a89.107,89.107,0,0,1-50.122,21.163v20.777H313.567Z" transform="translate(-70.722 -122.917)" fill="#fff"/>
<path id="Path_95" data-name="Path 95" d="M300.174,73.616a89,89,0,0,1-16.629,51.9h70.983V67.906A67.92,67.92,0,0,0,265.9,3.235a89.379,89.379,0,0,1,34.279,70.381Z" transform="translate(-111.683)" fill="#fff"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

@ -3217,6 +3217,10 @@
"en": "This ad will be valid for 2 week after approval",
"ar": "هذا الإعلان ساري المفعول لمدة أسبوعين بعد الموافقة"
},
"item-deleted": {
"en": "Item deleted successfully",
"ar": "تم حذف العنصر بنجاح"
},
"locked": {
"en": "Locked",
"ar": "مقفل"

Loading…
Cancel
Save