Files
marechai/Marechai/Pages/Admin/Details/Screen.razor

168 lines
6.3 KiB
Plaintext
Raw Normal View History

2020-05-26 04:36:42 +01:00
@{
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Filename : Details.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Admin view details
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2020 Natalia Portillo
*******************************************************************************/
}
@page "/admin/screens/details/{Id:int}"
2020-05-27 03:48:34 +01:00
@page "/admin/screens/edit/{Id:int}"
2020-05-28 03:17:03 +01:00
@page "/admin/screens/create"
2020-05-26 04:36:42 +01:00
@inherits OwningComponentBase<ScreensService>
@inject IStringLocalizer<ScreensService> L
@inject ResolutionsService ResolutionsService
2020-05-27 03:48:34 +01:00
@inject NavigationManager NavigationManager
2020-05-26 04:36:42 +01:00
@attribute [Authorize(Roles = "UberAdmin, Admin")]
<h3>@L["Screen details"]</h3>
<hr />
@if (!_loaded)
{
<p align="center">@L["Loading..."]</p>
return;
}
<div>
2020-05-27 03:48:34 +01:00
@if (_editing || _model.Width.HasValue)
2020-05-26 04:36:42 +01:00
{
<Field>
<FieldLabel>@L["Width (mm)"]</FieldLabel>
2020-05-27 03:48:34 +01:00
@if (_editing)
{
<Check TValue="bool" @bind-Checked="@_unknownWidth">@L["Unknown (width)"]</Check>
}
@if (!_editing ||
!_unknownWidth)
{
<Validation Validator="@ValidateDoubleBiggerThanZero">
<NumericEdit Disabled="!_editing" TValue="double?" Decimals="2" @bind-Value="@_model.Width" >
<Feedback>
<ValidationError>@L["Please enter a valid width in millimeters."]</ValidationError>
</Feedback>
</NumericEdit>
</Validation>
}
2020-05-26 04:36:42 +01:00
</Field>
}
2020-05-27 03:48:34 +01:00
@if (_editing || _model.Height.HasValue)
2020-05-26 04:36:42 +01:00
{
<Field>
<FieldLabel>@L["Height (mm)"]</FieldLabel>
2020-05-27 03:48:34 +01:00
@if (_editing)
{
<Check TValue="bool" @bind-Checked="@_unknownHeight">@L["Unknown (height)"]</Check>
}
@if (!_editing ||
!_unknownHeight)
{
<Validation Validator="@ValidateDoubleBiggerThanZero">
<NumericEdit Disabled="!_editing" TValue="double?" Decimals="2" @bind-Value="@_model.Height" >
<Feedback>
<ValidationError>@L["Please enter a valid height in millimeters."]</ValidationError>
</Feedback>
</NumericEdit>
</Validation>
}
<NumericEdit Disabled="!_editing" TValue="double?" Decimals="2" @bind-Value="@_model.Height"/>
2020-05-26 04:36:42 +01:00
</Field>
}
<Field>
<FieldLabel>@L["Diagonal (inches)"]</FieldLabel>
2020-05-27 03:48:34 +01:00
<Validation Validator="@ValidateDoubleBiggerThanZero">
2020-05-27 13:04:29 +01:00
<NumericEdit Disabled="!_editing" TValue="double" Decimals="2" @bind-Value="@_model.Diagonal" >
2020-05-27 03:48:34 +01:00
<Feedback>
<ValidationError>@L["Please enter a correct diagonal size in inches."]</ValidationError>
</Feedback>
</NumericEdit>
</Validation>
2020-05-26 04:36:42 +01:00
</Field>
2020-05-27 03:48:34 +01:00
@if (_editing || _model.EffectiveColors.HasValue)
2020-05-26 04:36:42 +01:00
{
<Field>
<FieldLabel>@L["Effective colors"]</FieldLabel>
2020-05-27 03:48:34 +01:00
@if (_editing)
{
<Check TValue="bool" @bind-Checked="@_unknownColors">@L["Unknown (effective colors)"]</Check>
}
@if (!_editing ||
!_unknownColors)
{
<Validation Validator="@ValidateLongBiggerThanZero">
<NumericEdit Disabled="!_editing" TValue="long?" Decimals="0" @bind-Value="@_model.EffectiveColors" >
<Feedback>
<ValidationError>@L["Please enter a number of effective colors."]</ValidationError>
</Feedback>
</NumericEdit>
</Validation>
}
2020-05-26 04:36:42 +01:00
</Field>
}
2020-05-27 03:48:34 +01:00
@if (_editing || _model.Type != null)
2020-05-26 04:36:42 +01:00
{
<Field>
<FieldLabel>@L["Type"]</FieldLabel>
2020-05-27 03:48:34 +01:00
@if (_editing)
{
<Check TValue="bool" @bind-Checked="@_unknownType">@L["Unknown (type)"]</Check>
}
@if (!_editing ||
!_unknownType)
{
<Validation Validator="@ValidateType">
<TextEdit ReadOnly="!_editing" @bind-Text="@_model.Type">
<Feedback>
<ValidationError>@L["Please enter a valid screen type."]</ValidationError>
</Feedback>
</TextEdit>
</Validation>
}
2020-05-26 04:36:42 +01:00
</Field>
}
<Field>
<FieldLabel>@L["Native resolution"]</FieldLabel>
2020-05-27 03:48:34 +01:00
<Select Disabled="!_editing" TValue="int" @bind-SelectedValue="@_model.NativeResolutionId">
2020-05-26 04:36:42 +01:00
@foreach (var resolution in _resolutions)
{
<SelectItem TValue="int" Value="@resolution.Id">@resolution.ToString()</SelectItem>
}
</Select>
</Field>
</div>
<div>
2020-05-27 03:48:34 +01:00
@if (!_editing)
{
<Button Color="Color.Primary" Clicked="@OnEditClicked">@L["Edit"]</Button>
}
else
{
<Button Color="Color.Success" Clicked="@OnSaveClicked">@L["Save"]</Button>
<Button Color="Color.Danger" Clicked="@OnCancelClicked">@L["Cancel"]</Button>
}
2020-05-26 04:36:42 +01:00
<a href="/admin/screens" class="btn btn-secondary">@L["Back to list"]</a>
</div>