Add people to document admin page.

This commit is contained in:
2020-08-10 03:17:24 +01:00
parent 9930ccaf0e
commit 35e000a02f
8 changed files with 326 additions and 8 deletions

View File

@@ -40,6 +40,8 @@
@inject DocumentsByMachineFamilyService DocumentsByMachineFamilyService
@inject MachinesService MachinesService
@inject DocumentsByMachineService DocumentsByMachineService
@inject DocumentPeopleService PeopleService
@inject PeopleByDocumentService PeopleByDocumentService
@inject NavigationManager NavigationManager
@inject IWebHostEnvironment Host
@inject IJSRuntime JSRuntime
@@ -208,6 +210,69 @@
</div>
}
<hr />
<h3>@L["People involved in this document"]</h3>
<Button Color="Color.Success" Clicked="OnAddPersonClick" Disabled="_addingPerson">@L["Add new (person)"]</Button>
@if (_addingPerson)
{
<div>
<Field>
<FieldLabel>@L["Person"]</FieldLabel>
<Select Disabled="_savingPerson" TValue="int?" @bind-SelectedValue="@_addingPersonId">
@foreach (var person in _people)
{
<SelectItem TValue="int?" Value="@person.Id">@person.FullName</SelectItem>
}
</Select>
</Field>
<Field>
<FieldLabel>@L["Role"]</FieldLabel>
<Select Disabled="!_editing" TValue="string" @bind-SelectedValue="@_addingPersonRoleId">
@foreach (var role in _roles)
{
<SelectItem TValue="string" Value="@role.Id">@role.Name</SelectItem>
}
</Select>
</Field>
<Button Color="Color.Primary" Clicked="@CancelAddPerson" Disabled="@_savingPerson">@L["Cancel"]</Button>
<Button Color="Color.Success" Clicked="@ConfirmAddPerson" Disabled="@_savingPerson">@L["Add"]</Button>
</div>
}
@if (_documentPeople?.Count > 0)
{
<div>
<table class="table table-striped">
<thead>
<tr>
<th>
@L["Person"]
</th>
<th>
@L["Role"]
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in _documentPeople)
{
<tr>
<td>
@item.FullName
</td>
<td>
@item.Role
</td>
<td>
<Button Color="Color.Danger" Clicked="() => {ShowPersonDeleteModal(item.Id);}" Disabled="@_addingPerson">@L["Delete"]</Button>
</td>
</tr>
}
</tbody>
</table>
</div>
}
<hr />
<h3>@L["Machine families this document talks about"]</h3>
<Button Color="Color.Success" Clicked="OnAddFamilyClick" Disabled="_addingMachineFamily">@L["Add new (machine family)"]</Button>