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

127 lines
4.1 KiB
Plaintext
Raw Normal View History

2020-05-24 17:19:13 +01:00
@{
2020-12-20 21:34:13 +00:00
/******************************************************************************
2020-05-24 17:19:13 +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/people"
@using Marechai.Database.Models
2020-05-24 17:19:13 +01:00
@inherits OwningComponentBase<PeopleService>
@inject IStringLocalizer<PeopleService> L
2020-12-20 21:34:13 +00:00
@inject UserManager<ApplicationUser> UserManager
@inject AuthenticationStateProvider AuthenticationStateProvider
2020-05-24 17:19:13 +01:00
@attribute [Authorize(Roles = "UberAdmin, Admin")]
<h3>@L["People"]</h3>
2020-12-20 21:34:13 +00:00
@if(_people is null)
2020-05-24 17:19:13 +01:00
{
<p>@L["Loading..."]</p>
return;
}
<p>
2020-05-28 03:05:21 +01:00
<a class="btn btn-primary" href="/admin/people/create">@L["Create new"]</a>
2020-05-24 17:19:13 +01:00
</p>
2020-05-27 21:37:43 +01:00
<table class="table table-striped">
2020-05-24 17:19:13 +01:00
<thead>
<tr>
<th>
@L["Known name"]
</th>
<th>
@L["Country of birth"]
</th>
<th>
@L["Birth date"]
</th>
<th>
@L["Date of death"]
</th>
<th>
@L["Webpage"]
</th>
<th>
@L["Twitter"]
</th>
<th>
@L["Facebook"]
</th>
<th></th>
</tr>
</thead>
<tbody>
2020-12-20 21:34:13 +00:00
@foreach(var item in _people)
2020-05-24 17:19:13 +01:00
{
<tr>
<td>
@item.FullName
</td>
<td>
@item.CountryOfBirth
</td>
<td>
@($"{item.BirthDate:d}")
</td>
<td>
@($"{item.DeathDate:d}")
</td>
<td>
@item.Webpage
</td>
<td>
2020-12-20 21:34:13 +00:00
@if(item.Twitter != null)
2020-05-24 17:19:13 +01:00
{
<a href="https://twitter.com/@item.Twitter">@item.Twitter</a>
}
</td>
<td>
2020-12-20 21:34:13 +00:00
@if(item.Facebook != null)
2020-05-24 17:19:13 +01:00
{
<a href="https://www.facebook.com/@item.Facebook">@item.Facebook</a>
}
</td>
<td>
2020-05-26 03:02:50 +01:00
<a class="btn btn-primary" href="/admin/people/details/@item.Id">@L["Details"]</a>
2020-05-27 21:37:43 +01:00
<a class="btn btn-secondary" href="/admin/edit/details/@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-05-24 17:19:13 +01:00
</td>
</tr>
}
</tbody>
</table>
2020-12-20 21:34:13 +00:00
<Modal Closing="@ModalClosing" IsCentered="true" ref="_frmDelete">
<ModalBackdrop />
2020-05-24 21:52:41 +01:00
<ModalContent Centered="true">
<ModalHeader>
<ModalTitle>@L["Delete person"]</ModalTitle>
2020-12-20 21:34:13 +00:00
<CloseButton Clicked="@HideModal" />
2020-05-24 21:52:41 +01:00
</ModalHeader>
<ModalBody>
2020-12-20 21:34:13 +00:00
<Text>@string.Format(L["Are you sure you want to delete {0}?"], _person?.FullName)</Text>
2020-05-24 21:52:41 +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-05-24 21:52:41 +01:00
</ModalFooter>
</ModalContent>
2020-12-20 21:34:13 +00:00
</Modal>