-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
191 additions
and
2,022 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 5 additions & 15 deletions
20
src/app/components/einstellungen/globale-einstellungen/globale-einstellungen.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,5 @@ | ||
<div *ngFor="let name of appNaming | keyvalue"> | ||
<div class="form-group"> | ||
<label for="name">{{ name.key }}</label> | ||
<input | ||
pInputText | ||
type="text" | ||
class="form-control" | ||
id="name" | ||
[ngModel]="name.value" | ||
(ngModelChange)="editNaming[name.key] = $event" | ||
/> | ||
</div> | ||
</div> | ||
|
||
<p-button label="Save" (onClick)="saveNaming()"></p-button> | ||
<p-tabView> | ||
<p-tabPanel header="UI Naming"> | ||
<app-ui-naming-config></app-ui-naming-config> | ||
</p-tabPanel> | ||
</p-tabView> |
16 changes: 3 additions & 13 deletions
16
src/app/components/einstellungen/globale-einstellungen/globale-einstellungen.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,13 @@ | ||
import { Component } from "@angular/core"; | ||
import * as _ from "lodash"; | ||
import { ConfigApiService } from "src/app/services/api/config-api.service"; | ||
import { AppNamingService } from "src/app/services/config.service"; | ||
import { MkjToolbarService } from "src/app/utilities/mkj-toolbar/mkj-toolbar.service"; | ||
|
||
@Component({ | ||
selector: "app-globale-einstellungen", | ||
templateUrl: "./globale-einstellungen.component.html", | ||
styleUrls: ["./globale-einstellungen.component.scss"], | ||
}) | ||
export class GlobaleEinstellungenComponent { | ||
public readonly appNaming = _.cloneDeep(this.namingService.appNaming); | ||
public readonly editNaming = _.cloneDeep(this.namingService.appNaming); | ||
|
||
constructor( | ||
private namingService: AppNamingService, | ||
private configService: ConfigApiService | ||
) {} | ||
|
||
public saveNaming(): void { | ||
this.configService.setUiNamingConfig(this.editNaming).subscribe(); | ||
constructor(toolBar: MkjToolbarService) { | ||
toolBar.header = "Globale Einstellungen"; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...ents/einstellungen/globale-einstellungen/ui-naming-config/ui-naming-config.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div class="grid"> | ||
<ng-container *ngFor="let name of appNaming | keyvalue"> | ||
<div class="col-12 lg:col-3 md:col-4 sm:col-6"> | ||
<mkj-text-input | ||
[label]="name.key" | ||
[value]="name.value" | ||
(valueChange)="editNaming[name.key] = $event" | ||
></mkj-text-input> | ||
</div> | ||
</ng-container> | ||
</div> | ||
|
||
<p-button label="Save" (onClick)="saveNaming()"></p-button> |
Empty file.
28 changes: 28 additions & 0 deletions
28
...onents/einstellungen/globale-einstellungen/ui-naming-config/ui-naming-config.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Component } from "@angular/core"; | ||
import * as _ from "lodash"; | ||
import { ConfigApiService } from "src/app/services/api/config-api.service"; | ||
import { AppNamingService } from "src/app/services/config.service"; | ||
import { InfoService } from "src/app/services/info.service"; | ||
|
||
@Component({ | ||
selector: "app-ui-naming-config", | ||
templateUrl: "./ui-naming-config.component.html", | ||
styleUrls: ["./ui-naming-config.component.scss"], | ||
}) | ||
export class UiNamingConfigComponent { | ||
public readonly appNaming = _.cloneDeep(this.namingService.appNaming); | ||
public readonly editNaming = _.cloneDeep(this.namingService.appNaming); | ||
|
||
constructor( | ||
private namingService: AppNamingService, | ||
private configService: ConfigApiService, | ||
private infoService: InfoService | ||
) {} | ||
|
||
public saveNaming(): void { | ||
this.configService.setUiNamingConfig(this.editNaming).subscribe({ | ||
next: (_) => this.infoService.success("Einstellungen gespeichert."), | ||
error: (err) => this.infoService.error(err), | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/app/utilities/form-input-components/abstract-control-accessor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { | ||
Component, | ||
EventEmitter, | ||
Injector, | ||
Input, | ||
Output, | ||
} from "@angular/core"; | ||
import { ControlValueAccessor, FormControl, NgControl } from "@angular/forms"; | ||
import { BehaviorSubject, Observable, distinctUntilChanged } from "rxjs"; | ||
|
||
@Component({ | ||
selector: "abstract-control-accessor", | ||
template: "", | ||
}) | ||
export abstract class AbstractControlAccessor<T> | ||
implements ControlValueAccessor | ||
{ | ||
private _value = new BehaviorSubject<T>(null); | ||
private _disabled = new BehaviorSubject(false); | ||
|
||
private _registerOnChange: (_: T) => void; | ||
private _registerOnTouched: () => void; | ||
|
||
@Input() | ||
public set value(value: T) { | ||
this._value.next(value); | ||
} | ||
|
||
public get disabled(): boolean { | ||
return this._disabled.value; | ||
} | ||
|
||
@Input() | ||
public set disabled(isDisabled: boolean) { | ||
this._disabled.next(isDisabled); | ||
} | ||
|
||
@Input() | ||
public label: string; | ||
|
||
@Output() | ||
public valueChange = new EventEmitter<T>(); | ||
|
||
public get value$(): Observable<T> { | ||
return this._value; | ||
} | ||
|
||
public get disabled$(): Observable<boolean> { | ||
return this._disabled.pipe(distinctUntilChanged()); | ||
} | ||
|
||
public formControl: FormControl; | ||
|
||
constructor(private inj: Injector) {} | ||
|
||
public ngAfterViewInit() { | ||
this.formControl = this.inj.get(NgControl, null) | ||
?.control as FormControl; | ||
} | ||
|
||
public change(value: T) { | ||
this._registerOnChange?.(value); | ||
this.valueChange.emit(value); | ||
} | ||
|
||
public touch() { | ||
this._registerOnTouched?.(); | ||
} | ||
|
||
writeValue(obj: T): void { | ||
this._value.next(obj); | ||
} | ||
registerOnChange(fn: any): void { | ||
this._registerOnChange = fn; | ||
} | ||
registerOnTouched(fn: any): void { | ||
this._registerOnTouched = fn; | ||
} | ||
setDisabledState(isDisabled: boolean): void { | ||
this._disabled.next(isDisabled); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/app/utilities/form-input-components/mkj-text-input/mkj-text-input.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<span class="p-float-label"> | ||
<input | ||
pInputText | ||
[ngModel]="value$ | async" | ||
(ngModelChange)="change($event)" | ||
[disabled]="disabled$ | async" | ||
(onBlur)="touch()" | ||
[class.ng-dirty]="formControl?.invalid" | ||
[class.ng-invalid]="formControl?.invalid" | ||
class="w-full" | ||
/> | ||
<label [for]="label">{{ label }}</label> | ||
</span> |
Empty file.
15 changes: 15 additions & 0 deletions
15
src/app/utilities/form-input-components/mkj-text-input/mkj-text-input.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component, Injector } from "@angular/core"; | ||
import { controlValueAccessor } from "src/app/providers/control-value-accessor"; | ||
import { AbstractControlAccessor } from "../abstract-control-accessor"; | ||
|
||
@Component({ | ||
selector: "mkj-text-input", | ||
templateUrl: "./mkj-text-input.component.html", | ||
styleUrls: ["./mkj-text-input.component.scss"], | ||
providers: [controlValueAccessor(MkjTextInputComponent)], | ||
}) | ||
export class MkjTextInputComponent extends AbstractControlAccessor<string> { | ||
constructor(inj: Injector) { | ||
super(inj); | ||
} | ||
} |
Oops, something went wrong.