diff --git a/Wonky.Client/Components/WorkplaceListComponent.razor b/Wonky.Client/Components/WorkplaceListComponent.razor
deleted file mode 100644
index c6668580..00000000
--- a/Wonky.Client/Components/WorkplaceListComponent.razor
+++ /dev/null
@@ -1,48 +0,0 @@
-@* Copyright (C) 2022 FCS Frede's Computer Services.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-*@
-
-@using Wonky.Entity.DTO
-@using Wonky.Entity.Views
-
-@if (Workplaces.Any())
-{
-
-}
diff --git a/Wonky.Client/Components/WorkplaceListComponent.razor.cs b/Wonky.Client/Components/WorkplaceListComponent.razor.cs
deleted file mode 100644
index 022fdfeb..00000000
--- a/Wonky.Client/Components/WorkplaceListComponent.razor.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (C) 2022 FCS Frede's Computer Services.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-
-using Microsoft.AspNetCore.Components;
-using Wonky.Entity.Views;
-
-namespace Wonky.Client.Components;
-
-public partial class WorkplaceListComponent
-{
- [Parameter] public List Workplaces { get; set; } = new();
-
- [Parameter] public string CompanyId { get; set; } = "";
-}
\ No newline at end of file
diff --git a/Wonky.Client/Helpers/Utils.cs b/Wonky.Client/Helpers/Utils.cs
index e457fb65..3a4985ae 100644
--- a/Wonky.Client/Helpers/Utils.cs
+++ b/Wonky.Client/Helpers/Utils.cs
@@ -16,6 +16,7 @@
using System.Net.Mail;
using System.Text.RegularExpressions;
using Wonky.Client.Models;
+using Wonky.Entity.DTO;
namespace Wonky.Client.Helpers;
@@ -24,6 +25,67 @@ namespace Wonky.Client.Helpers;
///
public static class Utils
{
+ ///
+ /// map user role edit model to role assignment model
+ ///
+ ///
+ ///
+ public static List MapSaveAssignedRoles(RoleAssignment model)
+ {
+ return new List()
+ {
+ new (){ Name = "Admin", Assigned = model.Admin},
+ new (){ Name = "Advisor", Assigned = model.Advisor},
+ new (){ Name = "EDoc", Assigned = model.EDoc},
+ new (){ Name = "EShop", Assigned = model.EShop},
+ new (){ Name = "Managment", Assigned = model.Management},
+ new (){ Name = "Office", Assigned = model.Office},
+ new (){ Name = "Supervisor", Assigned = model.Supervisor},
+ new (){ Name = "Warehouse", Assigned = model.Warehouse}
+ };
+ }
+
+ ///
+ /// map user role assignment to edit model
+ ///
+ ///
+ ///
+ public static RoleAssignment MapEditAssignedRoles(UserManagerEditView model)
+ {
+ var x = new RoleAssignment();
+ foreach (var role in model.AssignedRoles)
+ {
+ switch (role.Name.ToLower())
+ {
+ case "admin":
+ x.Admin = role.Assigned;
+ break;
+ case "advisor":
+ x.Advisor = role.Assigned;
+ break;
+ case "edoc":
+ x.EDoc = role.Assigned;
+ break;
+ case "eshop":
+ x.EShop = role.Assigned;
+ break;
+ case "management":
+ x.Management = role.Assigned;
+ break;
+ case "office":
+ x.Office = role.Assigned;
+ break;
+ case "supervisor":
+ x.Supervisor = role.Assigned;
+ break;
+ case "warehouse":
+ x.Warehouse = role.Assigned;
+ break;
+ }
+ }
+ return x;
+ }
+
///
/// Sanitize string by removing everything but digits
///
diff --git a/Wonky.Client/HttpRepository/AdvisorWorkplaceRepository.cs b/Wonky.Client/HttpRepository/AdvisorWorkplaceRepository.cs
index 863e2592..2486ae51 100644
--- a/Wonky.Client/HttpRepository/AdvisorWorkplaceRepository.cs
+++ b/Wonky.Client/HttpRepository/AdvisorWorkplaceRepository.cs
@@ -46,11 +46,6 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository
_api = configuration.Value;
}
- ///
- /// Get Workplaces for given customer id
- ///
- ///
- ///
public async Task> GetWorkplaces(string companyId)
{
var result = await _client.GetFromJsonAsync>(
@@ -58,12 +53,6 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository
return result ?? new List();
}
- ///
- /// Get specific workplace using customer id and workplace id
- ///
- ///
- ///
- ///
public async Task GetWorkplace(string companyId, string workplaceId)
{
var result = await _client.GetFromJsonAsync(
@@ -71,39 +60,28 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository
return result ?? new WorkplaceDto();
}
- ///
- /// Create new workplace given the customer id and workplace data
- ///
- ///
- ///
- ///
public async Task CreateWorkplace(string companyId, WorkplaceDto workplace)
{
await _client.PostAsJsonAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}", workplace, _options);
}
- ///
- /// Update workplace given the customer id and updated data
- ///
- ///
- ///
- ///
public async Task UpdateWorkplace(string companyId, WorkplaceDto workplace)
{
await _client.PutAsJsonAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplace.WorkplaceId}", workplace, _options);
}
- ///
- /// Delete workplace given customer id and workplace id
- ///
- ///
- ///
- ///
public async Task DeleteWorkplace(string companyId, string workplaceId)
{
await _client.DeleteAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}");
}
+
+ public async Task GetWorkplaceInventory(string companyId, string workplaceId)
+ {
+ var result = await _client.GetFromJsonAsync(
+ $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents");
+ return result ?? new WorkplaceInventory();
+ }
}
\ No newline at end of file
diff --git a/Wonky.Client/HttpRepository/IAdvisorWorkplaceRepository.cs b/Wonky.Client/HttpRepository/IAdvisorWorkplaceRepository.cs
index 56159e8c..acc2c2dc 100644
--- a/Wonky.Client/HttpRepository/IAdvisorWorkplaceRepository.cs
+++ b/Wonky.Client/HttpRepository/IAdvisorWorkplaceRepository.cs
@@ -61,4 +61,12 @@ public interface IAdvisorWorkplaceRepository
///
///
Task DeleteWorkplace(string companyId, string workplaceId);
+
+ ///
+ /// Get list of products and documentation for workplace
+ ///
+ ///
+ ///
+ ///
+ Task GetWorkplaceInventory(string companyId, string workplaceId);
}
\ No newline at end of file
diff --git a/Wonky.Client/HttpRepository/IOfficeUserInfoRepository.cs b/Wonky.Client/HttpRepository/IOfficeUserInfoRepository.cs
index 0e1567e1..3cebd1ba 100644
--- a/Wonky.Client/HttpRepository/IOfficeUserInfoRepository.cs
+++ b/Wonky.Client/HttpRepository/IOfficeUserInfoRepository.cs
@@ -46,5 +46,5 @@ public interface IOfficeUserInfoRepository
///
///
///
- Task GetUserInfo(string userId);
+ Task GetUserInfo(string userId);
}
\ No newline at end of file
diff --git a/Wonky.Client/HttpRepository/ISystemUserRepository.cs b/Wonky.Client/HttpRepository/ISystemUserRepository.cs
index 414d9c6f..2ca77e3e 100644
--- a/Wonky.Client/HttpRepository/ISystemUserRepository.cs
+++ b/Wonky.Client/HttpRepository/ISystemUserRepository.cs
@@ -47,7 +47,7 @@ public interface ISystemUserRepository
///
///
///
- Task CreateUser(UserManagerCreate model);
+ Task CreateUser(UserManagerCreateView model);
///
/// Update User using userId and updated data
diff --git a/Wonky.Client/HttpRepository/IWorkplaceHttpRepository.cs b/Wonky.Client/HttpRepository/IWorkplaceHttpRepository.cs
deleted file mode 100644
index 7c8c3e76..00000000
--- a/Wonky.Client/HttpRepository/IWorkplaceHttpRepository.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2022 FCS Frede's Computer Services.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-
-using Wonky.Entity.DTO;
-using Wonky.Entity.Views;
-
-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/OfficeUserInfoRepository.cs b/Wonky.Client/HttpRepository/OfficeUserInfoRepository.cs
index cf028500..eb13b77b 100644
--- a/Wonky.Client/HttpRepository/OfficeUserInfoRepository.cs
+++ b/Wonky.Client/HttpRepository/OfficeUserInfoRepository.cs
@@ -75,9 +75,9 @@ public class OfficeUserInfoRepository : IOfficeUserInfoRepository
///
///
///
- public async Task GetUserInfo(string userId)
+ public async Task GetUserInfo(string userId)
{
- return await _client.GetFromJsonAsync($"{_api.UserData}/{userId}");
+ return await _client.GetFromJsonAsync($"{_api.UserData}/{userId}");
}
}
\ No newline at end of file
diff --git a/Wonky.Client/HttpRepository/OrderProcessRepository.cs b/Wonky.Client/HttpRepository/OrderProcessRepository.cs
index 0929f509..7e9e7a90 100644
--- a/Wonky.Client/HttpRepository/OrderProcessRepository.cs
+++ b/Wonky.Client/HttpRepository/OrderProcessRepository.cs
@@ -53,7 +53,7 @@ public class OrderProcessRepository : IOrderProcessRepository
///
public async Task> GetWarehouseOrderListByDate(string date)
{
- return await _client.GetFromJsonAsync>($"{_api.Warehouse}?date={date}", _options);
+ return await _client.GetFromJsonAsync>($"{_api.Warehouse}/date?date={date}", _options);
}
///
@@ -65,7 +65,7 @@ public class OrderProcessRepository : IOrderProcessRepository
public async Task> GetWarehouseOrderListByStatus(string status, string express = "")
{
return await _client.GetFromJsonAsync>(
- $"{_api.Warehouse}?status={status}&express={express}", _options);
+ $"{_api.Warehouse}?status={status}&express={express}/state", _options);
}
///
diff --git a/Wonky.Client/HttpRepository/SystemUserRepository.cs b/Wonky.Client/HttpRepository/SystemUserRepository.cs
index c261a0b9..63b8278d 100644
--- a/Wonky.Client/HttpRepository/SystemUserRepository.cs
+++ b/Wonky.Client/HttpRepository/SystemUserRepository.cs
@@ -72,11 +72,12 @@ public class SystemUserRepository : ISystemUserRepository
///
///
///
- public async Task CreateUser(UserManagerCreate model)
+ public async Task CreateUser(UserManagerCreateView model)
{
var result = await _client.PostAsJsonAsync($"{_api.UserManager}", model, _options);
if (!result.IsSuccessStatusCode)
return new UserManagerEditView();
+
try
{
return await result.Content.ReadFromJsonAsync();
diff --git a/Wonky.Client/HttpRepository/WorkplaceHttpRepository.cs b/Wonky.Client/HttpRepository/WorkplaceHttpRepository.cs
deleted file mode 100644
index 7c0a9cfa..00000000
--- a/Wonky.Client/HttpRepository/WorkplaceHttpRepository.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (C) 2022 FCS Frede's Computer Services.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-
-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;
-using Wonky.Entity.Views;
-
-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.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}", _options);
- return result ?? new List();
- }
-
- public async Task GetWorkplace(string companyId, string workplaceId)
- {
- var result = await _client.GetFromJsonAsync(
- $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}", _options);
- return result ?? new WorkplaceDto();
- }
-
- public async Task CreateWorkplace(string companyId, WorkplaceDto workplace)
- {
- await _client.PostAsJsonAsync(
- $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}", workplace, _options);
- }
-
- public async Task UpdateWorkplace(string companyId, WorkplaceDto workplace)
- {
- await _client.PutAsJsonAsync(
- $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplace.WorkplaceId}", workplace, _options);
- }
-
- public async Task DeleteWorkplace(string companyId, string workplaceId)
- {
- await _client.DeleteAsync(
- $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}");
- }
-}
\ No newline at end of file
diff --git a/Wonky.Client/Models/AssignedRoles.cs b/Wonky.Client/Models/RoleAssignment.cs
similarity index 97%
rename from Wonky.Client/Models/AssignedRoles.cs
rename to Wonky.Client/Models/RoleAssignment.cs
index ebbbd6f9..d21bcf15 100644
--- a/Wonky.Client/Models/AssignedRoles.cs
+++ b/Wonky.Client/Models/RoleAssignment.cs
@@ -15,7 +15,7 @@
namespace Wonky.Client.Models;
-public class AssignedRoles
+public class RoleAssignment
{
public bool Admin { get; set; }
public bool Advisor { get; set; }
diff --git a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor
index f7877cc0..d786c8b4 100644
--- a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor
+++ b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor
@@ -247,6 +247,15 @@
+
+
+
\ No newline at end of file
diff --git a/Wonky.Client/Pages/WorkplaceDocumentListPage.razor.cs b/Wonky.Client/Pages/WorkplaceDocumentListPage.razor.cs
deleted file mode 100644
index 16c5c26f..00000000
--- a/Wonky.Client/Pages/WorkplaceDocumentListPage.razor.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using Microsoft.AspNetCore.Components;
-using Wonky.Client.HttpInterceptors;
-using Wonky.Client.HttpRepository;
-using Wonky.Entity.DTO;
-
-#pragma warning disable CS8618
-
-namespace Wonky.Client.Pages;
-
-public partial class WorkplaceDocumentListPage : IDisposable
-{
- // ##############################################################
- [Inject] private HttpInterceptorService Interceptor { get; set; }
- [Inject] private IWorkplaceHttpRepository WorkplaceRepo { get; set; }
-
- // ##############################################################
- [Parameter] public string CompanyId { get; set; } = "";
- [Parameter] public string WorkplaceId { get; set; } = "";
-
- // ##############################################################
- private WorkplaceDto Workplace { get; set; } = new();
-
-
- protected override async Task OnParametersSetAsync()
- {
- Interceptor.RegisterEvent();
- Interceptor.RegisterBeforeSendEvent();
-
- }
-
- public void Dispose()
- {
- Interceptor.DisposeEvent();
- }
-}
\ No newline at end of file
diff --git a/Wonky.Client/Pages/WorkplaceListPage.razor b/Wonky.Client/Pages/WorkplaceListPage.razor
deleted file mode 100644
index 17849fb8..00000000
--- a/Wonky.Client/Pages/WorkplaceListPage.razor
+++ /dev/null
@@ -1,30 +0,0 @@
-@*
-// Copyright (C) 2022 FCS Frede's Computer Services.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-*@
-
-@using Microsoft.AspNetCore.Authorization
-@using Wonky.Client.Components
-@attribute [Authorize(Roles = "Advisor")]
-@page "/advisor/customers/{CompanyId}/workplaces"
-
-
-
-
@Customer.Name
-
-
-
-
-
\ No newline at end of file
diff --git a/Wonky.Client/Pages/WorkplaceListPage.razor.cs b/Wonky.Client/Pages/WorkplaceListPage.razor.cs
deleted file mode 100644
index 0088fe6d..00000000
--- a/Wonky.Client/Pages/WorkplaceListPage.razor.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (C) 2022 FCS Frede's Computer Services.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-
-
-using Microsoft.AspNetCore.Components;
-using Wonky.Client.HttpInterceptors;
-using Wonky.Client.HttpRepository;
-using Wonky.Entity.DTO;
-using Wonky.Entity.Views;
-
-#pragma warning disable CS8618
-namespace Wonky.Client.Pages;
-
-public partial class WorkplaceListPage : IDisposable
-{
- // ##############################################################
- [Inject] private IWorkplaceHttpRepository WorkplaceRepo { get; set; }
- [Inject] private IAdvisorCustomerRepository CustomerRepo { get; set; }
- [Inject] private HttpInterceptorService Interceptor { get; set; }
-
-
- // ##############################################################
- [Parameter] public string CompanyId { get; set; } = "";
-
- // ##############################################################
- private List Workplaces { get; set; } = new();
- private CompanyDto Customer { get; set; } = new();
-
-
- protected override async Task OnParametersSetAsync()
- {
- Interceptor.RegisterEvent();
- Interceptor.RegisterBeforeSendEvent();
- Customer = await CustomerRepo.GetCompanyById(CompanyId);
- }
-
-
- protected override async Task OnInitializedAsync()
- {
- Workplaces = await WorkplaceRepo.GetWorkplaces(CompanyId);
- }
-
-
- 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
deleted file mode 100644
index f0175d74..00000000
--- a/Wonky.Client/Pages/WorkplaceViewPage.razor
+++ /dev/null
@@ -1,121 +0,0 @@
-@*
-// Copyright (C) 2022 FCS Frede's Computer Services.
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
-//
-*@
-
-
-@using Microsoft.AspNetCore.Authorization
-@attribute [Authorize(Roles = "Advisor")]
-@page "/advisor/customers/{CompanyId}/workplaces/{WorkplaceId}"
-
-