Add possibility to edit request award reason and give reject reason
parent
84ab4410f5
commit
7287f6b8a1
|
@ -29,6 +29,9 @@ const AwardingSchema = new Schema({
|
|||
max: 2,
|
||||
default: 0
|
||||
},
|
||||
rejectReason: {
|
||||
type: String
|
||||
},
|
||||
date: {
|
||||
type: Date,
|
||||
default: Date.now()
|
||||
|
|
|
@ -114,7 +114,6 @@ awarding.route('/:id')
|
|||
return; // prevent node to process this function further after next() has finished.
|
||||
}
|
||||
|
||||
// optional task 3: increment version manually as we do not use .save(.)
|
||||
req.body.updatedAt = new Date();
|
||||
req.body.$inc = {__v: 1};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<th class="col-sm-2">Begründung</th>
|
||||
<th class="col-sm-1 ">Antragsteller</th>
|
||||
<th class="col-sm-1 text-right">Datum</th>
|
||||
<th class="col-sm-1 text-right">Aktion</th>
|
||||
<th class="col-sm-2 text-right">Aktion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody *ngFor="let award of awards">
|
||||
|
@ -34,7 +34,10 @@
|
|||
{{award.decorationId.name}}
|
||||
</td>
|
||||
<td>
|
||||
{{award.reason}}
|
||||
<textarea style="width:100%;"
|
||||
rows="7"
|
||||
title="reason"
|
||||
#reason>{{award.reason}}</textarea>
|
||||
</td>
|
||||
<td>
|
||||
{{award.proposer?.username}}
|
||||
|
@ -43,8 +46,15 @@
|
|||
{{award.date | date: 'dd.MM.yyyy'}}
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<a class="action" (click)="confirm(award, true)">Bestätigen</a><br>
|
||||
<a class="action" (click)="confirm(award, false)">Ablehnen</a>
|
||||
<a class="action" (click)="confirm(award, true, reason.value)">Bestätigen</a><br>
|
||||
<a class="action" (click)="confirm(award, false, reason.value, rejectReason.value)">Ablehnen</a>
|
||||
<div>
|
||||
<textarea cols="20"
|
||||
rows="5"
|
||||
title="rejectReason"
|
||||
placeholder="Begründung für Ablehnung (optional)"
|
||||
#rejectReason></textarea>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
@ -25,12 +25,20 @@ export class ConfirmAwardComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
confirm(award: Award, decision: boolean) {
|
||||
confirm(award: Award, decision: boolean, reason: string, rejectReason: string) {
|
||||
const updateObject = {
|
||||
_id: award._id,
|
||||
confirmed: decision ? 1 : 2
|
||||
};
|
||||
|
||||
if (rejectReason) {
|
||||
updateObject['rejectReason'] = rejectReason;
|
||||
}
|
||||
|
||||
if (reason && reason !== award.reason) {
|
||||
updateObject['reason'] = reason;
|
||||
}
|
||||
|
||||
this.awardingService.updateAward(updateObject).subscribe(res => {
|
||||
const currentUser = this.loginService.getCurrentUser();
|
||||
this.awardingService.getUnconfirmedAwards(currentUser.squad.fraction).subscribe(awards => {
|
||||
|
|
Loading…
Reference in New Issue