feat: edit print templates on the printer page and store them on presets
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
@using WebApp.Services
|
||||
|
||||
<MudDialog Class="no-print">
|
||||
<DialogContent>
|
||||
@if (Pages.Count == 0)
|
||||
{
|
||||
<MudText Class="mud-text-secondary">No matching records for these filters.</MudText>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (Pages.Count > 75)
|
||||
{
|
||||
<MudAlert Severity="Severity.Warning" Dense="true" Class="mb-3">
|
||||
This preview has @Pages.Count pages. Printing a large set can be slow.
|
||||
</MudAlert>
|
||||
}
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary mb-2">
|
||||
@Pages.Count page@(Pages.Count == 1 ? "" : "s")
|
||||
</MudText>
|
||||
<PrintPageStack Pages="Pages"
|
||||
NewPagePerRecord="NewPagePerRecord"
|
||||
PrintPageStyle="@PrintPageStyle" />
|
||||
}
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<MudButton OnClick="Close">Close</MudButton>
|
||||
<MudButton Variant="Variant.Filled"
|
||||
Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Filled.Print"
|
||||
OnClick="PrintAsync"
|
||||
Disabled="@(Pages.Count == 0)">
|
||||
Print
|
||||
</MudButton>
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
|
||||
@code {
|
||||
[CascadingParameter]
|
||||
IMudDialogInstance MudDialog { get; set; } = null!;
|
||||
|
||||
[Parameter, EditorRequired]
|
||||
public IReadOnlyList<NotePrintPage> Pages { get; set; } = [];
|
||||
|
||||
[Parameter]
|
||||
public bool NewPagePerRecord { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public string PrintPageStyle { get; set; } = string.Empty;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback OnPrint { get; set; }
|
||||
|
||||
private async Task PrintAsync()
|
||||
{
|
||||
if (OnPrint.HasDelegate)
|
||||
await OnPrint.InvokeAsync();
|
||||
}
|
||||
|
||||
private void Close() => MudDialog.Close();
|
||||
}
|
||||
Reference in New Issue
Block a user