diff --git a/Wonky.Client/Components/TaskItemTableComponent.razor b/Wonky.Client/Components/TaskItemTableComponent.razor
index f3ada1ca..a6c1228e 100644
--- a/Wonky.Client/Components/TaskItemTableComponent.razor
+++ b/Wonky.Client/Components/TaskItemTableComponent.razor
@@ -26,6 +26,7 @@
@@ -60,6 +61,11 @@
+ }
+
+
+ @if (task.TaskTypeEnum is "Recall")
+ {
diff --git a/Wonky.Client/HttpRepository/IWorkplaceHttpRepository.cs b/Wonky.Client/HttpRepository/IWorkplaceHttpRepository.cs
new file mode 100644
index 00000000..b3801729
--- /dev/null
+++ b/Wonky.Client/HttpRepository/IWorkplaceHttpRepository.cs
@@ -0,0 +1,12 @@
+using Wonky.Entity.DTO;
+
+namespace Wonky.Client.HttpRepository;
+
+public interface IWorkplaceHttpRepository
+{
+ Task> GetWorkplaces(string companyId);
+ Task GetWorkplace(string companyId, string workplaceId);
+ Task CreateWorkplace(string companyId, WorkplaceDto workplace);
+ Task UpdateWorkplace(string companyId, WorkplaceDto workplace);
+ Task DeleteWorkplace(string companyId, string workplaceId);
+}
\ No newline at end of file
diff --git a/Wonky.Client/HttpRepository/WorkplaceHttpRepository.cs b/Wonky.Client/HttpRepository/WorkplaceHttpRepository.cs
new file mode 100644
index 00000000..094f2643
--- /dev/null
+++ b/Wonky.Client/HttpRepository/WorkplaceHttpRepository.cs
@@ -0,0 +1,64 @@
+using System.Net.Http.Json;
+using System.Text.Json;
+using Microsoft.AspNetCore.Components;
+using Microsoft.Extensions.Options;
+using Wonky.Entity.Configuration;
+using Wonky.Entity.DTO;
+
+namespace Wonky.Client.HttpRepository;
+
+public class WorkplaceHttpRepository : IWorkplaceHttpRepository
+{
+ private readonly JsonSerializerOptions? _options = new JsonSerializerOptions
+ {
+ PropertyNameCaseInsensitive = true
+ };
+
+ private readonly NavigationManager _navigation;
+ private ILogger _logger;
+ private readonly HttpClient _client;
+ private readonly ApiConfig _api;
+
+ public WorkplaceHttpRepository(HttpClient client,
+ ILogger logger,
+ NavigationManager navigation,
+ IOptions configuration)
+ {
+ _client = client;
+ _logger = logger;
+ _navigation = navigation;
+ _api = configuration.Value;
+ }
+
+ public async Task> GetWorkplaces(string companyId)
+ {
+ var result = await _client.GetFromJsonAsync>(
+ $"{_api.CrmCustomer}/{companyId}/{_api.CrmWorkplace}", _options);
+ return result ?? new List();
+ }
+
+ public async Task GetWorkplace(string companyId, string workplaceId)
+ {
+ var result = await _client.GetFromJsonAsync(
+ $"{_api.CrmCustomer}/{companyId}/{_api.CrmWorkplace}/{workplaceId}", _options);
+ return result ?? new WorkplaceDto();
+ }
+
+ public async Task CreateWorkplace(string companyId, WorkplaceDto workplace)
+ {
+ await _client.PostAsJsonAsync(
+ $"{_api.CrmCustomer}/{companyId}/{_api.CrmWorkplace}", workplace, _options);
+ }
+
+ public async Task UpdateWorkplace(string companyId, WorkplaceDto workplace)
+ {
+ await _client.PutAsJsonAsync(
+ $"{_api.CrmCustomer}/{companyId}/{_api.CrmWorkplace}/{workplace.WorkplaceId}", workplace, _options);
+ }
+
+ public async Task DeleteWorkplace(string companyId, string workplaceId)
+ {
+ await _client.DeleteAsync(
+ $"{_api.CrmCustomer}/{companyId}/{_api.CrmWorkplace}/{workplaceId}");
+ }
+}
\ No newline at end of file
diff --git a/Wonky.Client/Pages/CustomerViewPage.razor b/Wonky.Client/Pages/CustomerViewPage.razor
index 48bc1df2..25de0fd4 100644
--- a/Wonky.Client/Pages/CustomerViewPage.razor
+++ b/Wonky.Client/Pages/CustomerViewPage.razor
@@ -18,7 +18,6 @@
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components
@using Wonky.Client.Components
-@using Wonky.Client.Helpers
@attribute [Authorize(Roles = "Advisor")]
@page "/companies/{CompanyId}"
@@ -202,6 +201,9 @@
+
diff --git a/Wonky.Client/Pages/TaskItemListPage.razor b/Wonky.Client/Pages/TaskItemListPage.razor
index 9d9dcc06..3f75c070 100644
--- a/Wonky.Client/Pages/TaskItemListPage.razor
+++ b/Wonky.Client/Pages/TaskItemListPage.razor
@@ -34,7 +34,7 @@
-
-
\ No newline at end of file
diff --git a/Wonky.Client/Pages/WorkplaceListPage.razor b/Wonky.Client/Pages/WorkplaceListPage.razor
new file mode 100644
index 00000000..99e388c6
--- /dev/null
+++ b/Wonky.Client/Pages/WorkplaceListPage.razor
@@ -0,0 +1,24 @@
+@using Microsoft.AspNetCore.Authorization
+@attribute [Authorize(Roles = "Advisor")]
+@page "/companies/{CompanyId}/workplaces"
+
+
+
+
+ @if (_workplaces.Any())
+ {
+
+ }
+
+
\ No newline at end of file
diff --git a/Wonky.Client/Pages/WorkplaceListPage.razor.cs b/Wonky.Client/Pages/WorkplaceListPage.razor.cs
new file mode 100644
index 00000000..94aefc37
--- /dev/null
+++ b/Wonky.Client/Pages/WorkplaceListPage.razor.cs
@@ -0,0 +1,32 @@
+using System.Text.Json;
+using Microsoft.AspNetCore.Components;
+using Wonky.Client.HttpInterceptors;
+using Wonky.Client.HttpRepository;
+using Wonky.Entity.DTO;
+
+namespace Wonky.Client.Pages;
+
+public partial class WorkplaceListPage : IDisposable
+{
+ [Parameter] public string CompanyId { get; set; } = "";
+ [Inject] private IWorkplaceHttpRepository _workplaceRepo { get; set; }
+ [Inject] private ICompanyHttpRepository _companyRepo { get; set; }
+ [Inject] private HttpInterceptorService _interceptor { get; set; }
+ private List _workplaces { get; set; } = new();
+ private CompanyDto _company { get; set; } = new();
+
+ protected override async Task OnParametersSetAsync()
+ {
+ _interceptor.RegisterEvent();
+ _interceptor.RegisterBeforeSendEvent();
+ _company = await _companyRepo.GetCompanyById(CompanyId);
+ _workplaces = await _workplaceRepo.GetWorkplaces(CompanyId);
+
+ Console.WriteLine(JsonSerializer.Serialize(_workplaces));
+ }
+
+ public void Dispose()
+ {
+ _interceptor.DisposeEvent();
+ }
+}
\ No newline at end of file
diff --git a/Wonky.Client/Pages/WorkplaceViewPage.razor b/Wonky.Client/Pages/WorkplaceViewPage.razor
new file mode 100644
index 00000000..cea8bff0
--- /dev/null
+++ b/Wonky.Client/Pages/WorkplaceViewPage.razor
@@ -0,0 +1,26 @@
+@using Microsoft.AspNetCore.Authorization
+@attribute [Authorize(Roles = "Advisor")]
+@page "/companies/{CompanyId}/workplaces/{WorkplaceId}"
+
+
+
+
+
+ @_workplace.WorkplaceId
+
+
+ @_workplace.Name
+
+
+ @_workplace.Description
+
+
+ @_workplace.ShortUrl
+
+
+
\ No newline at end of file
diff --git a/Wonky.Client/Pages/WorkplaceViewPage.razor.cs b/Wonky.Client/Pages/WorkplaceViewPage.razor.cs
new file mode 100644
index 00000000..0c0abad7
--- /dev/null
+++ b/Wonky.Client/Pages/WorkplaceViewPage.razor.cs
@@ -0,0 +1,33 @@
+using System.Text.Json;
+using Microsoft.AspNetCore.Components;
+using Wonky.Client.HttpInterceptors;
+using Wonky.Client.HttpRepository;
+using Wonky.Entity.DTO;
+
+namespace Wonky.Client.Pages;
+
+public partial class WorkplaceViewPage : IDisposable
+{
+ [Parameter] public string CompanyId { get; set; } = "";
+ [Parameter] public string WorkplaceId { get; set; } = "";
+ [Inject] private IWorkplaceHttpRepository _workplaceRepo { get; set; }
+ [Inject] private ICompanyHttpRepository _companyRepo { get; set; }
+ [Inject] private HttpInterceptorService _interceptor { get; set; }
+ private WorkplaceDto _workplace { get; set; } = new();
+ private CompanyDto _company { get; set; } = new();
+
+ protected override async Task OnParametersSetAsync()
+ {
+ _interceptor.RegisterEvent();
+ _interceptor.RegisterBeforeSendEvent();
+ _company = await _companyRepo.GetCompanyById(CompanyId);
+ _workplace = await _workplaceRepo.GetWorkplace(CompanyId, WorkplaceId);
+
+ Console.WriteLine(JsonSerializer.Serialize(_workplace));
+ }
+
+ public void Dispose()
+ {
+ _interceptor.DisposeEvent();
+ }
+}
\ No newline at end of file
diff --git a/Wonky.Client/Program.cs b/Wonky.Client/Program.cs
index 1951cf7e..e580a24b 100644
--- a/Wonky.Client/Program.cs
+++ b/Wonky.Client/Program.cs
@@ -58,6 +58,7 @@ builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
+builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddBlazoredLocalStorage();
diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json
index f2337f69..d535e87a 100644
--- a/Wonky.Client/wwwroot/appsettings.json
+++ b/Wonky.Client/wwwroot/appsettings.json
@@ -7,7 +7,7 @@
"image": "grumpy-coder.png"
},
"apiConfig": {
- "innoBaseUrl": "https://staging.innotec.dk",
+ "innoBaseUrl": "https://dev.innotec.dk",
"glsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=",
"glsId": "",
"serviceVirk": "api/v2/services/virk",
@@ -23,6 +23,7 @@
"crmInventory": "history/inventory",
"crmProduct": "history/products",
"crmSync": "history/sync",
+ "crmWorkplace": "workplaces",
"adminUser": "api/v2/admin/users/advisors",
"adminOffice": "api/v2/admin/users/office",
"adminPasswd": "api/v2/admin/users/passwd",
diff --git a/Wonky.Entity/Configuration/ApiConfig.cs b/Wonky.Entity/Configuration/ApiConfig.cs
index 7b257c28..cbaded44 100644
--- a/Wonky.Entity/Configuration/ApiConfig.cs
+++ b/Wonky.Entity/Configuration/ApiConfig.cs
@@ -95,6 +95,11 @@ public class ApiConfig
/// Application uri for updating customer product sale request
///
public string CrmSync { get; set; } = "";
+
+ ///
+ /// Application uri for getting workplace(s)
+ ///
+ public string CrmWorkplace { get; set; } = "";
///
/// Application uri for administration of sales representatives
diff --git a/Wonky.Entity/DTO/WorkplaceDto.cs b/Wonky.Entity/DTO/WorkplaceDto.cs
new file mode 100644
index 00000000..dfb9c152
--- /dev/null
+++ b/Wonky.Entity/DTO/WorkplaceDto.cs
@@ -0,0 +1,9 @@
+namespace Wonky.Entity.DTO;
+
+public class WorkplaceDto
+{
+ public string WorkplaceId { get; set; } = "";
+ public string Name { get; set; } = "";
+ public string Description { get; set; } = "";
+ public string ShortUrl { get; set; } = "";
+}
\ No newline at end of file
|