dbMango/Rms.Risk.Mango.Pivot.UI/Controls/MessageBoxCheckBoxesComponent.razor
Alexander Shabarshov 2a7a24c9e7 Initial contribution
2025-11-03 14:43:26 +00:00

90 lines
2.7 KiB
Plaintext

@*
* dbMango
*
* Copyright 2025 Deutsche Bank AG
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*@
<style>
pre {
font-size: inherit;
color: inherit;
border: initial;
padding: initial;
font-family: inherit;
}
.m-body {
width: 100%;
max-height: 600px;
overflow-y: auto;
}
</style>
<p>@((MarkupString)Text)</p>
<div class="m-body">
@if (Info != null)
{
<div class="m-1">
@for ( var index = 0; index < Info.Count; index++)
{
var i = index;
<div class="form-row">
<div class="flex-stack-horizontal w-100 mr-3">
<label class="input-group-text w-75" style="min-width: 200px;">@Info[i].Name</label>
<label class="toggle-switch toggle-switch-xs input-group-text" style="display: inline-block">
<input type="checkbox" checked="@Info[i].Value" @onchange="@(e => Info[i].Value = Convert.ToBoolean(e.Value))" />
<span class="slider" data-label-on="on" data-label-off="off"></span>
</label>
</div>
</div>
}
</div>
}
</div>
<div class="form-row modal-footer w-100 p-0">
@if (ShowCancel)
{
<button class="btn btn-secondary" @onclick="@(()=>BlazoredModal.CancelAsync())">Cancel</button>
}
<button class="btn btn-primary" @onclick="@OnOK">@OkButtonName</button>
</div>
@code
{
[CascadingParameter] BlazoredModalInstance BlazoredModal { get; set; } = null!;
public class BoolNameValue
{
public string Name { get; set; } = "";
public bool Value { get; set; }
}
[Parameter] public bool ShowCancel { get; set; }
[Parameter] public string Text { get; set; } = "";
[Parameter] public List<BoolNameValue>? Info { get; set; }
[Parameter] public string OkButtonName { get; set; } = "OK";
private async Task OnOK()
{
await BlazoredModal.CloseAsync(ModalResult.Ok(true));
}
}