Files
marechai/Marechai/Pages/Admin/Details/CurrencyInflation.razor
2020-12-20 21:34:13 +00:00

90 lines
3.5 KiB
Plaintext

@{
/******************************************************************************
// 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/currency_inflation/details/{Id:int}"
@page "/admin/currency_inflation/edit/{Id:int}"
@page "/admin/currency_inflation/create"
@using Marechai.Database.Models
@inherits OwningComponentBase<CurrencyInflationService>
@inject IStringLocalizer<CurrencyInflationService> L
@inject Iso4217Service CurrenciesService
@inject NavigationManager NavigationManager
@inject IWebHostEnvironment Host
@inject UserManager<ApplicationUser> UserManager
@inject AuthenticationStateProvider AuthenticationStateProvider
@attribute [Authorize(Roles = "UberAdmin, Admin")]
<h3>@L["Currency inflation details"]</h3>
<hr />
@if(!_loaded)
{
<p align="center">@L["Loading..."]</p>
return;
}
<div>
<Field>
<FieldLabel>@L["Currency"]</FieldLabel>
<Select @bind-SelectedValue="@_model.CurrencyCode" Disabled="!_editing" @TValue="string">
@foreach(var currency in _currencies)
{
<SelectItem @TValue="string" Value="@currency.Code">@currency.Name</SelectItem>
}
</Select>
</Field>
<Field>
<FieldLabel>@L["Year"]</FieldLabel>
<Validation Validator="@ValidateYear">
<NumericEdit @bind-Value="@_model.Year" Decimals="0" Disabled="!_editing" @TValue="uint">
<Feedback>
<ValidationError>@L["Please enter a valid year."]</ValidationError>
</Feedback>
</NumericEdit>
</Validation>
</Field>
<Field>
<FieldLabel>@L["Inflation (ratio)"]</FieldLabel>
<Validation Validator="@ValidateInflation">
<NumericEdit @bind-Value="@_model.Inflation" Decimals="3" Disabled="!_editing" @TValue="float">
<Feedback>
<ValidationError>@L["Please enter a valid inflation."]</ValidationError>
</Feedback>
</NumericEdit>
</Validation>
</Field>
</div>
<div>
@if(!_editing)
{
<Button Clicked="@OnEditClicked" Color="Color.Primary">@L["Edit"]</Button>
}
else
{
<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/currency_inflation">@L["Back to list"]</a>
</div>