Project

General

Profile

« Previous | Next » 

Revision 60616

View differences:

modules/uoa-repository-manager-service/trunk/app/shared/models/record.interface.ts
1
import {InvoiceMasterData} from './invoice-master-data.interface';
2

  
3
export interface Record {
4
  id: number;
5
  documentClassificationId: number;
6
  documentSubclassificationId: number;
7
  ipowerClientId: number;
8
  dmsFileCode: string;
9
  abbyyConfidenceLvl: number;
10
  abbyyTemplate: string;
11
  invoiceMasterData: InvoiceMasterData;
12
}
modules/uoa-repository-manager-service/trunk/app/shared/models/lookup-data.interface.ts
1
export interface LookupData {
2
  id: number;
3
  name: string;
4
}
modules/uoa-repository-manager-service/trunk/app/shared/models/system-exception.interface.ts
1
export interface SystemException {
2
  id: number;
3
  processId: number;
4
  clientId: string;
5
  jobName: string;
6
  dmsFileCode: string;
7
  message: string;
8
  cause: string;
9
  creationDatetime : Date;
10
  trace: string;
11
}
modules/uoa-repository-manager-service/trunk/app/shared/models/paging/pageable.interface.ts
1
import {Sort} from './sort.interface';
2

  
3
export interface Pageable {
4
  sort: Sort;
5
  offset: number;
6
  pageNumber: number;
7
  pageSize: number;
8
  unpaged: boolean;
9
  paged: boolean;
10
}
modules/uoa-repository-manager-service/trunk/app/shared/models/document-subclassification.interface.ts
1
import { DocumentClassification } from "./document-classification.interface";
2

  
3
export interface DocumentSubclassification {
4
  subclassificationId: number;
5
  subclassificationName: string;
6
  documentClassification: DocumentClassification;
7
}
modules/uoa-repository-manager-service/trunk/app/shared/models/status-per-document.interface.ts
1
import { LookupData } from './lookup-data.interface';
2
import { ReceivedFiles } from './receivedFiles.interface';
3

  
4
export interface StatusPerDocument {
5
  statusPerDocRecId: number;
6
  batchId: number;
7
  documentStatusLastUpdate: Date;
8
  documentCurrentStatusId: LookupData;
9
  receivedFile: ReceivedFiles;
10
}
modules/uoa-repository-manager-service/trunk/app/shared/models/verification-rule.interface.ts
1
import { Template } from './template.interface';
2
import { DocumentClassification } from './document-classification.interface';
3
import { IPowerClient } from './ipower-client.interface';
4
import { CapturingVerification } from './capturing-verification.interface';
5
import { JournalVerification } from './journal-verification.interface';
6

  
7
export interface VerificationRule {
8
  id: number;
9
  confidenceLevelMinThreshold: number;
10
  alteryxRoutineId: string;
11
  verificationRuleStatus: string;
12
  client: IPowerClient;
13
  docClassificationCategory: DocumentClassification
14
  template: Template;
15
  capturingVerification: CapturingVerification;
16
  journalVerification: JournalVerification;
17
}
modules/uoa-repository-manager-service/trunk/app/shared/models/inbox-search-criteria.interface.ts
1
import {FILE_TYPE} from '../enums/FILE_TYPE.enum';
2

  
3
export interface InboxSearchCriteriaInterface {
4
  receivedFrom: Date;
5
  receivedTo: Date;
6
  fileCode: string;
7
  fileType: FILE_TYPE;
8
  //TODO change me in the future front and back
9
  ignore_status: boolean;
10
  ipowerClientName: string;
11
  ipowerClientCode: string;
12
  personalData: boolean;
13
  userId: string;
14
}
modules/uoa-repository-manager-service/trunk/app/shared/models/invoice-master-data.interface.ts
1
export interface InvoiceMasterData {
2
  id: number;
3
  supplierName: string;
4
  supplierTaxCode: string;
5
  customerName: string;
6
  customerTaxCode: string;
7
  invoiceNumber: string;
8
  invoiceType: string;
9
  invoiceIssueDate: Date;
10
  deliveryAddress: string;
11
  totalPriceBeforeDiscount: number;
12
  discountPercentage: number;
13
  discountAmount: number;
14
  totalPriceBeforeVat: number;
15
  vatRate: number;
16
  vatCode: number;
17
  vatAmount: number;
18
  totalAmount: number;
19
  totalAmountInBaseCurrency: number;
20
  numberOfDetailLines: number;
21
}
22

  
modules/uoa-repository-manager-service/trunk/app/shared/models/chart.interface.ts
1
export interface PieModel {
2
  labels: string[];
3
  datasets: dataset[];
4
}
5

  
6
export interface dataset {
7
  data: number[];
8
  backgroundColor: string[];
9
  hoverBackgroundColor: string[];
10
}
modules/uoa-repository-manager-service/trunk/app/shared/models/alteryx-exception.interface.ts
1
import {Record} from './record.interface';
2
import {LookupData} from './lookup-data.interface';
3

  
4
export interface AlteryxException {
5

  
6
  id: number;
7
  record: Record[];
8
  alteryxExceptionStatus: LookupData;
9
  alteryxRoutineId: number;
10
  alteryxExceptionDescription: string;
11
}
modules/uoa-repository-manager-service/trunk/app/shared/models/i-power-assignment.interface.ts
1
export interface IPowerAssignment {
2
  id: number;
3
  name: string;
4
  description: string;
5
  status: string;
6
}
modules/uoa-repository-manager-service/trunk/app/shared/models/invoice-processes-router-params.interface.ts
1
export interface InvoiceProcessesRouterParams {
2
  clientCode: string;
3
  docClassification: number;
4
}
modules/uoa-repository-manager-service/trunk/app/app.component.spec.ts
1
import { TestBed } from '@angular/core/testing';
2
import { RouterTestingModule } from '@angular/router/testing';
3
import { AppComponent } from './app.component';
4

  
5
describe('AppComponent', () => {
6
  beforeEach(async () => {
7
    await TestBed.configureTestingModule({
8
      imports: [
9
        RouterTestingModule
10
      ],
11
      declarations: [
12
        AppComponent
13
      ],
14
    }).compileComponents();
15
  });
16

  
17
  it('should create the app', () => {
18
    const fixture = TestBed.createComponent(AppComponent);
19
    const app = fixture.componentInstance;
20
    expect(app).toBeTruthy();
21
  });
22

  
23
  it(`should have as title 'RTA-Admin-UI'`, () => {
24
    const fixture = TestBed.createComponent(AppComponent);
25
    const app = fixture.componentInstance;
26
    expect(app.title).toEqual('RTA-Admin-UI');
27
  });
28

  
29
  it('should render title', () => {
30
    const fixture = TestBed.createComponent(AppComponent);
31
    fixture.detectChanges();
32
    const compiled = fixture.nativeElement;
33
    expect(compiled.querySelector('.content span').textContent).toContain('RTA-Admin-UI app is running!');
34
  });
35
});
modules/uoa-repository-manager-service/trunk/app/shared/models/search-response.interface.ts
1
export interface SearchResponse<T> {
2
    totalPages: number;
3
    totalElements: number;
4
    data: T[];
5
  }
modules/uoa-repository-manager-service/trunk/app/app.component.html
1
<p-toast preventOpenDuplicates="true"></p-toast>
2
<div class="container">
3
  <div class="p-grid p-nogutter">
4
    <div class="p-col-12">
5
      <app-header></app-header>
6
      <app-main-page></app-main-page>
7
    </div>
8
  </div>
9
</div>
modules/uoa-repository-manager-service/trunk/app/app.component.ts
1
import { AuthService } from './shared/services/auth.service';
2
import { Component, OnInit } from '@angular/core';
3
import { PrimeNGConfig } from 'primeng/api';
4

  
5
@Component({
6
  selector: 'app-root',
7
  templateUrl: './app.component.html',
8
  styleUrls: ['./app.component.scss']
9
})
10
export class AppComponent implements OnInit {
11

  
12
  constructor(private primengConfig: PrimeNGConfig, private authService: AuthService) { }
13

  
14

  
15
  ngOnInit(): void {
16
    this.primengConfig.ripple = true;
17
    this.authService.initializeOAuth2Login();
18
  }
19
}
modules/uoa-repository-manager-service/trunk/app/shared/models/process-status.interface.ts
1

  
2
export interface ProcessStatus {
3
  id: number;
4
  name: string;
5
}
modules/uoa-repository-manager-service/trunk/app/shared/shared.module.ts
1
import { TranslateModule } from '@ngx-translate/core';
2
import { NgModule } from '@angular/core';
3
import { CommonModule } from '@angular/common';
4
import { HttpClientModule } from '@angular/common/http';
5
import { ValidationMessageComponent } from './utils/components/validation-message/validation-message.component';
6
import { HourMinutesSecsPipe } from './pipes/hour-minutes-secs.pipe';
7

  
8
@NgModule({
9
  declarations: [ValidationMessageComponent, HourMinutesSecsPipe],
10
  imports: [
11
    CommonModule,
12
    HttpClientModule
13
  ],
14
  exports: [
15
    TranslateModule,
16
    ValidationMessageComponent,
17
    HourMinutesSecsPipe
18
  ]
19
})
20

  
21
export class SharedModule {
22
}
modules/uoa-repository-manager-service/trunk/app/shared/models/pwc-user-interface.ts
1
export interface PwcUser {
2
  email?: string;
3
  cloudEmail?: string;
4
  preferredMail?: string;
5
  guid: string;
6
}
modules/uoa-repository-manager-service/trunk/app/shared/models/card-item.interface.ts
1
export interface CardItem {
2
  title: string;
3
  subtitle: string;
4
  headerImage: string;
5
  footerImage: string;
6
  path: string;
7
}
modules/uoa-repository-manager-service/trunk/app/shared/pipes/hour-minutes-secs.pipe.spec.ts
1
import { HourMinutesSecsPipe } from './hour-minutes-secs.pipe';
2

  
3
describe('HourMinutesSecsPipe', () => {
4
  it('create an instance', () => {
5
    const pipe = new HourMinutesSecsPipe();
6
    expect(pipe).toBeTruthy();
7
  });
8
});
modules/uoa-repository-manager-service/trunk/app/shared/models/request/assign-update-role.interface.ts
1
import { RtaUser } from './../rta-user.interface';
2
import { Role } from '../role.interface';
3
import { IPowerClient } from 'src/app/shared/models/ipower-client.interface';
4
import { UserAccess } from '../user-access.interface';
5

  
6
export interface AssignUpdateRole {
7
  id: number;
8
  ipowerClient: IPowerClient;
9
  role: Role;
10
  users: RtaUser;
11
}
modules/uoa-repository-manager-service/trunk/app/shared/models/invoice-process.interface.ts
1
import {FilesPerProcess} from './files-per-process.interface';
2
import {LookupData} from './lookup-data.interface';
3

  
4
export interface InvoiceProcess {
5
  id: number;
6
  processCreationDatetime: Date;
7
  documentClassificationId: number;
8
  processStatus: LookupData;
9
  userId: string;
10
  filesPerProcess: FilesPerProcess[];
11
}
modules/uoa-repository-manager-service/trunk/app/shared/models/request/search-system-exceptions.interface.ts
1
import { IPowerClient } from "../ipower-client.interface";
2

  
3
export interface SearchSystemException {
4
  processId: number;
5
  jobName: string;
6
  dmsFileCode: string;
7
  dateFrom: Date;
8
  dateTo: Date;
9
  clientId: IPowerClient;
10
}
modules/uoa-repository-manager-service/trunk/app/shared/models/full-invoice-process.interface.ts
1
import {LookupData} from './lookup-data.interface';
2
import {JournalEntry} from './journal-entry.interface';
3
import {AlteryxException} from './alteryx-exception.interface';
4
import {AlteryxUnhandledData} from './alteryx-unhandled-data.interface';
5
import {FilesPerProcess} from './files-per-process.interface';
6
import {ProcessFailedRecord} from './process-failed-record.interface';
7

  
8
export interface FullInvoiceProcess {
9
  id: number;
10
  processCreationDatetime: Date;
11
  documentClassificationId: number;
12
  processStatus: LookupData;
13
  userId: string;
14
  filesPerProcess: FilesPerProcess[];
15
  recordsPerProcess: any;
16
  journalEntries: JournalEntry[];
17
  alteryxExceptions: AlteryxException[];
18
  alteryxUnhandled: AlteryxUnhandledData[];
19
  failedRecords: ProcessFailedRecord[];
20
}
modules/uoa-repository-manager-service/trunk/app/shared/models/vertical-menu.interface.ts
1
import { MenuItem } from 'primeng/api';
2

  
3
export interface VerticalMenu {
4
  title: string;
5
  items: MenuItem[];
6
}
modules/uoa-repository-manager-service/trunk/app/shared/pipes/hour-minutes-secs.pipe.ts
1
import { Pipe, PipeTransform } from '@angular/core';
2

  
3
@Pipe({
4
  name: 'hourMinutesSecs'
5
})
6
export class HourMinutesSecsPipe implements PipeTransform {
7

  
8
  transform(totalSeconds: number, ...args: unknown[]): unknown {
9
    const hours = Math.floor(totalSeconds / 3600);
10
    const minutes = Math.floor((totalSeconds % 3600) / 60);
11
    const seconds = totalSeconds % 60;
12
    let result = `${minutes
13
      .toString()
14
      .padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
15
    if (!!hours) {
16
      result = `${hours.toString().padStart(2, '0')}:${minutes
17
        .toString()
18
        .padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
19
    }
20
    return result;
21
  }
22

  
23
}
modules/uoa-repository-manager-service/trunk/app/shared/utils/utils.service.ts
1
import { FILE_TYPE } from './../enums/FILE_TYPE.enum';
2
import { Injectable } from '@angular/core';
3

  
4
@Injectable({
5
  providedIn: 'root'
6
})
7
export class UtilsService {
8

  
9
  constructor() { }
10

  
11
  public base64ToFile(base64Data: string, contentType: FILE_TYPE): Blob {
12
    const byteString = window.atob(base64Data);
13
    const arrayBuffer = new ArrayBuffer(byteString.length);
14
    const int8Array = new Uint8Array(arrayBuffer);
15
    for (let i = 0; i < byteString.length; i++) {
16
      int8Array[i] = byteString.charCodeAt(i);
17
    }
18
    const blob = new Blob([int8Array], { type: this.convertContentType(contentType) });
19
    return blob;
20
  }
21

  
22
  public convertContentType(type: FILE_TYPE): string {
23
    switch (type) {
24
      case FILE_TYPE.DOC:
25
        return 'application/msword';
26
      case FILE_TYPE.DOCX:
27
        return 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
28
      case FILE_TYPE.PDF:
29
        return 'application/pdf';
30
      case FILE_TYPE.PNG:
31
        return 'image/png';
32
      case FILE_TYPE.XLS:
33
        return 'application/vnd.ms-excel';
34
      case FILE_TYPE.XLSX:
35
        return 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
36
    }
37
  }
38
}
modules/uoa-repository-manager-service/trunk/app/shared/models/rights-category.interface.ts
1
import { Right } from 'src/app/shared/models';
2
export interface RightsCategory {
3
  id: number;
4
  name: string;
5
  rights: Right[];
6
}
modules/uoa-repository-manager-service/trunk/app/shared/utils/components/validation-message/validation-message.component.html
1
<div *ngIf="displayMessage">
2
  <p class="validation-message">{{validationMessage}}</p>
3
</div>
modules/uoa-repository-manager-service/trunk/app/shared/utils/components/validation-message/validation-message.component.ts
1
import { Component, Input, OnInit } from '@angular/core';
2
import { FormControl } from '@angular/forms';
3

  
4
@Component({
5
  selector: 'app-validation-message',
6
  templateUrl: './validation-message.component.html',
7
  styleUrls: ['./validation-message.component.scss']
8
})
9
export class ValidationMessageComponent implements OnInit {
10

  
11
  @Input() control: FormControl;
12
  @Input() validationMessage: String;
13

  
14
  @Input() set displayEvenIfPristine(val: boolean) {
15
    this._displayEvenIfPristine = val;
16
    this.shouldMessageBeShown();
17
  }
18

  
19
  _displayEvenIfPristine: boolean
20

  
21
  displayMessage: boolean;
22

  
23
  constructor() { }
24

  
25
  ngOnInit(): void {
26
    this.shouldMessageBeShown();
27
    this.control.statusChanges.subscribe(() => this.shouldMessageBeShown());
28
  }
29

  
30
  shouldMessageBeShown() {
31
    let temp = this.control.invalid && (this.control.dirty || this.control.touched || this._displayEvenIfPristine);
32

  
33
    this.displayMessage = temp;
34
  }
35
}
modules/uoa-repository-manager-service/trunk/app/shared/utils/components/validation-message/validation-message.component.scss
1
@import 'src/styles';
2

  
3
.validation-message{
4
  color: red;
5
  font-size: 90%;
6
  margin: 0px;
7
  padding: 0px;
8
}
modules/uoa-repository-manager-service/trunk/app/shared/utils/components/validation-message/validation-message.component.spec.ts
1
import { ComponentFixture, TestBed } from '@angular/core/testing';
2

  
3
import { ValidationMessageComponent } from './validation-message.component';
4

  
5
describe('ValidationMessageComponent', () => {
6
  let component: ValidationMessageComponent;
7
  let fixture: ComponentFixture<ValidationMessageComponent>;
8

  
9
  beforeEach(async () => {
10
    await TestBed.configureTestingModule({
11
      declarations: [ ValidationMessageComponent ]
12
    })
13
    .compileComponents();
14
  });
15

  
16
  beforeEach(() => {
17
    fixture = TestBed.createComponent(ValidationMessageComponent);
18
    component = fixture.componentInstance;
19
    fixture.detectChanges();
20
  });
21

  
22
  it('should create', () => {
23
    expect(component).toBeTruthy();
24
  });
25
});
modules/uoa-repository-manager-service/trunk/app/shared/models/downloading-procedure-metadata.interface.ts
1
import {LookupData} from './lookup-data.interface';
2
import {ReceivedFile} from './inbox-document.interface';
3

  
4
export interface DownloadingProcedureMetadata {
5
  id: number;
6
  downloadingProcedureStart: Date;
7
  downloadingProcedureFinish: Date;
8
  downloadingProcedureStatusId: LookupData;
9
  estimatedTime: Date;
10
  receivedFiles: ReceivedFile[];
11
}
modules/uoa-repository-manager-service/trunk/app/shared/models/capturing-verification.interface.ts
1
export interface CapturingVerification {
2
  id: number;
3
  capturingVerificationsName: string;
4
}
modules/uoa-repository-manager-service/trunk/app/shared/models/ipower-client.interface.ts
1
export interface IPowerClient {
2
  id: string;
3
  name: string;
4
  status: string;
5
  clientCode: string;
6
  bcServer: string;
7
  bcPort: string;
8
  bcDbInstance: string;
9
  hotFolderId: string;
10
  confidenceMinLvl: number;
11
  confidenceMaxLvl: number;
12
}
modules/uoa-repository-manager-service/trunk/app/shared/models/configurator-parameter.interface.ts
1

  
2
export interface ConfiguratorParameter {
3
  configurationId: number;
4
  configurationVariable: string;
5
  variableType: string;
6
  integerValue: number;
7
  stringValue: string;
8
}
modules/uoa-repository-manager-service/trunk/app/shared/models/dashboard-section.interface.ts
1
import { PieModel } from './chart.interface';
2

  
3
export interface DashboardSection {
4
  type: string;
5
  totalClients: number;
6
  totalProcesses: number;
7
  totalExceptions: number;
8
  totalUnhandled: number;
9
  totalPages: number;
10
  totalElements: number;
11
  pie?: PieModel;
12
  selectedElements: number;
13
  selectedPage: number;
14
  resultsLoading: boolean;
15
  aggregatedResults: ProcessesPerClient[];
16
}
17

  
18
export interface ProcessesPerClient {
19
  clientName?: string;
20
  clientId: string;
21
  processesNumber: number;
22
  unhandledNumber: number;
23
  exceptionsNumber: number;
24
}
modules/uoa-repository-manager-service/trunk/app/shared/models/user-access.interface.ts
1
import { RtaUser } from './rta-user.interface';
2
import { Role } from './role.interface';
3
import { IPowerClient } from 'src/app/shared/models/ipower-client.interface';
4
import { USER_ACCESS_STATUS } from '../enums/USER_ACCESS_STATUS.enum';
5

  
6
export interface UserAccess {
7
  id: number;
8
  ipowerClient: IPowerClient;
9
  role: Role;
10
  users: RtaUser;
11
  status: USER_ACCESS_STATUS;
12
}
modules/uoa-repository-manager-service/trunk/app/shared/models/administration-section.interface.ts
1
import { CardItem } from "./card-item.interface";
2

  
3
export interface AdministrationSection {
4
  title: string;
5
  subSections: CardItem[];
6
}
modules/uoa-repository-manager-service/trunk/app/shared/services/invoice-processes.service.ts
1
import { environment } from 'src/environments/environment';
2
import { Injectable } from '@angular/core';
3
import { GenericRestService } from './generic-rest.service';
4
import { LookupData } from '../models/lookup-data.interface';
5
import { HttpClient } from '@angular/common/http';
6
import { Observable, of, } from 'rxjs';
7
import { FullInvoiceProcess } from '../models/full-invoice-process.interface';
8
import { InvoiceProcess } from '../models/invoice-process.interface';
9
import { AlteryxUnhandledData } from '../models/alteryx-unhandled-data.interface';
10
import { InvoiceMasterData } from '../models/invoice-master-data.interface';
11
import { SentStringInterface } from '../models/sentString.interface';
12
import {JournalEntry} from "../models/journal-entry.interface";
13
import {AlteryxException} from "../models/alteryx-exception.interface";
14
import {ProcessFailedRecord} from "../models/process-failed-record.interface";
15
import {ProcessHistory} from "../models/process-history.interface";
16

  
17
@Injectable({
18
  providedIn: 'root'
19
})
20
export class InvoiceProcessesService extends GenericRestService<InvoiceProcess> {
21

  
22
  constructor(private http: HttpClient) {
23
    super(`${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}/processes`, http);
24
  }
25

  
26
  getAllStatuses(): Observable<LookupData> {
27
    return this.http.get<LookupData>(this.baseUrl + '/process-status/all');
28
  }
29

  
30
  getAllFileTypes(): Observable<string[]> {
31
    return of(['XL', 'PDF', 'DOCX']);
32
  }
33

  
34
  getFullInvoiceProcessById(invoiceProcessId: number): Observable<FullInvoiceProcess> {
35
    return this.http.get<FullInvoiceProcess>(this.baseUrl + '/full/' + invoiceProcessId.toString());
36
  }
37

  
38
  getIframe(invoiceProcessId: string): Observable<string> {
39
    return this.http.get<string>(
40
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}/abbyy` + '/verify/' + invoiceProcessId.toString());
41
  }
42

  
43
  getAssignToUsersDistinct(username: string): Observable<string[]> {
44
    return this.http.get<string[]>(
45
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}/processes/search-username/` + username.toString());
46
  }
47

  
48
  reclassifyRecords(id: string, selectedClassification: any, selectedSubClassification: any): Observable<InvoiceMasterData> {
49
    return this.http.post<any>(
50
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}` +
51
      '/alteryx/reclassify/' + id, '', {
52
      params: {
53
        docClassificationId: selectedClassification,
54
        docSubClassificationId: selectedSubClassification
55
      }
56
    });
57
  }
58

  
59
  recalculateException(id: number): Observable<any> {
60
    return this.http.post<any>(
61
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}` +
62
      '/alteryx/recalculate-exception/' + id, ''
63
    );
64
  }
65

  
66
  updateVerificationCompletedForProcess(id: number): Observable<any> {
67
    return this.http.get(
68
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}` +
69
      '/abbyy/verification-completed/' + id
70
    );
71
  }
72

  
73
  downloadFile(id: number): Observable<string> {
74
    return this.http.get(
75
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}` +
76
      '/processes/download-file/' + id, { responseType: 'text' }
77
    );
78
  }
79

  
80
  assignProcess(id: number, name: string): any {
81
    return this.http.put(
82
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}` +
83
      '/processes/assign-process?processId=' + id + '&username=' + name, '', {responseType: 'text'}
84
    );
85
  }
86

  
87
  unassignProcess(id: number): any {
88
    return this.http.put(
89
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}` +
90
      '/processes/assign-process?processId=' + id, '', {responseType: 'text'}
91
    );
92
  }
93

  
94
  refreshJournalEntries(processId: number): Observable<JournalEntry[]> {
95
    return this.http.get<JournalEntry[]>(
96
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}` +
97
      '/processes/refresh-journal/' + processId
98
    );
99
  }
100

  
101
  refreshAlteryxExceptions(processId: number): Observable<AlteryxException[]> {
102
    return this.http.get<AlteryxException[]>(
103
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}` +
104
      '/processes/refresh-alteryx-exceptions/' + processId
105
    );
106
  }
107

  
108
  refreshAlteryxUnhandled(processId: number): Observable<AlteryxUnhandledData[]> {
109
    return this.http.get<AlteryxUnhandledData[]>(
110
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}` +
111
      '/processes/refresh-alteryx-unhandled/' + processId
112
    );
113
  }
114

  
115
  sendProcessToAlteryxRecalculation(id: number): any {
116
    return this.http.put(
117
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}` +
118
      '/processes/send-to-alteryx-recalculation/' + id , '', {responseType: 'text'}
119
    );
120
  }
121

  
122
  sendProcessToAbbyyVerification(id: number): any {
123
    return this.http.put(
124
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}` +
125
      '/processes/send-to-abbyy-verification/' + id , '' , {responseType: 'text'}
126
    );
127
  }
128

  
129
  setProcessCanceled(id: number): any {
130
    return this.http.put(
131
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}` +
132
      '/processes/set-canceled/' + id , '' , {responseType: 'text'}
133
    );
134
  }
135

  
136
  setProcessCompleted(id: number): any {
137
    return this.http.put(
138
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}` +
139
      '/processes/set-completed/' + id , '' , {responseType: 'text'}
140
    );
141
  }
142

  
143
  getProcessHistory(processId: number): Observable<ProcessHistory[]> {
144
    return this.http.get<ProcessHistory[]>(
145
      `${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}` +
146
      '/processes/process-history/' + processId
147
    );
148
  }
149
}
modules/uoa-repository-manager-service/trunk/app/shared/services/auth.service.ts
1
import { USER_RIGHTS } from './../enums/USER_RIGHTS.enum';
2
import { IPowerClient } from './../models/ipower-client.interface';
3
import { RightsByClient } from './../models/rights-by-client.interface';
4
import { RtaUser } from './../models/rta-user.interface';
5
import { environment } from 'src/environments/environment';
6
import { ApiService } from './api.service';
7
import { PwcUser } from './../models/pwc-user-interface';
8
import { authCodeFlowConfig } from '../auth-codeflow-config';
9
import { OAuthService } from 'angular-oauth2-oidc';
10
import { EventEmitter, Injectable, Output } from '@angular/core';
11
import { Router } from '@angular/router';
12
import { BehaviorSubject, ReplaySubject, Observable, combineLatest, from, interval } from 'rxjs';
13
import { catchError, filter, map, mergeMap } from 'rxjs/operators';
14
import { Right } from '../models';
15
import { UserAccess } from '../models/user-access.interface';
16
import { USER_ACCESS_STATUS } from '../enums/USER_ACCESS_STATUS.enum';
17

  
18
@Injectable({
19
  providedIn: 'root'
20
})
21
export class AuthService {
22

  
23
  @Output() authStatusChanged = new EventEmitter<boolean>();
24

  
25
  private isAuthenticatedSubject$ = new BehaviorSubject<boolean>(false);
26
  public isAuthenticated$ = this.isAuthenticatedSubject$.asObservable();
27

  
28
  private isDoneLoadingSubject$ = new ReplaySubject<boolean>();
29
  public isDoneLoading$ = this.isDoneLoadingSubject$.asObservable();
30

  
31
  public tokenExpiresInSec$ = new BehaviorSubject(0);
32

  
33
  private loggedInUserDetails: RtaUser;
34
  private loggedInUserRights: RightsByClient[] = [];
35

  
36
  /**
37
   * Publishes "true" only if all the asynchronous initial login calls have completed and the user ended up being authenticated.
38
   * Essentially, it combines:
39
   * - the latest known status of the user (whether they are authorized)
40
   * - whether all the oauth2 shenanigan calls have been completed :P
41
   */
42
  public canActivateProtectedRoutes$: Observable<boolean> = combineLatest([
43
    this.isAuthenticated$,
44
    this.isDoneLoading$
45
  ]).pipe(
46
    map(values => values.every(b => b))
47
  );
48

  
49
  constructor(private router: Router, private oauthService: OAuthService, private api: ApiService) {
50

  
51
    this.oauthService.events
52
      .subscribe(_ => {
53
        this.isAuthenticatedSubject$.next(this.oauthService.hasValidAccessToken());
54
      });
55

  
56
    this.oauthService.events
57
      .pipe(filter(e => ['token_received'].includes(e.type)))
58
      .subscribe(e => this.oauthService.loadUserProfile());
59

  
60
    this.oauthService.events
61
      .pipe(filter(e => ['session_terminated', 'session_error'].includes(e.type)))
62
      .subscribe(e => this.navigateToLoginPage());
63
  }
64

  
65
  private navigateToLoginPage(): void {
66
    this.router.navigateByUrl('/login');
67
  }
68

  
69
  public initializeOAuth2Login(): void {
70
    this.oauthService.configure(authCodeFlowConfig);
71

  
72
    from(this.oauthService.loadDiscoveryDocument())
73
      .pipe(
74
        mergeMap((successEvent) => {
75
          console.log('successEvent', successEvent);
76
          return from(this.oauthService.tryLoginImplicitFlow());
77
        }),
78
        // @TODO: Handle errors
79
        catchError((err) => {
80
          return err;
81
        })
82
      ).subscribe(() => {
83
        if (!this.oauthService.hasValidAccessToken()) {
84
          if (environment.oAuth2.autoLogin) {
85
            this.oauthService.initImplicitFlow();
86
          }
87
          else {
88
            this.authStatusChanged.emit(false);
89
          }
90
        } else {
91
          // Succesfully authenticated :)
92
          this.authStatusChanged.emit(true);
93
          this.getUserDetails();
94
        }
95
      });
96
  }
97

  
98
  public getUserDetails(): void {
99
    const email = environment.staging || environment.production ?
100
      (this.oauthService.getIdentityClaims() as PwcUser).cloudEmail :
101
        (this.oauthService.getIdentityClaims() as PwcUser).email;
102

  
103
    // Request only the ACTIVE UserAccess relations of the user.
104
    this.api.getUserByEmail(email, USER_ACCESS_STATUS.ACTIVE).subscribe((result) => {
105
      this.loggedInUserDetails = result;
106

  
107
      // Process the received user data and assign a proper value to 'this.loggedInUserRights'.
108
      this.assignLoggedInUserRights(result);
109

  
110
      this.isDoneLoadingSubject$.next(true);
111

  
112
      this.startTokenExpirationCounter();
113

  
114
      console.log('Logged-in User\'s Rights', this.userRights);
115
    },
116
      err => {
117
        // @TODO: Handle errors
118
        console.log(err);
119
        this.isDoneLoadingSubject$.next(true);
120
      });
121
  }
122

  
123
  private assignLoggedInUserRights(user: RtaUser) {
124

  
125
    // ClientId to RightsByClient.
126
    let rightsPerClientMap: Map<string, RightsByClient> = new Map();
127

  
128
    user.userAccessUsers.forEach(ua => {
129

  
130
      // If we don't have an entry for this client, create it. Initialise it with the client, but no rights.
131
      if (!rightsPerClientMap.has(ua.ipowerClient.id)) {
132
        let newEntry: RightsByClient = {
133
          client: ua.ipowerClient,
134
          rights: []
135
        }
136
        rightsPerClientMap.set(ua.ipowerClient.id, newEntry);
137
      }
138

  
139
      // Now, regardless of whether the entry existed or not, add the rights.   -Map does not
140
      rightsPerClientMap.get(ua.ipowerClient.id).rights = rightsPerClientMap.get(ua.ipowerClient.id).rights.concat(ua.role.rightsList);
141
    });
142

  
143
    // Finally, pass them all unto the 'loggedInUserRights' variable.
144
    this.loggedInUserRights = [];
145
    rightsPerClientMap.forEach((value, key) => this.loggedInUserRights.push(value));
146
  }
147

  
148
  // This is mostly useful if "autoLogin" is false in environment, so we manually trigger the final step of the OAuth2 login flow.
149
  login(targetUrl?: string): void {
150
    this.oauthService.initLoginFlow(targetUrl || this.router.url);
151
  }
152

  
153
  logout(): void {
154
    this.loggedInUserDetails = null;
155
    this.loggedInUserRights = null;
156
    this.oauthService.logOut(true);
157

  
158
    this.authStatusChanged.emit(false);
159
    this.router.navigateByUrl('/login');
160
  }
161

  
162
  isLoggedIn(): boolean {
163
    return this.oauthService.hasValidAccessToken();
164
  }
165

  
166
  startTokenExpirationCounter(): void {
167
    const expiringAt = this.oauthService.getAccessTokenExpiration() ? this.oauthService.getAccessTokenExpiration() : Date.now();
168
    const now = Date.now();
169

  
170
    let remainingSecs = Math.floor(expiringAt / 1000) - Math.floor(now / 1000);
171
    const secondsCounter = interval(1000);
172
    // Subscribe to begin publishing values
173
    const subscription = secondsCounter.subscribe(n => {
174
      remainingSecs = remainingSecs > 0 ? remainingSecs - 1 : remainingSecs;
175
      this.tokenExpiresInSec$.next(remainingSecs);
176
    });
177

  
178
  }
179

  
180
  /*
181
   * Public Methods
182
   */
183
  public get userDetails(): RtaUser { return this.loggedInUserDetails; }
184
  public get userRights(): RightsByClient[] { return this.loggedInUserRights; }
185
  public userHasRightForClient(right: USER_RIGHTS, clientId: string): boolean {
186
    // return true;   // Bypass. Also has to be set in USER_RIGHTS.isGrantedToUser()
187
    return this.userRights.find(rdc => rdc.client.id == clientId)?.rights?.find(r => r.code == right.code) != null;
188
  }
189
}
modules/uoa-repository-manager-service/trunk/app/shared/utils/utils.service.spec.ts
1
import { TestBed } from '@angular/core/testing';
2

  
3
import { UtilsService } from './utils.service';
4

  
5
describe('UtilsService', () => {
6
  let service: UtilsService;
7

  
8
  beforeEach(() => {
9
    TestBed.configureTestingModule({});
10
    service = TestBed.inject(UtilsService);
11
  });
12

  
13
  it('should be created', () => {
14
    expect(service).toBeTruthy();
15
  });
16
});
modules/uoa-repository-manager-service/trunk/app/shared/models/inbox-batch.interface.ts
1
import {ReceivedFile} from './inbox-document.interface';
2
import {LookupData} from './lookup-data.interface';
3
import { ReceivedFiles } from './receivedFiles.interface';
4

  
5

  
6
export interface InboxBatch {
7
  batchId: number;
8
  documentCurrentStatusId: LookupData;
9
  documentStatusLastUpdate: Date;
10
  statusPerDocRecId: number;
11
  receivedFile: ReceivedFiles;
12
}
modules/uoa-repository-manager-service/trunk/app/shared/models/alteryx-unhandled-data.interface.ts
1
import {Record} from './record.interface';
2
import {LookupData} from './lookup-data.interface';
3

  
4
export interface AlteryxUnhandledData {
5
  id:string;
6
  record: Record;
7
  alteryxUnhandledStatus: LookupData;
8
}
9

  
modules/uoa-repository-manager-service/trunk/app/shared/models/role.interface.ts
1
import { UserAccess } from './user-access.interface';
2
import { Right } from './index';
3

  
4
export interface Role {
5
  id: number;
6
  name: string;
7
  description: string;
8
  readOnly: boolean;
9
  status: boolean;
10
  canBeDeleted: boolean;
11
  isGlobal: boolean;
12
  rightsList: Right[];
13
  userAccessRoles: UserAccess[];
14
}
modules/uoa-repository-manager-service/trunk/app/shared/models/files-per-process.interface.ts
1
import {ReceivedFile} from './inbox-document.interface';
2

  
3
export interface FilesPerProcess {
4
  id: number;
5
  receivedFile: ReceivedFile;
6
}
7

  
modules/uoa-repository-manager-service/trunk/app/shared/models/rta-user.interface.ts
1
import { UserAccess } from './user-access.interface';
2
export interface RtaUser {
3
  id: number;
4
  name: string;
5
  surname: string;
6
  email: string;
7
  status: string;
8
  userCode: string;
9
  userAccessUsers: UserAccess[];
10
}
modules/uoa-repository-manager-service/trunk/app/shared/models/index.ts
1
export * from './role.interface';
2
export * from './right.interface';
3
export * from './i-power-assignment.interface';
modules/uoa-repository-manager-service/trunk/app/shared/services/administration/application-level-exception.spec.ts
1
import { TestBed } from '@angular/core/testing';
2
import { ApplicationLevelExceptionService } from './application-level-exception.service';
3

  
4

  
5
describe('ApplicationLevelExceptionService', () => {
6
  let service: ApplicationLevelExceptionService;
7

  
8
  beforeEach(() => {
9
    TestBed.configureTestingModule({});
10
    service = TestBed.inject(ApplicationLevelExceptionService);
11
  });
12

  
13
  it('should be created', () => {
14
    expect(service).toBeTruthy();
15
  });
16
});
modules/uoa-repository-manager-service/trunk/app/shared/models/journal-entry.interface.ts
1
import { LookupData } from './lookup-data.interface';
2

  
3
export interface JournalEntry {
4
  id: number;
5
  recordId: number;
6
  journalEntriesStatus: LookupData;
7
  postingDate: Date;
8
  documentType: string;
9
  documentNo: string;
10
  accountType: string;
11
  accountNo: string;
12
  description: string;
13
  eu3PartyTrade: string;
14
  genPostingType: string;
15
  genBusPostingGroup: string;
16
  genProdPostingGroup: string;
17
  vatBusPostingGroup: string;
18
  vatProdPostingGroup: string;
19
  deferralCode: number;
20
  currencyCode: string;
21
  vatBaseAmount: number;
22
  vatAmount: number;
23
  amount: number;
24
  amountLCY: number;
25
  balAccountType: string;
26
  balAccountNo: string;
27
  balGenPostingType: string;
28
  externalDocumentNo: string;
29
  dmsCodeNo: string;
30
  correction: string;
31
  comment: string;
32
  shortcutDimension1Code: string;
33
  shortcutDimension2Code: string;
34
  shortcutDimension3Code: string;
35
  shortcutDimension4Code: string;
36
  shortcutDimension5Code: string;
37
  shortcutDimension6Code: string;
38
  shortcutDimension7Code: string;
39
  shortcutDimension8Code: string;
40
  shortcutDimension9Code: string;
41
  shortcutDimension10Code: string;
42
  applied: string;
43
  appliedAutomatically: string;
44
  appliesToDocNo: string;
45
  appliesToDocType: string;
46
  appliesToExtDocNo: string;
47
  appliesToId: string;
48
}
modules/uoa-repository-manager-service/trunk/app/shared/models/journal-verification.interface.ts
1
export interface JournalVerification {
2
  id: number;
3
  journalVerificationsName: string;
4
}
modules/uoa-repository-manager-service/trunk/app/shared/services/administration/verification-rules.service.spec.ts
1
import { TestBed } from '@angular/core/testing';
2

  
3
import { VerificationRulesService } from './verification-rules.service';
4

  
5
describe('VerificationRulesServiceService', () => {
6
  let service: VerificationRulesService;
7

  
8
  beforeEach(() => {
9
    TestBed.configureTestingModule({});
10
    service = TestBed.inject(VerificationRulesService);
11
  });
12

  
13
  it('should be created', () => {
14
    expect(service).toBeTruthy();
15
  });
16
});
modules/uoa-repository-manager-service/trunk/app/shared/services/administration/journal-verifications.service.spec.ts
1
import { TestBed } from '@angular/core/testing';
2

  
3
import { JournalVerificationsService } from './journal-verifications.service';
4

  
5
describe('JournalVerificationsService', () => {
6
  let service: JournalVerificationsService;
7

  
8
  beforeEach(() => {
9
    TestBed.configureTestingModule({});
10
    service = TestBed.inject(JournalVerificationsService);
11
  });
12

  
13
  it('should be created', () => {
14
    expect(service).toBeTruthy();
15
  });
16
});
modules/uoa-repository-manager-service/trunk/app/shared/models/receivedFiles.interface.ts
1
import { FILE_TYPE } from '../enums/FILE_TYPE.enum';
2
import { DownloadingProcedureMetadata } from './downloading-procedure-metadata.interface';
3

  
4
export interface ReceivedFiles {
5
  id: number;
6
  downloadingProcedureMetadata: DownloadingProcedureMetadata;
7
  dmsFileCode: string;
8
  dmsFileName: string;
9
  dmsFileType: FILE_TYPE;
10
  dmsPersonalData: boolean;
11
  dmsClientCode: string;
12
  rtaReceivedDate: Date;
13
  dmsInsertedDate: Date;
14
  rtaFolderPath: string;
15
  dmsDocumentNumber : string;
16
  rtaFileName: string;
17
}
modules/uoa-repository-manager-service/trunk/app/shared/services/administration/document-subclassifications.service.spec.ts
1
import { TestBed } from '@angular/core/testing';
2

  
3
import { DocumentSubclassificationsService } from './document-subclassifications.service';
4

  
5
describe('DocumentSubclassificationsService', () => {
6
  let service: DocumentSubclassificationsService;
7

  
8
  beforeEach(() => {
9
    TestBed.configureTestingModule({});
10
    service = TestBed.inject(DocumentSubclassificationsService);
11
  });
12

  
13
  it('should be created', () => {
14
    expect(service).toBeTruthy();
15
  });
16
});
modules/uoa-repository-manager-service/trunk/app/shared/services/administration/configurator.service.spec.ts
1
import { TestBed } from '@angular/core/testing';
2

  
3
import { ConfiguratorService } from './configurator.service';
4

  
5
describe('ConfiguratorService', () => {
6
  let service: ConfiguratorService;
7

  
8
  beforeEach(() => {
9
    TestBed.configureTestingModule({});
10
    service = TestBed.inject(ConfiguratorService);
11
  });
12

  
13
  it('should be created', () => {
14
    expect(service).toBeTruthy();
15
  });
16
});
modules/uoa-repository-manager-service/trunk/app/shared/services/administration/templates.service.ts
1
import { environment } from 'src/environments/environment';
2
import { Category } from './../../models/category.interface';
3
import { IPowerClient } from './../../models/ipower-client.interface';
4
import { Observable } from 'rxjs';
5
import { GenericRestService } from './../generic-rest.service';
6
import { Injectable } from '@angular/core';
7
import { Template } from '../../models/template.interface';
8
import { HttpClient } from '@angular/common/http';
9

  
10
@Injectable({
11
  providedIn: 'root'
12
})
13
export class TemplatesService extends GenericRestService<Template> {
14

  
15
  constructor(private http: HttpClient) {
16
    super(`${environment.baseApiUrl}${environment.apiUrl.verificationRulesWs}/templates`, http); // TODO: Change this when GenericRestService<> changes.
17
  }
18

  
19
  public createNewTemplate(template: Template): Observable<Template> {
20
    // Create the model required by the backend ('CreateTemplateRequestModel') before using the generic create method.
21
    let createCategoryRequestModel = {
22
      id: null,
23
      category: template.category,
24
      subCategoryCode: template.subCategoryCode,
25
      abbyyTemplate: template.abbyyTemplate,
26
      clientId: template.client.id,
27

  
28
      // Just to comply to the required Template interface.
29
      documentClassification: null,
30
      client: null
31
    }
32

  
33
    return super.create(createCategoryRequestModel);
34
  }
35

  
36
  public updateTemplate(template: Template): Observable<Template> {
37

  
38
    // Create the model required by the backend ('CreateTemplateRequestModel') before using the generic create method.
39
    let updateCategoryRequestModel = {
40
      id: template.id,
41
      category: template.category,
42
      subCategoryCode: template.subCategoryCode,
43
      abbyyTemplate: template.abbyyTemplate,
44
      clientId: template.client.id,
45

  
46
      // Just to comply to the required Template interface.
47
      documentClassification: null,
48
      client: null
49
    }
50

  
51
    return super.update(updateCategoryRequestModel);
52
  }
53
}
modules/uoa-repository-manager-service/trunk/app/shared/services/administration/configurator.service.ts
1
import { Injectable } from '@angular/core';
2
import {HttpClient} from '@angular/common/http';
3
import {environment} from '../../../../environments/environment';
4
import {Observable} from 'rxjs';
5
import {ConfiguratorParameter} from '../../models/configurator-parameter.interface';
6
import {GenericRestService} from '../generic-rest.service';
7

  
8
@Injectable({
9
  providedIn: 'root'
10
})
11
export class ConfiguratorService extends GenericRestService<ConfiguratorParameter>  {
12

  
13
  constructor(private http: HttpClient) {
14
    super(`${environment.baseApiUrl}${environment.apiUrl.configurationWs}/platform-configurations`, http);
15
  }
16

  
17
  getConfiguratorParameters(): Observable<ConfiguratorParameter[]> {
18
    return this.http.get<ConfiguratorParameter[]>(this.baseUrl + `/all`);
19
  }
20

  
21
  public updateConfiguratorParameter(parameter: ConfiguratorParameter) {
22

  
23
    // Create the model required by the backend ('CreateCategoryRequestModel') before using the generic create method.
24
    const updateParameterRequestModel = {
25
      configurationId: parameter.configurationId,
26
      configurationVariable: parameter.configurationVariable,
27
      variableType: parameter.variableType,
28
      integerValue: parameter.integerValue,
29
      stringValue: parameter.stringValue
30
    };
31

  
32
    // return super.update(updateParameterRequestModel);
33
    return this.http.put(`${this.baseUrl}/` + parameter.configurationId, updateParameterRequestModel);
34
  }
35
}
modules/uoa-repository-manager-service/trunk/app/shared/services/administration/application-level-exception.service.ts
1
import { HttpClient } from "@angular/common/http";
2
import { Injectable } from "@angular/core";
3
import { environment } from "src/environments/environment";
4
import { SystemException } from "../../models/system-exception.interface";
5
import { GenericRestService } from "../generic-rest.service";
6

  
7
@Injectable({
8
  providedIn: 'root'
9
})
10
export class ApplicationLevelExceptionService extends GenericRestService<SystemException> {
11

  
12
  constructor(private http: HttpClient) {
13
    super(`${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}/exceptions`, http);
14
  }
15

  
16
}
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff