customer lists for country - fix bug with order print

This commit is contained in:
Frede Hundewadt 2023-01-25 11:36:50 +01:00
parent 950c70e05e
commit cbfebdf7fd
10 changed files with 118 additions and 24 deletions

View file

@ -29,9 +29,11 @@
<i class="bi-activity"></i> Sælgere
</a>
</AuthorizeView>
@*
<a class="list-group-item list-group-item-action list-group-item-success" href="/office/customers/dk">
<i class="bi-phone"></i> Tlf.Ordre
<i class="bi-building"></i> Tlf.Ordre
</a>
*@
<a class="list-group-item list-group-item-action list-group-item-info" href="/catalog/dk">
<i class="bi-file-spreadsheet"></i> Priser
</a>
@ -50,9 +52,11 @@
<i class="bi-activity"></i> Sælgere
</a>
</AuthorizeView>
@*
<a class="list-group-item list-group-item-action list-group-item-success" href="/office/customers/no">
<i class="bi-phone"></i> Tlf.Ordre
</a>
*@
<a class="list-group-item list-group-item-action list-group-item-info" href="/catalog/no">
<i class="bi-file-spreadsheet"></i> Priser
</a>
@ -71,9 +75,11 @@
<i class="bi-activity"></i> Sælgere
</a>
</AuthorizeView>
@*
<a class="list-group-item list-group-item-action list-group-item-success" href="/office/customers/se">
<i class="bi-phone"></i> Tlf.Ordre
</a>
*@
<a class="list-group-item list-group-item-action list-group-item-info" href="/catalog/se">
<i class="bi-file-spreadsheet"></i> Priser
</a>

View file

@ -20,6 +20,7 @@
@if (CompanyList.Any())
{
@*
<div class="list-group list-group-flush">
<div class="list-group-item px-3 bg-black text-white opacity-75">
<div class="row">
@ -40,8 +41,39 @@
</div>
</div>
</div>
*@
<div class="row d-flex g-3">
@foreach (var company in CompanyList)
{
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<h5 class="card-title">
@company.Name
</h5>
<div class="row">
<div class="col-sm-3 col-md-3 fw-bold">Konto</div>
<div class="col-sm-3 col-dm-3">@company.Account</div>
<div class="col-sm-3 col-md-3 fw-bold">CVR / ORG</div>
<div class="col-sm-3 col-md-3">@company.VatNumber</div>
</div>
<div class="row">
<div class="col-sm-3 col-md-3 fw-bold">Telefon</div>
<div class="col-sm-3 col-md-3">@company.Phone</div>
</div>
<div class="row">
<div class="col-sm-3 col-md-3 fw-bold">Adresse</div>
<div class="col-sm-9 col-md-9">@company.Address1 @(string.IsNullOrWhiteSpace(company.Address2) ? "" : ",") @company.Address2</div>
</div>
<div class="row">
<div class="col-sm-3 col-md-3 fw-bold">Post By</div>
<div class="col-sm-9 col-md-9">@company.CountryCode.ToUpper()-@company.ZipCode @company.City</div>
</div>
</div>
</div>
</div>
@*
<a class=" list-group-item list-group-item-action" href="/office/customers/@CountryCode/@company.CompanyId/order">
<div class="row align-items-center">
<div class="col-sm-1">
@ -61,6 +93,7 @@
</div>
</div>
</a>
*@
}
</div>
}

View file

@ -35,10 +35,17 @@
<PageSizeComponent OnChanged="SetPageSize" />
</div>
<div class="col-sm-2">
<button type button class="btn btn-warning @(@IncludeFolded ? "active" : "")"
data-bs-toggle="button" aria-pressed="@IncludeFolded" @onclick="OnFoldedClick">
@ButtonFoldedText
</button>
@*
<div class="form-check">
<input type="checkbox" id="folded" class="form-check-input" checked="@IncludeFolded" @onclick="OnFoldedClick" >
<label for="folded" class="form-check-label">Ophørte</label>
</div>
*@
</div>
<div class="col-sm-8">
<PaginationComponent MetaData="PageData" Spread="2" SelectedPage="SelectedPage"/>

View file

@ -43,6 +43,7 @@ namespace Wonky.Client.Pages
private bool Working { get; set; } = true;
private MetaData PageData { get; set; } = new();
private CustomerPaging Paging { get; set; } = new();
private string ButtonFoldedText { get; set; } = "Vis Ophørte";
protected override void OnParametersSet()
{
@ -66,24 +67,26 @@ namespace Wonky.Client.Pages
Paging.SearchTerm = SavedSearch;
// get companies
await FetchCompanies();
await FetchCustomers();
Working = false;
}
private async Task OnFoldedClick()
{
Working = true;
IncludeFolded = !IncludeFolded;
ButtonFoldedText = IncludeFolded ? "Vis Aktive" : "Vis Ophørte";
Companies = new List<CompanyDto>();
Paging.PageNumber = 1;
Paging.HasFolded = IncludeFolded ? 1 : 0;
await FetchCompanies();
await FetchCustomers();
}
private async Task SelectedPage(int page)
{
Companies = new List<CompanyDto>();
Paging.PageNumber = page;
await FetchCompanies();
await FetchCustomers();
}
private async Task SetSearchCol(string searchColumn)
@ -91,14 +94,14 @@ namespace Wonky.Client.Pages
Companies = new List<CompanyDto>();
Paging.SearchColumn = searchColumn;
Paging.PageNumber = 1;
await FetchCompanies();
await FetchCustomers();
}
private async Task SetPageSize(string pageSize)
{
Companies = new List<CompanyDto>();
Paging.PageSize = Convert.ToInt32(pageSize);
Paging.PageNumber = 1;
await FetchCompanies();
await FetchCustomers();
}
private async Task SetSearchPhrase(string searchTerm)
@ -106,14 +109,14 @@ namespace Wonky.Client.Pages
Companies = new List<CompanyDto>();
Paging.PageNumber = 1;
Paging.SearchTerm = searchTerm;
await FetchCompanies();
await FetchCustomers();
}
private async Task SetSortCol(string orderBy)
{
Companies = new List<CompanyDto>();
Paging.OrderBy = orderBy;
await FetchCompanies();
await FetchCustomers();
}
/// <summary>
@ -126,10 +129,10 @@ namespace Wonky.Client.Pages
await CompanyRepo.DeleteCompany(companyId);
if (Paging.PageNumber > 1 && Companies.Count == 1)
Paging.PageNumber--;
await FetchCompanies();
await FetchCustomers();
}
private async Task FetchCompanies()
private async Task FetchCustomers()
{
Working = true;
var pageRes = await CompanyRepo.GetCompanies(Paging);

View file

@ -37,15 +37,27 @@
<PageSizeComponent OnChanged="SetPageSize" />
</div>
<div class="col-sm-2">
<button type button class="btn btn-warning @(@IncludeFolded ? "active" : "")"
data-bs-toggle="button" aria-pressed="@IncludeFolded" @onclick="OnFoldedClick">
@ButtonFoldedText
</button>
@*
<div class="form-check">
<input type="checkbox" id="folded" class="form-check-input" checked="@IncludeFolded" @onclick="OnFoldedClick">
<label for="folded" class="form-check-label">Ophørte</label>
</div>
*@
</div>
<div class="col-sm-8">
<PaginationComponent MetaData="ResponseMeta" Spread="2" SelectedPage="SelectedPage"/>
<PaginationComponent MetaData="PageData" Spread="2" SelectedPage="SelectedPage"/>
</div>
<div class="col-sm-2">
<div class="busy-signal" style="display:@(Working ? "block" : "none")">
<div class="spinner-grow text-info" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
</div>
<div class="col-sm-2"></div>
</div>
</div>

View file

@ -33,7 +33,7 @@ namespace Wonky.Client.Pages
[Parameter] public string CountryCode { get; set; } = "";
[Inject] private ILocalStorageService Storage { get; set; }
[Inject] private UserProfileService ProfileService { get; set; }
[Inject] private ICountryCustomerRepository Customers { get; set; }
[Inject] private ICountryCustomerRepository CustomerRepo { get; set; }
[Inject] private HttpInterceptorService Interceptor { get; set; }
[Inject] private NavigationManager Navigator { get; set; }
private List<CompanyDto> Companies { get; set; } = new();
@ -42,14 +42,17 @@ namespace Wonky.Client.Pages
private string SavedSearch { get; set; } = "";
private bool IncludeFolded { get; set; }
private bool Working { get; set; } = true;
private MetaData ResponseMeta { get; set; } = new();
private MetaData PageData { get; set; } = new();
private CustomerPaging Paging { get; set; } = new();
private string ButtonFoldedText { get; set; } = "Vis Ophørte";
protected override async Task OnParametersSetAsync()
{
Working = true;
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
// set preferences
Prefs = await ProfileService.GetPreferences();
UserInfo = await Storage.GetItemAsync<UserInfoView>("_xu");
@ -64,13 +67,13 @@ namespace Wonky.Client.Pages
// get companies
await FetchCustomers();
Working = false;
}
private async Task OnFoldedClick()
{
Working = true;
IncludeFolded = !IncludeFolded;
ButtonFoldedText = IncludeFolded ? "Vis Aktive" : "Vis Ophørte";
Companies = new List<CompanyDto>();
Paging.PageNumber = 1;
Paging.HasFolded = IncludeFolded ? 1 : 0;
@ -79,6 +82,7 @@ namespace Wonky.Client.Pages
private async Task SelectedPage(int page)
{
Working = true;
Companies = new List<CompanyDto>();
Paging.PageNumber = page;
await FetchCustomers();
@ -86,6 +90,7 @@ namespace Wonky.Client.Pages
private async Task SetSearchCol(string searchColumn)
{
Working = true;
Companies = new List<CompanyDto>();
Paging.SearchColumn = searchColumn;
Paging.PageNumber = 1;
@ -93,6 +98,7 @@ namespace Wonky.Client.Pages
}
private async Task SetPageSize(string pageSize)
{
Working = true;
Companies = new List<CompanyDto>();
Paging.PageSize = Convert.ToInt32(pageSize);
Paging.PageNumber = 1;
@ -101,6 +107,7 @@ namespace Wonky.Client.Pages
private async Task SetSearchPhrase(string searchTerm)
{
Working = true;
Companies = new List<CompanyDto>();
Paging.PageNumber = 1;
Paging.SearchTerm = searchTerm;
@ -109,6 +116,7 @@ namespace Wonky.Client.Pages
private async Task SetSortCol(string orderBy)
{
Working = true;
Companies = new List<CompanyDto>();
Paging.OrderBy = orderBy;
await FetchCustomers();
@ -117,10 +125,18 @@ namespace Wonky.Client.Pages
private async Task FetchCustomers()
{
Working = true;
var pageRes = await Customers.GetCompaniesPaged(CountryCode, Paging);
var response = await CustomerRepo.GetCompaniesPaged(CountryCode, Paging);
Working = false;
Companies = pageRes.Items;
ResponseMeta = pageRes.MetaData;
if (response.Items.Any())
{
Companies = response.Items;
PageData = response.MetaData;
}
else
{
Companies = new List<CompanyDto>();
PageData = new MetaData();
}
}
public void Dispose() => Interceptor.DisposeEvent();

View file

@ -31,9 +31,11 @@
</div>
@if (_reportItem.Express)
{
@*
<div id="watermark">
<i class="bi-lightning-charge text-dark" style="font-size: 11rem;"></i>
</div>
*@
@if (_reportItem.ProcessStatusEnum == "None")
{
<AuthorizeView Roles="Admin,Office,Warehouse">

View file

@ -1,6 +1,6 @@
#watermark {
position: fixed;
z-index: 999;
position: absolute;
z-index: -999;
top: 10px;
right: 0;
}

View file

@ -53,6 +53,21 @@
<i class="bi-people pe-2" style="font-size:1.3em;" aria-hidden="true"></i> Sælgere
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/office/customers/dk">
<i class="bi-building pe-2" style="font-size:1.3em;" aria-hidden="true"></i> Kunder DK
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/office/customers/no">
<i class="bi-building pe-2" style="font-size:1.3em;" aria-hidden="true"></i> Kunder NO
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/office/customers/se">
<i class="bi-building pe-2" style="font-size:1.3em;" aria-hidden="true"></i> Kunder SE
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/warehouse/orders/none">
<i class="bi-box pe-2" style="font-size:1.3em;" aria-hidden="true"></i> Forsendelse

View file

@ -1,14 +1,14 @@
{
"appInfo": {
"name": "Wonky Online",
"version": "0.106.13",
"version": "0.107.3",
"rc": true,
"sandBox": false,
"image": "grumpy-coder.png"
},
"Logging": {
"LogLevel": {
"Default": "Debug",
"Default": "Information",
"System": "Information",
"Microsoft": "Information"
},