fix login;

This commit is contained in:
Daniel Ponte 2024-12-21 07:52:57 -05:00
parent 200379980a
commit e8355ee451
5 changed files with 49 additions and 6 deletions

View file

@ -12,6 +12,24 @@
</div> </div>
<div class="tabFootContainer"> <div class="tabFootContainer">
<table class="callsTable" mat-table [dataSource]="callsResult"> <table class="callsTable" mat-table [dataSource]="callsResult">
<ng-container matColumnDef="select">
<th mat-header-cell *matHeaderCellDef>
<mat-checkbox
(change)="$event ? masterToggle() : null"
[checked]="selection.hasValue() && isAllSelected()"
[indeterminate]="selection.hasValue() && !isAllSelected()"
>
</mat-checkbox>
</th>
<td mat-cell *matCellDef="let row">
<mat-checkbox
(click)="$event.stopPropagation()"
(change)="$event ? selection.toggle(row) : null"
[checked]="selection.isSelected(row)"
>
</mat-checkbox>
</td>
</ng-container>
<ng-container matColumnDef="play"> <ng-container matColumnDef="play">
<th mat-header-cell *matHeaderCellDef></th> <th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let call"> <td mat-cell *matCellDef="let call">

View file

@ -39,17 +39,25 @@ tr.mat-mdc-row {
display: block !important; display: block !important;
} }
.mat-column-select,
.mat-column-date, .mat-column-date,
.mat-column-time, .mat-column-time,
.mat-column-play, .mat-column-play,
.mat-column-download, .mat-column-download,
.mat-column-duration { .mat-column-duration {
width: 70px; width: 2%;
}
.mat-column-system {
width: 4%;
}
.mat-column-talkgroup {
width: 40%;
} }
@media screen and (max-width: 768px) { @media screen and (max-width: 768px) {
.mat-column-group, .mat-column-group {
.mat-column-frequency {
display: none; display: none;
} }

View file

@ -149,6 +149,7 @@ const reqPageSize = 200;
MatInputModule, MatInputModule,
MatDatepickerModule, MatDatepickerModule,
MatTimepickerModule, MatTimepickerModule,
MatCheckboxModule,
], ],
templateUrl: './calls.component.html', templateUrl: './calls.component.html',
styleUrl: './calls.component.scss', styleUrl: './calls.component.scss',
@ -159,8 +160,9 @@ export class CallsComponent {
count = 0; count = 0;
page = 0; page = 0;
perPage = 25; perPage = 25;
pageSizeOptions = [25, 50, 75, 100, 200, 500]; pageSizeOptions = [25, 50, 75, 100, 200];
columns = [ columns = [
'select',
'play', 'play',
'download', 'download',
'date', 'date',
@ -174,6 +176,8 @@ export class CallsComponent {
currentSet!: CallRecord[]; currentSet!: CallRecord[];
currentServerPage = 0; // page is never 0, forces load currentServerPage = 0; // page is never 0, forces load
selection = new SelectionModel<CallRecord>(true, []);
start = new FormControl(this.lTime(new Date())); start = new FormControl(this.lTime(new Date()));
end = new FormControl(null); end = new FormControl(null);
@ -182,6 +186,18 @@ export class CallsComponent {
private prefsSvc: PrefsService, private prefsSvc: PrefsService,
) {} ) {}
isAllSelected() {
const numSelected = this.selection.selected.length;
const numRows = this.curPage.pageSize;
return numSelected === numRows;
}
masterToggle() {
this.isAllSelected()
? this.selection.clear()
: this.callsResult.value.forEach((row) => this.selection.select(row));
}
lTime(now: Date): string { lTime(now: Date): string {
now.setDate(new Date().getDate() - 7); now.setDate(new Date().getDate() - 7);
now.setMinutes(now.getMinutes() - now.getTimezoneOffset()); now.setMinutes(now.getMinutes() - now.getTimezoneOffset());
@ -196,6 +212,7 @@ export class CallsComponent {
} }
setPage(p: PageEvent) { setPage(p: PageEvent) {
this.selection.clear();
this.curPage = p; this.curPage = p;
const current = new Date(); const current = new Date();
this.getCalls(p); this.getCalls(p);

View file

@ -25,7 +25,7 @@
</mat-form-field> </mat-form-field>
</div> </div>
<div> <div>
<button class="login" (click)="onSubmit()">Login</button> <button class="login sbButton" (click)="onSubmit()">Login</button>
</div> </div>
</form> </form>
@if (failed) { @if (failed) {

View file

@ -83,7 +83,7 @@ export class TalkgroupTableComponent {
talkgroups = input<TalkgroupsPaginated>(); talkgroups = input<TalkgroupsPaginated>();
talkgroups$ = toObservable(this.talkgroups); talkgroups$ = toObservable(this.talkgroups);
dataSource = new MatTableDataSource<Talkgroup>(); dataSource = new MatTableDataSource<Talkgroup>();
pageSizeOptions = [25, 50, 75, 100, 200, 500]; pageSizeOptions = [25, 50, 75, 100, 200];
perPage: number = 25; perPage: number = 25;
count = 0; count = 0;
columns = [ columns = [