diff --git a/Wonky.Client/Components/AdminAdviserCompanyTableComponent.razor b/Wonky.Client/Components/AdminAdviserCompanyTableComponent.razor new file mode 100644 index 00000000..3246eaf6 --- /dev/null +++ b/Wonky.Client/Components/AdminAdviserCompanyTableComponent.razor @@ -0,0 +1,82 @@ +@* +// 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.Client.Components; +@using Wonky.Client.Helpers; + +@if (Companies.Any()) +{ +
+
+
+
+ Besøg +
+
+ Navn +
+
+ Konto +
+
+ Telefon +
+
+ Bynavn +
+
+ +
+
+
+ @foreach (var company in Companies) + { + +
+
+ + +
+
+ @company.Name +
+
+ @company.Account +
+
+ @company.Phone +
+
+ @company.City +
+
+ + +
+
+
+ } +
+} +else +{ + +} \ No newline at end of file diff --git a/Wonky.Client/Components/AdminAdviserCompanyTableComponent.razor.cs b/Wonky.Client/Components/AdminAdviserCompanyTableComponent.razor.cs new file mode 100644 index 00000000..8f6df369 --- /dev/null +++ b/Wonky.Client/Components/AdminAdviserCompanyTableComponent.razor.cs @@ -0,0 +1,54 @@ + +// 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 Blazored.LocalStorage; +using Microsoft.AspNetCore.Components; +using Wonky.Client.Helpers; +using Wonky.Client.Services; +using Wonky.Client.Shared; +using Wonky.Entity.DTO; +using Wonky.Entity.Views; + +namespace Wonky.Client.Components +{ + public partial class AdminAdviserCompanyTableComponent + { + [Parameter] public List Companies { get; set; } = new(); + [Parameter] public EventCallback OnDelete { get; set; } + [Parameter] public EventCallback OnSelect { get; set; } + + private Confirmation _confirmation = new (); + private string _companyId = ""; + private string _actionUrl = ""; + + protected override async Task OnInitializedAsync() + { + await base.OnInitializedAsync(); + } + + private void CallConfirmationModal(string companyId) + { + _companyId = companyId; + _confirmation.Show(); + } + + private async Task DeleteCompany() + { + _confirmation.Hide(); + await OnDelete.InvokeAsync(_companyId); + } + } +} diff --git a/Wonky.Client/Components/AdminAdviserTableComponent.razor b/Wonky.Client/Components/AdminAdviserTableComponent.razor index d17a20e2..8a5d94e1 100644 --- a/Wonky.Client/Components/AdminAdviserTableComponent.razor +++ b/Wonky.Client/Components/AdminAdviserTableComponent.razor @@ -29,12 +29,6 @@ Email - - Land - - - Nr. - @@ -50,10 +44,9 @@ @user.FullName @user.PhoneNumber @user.Email - @user.CountryCode - @user.SalesRep - Rapporter - Rediger + Rapporter + Kunder + Rediger } diff --git a/Wonky.Client/HttpRepository/CompanyHttpRepository.cs b/Wonky.Client/HttpRepository/CompanyHttpRepository.cs index d2eafea6..71334c7a 100644 --- a/Wonky.Client/HttpRepository/CompanyHttpRepository.cs +++ b/Wonky.Client/HttpRepository/CompanyHttpRepository.cs @@ -80,6 +80,31 @@ public class CompanyHttpRepository : ICompanyHttpRepository return pagingResponse; } + public async Task> GetAdminAdviserCompaniesPaged(string userId, CompanyPagingParams pagingParameters) + { + var queryString = new Dictionary + { + ["pageNumber"] = pagingParameters.PageNumber.ToString(), + ["pageSize"] = pagingParameters.PageSize.ToString(), + ["searchTerm"] = pagingParameters.SearchTerm, + ["searchColumn"] = pagingParameters.SearchColumn, + ["orderBy"] = pagingParameters.OrderBy, + ["isHidden"] = pagingParameters.IsHidden.ToString(), + ["hasFolded"] = pagingParameters.HasFolded.ToString() + }; + var response = await _client + .GetAsync(QueryHelpers.AddQueryString($"{_apiConfig.AdminAdviserUri}/{userId}/companies", queryString)); + + var content = await response.Content.ReadAsStringAsync(); + + var pagingResponse = new PagingResponse + { + Items = JsonSerializer.Deserialize>(content, _options), + MetaData = JsonSerializer.Deserialize(response.Headers.GetValues("X-Pagination").First(), _options) + }; + return pagingResponse; + } + public async Task GetCompanyByAccount(string accountNumber) { var company = await _client.GetFromJsonAsync($"{_apiConfig.CompanyUri}/account/{accountNumber}"); diff --git a/Wonky.Client/HttpRepository/ICompanyHttpRepository.cs b/Wonky.Client/HttpRepository/ICompanyHttpRepository.cs index d660a829..8ec4dce6 100644 --- a/Wonky.Client/HttpRepository/ICompanyHttpRepository.cs +++ b/Wonky.Client/HttpRepository/ICompanyHttpRepository.cs @@ -24,6 +24,7 @@ namespace Wonky.Client.HttpRepository; public interface ICompanyHttpRepository { Task> GetCompaniesPaged(CompanyPagingParams pagingParameters); + Task> GetAdminAdviserCompaniesPaged(string userId, CompanyPagingParams pagingParameters); Task GetCompanyByAccount(string accountNumber); Task GetCompanyById(string companyId); Task CreateCompany(CompanyDto model); diff --git a/Wonky.Client/Pages/ActivityToday.razor b/Wonky.Client/Pages/ActivityToday.razor index de643b44..016d3757 100644 --- a/Wonky.Client/Pages/ActivityToday.razor +++ b/Wonky.Client/Pages/ActivityToday.razor @@ -24,7 +24,7 @@
-

@(string.IsNullOrWhiteSpace(_workDate) ? "" : $"{DateTime.Parse(_workDate).ToLongDateString()}")

+

@(string.IsNullOrWhiteSpace(_workDate) ? "" : $"{DateTime.Parse(_workDate).ToLongDateString()}")

diff --git a/Wonky.Client/Pages/ActivityVisitNew.razor b/Wonky.Client/Pages/ActivityVisitNew.razor index a2f27512..545ebb7f 100644 --- a/Wonky.Client/Pages/ActivityVisitNew.razor +++ b/Wonky.Client/Pages/ActivityVisitNew.razor @@ -22,7 +22,7 @@
-
+

@_workDate.ToLongDateString()

diff --git a/Wonky.Client/Pages/AdminAdviserCompanyList.razor b/Wonky.Client/Pages/AdminAdviserCompanyList.razor index 64d10df5..4a4a3a38 100644 --- a/Wonky.Client/Pages/AdminAdviserCompanyList.razor +++ b/Wonky.Client/Pages/AdminAdviserCompanyList.razor @@ -1,10 +1,39 @@ @using Wonky.Client.Components @page "/admin/users/advisers/{CountryCode}/{UserId}/companies" +
-
- +
+
+

@_userInfo.FirstName @_userInfo.LastName Kunder

+
- +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+ +
+
+
+
-
\ No newline at end of file +
diff --git a/Wonky.Client/Pages/AdminAdviserCompanyList.razor.cs b/Wonky.Client/Pages/AdminAdviserCompanyList.razor.cs index 050a24a3..7bc1f8bd 100644 --- a/Wonky.Client/Pages/AdminAdviserCompanyList.razor.cs +++ b/Wonky.Client/Pages/AdminAdviserCompanyList.razor.cs @@ -1,21 +1,94 @@ using Microsoft.AspNetCore.Components; using Wonky.Client.HttpInterceptors; +using Wonky.Client.HttpRepository; using Wonky.Client.Services; using Wonky.Entity.DTO; +using Wonky.Entity.Requests; namespace Wonky.Client.Pages; -public partial class AdminAdviserCompanyList +public partial class AdminAdviserCompanyList : IDisposable { [Parameter] public string UserId { get; set; } = ""; [Parameter] public string CountryCode { get; set; } = ""; [Inject] private ILogger _logger { get; set; } [Inject] private HttpInterceptorService _interceptor { get; set; } - [Inject] private UserPreferenceService _userPrefs { get; set; } - - private readonly List _companyList = new(); - - + [Inject] private UserPreferenceService _preferenceService { get; set; } + [Inject] private ICompanyHttpRepository _companyRepo { get; set; } + [Inject] private IUserHttpRepository _userRepo { get; set; } + private MetaData _metaData { get; set; } = new(); + private CompanyPagingParams _paging = new(); + private Preferences _preferences { get; set; } = new(); + private string _savedSearch { get; set; } = ""; + private UserInfoAdminView _userInfo { get; set; } = new(); + private List _companyList { get; set; } = new(); + protected override async Task OnInitializedAsync() + { + // set preferences + _preferences = await _preferenceService.GetPreferences(); + _paging.OrderBy = _preferences.CompanySort; + _paging.SearchColumn = _preferences.CompanySearch; + _paging.PageSize = Convert.ToInt32(_preferences.PageSize); + + // load saved search + _savedSearch = _preferences.CompanyFilterPhrase; + _paging.SearchTerm = _savedSearch; + + _interceptor.RegisterEvent(); + _interceptor.RegisterBeforeSendEvent(); + + _userInfo = await _userRepo.GetAdviserInfo(UserId); + // get companies + await GetCompanies(); + } + + private async Task GetCompanies() + { + var pagingResponse = await _companyRepo.GetAdminAdviserCompaniesPaged(UserId, _paging); + _companyList = pagingResponse.Items; + _metaData = pagingResponse.MetaData; + } + + private async Task SelectedPage(int page) + { + _companyList = new List(); + _paging.PageNumber = page; + await GetCompanies(); + } + + private async Task SetSearchCol(string searchColumn) + { + _companyList = new List(); + _paging.SearchColumn = searchColumn; + _paging.PageNumber = 1; + await GetCompanies(); + } + private async Task SetPageSize(string pageSize) + { + _companyList = new List(); + _paging.PageSize = Convert.ToInt32(pageSize); + _paging.PageNumber = 1; + await GetCompanies(); + } + + private async Task SetSearchPhrase(string searchTerm) + { + _savedSearch = searchTerm; + await _preferenceService.SetCompanyFilterPhrase(searchTerm); + _companyList = new List(); + _paging.PageNumber = 1; + _paging.SearchTerm = searchTerm; + await GetCompanies(); + } + + private async Task SetSortCol(string orderBy) + { + _companyList = new List(); + _paging.OrderBy = orderBy; + await GetCompanies(); + } + + public void Dispose() => _interceptor.DisposeEvent(); } \ No newline at end of file diff --git a/Wonky.Client/Pages/AdminAdviserLandingPage.razor b/Wonky.Client/Pages/AdminAdviserLandingPage.razor deleted file mode 100644 index 222ae976..00000000 --- a/Wonky.Client/Pages/AdminAdviserLandingPage.razor +++ /dev/null @@ -1,11 +0,0 @@ -@page "/admin/users/advisers" - - - -@code { - -} \ No newline at end of file diff --git a/Wonky.Client/Pages/AdminAdviserUserList.razor b/Wonky.Client/Pages/AdminAdviserUserList.razor index cbedbc49..a414d2ba 100644 --- a/Wonky.Client/Pages/AdminAdviserUserList.razor +++ b/Wonky.Client/Pages/AdminAdviserUserList.razor @@ -4,7 +4,7 @@ @page "/admin/users/advisers/{CountryCode}"
-
+

Sælgere

diff --git a/Wonky.Client/Pages/AdminAdviserView.razor b/Wonky.Client/Pages/AdminAdviserView.razor index e5db3f35..1c618ffd 100644 --- a/Wonky.Client/Pages/AdminAdviserView.razor +++ b/Wonky.Client/Pages/AdminAdviserView.razor @@ -3,7 +3,7 @@ @attribute [Authorize(Roles = "Admin")]
-
+

Sælger info

diff --git a/Wonky.Client/Pages/AdminCompanyList.razor b/Wonky.Client/Pages/AdminCompanyList.razor index b09cde5c..80066d6e 100644 --- a/Wonky.Client/Pages/AdminCompanyList.razor +++ b/Wonky.Client/Pages/AdminCompanyList.razor @@ -1,7 +1,7 @@ @using Wonky.Client.Components @page "/admin/companies"
-
+
Kundeliste
diff --git a/Wonky.Client/Pages/AdminOfficeLandingPage.razor b/Wonky.Client/Pages/AdminOfficeLandingPage.razor deleted file mode 100644 index 89e01a65..00000000 --- a/Wonky.Client/Pages/AdminOfficeLandingPage.razor +++ /dev/null @@ -1,9 +0,0 @@ -@page "/admin/users/office" - -
- Danmark -
- -@code { - -} \ No newline at end of file diff --git a/Wonky.Client/Pages/AdminOfficeList.razor b/Wonky.Client/Pages/AdminOfficeList.razor index 9b40cb90..3c51dc55 100644 --- a/Wonky.Client/Pages/AdminOfficeList.razor +++ b/Wonky.Client/Pages/AdminOfficeList.razor @@ -4,7 +4,7 @@ @page "/admin/users/office/{CountryCode}"
-
+

Admins

diff --git a/Wonky.Client/Pages/AdminOfficeView.razor b/Wonky.Client/Pages/AdminOfficeView.razor index 3de328cd..f6c85646 100644 --- a/Wonky.Client/Pages/AdminOfficeView.razor +++ b/Wonky.Client/Pages/AdminOfficeView.razor @@ -3,7 +3,7 @@ @attribute [Authorize(Roles = "Admin")]
-
+

Sælger info

diff --git a/Wonky.Client/Pages/AdminSalesReportList.razor b/Wonky.Client/Pages/AdminSalesReportList.razor index 39536903..a38a32d0 100644 --- a/Wonky.Client/Pages/AdminSalesReportList.razor +++ b/Wonky.Client/Pages/AdminSalesReportList.razor @@ -19,7 +19,7 @@ @attribute [Authorize(Roles = "Admin")] @page "/admin/users/advisers/{CountryCode}/{UserId}/reports"
-
+

Rapport Arkiv

diff --git a/Wonky.Client/Pages/AdminSalesReportView.razor b/Wonky.Client/Pages/AdminSalesReportView.razor index 1cfb15ca..2bb43488 100644 --- a/Wonky.Client/Pages/AdminSalesReportView.razor +++ b/Wonky.Client/Pages/AdminSalesReportView.razor @@ -23,18 +23,18 @@ @_report.Report.Name
-
+
-
+
@if (!string.IsNullOrWhiteSpace(ReportDate)) { -

@DateTime.Parse(ReportDate).ToLongDateString()

+

@DateTime.Parse(ReportDate).ToLongDateString()

}
-
+
-
+

@_report.Report.Name

diff --git a/Wonky.Client/Pages/CompanyNew.razor b/Wonky.Client/Pages/CompanyNew.razor index 093e9453..201d37ea 100644 --- a/Wonky.Client/Pages/CompanyNew.razor +++ b/Wonky.Client/Pages/CompanyNew.razor @@ -23,7 +23,7 @@

Opret kunde

- +
diff --git a/Wonky.Client/Pages/CompanyView.razor b/Wonky.Client/Pages/CompanyView.razor index cb459716..7c7aad8a 100644 --- a/Wonky.Client/Pages/CompanyView.razor +++ b/Wonky.Client/Pages/CompanyView.razor @@ -25,7 +25,7 @@ @if (!string.IsNullOrWhiteSpace(_company.Name)) {
-
+

@_company.Account - @_company.Name

diff --git a/Wonky.Client/Pages/ItemCatalog.razor b/Wonky.Client/Pages/ItemCatalog.razor index 1594139b..1ecf48f5 100644 --- a/Wonky.Client/Pages/ItemCatalog.razor +++ b/Wonky.Client/Pages/ItemCatalog.razor @@ -15,7 +15,7 @@ // *@ -@page "/Price-Catalog" +@page "/price-catalog" @using Wonky.Client.Components @using Microsoft.AspNetCore.Authorization diff --git a/Wonky.Client/Pages/LandingPageAdminAdvisers.razor b/Wonky.Client/Pages/LandingPageAdminAdvisers.razor new file mode 100644 index 00000000..8a0c9970 --- /dev/null +++ b/Wonky.Client/Pages/LandingPageAdminAdvisers.razor @@ -0,0 +1,20 @@ +@page "/admin/users/advisers" + +
+
+
+

Lande

+
+
+
+ +
+
+ +@code { + +} \ No newline at end of file diff --git a/Wonky.Client/Pages/LandingPageAdminUsers.razor b/Wonky.Client/Pages/LandingPageAdminUsers.razor new file mode 100644 index 00000000..2d80c015 --- /dev/null +++ b/Wonky.Client/Pages/LandingPageAdminUsers.razor @@ -0,0 +1,18 @@ +@page "/admin/users/office" + +
+
+
+

Administrative brugere

+
+
+
+
+ Danmark +
+
+
+ +@code { + +} \ No newline at end of file diff --git a/Wonky.Client/Pages/SalesReportNew.razor b/Wonky.Client/Pages/SalesReportNew.razor index 400ef057..b248747c 100644 --- a/Wonky.Client/Pages/SalesReportNew.razor +++ b/Wonky.Client/Pages/SalesReportNew.razor @@ -22,15 +22,15 @@
-
+
-
-
@(_workDate.ToLongDateString())
+
+

@(_workDate.ToLongDateString())

-
+
-
+
@if (_working) { diff --git a/Wonky.Client/Pages/SalesReportView.razor b/Wonky.Client/Pages/SalesReportView.razor index c45bfa29..1bdc19bd 100644 --- a/Wonky.Client/Pages/SalesReportView.razor +++ b/Wonky.Client/Pages/SalesReportView.razor @@ -25,16 +25,16 @@
-
+
@if (!string.IsNullOrWhiteSpace(ReportDate)) { -

@DateTime.Parse(ReportDate).ToLongDateString()

+

@DateTime.Parse(ReportDate).ToLongDateString()

}
-
+
-
+

@_report.Report.Name

diff --git a/Wonky.Client/Shared/NavMenu.razor b/Wonky.Client/Shared/NavMenu.razor index 7f43719f..5f597944 100644 --- a/Wonky.Client/Shared/NavMenu.razor +++ b/Wonky.Client/Shared/NavMenu.razor @@ -34,23 +34,28 @@ - + - + + @@ -65,23 +70,23 @@
- + @@ -99,4 +104,5 @@ { collapseNavMenu = !collapseNavMenu; } -} + +} \ No newline at end of file diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index 93e0807b..a44d28a5 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,12 +1,12 @@ { "appInfo": { "name": "Wonky Client", - "version": "0.8.63", + "version": "0.8.66", "isBeta": true, "image": "grumpy-coder.png" }, "apiConfig": { - "innoBaseUrl": "https://staging.innotec.dk", + "innoBaseUrl": "https://app.innotec.dk", "glsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=", "glsId": "", "virkUrl": "api/v2/services/virk", diff --git a/Wonky.Client/wwwroot/css/app.css b/Wonky.Client/wwwroot/css/app.css index c0f5d926..d22a2fa2 100644 --- a/Wonky.Client/wwwroot/css/app.css +++ b/Wonky.Client/wwwroot/css/app.css @@ -10,7 +10,6 @@ body { height: 48px; } .workDate { - font-size: 1.25em; font-variant: small-caps; } /* visit / vat state classes */
Virksomhedsopslag