Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. import { Component } from '@angular/core';
  2. import { FormBuilder } from '@angular/forms';
  3.  
  4. import { CtCommonService, CtPartItems } from '..';
  5. import { Form, FormField, CTResult } from 'src/model/models';
  6. import { CtService, DocumentationService } from 'src/api/api';
  7. import { Observable, of } from 'rxjs';
  8. import { tap, catchError } from 'rxjs/operators';
  9.  
  10. @Component({
  11. selector: 'app-ct-structure-form',
  12. templateUrl: './ct-structure-form.component.html',
  13. styleUrls: ['./ct-structure-form.component.css']
  14. })
  15. export class CtStructureFormComponent extends CtPartItems {
  16.  
  17. constructor(fb: FormBuilder, ctCommon: CtCommonService,
  18. private ctService: CtService,
  19. private documentationService: DocumentationService) {
  20. super(fb, ctCommon, 'Structure', f => f.fieldNo);
  21. }
  22.  
  23. cores: number[];
  24. result: CTResult;
  25.  
  26. setup(f: Form) {
  27. this.cores = Array.from(new Set(f.fields.map(ff => ff.coreNo)));
  28.  
  29. this.ctService.calculate(this.previousFields)
  30. .subscribe(r => this.result = r);
  31. super.setup(f);
  32. }
  33.  
  34. mapResultFields(coreNo: number, ctResult: CTResult): Map<string, string> {
  35. const filtered = ctResult.result.filter(ff => ff.coreNo === coreNo);
  36. const map = new Map<string, string>(filtered.map(ff => [ff.fieldNo, ff.value]));
  37. return map;
  38. }
  39.  
  40. exportDocumentation() {
  41. this.documentationService.getDocumentation(this.result.guid)
  42. .subscribe(d => {
  43. console.log("dupa");
  44. }, e => {
  45. console.log("eeeee");
  46. });
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement