Compare commits

..

No commits in common. "162453c894ef86d793662b31b077048f417f925c" and "07a6822920418a92c34e4bfb1cd8d45cff1ce260" have entirely different histories.

2 changed files with 15 additions and 28 deletions

View File

@ -73,9 +73,7 @@
<th class="col-sm-2">Begründung</th> <th class="col-sm-2">Begründung</th>
<th class="col-sm-1 text-right">Datum</th> <th class="col-sm-1 text-right">Datum</th>
<th class="col-sm-1 text-center">Status</th> <th class="col-sm-1 text-center">Status</th>
<th class="col-sm-1 text-center"> <th class="col-sm-1 text-center"></th>
<span class="btn btn-default" (click)="deleteAwarding()">Löschen</span>
</th>
</tr> </tr>
</thead> </thead>
<tbody *ngFor="let award of awards"> <tbody *ngFor="let award of awards">
@ -96,15 +94,10 @@
<a class="small text-nowrap">{{award.date | date: 'dd.MM.yyyy'}}</a> <a class="small text-nowrap">{{award.date | date: 'dd.MM.yyyy'}}</a>
</td> </td>
<td class="text-center"> <td class="text-center">
{{award.confirmed === 0 ? 'In Bearbeitung' : (award.confirmed === 1 ? 'Genehmigt' : 'Abgelehnt')}} {{award.confirmed === 0? 'In Bearbeitung' : (award.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}}
</td> </td>
<td class="text-center"> <td class="text-center">
<label> <span class="glyphicon glyphicon-trash trash" title="Löschen" (click)="deleteAwarding(award._id)"></span>
<input name="deleteAward"
type="checkbox"
value="{{award._id}}"
[(ngModel)]="award.checked">
</label>
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@ -93,28 +93,22 @@ export class AwardUserComponent implements OnInit {
} }
} }
deleteAwarding() { deleteAwarding(awardingId) {
const checkedAwardings = this.awards.filter(award => award['checked'] === true); this.awardingService.deleteAwarding(awardingId).subscribe((res) => {
this.awardingService.getUserAwardings(this.userId)
if (checkedAwardings.length > 0) { .subscribe((awards) => {
checkedAwardings.forEach(awarding => { this.awards = awards;
this.awardingService.deleteAwarding(awarding._id).subscribe((res) => { this.showSuccessLabel = true;
this.awardingService.getUserAwardings(this.userId) setTimeout(() => {
.subscribe((awards) => { this.showSuccessLabel = false;
this.awards = awards; }, 2000);
}); });
}); });
});
this.showSuccessLabel = true;
setTimeout(() => {
this.showSuccessLabel = false;
}, 4000);
}
} }
cancel() { cancel() {
this.router.navigate(['../..'], {relativeTo: this.route}); this.router.navigate(['../..'], {relativeTo: this.route});
return false; return false;
} }
} }