Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export * from './wkdurchfuehrung/wkdurchfuehrung.component';
export * from './schusszettel/schusszettel.component';
export * from './schusszettel/number.directive';
export {RingzahlTabIndexDirective} from './schusszettel/tabindex.directive';
export {RingzahlTabIndexDirective, SchuetzeTabIndexDirective} from './schusszettel/tabindex.directive';
export * from './tablet-admin/tablet-admin.component';
export * from './tableteingabe/tableteingabe.component';
export * from './fullscreen/fullscreen.component';
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ <h3>
<ng-template ngFor let-j="index" let-passe [ngForOf]="schuetze">
<td *ngIf="j === 0">
<select
[blaSchuetzeTabIndex]="1"
[(ngModel)]="passe.rueckennummer"
(ngModelChange)="onSchuetzeChangeDropdown($event, 1, i, j)"
[disabled]="readOnlyMode"
Expand Down Expand Up @@ -323,6 +324,7 @@ <h3>
<ng-template ngFor let-j="index" let-passe [ngForOf]="schuetze">
<td *ngIf="j === 0">
<select
[blaSchuetzeTabIndex]="2"
[(ngModel)]="passe.rueckennummer"
(ngModelChange)="onSchuetzeChangeDropdown($event, 2, i, j)"
[disabled]="readOnlyMode"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Directive, ElementRef} from '@angular/core';
import {Directive, ElementRef, Input} from '@angular/core';

/**
* Index generator for tabindex number generation,
Expand Down Expand Up @@ -34,11 +34,21 @@ class RingzahlIndexGenerator extends IndexGenerator {
[39, 64], // mid left second table, mid right second table
[41, 66], // bottom left second table, bottom right second table
];

// Tabindex-Start für Team 1
const TEAM1_OFFSET = 20;
// Tabindex-Start für Team 2
const TEAM2_OFFSET = 120;

this.indices = [];
for (const row of rows) {
for (let i = row[0]; i <= row[1]; i += 6) {
this.indices.push(i);
this.indices.push(i + 1);
const offset = i < 37 ? TEAM1_OFFSET : TEAM2_OFFSET;

// Pfeil 1 bekommt den nächsten Tabindex
this.indices.push(i + offset);
// Pfeil 2 bekommt den nächsten Tabindex
this.indices.push(i + 1 + offset);
}
}
this.currIdx = 0;
Expand Down Expand Up @@ -68,3 +78,29 @@ export class RingzahlTabIndexDirective extends TabIndexDirective {
this.el.nativeElement.setAttribute('tabindex', ringzahlIdxGen.getNext());
}
}

// Directive, die einem Schützen im Formular einen Tabindex gibt
@Directive({
selector: '[blaSchuetzeTabIndex]'
})
export class SchuetzeTabIndexDirective {
// Startindex für Team 1
private static team1Idx = 1;
// Startindex für Team 2
private static team2Idx = 101;

@Input('blaSchuetzeTabIndex') team!: number;

constructor(private el: ElementRef) {
}

ngOnInit() {
const idx =
this.team === 1
? SchuetzeTabIndexDirective.team1Idx++
: SchuetzeTabIndexDirective.team2Idx++;

// Tabindex als HTML-Attribut setzen
this.el.nativeElement.setAttribute('tabindex', idx);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
TabletAdminComponent,
PfeilNumberOnlyDirective,
FehlerpunkteNumberOnlyDirective,
SchuetzeTabIndexDirective,
} from '../wkdurchfuehrung/components';

import {
Expand Down Expand Up @@ -47,6 +48,7 @@ import {QRCodeModule} from 'angularx-qrcode';
TeilnemendeManschaftenTabelleComponent,
FullscreenComponent,
TabletAdminPopUpComponent,
SchuetzeTabIndexDirective
],
providers: [
WkdurchfuehrungGuard,
Expand Down