2020-08-08 18:57:22 +01:00
|
|
|
@{
|
2020-12-20 21:34:13 +00:00
|
|
|
/******************************************************************************
|
2020-08-08 18:57:22 +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
|
|
|
|
|
*******************************************************************************/
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-12 20:05:09 +01:00
|
|
|
@page "/admin/software_families/details/{Id:long}"
|
|
|
|
|
@page "/admin/software_families/edit/{Id:long}"
|
2020-08-08 18:57:22 +01:00
|
|
|
@page "/admin/software_families/create"
|
|
|
|
|
@using Marechai.Database.Models
|
|
|
|
|
@inherits OwningComponentBase<SoftwareFamiliesService>
|
|
|
|
|
@inject IStringLocalizer<SoftwareFamiliesService> L
|
2020-08-09 17:05:22 +01:00
|
|
|
@inject CompaniesService CompaniesService
|
|
|
|
|
@inject DocumentRolesService DocumentRolesService
|
|
|
|
|
@inject CompaniesBySoftwareFamilyService CompaniesBySoftwareFamilyService
|
2020-08-08 18:57:22 +01:00
|
|
|
@inject NavigationManager NavigationManager
|
|
|
|
|
@inject IWebHostEnvironment Host
|
|
|
|
|
@inject IJSRuntime JSRuntime
|
2020-12-20 21:34:13 +00:00
|
|
|
@inject UserManager<ApplicationUser> UserManager
|
2020-08-08 18:57:22 +01:00
|
|
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
|
|
|
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
|
|
|
|
<h3>@L["Software family details"]</h3>
|
|
|
|
|
<hr />
|
2020-12-20 21:34:13 +00:00
|
|
|
@if(!_loaded)
|
2020-08-08 18:57:22 +01:00
|
|
|
{
|
|
|
|
|
<p align="center">@L["Loading..."]</p>
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
<div>
|
|
|
|
|
<Field>
|
|
|
|
|
<FieldLabel>@L["Name"]</FieldLabel>
|
|
|
|
|
<Validation Validator="@ValidateName">
|
2020-12-20 21:34:13 +00:00
|
|
|
<TextEdit @bind-Text="@_model.Name" ReadOnly="!_editing">
|
2020-08-08 18:57:22 +01:00
|
|
|
<Feedback>
|
|
|
|
|
<ValidationError>@L["Please enter a valid name."]</ValidationError>
|
|
|
|
|
</Feedback>
|
|
|
|
|
</TextEdit>
|
|
|
|
|
</Validation>
|
|
|
|
|
</Field>
|
2020-12-20 21:34:13 +00:00
|
|
|
@if(_editing || _model.Introduced != null)
|
2020-08-08 18:57:22 +01:00
|
|
|
{
|
|
|
|
|
<Field>
|
|
|
|
|
<FieldLabel>@L["Introduced"]</FieldLabel>
|
2020-12-20 21:34:13 +00:00
|
|
|
@if(_editing)
|
2020-08-08 18:57:22 +01:00
|
|
|
{
|
2020-12-20 21:34:13 +00:00
|
|
|
<Check @bind-Checked="@_unknownIntroduced" @TValue="bool">@L["Unknown (introduction date)"]</Check>
|
|
|
|
|
}
|
|
|
|
|
@if(!_editing ||
|
|
|
|
|
!_unknownIntroduced)
|
2020-08-08 18:57:22 +01:00
|
|
|
{
|
|
|
|
|
<Validation Validator="@ValidateIntroduced">
|
2020-12-20 21:34:13 +00:00
|
|
|
<DateEdit @bind-Date="@_model.Introduced" ReadOnly="!_editing" @TValue="DateTime?">
|
2020-08-08 18:57:22 +01:00
|
|
|
<Feedback>
|
|
|
|
|
<ValidationError>@L["Please enter a valid introduction date."]</ValidationError>
|
|
|
|
|
</Feedback>
|
|
|
|
|
</DateEdit>
|
|
|
|
|
</Validation>
|
2020-12-20 21:34:13 +00:00
|
|
|
}
|
2020-08-08 18:57:22 +01:00
|
|
|
</Field>
|
2020-12-20 21:34:13 +00:00
|
|
|
}
|
|
|
|
|
@if(_editing || _model.ParentId != null)
|
2020-08-08 18:57:22 +01:00
|
|
|
{
|
|
|
|
|
<Field>
|
|
|
|
|
<FieldLabel>@L["Parent software family"]</FieldLabel>
|
2020-12-20 21:34:13 +00:00
|
|
|
@if(_editing)
|
2020-08-08 18:57:22 +01:00
|
|
|
{
|
2020-12-20 21:34:13 +00:00
|
|
|
<Check @bind-Checked="@_unknownParent" @TValue="bool">@L["Unknown or none (parent software family)"]</Check>
|
|
|
|
|
}
|
|
|
|
|
@if(!_editing ||
|
|
|
|
|
!_unknownParent)
|
2020-08-08 18:57:22 +01:00
|
|
|
{
|
2020-12-20 21:34:13 +00:00
|
|
|
<Select @bind-SelectedValue="@_model.ParentId" Disabled="!_editing" @TValue="ulong?">
|
|
|
|
|
@foreach(var family in _softwareFamilies)
|
2020-08-08 18:57:22 +01:00
|
|
|
{
|
2020-12-20 21:34:13 +00:00
|
|
|
<SelectItem @TValue="ulong?" Value="@family.Id">@family.Name</SelectItem>
|
|
|
|
|
}
|
2020-08-08 18:57:22 +01:00
|
|
|
</Select>
|
2020-12-20 21:34:13 +00:00
|
|
|
}
|
2020-08-08 18:57:22 +01:00
|
|
|
</Field>
|
2020-12-20 21:34:13 +00:00
|
|
|
}
|
2020-08-08 18:57:22 +01:00
|
|
|
</div>
|
|
|
|
|
<div>
|
2020-12-20 21:34:13 +00:00
|
|
|
@if(!_editing)
|
2020-08-08 18:57:22 +01:00
|
|
|
{
|
2020-12-20 21:34:13 +00:00
|
|
|
<Button Clicked="@OnEditClicked" Color="Color.Primary">@L["Edit"]</Button>
|
|
|
|
|
}
|
2020-08-08 18:57:22 +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/software_families">@L["Back to list"]</a>
|
2020-08-08 18:57:22 +01:00
|
|
|
</div>
|
2020-12-20 21:34:13 +00:00
|
|
|
@if(!_editing)
|
2020-08-09 17:05:22 +01:00
|
|
|
{
|
|
|
|
|
<hr />
|
|
|
|
|
<h3>@L["Companies involved in this software family"]</h3>
|
2020-12-20 21:34:13 +00:00
|
|
|
<Button Clicked="OnAddCompanyClick" Color="Color.Success" Disabled="_addingCompany">@L["Add new (company)"]</Button>
|
|
|
|
|
@if(_addingCompany)
|
2020-08-09 17:05:22 +01:00
|
|
|
{
|
|
|
|
|
<div>
|
|
|
|
|
<Field>
|
|
|
|
|
<FieldLabel>@L["Company"]</FieldLabel>
|
2020-12-20 21:34:13 +00:00
|
|
|
<Select @bind-SelectedValue="@_addingCompanyId" Disabled="_savingCompany" @TValue="int?">
|
|
|
|
|
@foreach(var company in _companies)
|
2020-08-09 17:05:22 +01:00
|
|
|
{
|
2020-12-20 21:34:13 +00:00
|
|
|
<SelectItem @TValue="int?" Value="@company.Id">@company.Name</SelectItem>
|
|
|
|
|
}
|
2020-08-09 17:05:22 +01:00
|
|
|
</Select>
|
|
|
|
|
</Field>
|
|
|
|
|
<Field>
|
|
|
|
|
<FieldLabel>@L["Role"]</FieldLabel>
|
2020-12-20 21:34:13 +00:00
|
|
|
<Select @bind-SelectedValue="@_addingCompanyRoleId" Disabled="!_editing" @TValue="string">
|
|
|
|
|
@foreach(var role in _roles)
|
2020-08-09 17:05:22 +01:00
|
|
|
{
|
2020-12-20 21:34:13 +00:00
|
|
|
<SelectItem @TValue="string" Value="@role.Id">@role.Name</SelectItem>
|
|
|
|
|
}
|
2020-08-09 17:05:22 +01:00
|
|
|
</Select>
|
|
|
|
|
</Field>
|
2020-12-20 21:34:13 +00:00
|
|
|
<Button Clicked="@CancelAddCompany" Color="Color.Primary" Disabled="@_savingCompany">@L["Cancel"]</Button>
|
|
|
|
|
<Button Clicked="@ConfirmAddCompany" Color="Color.Success" Disabled="@_savingCompany">@L["Add"]</Button>
|
2020-08-09 17:05:22 +01:00
|
|
|
</div>
|
|
|
|
|
}
|
2020-12-20 21:34:13 +00:00
|
|
|
@if(_softwareFamilyCompanies?.Count > 0)
|
2020-08-09 17:05:22 +01:00
|
|
|
{
|
|
|
|
|
<div>
|
|
|
|
|
<table class="table table-striped">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>
|
|
|
|
|
@L["Company"]
|
|
|
|
|
</th>
|
|
|
|
|
<th>
|
|
|
|
|
@L["Role"]
|
|
|
|
|
</th>
|
|
|
|
|
<th></th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
2020-12-20 21:34:13 +00:00
|
|
|
@foreach(var item in _softwareFamilyCompanies)
|
2020-08-09 17:05:22 +01:00
|
|
|
{
|
|
|
|
|
<tr>
|
|
|
|
|
<td>
|
|
|
|
|
@item.Company
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
@item.Role
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
2020-12-20 21:34:13 +00:00
|
|
|
<Button Clicked="() => {ShowCompanyDeleteModal(item.Id);}" Color="Color.Danger" Disabled="@_addingCompany">@L["Delete"]</Button>
|
2020-08-09 17:05:22 +01:00
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
}
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-20 21:34:13 +00:00
|
|
|
<Modal Closing="@ModalClosing" IsCentered="true" ref="_frmDelete">
|
2020-08-09 17:05:22 +01:00
|
|
|
<ModalBackdrop />
|
|
|
|
|
<ModalContent Centered="true">
|
|
|
|
|
<ModalHeader>
|
|
|
|
|
<ModalTitle>@_deleteTitle</ModalTitle>
|
|
|
|
|
<CloseButton Clicked="@HideModal" />
|
|
|
|
|
</ModalHeader>
|
|
|
|
|
<ModalBody>
|
|
|
|
|
<Text>@_deleteText</Text>
|
|
|
|
|
</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-09 17:05:22 +01:00
|
|
|
</ModalFooter>
|
|
|
|
|
</ModalContent>
|
2020-12-20 21:34:13 +00:00
|
|
|
</Modal>}
|