summaryrefslogtreecommitdiffstats
path: root/public/src/app/rule-engine/condition/condition.component.html
blob: 7ba21e239b702e72520d5501d9306aff0fb2f789 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<tree-root #tree class="condition-tree" (initialized)="onInitialized(tree)" [nodes]="conditionTree" [options]="customTemplateStringOptions">
  <ng-template #treeNodeTemplate let-node let-index="index">

    <div>
      <div *ngIf="node.data.name === 'operator'" style="background: #F2F2F2;">
        <div style="display: flex; margin-left: 5px; align-items: center; min-height: 35px;">
          <div style="display: flex; align-items: center;" *ngIf="showType">
            <select style="padding: 5px;margin-left: 10px;" [(ngModel)]="node.data.type">
              <option value="ANY">ANY</option>
              <option value="ALL">ALL</option>
            </select>

            <div style="display: flex; align-items: center; margin-left: 10px; width: 150px;">
              of the following are true:
            </div>
          </div>

          <div *ngIf="isFilter" style="display: flex; width: 100%; justify-content: space-between; cursor: default;">
            <div style="display: flex;">
              <div style="display: flex; align-items: center; padding: 0 15px;">
                <button mat-mini-fab color="primary" data-tests-id="addCondition" (click)="addConditional(tree, node)" style="height: 16px; width: 16px; display:flex; box-shadow: none;align-items: center;justify-content: center;">
                  <span style="width: 100%;
                color:white;
                height: 100%;
                display: flex;
                justify-content: center;
                align-items: center;" [innerHTML]="'plus' | feather:12"></span>
                </button>
                <span class="btn-label">Add Filter
                </span>
              </div>

              <div style="display: flex; align-items: center; padding: 0 25px;">
                <button mat-mini-fab color="primary" data-tests-id="addConditionGroup" [disabled]="node.data.level === 2" (click)="addConditionalGroup(tree, node)"
                  style="height: 16px; width: 16px; display:flex; box-shadow: none;align-items: center;justify-content: center;">
                  <span style="width: 100%;
                color:white;
                height: 100%;
                display: flex;
                justify-content: center;
                align-items: center;" [innerHTML]="'plus' | feather:12"></span>
                </button>
                <span [style.color]="node.data.level === 2 ? '#a7a7a7' : '#009fdb' " class="btn-label">Add Filter Group
                </span>
              </div>
            </div>
            <!-- background: #FFFFFF; -->
            <div style="display: flex; align-items: center; padding: 0 5px; ">
              <button data-tests-id="removeConditionNode" mat-icon-button (click)="removeConditional(tree, node)" class="button-remove">
                <span style="width: 100%;
                            height: 100%;
                            display: flex;
                            justify-content: center;
                            align-items: center;" [innerHTML]="'trash-2' | feather:20"></span>
              </button>
            </div>
          </div>

          <div *ngIf="!isFilter" style="display: flex; margin-left: auto;">

            <div style="display: flex; align-items: center; padding: 0 25px;">
              <button mat-mini-fab color="primary" data-tests-id="addCondition" (click)="addConditional(tree, node)" style="height: 24px; width: 24px; display:flex; box-shadow: none;">
                <mat-icon class="material-icons md-18">add</mat-icon>
              </button>
              <span class="btn-label">Add Condition
              </span>
            </div>

            <div style="display: flex; align-items: center; padding: 0 25px;">
              <button mat-mini-fab color="primary" data-tests-id="addConditionGroup" [disabled]="node.data.level === 2" (click)="addConditionalGroup(tree, node)"
                style="height: 24px; width: 24px; display:flex; box-shadow: none;">
                <mat-icon class="material-icons md-18">add</mat-icon>
              </button>
              <span [style.color]="node.data.level === 2 ? '#a7a7a7' : '#009fdb' " [style.cursor]="node.data.level === 2 ? 'default' : 'pointer' "
                class="btn-label">Add Condition Group
              </span>
            </div>

            <div style="display: flex; align-items: center; padding: 0 5px;">
              <button data-tests-id="removeConditionNode" mat-icon-button (click)="removeConditional(tree, node)" class="button-remove">
                <span style="width: 100%;
                            height: 100%;
                            display: flex;
                            justify-content: center;
                            align-items: center;" [innerHTML]="'trash-2' | feather:20"></span>
              </button>
            </div>

          </div>
        </div>
      </div>
      <div *ngIf="node.data.name === 'condition'">
        <div class="from-conatiner" style="height:35px; ">
          <div style="display: flex; width:90%;">
            <div class="label" style="width:100%">
              <span class="label" style="padding: 0 10px; border-left: none;">
                Input
              </span>
              <input class="input-text" data-tests-id="left" [(ngModel)]="node.data.left" (ngModelChange)="modelChange($event)" ngDefaultControl
                type="text">
            </div>

            <div style="margin: 0 1rem;">
              <select style="height: 30px;" data-tests-id="selectOperator" [(ngModel)]="node.data.operator" (ngModelChange)="modelChange($event)"
                ngDefaultControl>
                <option [ngValue]="null" disabled>Select operator</option>
                <option value="contains">Contains</option>
                <option value="endsWith">Ends with</option>
                <option value="startsWith">Starts with</option>
                <option value="equals">Equals</option>
                <option value="notEqual">Not equal</option>
                <option value="assigned">Assigned</option>
                <option value="unassigned">Unassigned</option>
                <option value="oneOf">One of</option>
                <option value="NotOneOf">Not one of</option>
              </select>
            </div>

            <div class="label" style="width:100%" *ngIf="node.data.operator !== 'assigned' && node.data.operator !== 'unassigned'">
              <span class="label" style="padding: 0 10px; border-left: none;">
                Value
              </span>
              <input class="input-text" data-tests-id="right" (ngModelChange)="modelChange($event)" [(ngModel)]="node.data.right" ngDefaultControl
                type="text">
            </div>

            <div *ngIf="node.data.operator === 'assigned' || node.data.operator === 'unassigned'" class="pretty p-svg" style="margin: 4px 0 1em 0em; margin-left:10px;">
              <input type="checkbox" name="emptyIsAssigned" data-tests-id="emptyIsAssigned" [checked]="node.data.emptyIsAssigned" (change)="node.data.emptyIsAssigned = !node.data.emptyIsAssigned"
              />
              <div class="state">
                <svg class="svg svg-icon" viewBox="0 0 20 20">
                  <path d="M7.629,14.566c0.125,0.125,0.291,0.188,0.456,0.188c0.164,0,0.329-0.062,0.456-0.188l8.219-8.221c0.252-0.252,0.252-0.659,0-0.911c-0.252-0.252-0.659-0.252-0.911,0l-7.764,7.763L4.152,9.267c-0.252-0.251-0.66-0.251-0.911,0c-0.252,0.252-0.252,0.66,0,0.911L7.629,14.566z"
                    style="stroke: #009fdb; fill:#009fdb;"></path>
                </svg>
                <label>Empty Is Assigned</label>
              </div>
            </div>
          </div>
          <!-- remove button -->
          <div class="show-delete">
            <button mat-icon-button data-tests-id="RemoveCondition" (click)="removeConditional(tree, node)" class="button-remove">
              <span style="width: 100%;
                          height: 100%;
                          display: flex;
                          justify-content: center;
                          align-items: center;" [innerHTML]="'trash-2' | feather:20"></span>
            </button>
          </div>

        </div>
      </div>
    </div>
  </ng-template>
</tree-root>