EIT Flow completed
parent
84643553bf
commit
08f588c302
@ -0,0 +1,62 @@
|
||||
<ion-header>
|
||||
<ion-toolbar class="header-toolbar">
|
||||
<nav-buttons></nav-buttons>
|
||||
<ion-title color="light">{{'general, addAttach' | translate}}</ion-title>
|
||||
|
||||
<ion-buttons slot="primary">
|
||||
<ion-button style="background: none !important;" (click)="closeBtnModal()">
|
||||
<ion-icon slot="icon-only" name="close"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
|
||||
<ion-card>
|
||||
<ion-card-header class="boxHdr">
|
||||
<div class="hrTitle">{{"addAttach.title" | translate}}</div>
|
||||
<div class="fileDiv"> <input end class="inputfile" type="file" ng2FileSelect [uploader]="uploader"
|
||||
(change)="onFileSelected($event)" />
|
||||
<label end for="file">
|
||||
<ion-icon name="add"></ion-icon>
|
||||
</label></div>
|
||||
</ion-card-header>
|
||||
<ion-card-content>
|
||||
<ion-grid class=" gridAH" *ngIf="uploader?.queue?.length > 0">
|
||||
<ion-row class="rowAH titleH">
|
||||
<ion-col col-4>
|
||||
<label class="Header" for="">{{'addAttach.name' | translate}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-4>
|
||||
<label class="Header" for="">{{'addAttach.size' | translate}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-4>
|
||||
<label class="Header" for="">{{'addAttach.remove' | translate}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row class="rowAH" *ngFor="let item of uploader.queue">
|
||||
<ion-col col-4>
|
||||
<label for="">{{ item?.file?.name }}</label>
|
||||
</ion-col>
|
||||
<ion-col col-4>
|
||||
<label *ngIf="uploader.options.isHTML5">{{ item?.file?.size/1024/1024 | number:'.2' }} MB</label>
|
||||
</ion-col>
|
||||
<ion-col col-4>
|
||||
<button class="iconButton" ion-button (click)="removeFile(item)"> <img class="imgSize"
|
||||
src="../assets/imgs/deletegray.png"></button>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
|
||||
</ion-content>
|
||||
|
||||
<ion-footer>
|
||||
<div class="centerDiv">
|
||||
<ion-button class="footer-button" color="customnavy" ion-button (click)="OkBtnModal()">
|
||||
{{'general, ok' | translate}}</ion-button>
|
||||
</div>
|
||||
</ion-footer>
|
||||
@ -0,0 +1,27 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AddAttachComponent } from './add-attach.component';
|
||||
|
||||
describe('AddAttachComponent', () => {
|
||||
let component: AddAttachComponent;
|
||||
let fixture: ComponentFixture<AddAttachComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AddAttachComponent ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AddAttachComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,172 @@
|
||||
import { AddEitResponse } from './../models/add.eit.response';
|
||||
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FileUploader } from 'ng2-file-upload';
|
||||
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-add-attach',
|
||||
templateUrl: './add-attach.component.html',
|
||||
styleUrls: ['./add-attach.component.scss'],
|
||||
})
|
||||
export class AddAttachComponent implements OnInit {
|
||||
|
||||
private eitResponse: any;//AddEitResponse=new AddEitResponse();
|
||||
isUpload: boolean = false;
|
||||
inQueue: boolean = false;
|
||||
addAttachmentListReq: any;
|
||||
attachmentID: number = 0;
|
||||
addAttachRequest: any = [];
|
||||
fileData: any;
|
||||
fileType: any;
|
||||
index: any = 1;
|
||||
dirPage: any;
|
||||
TransactionID: any;
|
||||
indexLastObj: any
|
||||
filterAllowedType: any = ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'];
|
||||
|
||||
|
||||
constructor(public cs: CommonService, public ts: TranslatorService, public modalCtrl: ModalController) {
|
||||
this.eitResponse = this.cs.sharedService.getSharedData(AddEitResponse.SHARED_DATA, false);
|
||||
this.TransactionID = this.cs.sharedService.getSharedData('TransactionID', false);
|
||||
this.indexLastObj = this.cs.sharedService.getSharedData('indexLastObj', false);
|
||||
|
||||
// console.log("this.TransactionID : "+ this.TransactionID);
|
||||
this.isUpload = false;
|
||||
}
|
||||
|
||||
ngOnInit() { }
|
||||
|
||||
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()
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
public hasBaseDropZoneOver: boolean = false;
|
||||
public hasAnotherDropZoneOver: boolean = false;
|
||||
|
||||
public fileOverBase(e: any): void {
|
||||
this.hasBaseDropZoneOver = e;
|
||||
}
|
||||
|
||||
public fileOverAnother(e: any): void {
|
||||
this.hasAnotherDropZoneOver = e;
|
||||
}
|
||||
|
||||
OkBtnModal() {
|
||||
let fileCount: number = this.uploader.queue.length;
|
||||
if (fileCount > 0) {
|
||||
let data: any = this.addAttachRequest;
|
||||
// this.viewCtrl.dismiss(data);
|
||||
|
||||
this.modalCtrl.dismiss(data);
|
||||
|
||||
}
|
||||
else {
|
||||
let msg: string = "";
|
||||
msg = this.ts.trPK("general", "noFileSelect");
|
||||
this.cs.presentAlert(msg);
|
||||
return;
|
||||
}
|
||||
} // end ok button
|
||||
|
||||
closeBtnModal() {
|
||||
// this.viewCtrl.dismiss("cancel");
|
||||
this.modalCtrl.dismiss("cancel");
|
||||
|
||||
}
|
||||
|
||||
onFileSelected(input) {
|
||||
|
||||
// this.uploader.onWhenAddingFileFailed = function (item: any, filter: any, options: any){
|
||||
|
||||
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];
|
||||
|
||||
// console.log(file);
|
||||
|
||||
//var encoded = Base64.encode(file);
|
||||
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);
|
||||
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],
|
||||
P_TRANSACTION_ID: this.TransactionID
|
||||
})
|
||||
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
//console.log("after push: "+ this.index);
|
||||
// return this.addAttachRequest
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
// this.addAttachRequest =this.addAttachRequest.filter(item => item.AttachmentID !== objectitem.AttachmentID);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,3 +1,183 @@
|
||||
<p>
|
||||
confirm-add-eit works!
|
||||
</p>
|
||||
<ion-header>
|
||||
<ion-toolbar class="header-toolbar">
|
||||
<nav-buttons></nav-buttons>
|
||||
<ion-title color="light">{{headerTitle}}</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
|
||||
<ion-card>
|
||||
<ion-card-header class="boxHdr">
|
||||
<div class="hrTitle">{{"confirmAddEit.approverList" | translate}}</div>
|
||||
</ion-card-header>
|
||||
<ion-card-content>
|
||||
|
||||
<!-- <ion-item class="itemAH" > -->
|
||||
<ion-grid class=" gridAH" *ngIf="approversList?.length > 0">
|
||||
<ion-row class="rowAH titleH">
|
||||
<ion-col col-1>
|
||||
<label class="Header" for="">{{'confirmAddEit, no' | translate}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-3>
|
||||
<label class="Header" for="">{{'confirmAddEit, approver' | translate}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-3>
|
||||
<label class="Header" for="">{{'confirmAddEit, approverCategory' | translate}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-3>
|
||||
<label class="Header" for="">{{'confirmAddEit, approverType' | translate}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-2>
|
||||
<label class="Header" for="">{{'confirmAddEit, status' | translate}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<!-- </ion-grid>
|
||||
</ion-item> -->
|
||||
|
||||
|
||||
<!-- <ion-list *ngIf="approversList?.length > 0"> -->
|
||||
|
||||
<!-- <ion-item class="itemAH" *ngFor="let item of approversList" >
|
||||
<ion-grid class=" gridAH"> -->
|
||||
<ion-row class="rowAH" *ngFor="let item of approversList">
|
||||
<ion-col col-1>
|
||||
<label for="">{{item.APPROVER_ORDER_NUMBER}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-3>
|
||||
<label for="">{{item.APPROVER}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-3>
|
||||
<label for="">{{item.APPROVER_CATEGORY}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-3>
|
||||
<label for="">{{item.APPROVER_TYPE}}</label>
|
||||
</ion-col>
|
||||
<ion-col col-2>
|
||||
<label for="">{{item.APPROVAL_STATUS}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
<!-- </ion-item>
|
||||
|
||||
</ion-list> -->
|
||||
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
<ion-item padding>
|
||||
<ion-label class="boldTxtNav">{{'confirmAddEit, comment' | translate}}</ion-label>
|
||||
<ion-textarea type="text" [(ngModel)]="eitComments"></ion-textarea>
|
||||
</ion-item>
|
||||
|
||||
<!-- <div padding *ngIf="attachmentRes?.length > 0 || attachListOver?.length > 0">
|
||||
<p class="boldTxt"> {{"absenceList.attachList" | translate}}</p>
|
||||
</div>
|
||||
<div *ngIf="attachListOver?.length > 0">
|
||||
<ion-row *ngFor="let attachList of attachListOver ; let i = index">
|
||||
|
||||
<ion-col col-8 (click)="OpenAttachFiles(attachList.P_FILE_DATA,attachList.P_FILE_CONTENT_TYPE)">
|
||||
{{ attachList.P_FILE_NAME }}</ion-col>
|
||||
<ion-col col-4>
|
||||
|
||||
<button [disabled]="attachList.isSuccess" class="iconButton" (click)="removeFile(attachList)"><img
|
||||
class="imgSize" src="../assets/imgs/cancel.png"></button>
|
||||
|
||||
</ion-col>
|
||||
|
||||
</ion-row>
|
||||
</div> -->
|
||||
|
||||
|
||||
|
||||
<!-- <div *ngIf="attachmentRes?.length > 0">
|
||||
<ion-row *ngFor="let attachRes of attachmentRes">
|
||||
|
||||
|
||||
<ion-col col-8 (click)="OpenAttachFiles(attachRes.FILE_DATA,attachRes.FILE_CONTENT_TYPE)">
|
||||
{{ attachRes.FILE_NAME }}</ion-col>
|
||||
<ion-col col-4>
|
||||
|
||||
<button [disabled]="!isResubmitEIT" class="iconButton" (click)="addAttachment(false,attachRes)"><img
|
||||
class="imgSize" src="../assets/imgs/editIcon.png"></button>
|
||||
<button (click)="delelteFile(attachRes)" class="iconButton" [disabled]="!isResubmitEIT"><img
|
||||
class="imgSize" src="../assets/imgs/cancel.png"></button>
|
||||
|
||||
</ion-col>
|
||||
|
||||
|
||||
</ion-row>
|
||||
</div> -->
|
||||
|
||||
<div>
|
||||
<ion-card>
|
||||
|
||||
<ion-card-header class="boxHdr">
|
||||
<div class="hrTitle">{{"absenceList, attachList" | translate}}</div>
|
||||
<button ion-button (click)="addAttachment(true,-1)">
|
||||
<img class="imgSize" src="../assets/imgs/attachment.png"></button>
|
||||
|
||||
</ion-card-header>
|
||||
<ion-card-content>
|
||||
<ion-grid *ngIf="attachListOver?.length > 0">
|
||||
<div *ngFor="let attachList of attachListOver ; let i = index">
|
||||
<ion-row>
|
||||
<ion-col col-8>
|
||||
<div> <img float-start class="attachImg" src="../assets/imgs/file.png">
|
||||
</div>
|
||||
<ion-label>
|
||||
{{attachList.P_FILE_NAME }} </ion-label>
|
||||
|
||||
</ion-col>
|
||||
<ion-col col-4>
|
||||
<button float-end class="attachImgBtn"
|
||||
(click)="OpenAttachFiles(attachList.P_FILE_DATA,attachList.P_FILE_CONTENT_TYPE)">
|
||||
<img class="attachImg" src="../assets/imgs/view.png">
|
||||
</button>
|
||||
<button float-end [disabled]="attachList.isSuccess" class="attachImgBtn"
|
||||
(click)="removeFile(attachList)"><img class="attachImg" src="../assets/imgs/deletegray.png"></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>
|
||||
|
||||
|
||||
<!-- <button [disabled]="!isResubmitEIT" class="iconButton" (click)="addAttachment(false,attachRes)"><img
|
||||
class="imgSize" src="../assets/imgs/editIcon.png"></button>
|
||||
<button (click)="delelteFile(attachRes)" class="iconButton" [disabled]="!isResubmitEIT"><img
|
||||
class="imgSize" src="../assets/imgs/cancel.png"></button> -->
|
||||
</ion-row>
|
||||
</div>
|
||||
|
||||
</ion-grid>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
|
||||
</div>
|
||||
|
||||
</ion-content>
|
||||
|
||||
<ion-footer>
|
||||
<div class="centerDiv">
|
||||
<ion-button class="footer-button" color="customnavy" ion-button (click)="startEitApproval()">
|
||||
{{ (isDelete ? 'general, delete' : 'general, submit') | translate }}</ion-button>
|
||||
</div>
|
||||
</ion-footer>
|
||||
@ -0,0 +1,7 @@
|
||||
.footer-button {
|
||||
border-radius: 2px;
|
||||
padding: 0 1.1em;
|
||||
min-height: 45px;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
.footer-button {
|
||||
border-radius: 2px;
|
||||
padding: 0 1.1em;
|
||||
min-height: 45px;
|
||||
min-width: 200px;
|
||||
}
|
||||
border-radius: 2px;
|
||||
padding: 0 1.1em;
|
||||
min-height: 45px;
|
||||
min-width: 200px;
|
||||
}
|
||||
h4 {
|
||||
font-size: 2.2rem;
|
||||
text-align: center;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
export class EITNotificationBodyItems {
|
||||
public TRANSACTION_NUMBER :number;
|
||||
public DESC_FLEX_NAME : string;
|
||||
public ACTION : string;
|
||||
public EXTRA_INFO_ID :number;
|
||||
public DESC_FLEX_CONTEXT_COD : string;
|
||||
public APPLICATION_COLUMN_NAME : string;
|
||||
public SEGMENT_SEQ_NUM :number;
|
||||
public DATATYPE : string;
|
||||
public SEGMENT_NAME : string;
|
||||
public VARCHAR2_VALUE : string;
|
||||
public SEGMENT_PROMPT : string;
|
||||
public NUMBER_VALUE :number;
|
||||
public SEGMENT_VALUE_DSP : string;
|
||||
public DATE_VALUE : string ;
|
||||
public PREV_SEGMENT_VALUE_DSP : string;
|
||||
public DISPLAY_FLAG : string ;
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
import { EITNotificationBodyItems } from './EITNotificationBodyItems';
|
||||
import { Response } from '../../hmg-common/services/models/response';
|
||||
|
||||
export class EITNotificatonBodyResponse extends Response {
|
||||
public static SHARED_DATA = 'Notif_BODY_List';
|
||||
public static NOT_WORKLIST = 'Notif_WORK_LOST';
|
||||
public EITNotificationBodyItems: EITNotificationBodyItems [];
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
import { Request } from '../../hmg-common/services/models/request';
|
||||
|
||||
export class WorkListButtonRequest extends Request{
|
||||
//public static SHARED_DATA = '';
|
||||
public P_NOTIFICATION_ID :any;
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
import { Response } from '../../hmg-common/services/models/response';
|
||||
|
||||
export class NotificationGetAttachResponse extends Response {
|
||||
public static SHARED_DATA = '';
|
||||
public SEQ_NUM = 0;// Int
|
||||
public FILE_NAME = '';//String
|
||||
public FILE_DATA = '';//base64
|
||||
public PK1_VALUE = '';//String
|
||||
public PK2_VALUE = '';//String
|
||||
public PK3_VALUE = '';//String
|
||||
public PK4_VALUE = '';//String
|
||||
public FILE_CONTENT_TYPE = '';//String
|
||||
public ATTACHED_DOCUMENT_ID = 0;//Int
|
||||
public DOCUMENT_ID = 0;//Int
|
||||
public CATEGORY_ID = 0;//Int
|
||||
public DATATYPE_ID = 0;//Int
|
||||
public ENTITY_NAME = '';//String
|
||||
public FILE_ID = 0;//Int
|
||||
public PK5_VALUE = '';//String
|
||||
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
<p>
|
||||
home works!
|
||||
</p>
|
||||
@ -0,0 +1,27 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HomeComponent } from './home.component';
|
||||
|
||||
describe('HomeComponent', () => {
|
||||
let component: HomeComponent;
|
||||
let fixture: ComponentFixture<HomeComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ HomeComponent ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HomeComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,14 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
templateUrl: './home.component.html',
|
||||
styleUrls: ['./home.component.scss'],
|
||||
})
|
||||
export class HomeComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
import { HmgCommonModule } from './../hmg-common/hmg-common.module';
|
||||
import { WorkListAttachViewComponent } from './work-list-attach-view/work-list-attach-view.component';
|
||||
import { HomeComponent } from './home/home.component';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
import { NotificationPage } from './notification.page';
|
||||
import { PdfViewerModule } from 'ng2-pdf-viewer';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: NotificationPage,
|
||||
children: [
|
||||
{
|
||||
path: 'homepage',
|
||||
component: HomeComponent
|
||||
},
|
||||
{
|
||||
path: 'work-list-attach-view',
|
||||
component: WorkListAttachViewComponent
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
HmgCommonModule,
|
||||
PdfViewerModule,
|
||||
RouterModule.forChild(routes)
|
||||
],
|
||||
declarations: [
|
||||
NotificationPage,
|
||||
HomeComponent,
|
||||
WorkListAttachViewComponent
|
||||
]
|
||||
})
|
||||
export class NotificationPageModule {}
|
||||
@ -0,0 +1,3 @@
|
||||
<ion-content>
|
||||
<ion-router-outlet></ion-router-outlet>
|
||||
</ion-content>
|
||||
@ -0,0 +1,27 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NotificationPage } from './notification.page';
|
||||
|
||||
describe('NotificationPage', () => {
|
||||
let component: NotificationPage;
|
||||
let fixture: ComponentFixture<NotificationPage>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ NotificationPage ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(NotificationPage);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-notification',
|
||||
templateUrl: './notification.page.html',
|
||||
styleUrls: ['./notification.page.scss'],
|
||||
})
|
||||
export class NotificationPage implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
<ion-header>
|
||||
<ion-toolbar class="header-toolbar">
|
||||
<nav-buttons></nav-buttons>
|
||||
<ion-title color="light">{{'workListMain, suppDoc' | translate}}</ion-title>
|
||||
|
||||
<ion-buttons slot="primary">
|
||||
<ion-button style="background: none !important;" (click)="onClose()">
|
||||
<ion-icon slot="icon-only" name="close"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content padding>
|
||||
|
||||
<div *ngIf="displayPdf != '' ">
|
||||
<pdf-viewer *ngIf="displayPdf" [src]="displayPdf" [show-all]="true" [original-size]="false" [zoom]="pdfZoom"
|
||||
style="display: block"></pdf-viewer>
|
||||
|
||||
<ion-fab bottom right>
|
||||
<button ion-fab mini (click)="zoomIn()">
|
||||
<ion-icon name="add"></ion-icon>
|
||||
</button>
|
||||
<button ion-fab mini (click)="zoomOut()">
|
||||
<ion-icon name="remove"></ion-icon>
|
||||
</button>
|
||||
<button ion-fab mini (click)="resetZoom()">
|
||||
<ion-icon name="refresh"></ion-icon>
|
||||
</button>
|
||||
</ion-fab>
|
||||
|
||||
</div>
|
||||
<div *ngIf="displayImage != '' ">
|
||||
<img [src]="displayImage" alt="Select Image" />
|
||||
</div>
|
||||
|
||||
<div *ngIf="decodedString != 0 ">
|
||||
<p [innerHTML]="decodedString"></p>
|
||||
<!-- <p>{{decodedString}}</p> -->
|
||||
</div>
|
||||
|
||||
<div *ngIf="sheetNameList?.length > 0 ">
|
||||
<ion-content class="XlsxScroll" scrollX="true" scrollY="true"
|
||||
style="display: block; width: 100%; height: 100% ;position: initial">
|
||||
Choose a worksheet:
|
||||
<ion-grid class="btnGrid">
|
||||
<ion-row>
|
||||
<div *ngFor="let sheetName of sheetNameList">
|
||||
<ion-col col-6 class="gridBtnCol">
|
||||
<button ion-button class="gridBtn" (click)="openSheet(sheetName)">
|
||||
{{sheetName.sheetName}}
|
||||
</button>
|
||||
</ion-col>
|
||||
</div>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
<ion-grid style="width: 500%;">
|
||||
<ion-row *ngFor="let row of data">
|
||||
<ion-col style="border:#0000002e solid 0.5px" *ngFor="let val of row">
|
||||
{{val}}
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
</ion-content>
|
||||
</div>
|
||||
</ion-content>
|
||||
@ -0,0 +1,27 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { WorkListAttachViewComponent } from './work-list-attach-view.component';
|
||||
|
||||
describe('WorkListAttachViewComponent', () => {
|
||||
let component: WorkListAttachViewComponent;
|
||||
let fixture: ComponentFixture<WorkListAttachViewComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ WorkListAttachViewComponent ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(WorkListAttachViewComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,147 @@
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import * as XLSX from 'xlsx';
|
||||
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
||||
|
||||
type AOA = any[][];
|
||||
const ZOOM_STEP: number = 0.25;
|
||||
const DEFAULT_ZOOM: number = 1;
|
||||
|
||||
@Component({
|
||||
selector: 'app-work-list-attach-view',
|
||||
templateUrl: './work-list-attach-view.component.html',
|
||||
styleUrls: ['./work-list-attach-view.component.scss'],
|
||||
})
|
||||
export class WorkListAttachViewComponent implements OnInit {
|
||||
|
||||
displayPdf: string = "";
|
||||
displayImage: string = "";
|
||||
TypeData: string = "";
|
||||
displayData: string = "";
|
||||
decodedString: any;
|
||||
displayxlsx: string = "";
|
||||
public pdfZoom: number = DEFAULT_ZOOM;
|
||||
sheetNameList: any = [];
|
||||
sheetDataList: any = [];
|
||||
|
||||
data: any[][];//[[1,2,3],[4,5,6]];
|
||||
|
||||
constructor(private cs: CommonService, private ts: TranslatorService, private modalCtrl: ModalController) {
|
||||
this.displayData = this.cs.sharedService.getSharedData('WorkListAttachViewPage', false).displayData;
|
||||
this.TypeData = this.cs.sharedService.getSharedData('WorkListAttachViewPage', false).TypeData;
|
||||
|
||||
if (this.TypeData == "png" || this.TypeData == "jpeg" || this.TypeData == "jpg" || this.TypeData == "PNG" || this.TypeData == "JPEG" || this.TypeData == "JPG") {
|
||||
this.displayImage = 'data:image/' + this.TypeData + ';base64,' + this.displayData;
|
||||
}
|
||||
else if (this.TypeData == "pdf" || this.TypeData == "PDF") {
|
||||
this.displayPdf = 'data:application/octet-stream;base64,' + this.displayData;
|
||||
}
|
||||
else if (this.TypeData == "txt") {
|
||||
//
|
||||
this.decodedString = atob(this.displayData);
|
||||
// console.log("..."+ this.decodedString);
|
||||
}
|
||||
else if (this.TypeData == "xlx" || this.TypeData == "xlsx") {
|
||||
this.displayxlsx = this.displayData;
|
||||
var base64 = this.displayxlsx;//.split(";base64,")
|
||||
var binary = "";
|
||||
var raw = window.atob(base64);
|
||||
var rawLength = raw.length;
|
||||
var array = new Uint8Array(new ArrayBuffer(rawLength));
|
||||
|
||||
for (let i = 0; i < rawLength; i++) {
|
||||
array[i] = raw.charCodeAt(i);
|
||||
}
|
||||
|
||||
var length = array.byteLength;
|
||||
for (let i = 0; i < length; i++) {
|
||||
binary += String.fromCharCode(array[i]);
|
||||
}
|
||||
const wb: XLSX.WorkBook = XLSX.read(binary, { type: 'binary', cellDates: true });
|
||||
|
||||
/* grab first sheet */
|
||||
const wsname: string = wb.SheetNames[0];
|
||||
const ws: XLSX.WorkSheet = wb.Sheets[wsname];
|
||||
// if(ws["!type"]=="chart")
|
||||
// {
|
||||
// alert("chart");
|
||||
// }
|
||||
// else alert("able");
|
||||
|
||||
this.data = <AOA>(XLSX.utils.sheet_to_json(ws, { header: 1 }));
|
||||
|
||||
// const wsname1: string = wb.SheetNames[1];
|
||||
// const ws1: XLSX.WorkSheet = wb.Sheets[wsname];
|
||||
// console.log("wsname..."+wsname);
|
||||
// console.log("ws..."+ws);
|
||||
/* save data */
|
||||
// this.data = <AOA>(XLSX.utils.sheet_to_json(ws, {header: 1}));
|
||||
// this.data = <AOA>(XLSX.utils.sheet_to_json(ws1, {header: 1}));
|
||||
|
||||
|
||||
for (let i = 0; i < wb.SheetNames.length; ++i) {
|
||||
const sheetName = wb.SheetNames[i];
|
||||
const ws: XLSX.WorkSheet = wb.Sheets[sheetName];
|
||||
this.sheetNameList.push({ id: i, sheetName: sheetName });
|
||||
this.sheetDataList.push({ id: i, sheetData: ws });
|
||||
}
|
||||
}//if file == xlx/s
|
||||
else {
|
||||
let msg: string = "";
|
||||
msg = this.ts.trPK("general", "notSupportFile");
|
||||
this.cs.presentAlert(msg);
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() { }
|
||||
|
||||
public zoomIn() {
|
||||
this.pdfZoom += ZOOM_STEP;
|
||||
}
|
||||
|
||||
public zoomOut() {
|
||||
if (this.pdfZoom > DEFAULT_ZOOM) {
|
||||
this.pdfZoom -= ZOOM_STEP;
|
||||
}
|
||||
}
|
||||
|
||||
public resetZoom() {
|
||||
this.pdfZoom = DEFAULT_ZOOM;
|
||||
}
|
||||
|
||||
onClose(): void {
|
||||
this.modalCtrl.dismiss();
|
||||
}
|
||||
|
||||
base64ToByteArray(base64String) {
|
||||
try {
|
||||
var sliceSize = 1024;
|
||||
var byteCharacters = atob(base64String);
|
||||
var bytesLength = byteCharacters.length;
|
||||
var slicesCount = Math.ceil(bytesLength / sliceSize);
|
||||
var byteArrays = new Array(slicesCount);
|
||||
|
||||
for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
|
||||
var begin = sliceIndex * sliceSize;
|
||||
var end = Math.min(begin + sliceSize, bytesLength);
|
||||
|
||||
var bytes = new Array(end - begin);
|
||||
for (var offset = begin, i = 0; offset < end; ++i, ++offset) {
|
||||
bytes[i] = byteCharacters[offset].charCodeAt(0);
|
||||
}
|
||||
byteArrays[sliceIndex] = new Uint8Array(bytes);
|
||||
}
|
||||
return byteArrays;
|
||||
} catch (e) {
|
||||
//console.log("Couldn't convert to byte array: " + e);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
openSheet(obj) {
|
||||
this.data = <AOA>(XLSX.utils.sheet_to_json(this.sheetDataList[obj.id].sheetData, { header: 1 }));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue