94 lines
3.3 KiB
Plaintext
94 lines
3.3 KiB
Plaintext
<MudPaper Class="pa-4 h-100 d-flex flex-column overflow-hidden" Elevation="2">
|
|
<MudStack Row AlignItems="AlignItems.Center" Justify="Justify.SpaceBetween"
|
|
Class="mb-4 flex-shrink-0">
|
|
<MudText Typo="Typo.h6">📄 JSON Output (/order)</MudText>
|
|
|
|
<div class="d-flex gap-2">
|
|
|
|
<!-- IMPORT -->
|
|
<MudButton Variant="Variant.Outlined"
|
|
Color="Color.Secondary"
|
|
Size="Size.Small"
|
|
StartIcon="@Icons.Material.Filled.UploadFile"
|
|
OnClick="OnImport">
|
|
Import JSON
|
|
</MudButton>
|
|
|
|
<!-- CANCEL -->
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="Color.Error"
|
|
StartIcon="@Icons.Material.Filled.Cancel"
|
|
Disabled="@DisableCancel"
|
|
OnClick="OnCancel">
|
|
Cancel
|
|
</MudButton>
|
|
|
|
<!-- SEND -->
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="@SendButtonColor"
|
|
StartIcon="@SendButtonIcon"
|
|
OnClick="OnSend"
|
|
Disabled="@(string.IsNullOrEmpty(OrderJson.Trim()))">
|
|
@SendButtonText
|
|
</MudButton>
|
|
|
|
<!-- COPY -->
|
|
<MudTooltip Text="@(Copied ? "Copied!" : "Copy to clipboard")">
|
|
<MudButton Variant="Variant.Filled"
|
|
Color="@(Copied ? Color.Success : Color.Primary)"
|
|
StartIcon="@(Copied ? Icons.Material.Filled.Check : Icons.Material.Filled.ContentCopy)"
|
|
OnClick="OnCopy">
|
|
@(Copied ? "Copied!" : "Copy")
|
|
</MudButton>
|
|
</MudTooltip>
|
|
</div>
|
|
</MudStack>
|
|
|
|
<div class="flex-grow-1">
|
|
<MudTextField Value="@OrderJson"
|
|
ReadOnly
|
|
Variant="Variant.Filled"
|
|
Lines="50"
|
|
Style="font-family: 'Roboto Mono', Consolas, monospace;
|
|
font-size: 0.85rem;
|
|
background:#1e1e1e;
|
|
color:#d4d4d4;" />
|
|
</div>
|
|
</MudPaper>
|
|
|
|
@code {
|
|
[Parameter] public string OrderJson { get; set; } = "";
|
|
[Parameter] public bool Copied { get; set; }
|
|
[Parameter] public bool? SendSuccess { get; set; }
|
|
[Parameter] public bool DisableCancel { get; set; }
|
|
|
|
[Parameter] public EventCallback OnCopy { get; set; }
|
|
[Parameter] public EventCallback OnSend { get; set; }
|
|
[Parameter] public EventCallback OnImport { get; set; }
|
|
[Parameter] public EventCallback OnCancel { get; set; }
|
|
|
|
private string SendButtonText =>
|
|
SendSuccess switch
|
|
{
|
|
true => "Done",
|
|
false => "Error",
|
|
_ => "Send"
|
|
};
|
|
|
|
private Color SendButtonColor =>
|
|
SendSuccess switch
|
|
{
|
|
true => Color.Success,
|
|
false => Color.Error,
|
|
_ => Color.Success
|
|
};
|
|
|
|
private string SendButtonIcon =>
|
|
SendSuccess switch
|
|
{
|
|
true => Icons.Material.Filled.CheckCircle,
|
|
false => Icons.Material.Filled.Error,
|
|
_ => Icons.Material.Filled.Send
|
|
};
|
|
}
|