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

127 lines
5.0 KiB
Plaintext
Raw Normal View History

2020-05-30 04:36:31 +01:00
@{
2020-12-20 21:34:13 +00:00
/******************************************************************************
2020-05-30 04:36:31 +01:00
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ 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/resolutions/details/{Id:int}"
@page "/admin/resolutions/edit/{Id:int}"
@page "/admin/resolutions/create"
@using Marechai.Database.Models
2020-05-30 04:36:31 +01:00
@inherits OwningComponentBase<ResolutionsService>
@inject IStringLocalizer<ResolutionsService> L
@inject NavigationManager NavigationManager
2020-12-20 21:34:13 +00:00
@inject UserManager<ApplicationUser> UserManager
@inject AuthenticationStateProvider AuthenticationStateProvider
2020-05-30 04:36:31 +01:00
@attribute [Authorize(Roles = "UberAdmin, Admin")]
<h3>@L["Resolution details"]</h3>
<hr />
2020-12-20 21:34:13 +00:00
@if(!_loaded)
2020-05-30 04:36:31 +01:00
{
<p align="center">@L["Loading..."]</p>
return;
}
<div>
<Field>
<FieldLabel>@L["Width (pixels or characters)"]</FieldLabel>
<Validation Validator="@ValidateIntegerBiggerThanZero">
2020-12-20 21:34:13 +00:00
<NumericEdit @bind-Value="@_model.Width" Disabled="!_editing" @TValue="int">
2020-05-30 04:36:31 +01:00
<Feedback>
<ValidationError>@L["Please enter a valid width in pixels or characters."]</ValidationError>
</Feedback>
</NumericEdit>
</Validation>
</Field>
<Field>
<FieldLabel>@L["Height (pixels or characters)"]</FieldLabel>
<Validation Validator="@ValidateIntegerBiggerThanZero">
2020-12-20 21:34:13 +00:00
<NumericEdit @bind-Value="@_model.Height" Disabled="!_editing" @TValue="int">
2020-05-30 04:36:31 +01:00
<Feedback>
<ValidationError>@L["Please enter a valid height in pixels or characters."]</ValidationError>
</Feedback>
</NumericEdit>
</Validation>
</Field>
2020-12-20 21:34:13 +00:00
@if(_editing || _model.Colors.HasValue)
2020-05-30 04:36:31 +01:00
{
<Field>
<FieldLabel>@L["Colors"]</FieldLabel>
2020-12-20 21:34:13 +00:00
@if(_editing)
2020-05-30 04:36:31 +01:00
{
2020-12-20 21:34:13 +00:00
<Check @bind-Checked="@_unknownColors" @TValue="bool">@L["Unknown (colors)"]</Check>
}
@if(!_editing ||
!_unknownColors)
2020-05-30 04:36:31 +01:00
{
<Validation Validator="@ValidateLongBiggerThanZero">
2020-12-20 21:34:13 +00:00
<NumericEdit @bind-Value="@_model.Colors" Decimals="0" Disabled="!_editing" @TValue="long?">
2020-05-30 04:36:31 +01:00
<Feedback>
<ValidationError>@L["Please enter a valid number of colors."]</ValidationError>
</Feedback>
</NumericEdit>
</Validation>
2020-12-20 21:34:13 +00:00
}
2020-05-30 04:36:31 +01:00
</Field>
2020-12-20 21:34:13 +00:00
}
@if(_editing || _model.Palette.HasValue)
2020-05-30 04:36:31 +01:00
{
<Field>
<FieldLabel>@L["Colors in palette"]</FieldLabel>
2020-12-20 21:34:13 +00:00
@if(_editing)
2020-05-30 04:36:31 +01:00
{
2020-12-20 21:34:13 +00:00
<Check @bind-Checked="@_unknownPalette" @TValue="bool">@L["Unknown (colors in palette)"]</Check>
}
@if(!_editing ||
!_unknownPalette)
2020-05-30 04:36:31 +01:00
{
<Validation Validator="@ValidateLongBiggerThanZero">
2020-12-20 21:34:13 +00:00
<NumericEdit @bind-Value="@_model.Palette" Decimals="0" Disabled="!_editing" @TValue="long?">
2020-05-30 04:36:31 +01:00
<Feedback>
<ValidationError>@L["Please enter a valid number of colors in palette."]</ValidationError>
</Feedback>
</NumericEdit>
</Validation>
2020-12-20 21:34:13 +00:00
}
2020-05-30 04:36:31 +01:00
</Field>
2020-12-20 21:34:13 +00:00
}
2020-05-30 04:36:31 +01:00
<Field>
2020-12-20 21:34:13 +00:00
<Check @bind-Checked="@_model.Chars" Disabled="!_editing" @TValue="bool">@L["Resolution is character based (text only)."]</Check>
2020-05-30 04:36:31 +01:00
</Field>
<Field>
2020-12-20 21:34:13 +00:00
<Check @bind-Checked="@_model.Grayscale" Disabled="!_editing" @TValue="bool">@L["Resolution only has gray colors."]</Check>
2020-05-30 04:36:31 +01:00
</Field>
</div>
<div>
2020-12-20 21:34:13 +00:00
@if(!_editing)
2020-05-30 04:36:31 +01:00
{
2020-12-20 21:34:13 +00:00
<Button Clicked="@OnEditClicked" Color="Color.Primary">@L["Edit"]</Button>
}
2020-05-30 04:36:31 +01:00
else
{
2020-12-20 21:34:13 +00:00
<Button Clicked="@OnSaveClicked" Color="Color.Success">@L["Save"]</Button>
<Button Clicked="@OnCancelClicked" Color="Color.Danger">@L["Cancel"]</Button>
}
<a class="btn btn-secondary" href="/admin/resolutions">@L["Back to list"]</a>
2020-05-30 04:36:31 +01:00
</div>