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, min: 0,
max: 2, max: 2,
required: true required: true
},
rejectReason: {
type: String
} }
}, { }, {
collection: 'promotion', collection: 'promotion',

View File

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

View File

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

View File

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

View File

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

View File

@ -16,7 +16,8 @@
<th class="col-sm-1 ">Antragsteller</th> <th class="col-sm-1 ">Antragsteller</th>
<th class="col-sm-1 text-center">Datum</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">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> </tr>
</thead> </thead>
<tbody *ngFor="let promotion of promotions"> <tbody *ngFor="let promotion of promotions">
@ -39,9 +40,16 @@
<td class="text-center"> <td class="text-center">
{{promotion.confirmed === 0? 'In Bearbeitung' : (promotion.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}} {{promotion.confirmed === 0? 'In Bearbeitung' : (promotion.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}}
</td> </td>
<td>
<textarea style="width: 100%;"
rows="3"
title="rejectReason"
placeholder="Begründung für Ablehnung (optional)"
#rejectReason></textarea>
</td>
<td class="text-right"> <td class="text-right">
<a class="action" (click)="confirm(promotion, true)">Bestätigen</a><br> <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> </td>
</tr> </tr>
</tbody> </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 = { const updateObject = {
_id: promotion._id, _id: promotion._id,
confirmed: decision ? 1 : 2 confirmed: decision ? 1 : 2
}; };
if (rejectReason) {
updateObject['rejectReason'] = rejectReason;
}
this.promotionService.updatePromotion(updateObject).subscribe(res => { this.promotionService.updatePromotion(updateObject).subscribe(res => {
const currentUser = this.loginService.getCurrentUser(); const currentUser = this.loginService.getCurrentUser();
this.promotionService.getUnconfirmedPromotions(currentUser.squad.fraction).subscribe(promotions => { this.promotionService.getUnconfirmedPromotions(currentUser.squad.fraction).subscribe(promotions => {

View File

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

View File

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

View File

@ -75,7 +75,7 @@
</span> </span>
</ng-template> </ng-template>
</ngx-datatable-column> </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>
<ngx-datatable <ngx-datatable