feat: wire cashbox export and subscription dialogs into Cashbox page
Adds an Export button (opens CashboxExportDialog directly) plus a secondary menu (opens CashboxExportSubscriptionDialog) to the journal toolbar, gated by the existing canBook permission signal.
This commit is contained in:
@@ -178,6 +178,25 @@
|
|||||||
}
|
}
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
@if (canBook()) {
|
||||||
|
<button mat-stroked-button type="button" (click)="openExportDialog()">
|
||||||
|
<mat-icon>download</mat-icon>
|
||||||
|
Export
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
mat-icon-button
|
||||||
|
type="button"
|
||||||
|
[matMenuTriggerFor]="exportMenu"
|
||||||
|
aria-label="Weitere Exportoptionen"
|
||||||
|
>
|
||||||
|
<mat-icon>more_vert</mat-icon>
|
||||||
|
</button>
|
||||||
|
<mat-menu #exportMenu="matMenu">
|
||||||
|
<button mat-menu-item (click)="openExportSubscriptionDialog()">
|
||||||
|
Automatischen Versand einrichten
|
||||||
|
</button>
|
||||||
|
</mat-menu>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ag-grid-angular
|
<ag-grid-angular
|
||||||
|
|||||||
@@ -281,4 +281,29 @@ describe('Cashbox', () => {
|
|||||||
expect.objectContaining({ amount: 0, note: '', type: 11 }),
|
expect.objectContaining({ amount: 0, note: '', type: 11 }),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('opens the cashbox export dialog when the treasurer clicks Export', async () => {
|
||||||
|
const { fixture, dialog } = await setup();
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
const exportButton = [...(fixture.nativeElement as HTMLElement).querySelectorAll('button')].find(
|
||||||
|
(btn) => btn.textContent?.includes('Export'),
|
||||||
|
);
|
||||||
|
exportButton?.click();
|
||||||
|
|
||||||
|
expect(dialog.open).toHaveBeenCalledWith(
|
||||||
|
expect.anything(),
|
||||||
|
expect.objectContaining({ data: { teamId: expect.any(Number) } }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('hides the Export button from a member without booking rights', async () => {
|
||||||
|
const { fixture } = await setup(1);
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
const exportButton = [...(fixture.nativeElement as HTMLElement).querySelectorAll('button')].find(
|
||||||
|
(btn) => btn.textContent?.includes('Export'),
|
||||||
|
);
|
||||||
|
expect(exportButton).toBeUndefined();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { MatDialog } from '@angular/material/dialog';
|
|||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { MatMenuModule } from '@angular/material/menu';
|
||||||
import { MatSelectModule } from '@angular/material/select';
|
import { MatSelectModule } from '@angular/material/select';
|
||||||
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||||
import { AgGridAngular } from 'ag-grid-angular';
|
import { AgGridAngular } from 'ag-grid-angular';
|
||||||
@@ -38,6 +39,8 @@ import {
|
|||||||
} from '../../../models/transaction.model';
|
} from '../../../models/transaction.model';
|
||||||
import { ConfirmDialog, ConfirmDialogData } from '../../../shared/confirm-dialog/confirm-dialog';
|
import { ConfirmDialog, ConfirmDialogData } from '../../../shared/confirm-dialog/confirm-dialog';
|
||||||
import { ContextHelp } from '../../../shared/context-help/context-help';
|
import { ContextHelp } from '../../../shared/context-help/context-help';
|
||||||
|
import { CashboxExportDialog } from './cashbox-export-dialog/cashbox-export-dialog';
|
||||||
|
import { CashboxExportSubscriptionDialog } from './cashbox-export-subscription-dialog/cashbox-export-subscription-dialog';
|
||||||
import '../../../shared/ag-grid/ag-grid-modules';
|
import '../../../shared/ag-grid/ag-grid-modules';
|
||||||
import { teamwalletGridTheme } from '../../../shared/ag-grid/ag-grid-theme';
|
import { teamwalletGridTheme } from '../../../shared/ag-grid/ag-grid-theme';
|
||||||
import { AmountCellRenderer } from '../../../shared/ag-grid/amount-cell-renderer';
|
import { AmountCellRenderer } from '../../../shared/ag-grid/amount-cell-renderer';
|
||||||
@@ -72,6 +75,7 @@ const JOURNAL_TYPE_OPTIONS: { value: string; label: string }[] = [
|
|||||||
MatFormFieldModule,
|
MatFormFieldModule,
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
MatInputModule,
|
MatInputModule,
|
||||||
|
MatMenuModule,
|
||||||
MatSelectModule,
|
MatSelectModule,
|
||||||
MatSnackBarModule,
|
MatSnackBarModule,
|
||||||
ContextHelp,
|
ContextHelp,
|
||||||
@@ -396,6 +400,18 @@ export class Cashbox {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected openExportDialog(): void {
|
||||||
|
const teamId = this.team()?.id;
|
||||||
|
if (!teamId) return;
|
||||||
|
this.dialog.open(CashboxExportDialog, { data: { teamId } });
|
||||||
|
}
|
||||||
|
|
||||||
|
protected openExportSubscriptionDialog(): void {
|
||||||
|
const teamId = this.team()?.id;
|
||||||
|
if (!teamId) return;
|
||||||
|
this.dialog.open(CashboxExportSubscriptionDialog, { data: { teamId } });
|
||||||
|
}
|
||||||
|
|
||||||
protected typeLabel(type: string): string {
|
protected typeLabel(type: string): string {
|
||||||
return (
|
return (
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user