Project

General

Profile

1 50169 argiro.kok
import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
2
3 55403 argiro.kok
import {ClaimEntity} from '../claim-utils/claimEntities.class';
4 50169 argiro.kok
import {AlertModal} from '../../utils/modal/alert';
5
6
@Component({
7
    selector: 'start-over',
8
    template: `
9 53379 argiro.kok
    <!--button   (click)="confirmOpen()"  class="uk-button portal-button 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 55403 argiro.kok
11
    <span  (click)="confirmOpen()" [attr.uk-tooltip]="'title:<div  >Remove '+message+'</div>'" aria-expanded="false" class="uk-text-danger uk-width-small" [style]="'cursor: '+ ((results.length > 0)?'pointer;':'not-allowed;')" [style.cursor]="((results.length> 0)?'pointer':'not-allowed')">
12 52837 argiro.kok
      <span class="uk-icon">
13
        <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <polyline fill="none" stroke="#000" points="6.5 3 6.5 1.5 13.5 1.5 13.5 3"></polyline> <polyline fill="none" stroke="#000" points="4.5 4 4.5 18.5 15.5 18.5 15.5 4"></polyline> <rect x="8" y="7" width="1" height="9"></rect> <rect x="11" y="7" width="1" height="9"></rect> <rect x="2" y="3" width="16" height="1"></rect></svg>
14
      </span>
15
    </span>
16
17 50169 argiro.kok
    <modal-alert (alertOutput)="confirmClose($event)">
18
    </modal-alert>
19
    `,
20
21
})
22
export class StartOverComponent {
23
  constructor () {
24
  }
25
  ngOnInit() {
26
27 52837 argiro.kok
  }
28 50169 argiro.kok
29
  @Input() public type:string;
30
  @Input() public linkTo:string;
31
  @Input() public results;
32 55403 argiro.kok
  @Input() public message = "selected entities";
33 50169 argiro.kok
34
  @ViewChild(AlertModal) alertApplyAll;
35 52837 argiro.kok
  @Input()  localStoragePrefix:string = "";
36 50169 argiro.kok
37
  confirmOpen(){
38 55201 argiro.kok
    if( this.results.length == 0 ){
39 52837 argiro.kok
      return;
40
    }
41 50169 argiro.kok
    this.alertApplyAll.cancelButton = true;
42
    this.alertApplyAll.okButton = true;
43
    this.alertApplyAll.alertTitle = "Remove selected";
44 55403 argiro.kok
    this.alertApplyAll.message = "Do you want to remove " + this.message + "?";
45 50169 argiro.kok
    this.alertApplyAll.okButtonText = "Yes";
46
    this.alertApplyAll.cancelButtonText = "No";
47
    this.alertApplyAll.open();
48
  }
49
   confirmClose(data){
50
     this.startOver();
51
  }
52
  startOver(){
53
    if(this.type != null && this.linkTo != null){
54 54775 konstantin
      //console.log("inline");
55 55201 argiro.kok
      //TODO
56
      // if(this.linkTo == "project"){
57
      //   this.projects.splice(0, this.projects.length);
58
      // }else if(this.linkTo == "context"){
59
      //   this.contexts.splice(0, this.contexts.length);
60 55403 argiro.kok
      // }else if(this.linkTo == "entity"){
61 55201 argiro.kok
      //     this.results.splice(0, this.results.length);
62
      // }
63 50169 argiro.kok
      }else{
64
        this.results.splice(0, this.results.length);
65
      }
66 55403 argiro.kok
      localStorage.removeItem(this.localStoragePrefix);
67 50169 argiro.kok
  }
68
69
}