Project

General

Profile

1 47593 argiro.kok
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
2 46564 argiro.kok
3
import {ClaimResult} from '../claim-utils/claimEntities.class';
4 47593 argiro.kok
import {AlertModal} from '../../utils/modal/alert';
5 46564 argiro.kok
6
@Component({
7
    selector: 'start-over',
8 47593 argiro.kok
    template: `
9 48265 argiro.kok
    <button   (click)="confirmOpen()"  class="uk-button uk-button-danger uk-align-left"  >  <span  class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="refresh" ratio="1"><path fill="none" stroke="#000" stroke-width="1.1" d="M17.08,11.15 C17.09,11.31 17.1,11.47 17.1,11.64 C17.1,15.53 13.94,18.69 10.05,18.69 C6.16,18.68 3,15.53 3,11.63 C3,7.74 6.16,4.58 10.05,4.58 C10.9,4.58 11.71,4.73 12.46,5"></path><polyline fill="none" stroke="#000" points="9.9 2 12.79 4.89 9.79 7.9"></polyline></svg></span> Clear All</button>
10 47593 argiro.kok
    <modal-alert (alertOutput)="confirmClose($event)">
11
    </modal-alert>
12
    `,
13 46564 argiro.kok
14
})
15
export class StartOverComponent {
16
  constructor () {
17
18
19
  }
20
  ngOnInit() {
21
22
}
23
24
25
  // @Input() public inlineEntity = null;
26
  @Input() public type:string;
27
  @Input() public linkTo:string;
28
  @Input() public results;
29
  @Input() public projects;
30
  @Input() public contexts;
31
32 47593 argiro.kok
  @ViewChild(AlertModal) alertApplyAll;
33 46564 argiro.kok
34 47691 argiro.kok
  confirmOpen(){
35 47593 argiro.kok
    this.alertApplyAll.cancelButton = true;
36
    this.alertApplyAll.okButton = true;
37
    this.alertApplyAll.alertTitle = "Remove selected";
38
    this.alertApplyAll.message = "This action will delete every selected entity (projects, communities, research results). Do you wish to continue?";
39
    this.alertApplyAll.okButtonText = "Yes";
40
    this.alertApplyAll.cancelButtonText = "No";
41
    this.alertApplyAll.open();
42
  }
43
   confirmClose(data){
44
     this.startOver();
45
  }
46 46564 argiro.kok
  startOver(){
47
    if(this.type != null && this.linkTo != null){
48
      console.log("inline");
49
      if(this.linkTo == "project"){
50
        this.projects.splice(0, this.projects.length);
51
      }else if(this.linkTo == "context"){
52
        this.contexts.splice(0, this.contexts.length);
53
      }else if(this.linkTo == "result"){
54
          this.results.splice(0, this.results.length);
55
      }
56
      }else{
57
        console.log("generic");
58
        this.results.splice(0, this.results.length);
59
        this.projects.splice(0, this.projects.length);
60
        this.contexts.splice(0, this.contexts.length);
61
      }
62
    console.log("projects:"+this.projects.length +" contexts:"+this.contexts.length + " results:"+this.results.length );
63
  }
64
65
}