wip
This commit is contained in:
parent
1225760d7f
commit
f1deb49d0d
13 changed files with 222 additions and 4 deletions
52
Wonky.Client/Components/HistoryTableComponent.razor
Normal file
52
Wonky.Client/Components/HistoryTableComponent.razor
Normal file
|
@ -0,0 +1,52 @@
|
|||
@if (History.Any())
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
Dato
|
||||
</th>
|
||||
<th scope="col">
|
||||
Antal
|
||||
</th>
|
||||
<th scope="col">
|
||||
Vare
|
||||
</th>
|
||||
<th scope="col">
|
||||
Varenummer
|
||||
</th>
|
||||
<th scope="col" class="align-content-end">
|
||||
Rabat
|
||||
</th>
|
||||
<th scope="col" class="align-content-end">
|
||||
Pris
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var line in History)
|
||||
{
|
||||
<tr class="align-content-center">
|
||||
<td>
|
||||
@line.DeliverDate
|
||||
</td>
|
||||
<td>
|
||||
@line.Quantity
|
||||
</td>
|
||||
<td>
|
||||
@line.Name
|
||||
</td>
|
||||
<td>
|
||||
@line.Sku
|
||||
</td>
|
||||
<td class="align-content-end">
|
||||
@(line.Discount)%
|
||||
</td>
|
||||
<td class="align-content-end">
|
||||
@line.Price
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
9
Wonky.Client/Components/HistoryTableComponent.razor.cs
Normal file
9
Wonky.Client/Components/HistoryTableComponent.razor.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using Wonky.Entity.DTO;
|
||||
|
||||
namespace Wonky.Client.Components;
|
||||
|
||||
public partial class HistoryTableComponent
|
||||
{
|
||||
[Parameter] public List<ProductHistoryView> History { get; set; }
|
||||
}
|
34
Wonky.Client/Components/InventoryTableComponent.razor
Normal file
34
Wonky.Client/Components/InventoryTableComponent.razor
Normal file
|
@ -0,0 +1,34 @@
|
|||
@if (Products.Any())
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
Product
|
||||
</th>
|
||||
<th scope="col">
|
||||
Varenummer
|
||||
</th>
|
||||
<th scope="col">
|
||||
Antal
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var product in Products)
|
||||
{
|
||||
<tr class="align-content-center">
|
||||
<td>
|
||||
@product.Name
|
||||
</td>
|
||||
<td>
|
||||
@product.Sku
|
||||
</td>
|
||||
<td>
|
||||
@product.Quantity
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
9
Wonky.Client/Components/InventoryTableComponent.razor.cs
Normal file
9
Wonky.Client/Components/InventoryTableComponent.razor.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using Wonky.Entity.DTO;
|
||||
|
||||
namespace Wonky.Client.Components;
|
||||
|
||||
public partial class InventoryTableComponent
|
||||
{
|
||||
[Parameter] public List<ProductInventoryView> Products { get; set; }
|
||||
}
|
72
Wonky.Client/HttpRepository/HistoryHttpRepository.cs
Normal file
72
Wonky.Client/HttpRepository/HistoryHttpRepository.cs
Normal file
|
@ -0,0 +1,72 @@
|
|||
using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Wonky.Client.Pages;
|
||||
using Wonky.Entity.Configuration;
|
||||
using Wonky.Entity.DTO;
|
||||
using Wonky.Entity.Views;
|
||||
|
||||
namespace Wonky.Client.HttpRepository;
|
||||
|
||||
public class HistoryHttpRepository : IHistoryHttpRepository
|
||||
{
|
||||
private readonly JsonSerializerOptions _options = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
private readonly NavigationManager _navigation;
|
||||
private ILogger<HistoryHttpRepository> _logger;
|
||||
private readonly HttpClient _client;
|
||||
private readonly ApiConfig _apiConfig;
|
||||
|
||||
public HistoryHttpRepository(HttpClient client,
|
||||
ILogger<HistoryHttpRepository> logger,
|
||||
NavigationManager navigation, IOptions<ApiConfig> configuration)
|
||||
{
|
||||
_client = client;
|
||||
_logger = logger;
|
||||
_navigation = navigation;
|
||||
_apiConfig = configuration.Value;
|
||||
}
|
||||
|
||||
|
||||
// public async Task<List<TaskItemView>> GetTaskList()
|
||||
// {
|
||||
// return await _client.GetFromJsonAsync<List<TaskItemView>>($"{_apiConfig.TaskItemEndpoint}");
|
||||
// }
|
||||
//
|
||||
// public async Task CreateTaskItem(TaskItemView taskItem)
|
||||
// {
|
||||
// await _client.PostAsJsonAsync($"{_apiConfig.TaskItemEndpoint}", taskItem);
|
||||
// }
|
||||
//
|
||||
// public async Task<TaskItemView> GetTaskItem(string taskItemId)
|
||||
// {
|
||||
// return await _client.GetFromJsonAsync<TaskItemView>($"{_apiConfig.TaskItemEndpoint}/{taskItemId}");
|
||||
// }
|
||||
public async Task<List<ProductInventoryView>> GetProductInventory(string companyId)
|
||||
{
|
||||
return await _client.GetFromJsonAsync<List<ProductInventoryView>>(
|
||||
$"{_apiConfig.CompanyEndpoint}/{companyId}/{_apiConfig.HistoryEndpoint}/products");
|
||||
}
|
||||
|
||||
public async Task<List<ProductHistoryView>> GetProductHistory(string companyId)
|
||||
{
|
||||
return await _client.GetFromJsonAsync<List<ProductHistoryView>>(
|
||||
$"{_apiConfig.CompanyEndpoint}/{companyId}/{_apiConfig.HistoryEndpoint}/products");
|
||||
|
||||
}
|
||||
|
||||
public async Task<List<ProductHistoryView>> GetProductHistory(string companyId, string sku)
|
||||
{
|
||||
return await _client.GetFromJsonAsync<List<ProductHistoryView>>(
|
||||
$"{_apiConfig.CompanyEndpoint}/{companyId}/{_apiConfig.HistoryEndpoint}/products");
|
||||
}
|
||||
|
||||
public async Task<string> UpdateProductHistory(string companyId, string syncDate)
|
||||
{
|
||||
return await _client.GetStringAsync($"{_apiConfig.CompanyEndpoint}/{companyId}/{syncDate}");
|
||||
}
|
||||
}
|
12
Wonky.Client/HttpRepository/IHistoryHttpRepository.cs
Normal file
12
Wonky.Client/HttpRepository/IHistoryHttpRepository.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using Wonky.Client.Pages;
|
||||
using Wonky.Entity.DTO;
|
||||
|
||||
namespace Wonky.Client.HttpRepository;
|
||||
|
||||
public interface IHistoryHttpRepository
|
||||
{
|
||||
Task<List<ProductInventoryView>> GetProductInventory(string companyId);
|
||||
Task<List<ProductHistoryView>> GetProductHistory(string companyId);
|
||||
Task<List<ProductHistoryView>> GetProductHistory(string companyId, string sku);
|
||||
Task<string> UpdateProductHistory(string companyId, string syncDate);
|
||||
}
|
|
@ -200,6 +200,12 @@
|
|||
<div class="col">
|
||||
<a class="btn btn-primary" href="/companies">Til Oversigt</a>
|
||||
</div>
|
||||
<div class="col">
|
||||
<a class="btn btn-success" href="/companies/@_company.CompanyId/products">Produktkøb</a>
|
||||
</div>
|
||||
<div class="col">
|
||||
<a class="btn btn-success" href="/companies/@_company.CompanyId/history">Varelinjer</a>
|
||||
</div>
|
||||
<div class="col">
|
||||
<ActivityButton CompanyId="@_company.CompanyId" Enabled="@_company.ValidVat"></ActivityButton>
|
||||
</div>
|
||||
|
|
1
Wonky.Client/Pages/ProductInventory.razor
Normal file
1
Wonky.Client/Pages/ProductInventory.razor
Normal file
|
@ -0,0 +1 @@
|
|||
@page "/companies/{CompanyId}/products"
|
6
Wonky.Client/Pages/ProductInventory.razor.cs
Normal file
6
Wonky.Client/Pages/ProductInventory.razor.cs
Normal file
|
@ -0,0 +1,6 @@
|
|||
namespace Wonky.Client.Pages;
|
||||
|
||||
public partial class ProductInventory
|
||||
{
|
||||
|
||||
}
|
|
@ -36,7 +36,6 @@
|
|||
"activityEndpoint": "api/v2/crm/salesReps/sales",
|
||||
"reportEndpoint": "api/v2/crm/salesReps/reports",
|
||||
"taskItemEndpoint": "api/v2/crm/salesRps/tasks",
|
||||
"productHistoryEndpoint": "products",
|
||||
"accountHistoryEndpoint": "account"
|
||||
"historyEndpoint": "products"
|
||||
}
|
||||
}
|
|
@ -33,6 +33,5 @@ public class ApiConfig
|
|||
public string ActivityEndpoint { get; set; } = "";
|
||||
public string ReportEndpoint { get; set; } = "";
|
||||
public string TaskItemEndpoint { get; set; } = "";
|
||||
public string ProductHistoryEndpoint { get; set; } = "";
|
||||
public string AccountHistoryEndpoint { get; set; } = "";
|
||||
public string HistoryEndpoint { get; set; } = "";
|
||||
}
|
11
Wonky.Entity/DTO/ProductHistoryView.cs
Normal file
11
Wonky.Entity/DTO/ProductHistoryView.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
namespace Wonky.Entity.DTO;
|
||||
|
||||
public class ProductHistoryView
|
||||
{
|
||||
public string DeliverDate { get; set; } = "";
|
||||
public string Name { get; set; } = "";
|
||||
public string Sku { get; set; } = "";
|
||||
public int Quantity { get; set; }
|
||||
public decimal Price { get; set; }
|
||||
public decimal Discount { get; set; }
|
||||
}
|
8
Wonky.Entity/DTO/ProductInventoryView.cs
Normal file
8
Wonky.Entity/DTO/ProductInventoryView.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace Wonky.Entity.DTO;
|
||||
|
||||
public class ProductInventoryView
|
||||
{
|
||||
public string Name { get; set; } = "";
|
||||
public string Sku { get; set; } = "";
|
||||
public int Quantity { get; set; }
|
||||
}
|
Loading…
Reference in a new issue