Add reject reason field for promotions; optimize design for confirm pages;

pull/30/head
HardiReady 2018-03-11 14:29:03 +01:00
parent 7808101c58
commit a8094ec802
10 changed files with 37 additions and 16 deletions

View File

@ -32,6 +32,9 @@ const PromotionSchema = new Schema({
min: 0,
max: 2,
required: true
},
rejectReason: {
type: String
}
}, {
collection: 'promotion',

View File

@ -91,6 +91,7 @@ export interface Promotion {
userId?: string;
oldRankLvl: number;
newRankLvl: number;
rejectReason?: string;
}
export interface Decoration {

View File

@ -18,7 +18,7 @@
.table-container {
margin-top: 40px;
overflow-x: auto;
width: 75%;
width: 90%;
padding: 5px;
}

View File

@ -16,7 +16,8 @@
<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-2 text-right">Aktion</th>
<th class="col-sm-2 text-right"></th>
<th class="col-sm-1 text-right">Aktion</th>
</tr>
</thead>
<tbody *ngFor="let award of awards">
@ -35,7 +36,7 @@
</td>
<td>
<textarea style="width:100%;"
rows="7"
rows="3"
title="reason"
#reason>{{award.reason}}</textarea>
</td>
@ -45,16 +46,16 @@
<td class="text-right">
{{award.date | date: 'dd.MM.yyyy'}}
</td>
<td>
<textarea style="width: 100%;"
rows="3"
title="rejectReason"
placeholder="Begründung für Ablehnung (optional)"
#rejectReason></textarea>
</td>
<td class="text-right">
<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>

View File

@ -18,7 +18,7 @@
.table-container {
margin-top: 40px;
overflow-x: auto;
width: 65%;
width: 90%;
padding: 5px;
}

View File

@ -16,7 +16,8 @@
<th class="col-sm-1 ">Antragsteller</th>
<th class="col-sm-1 text-center">Datum</th>
<th class="col-sm-1 text-center">Status</th>
<th class="col-sm-1 text-center">Aktion</th>
<th class="col-sm-2 text-right"></th>
<th class="col-sm-1 text-right">Aktion</th>
</tr>
</thead>
<tbody *ngFor="let promotion of promotions">
@ -39,9 +40,16 @@
<td class="text-center">
{{promotion.confirmed === 0? 'In Bearbeitung' : (promotion.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}}
</td>
<td>
<textarea style="width: 100%;"
rows="3"
title="rejectReason"
placeholder="Begründung für Ablehnung (optional)"
#rejectReason></textarea>
</td>
<td class="text-right">
<a class="action" (click)="confirm(promotion, true)">Bestätigen</a><br>
<a class="action" (click)="confirm(promotion, false)">Ablehnen</a>
<a class="action" (click)="confirm(promotion, false, rejectReason.value)">Ablehnen</a>
</td>
</tr>
</tbody>

View File

@ -33,12 +33,16 @@ export class ConfirmPromotionComponent implements OnInit {
});
}
confirm(promotion: Promotion, decision: boolean) {
confirm(promotion: Promotion, decision: boolean, rejectReason: string) {
const updateObject = {
_id: promotion._id,
confirmed: decision ? 1 : 2
};
if (rejectReason) {
updateObject['rejectReason'] = rejectReason;
}
this.promotionService.updatePromotion(updateObject).subscribe(res => {
const currentUser = this.loginService.getCurrentUser();
this.promotionService.getUnconfirmedPromotions(currentUser.squad.fraction).subscribe(promotions => {

View File

@ -18,7 +18,7 @@
.table-container {
margin-top: 40px;
overflow-x: auto;
width: 65%;
width: 90%;
min-width: 800px;
padding: 5px;
}

View File

@ -74,6 +74,7 @@
<th class="col-sm-1 ">Antragsteller</th>
<th class="col-sm-1 text-center">Datum</th>
<th class="col-sm-1 text-center">Status</th>
<th class="col-sm-2 text-right">Grund für Ablehnung</th>
</tr>
</thead>
<tbody *ngFor="let promotion of uncheckedPromotions">
@ -96,6 +97,9 @@
<td class="text-center">
{{promotion.confirmed === 0? 'In Bearbeitung' : (promotion.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}}
</td>
<td class="text-right">
{{promotion.rejectReason ? promotion.rejectReason : ''}}
</td>
</tr>
</tbody>
</table>

View File

@ -75,7 +75,7 @@
</span>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column [width]="valueColWidth" name="Fahrzeug-Kills" prop="vehicle"></ngx-datatable-column>
<ngx-datatable-column [width]="valueColWidth" name="FahrzeugKill" prop="vehicle"></ngx-datatable-column>
</ngx-datatable>
<ngx-datatable