diff --git a/Marechai/Areas/Admin/Views/DocumentPeople/Details.cshtml b/Marechai/Areas/Admin/Views/DocumentPeople/Details.cshtml deleted file mode 100644 index 26468c80..00000000 --- a/Marechai/Areas/Admin/Views/DocumentPeople/Details.cshtml +++ /dev/null @@ -1,51 +0,0 @@ -@model Marechai.Database.Models.DocumentPerson - -@{ - ViewData["Title"] = "Details"; -} -

Details

-
-

Document person

-
-
-
- @Html.DisplayNameFor(model => model.Name) -
-
- @Html.DisplayFor(model => model.Name) -
-
- @Html.DisplayNameFor(model => model.Surname) -
-
- @Html.DisplayFor(model => model.Surname) -
-
- @Html.DisplayNameFor(model => model.Alias) -
-
- @Html.DisplayFor(model => model.Alias) -
-
- @Html.DisplayNameFor(model => model.DisplayName) -
-
- @Html.DisplayFor(model => model.DisplayName) -
-
- @Html.DisplayNameFor(model => model.Person) -
-
- - @Html.DisplayFor(modelItem => Model.Person.FullName) -
-
-
-
- - Edit - - - Back to List - -
\ No newline at end of file diff --git a/Marechai/Marechai.csproj b/Marechai/Marechai.csproj index 58ced25f..b968971e 100644 --- a/Marechai/Marechai.csproj +++ b/Marechai/Marechai.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 3.0.99.1170 + 3.0.99.1171 Canary Islands Computer Museum Copyright © 2003-2020 Natalia Portillo Canary Islands Computer Museum Website @@ -88,6 +88,9 @@ true + + true + <_ContentIncludedByDefault Remove="Areas\Admin\Views\BrowserTests\Delete.cshtml" /> diff --git a/Marechai/Pages/Admin/Details/DocumentPerson.razor b/Marechai/Pages/Admin/Details/DocumentPerson.razor new file mode 100644 index 00000000..49527b64 --- /dev/null +++ b/Marechai/Pages/Admin/Details/DocumentPerson.razor @@ -0,0 +1,93 @@ +@{ +/****************************************************************************** +// MARECHAI: Master repository of computing history artifacts information +// ---------------------------------------------------------------------------- +// +// Filename : Details.cshtml +// Author(s) : Natalia Portillo +// +// --[ Description ] ---------------------------------------------------------- +// +// Admin view details +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2003-2020 Natalia Portillo +*******************************************************************************/ +} + +@page "/admin/document_people/details/{Id:int}" +@inherits OwningComponentBase +@inject IStringLocalizer L +@inject PeopleService PeopleService +@attribute [Authorize(Roles = "UberAdmin, Admin")] +

@L["Document person details"]

+
+ +@if (!_loaded) +{ +

@L["Loading..."]

+ + return; +} + +
+ @if (_editable || _model.Name != null) + { + + @L["Name"] + + + } + @if (_editable || _model.Surname != null) + { + + @L["Surname"] + + + } + @if (_editable || _model.Alias != null) + { + + @L["Alias"] + + + } + @if (_editable || _model.DisplayName != null) + { + + @L["Display name"] + + + } + @if (_editable || _model.PersonId != null) + { + + @L["Linked person"] + + + } +
+
+ @L["Edit"] + @L["Back to list"] +
\ No newline at end of file diff --git a/Marechai/Pages/Admin/Details/DocumentPerson.razor.cs b/Marechai/Pages/Admin/Details/DocumentPerson.razor.cs new file mode 100644 index 00000000..29b5f4ca --- /dev/null +++ b/Marechai/Pages/Admin/Details/DocumentPerson.razor.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Marechai.ViewModels; +using Microsoft.AspNetCore.Components; + +namespace Marechai.Pages.Admin.Details +{ + public partial class DocumentPerson + { + bool _editable; + bool _loaded; + Database.Models.DocumentPerson _model; + List _people; + [Parameter] + public int Id { get; set; } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if(_loaded) + return; + + _loaded = true; + + if(Id <= 0) + return; + + _people = await PeopleService.GetAsync(); + _model = await Service.GetAsync(Id); + + StateHasChanged(); + } + } +} \ No newline at end of file diff --git a/Marechai/Pages/Admin/DocumentPeople.razor b/Marechai/Pages/Admin/DocumentPeople.razor index be360862..2446f18f 100644 --- a/Marechai/Pages/Admin/DocumentPeople.razor +++ b/Marechai/Pages/Admin/DocumentPeople.razor @@ -71,9 +71,7 @@ - - @L["Details"] - + @L["Details"] @L["Edit"] diff --git a/Marechai/Resources/Services/DocumentPeopleService.es.resx b/Marechai/Resources/Services/DocumentPeopleService.es.resx index 4c137203..e186a97e 100644 --- a/Marechai/Resources/Services/DocumentPeopleService.es.resx +++ b/Marechai/Resources/Services/DocumentPeopleService.es.resx @@ -162,4 +162,24 @@ Cancelar Cancel + + Detalles de persona de documentos + Document person details + + + Volver a la lista + Back to list + + + Apellido + Surname + + + Nombre para mostrar + Display name + + + Alias + Alias + \ No newline at end of file diff --git a/Marechai/Services/DocumentPeopleService.cs b/Marechai/Services/DocumentPeopleService.cs index 4ed758cc..f0fbbd4b 100644 --- a/Marechai/Services/DocumentPeopleService.cs +++ b/Marechai/Services/DocumentPeopleService.cs @@ -24,6 +24,8 @@ namespace Marechai.Services PersonId = d.PersonId }).ToListAsync(); + public async Task GetAsync(int id) => await _context.DocumentPeople.FindAsync(id); + public async Task DeleteAsync(int id) { DocumentPerson item = await _context.DocumentPeople.FindAsync(id);