mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 11:04:25 +00:00
310 lines
12 KiB
Plaintext
310 lines
12 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/magazine_issues/details/{Id:long}"
|
|
@page "/admin/magazine_issues/edit/{Id:long}"
|
|
@page "/admin/magazine_issues/create"
|
|
@using Marechai.Database
|
|
@using Marechai.Database.Models
|
|
@inherits OwningComponentBase<MagazineIssuesService>
|
|
@inject IStringLocalizer<MagazineIssuesService> L
|
|
@inject MagazinesService MagazinesService
|
|
@inject MachineFamiliesService MachineFamiliesService
|
|
@inject MagazinesByMachineFamilyService MagazinesByMachineFamilyService
|
|
@inject MachinesService MachinesService
|
|
@inject MagazinesByMachineService MagazinesByMachineService
|
|
@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["Magazine issue details"]</h3>
|
|
<hr />
|
|
|
|
@if (!_loaded)
|
|
{
|
|
<p align="center">@L["Loading..."]</p>
|
|
|
|
return;
|
|
}
|
|
|
|
<div>
|
|
<Field>
|
|
<FieldLabel>@L["Magazine"]</FieldLabel>
|
|
<Select Disabled="!_editing" TValue="long" @bind-SelectedValue="@_model.MagazineId">
|
|
@foreach (var magazine in _magazines)
|
|
{
|
|
<SelectItem TValue="long" Value="@magazine.Id">@magazine.Title</SelectItem>
|
|
}
|
|
</Select>
|
|
</Field>
|
|
<Field>
|
|
<FieldLabel>@L["Caption using latin script"]</FieldLabel>
|
|
<Validation Validator="@ValidateCaption">
|
|
<TextEdit ReadOnly="!_editing" @bind-Text="@_model.Caption">
|
|
<Feedback>
|
|
<ValidationError>@L["Please enter a valid caption."]</ValidationError>
|
|
</Feedback>
|
|
</TextEdit>
|
|
</Validation>
|
|
</Field>
|
|
@if (_editing || _model.NativeCaption != null)
|
|
{
|
|
<Field>
|
|
<FieldLabel>@L["Native caption, that is, caption using native script (cyrillic, chinese, etc)"]</FieldLabel>
|
|
@if (_editing)
|
|
{
|
|
<Check TValue="bool" @bind-Checked="@_unknownNativeCaption">@L["Unknown (native caption)"]</Check>
|
|
}
|
|
@if (!_editing ||
|
|
!_unknownNativeCaption)
|
|
{
|
|
<Validation Validator="@ValidateNativeCaption">
|
|
<TextEdit Disabled="!_editing" @bind-Text="@_model.NativeCaption">
|
|
<Feedback>
|
|
<ValidationError>@L["Please enter a valid native caption."]</ValidationError>
|
|
</Feedback>
|
|
</TextEdit>
|
|
</Validation>
|
|
}
|
|
</Field>
|
|
}
|
|
@if (_editing || _model.Published != null)
|
|
{
|
|
<Field>
|
|
<FieldLabel>@L["Published"]</FieldLabel>
|
|
@if (_editing)
|
|
{
|
|
<Check TValue="bool" @bind-Checked="@_unknownPublished">@L["Unknown (publication date)"]</Check>
|
|
}
|
|
@if (!_editing || !_unknownPublished)
|
|
{
|
|
@L["If the date of exact publication is unknown, set as first day of first month the publication applies to. E.g. July/August 1998 -> 1st July 1998"]
|
|
<Validation Validator="@ValidatePublished">
|
|
<DateEdit TValue="DateTime?" ReadOnly="!_editing" @bind-Date="@_model.Published" >
|
|
<Feedback>
|
|
<ValidationError>@L["Please enter a valid publication date."]</ValidationError>
|
|
</Feedback>
|
|
</DateEdit>
|
|
</Validation>
|
|
}
|
|
</Field>
|
|
}
|
|
@if (_editing || _model.ProductCode != null)
|
|
{
|
|
<Field>
|
|
<FieldLabel>@L["Product code"]</FieldLabel>
|
|
@if (_editing)
|
|
{
|
|
<Check TValue="bool" @bind-Checked="@_unknownProductCode">@L["Unknown (Product code)"]</Check>
|
|
}
|
|
@if (!_editing ||
|
|
!_unknownProductCode)
|
|
{
|
|
<Validation Validator="@ValidateProductCode">
|
|
<TextEdit ReadOnly="!_editing" @bind-Text="@_model.ProductCode">
|
|
<Feedback>
|
|
<ValidationError>@L["Please enter a valid product code."]</ValidationError>
|
|
</Feedback>
|
|
</TextEdit>
|
|
</Validation>
|
|
}
|
|
</Field>
|
|
}
|
|
@if (_editing || _model.Pages.HasValue)
|
|
{
|
|
<Field>
|
|
<FieldLabel>@L["Pages"]</FieldLabel>
|
|
@if (_editing)
|
|
{
|
|
<Check TValue="bool" @bind-Checked="@_unknownPages">@L["Unknown (pages)"]</Check>
|
|
}
|
|
@if (!_editing ||
|
|
!_unknownPages)
|
|
{
|
|
<Validation Validator="@ValidatePages">
|
|
<NumericEdit Disabled="!_editing" TValue="short?" Decimals="0" @bind-Value="@_model.Pages">
|
|
<Feedback>
|
|
<ValidationError>@L["Please enter a valid number of pages."]</ValidationError>
|
|
</Feedback>
|
|
</NumericEdit>
|
|
</Validation>
|
|
}
|
|
</Field>
|
|
}
|
|
@if (_editing || _model.IssueNumber.HasValue)
|
|
{
|
|
<Field>
|
|
<FieldLabel>@L["Issue number"]</FieldLabel>
|
|
@if (_editing)
|
|
{
|
|
<Check TValue="bool" @bind-Checked="@_unknownIssueNumber">@L["Unknown (issue number)"]</Check>
|
|
}
|
|
@if (!_editing ||
|
|
!_unknownIssueNumber)
|
|
{
|
|
<Validation Validator="@ValidateIssueNumber">
|
|
<NumericEdit Disabled="!_editing" TValue="uint?" Decimals="0" @bind-Value="@_model.IssueNumber">
|
|
<Feedback>
|
|
<ValidationError>@L["Please enter a valid issue number."]</ValidationError>
|
|
</Feedback>
|
|
</NumericEdit>
|
|
</Validation>
|
|
}
|
|
</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/magazine_issues" class="btn btn-secondary">@L["Back to list"]</a>
|
|
</div>
|
|
@if (!_editing)
|
|
{
|
|
<hr />
|
|
<h3>@L["Machine families this magazine issue talks about"]</h3>
|
|
<Button Color="Color.Success" Clicked="OnAddFamilyClick" Disabled="_addingMachineFamily">@L["Add new (machine family)"]</Button>
|
|
@if (_addingMachineFamily)
|
|
{
|
|
<div>
|
|
<Field>
|
|
<FieldLabel>@L["Family"]</FieldLabel>
|
|
<Select Disabled="_savingMachineFamily" TValue="int?" @bind-SelectedValue="@_addingMachineFamilyId">
|
|
@foreach (var family in _machineFamilies)
|
|
{
|
|
<SelectItem TValue="int?" Value="@family.Id">@family.Name</SelectItem>
|
|
}
|
|
</Select>
|
|
</Field>
|
|
<Button Color="Color.Primary" Clicked="@CancelAddFamily" Disabled="@_savingMachineFamily">@L["Cancel"]</Button>
|
|
<Button Color="Color.Success" Clicked="@ConfirmAddFamily" Disabled="@_savingMachineFamily">@L["Add"]</Button>
|
|
</div>
|
|
}
|
|
@if (_magazineMachineFamilies?.Count > 0)
|
|
{
|
|
<div>
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
@L["Family"]
|
|
</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var item in _magazineMachineFamilies)
|
|
{
|
|
<tr>
|
|
<td>
|
|
@item.MachineFamily
|
|
</td>
|
|
<td>
|
|
<Button Color="Color.Danger" Clicked="() => {ShowMachineFamilyDeleteModal(item.Id);}" Disabled="@_addingMachineFamily">@L["Delete"]</Button>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
}
|
|
|
|
<hr />
|
|
<h3>@L["Machines this magazine talks about"]</h3>
|
|
<Button Color="Color.Success" Clicked="OnAddMachineClick" Disabled="_addingMachine">@L["Add new (machine)"]</Button>
|
|
@if (_addingMachine)
|
|
{
|
|
<div>
|
|
<Field>
|
|
<FieldLabel>@L[""]</FieldLabel>
|
|
<Select Disabled="_savingMachine" TValue="int?" @bind-SelectedValue="@_addingMachineId">
|
|
@foreach (var machine in _machines)
|
|
{
|
|
<SelectItem TValue="int?" Value="@machine.Id">@machine.Name</SelectItem>
|
|
}
|
|
</Select>
|
|
</Field>
|
|
<Button Color="Color.Primary" Clicked="@CancelAddMachine" Disabled="@_savingMachine">@L["Cancel"]</Button>
|
|
<Button Color="Color.Success" Clicked="@ConfirmAddMachine" Disabled="@_savingMachine">@L["Add"]</Button>
|
|
</div>
|
|
}
|
|
@if (_magazineMachines?.Count > 0)
|
|
{
|
|
<div>
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
@L["Machine"]
|
|
</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var item in _magazineMachines)
|
|
{
|
|
<tr>
|
|
<td>
|
|
@item.Machine
|
|
</td>
|
|
<td>
|
|
<Button Color="Color.Danger" Clicked="() => {ShowMachineDeleteModal(item.Id);}" Disabled="@_addingMachine">@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>
|
|
} |