Replace strings with i18n keys in request module

pull/46/head
HardiReady 2018-10-04 13:06:14 +02:00
parent b2fa02d4eb
commit 36e213bbbf
13 changed files with 244 additions and 107 deletions

View File

@ -11,7 +11,7 @@ import {TranslateService} from '@ngx-translate/core';
</div>
</div>`
})
export class ShowErrorComponent implements OnInit{
export class ShowErrorComponent implements OnInit {
// tslint:disable-next-line:no-input-rename
@Input('controlPath') controlPath;

View File

@ -1,8 +1,8 @@
<form #form="ngForm" class="overview">
<h3>Auszeichnung beantragen</h3>
<h3>{{'request.award.headline' | translate}}</h3>
<div class="form-group">
<label for="user">Teilnehmer</label>
<label for="user">{{'request.award.field.user' | translate}}</label>
<select class="form-control"
name="user"
id="user"
@ -10,7 +10,7 @@
[compareWith]="equals"
(change)="toggleUser()"
required>
<option [ngValue]="{_id: '0'}">Auswählen...</option>
<option [ngValue]="{_id: '0'}">{{'request.award.field.user.placeholder' | translate}}</option>
<option *ngFor="let user of users" [ngValue]="user">
{{user.username}}
</option>
@ -18,7 +18,7 @@
</div>
<div class="form-group">
<label for="decoration">Auszeichnung</label>
<label for="decoration">{{'request.award.field.award' | translate}}</label>
<select class="form-control"
name="decoration"
id="decoration"
@ -26,7 +26,7 @@
[compareWith]="equals"
(change)="toggleDecoPreview(decoDescription, decoPreview)"
required>
<option [ngValue]="{_id: '0'}">Auswählen...</option>
<option [ngValue]="{_id: '0'}">{{'request.award.field.award.placeholder' | translate}}</option>
<option *ngFor="let deco of decorations" [ngValue]="deco">
{{deco.name}}
</option>
@ -44,35 +44,35 @@
</div>
<div class="form-group">
<label for="reason">Begründung</label>
<label for="reason">{{'request.award.field.reason' | translate}}</label>
<textarea class="form-control center-block" name="reason" [(ngModel)]="reason" required
id="reason" placeholder="Begründung eingeben..." rows="3"></textarea>
id="reason" placeholder="{{'request.award.field.reason.placeholder' | translate}}" rows="3"></textarea>
</div>
<button id="cancel"
(click)="cancel()"
class="btn btn-default">
Abbrechen
{{'request.award.button.cancel' | translate}}
</button>
<button id="save"
(click)="addAwarding(decoPreview, decoDescription)"
class="btn btn-default"
[disabled]="!form.valid || user._id === '0' || decoration._id === '0'">
Bestätigen
{{'request.award.button.submit' | translate}}
</button>
<div class="table-container" *ngIf="showForm">
<table class="table table-hover">
<thead>
<tr>
<th class="col-sm-1">Bild</th>
<th class="col-sm-2">Bezeichnung</th>
<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-center">Status</th>
<th class="col-sm-2 text-right">Grund für Ablehnung</th>
<th class="col-sm-1">{{'request.award.table.head.image' | translate}}</th>
<th class="col-sm-2">{{'request.award.table.head.name' | translate}}</th>
<th class="col-sm-2">{{'request.award.table.head.reason' | translate}}</th>
<th class="col-sm-1 ">{{'request.award.table.head.requester' | translate}}</th>
<th class="col-sm-1 text-right">{{'request.award.table.head.date' | translate}}</th>
<th class="col-sm-1 text-center">{{'request.award.table.head.status' | translate}}</th>
<th class="col-sm-2 text-right">{{'request.award.table.head.reject.reason' | translate}}</th>
</tr>
</thead>
<tbody *ngFor="let award of awards">
@ -96,7 +96,15 @@
{{award.date | date: 'dd.MM.yyyy'}}
</td>
<td class="text-center">
{{award.confirmed === 0? 'In Bearbeitung' : (award.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}}
<span *ngIf="award.confirmed === 0">
{{'request.award.table.status.progressing' | translate}}
</span>
<span *ngIf="award.confirmed === 1">
{{'request.award.table.status.accepted' | translate}}
</span>
<span *ngIf="award.confirmed !== 0 && award.confirmed !== 1">
{{'request.award.table.status.rejected' | translate}}
</span>
</td>
<td class="text-right">
{{award.rejectReason ? award.rejectReason : ''}}

View File

@ -82,10 +82,10 @@ export class RequestAwardComponent implements OnInit {
addAwarding(previewImage, descriptionField) {
if (this.decoration._id && this.reason.length > 0) {
const award: Award = {
'userId': this.user._id,
'decorationId': this.decoration._id,
'reason': this.reason,
'date': Date.now()
userId: this.user._id,
decorationId: this.decoration._id,
reason: this.reason,
date: Date.now()
};
this.awardingService.requestAwarding(award).subscribe(() => {
this.awardingService.getUserAwardings(this.user._id)

View File

@ -1,18 +1,18 @@
<form #form="ngForm" class="overview">
<h3>Offene Anträge - Auszeichnungen</h3>
<h3>{{'request.confirm.award.headline' | translate}}</h3>
<div class="table-container">
<table class="table table-hover">
<thead>
<tr>
<th class="col-sm-1">Teilnehmer</th>
<th class="col-sm-1">{{'request.confirm.award.table.head.participant' | translate}}</th>
<th class="col-sm-1"></th>
<th class="col-sm-2">Auszeichnung</th>
<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">{{'request.confirm.award.table.head.award' | translate}}</th>
<th class="col-sm-2">{{'request.confirm.award.table.head.reason' | translate}}</th>
<th class="col-sm-1 ">{{'request.confirm.award.table.head.requester' | translate}}</th>
<th class="col-sm-1 text-right">{{'request.confirm.award.table.head.date' | translate}}</th>
<th class="col-sm-2 text-right"></th>
<th class="col-sm-1 text-right">Aktion</th>
<th class="col-sm-1 text-right">{{'request.confirm.award.table.head.action' | translate}}</th>
</tr>
</thead>
<tbody *ngFor="let award of awards">
@ -43,16 +43,19 @@
<td>
<textarea style="width: 100%;"
rows="3"
placeholder="Begründung für Ablehnung (optional)"
placeholder="{{'request.confirm.award.table.reject.reason.placeholder' | translate}}"
#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>
<a class="action" (click)="confirm(award, true, reason.value)">
{{'request.confirm.award.table.button.action.accept' | translate}}
</a><br>
<a class="action" (click)="confirm(award, false, reason.value, rejectReason.value)">
{{'request.confirm.award.table.button.action.reject' | translate}}
</a>
</td>
</tr>
</tbody>
</table>
</div>
</form>

View File

@ -1,18 +1,18 @@
<form #form="ngForm" class="overview">
<h3>Offene Anträge - Beförderung</h3>
<h3>{{'request.confirm.promotion.headline' | translate}}</h3>
<div class="table-container">
<table class="table table-hover">
<thead>
<tr>
<th class="col-sm-1">Teilnehmer</th>
<th class="col-sm-1">Alter Rang</th>
<th class="col-sm-1">Neuer Rang</th>
<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">{{'request.confirm.promotion.table.head.participant' | translate}}</th>
<th class="col-sm-1">{{'request.confirm.promotion.table.head.rank.before' | translate}}</th>
<th class="col-sm-1">{{'request.confirm.promotion.table.head.rank.after' | translate}}</th>
<th class="col-sm-1 ">{{'"request.confirm.promotion.table.head.requester' | translate}}</th>
<th class="col-sm-1 text-center">{{'request.confirm.promotion.table.head.date' | translate}}</th>
<th class="col-sm-1 text-center">{{'request.confirm.promotion.table.head.status' | translate}}</th>
<th class="col-sm-2 text-right"></th>
<th class="col-sm-1 text-right">Aktion</th>
<th class="col-sm-1 text-right">{{'request.confirm.promotion.table.head.action' | translate}}</th>
</tr>
</thead>
<tbody *ngFor="let promotion of promotions">
@ -33,17 +33,29 @@
{{promotion.timestamp | date: 'dd.MM.yyyy'}}
</td>
<td class="text-center">
{{promotion.confirmed === 0? 'In Bearbeitung' : (promotion.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}}
<span *ngIf="promotion.confirmed === 0">
{{'request.confirm.promotion.table.status.progressing' | translate}}
</span>
<span *ngIf="promotion.confirmed === 1">
{{'request.confirm.promotion.table.status.accepted' | translate}}
</span>
<span *ngIf="promotion.confirmed !== 0 && promotion.confirmed !== 1">
{{'request.confirm.promotion.table.status.rejected' | translate}}
</span>
</td>
<td>
<textarea style="width: 100%;"
rows="3"
placeholder="Begründung für Ablehnung (optional)"
placeholder="{{'request.confirm.promotion.table.reject.reason.placeholder' | translate}}"
#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, rejectReason.value)">Ablehnen</a>
<a class="action" (click)="confirm(promotion, true)">
{{'request.confirm.promotion.table.button.action.accept' | translate}}
</a><br>
<a class="action" (click)="confirm(promotion, false, rejectReason.value)">
{{'request.confirm.promotion.table.button.action.reject' | translate}}
</a>
</td>
</tr>
</tbody>

View File

@ -1,8 +1,8 @@
<form #form="ngForm" class="overview">
<h3>Beförderung beantragen</h3>
<h3>{{'request.promotion.headline' | translate}}</h3>
<div class="form-group">
<label for="user">Teilnehmer</label>
<label for="user">{{'request.promotion.field.participant' | translate}}</label>
<select class="form-control"
name="user"
id="user"
@ -10,7 +10,7 @@
[compareWith]="equals"
required
(change)="toggleUser()">
<option [ngValue]="{_id: '0'}">Auswählen...</option>
<option [ngValue]="{_id: '0'}">{{'request.promotion.field.participant.placeholder' | translate}}</option>
<option *ngFor="let user of users" [ngValue]="user">
{{user.username}}
</option>
@ -20,7 +20,7 @@
<div *ngIf="showForm">
<div class="form-group">
<label for="user">Aktueller Rang</label>
<label for="user">{{'request.promotion.field.rank.before' | translate}}</label>
<input class="form-control"
[(ngModel)]="selectedUserRank"
[ngModelOptions]="{standalone: true}"
@ -28,7 +28,7 @@
</div>
<div class="form-group">
<label for="decoration">Neuer Rang</label>
<label for="decoration">{{'request.promotion.field.rank.after' | translate}}</label>
<select class="form-control"
name="decoration"
id="decoration"
@ -46,7 +46,7 @@
<button id="cancel"
(click)="cancel()"
class="btn btn-default">
Abbrechen
{{'request.promotion.button.cancel' | translate}}
</button>
<button id="save"
@ -54,7 +54,7 @@
(click)="addPromotion()"
class="btn btn-default"
[disabled]="newLevel === user.rankLvl">
Bestätigen
{{'request.promotion.button.submit' | translate}}
</button>
<div class="table-container">
@ -62,13 +62,13 @@
<table class="table table-hover">
<thead>
<tr>
<th class="col-sm-1">Teilnehmer</th>
<th class="col-sm-1">Alter Rang</th>
<th class="col-sm-1">Neuer Rang</th>
<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>
<th class="col-sm-1">{{'request.promotion.table.head.participant' | translate}}</th>
<th class="col-sm-1">{{'request.promotion.table.head.rank.before' | translate}}</th>
<th class="col-sm-1">{{'request.promotion.table.head.rank.after' | translate}}</th>
<th class="col-sm-1 ">{{'request.promotion.table.head.requester' | translate}}</th>
<th class="col-sm-1 text-center">{{'request.promotion.table.head.date' | translate}}</th>
<th class="col-sm-1 text-center">{{'request.promotion.table.head.status' | translate}}</th>
<th class="col-sm-2 text-right">{{'request.promotion.table.head.reject.reason' | translate}}</th>
</tr>
</thead>
<tbody *ngFor="let promotion of uncheckedPromotions">
@ -89,10 +89,18 @@
{{promotion.timestamp | date: 'dd.MM.yyyy'}}
</td>
<td class="text-center">
{{promotion.confirmed === 0? 'In Bearbeitung' : (promotion.confirmed === 1? 'Genehmigt' : 'Abgelehnt')}}
<span *ngIf="promotion.confirmed === 0">
{{'request.confirm.promotion.table.status.progressing' | translate}}
</span>
<span *ngIf="promotion.confirmed === 1">
{{'request.confirm.promotion.table.status.accepted' | translate}}
</span>
<span *ngIf="promotion.confirmed !== 0 && promotion.confirmed !== 1">
{{'request.confirm.promotion.table.status.rejected' | translate}}
</span>
</td>
<td class="text-right">
{{promotion.rejectReason ? promotion.rejectReason : ''}}
<span *ngIf="promotion.rejectReason">{{promotion.rejectReason}}</span>
</td>
</tr>
</tbody>

View File

@ -98,5 +98,4 @@ export class RequestPromotionComponent implements OnInit {
return o1._id === o2._id;
}
}
}

View File

@ -1,11 +1,13 @@
import {Component} from '@angular/core';
import {TranslateService} from '@ngx-translate/core';
@Component({
selector: 'cc-request',
selector: 'cc-request-root',
templateUrl: 'request.component.html',
styleUrls: ['request.component.css']
})
export class RequestComponent {
constructor() {
constructor(private translate: TranslateService) {
translate.setDefaultLang('de');
}
}

View File

@ -9,11 +9,38 @@ import {ConfirmPromotionComponent} from './confirm-promotion/confirm-promotion.c
import {RequestAwardComponent} from './award/req-award.component';
import {RequestPromotionComponent} from './promotion/req-promotion.component';
import {SqlDashboardComponent} from './sql-dashboard/sql-dashboard.component';
import {HttpClient} from '@angular/common/http';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
import {TranslateLoader, TranslateModule} from '@ngx-translate/core';
export function createTranslateLoader(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/request/', '.json');
}
@NgModule({
declarations: [RequestComponent, RequestPromotionComponent, RequestAwardComponent, ConfirmPromotionComponent,
ConfirmAwardComponent, SqlDashboardComponent, FilterRankPipe],
imports: [CommonModule, SharedModule, requestRouterModule]
declarations: [
RequestComponent,
RequestPromotionComponent,
RequestAwardComponent,
ConfirmPromotionComponent,
ConfirmAwardComponent,
SqlDashboardComponent,
FilterRankPipe
],
imports: [
CommonModule,
SharedModule,
requestRouterModule,
TranslateModule.forChild({
loader: {
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [HttpClient]
},
isolate: true
})
]
})
export class RequestModule {
static routes = requestRouterModule;

View File

@ -11,33 +11,37 @@ import {LoginGuardHL, LoginGuardSQL} from '../login';
import {SqlDashboardComponent} from './sql-dashboard/sql-dashboard.component';
export const requestRoutes: Routes = [{
path: '', component: RequestComponent
},
export const requestRoutes: Routes = [
{
path: RouteConfig.requestAwardPath,
component: RequestAwardComponent,
canActivate: [LoginGuardSQL]
},
{
path: RouteConfig.requestPromotionPath,
component: RequestPromotionComponent,
canActivate: [LoginGuardSQL]
},
{
path: RouteConfig.sqlDashboardPath,
component: SqlDashboardComponent,
canActivate: [LoginGuardSQL]
},
{
path: RouteConfig.confirmAwardPath,
component: ConfirmAwardComponent,
canActivate: [LoginGuardHL]
},
{
path: RouteConfig.confirmPromotionPath,
component: ConfirmPromotionComponent,
canActivate: [LoginGuardHL]
path: '',
component: RequestComponent,
children: [
{
path: RouteConfig.requestAwardPath,
component: RequestAwardComponent,
canActivate: [LoginGuardSQL]
},
{
path: RouteConfig.requestPromotionPath,
component: RequestPromotionComponent,
canActivate: [LoginGuardSQL]
},
{
path: RouteConfig.sqlDashboardPath,
component: SqlDashboardComponent,
canActivate: [LoginGuardSQL]
},
{
path: RouteConfig.confirmAwardPath,
component: ConfirmAwardComponent,
canActivate: [LoginGuardHL]
},
{
path: RouteConfig.confirmPromotionPath,
component: ConfirmPromotionComponent,
canActivate: [LoginGuardHL]
},
]
},
];

View File

@ -1,16 +1,16 @@
<div class="overview">
<h3>SQL Dashboard</h3>
<h3>{{'request.sql.dashboard.headline' | translate}}</h3>
<div class="table-container">
<label>Beförderungsanträge</label>
<label>{{'request.confirm.promotion.headline' | translate}}</label>
<table class="table table-hover">
<thead>
<tr>
<th class="col-sm-1">Teilnehmer</th>
<th class="col-sm-1">Alter Rang</th>
<th class="col-sm-1">Neuer Rang</th>
<th class="col-sm-1 ">Antragsteller</th>
<th class="col-sm-1 text-center">Datum</th>
<th class="col-sm-1">{{'request.confirm.promotion.table.head.participant' | translate}}</th>
<th class="col-sm-1">{{'request.confirm.promotion.table.head.rank.before' | translate}}</th>
<th class="col-sm-1">{{'request.confirm.promotion.table.head.rank.after' | translate}}</th>
<th class="col-sm-1 ">{{'request.confirm.promotion.table.head.requester' | translate}}</th>
<th class="col-sm-1 text-center">{{'request.confirm.promotion.table.head.date' | translate}}</th>
</tr>
</thead>
<tbody *ngFor="let promotion of promotions">
@ -36,16 +36,16 @@
</div>
<div class="table-container">
<label>Anträge für Orden/ Auszeichnungen</label>
<label>{{'request.confirm.award.headline' | translate}}</label>
<table class="table table-hover">
<thead>
<tr>
<th class="col-sm-1">Teilnehmer</th>
<th class="col-sm-1">Bild</th>
<th class="col-sm-2">Bezeichnung</th>
<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">{{'request.confirm.award.table.head.participant' | translate}}</th>
<th class="col-sm-1"></th>
<th class="col-sm-2">{{'request.confirm.award.table.head.award' | translate}}</th>
<th class="col-sm-2">{{'request.confirm.award.table.head.reason' | translate}}</th>
<th class="col-sm-1 ">{{'request.confirm.award.table.head.requester' | translate}}</th>
<th class="col-sm-1 text-right">{{'request.confirm.award.table.head.date' | translate}}</th>
</tr>
</thead>
<tbody *ngFor="let award of awards">

View File

@ -0,0 +1,72 @@
{
"public.error.message.required": "{{fieldName}} ist ein Pflichtfeld",
"public.error.message.min.length": "{{fieldName}} muss mindestens {{boundary}} Zeichen enthalten",
"public.error.message.max.length": "{{fieldName}} darf maximal {{boundary}} Zeichen enthalten",
"public.error.message.email": "Bitte geben Sie eine gültige E-Mail Adresse an",
"public.error.message.no.user": "Der eingetragene Benutzer existiert nicht.",
"public.error.message.default": "{{fieldName}} ist nicht valide",
"public.common.search.button": "Suchen",
"request.confirm.award.headline": "Offene Anträge - Auszeichnungen",
"request.confirm.award.table.head.participant": "Teilnehmer",
"request.confirm.award.table.head.award": "Auszeichnung",
"request.confirm.award.table.head.reason": "Begründung",
"request.confirm.award.table.head.requester": "Antragsteller",
"request.confirm.award.table.head.date": "Datum",
"request.confirm.award.table.head.action": "Aktion",
"request.confirm.award.table.reject.reason.placeholder": "Begründung für Ablehnung (optional)",
"request.confirm.award.table.button.action.accept": "Bestätigen",
"request.confirm.award.table.button.action.reject": "Ablehnen",
"request.confirm.promotion.headline": "Offene Anträge - Beförderungen",
"request.confirm.promotion.table.head.participant": "Teilnehmer",
"request.confirm.promotion.table.head.rank.before": "Alter Rang",
"request.confirm.promotion.table.head.rank.after": "Neuer Rang",
"request.confirm.promotion.table.head.requester": "Antragsteller",
"request.confirm.promotion.table.head.date": "Datum",
"request.confirm.promotion.table.head.status": "Status",
"request.confirm.promotion.table.head.action": "Aktion",
"request.confirm.promotion.table.reject.reason.placeholder": "Begründung für Ablehnung (optional)",
"request.confirm.promotion.table.button.action.accept": "Bestätigen",
"request.confirm.promotion.table.button.action.reject": "Ablehnen",
"request.confirm.promotion.table.status.progressing": "In Bearbeitung",
"request.confirm.promotion.table.status.accepted": "Genehmigt",
"request.confirm.promotion.table.status.rejected": "Abgelehnt",
"request.award.headline": "Auszeichnung beantragen",
"request.award.field.user": "Teilnehmer",
"request.award.field.user.placeholder": "Auswählen...",
"request.award.field.award": "Auszeichnung",
"request.award.field.award.placeholder": "Auswählen...",
"request.award.field.reason": "Begründung",
"request.award.field.reason.placeholder": "Begründung eingeben...",
"request.award.button.cancel": "Abbrechen",
"request.award.button.submit": "Bestätigen",
"request.award.table.head.image": "Bild",
"request.award.table.head.name": "Bezeichnung",
"request.award.table.head.reason": "Begründung",
"request.award.table.head.requester": "Antragsteller",
"request.award.table.head.date": "Datum",
"request.award.table.head.status": "Status",
"request.award.table.head.reject.reason": "Grund für Ablehnung",
"request.award.table.status.progressing": "In Bearbeitung",
"request.award.table.status.accepted": "Genehmigt",
"request.award.table.status.rejected": "Abgelehnt",
"request.promotion.headline": "Beförderung beantragen",
"request.promotion.field.participant": "Teilnehmer",
"request.promotion.field.participant.placeholder": "Auswählen...",
"request.promotion.field.rank.before": "Aktueller Rang",
"request.promotion.field.rank.after": "Neuer Rang",
"request.promotion.button.submit": "Bestätigen",
"request.promotion.button.cancel": "Abbrechen",
"request.promotion.table.head.participant": "Teilnehmer",
"request.promotion.table.head.rank.before": "Alter Rang",
"request.promotion.table.head.rank.after": "Neuer Rang",
"request.promotion.table.head.requester": "Antragsteller",
"request.promotion.table.head.date": "Datum",
"request.promotion.table.head.status": "Status",
"request.promotion.table.head.reject.reason": "Grund für Ablehnung",
"request.sql.dashboard.headline":"SQL Dashboard"
}

View File

@ -0,0 +1,2 @@
{
}