Files
WatchIt/WatchIt.Website/WatchIt.Website/Pages/PersonEditPage.razor

88 lines
2.7 KiB
Plaintext

@using WatchIt.Common.Model.Persons
@using WatchIt.Website.Components.Pages.PersonEditPage.Panels
@page "/person/{id:long}/edit"
@page "/person/new"
<PageTitle>
WatchIt -
@if (_loaded)
{
if (string.IsNullOrWhiteSpace(_error) && _user?.IsAdmin == true)
{
if (_person is not null)
{
@("Edit \"")@(_person.Name)@("\"")
}
else
{
@("Create new person")
}
}
else
{
@("Error")
}
}
else
{
@("Loading")
}
</PageTitle>
@if (_loaded)
{
if (_user?.IsAdmin == true)
{
<div class="container-grid">
<div class="row">
<div class="col">
<div class="rounded-3 panel panel-regular p-2 px-3">
<h3 class="m-0 p-0">@(Id is not null ? "Edit" : "Create new") person @(_person is not null ? $" \"{_person.Name}\"" : string.Empty)</h3>
</div>
</div>
</div>
<div class="row mt-3 gx-3">
<div class="col-auto">
<PictureEditorPanelComponent Id="@(Id)"
PictureGetTask="@(async (id, action) => await PersonsClientService.GetPersonPhoto(id, action))"
PicturePutTask="@(async (id, data, action) => await PersonsClientService.PutPersonPhoto(id, new PersonPhotoRequest(data), action))"
PictureDeleteTask="@(async (id, action) => await PersonsClientService.DeletePersonPhoto(id, action))"
PicturePlaceholder="/assets/person_poster.png"
Class="h-100"/>
</div>
<div class="col">
<PersonEditFormPanelComponent Id="@(Id)"
Class="h-100"/>
</div>
</div>
<div class="row mt-3">
<div class="col">
<PersonActorRolesEditPanelComponent Id="@(Id)"
Media="@(_media)"/>
</div>
</div>
<div class="row mt-3">
<div class="col">
<PersonCreatorRolesEditPanelComponent Id="@(Id)"
Media="@(_media)"/>
</div>
</div>
</div>
}
else
{
<ErrorPanelComponent ErrorMessage="You do not have permission to view this site"/>
}
}
else
{
<div class="m-5">
<LoadingComponent/>
</div>
}