Thor/Thor.BlazorWAsm/Components/InspectionRow.razor
2025-02-10 18:38:27 +01:00

161 lines
4.1 KiB
Plaintext

<style>
.row{
}
.title{
margin-top: 1em;
}
.order-0{
font-size: xx-large;
}
.order-1 {
font-size: x-large;
text-indent: 2em;
}
.order-2 {
font-size: large;
text-indent: 4em;
}
.order-3 {
font-size: medium;
text-indent: 6em;
}
</style>
<div class="row align-items-center">
@if(Row is not null)
{
@if(Row.IsTitle)
{
<span class="@Class">
@Row.Item.OrderId - @Row.Item.Label
</span>
}
else if(Row.Item is ItemVerification verification)
{
<div class="col-1">
<Tooltip Class="d-inline-block" Title="Détails" role="button">
<Icon Name="IconName.Eye" Color="IconColor.Success" Size="IconSize.x5" @onclick="async () => {
await ShowDetails();
}" Style="cursor: pointer;"/>
</Tooltip>
@if (verification.Force == ItemVerification.VerificationForce.Optionnal)
{
<Tooltip Class="d-inline-block" Title="Indication" role="button">
<Icon Name="IconName.InfoCircleFill" Color="IconColor.Info" Size="IconSize.x5" />
</Tooltip>
}
else if(verification.Force == ItemVerification.VerificationForce.Recommandation)
{
<Tooltip Class="d-inline-block" Title="Recommandation" role="button">
<Icon Name="IconName.ExclamationDiamondFill" Color="IconColor.Warning" Size="IconSize.x5" />
</Tooltip>
}
else if(verification.Force == ItemVerification.VerificationForce.Mandatory)
{
<Tooltip Class="d-inline-block" Title="Obligation" role="button">
<Icon Name="IconName.ExclamationTriangleFill" Color="IconColor.Danger" Size="IconSize.x5" />
</Tooltip>
}
</div>
<div class="col-2">
@Row.Item.OrderId
</div>
<div class="col-5">
@Row.Item.Label
</div>
<div class="col-2">
@Row.Item.References
</div>
<div class="col-2">
<AnswerStateSelect
Value=@Row.Answer.CurrentState
ValueChanged="(v) => {
Row.Answer.CurrentState = v;
}"/>
<p>Out: @Row.Answer.CurrentState</p>
</div>
}
}
else
{
<Spinner />
}
</div>
<Modal @ref="detailsModal" title="Détails" Size="ModalSize.ExtraLarge" Fullscreen="ModalFullscreen.LargeDown"/>
@code {
public Shared.InspectionRow? _row;
[Parameter]
public Shared.InspectionRow? Row
{
get
{
return _row;
}
set
{
if (_row != value)
{
_row = value;
if (RowChanged.HasDelegate)
RowChanged.InvokeAsync(_row);
}
}
}
[Parameter]
public EventCallback<Shared.InspectionRow?> RowChanged { get; set; }
private Modal detailsModal = default!;
protected override Task OnInitializedAsync()
{
return base.OnInitializedAsync();
}
public string Class
{
get
{
if (Row is null)
return "";
if (!Row.IsTitle)
return "verification";
return "title order-" + Row.Order;
}
}
private async Task ShowDetails()
{
if (Row is null)
return; //TODO: add error message
Action<Shared.InspectionRow> callback = (Shared.InspectionRow row) =>
{
StateHasChanged();
};
var parameters = new Dictionary<string, object>();
parameters.Add("Row", Row);
parameters.Add("RowChanged", callback);
await detailsModal.ShowAsync<InspectionRowDetails>(title: "Détails", parameters: parameters);
}
}