FEAT: workplace document list and delete
This commit is contained in:
parent
b0a7757f34
commit
a40a92f47d
6 changed files with 99 additions and 41 deletions
|
@ -105,4 +105,14 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository
|
||||||
await _client.DeleteAsync(
|
await _client.DeleteAsync(
|
||||||
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}");
|
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task DeleteWorkplaceDocuments(string companyId, string workplaceId, string apbDocumentId, string apvDocumentId)
|
||||||
|
{
|
||||||
|
await _client.DeleteAsync(
|
||||||
|
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents/{apvDocumentId}");
|
||||||
|
|
||||||
|
await _client.DeleteAsync(
|
||||||
|
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents/{apbDocumentId}");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -69,4 +69,14 @@ public interface IAdvisorWorkplaceRepository
|
||||||
/// <param name="workplaceId"></param>
|
/// <param name="workplaceId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<WorkplaceInventory> GetWorkplaceInventory(string companyId, string workplaceId);
|
Task<WorkplaceInventory> GetWorkplaceInventory(string companyId, string workplaceId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove a document pair from the workplace
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="companyId"></param>
|
||||||
|
/// <param name="workplaceId"></param>
|
||||||
|
/// <param name="apvDocumentId"></param>
|
||||||
|
/// <param name="apbDocumentId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task DeleteWorkplaceDocuments(string companyId, string workplaceId, string apbDocumentId, string apvDocumentId);
|
||||||
}
|
}
|
|
@ -309,10 +309,10 @@
|
||||||
<div class="col-sm-3 d-grid">
|
<div class="col-sm-3 d-grid">
|
||||||
<button type="button" class="btn btn-danger" onclick="@ToggleVisibility">@ToggleButtonText</button>
|
<button type="button" class="btn btn-danger" onclick="@ToggleVisibility">@ToggleButtonText</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col text-end">
|
<div class="col-sm-3 d-grid">
|
||||||
@if (AppInfo.Value.Rc)
|
@if (AppInfo.Value.Rc)
|
||||||
{
|
{
|
||||||
<a class="btn btn-info" href="@($"/advisor/customers/{CompanyId}/workplaces")">Kemi Dokumentationr</a>
|
<a class="btn btn-info" href="@($"/advisor/customers/{CompanyId}/workplaces")">Kemi Dokumentation</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,41 +19,62 @@
|
||||||
@attribute [Authorize(Roles = "Advisor")]
|
@attribute [Authorize(Roles = "Advisor")]
|
||||||
@page "/advisor/customers/{CompanyId}/workplaces/{WorkplaceId}/documents"
|
@page "/advisor/customers/{CompanyId}/workplaces/{WorkplaceId}/documents"
|
||||||
|
|
||||||
<PageTitle>Dokumenter for Arbejdssted</PageTitle>
|
<PageTitle>Dokumenter - @WorkplaceInventory.CompanyName - @WorkplaceInventory.WorkplaceName</PageTitle>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<h2>@WorkplaceInventory.CompanyName</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-10"><h3>@WorkplaceInventory.WorkplaceName Produkt Dokumentation</h3></div>
|
||||||
|
<div class="col-sm-2"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<h2>Dokumenter</h2>
|
|
||||||
@if (WorkplaceInventory.Products.Any())
|
@if (WorkplaceInventory.Products.Any())
|
||||||
{
|
{
|
||||||
<table class="table table-striped">
|
<ol class="list-group">
|
||||||
<thead>
|
<li class="list-group-item d-flex row g-2 align-items-center">
|
||||||
<tr>
|
<div class="row">
|
||||||
<th>Produkt</th>
|
<div class="col-sm-4">
|
||||||
<th>APB</th>
|
Produkt
|
||||||
<th>APV</th>
|
</div>
|
||||||
<th>Oprettet</th>
|
<div class="col-sm-2">
|
||||||
</tr>
|
APB
|
||||||
</thead>
|
</div>
|
||||||
<tbody>
|
<div class="col-sm-2">
|
||||||
@foreach (var document in Documents)
|
KAPV
|
||||||
{
|
</div>
|
||||||
<tr>
|
<div class="col-sm-3">
|
||||||
<td>
|
Oprettet
|
||||||
@document.ProductName
|
</div>
|
||||||
</td>
|
<div class="col-sm-1">
|
||||||
<td>
|
|
||||||
@document.ApbLink
|
</div>
|
||||||
</td>
|
</div>
|
||||||
<td>
|
</li>
|
||||||
@document.ApvLink
|
@foreach (var document in Documents)
|
||||||
</td>
|
{
|
||||||
<td>
|
<li class="list-group-item d-flex row g-2 align-items-center">
|
||||||
@document.DocumentDate
|
<div class="col-sm-4">
|
||||||
</td>
|
@document.ProductName
|
||||||
</tr>
|
</div>
|
||||||
}
|
<div class="col-sm-2">
|
||||||
</tbody>
|
<a class="btn btn-outline-dark btn-sm" href="@document.ApbLink" target="_blank">Vis APB</a>
|
||||||
</table>
|
</div>
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<a class="btn btn-outline-dark btn-sm" href="@document.ApvLink" target="_blank">Vis KAPV</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
@document.DocumentDate
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1 text-end">
|
||||||
|
<button type="button" class="btn btn-danger btn-sm" @onclick="@(() => RemoveDocument(document.ApbId, document.ApvId))">
|
||||||
|
<i class="bi-trash"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ol>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,21 @@ public partial class AdvisorCustomerWorkplaceDocumentListPage : IDisposable
|
||||||
Interceptor.RegisterEvent();
|
Interceptor.RegisterEvent();
|
||||||
Interceptor.RegisterBeforeSendEvent();
|
Interceptor.RegisterBeforeSendEvent();
|
||||||
|
|
||||||
WorkplaceInventory = await WorkplaceRepo.GetWorkplaceInventory(CompanyId, WorkplaceId);
|
Documents = await FetchDocuments();
|
||||||
|
|
||||||
|
Working = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task RemoveDocument(string apbId, string apvId)
|
||||||
|
{
|
||||||
|
await WorkplaceRepo.DeleteWorkplaceDocuments(CompanyId, WorkplaceId, apbId, apvId);
|
||||||
|
Documents = await FetchDocuments();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<List<Document>> FetchDocuments()
|
||||||
|
{
|
||||||
|
Documents = new List<Document>();
|
||||||
|
WorkplaceInventory = await WorkplaceRepo.GetWorkplaceInventory(CompanyId, WorkplaceId);
|
||||||
foreach (var product in WorkplaceInventory.Products)
|
foreach (var product in WorkplaceInventory.Products)
|
||||||
{
|
{
|
||||||
var newDoc = new Document();
|
var newDoc = new Document();
|
||||||
|
@ -57,21 +70,23 @@ public partial class AdvisorCustomerWorkplaceDocumentListPage : IDisposable
|
||||||
if (doc.DocumentTypeEnum == "Apb")
|
if (doc.DocumentTypeEnum == "Apb")
|
||||||
{
|
{
|
||||||
newDoc.ApbLink = doc.DocumentLink;
|
newDoc.ApbLink = doc.DocumentLink;
|
||||||
|
newDoc.ApbId = doc.DocumentId;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newDoc.ApvLink = doc.DocumentLink;
|
newDoc.ApvLink = doc.DocumentLink;
|
||||||
|
newDoc.ApvId = doc.DocumentId;
|
||||||
}
|
}
|
||||||
newDoc.DocumentDate = doc.DocumentDate;
|
newDoc.DocumentDate = doc.DocumentDate;
|
||||||
|
|
||||||
}
|
}
|
||||||
Documents.Add(newDoc);
|
Documents.Add(newDoc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Working = false;
|
return Documents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Interceptor.DisposeEvent();
|
Interceptor.DisposeEvent();
|
||||||
|
@ -84,4 +99,6 @@ internal sealed class Document
|
||||||
public string ApbLink { get; set; }
|
public string ApbLink { get; set; }
|
||||||
public string ApvLink { get; set; }
|
public string ApvLink { get; set; }
|
||||||
public string DocumentDate { get; set; }
|
public string DocumentDate { get; set; }
|
||||||
|
public string ApvId { get; set; }
|
||||||
|
public string ApbId { get; set; }
|
||||||
}
|
}
|
|
@ -23,11 +23,11 @@
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-6">
|
||||||
<h2>@Company.Name</h2>
|
<h2>@Company.Name</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-4 d-grid">
|
||||||
<a class="btn btn-primary" href="/advisor/customers/@CompanyId/workplaces/new"><i class="bi-plus-lg"></i> NY</a>
|
<a class="btn btn-primary" href="/advisor/customers/@CompanyId/workplaces/new"><i class="bi-plus-lg"></i> Opret arbejdssted</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue