Revision 47033
Added by Konstantina Galouni about 7 years ago
claimsByToken.component.ts | ||
---|---|---|
9 | 9 |
|
10 | 10 |
import {Session} from '../../login/utils/helper.class'; |
11 | 11 |
|
12 |
import {RouterHelper} from '../../utils/routerHelper.class'; |
|
13 |
|
|
12 | 14 |
@Component({ |
13 | 15 |
selector: 'claims-project-manager', |
14 | 16 |
template: ` |
... | ... | |
38 | 40 |
</div> |
39 | 41 |
|
40 | 42 |
<div *ngIf="accessStatus=='valid'"> |
41 |
<h1> Pending Claims </h1> |
|
43 |
<h1> Pending Claims for project: |
|
44 |
<a [queryParams]="routerHelper.createQueryParam('projectId',project['openaireId'])" |
|
45 |
routerLinkActive="router-link-active" |
|
46 |
routerLink="/search/project" > |
|
47 |
{{project['name']}} ({{project['funderName']}}) |
|
48 |
</a> |
|
49 |
</h1> |
|
42 | 50 |
|
43 | 51 |
<div *ngIf=" pending_claims && pending_claims.length == 0" > |
44 | 52 |
<div class = "uk-alert uk-alert-info " >No pending claims found.</div> |
45 | 53 |
</div> |
46 | 54 |
|
47 |
<div class=""> |
|
55 |
<div class="uk-overflow-container">
|
|
48 | 56 |
<table *ngIf="pending_claims && pending_claims.length > 0" class="uk-table uk-table-striped"> |
49 | 57 |
<thead> |
50 | 58 |
<tr> |
51 | 59 |
<th>Research Result</th> |
52 |
<th>Link to</th> |
|
53 |
<th>Claimed by</th> |
|
54 |
<th>Claimed Date</th> |
|
55 |
<th>True</th> |
|
56 |
<th>False</th> |
|
60 |
<!--th>Link to</th--> |
|
61 |
<th class="uk-text-center">Claimed by</th> |
|
62 |
<th class="uk-text-center">Claimed Date</th> |
|
63 |
<th class="uk-text-center">Approve</th> |
|
57 | 64 |
</tr> |
58 | 65 |
</thead> |
59 | 66 |
<tbody> |
60 |
<tr *ngFor="let claim of pending_claims "> |
|
61 |
<td><claim-entity [entity]="claim.target" [type]="claim.targetType" > </claim-entity></td> |
|
62 |
<td><claim-entity [entity]="claim.source" [type]="claim.sourceType" > </claim-entity></td> |
|
63 |
<td>{{claim.userMail}}</td> |
|
64 |
<td>{{claim.date}}</td> |
|
65 |
<td><input [id]="claim.id" type="checkbox" (click)="selectApprove(claim.id,$event)" [ngModel]="isSelectedRight(claim.id)"/></td> |
|
66 |
<td><input [id]="claim.id" type="checkbox" (click)="selectDisapprove(claim.id,$event)" [ngModel]="isSelectedWrong(claim.id)"/></td> |
|
67 |
<tr class="uk-table-middle" *ngFor="let claim of pending_claims "> |
|
68 |
<td class="uk-width-2-6" *ngIf="claim.targetType != 'project'"><claim-entity [entity]="claim.target" [type]="claim.targetType" > </claim-entity></td> |
|
69 |
<td class="uk-width-1-6 uk-text-center" *ngIf="claim.sourceType != 'project'"><claim-entity [entity]="claim.source" [type]="claim.sourceType" > </claim-entity></td> |
|
70 |
<td class="uk-width-1-6 uk-text-center">{{claim.userMail}}</td> |
|
71 |
<td class="uk-width-1-6 uk-text-center">{{claim.date}}</td> |
|
72 |
<!--td> |
|
73 |
<label> |
|
74 |
Yes <input [id]="claim.id" type="checkbox" (click)="selectApprove(claim.id,$event)" [ngModel]="isSelectedRight(claim.id)"/> |
|
75 |
</label> |
|
76 |
<label> |
|
77 |
No <input [id]="claim.id" type="checkbox" (click)="selectDisapprove(claim.id,$event)" [ngModel]="isSelectedWrong(claim.id)"/> |
|
78 |
</label> |
|
79 |
</td--> |
|
80 |
<td class="uk-width-1-6 uk-text-center"> |
|
81 |
|
|
82 |
<label> |
|
83 |
Yes <input [id]="claim.id" type="checkbox" (click)="selectApprove(claim.id,$event)" [ngModel]="isSelectedRight(claim.id)"/> |
|
84 |
</label> |
|
85 |
<label> |
|
86 |
No <input [id]="claim.id" type="checkbox" (click)="selectDisapprove(claim.id,$event)" [ngModel]="isSelectedWrong(claim.id)"/> |
|
87 |
</label> |
|
88 |
</td> |
|
67 | 89 |
</tr> |
68 | 90 |
</tbody> |
69 | 91 |
</table> |
70 | 92 |
|
71 |
|
|
72 | 93 |
<h1> Already Curated Claims </h1> |
73 | 94 |
|
74 | 95 |
<div *ngIf=" curated_claims && curated_claims.length == 0" > |
75 | 96 |
<div class = "uk-alert uk-alert-info " >No curated claims found.</div> |
76 | 97 |
</div> |
77 | 98 |
|
78 |
<div class=""> |
|
99 |
<div class="uk-overflow-container">
|
|
79 | 100 |
<table *ngIf="curated_claims && curated_claims.length > 0" class="uk-table uk-table-striped"> |
80 | 101 |
<thead> |
81 | 102 |
<tr> |
82 | 103 |
<th>Research Result</th> |
83 |
<th>Link to</th> |
|
84 |
<th>Claimed by</th> |
|
85 |
<th>Claimed Date</th> |
|
86 |
<th>Curated by</th> |
|
87 |
<th>Curation Date</th> |
|
88 |
<th>True</th> |
|
89 |
<th>False</th> |
|
90 |
<th></th> |
|
104 |
<!--th>Link to</th--> |
|
105 |
<th class="uk-text-center">Claimed by</th> |
|
106 |
<th class="uk-text-center">Claimed Date</th> |
|
107 |
<th class="uk-text-center">Curated by</th> |
|
108 |
<th class="uk-text-center">Curation Date</th> |
|
109 |
<th class="uk-text-center">Approved</th> |
|
91 | 110 |
</tr> |
92 | 111 |
</thead> |
93 | 112 |
<tbody> |
94 |
<tr *ngFor="let claim of curated_claims let i=index"> |
|
95 |
<td><claim-entity [entity]="claim.target" [type]="claim.targetType" > </claim-entity></td> |
|
96 |
<td><claim-entity [entity]="claim.source" [type]="claim.sourceType" > </claim-entity></td> |
|
97 |
<td>{{claim.userMail}}</td> |
|
98 |
<td>{{claim.date}}</td> |
|
99 |
<td>{{claim.curatedBy}}</td> |
|
100 |
<td>{{claim.curationDate}}</td> |
|
101 |
<td><input [id]="claim.id" type="checkbox" [disabled]="!editable.has(i)" (click)="selectApprove(claim.id,$event)" [ngModel]="isRight(claim)"/></td> |
|
102 |
<td><input [id]="claim.id" type="checkbox" [disabled]="!editable.has(i)" (click)="selectDisapprove(claim.id,$event)" [ngModel]="isWrong(claim)"/></td> |
|
103 |
<td><button class="uk-button" (click)="editable.add(i)">Edit</button></td> |
|
113 |
<tr class="uk-table-middle" *ngFor="let claim of curated_claims let i=index"> |
|
114 |
<td class="uk-width-1-6" *ngIf="claim.targetType != 'project'"><claim-entity [entity]="claim.target" [type]="claim.targetType" > </claim-entity></td> |
|
115 |
<td class="uk-width-1-6" *ngIf="claim.sourceType != 'project'"><claim-entity [entity]="claim.source" [type]="claim.sourceType" > </claim-entity></td> |
|
116 |
<td class="uk-width-1-6 uk-text-center">{{claim.userMail}}</td> |
|
117 |
<td class="uk-width-1-6 uk-text-center">{{claim.date}}</td> |
|
118 |
<td class="uk-width-1-6 uk-text-center">{{claim.curatedBy}}</td> |
|
119 |
<td class="uk-width-1-6 uk-text-center">{{claim.curationDate}}</td> |
|
120 |
<td class="uk-width-1-6 uk-text-center"> |
|
121 |
|
|
122 |
<label> |
|
123 |
Yes <input [id]="claim.id" type="checkbox" [disabled]="!editable.has(i)" [ngModel]="isRight(claim)"/> |
|
124 |
</label> |
|
125 |
|
|
126 |
<label> |
|
127 |
No <input [id]="claim.id" type="checkbox" [disabled]="!editable.has(i)" [ngModel]="isWrong(claim)"/> |
|
128 |
</label> |
|
129 |
|
|
130 |
</td> |
|
131 |
<!--td><input [id]="claim.id" type="checkbox" [disabled]="!editable.has(i)" (click)="selectDisapprove(claim.id,$event)" [ngModel]="isWrong(claim)"/></td--> |
|
132 |
<!--td><button class="uk-button" (click)="editable.add(i)">Edit</button></td--> |
|
104 | 133 |
</tr> |
105 | 134 |
</tbody> |
106 | 135 |
</table> |
... | ... | |
116 | 145 |
|
117 | 146 |
}) |
118 | 147 |
export class ClaimsByTokenComponent { |
148 |
//change true - false to accept: yes - no |
|
119 | 149 |
public token: string = ""; |
120 | 150 |
public sub: any; |
151 |
public project: any; |
|
121 | 152 |
private claims:any = []; |
122 | 153 |
public pending_claims: any = []; |
123 | 154 |
public curated_claims: any = []; |
... | ... | |
132 | 163 |
@ViewChild (ModalSelect) selectModal : ModalSelect; |
133 | 164 |
@ViewChild (ModalLoading) loading : ModalLoading ; |
134 | 165 |
|
166 |
public routerHelper:RouterHelper = new RouterHelper(); |
|
167 |
|
|
135 | 168 |
constructor ( private route: ActivatedRoute, private _router:Router, private claimsByTokenService: ClaimsByTokenService ) { |
136 | 169 |
|
137 | 170 |
} |
... | ... | |
150 | 183 |
} |
151 | 184 |
|
152 | 185 |
validateJWTandToken() { |
153 |
var user_token=Session.getUserJwt();
|
|
186 |
var jwtToken=Session.getUserJwt();
|
|
154 | 187 |
if(this.token) { |
155 |
this.claimsByTokenService.getClaims(this.token, user_token).subscribe(
|
|
188 |
this.claimsByTokenService.getClaims(this.token, jwtToken).subscribe(
|
|
156 | 189 |
data => { |
157 | 190 |
this.closeLoading(); |
158 | 191 |
this.accessStatus = "valid"; |
159 | 192 |
//console.info(data); |
160 | 193 |
this.claims = data.data; |
161 | 194 |
for(let claim of this.claims) { |
195 |
if(claim.targetType == "project") { |
|
196 |
this.project = claim.target; |
|
197 |
} else { |
|
198 |
this.project = claim.source; |
|
199 |
} |
|
162 | 200 |
if(claim.curatedBy) { |
163 | 201 |
this.curated_claims.push(claim); |
164 | 202 |
} else { |
... | ... | |
229 | 267 |
|
230 | 268 |
saveChanges() { |
231 | 269 |
console.info("Changes Saved!"); |
232 |
/* |
|
233 |
this.claimsByTokenService.updateClaimsCuration(this.token, this.selectedRight, this.selectedWrong).subscribe( |
|
270 |
var jwtToken=Session.getUserJwt(); |
|
271 |
|
|
272 |
this.claimsByTokenService.updateClaimsCuration(jwtToken, this.selectedRight, this.selectedWrong).subscribe( |
|
234 | 273 |
data => { |
235 | 274 |
console.info(data); |
236 | 275 |
}, |
... | ... | |
238 | 277 |
console.log(err); |
239 | 278 |
} |
240 | 279 |
); |
241 |
*/ |
|
280 |
|
|
242 | 281 |
} |
243 | 282 |
|
244 | 283 |
public closeLoading(){ |
Also available in: Unified diff
Save changes and update database with claims