mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
274 lines
10 KiB
Plaintext
274 lines
10 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/software_versions/details/{Id:ulong}"
|
|
@page "/admin/software_versions/edit/{Id:ulong}"
|
|
@page "/admin/software_versions/create"
|
|
@using Marechai.Database
|
|
@using Marechai.Database.Models
|
|
@inherits OwningComponentBase<SoftwareVersionsService>
|
|
@inject IStringLocalizer<SoftwareVersionsService> L
|
|
@inject SoftwareFamiliesService SoftwareFamiliesService
|
|
@inject LicensesService LicensesService
|
|
@inject CompaniesService CompaniesService
|
|
@inject DocumentRolesService DocumentRolesService
|
|
@inject CompaniesBySoftwareVersionService CompaniesBySoftwareVersionService
|
|
@inject NavigationManager NavigationManager
|
|
@inject IWebHostEnvironment Host
|
|
@inject IJSRuntime JSRuntime
|
|
@inject Microsoft.AspNetCore.Identity.UserManager<ApplicationUser> UserManager
|
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
|
|
|
|
|
<h3>@L["Software version details"]</h3>
|
|
<hr />
|
|
|
|
@if (!_loaded)
|
|
{
|
|
<p align="center">@L["Loading..."]</p>
|
|
|
|
return;
|
|
}
|
|
|
|
<div>
|
|
<Field>
|
|
<FieldLabel>@L["Software family"]</FieldLabel>
|
|
<Select Disabled="!_editing" TValue="ulong" @bind-SelectedValue="@_model.FamilyId">
|
|
@foreach (var family in _softwareFamilies)
|
|
{
|
|
<SelectItem TValue="ulong" Value="@family.Id">@family.Name</SelectItem>
|
|
}
|
|
</Select>
|
|
</Field>
|
|
<Field>
|
|
<FieldLabel>@L["Version"]</FieldLabel>
|
|
<Validation Validator="@ValidateVersion">
|
|
<TextEdit ReadOnly="!_editing" @bind-Text="@_model.Version">
|
|
<Feedback>
|
|
<ValidationError>@L["Please enter a valid version."]</ValidationError>
|
|
</Feedback>
|
|
</TextEdit>
|
|
</Validation>
|
|
</Field>
|
|
@if (_editing || _model.Name != null)
|
|
{
|
|
<Field>
|
|
<FieldLabel>@L["Name, if different from family name"]</FieldLabel>
|
|
@if (_editing)
|
|
{
|
|
<Check TValue="bool" @bind-Checked="@_unknownName">@L["Unknown (name)"]</Check>
|
|
}
|
|
@if (!_editing ||
|
|
!_unknownName)
|
|
{
|
|
<Validation Validator="@ValidateName">
|
|
<TextEdit Disabled="!_editing" @bind-Text="@_model.Name">
|
|
<Feedback>
|
|
<ValidationError>@L["Please enter a valid name."]</ValidationError>
|
|
</Feedback>
|
|
</TextEdit>
|
|
</Validation>
|
|
}
|
|
</Field>
|
|
}
|
|
@if (_editing || _model.Codename != null)
|
|
{
|
|
<Field>
|
|
<FieldLabel>@L["Codename"]</FieldLabel>
|
|
@if (_editing)
|
|
{
|
|
<Check TValue="bool" @bind-Checked="@_unknownCodename">@L["Unknown (codename)"]</Check>
|
|
}
|
|
@if (!_editing ||
|
|
!_unknownCodename)
|
|
{
|
|
<Validation Validator="@ValidateCodename">
|
|
<TextEdit Disabled="!_editing" @bind-Text="@_model.Codename">
|
|
<Feedback>
|
|
<ValidationError>@L["Please enter a valid codename."]</ValidationError>
|
|
</Feedback>
|
|
</TextEdit>
|
|
</Validation>
|
|
}
|
|
</Field>
|
|
}
|
|
@if (_editing || _model.Introduced != null)
|
|
{
|
|
<Field>
|
|
<FieldLabel>@L["Introduced"]</FieldLabel>
|
|
@if (_editing)
|
|
{
|
|
<Check TValue="bool" @bind-Checked="@_unknownIntroduced">@L["Unknown (introduction date)"]</Check>
|
|
}
|
|
@if (!_editing || !_unknownIntroduced)
|
|
{
|
|
<Validation Validator="@ValidateIntroduced">
|
|
<DateEdit TValue="DateTime?" ReadOnly="!_editing" @bind-Date="@_model.Introduced" >
|
|
<Feedback>
|
|
<ValidationError>@L["Please enter a valid introduction date."]</ValidationError>
|
|
</Feedback>
|
|
</DateEdit>
|
|
</Validation>
|
|
}
|
|
</Field>
|
|
}
|
|
@if (_editing || _model.LicenseId != null)
|
|
{
|
|
<Field>
|
|
<FieldLabel>@L["License"]</FieldLabel>
|
|
@if (_editing)
|
|
{
|
|
<Check TValue="bool" @bind-Checked="@_unknownLicense">@L["Unknown (license)"]</Check>
|
|
}
|
|
@if (!_editing ||
|
|
!_unknownLicense)
|
|
{
|
|
<Select Disabled="!_editing" TValue="int?" @bind-SelectedValue="@_model.LicenseId">
|
|
@foreach (var license in _licenses)
|
|
{
|
|
<SelectItem TValue="int?" Value="@license.Id">@license.Name</SelectItem>
|
|
}
|
|
</Select>
|
|
}
|
|
</Field>
|
|
}
|
|
@if (_editing || _model.PreviousId != null)
|
|
{
|
|
<Field>
|
|
<FieldLabel>@L["Previous"]</FieldLabel>
|
|
@if (_editing)
|
|
{
|
|
<Check TValue="bool" @bind-Checked="@_unknownPrevious">@L["Unknown or none (previous version)"]</Check>
|
|
}
|
|
@if (!_editing ||
|
|
!_unknownPrevious)
|
|
{
|
|
<Select Disabled="!_editing" TValue="ulong?" @bind-SelectedValue="@_model.PreviousId">
|
|
@foreach (var version in _softwareVersions)
|
|
{
|
|
<SelectItem TValue="ulong?" Value="@version.Id">@version.Name ?? @version.Version</SelectItem>
|
|
}
|
|
</Select>
|
|
}
|
|
</Field>
|
|
}
|
|
</div>
|
|
<div>
|
|
@if (!_editing)
|
|
{
|
|
<Button Color="Color.Primary" Clicked="@OnEditClicked">@L["Edit"]</Button>
|
|
}
|
|
else
|
|
{
|
|
<Button Color="Color.Success" Clicked="@OnSaveClicked">@L["Save"]</Button>
|
|
<Button Color="Color.Danger" Clicked="@OnCancelClicked">@L["Cancel"]</Button>
|
|
}
|
|
<a href="/admin/software_versions" class="btn btn-secondary">@L["Back to list"]</a>
|
|
</div>
|
|
@if (!_editing)
|
|
{
|
|
<hr />
|
|
<h3>@L["Companies involved in this software version"]</h3>
|
|
<Button Color="Color.Success" Clicked="OnAddCompanyClick" Disabled="_addingCompany">@L["Add new (company)"]</Button>
|
|
@if (_addingCompany)
|
|
{
|
|
<div>
|
|
<Field>
|
|
<FieldLabel>@L["Company"]</FieldLabel>
|
|
<Select Disabled="_savingCompany" TValue="int?" @bind-SelectedValue="@_addingCompanyId">
|
|
@foreach (var company in _companies)
|
|
{
|
|
<SelectItem TValue="int?" Value="@company.Id">@company.Name</SelectItem>
|
|
}
|
|
</Select>
|
|
</Field>
|
|
<Field>
|
|
<FieldLabel>@L["Role"]</FieldLabel>
|
|
<Select Disabled="!_editing" TValue="string" @bind-SelectedValue="@_addingCompanyRoleId">
|
|
@foreach (var role in _roles)
|
|
{
|
|
<SelectItem TValue="string" Value="@role.Id">@role.Name</SelectItem>
|
|
}
|
|
</Select>
|
|
</Field>
|
|
<Button Color="Color.Primary" Clicked="@CancelAddCompany" Disabled="@_savingCompany">@L["Cancel"]</Button>
|
|
<Button Color="Color.Success" Clicked="@ConfirmAddCompany" Disabled="@_savingCompany">@L["Add"]</Button>
|
|
</div>
|
|
}
|
|
@if (_softwareVersionCompanies?.Count > 0)
|
|
{
|
|
<div>
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
@L["Company"]
|
|
</th>
|
|
<th>
|
|
@L["Role"]
|
|
</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var item in _softwareVersionCompanies)
|
|
{
|
|
<tr>
|
|
<td>
|
|
@item.Company
|
|
</td>
|
|
<td>
|
|
@item.Role
|
|
</td>
|
|
<td>
|
|
<Button Color="Color.Danger" Clicked="() => {ShowCompanyDeleteModal(item.Id);}" Disabled="@_addingCompany">@L["Delete"]</Button>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
}
|
|
|
|
<Modal @ref="_frmDelete" IsCentered="true" Closing="@ModalClosing">
|
|
<ModalBackdrop />
|
|
<ModalContent Centered="true">
|
|
<ModalHeader>
|
|
<ModalTitle>@_deleteTitle</ModalTitle>
|
|
<CloseButton Clicked="@HideModal" />
|
|
</ModalHeader>
|
|
<ModalBody>
|
|
<Text>@_deleteText</Text>
|
|
</ModalBody>
|
|
<ModalFooter>
|
|
<Button Color="Color.Primary" Clicked="@HideModal" Disabled="@_deleteInProgress">@L["Cancel"]</Button>
|
|
<Button Color="Color.Danger" Clicked="@ConfirmDelete" Disabled="@_deleteInProgress">@L["Delete"]</Button>
|
|
</ModalFooter>
|
|
</ModalContent>
|
|
</Modal>
|
|
} |