Skip to content

Commit

Permalink
Add disable imprint option to options page
Browse files Browse the repository at this point in the history
  • Loading branch information
jggoebel committed Jun 5, 2024
1 parent b35ee2b commit 5f21546
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/app/config/config.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@
/>
</clr-checkbox-wrapper>
</clr-checkbox-container>
<clr-checkbox-container>
<label class="clr-col-md-4">Disable Imprint</label>
<clr-checkbox-wrapper>
<input
class="clr-col-md-8"
type="checkbox"
clrCheckbox
name="disable_imprint"
formControlName="disable_imprint"
/>
</clr-checkbox-wrapper>
</clr-checkbox-container>
</form>
<button type="button" class="btn btn-outline" (click)="storeSettings()">
Save
Expand Down
15 changes: 15 additions & 0 deletions src/app/config/config.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class Cooldown {
})
export class ConfigComponent {
badgeScanningMode: boolean;
disableImprint: boolean;
scannerTest: boolean;
scannedCode = false;
scannerTimeoutId: number;
Expand All @@ -28,6 +29,9 @@ export class ConfigComponent {
badge_scanner: new FormControl<string | null>(null, [
Validators.required,
]),
disable_imprint: new FormControl<string | null>(null, [
Validators.required,
]),
},
{
validators: ({ value: { new_password1: pw1, new_password1: pw2 } }) =>
Expand All @@ -40,9 +44,14 @@ export class ConfigComponent {
? true
: false;

this.disableImprint = localStorage.getItem('disable_imprint')
? true
: false;

this.settingsForm.setValue({
server: localStorage.getItem('score_server'),
badge_scanner: this.badgeScanningMode,
disable_imprint: this.disableImprint,
});

// in normal mode display the
Expand Down Expand Up @@ -73,11 +82,17 @@ export class ConfigComponent {
localStorage.setItem('score_server', server);
const badge_scanning_mode =
this.settingsForm.controls['badge_scanner'].value;
const disableImprint = this.settingsForm.controls['disable_imprint'].value;
if (badge_scanning_mode == true) {
localStorage.setItem('badge_scanner', 'true');
} else {
localStorage.removeItem('badge_scanner');
}
if (disableImprint == true) {
localStorage.setItem('disable_imprint', 'true');
} else {
localStorage.removeItem('disable_imprint');
}
window.location.reload();
}

Expand Down

0 comments on commit 5f21546

Please sign in to comment.