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

115 lines
3.7 KiB
Plaintext
Raw Normal View History

2020-05-24 04:49:53 +01:00
@{
2020-12-20 21:34:13 +00:00
/******************************************************************************
2020-02-10 01:52:56 +00: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/>.
//
// ----------------------------------------------------------------------------
2020-02-10 03:05:39 +00:00
// Copyright © 2003-2020 Natalia Portillo
*******************************************************************************/
}
2020-05-24 04:49:53 +01:00
@page "/admin/companies"
@using Marechai.Database.Models
2020-05-24 04:49:53 +01:00
@inherits OwningComponentBase<CompaniesService>
@inject IStringLocalizer<CompaniesService> L
2020-12-20 21:34:13 +00:00
@inject UserManager<ApplicationUser> UserManager
@inject AuthenticationStateProvider AuthenticationStateProvider
2020-05-24 04:49:53 +01:00
@attribute [Authorize(Roles = "UberAdmin, Admin")]
<h3>@L["Companies"]</h3>
2020-12-20 21:34:13 +00:00
@if(_companies is null)
2020-05-24 04:49:53 +01:00
{
<p>@L["Loading..."]</p>
return;
}
2020-05-27 21:37:43 +01:00
<p>
2020-05-27 22:30:06 +01:00
<a class="btn btn-primary" href="/admin/companies/create">@L["Create new"]</a>
2020-05-27 21:37:43 +01:00
</p>
2019-05-18 11:19:06 +01:00
<table class="table table-striped">
<thead>
<tr>
<th>
2020-05-24 04:49:53 +01:00
@L["Name"]
</th>
<th>
2020-05-24 04:49:53 +01:00
@L["Founded"]
</th>
<th>
2020-05-24 04:49:53 +01:00
@L["Status"]
</th>
<th>
2020-05-24 04:49:53 +01:00
@L["Country"]
</th>
<th>
2020-05-24 04:49:53 +01:00
@L["Sold"]
</th>
<th>
2020-05-24 04:49:53 +01:00
@L["Sold to"]
</th>
<th></th>
</tr>
</thead>
<tbody>
2020-12-20 21:34:13 +00:00
@foreach(var item in _companies)
{
<tr>
<td>
2020-05-24 04:49:53 +01:00
@item.Name
</td>
<td>
2020-05-24 04:49:53 +01:00
@($"{item.Founded:d}")
</td>
<td>
2020-05-24 04:49:53 +01:00
@item.Status
</td>
<td>
2020-05-24 04:49:53 +01:00
@item.Country
</td>
<td>
2020-05-24 04:49:53 +01:00
@item.SoldView
</td>
<td>
2020-05-24 04:49:53 +01:00
@item.SoldTo
</td>
<td>
2020-05-25 02:44:52 +01:00
<a class="btn btn-primary" href="/admin/companies/details/@item.Id">@L["Details"]</a>
2020-05-27 21:37:43 +01:00
<a class="btn btn-secondary" href="/admin/companies/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>
</td>
</tr>
}
</tbody>
2020-05-24 04:49:53 +01:00
</table>
2020-12-20 21:34:13 +00:00
<Modal Closing="@ModalClosing" IsCentered="true" ref="_frmDelete">
<ModalBackdrop />
2020-05-24 20:53:29 +01:00
<ModalContent Centered="true">
<ModalHeader>
<ModalTitle>@L["Delete company"]</ModalTitle>
2020-12-20 21:34:13 +00:00
<CloseButton Clicked="@HideModal" />
2020-05-24 20:53:29 +01:00
</ModalHeader>
<ModalBody>
2020-12-20 21:34:13 +00:00
<Text>@string.Format(L["Are you sure you want to delete the company {0}?"], _currentCompany?.Name)</Text>
2020-05-24 20:53:29 +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 20:53:29 +01:00
</ModalFooter>
</ModalContent>
2020-12-20 21:34:13 +00:00
</Modal>