From a8094ec802fb1ee4f6a8f12c2d8215c9124e0198 Mon Sep 17 00:00:00 2001 From: HardiReady Date: Sun, 11 Mar 2018 14:29:03 +0100 Subject: [PATCH] Add reject reason field for promotions; optimize design for confirm pages; --- api/models/promotion.js | 3 +++ static/src/app/models/model-interfaces.ts | 1 + .../confirm-award/confirm-award.component.css | 2 +- .../confirm-award.component.html | 19 ++++++++++--------- .../confirm-promotion.component.css | 2 +- .../confirm-promotion.component.html | 12 ++++++++++-- .../confirm-promotion.component.ts | 6 +++++- .../promotion/req-promotion.component.css | 2 +- .../promotion/req-promotion.component.html | 4 ++++ .../highscore/highscore.component.html | 2 +- 10 files changed, 37 insertions(+), 16 deletions(-) diff --git a/api/models/promotion.js b/api/models/promotion.js index c809bd7..d0da9d0 100644 --- a/api/models/promotion.js +++ b/api/models/promotion.js @@ -32,6 +32,9 @@ const PromotionSchema = new Schema({ min: 0, max: 2, required: true + }, + rejectReason: { + type: String } }, { collection: 'promotion', diff --git a/static/src/app/models/model-interfaces.ts b/static/src/app/models/model-interfaces.ts index 0a00241..1a52f36 100644 --- a/static/src/app/models/model-interfaces.ts +++ b/static/src/app/models/model-interfaces.ts @@ -91,6 +91,7 @@ export interface Promotion { userId?: string; oldRankLvl: number; newRankLvl: number; + rejectReason?: string; } export interface Decoration { diff --git a/static/src/app/request/confirm-award/confirm-award.component.css b/static/src/app/request/confirm-award/confirm-award.component.css index df217b2..2d7ee71 100644 --- a/static/src/app/request/confirm-award/confirm-award.component.css +++ b/static/src/app/request/confirm-award/confirm-award.component.css @@ -18,7 +18,7 @@ .table-container { margin-top: 40px; overflow-x: auto; - width: 75%; + width: 90%; padding: 5px; } diff --git a/static/src/app/request/confirm-award/confirm-award.component.html b/static/src/app/request/confirm-award/confirm-award.component.html index 06799b6..a35c79b 100644 --- a/static/src/app/request/confirm-award/confirm-award.component.html +++ b/static/src/app/request/confirm-award/confirm-award.component.html @@ -16,7 +16,8 @@ Begründung Antragsteller Datum - Aktion + + Aktion @@ -35,7 +36,7 @@ @@ -45,16 +46,16 @@ {{award.date | date: 'dd.MM.yyyy'}} + + + Bestätigen
Ablehnen -
- -
diff --git a/static/src/app/request/confirm-promotion/confirm-promotion.component.css b/static/src/app/request/confirm-promotion/confirm-promotion.component.css index 2ea383a..2d7ee71 100644 --- a/static/src/app/request/confirm-promotion/confirm-promotion.component.css +++ b/static/src/app/request/confirm-promotion/confirm-promotion.component.css @@ -18,7 +18,7 @@ .table-container { margin-top: 40px; overflow-x: auto; - width: 65%; + width: 90%; padding: 5px; } diff --git a/static/src/app/request/confirm-promotion/confirm-promotion.component.html b/static/src/app/request/confirm-promotion/confirm-promotion.component.html index dad3f1d..d9db874 100644 --- a/static/src/app/request/confirm-promotion/confirm-promotion.component.html +++ b/static/src/app/request/confirm-promotion/confirm-promotion.component.html @@ -16,7 +16,8 @@ Antragsteller Datum Status - Aktion + + Aktion @@ -39,9 +40,16 @@ {{promotion.confirmed === 0? 'In Bearbeitung' : (promotion.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}} + + + Bestätigen
- Ablehnen + Ablehnen diff --git a/static/src/app/request/confirm-promotion/confirm-promotion.component.ts b/static/src/app/request/confirm-promotion/confirm-promotion.component.ts index c95b6b2..c3c5458 100644 --- a/static/src/app/request/confirm-promotion/confirm-promotion.component.ts +++ b/static/src/app/request/confirm-promotion/confirm-promotion.component.ts @@ -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 => { diff --git a/static/src/app/request/promotion/req-promotion.component.css b/static/src/app/request/promotion/req-promotion.component.css index 58d23c6..e799ab8 100644 --- a/static/src/app/request/promotion/req-promotion.component.css +++ b/static/src/app/request/promotion/req-promotion.component.css @@ -18,7 +18,7 @@ .table-container { margin-top: 40px; overflow-x: auto; - width: 65%; + width: 90%; min-width: 800px; padding: 5px; } diff --git a/static/src/app/request/promotion/req-promotion.component.html b/static/src/app/request/promotion/req-promotion.component.html index 9e7307f..33be9d0 100644 --- a/static/src/app/request/promotion/req-promotion.component.html +++ b/static/src/app/request/promotion/req-promotion.component.html @@ -74,6 +74,7 @@ Antragsteller Datum Status + Grund für Ablehnung @@ -96,6 +97,9 @@ {{promotion.confirmed === 0? 'In Bearbeitung' : (promotion.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}} + + {{promotion.rejectReason ? promotion.rejectReason : ''}} + diff --git a/static/src/app/statistic/highscore/highscore.component.html b/static/src/app/statistic/highscore/highscore.component.html index 7bb51f6..e7ce8cf 100644 --- a/static/src/app/statistic/highscore/highscore.component.html +++ b/static/src/app/statistic/highscore/highscore.component.html @@ -75,7 +75,7 @@ - +