Files
marechai/Marechai/Pages/Admin/CurrencyPegging.razor

109 lines
3.9 KiB
Plaintext
Raw Normal View History

2020-08-07 21:46:48 +01:00
@{
2020-12-20 21:34:13 +00:00
/******************************************************************************
2020-08-07 21:46:48 +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/currency_pegging"
@using Marechai.Database.Models
@inherits OwningComponentBase<CurrencyPeggingService>
@inject IStringLocalizer<CurrencyPeggingService> L
2020-12-20 21:34:13 +00:00
@inject UserManager<ApplicationUser> UserManager
2020-08-07 21:46:48 +01:00
@inject AuthenticationStateProvider AuthenticationStateProvider
@attribute [Authorize(Roles = "UberAdmin, Admin")]
<h3>@L["Currency pegging"]</h3>
2020-12-20 21:34:13 +00:00
@if(_peggings is null)
2020-08-07 21:46:48 +01:00
{
<p>@L["Loading..."]</p>
return;
}
<p>
<a class="btn btn-primary" href="/admin/currency_pegging/create">@L["Create new"]</a>
</p>
<table class="table table-striped">
<thead>
<tr>
<th>
@L["Source currency"]
</th>
<th>
@L["Destination currency"]
</th>
<th>
@L["Starting date"]
</th>
<th>
@L["Ending date"]
</th>
<th>
@L["Pegging"]
</th>
<th></th>
</tr>
</thead>
<tbody>
2020-12-20 21:34:13 +00:00
@foreach(var item in _peggings)
2020-08-07 21:46:48 +01:00
{
<tr>
<td>
@item.SourceName
</td>
<td>
@item.DestinationName
</td>
<td>
@item.Start.ToLongDateString()
</td>
<td>
@item.End?.ToLongDateString()
</td>
<td>
@($"{item.Ratio:F2}")
</td>
<td>
<a class="btn btn-primary" href="/admin/currency_pegging/details/@item.Id">@L["Details"]</a>
<a class="btn btn-secondary" href="/admin/currency_pegging/edit/@item.Id">@L["Edit"]</a>
2020-12-20 21:34:13 +00:00
<Button Clicked="() => {ShowModal(item.Id);}" Color="Color.Danger">@L["Delete"]</Button>
2020-08-07 21:46:48 +01:00
</td>
</tr>
}
</tbody>
</table>
2020-12-20 21:34:13 +00:00
<Modal Closing="@ModalClosing" IsCentered="true" ref="_frmDelete">
<ModalBackdrop />
2020-08-07 21:46:48 +01:00
<ModalContent Centered="true">
<ModalHeader>
<ModalTitle>@L["Delete currency pegging"]</ModalTitle>
2020-12-20 21:34:13 +00:00
<CloseButton Clicked="@HideModal" />
2020-08-07 21:46:48 +01:00
</ModalHeader>
<ModalBody>
2020-12-20 21:34:13 +00:00
<Text>@string.Format(L["Are you sure you want to delete the pegging of {0:F} happened to currency {1} with currency {2} since {3}?"], _currentPegging?.Ratio, _currentPegging?.SourceName, _currentPegging?.DestinationName, _currentPegging?.Start.ToLongDateString())</Text>
2020-08-07 21:46:48 +01:00
</ModalBody>
<ModalFooter>
2020-12-20 21:34:13 +00:00
<Button Clicked="@HideModal" Color="Color.Primary" Disabled="@_deleteInProgress">@L["Cancel"]</Button>
<Button Clicked="@ConfirmDelete" Color="Color.Danger" Disabled="@_deleteInProgress">@L["Delete"]</Button>
2020-08-07 21:46:48 +01:00
</ModalFooter>
</ModalContent>
2020-12-20 21:34:13 +00:00
</Modal>