refactor office display and landing pages

This commit is contained in:
Frede Hundewadt 2023-01-01 15:46:02 +01:00
parent dd91890b97
commit 3470676699
68 changed files with 550 additions and 584 deletions

View file

@ -38,7 +38,7 @@
@foreach (var activity in ActivityList)
{
<tr>
<td class="align-middle"><a class="btn btn-outline-info text-black d-block" href="/companies/@activity.Company.CompanyId/orders/@activity.ActivityId">@activity.Company.Name</a></td>
<td class="align-middle"><a class="btn btn-outline-info text-black d-block" href="/customers/@activity.Company.CompanyId/orders/@activity.ActivityId">@activity.Company.Name</a></td>
<td class="align-middle">@activity.Company.City</td>
<td class="align-middle">@activity.Demo</td>
<td class="align-middle">@activity.Sales</td>

View file

@ -58,7 +58,7 @@
@company.City
</td>
<td class="align-middle">
<ActivityButton CompanyId="@company.CompanyId" ActionLink="/companies/$ID$/activities/new"
<ActivityButton CompanyId="@company.CompanyId" ActionLink="/customers/$ID$/activities/new"
ButtonText="Besøg" ButtonType="primary" Enabled="@company.ValidVat"/>
</td>
</tr>

View file

@ -43,7 +43,7 @@ namespace Wonky.Client.Components
private void ViewCustomer(string companyId)
{
Navigator.NavigateTo($"/companies/{companyId}");
Navigator.NavigateTo($"/customers/{companyId}");
}
private void CallInformationModal(string info)

View file

@ -23,16 +23,16 @@
<div class="list-group list-group-flush">
<div class="list-group-item px-3 bg-black text-white opacity-75">
<div class="row">
<div class="col-md-1">
<div class="col-sm-1">
Sælger
</div>
<div class="col-md-1">
<div class="col-sm-1">
Konto
</div>
<div class="col-md-2">
<div class="col-sm-1">
Telefon
</div>
<div class="col">
<div class="col-sm-3">
Navn
</div>
<div class="col">
@ -42,18 +42,18 @@
</div>
@foreach (var company in CompanyList)
{
<a class=" list-group-item list-group-item-action" href="/office/customers/@company.CompanyId/orders/new">
<a class=" list-group-item list-group-item-action" href="/office/customers/@CountryCode/@company.CompanyId/view">
<div class="row align-items-center">
<div class="col-md-1">
<div class="col-sm-1">
@company.SalesRep
</div>
<div class="col-md-1">
<div class="col-sm-1">
@company.Account
</div>
<div class="col-md-2">
<div class="col-sm-1">
@company.Phone
</div>
<div class="col">
<div class="col-sm-3">
@company.Name
</div>
<div class="col">

View file

@ -26,7 +26,8 @@ namespace Wonky.Client.Components
{
public partial class CountryCustomerListComponent
{
[Parameter] public List<CompanyDto> CompanyList { get; set; } = new();
[Parameter] public List<CompanyDto> CompanyList { get; set; } = new();
[Parameter] public string CountryCode { get; set; } = "";
}
}

View file

@ -18,29 +18,38 @@
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Components
<div class="row g-3">
<div class="col-sm-3">
<div class="card" style="width: 10rem;">
<img src="flag-icons/flags/4x3/dk.svg" alt="Danmark"/>
<div class="card-body">
<a class="btn btn-primary d-block" href="/office/dk">Danmark</a>
</div>
</div>
<div class="card m-3" style="width: 400px">
<div class="card-body">
<h4 class="card-title">
Danmark
</h4>
<p class="card-text">
Kunder, Prisliste
</p>
<a class="btn btn-lg btn-primary d-block" href="/office/country/dk"> Danmark ....</a>
</div>
<div class="col-sm-3">
<div class="card" style="width: 10rem;">
<img src="flag-icons/flags/4x3/no.svg" alt="Norge"/>
<div class="card-body">
<a class="btn btn-primary d-block" href="/office/no">Norge</a>
</div>
</div>
</div>
<div class="card m-3" style="width: 400px">
<div class="card-body">
<h4 class="card-title">
Norge
</h4>
<p class="card-text">
Kunder, Prisliste
</p>
<a class="btn btn-lg btn-primary d-block" href="/office/country/no"> Norge ....</a>
</div>
<div class="col-sm-3">
<div class="card" style="width: 10rem;">
<img src="flag-icons/flags/4x3/se.svg" alt="Sverige"/>
<div class="card-body">
<a class="btn btn-primary d-block" href="/office/se">Sverige</a>
</div>
</div>
</div>
<div class="card m-3" style="width: 400px">
<div class="card-body">
<h4 class="card-title">
Sverige
</h4>
<p class="card-text">
Kunder, Prisliste
</p>
<a class="btn btn-lg btn-primary d-block" href="/office/country/s"> Sverige ....</a>
</div>
</div>
</div>

View file

@ -44,13 +44,20 @@ public partial class LandingComponentAdmin
private string WorkDate { get; set; } = $"{DateTime.Now:yyyy-MM-dd}";
private string Today { get; set; } = $"{DateTime.Now:yyyy-MM-dd}";
protected override async Task OnInitializedAsync()
{
ProfileService.OnChange += ProfileChanged;
Prefs = await ProfileService.GetPreferences();
if(!string.IsNullOrWhiteSpace(Prefs.WorkDate))
WorkDate = Prefs.WorkDate;
if (string.IsNullOrWhiteSpace(Prefs.WorkDate))
{
await ProfileService.SetWorkDate(DateTime.Now);
}
}
private void ProfileChanged(UserPref newPrefs)
{
Prefs = newPrefs;
WorkDate = Prefs.WorkDate;
}
}

View file

@ -1,6 +0,0 @@
.workDate {
font-size: 1.2em;
font-weight: bold;
font-variant: small-caps;
}

View file

@ -64,7 +64,7 @@
</div>
<div class="col-sm-2 text-center">
<a class="btn btn-outline-dark d-block" style="font-family:monospace;font-size: 14px;"
href="/companies/@quote.Company.CompanyId/quotes/@quote.ActivityId">@quote.ESalesNumber</a>
href="/customers/@quote.Company.CompanyId/quotes/@quote.ActivityId">@quote.ESalesNumber</a>
</div>
@if (!string.IsNullOrWhiteSpace(quote.OfficeNote))
{

View file

@ -64,7 +64,7 @@
<td class="align-middle">
@if (task.TaskTypeEnum is "Recall")
{
<a class="btn btn-light border-dark pe-3 me-2" href="/companies/@task.ReferenceId">
<a class="btn btn-light border-dark pe-3 me-2" href="/customers/@task.ReferenceId">
<i class="oi oi-pencil"></i>
</a>
}

View file

@ -1,3 +1,4 @@
@using Wonky.Client.Models
@*
// Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
@ -15,101 +16,86 @@
//
*@
<div class="row mb-3">
<div class="col-sm-4">
<div class="btn-group" role="group" aria-label="Ordre status">
<input type="radio" class="btn-check" name="btn-order" id="btn-order1" autocomplete="off" checked @onchange="@GetOrderStatusNone"/>
<label class="btn btn-success" for="btn-order1">Ubehandlet</label>
@if (OrderList != null)
{
<div class="row mb-3">
<div class="col-sm-4">
<div class="btn-group" role="group" aria-label="Ordre status">
<input type="radio" class="btn-check" name="btn-order" id="btn-order1" @onchange="() => GetWithStatus(PStatus.None)" autocomplete="off" checked="checked"/>
<label class="btn btn-success" for="btn-order1">Ubehandlet</label>
<input type="radio" class="btn-check" name="btn-order" id="btn-order2" autocomplete="off" @onchange="@GetOrderStatusPicked"/>
<label class="btn btn-warning" for="btn-order2">Plukket</label>
<input type="radio" class="btn-check" name="btn-order" id="btn-order2" @onchange="() => GetWithStatus(PStatus.Picked)" autocomplete="off"/>
<label class="btn btn-warning" for="btn-order2">Plukket</label>
<input type="radio" class="btn-check" name="btn-order" id="btn-order3" autocomplete="off" @onchange="@GetOrderStatusPacked"/>
<label class="btn btn-danger" for="btn-order3">Pakket</label>
</div>
</div>
<div class="col-sm-4 text-end">
<label class="btn btn-outline-dark position-relative">
@Header
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">@OrderList.Count</span>
<span class="visually-hidden">ordrer i listen</span>
</label>
</div>
<div class="col-sm-4 text-end">
@if (ReadyToShip && OrderList.Any())
{
<button type="button" class="btn btn-primary text-sm-center" @onclick="SetAllPackedStatusToShipped">Sæt alle afsendt</button>
}
</div>
</div>
<div class="list-group list-group-flush">
<div class="list-group-item">
<div class="row mb-1">
<div class="col-md-2">
<h4>Ordredato</h4>
</div>
<div class="col-md-4">
<h4>Kundenavn</h4>
</div>
<div class="col-md-3">
<h4>Postnr. Bynavn</h4>
</div>
<div class="col-md-1 text-center">
<h4>
<i class="oi oi-flash"></i>
</h4>
</div>
<div class="col-md-2">
<h4>Status</h4>
<input type="radio" class="btn-check" name="btn-order" id="btn-order3" @onchange="() => GetWithStatus(PStatus.Packed)" autocomplete="off"/>
<label class="btn btn-danger" for="btn-order3">Pakket</label>
</div>
</div>
<div class="col-sm-4 text-end">
<label class="btn btn-outline-dark position-relative">
@Header
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-info">@Orders.Count</span>
<span class="visually-hidden">ordrer i listen</span>
</label>
</div>
<div class="col-sm-4 text-end">
@if (ReadyToShip && Orders.Any())
{
<button type="button" class="btn btn-primary text-sm-center" @onclick="SetShipStatus">Sæt alle afsendt</button>
}
</div>
</div>
@if (OrderList.Any())
{
@foreach (var order in OrderList)
<div class="list-group list-group-flush">
<div class="list-group-item">
<div class="row">
<div class="col-sm-4">
<h4>Modtager</h4>
</div>
<div class="col-sm-3">
<h5>Post By</h5>
</div>
<div class="col-sm-2">
<h5>Dato</h5>
</div>
<div class="col-sm-3 text-end">
<h5><i class="bi-lightning-fill"></i> Status</h5>
</div>
</div>
</div>
@foreach (var order in Orders)
{
<a class="list-group-item list-group-item-action" href="warehouse/orders/process/@order.OrderId">
<div class="list-group-item list-group-item-action" style="cursor: hand;">
<div class="row">
<div class="col-md-2">
@order.OrderDate
</div>
<div class="col-md-4">
<div class="col-sm-4">
@order.Company.Name
</div>
<div class="col-md-3">
<div class="col-sm-3">
@order.Company.ZipCode @order.Company.City
</div>
<div class="col-md-1 text-center">
<div class="col-sm-2">
@order.OrderDate
</div>
<div class="col-sm-3 d-flex">
@if (order.Express)
{
<i class="oi oi-flash"></i>
<i class="bi-lightning-fill text-warning"></i>
}
</div>
<div class="col-md-2">
@switch (order.ProcessStatusEnum.ToLower())
{
case "none":
<span>Ubehandlet</span>
<button class="btn btn-outline-danger me-4" @onclick="() => QuickPak(order.OrderId)">QuickPak</button>
<a class="btn btn-warning" href="warehouse/orders/process/@order.OrderId">Pluk varer</a>
break;
case "picked":
<span>Plukket</span>
<a class="btn btn-warning" href="warehouse/orders/process/@order.OrderId">Pak varer</a>
break;
case "packed":
<span>Pakket</span>
break;
case "shipped":
<span>Afsendt</span>
<a class="btn btn-warning" href="warehouse/orders/process/@order.OrderId">Afhent varer</a>
break;
}
</div>
</div>
</a>
</div>
}
}
else
{
<div>
Flot klaret - bordet er ryddet
</div>
}
</div>
</div>
}

View file

@ -13,131 +13,43 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
using System.Text.Json;
using Blazored.Toast.Services;
using Microsoft.AspNetCore.Components;
using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpInterfaces;
using Wonky.Client.HttpRepository;
using Wonky.Client.Models;
using Wonky.Entity.Views;
namespace Wonky.Client.Components;
public partial class WarehouseListComponent
{
[Parameter] public string Status { get; set; } = "none";
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IWarehouseRepository WarehouseRepo { get; set; }
[Inject] public IToastService Toaster { get; set; }
private string ItemList { get; set; } = "";
private bool ReadyToShip;
private string Header = "Ubehandlet";
[Parameter] public string Header { get; set; } = "";
[Parameter] public List<WarehouseOrderView>? OrderList { get; set; }
[Parameter] public bool ReadyToShip { get; set; }
[Parameter] public EventCallback<PStatus> OnGetStatus { get; set; }
[Parameter] public EventCallback OnSetShipped { get; set; }
[Parameter] public EventCallback<string> OnQPak { get; set; }
private List<WarehouseOrderView> OrderList { get; set; }
private bool Working { get; set; } = true;
private List<WarehouseOrderView> Orders { get; set; } = new();
protected override async Task OnInitializedAsync()
protected override async Task OnParametersSetAsync()
{
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
switch (Status.ToLower())
{
case "none":
Header = "Ubehandlede ordrer";
await GetOrderStatusNone();
break;
case "picked":
Header = "Plukkede ordrer";
await GetOrderStatusPicked();
break;
case "packed":
Header = "Pakkede ordrer";
await GetOrderStatusPacked();
break;
case "shipped":
Header = "Afsendte ordrer";
await GetOrderStatusShipped();
break;
default:
await GetOrderStatusNone();
break;
}
}
private async Task GetOrderStatusNone()
{
Working = true;
OrderList = new List<WarehouseOrderView>();
Header = "Ubehandlede ordrer";
ReadyToShip = false;
Working = true;
OrderList = new List<WarehouseOrderView>();
OrderList = await WarehouseRepo.GetWarehouseOrderListByStatus("none");
if(OrderList.Any(x => x.Express))
OrderList = OrderList.OrderByDescending(x => x.Express).ToList();
Working = false;
}
private async Task GetOrderStatusPicked()
{
Working = true;
OrderList = new List<WarehouseOrderView>();
Header = "Plukkede ordrer";
ReadyToShip = false;
Working = true;
OrderList = new List<WarehouseOrderView>();
OrderList = await WarehouseRepo.GetWarehouseOrderListByStatus("picked");
Working = false;
}
private async Task GetOrderStatusPacked()
{
Working = true;
OrderList = new List<WarehouseOrderView>();
Header = "Pakkede ordrer";
Working = true;
OrderList = new List<WarehouseOrderView>();
OrderList = await WarehouseRepo.GetWarehouseOrderListByStatus("packed");
ReadyToShip = true;
Working = false;
}
private async Task GetOrderStatusShipped()
{
Working = true;
OrderList = new List<WarehouseOrderView>();
Header = "Afsendte ordrer";
ReadyToShip = false;
Toaster.ShowWarning("Det kan tage lidt tid at hente alle.\nVent venligst.\nMåske skal vi tænke over hvor mange vi henter?");
Working = true;
OrderList = new List<WarehouseOrderView>();
var orderList = await WarehouseRepo.GetWarehouseOrderListByStatus("shipped");
OrderList = orderList.OrderByDescending(x => x.OrderDate).ToList();
Toaster.ShowInfo("Her er de så ....");
Working = false;
while (OrderList == null)
await Task.Delay(500);
Orders = OrderList;
}
private async Task SetAllPackedStatusToShipped()
private async Task SetShipStatus()
{
Working = true;
foreach (var order in OrderList.Where(order => order.ProcessStatusEnum.ToLower() == "packed"))
{
order.ProcessStatusEnum = "shipped";
var process = new WarehouseProcess
{
OrderId = order.OrderId,
ProcessStatusEnum = "shipped"
};
await WarehouseRepo.UpdateWarehouseOrderStatus(process);
}
Working = false;
await OnSetShipped.InvokeAsync();
}
public void Dispose()
private async Task GetWithStatus(PStatus status)
{
Interceptor.DisposeEvent();
await OnGetStatus.InvokeAsync(status);
}
private async Task QuickPak(string orderId)
{
await OnQPak.InvokeAsync(orderId);
}
}

View file

@ -14,7 +14,7 @@
</div>
@foreach (var workplace in Workplaces)
{
<a class="list-group-item list-group-item-action" href="/companies/@CompanyId/workplaces/@workplace.WorkplaceId">
<a class="list-group-item list-group-item-action" href="/customers/@CompanyId/workplaces/@workplace.WorkplaceId">
<div class="row">
<div class="col">
@workplace.Name

View file

@ -75,7 +75,16 @@ public static class Utils
{
return value.ToString();
}
/// <summary>
/// Parse string to enum of T
/// </summary>
/// <param name="value"></param>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public static T StringToEnum<T>(string value)
{
return (T)Enum.Parse(typeof(T), value, true);
}
/// <summary>
/// Generate unique hashcode from time
/// </summary>

View file

@ -28,29 +28,33 @@ public interface ICountryCustomerRepository
/// Get customers paged for given country
/// </summary>
/// <param name="paging"></param>
/// <param name="countryCode"></param>
/// <returns></returns>
Task<PagingResponse<CompanyDto>> GetCompaniesPaged(CustomerPaging paging);
Task<PagingResponse<CompanyDto>> GetCompaniesPaged(string countryCode, CustomerPaging paging);
/// <summary>
/// Get customers paged for given sales rep
/// </summary>
/// <param name="countryCode"></param>
/// <param name="salesRepId"></param>
/// <param name="paging"></param>
/// <returns></returns>
Task<PagingResponse<CompanyDto>> GetCompaniesPagedSalesRep(string salesRepId, CustomerPaging paging);
Task<PagingResponse<CompanyDto>> GetCompaniesPaged(string countryCode, string salesRepId, CustomerPaging paging);
/// <summary>
/// Get customer by Id
/// </summary>
/// <param name="countryCode"></param>
/// <param name="companyId"></param>
/// <returns></returns>
Task<CompanyDto> GetByCustomerId(string companyId);
Task<CompanyDto> GetByCustomerId(string countryCode, string companyId);
/// <summary>
/// Update Company data
/// </summary>
/// <param name="countryCode"></param>
/// <param name="companyId"></param>
/// <param name="model"></param>
/// <returns></returns>
Task<bool> UpdateCompany(string companyId, CompanyDto model);
Task<bool> UpdateCompany(string countryCode, string companyId, CompanyDto model);
}

View file

@ -68,7 +68,6 @@ public class AdvisorCatalogRepository : IAdvisorCatalogRepository
["searchColumn"] = pagingParameters.SearchColumn,
["searchTerm"] = pagingParameters.SearchTerm,
["selectGroup"] = pagingParameters.SelectGroup == "0" ? "" : pagingParameters.SelectGroup,
["countryCode"] = pagingParameters.CountryCode
};
var response = await _client
.GetAsync(QueryHelpers.AddQueryString($"{_apiConfig.Catalog}/page", queryString));
@ -108,7 +107,6 @@ public class AdvisorCatalogRepository : IAdvisorCatalogRepository
["searchColumn"] = pagingParameters.SearchColumn,
["searchTerm"] = pagingParameters.SearchTerm,
["selectGroup"] = pagingParameters.SelectGroup == "0" ? "" : pagingParameters.SelectGroup,
["countryCode"] = pagingParameters.CountryCode
};
var response = await _client
.GetAsync(QueryHelpers.AddQueryString($"{_apiConfig.Catalog}/{countryCode}/page", queryString));

View file

@ -68,8 +68,7 @@ public class CountryCatalogRepository : ICountryCatalogRepository
["orderBy"] = paging.OrderBy,
["searchColumn"] = paging.SearchColumn,
["searchTerm"] = paging.SearchTerm,
["selectGroup"] = paging.SelectGroup == "0" ? "" : paging.SelectGroup,
["countryCode"] = countryCode
["selectGroup"] = paging.SelectGroup == "0" ? "" : paging.SelectGroup
};
var response = await _client
.GetAsync(QueryHelpers.AddQueryString($"{_apiConfig.Catalog}/country/{countryCode}/page", queryString));

View file

@ -61,8 +61,9 @@ public class CountryCustomerRepository : ICountryCustomerRepository
/// Get customers paged for given sales rep
/// </summary>
/// <param name="paging"></param>
/// <param name="countryCode"></param>
/// <returns></returns>
public async Task<PagingResponse<CompanyDto>> GetCompaniesPaged(CustomerPaging paging)
public async Task<PagingResponse<CompanyDto>> GetCompaniesPaged(string countryCode, CustomerPaging paging)
{
var queryString = new Dictionary<string, string>
{
@ -73,10 +74,9 @@ public class CountryCustomerRepository : ICountryCustomerRepository
["orderBy"] = paging.OrderBy,
["isHidden"] = paging.IsHidden.ToString(),
["hasFolded"] = paging.HasFolded.ToString(),
["countryCode"] = paging.CountryCode
};
var response = await _client.GetAsync(QueryHelpers.AddQueryString($"{_api.OfficeCustomers}", queryString));
var response = await _client.GetAsync(QueryHelpers.AddQueryString($"{_api.OfficeCustomers}/{countryCode}", queryString));
var content = await response.Content.ReadAsStringAsync();
var pagingResponse = new PagingResponse<CompanyDto>
@ -86,14 +86,16 @@ public class CountryCustomerRepository : ICountryCustomerRepository
};
return pagingResponse;
}
/// <summary>
/// Get customers paged for given sales rep
/// </summary>
/// <param name="countryCode"></param>
/// <param name="salesRepId"></param>
/// <param name="paging"></param>
/// <returns></returns>
public async Task<PagingResponse<CompanyDto>> GetCompaniesPagedSalesRep(string salesRepId, CustomerPaging paging)
public async Task<PagingResponse<CompanyDto>> GetCompaniesPaged(string countryCode, string salesRepId,
CustomerPaging paging)
{
var queryString = new Dictionary<string, string>
{
@ -104,7 +106,6 @@ public class CountryCustomerRepository : ICountryCustomerRepository
["orderBy"] = paging.OrderBy,
["isHidden"] = paging.IsHidden.ToString(),
["hasFolded"] = paging.HasFolded.ToString(),
["countryCode"] = paging.CountryCode
};
var response = await _client.GetAsync(QueryHelpers.AddQueryString($"{_api.OfficeCustomers}/salesRep/{salesRepId}/", queryString));
@ -116,25 +117,28 @@ public class CountryCustomerRepository : ICountryCustomerRepository
};
return pagingResponse;
}
}
/// <summary>
/// Get customer entity by id
/// </summary>
/// <param name="countryCode"></param>
/// <param name="companyId"></param>
/// <returns></returns>
public async Task<CompanyDto> GetByCustomerId(string companyId)
public async Task<CompanyDto> GetByCustomerId(string countryCode, string companyId)
{
var company = await _client.GetFromJsonAsync<CompanyDto>($"{_api.OfficeCustomers}/id/{companyId}");
return company ?? new CompanyDto();
}
/// <summary>
/// Update Company data
/// </summary>
/// <param name="countryCode"></param>
/// <param name="companyId"></param>
/// <param name="model"></param>
/// <returns></returns>
public async Task<bool> UpdateCompany(string companyId, CompanyDto model)
public async Task<bool> UpdateCompany(string countryCode, string companyId, CompanyDto model)
{
var response = await _client.PutAsJsonAsync($"{_api.OfficeCustomers}/{companyId}", model);
var content = await response.Content.ReadAsStringAsync();

View file

@ -0,0 +1,11 @@
namespace Wonky.Client.Models;
public enum PStatus
{
None,
Picked,
Packed,
Shipped,
All,
Express
}

View file

@ -47,8 +47,6 @@ public partial class AdvisorCatalogPage : IDisposable
Prefs = await ProfileService.GetPreferences();
UserInfo = await Storage.GetItemAsync<UserInfoView>("_xu");
_page.CountryCode = UserInfo.CountryCode;
_page.OrderBy = Prefs.ItemSort;
_page.SearchColumn = Prefs.ItemSearch;
_page.PageSize = Convert.ToInt32(Prefs.PageSize);

View file

@ -18,7 +18,7 @@
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Components
@attribute [Authorize(Roles = "Advisor")]
@page "/companies/{CompanyId}/activities/new"
@page "/customers/{CompanyId}/activities/new"
<div class="row bg-dark text-white rounded-2 mb-2 py-2 align-items-center">
<div class="col">
@ -314,7 +314,7 @@ else
</EditForm>
<div class="row mt-5 mb-2">
<div class="col-sm-6">
<a class="btn btn-warning" href="/companies/@Company.CompanyId">Kundekort <i class="bi-arrow-left"></i></a>
<a class="btn btn-warning" href="/customers/@Company.CompanyId">Kundekort <i class="bi-arrow-left"></i></a>
</div>
<div class="col-sm-4 text-end">
<button type="button" class="btn btn-warning" @onclick="CallConfirmProductCheckModel" disabled="@(PoFormInvalid || Working)">Opret besøg <i class="bi-plus"></i></button>

View file

@ -370,7 +370,7 @@ public partial class AdvisorCreateActivityPage : IDisposable
Toast.ShowSuccess($"{result.Message}",
DraftProvider.Draft.Items.Count == 0 ? "Besøg er oprettet" : "Bestilling/Tilbud er oprettet");
await DeleteDraft();
Navigator.NavigateTo($"/companies");
Navigator.NavigateTo($"/customers");
return;
}
// lower working flag

View file

@ -15,7 +15,7 @@
//
*@
@page "/companies/new"
@page "/customers/new"
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Components
@using System.Xml

View file

@ -177,7 +177,7 @@ namespace Wonky.Client.Pages
if (!string.IsNullOrWhiteSpace(newId))
{
Toaster.ShowSuccess($"'{Company.Name}' er oprettet i CRM.");
Navigator.NavigateTo($"/companies/{newId}");
Navigator.NavigateTo($"/customers/{newId}");
}
else
{

View file

@ -18,7 +18,7 @@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Advisor")]
@page "/companies/{CompanyId}/activities"
@page "/customers/{CompanyId}/activities"
@if (!string.IsNullOrWhiteSpace(Company.Name))
{
@ -27,10 +27,10 @@
<h4 class="pt-1">@Company.Name</h4>
</div>
<div class="col-sm-3 align-content-end">
<a class="btn btn-primary d-block" href="/companies/@Company.CompanyId"><i class="bi-arrow-right"></i> Kundekort</a>
<a class="btn btn-primary d-block" href="/customers/@Company.CompanyId"><i class="bi-arrow-right"></i> Kundekort</a>
</div>
<div class="col-sm-3 align-content-end">
<a class="btn btn-primary d-block" href="/companies/@Company.CompanyId/activities/new"><i class="bi-arrow-right"></i> Besøg</a>
<a class="btn btn-primary d-block" href="/customers/@Company.CompanyId/activities/new"><i class="bi-arrow-right"></i> Besøg</a>
</div>
</div>

View file

@ -17,7 +17,7 @@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@page "/companies/{CompanyId}/h/i"
@page "/customers/{CompanyId}/h/i"
@attribute [Authorize(Roles = "Advisor")]
<div class="row pt-2 pb-1 rounded-2 bg-dark text-white">
@ -25,10 +25,10 @@
<h4 class="pt-1">@Company.Name</h4>
</div>
<div class="col-sm-3 align-content-end">
<a class="btn btn-primary d-block" href="/companies/@Company.CompanyId"><i class="bi-arrow-left"></i> Kundekort</a>
<a class="btn btn-primary d-block" href="/customers/@Company.CompanyId"><i class="bi-arrow-left"></i> Kundekort</a>
</div>
<div class="col-sm-3 align-content-end">
<a class="btn btn-primary d-block" href="/companies/@Company.CompanyId/activities/new"><i class="bi-arrow-right"></i> Nyt Besøg</a>
<a class="btn btn-primary d-block" href="/customers/@Company.CompanyId/activities/new"><i class="bi-arrow-right"></i> Nyt Besøg</a>
</div>
</div>

View file

@ -16,7 +16,7 @@
*@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@page "/companies/{CompanyId}/invoices"
@page "/customers/{CompanyId}/invoices"
@attribute [Authorize(Roles = "Advisor")]
@if (!string.IsNullOrWhiteSpace(Company.Name))
@ -26,10 +26,10 @@
<h4 class="pt-1">@Company.Name</h4>
</div>
<div class="col-sm-3 align-content-end">
<a class="btn btn-primary d-block" href="/companies/@Company.CompanyId"><i class="bi-arrow-right"></i> Kundekort</a>
<a class="btn btn-primary d-block" href="/customers/@Company.CompanyId"><i class="bi-arrow-right"></i> Kundekort</a>
</div>
<div class="col-sm-3 align-content-end">
<a class="btn btn-primary d-block" href="/companies/@Company.CompanyId/activities/new"><i class="bi-arrow-right"></i> Besøg</a>
<a class="btn btn-primary d-block" href="/customers/@Company.CompanyId/activities/new"><i class="bi-arrow-right"></i> Besøg</a>
</div>
</div>
<CustomerInvoiceListComponent OnShowInvoice="CallInvoiceModal" CompanyId="@CompanyId" InvoiceList="@CompanyInvoices.Invoices"/>

View file

@ -17,7 +17,7 @@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@page "/companies"
@page "/customers"
@attribute [Authorize(Roles = "Advisor")]
<div class="sticky-top bg-dark text-light rounded-2 px-3">
@ -44,7 +44,7 @@
<PaginationComponent MetaData="PageData" Spread="2" SelectedPage="SelectedPage"/>
</div>
<div class="col-sm-2 text-end">
<a class="btn btn-success text-nowrap" href="/companies/new">Opret kunde <i class="bi-plus"></i></a>
<a class="btn btn-success text-nowrap" href="/customers/new">Opret kunde <i class="bi-plus"></i></a>
</div>
</div>
</div>

View file

@ -60,8 +60,7 @@ namespace Wonky.Client.Pages
Paging.SearchColumn = Prefs.CompanySearch;
Paging.PageSize = Convert.ToInt32(Prefs.PageSize);
Paging.HasFolded = IncludeFolded ? 1 : 0;
Paging.CountryCode = UserInfo.CountryCode;
// load saved search
SavedSearch = string.IsNullOrWhiteSpace(Prefs.CompanyFilterPhrase) ? "" : Prefs.CompanyFilterPhrase;
Paging.SearchTerm = SavedSearch;

View file

@ -19,7 +19,7 @@
@using Microsoft.AspNetCore.Components
@using Wonky.Client.Components
@attribute [Authorize(Roles = "Advisor")]
@page "/companies/{CompanyId}"
@page "/customers/{CompanyId}"
@if (!string.IsNullOrWhiteSpace(Company.Account))
@ -128,13 +128,13 @@
@* activity buttons *@
<div class="row mt-3 mb-3">
<div class="col-sm-3">
<a class="btn btn-danger d-block" href="/companies/@Company.CompanyId/invoices">Faktura</a>
<a class="btn btn-danger d-block" href="/customers/@Company.CompanyId/invoices">Faktura</a>
</div>
<div class="col-sm-3">
<a class="btn btn-warning d-block" href="/companies/@Company.CompanyId/activities">Tidl. Besøg</a>
<a class="btn btn-warning d-block" href="/customers/@Company.CompanyId/activities">Tidl. Besøg</a>
</div>
<div class="col-sm-3">
<a class="btn btn-success d-block" href="/companies/@Company.CompanyId/h/i">Produkter</a>
<a class="btn btn-success d-block" href="/customers/@Company.CompanyId/h/i">Produkter</a>
</div>
<div class="col-sm-3">
<ActivityButton ActionLink="@ActionLink"

View file

@ -115,7 +115,7 @@ public partial class AdvisorCustomerViewPage : IDisposable
// display urgency of next visit
VisitState = Utils.GetVisitState($"{NextVisit:yyyy-MM-dd}");
// action link passed to activity button component
ActionLink = $"/companies/{CompanyId}/activities/new"; // used when drawing visit button
ActionLink = $"/customers/{CompanyId}/activities/new"; // used when drawing visit button
// handle company out of business case
if(Company.HasFolded == 1)
{

View file

@ -18,7 +18,7 @@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Models
@attribute [Authorize(Roles = "Advisor,Admin,Supervisor")]
@attribute [Authorize(Roles = "Advisor,Admin")]
@page "/sales-reports/view/{ReportDate}"
<div class="row bg-dark text-white rounded-2 mb-2 py-2 align-items-center d-print-none">

View file

@ -19,8 +19,8 @@
@using Wonky.Client.Components
@attribute [Authorize(Roles = "Admin,Advisor,Warehouse")]
@page "/companies/{CompanyId}/orders/{OrderId}"
@page "/companies/{CompanyId}/quotes/{OrderId}"
@page "/customers/{CompanyId}/orders/{OrderId}"
@page "/customers/{CompanyId}/quotes/{OrderId}"
@* <ReportItemComponent ReportItem="@_item" /> *@

View file

@ -17,8 +17,8 @@
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Components
@attribute [Authorize(Roles = "Admin,Warehouse,Office")]
@page "/companies/{CompanyId}/workplaces/{WorkplaceId}/documents"
@attribute [Authorize(Roles = "Advisor")]
@page "/customers/{CompanyId}/workplaces/{WorkplaceId}/documents"
<h2>Dokumenter</h2>

View file

@ -18,7 +18,7 @@
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Components
@attribute [Authorize(Roles = "Advisor")]
@page "/companies/{CompanyId}/workplaces"
@page "/customers/{CompanyId}/workplaces"
<div class="row bg-light border border-1 rounded-2">
<div class="col">

View file

@ -19,7 +19,7 @@
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Components
@attribute [Authorize(Roles = "Advisor")]
@page "/companies/{CompanyId}/workplaces/{WorkplaceId}"
@page "/customers/{CompanyId}/workplaces/{WorkplaceId}"
<div class="card">
<div class="card-header">
@ -114,7 +114,7 @@
<button type="submit" class="btn btn-success">Gem</button>
</div>
<div class="col-md-4">
<a class="btn btn-primary" href="/companies/@CompanyId/workplaces/@WorkplaceId/documents">Dokumenter</a>
<a class="btn btn-primary" href="/customers/@CompanyId/workplaces/@WorkplaceId/documents">Dokumenter</a>
</div>
</div>
</EditForm>

View file

@ -62,7 +62,7 @@ public partial class AdvisorWorkplaceViewPage : IDisposable
{
Working = true;
await WorkplaceCrmRepo.DeleteWorkplace(CompanyId, _workplace.WorkplaceId);
_navigator.NavigateTo($"/companies/{CompanyId}/workplaces");
_navigator.NavigateTo($"/customers/{CompanyId}/workplaces");
}
public void Dispose()

View file

@ -18,7 +18,7 @@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Admin,Warehouse")]
@page "/price-catalog/{CountryCode}"
@page "/office/catalog/{CountryCode}"
<div class="sticky-top bg-dark rounded-2 px-3">

View file

@ -26,7 +26,7 @@ namespace Wonky.Client.Pages;
public partial class CountryCatalogPage : IDisposable
{
[Inject] public ILocalStorageService Storage { get; set; }
[Inject] public IAdvisorCatalogRepository ItemRepo { get; set; }
[Inject] public ICountryCatalogRepository Catalog { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public UserProfileService ProfileService { get; set; }
@ -43,14 +43,11 @@ public partial class CountryCatalogPage : IDisposable
{
Prefs = await ProfileService.GetPreferences();
UserInfo = await Storage.GetItemAsync<UserInfoView>("_xu");
Paging.CountryCode = UserInfo.CountryCode;
Paging.OrderBy = Prefs.ItemSort;
Paging.SearchColumn = Prefs.ItemSearch;
Paging.PageSize = Convert.ToInt32(Prefs.PageSize);
Paging.CountryCode = CountryCode.ToLower();
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
@ -106,13 +103,12 @@ public partial class CountryCatalogPage : IDisposable
private async Task FetchSalesItems()
{
Working = true;
var pagingResponse = await ItemRepo.GetSalesItemsPaged(Paging);
var pagingResponse = await Catalog.GetSalesItemsPaged(CountryCode, Paging);
Working = false;
Items = pagingResponse.Items!;
MetaInfo = pagingResponse.MetaData;
MetaInfo = pagingResponse.MetaData!;
}
public void Dispose() => Interceptor.DisposeEvent();
}

View file

@ -18,9 +18,7 @@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Admin,Warehouse")]
@page "/office/{countryCode}/customers"
@page "/office/customers/{countryCode}"
<div class="sticky-top bg-dark text-light rounded-2 px-3">
<div class="row g-3">
@ -43,12 +41,14 @@
</div>
</div>
<div class="col-sm-8">
<PaginationComponent MetaData="PageData" Spread="2" SelectedPage="SelectedPage"/>
<PaginationComponent MetaData="ResponseMeta" Spread="2" SelectedPage="SelectedPage"/>
</div>
<div class="col-sm-2"></div>
</div>
</div>
<CountryCustomerListComponent CompanyList="Companies" CountryCode="@CountryCode" />
@if (Working)
{
<WorkingThreeDots />

View file

@ -33,7 +33,7 @@ namespace Wonky.Client.Pages
[Parameter] public string CountryCode { get; set; } = "";
[Inject] public ILocalStorageService Storage { get; set; }
[Inject] public UserProfileService ProfileService { get; set; }
[Inject] public ICountryCustomerRepository CompanyRepo { get; set; }
[Inject] public ICountryCustomerRepository Customers { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
private List<CompanyDto> Companies { get; set; } = new();
@ -42,13 +42,14 @@ namespace Wonky.Client.Pages
private string SavedSearch { get; set; } = "";
private bool IncludeFolded { get; set; }
private bool Working { get; set; } = true;
private MetaData PageData { get; set; } = new();
private MetaData ResponseMeta { get; set; } = new();
private CustomerPaging Paging { get; set; } = new();
protected override async Task OnParametersSetAsync()
{
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
// set preferences
Prefs = await ProfileService.GetPreferences();
UserInfo = await Storage.GetItemAsync<UserInfoView>("_xu");
@ -56,8 +57,7 @@ namespace Wonky.Client.Pages
Paging.SearchColumn = Prefs.CompanySearch;
Paging.PageSize = Convert.ToInt32(Prefs.PageSize);
Paging.HasFolded = IncludeFolded ? 1 : 0;
Paging.CountryCode = CountryCode.ToLower();
// load saved search
SavedSearch = string.IsNullOrWhiteSpace(Prefs.CompanyFilterPhrase) ? "" : Prefs.CompanyFilterPhrase;
Paging.SearchTerm = SavedSearch;
@ -117,18 +117,10 @@ namespace Wonky.Client.Pages
private async Task FetchCustomers()
{
Working = true;
var pageRes = await CompanyRepo.GetCompaniesPaged(Paging);
var pageRes = await Customers.GetCompaniesPaged(CountryCode, Paging);
Working = false;
if (pageRes.Items.Any())
{
Companies = pageRes.Items;
PageData = pageRes.MetaData;
}
else
{
Companies = new List<CompanyDto>();
PageData = new MetaData();
}
Companies = pageRes.Items;
ResponseMeta = pageRes.MetaData;
}
public void Dispose() => Interceptor.DisposeEvent();

View file

@ -0,0 +1,28 @@
@*
// 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 Microsoft.AspNetCore.Components
@using Wonky.Client.Components
@attribute [Authorize(Roles = "Admin,Warehouse")]
@page "/office/customers/{CountryCode}/{CompanyId}/view"
<div class="row">
<div class="col">
<h3>Data for @CountryCode.ToUpper() Id '@CompanyId' er ikke klar</h3>
</div>
</div>

View file

@ -13,37 +13,26 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
using System;
using System.Threading.Tasks;
using System.Text.Json;
using System.Text.RegularExpressions;
using Blazored.LocalStorage;
using Blazored.Toast.Services;
using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpRepository;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms;
using Wonky.Client.Helpers;
using Wonky.Client.HttpInterfaces;
using Wonky.Client.Models;
using Wonky.Client.Services;
using Wonky.Client.Shared;
using Wonky.Entity.DTO;
using Wonky.Entity.Models;
using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class KrvItemViewAdminPage : IDisposable
public partial class CountryCustomerViewPage
{
[Parameter] public string SalesItemId { get; set; } = "";
private SalesItemView _item { get; set; } = new ();
[Inject] public IAdvisorCatalogRepository _itemRepo { get; set; }
[Inject] public HttpInterceptorService _interceptor { get; set; }
protected override async Task OnInitializedAsync()
{
_interceptor.RegisterEvent();
_interceptor.RegisterBeforeSendEvent();
_item = await _itemRepo.GetSalesVariantId(SalesItemId);
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
_interceptor!.DisposeEvent();
}
[Parameter] public string CompanyId { get; set; } = "";
[Parameter] public string CountryCode { get; set; } = "";
}

View file

@ -17,48 +17,41 @@
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Admin,Warehouse")]
@page "/office/{CountryCode}"
@page "/office/country/{CountryCode}"
<div class="row g-3">
<AuthorizeView Roles="Admin,Office">
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<h4 class="card-title">
@CountryCode.ToUpper() Sælgere
</h4>
<p class="card-text">
Sælger kundeliste, Rapporter, Stamdata
</p>
<a class="btn btn-primary d-block" href="/office/users/advisors/@CountryCode"> Sælgere</a>
</div>
</div>
</div>
</AuthorizeView>
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<h4 class="card-title">
@CountryCode.ToUpper() Kunder
</h4>
<p class="card-text">
Filtrer og søg kunder
</p>
<a class="btn btn-primary d-block" href="/office/@CountryCode/customers"> Kundeliste</a>
</div>
<AuthorizeView Roles="Admin,Office">
<div class="card m-3" style="width: 400px">
<div class="card-body">
<h4 class="card-title">
@CountryCode.ToUpper() Sælgere
</h4>
<p class="card-text">
Sælger kundeliste, Rapporter, Stamdata
</p>
<a class="btn btn-lg btn-primary d-block" href="/office/users/advisors/@CountryCode"> Sælgere</a>
</div>
</div>
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<h4 class="card-title">
@CountryCode.ToUpper() Priskatalog
</h4>
<p class="card-text">
Produkter og priser
</p>
<a class="btn btn-primary d-block" href="/price-catalog/@CountryCode"> Priskatalog</a>
</div>
</div>
</AuthorizeView>
<div class="card m-3" style="width: 400px">
<div class="card-body">
<h4 class="card-title">
@CountryCode.ToUpper() Kunder
</h4>
<p class="card-text">
Filtrer og søg kunder
</p>
<a class="btn btn-lg btn-primary d-block" href="/office/customers/@CountryCode"> Kundeliste</a>
</div>
</div>
<div class="card m-3" style="width: 400px">
<div class="card-body">
<h4 class="card-title">
@CountryCode.ToUpper() Priskatalog
</h4>
<p class="card-text">
Produkter og priser
</p>
<a class="btn btn-lg btn-primary d-block" href="/office/catalog/@CountryCode"> Priskatalog</a>
</div>
</div>

View file

@ -39,20 +39,20 @@
<div class="row mb-2">
<div class="col-3">
<div class="form-check">
<input type="checkbox" id="folded" class="form-check-input" checked="@_includeFolded" @onclick="OnFoldedClick" >
<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-6">
<PaginationComponent MetaData="_metaData" Spread="2" SelectedPage="SelectedPage"/>
<PaginationComponent MetaData="ResponseMeta" Spread="2" SelectedPage="SelectedPage"/>
</div>
<div class="col-3 justify-content-end">
<a class="btn btn-success text-nowrap" href="/companies/new">Opret kunde</a>
<a class="btn btn-success text-nowrap" href="/customers/new">Opret kunde</a>
</div>
</div>
</div>
</div>
<CountryCustomerListComponent CompanyList="_companyList" />
<CountryCustomerListComponent CompanyList="CompanyList" />
@if (Working)

View file

@ -26,17 +26,15 @@ public partial class CountrySalesRepCustomerListPage : IDisposable
{
[Parameter] public string UserId { get; set; } = "";
[Parameter] public string CountryCode { get; set; } = "dk";
[Inject] public ILogger<CountrySalesRepCustomerListPage> Logger { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public ICountryCustomerRepository CustomerRepo { get; set; }
[Inject] public UserProfileService UserProfileService { get; set; }
private List<CompanyDto> _companyList { get; set; } = new();
private MetaData _metaData { get; set; } = new();
private CustomerPaging _paging = new();
private List<CompanyDto> CompanyList { get; set; } = new();
private MetaData ResponseMeta { get; set; } = new();
private CustomerPaging Paging = new();
private UserPref UserPref { get; set; } = new();
private string _savedSearch { get; set; } = "";
private bool _includeFolded { get; set; }
private string SavedSearch { get; set; } = "";
private bool IncludeFolded { get; set; }
private bool Working { get; set; } = true;
protected override async Task OnParametersSetAsync()
@ -46,15 +44,14 @@ public partial class CountrySalesRepCustomerListPage : IDisposable
// set preferences
UserPref = await UserProfileService.GetPreferences();
_paging.CountryCode = CountryCode.ToLower();
_paging.OrderBy = UserPref.CompanySort;
_paging.SearchColumn = UserPref.CompanySearch;
_paging.PageSize = Convert.ToInt32(UserPref.PageSize);
_paging.HasFolded = _includeFolded ? 1 : 0;
Paging.OrderBy = UserPref.CompanySort;
Paging.SearchColumn = UserPref.CompanySearch;
Paging.PageSize = Convert.ToInt32(UserPref.PageSize);
Paging.HasFolded = IncludeFolded ? 1 : 0;
// load saved search
_savedSearch = UserPref.CompanyFilterPhrase;
_paging.SearchTerm = _savedSearch;
SavedSearch = UserPref.CompanyFilterPhrase;
Paging.SearchTerm = SavedSearch;
await FetchCompanies();
Working = false;
@ -62,33 +59,33 @@ public partial class CountrySalesRepCustomerListPage : IDisposable
private async Task OnFoldedClick()
{
_includeFolded = !_includeFolded;
_companyList = new List<CompanyDto>();
_paging.PageNumber = 1;
_paging.HasFolded = _includeFolded ? 1 : 0;
IncludeFolded = !IncludeFolded;
CompanyList = new List<CompanyDto>();
Paging.PageNumber = 1;
Paging.HasFolded = IncludeFolded ? 1 : 0;
await FetchCompanies();
}
private async Task SelectedPage(int page)
{
_companyList = new List<CompanyDto>();
_paging.PageNumber = page;
CompanyList = new List<CompanyDto>();
Paging.PageNumber = page;
await FetchCompanies();
}
private async Task SetSearchCol(string searchColumn)
{
_companyList = new List<CompanyDto>();
_paging.SearchColumn = searchColumn;
_paging.PageNumber = 1;
CompanyList = new List<CompanyDto>();
Paging.SearchColumn = searchColumn;
Paging.PageNumber = 1;
await FetchCompanies();
}
private async Task SetPageSize(string pageSize)
{
_companyList = new List<CompanyDto>();
_paging.PageSize = Convert.ToInt32(pageSize);
_paging.PageNumber = 1;
CompanyList = new List<CompanyDto>();
Paging.PageSize = Convert.ToInt32(pageSize);
Paging.PageNumber = 1;
await FetchCompanies();
}
@ -96,30 +93,30 @@ public partial class CountrySalesRepCustomerListPage : IDisposable
{
// if (!string.IsNullOrWhiteSpace(searchTerm) && searchTerm.Length < 3) return;
_companyList = new List<CompanyDto>();
_paging.PageNumber = 1;
_paging.SearchTerm = searchTerm;
CompanyList = new List<CompanyDto>();
Paging.PageNumber = 1;
Paging.SearchTerm = searchTerm;
await FetchCompanies();
if (!string.IsNullOrWhiteSpace(searchTerm) && searchTerm.TrimEnd().Length > 2)
{
_savedSearch = searchTerm;
SavedSearch = searchTerm;
await UserProfileService.SetCompanyFilterPhrase(searchTerm.Trim());
}
}
private async Task SetSortCol(string orderBy)
{
_companyList = new List<CompanyDto>();
_paging.OrderBy = orderBy;
CompanyList = new List<CompanyDto>();
Paging.OrderBy = orderBy;
await FetchCompanies();
}
private async Task FetchCompanies()
{
Working = true;
var pagingResponse = await CustomerRepo.GetCompaniesPagedSalesRep(UserId, _paging);
_companyList = pagingResponse.Items;
_metaData = pagingResponse.MetaData;
var pagingResponse = await CustomerRepo.GetCompaniesPaged(CountryCode, UserId, Paging);
CompanyList = pagingResponse.Items;
ResponseMeta = pagingResponse.MetaData;
Working = false;
}

View file

@ -1,68 +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]
//
*@
@page "/sales-item/{salesItemId}"
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Advisor,Admin")]
<div class="card">
<div class="card-header">
<h1>@_item.Name</h1>
</div>
<div class="card-body">
<table class="table table-striped table-bordered">
<tbody>
<tr>
<th scope="row">Navn</th>
<td>@_item.Name</td>
</tr>
<tr>
<th scope="row">Varenr</th>
<td>@_item.Sku</td>
</tr>
<tr>
<th scope="row"></th>
<td>@_item.ProductGroup</td>
</tr>
<tr>
<th scope="row">Kort Navn</th>
<td>@_item.ShortName</td>
</tr>
</tbody>
</table>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th scope="col" rowspan="2">Priser</th>
</tr>
</thead>
<tbody>
@foreach (var rate in _item.Rates)
{
<tr>
<th scope="row">@rate.Quantity</th>
<td>@rate.Rate</td>
</tr>
}
</tbody>
</table>
</div>
<div class="card-footer">
<a href="/krvVariants" class="btn btn-success">Tilbage</a>
</div>
</div>

View file

@ -1,10 +0,0 @@
/* item image preview */
.image-name {
margin-left: 10px;
}
.image-preview {
width: auto;
max-width: 200px;
height: 100px;
margin-top: 15px;
}

View file

@ -17,7 +17,7 @@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Admin,Advisor,Office,Warehouse")]
@attribute [Authorize(Roles = "Admin,Advisor,Warehouse")]
@page "/print/catalog"
<CatalogPrintComponent ItemList="Items" CountryName="@UserInfo.CountryName" />

View file

@ -29,7 +29,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class SsystemPrintCatalogPage : IDisposable
public partial class PrintCatalogPage : IDisposable
{
[Inject] public ILocalStorageService Storage { get; set; }
[Inject] public IAdvisorCatalogRepository ItemRepo { get; set; }

View file

@ -17,7 +17,7 @@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Admin,Advisor,Office")]
@attribute [Authorize(Roles = "Admin,Advisor")]
@page "/print/report/{CountryCode}/{UserId}/{ReportDate}"
<div class="row mb-3 d-print-none">

View file

@ -22,7 +22,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class SystemPrintFrontPage
public partial class PrintFrontPage
{
[Parameter] public string CountryCode { get; set; } = "";
[Parameter] public string UserId { get; set; } = "";
@ -30,7 +30,7 @@ public partial class SystemPrintFrontPage
[Inject] public ILocalStorageService Storage { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
[Inject] private IJSRuntime JSRuntime { get; set; }
[Inject] public ILogger<SystemPrintFrontPage> Logger { get; set; }
[Inject] public ILogger<PrintFrontPage> Logger { get; set; }
private ReportView Report { get; set; } = new();
private IJSObjectReference JsModule { get; set; }
private string ReturnUrl { get; set; } = "";

View file

@ -17,7 +17,7 @@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Admin,Advisor,Office")]
@attribute [Authorize(Roles = "Admin,Advisor")]
@page "/print/orders/{CountryCode}/{UserId}/{ReportDate}"
<div class="row mb-3 d-print-none">

View file

@ -21,7 +21,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class SystemPrintOrderPage
public partial class PrintOrderPage
{
[Parameter] public string CountryCode { get; set; } = "";
[Parameter] public string UserId { get; set; } = "";
@ -29,7 +29,7 @@ public partial class SystemPrintOrderPage
[Inject] public ILocalStorageService Storage { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
[Inject] private IJSRuntime JSRuntime { get; set; }
[Inject] public ILogger<SystemPrintOrderPage> Logger { get; set; }
[Inject] public ILogger<PrintOrderPage> Logger { get; set; }
private ReportView Report { get; set; } = new();
private List<ReportItemView> Items { get; set; } = new();
private IJSObjectReference JsModule { get; set; }

View file

@ -17,7 +17,20 @@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Admin,Warehouse,Office")]
@attribute [Authorize(Roles = "Admin,Warehouse")]
@page "/warehouse/orders/{Status}"
<WarehouseListComponent Status="@Status" />
<div class="row">
<div class="col">
<h2>Forsendelser</h2>
</div>
<div class="col">
<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>
<WarehouseListComponent Header="@Header" OrderList="@OrderList" ReadyToShip="@ReadyToShip"
OnGetStatus="GetStatusCallback" OnSetShipped="@SetShippedCallback" OnQPak="QPakCallback"/>

View file

@ -1,8 +1,108 @@
using Microsoft.AspNetCore.Components;
using Wonky.Client.Helpers;
using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpInterfaces;
using Wonky.Client.Models;
using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class WarehouseOrderListPage
public partial class WarehouseOrderListPage : IDisposable
{
[Parameter] public string Status { get; set; } = "none";
[Parameter] public string Status { get; set; } = "none";
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IWarehouseRepository WarehouseRepo { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
private List<WarehouseOrderView> OrderList { get; set; }
private bool Working { get; set; } = true;
private string Header { get; set; } = "Ubehandlet";
private bool ReadyToShip { get; set; }
protected override async Task OnParametersSetAsync()
{
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
OrderList = await FetchOrders(Status);
}
private async Task GetStatusCallback(PStatus status)
{
Working = true;
OrderList = new List<WarehouseOrderView>();
switch (status)
{
case PStatus.None:
Header = "Ubehandlede ordrer";
ReadyToShip = false;
break;
case PStatus.Picked:
Header = "Plukkede ordrer";
ReadyToShip = false;
break;
case PStatus.Packed:
Header = "Pakkede ordrer";
ReadyToShip = true;
break;
case PStatus.Shipped:
break;
case PStatus.All:
break;
case PStatus.Express:
break;
default:
throw new ArgumentOutOfRangeException(nameof(status), status, null);
}
Status = Utils.EnumToString(status).ToLower();
OrderList = await FetchOrders(Status);
Working = false;
}
/// <summary>
/// QPak - quick mark an order as shipped
/// </summary>
/// <param name="orderId"></param>
private async Task QPakCallback(string orderId)
{
Working = true;
var order = OrderList.First(x => x.OrderId == orderId);
order.ProcessStatusEnum = "packed";
var process = new WarehouseProcess
{
OrderId = order.OrderId,
ProcessStatusEnum = "packed"
};
await WarehouseRepo.UpdateWarehouseOrderStatus(process);
OrderList.Remove(order);
Working = false;
}
/// <summary>
/// Set status shipped where status is packed
/// </summary>
private async Task SetShippedCallback()
{
Working = true;
foreach (var order in OrderList.Where(order => order.ProcessStatusEnum.ToLower() == "packed"))
{
order.ProcessStatusEnum = "shipped";
var process = new WarehouseProcess
{
OrderId = order.OrderId,
ProcessStatusEnum = "shipped"
};
await WarehouseRepo.UpdateWarehouseOrderStatus(process);
}
Working = false;
}
private async Task<List<WarehouseOrderView>> FetchOrders(string status)
{
Working = true;
var orderList = await WarehouseRepo.GetWarehouseOrderListByStatus(status.ToLower());
if(orderList.Any(x => x.Express))
orderList = orderList.OrderByDescending(x => x.Express).ToList();
Working = false;
return orderList;
}
public void Dispose() => Interceptor.DisposeEvent();
}

View file

@ -17,53 +17,53 @@
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Components
@attribute [Authorize(Roles = "Admin,Warehouse,Office")]
@attribute [Authorize(Roles = "Admin,Warehouse")]
@page "/warehouse/orders/process/{OrderId}"
@if (!string.IsNullOrWhiteSpace(_order.OrderDate))
@if (!string.IsNullOrWhiteSpace(Order.OrderDate))
{
<table class="table">
<thead>
<tr>
<th colspan="4">
@if (_order.Express)
@if (Order.Express)
{
<h2 class="text-center fw-bold">HASTE ORDRE</h2>
}
<h2 class="text-center">@_order.Company.Name</h2>
<h2 class="text-center">@Order.Company.Name</h2>
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Konto</th>
<td>@_order.Company.Account</td>
<td>@Order.Company.Account</td>
<th scope="row">Telefon</th>
<td>@_order.Company.Phone</td>
<td>@Order.Company.Phone</td>
</tr>
<tr>
<th scope="row">Kunde</th>
<td>@_order.Company.Name</td>
<td>@Order.Company.Name</td>
<th scope="row">Lev.Navn</th>
<td>@_order.DlvName</td>
<td>@Order.DlvName</td>
</tr>
<tr>
<th scope="row">Adresse</th>
<td>@_order.Company.Address1</td>
<td>@Order.Company.Address1</td>
<th scope="row">Lev.Adresse</th>
<td>@_order.DlvAddress1</td>
<td>@Order.DlvAddress1</td>
</tr>
<tr>
<th scope="row">Adresse</th>
<td>@_order.Company.Address2</td>
<td>@Order.Company.Address2</td>
<th scope="row">Lev.Adresse</th>
<td>@_order.DlvAddress2</td>
<td>@Order.DlvAddress2</td>
</tr>
<tr>
<th scope="row">Postnr By</th>
<td>@_order.Company.ZipCode @_order.Company.City</td>
<td>@Order.Company.ZipCode @Order.Company.City</td>
<th scope="row">Lev.Postnr By</th>
<td>@_order.DlvZipCity</td>
<td>@Order.DlvZipCity</td>
</tr>
</tbody>
</table>
@ -77,7 +77,7 @@
</tr>
</thead>
<tbody>
@foreach (var line in _order.Lines)
@foreach (var line in Order.Lines)
{
<tr>
<td class="fw-bold">@line.Location</td>
@ -93,10 +93,10 @@
}
</tbody>
</table>
@if (!string.IsNullOrWhiteSpace(_order.OfficeNote))
@if (!string.IsNullOrWhiteSpace(Order.OfficeNote))
{
<div class="alert bg-light border-dark border-2">
<h3 class="text-center">@_order.OfficeNote</h3>
<h3 class="text-center">@Order.OfficeNote</h3>
</div>
}
<div class="row">
@ -106,15 +106,15 @@
<div class="col-md-3">
</div>
<div class="col-md-4">
@if (_order.ProcessStatusEnum.ToLower() == "none")
@if (Order.ProcessStatusEnum.ToLower() == "none")
{
<button class="btn btn-lg btn-warning text-nowrap" type="button" @onclick="SetProcessStatusPicked" disabled="@Working">Sæt status plukket</button>
}
@if (_order.ProcessStatusEnum.ToLower() == "picked")
@if (Order.ProcessStatusEnum.ToLower() == "picked")
{
<button class="btn btn-lg btn-danger text-nowrap" type="button" @onclick="SetProcessStatusPacked" disabled="@Working">Sæt status pakket</button>
}
@if (_order.ProcessStatusEnum.ToLower() == "packed")
@if (Order.ProcessStatusEnum.ToLower() == "packed")
{
<button class="btn btn-lg btn-primary text-nowrap" type="button" @onclick="SetProcessStatusShipped" disabled="@Working">Sæt status afsendt</button>
}

View file

@ -28,63 +28,71 @@ namespace Wonky.Client.Pages;
public partial class WarehouseOrderViewPage : IDisposable
{
[Parameter] public string OrderId { get; set; } = "";
[Inject] public HttpInterceptorService _interceptor { get; set; }
[Inject] public IWarehouseRepository _warehouseRepo { get; set; }
[Inject] public NavigationManager _navigator { get; set; }
[Inject] public IToastService _toast { get; set; }
[Inject] public ILogger<WarehouseOrderViewPage> _logger { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IWarehouseRepository WarehouseRepo { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public IToastService Toast { get; set; }
[Inject] public ILogger<WarehouseOrderViewPage> Logger { get; set; }
private WarehouseOrderView _order { get; set; } = new();
private bool Working { get; set; }
private WarehouseOrderView Order { get; set; } = new();
private bool Working { get; set; } = true;
protected override async Task OnParametersSetAsync()
{
_interceptor.RegisterEvent();
_interceptor.RegisterBeforeSendEvent();
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
if (!string.IsNullOrWhiteSpace(OrderId))
_order = await _warehouseRepo.GetWarehouseOrder(OrderId);
Order = await WarehouseRepo.GetWarehouseOrder(OrderId);
_logger.LogDebug("Warehouse OrderView =>\n{}", JsonSerializer.Serialize(_order));
Logger.LogDebug("Warehouse OrderView =>\n{}", JsonSerializer.Serialize(Order));
Working = false;
}
private async Task SetProcessStatusPicked()
{
if (Working)
return;
Working = true;
var process = new WarehouseProcess
{
OrderId = _order.OrderId,
OrderId = Order.OrderId,
ProcessStatusEnum = "picked"
};
await _warehouseRepo.UpdateWarehouseOrderStatus(process);
_navigator.NavigateTo("/warehouse/orders/none");
await WarehouseRepo.UpdateWarehouseOrderStatus(process);
Navigator.NavigateTo("/warehouse/orders/none");
}
private async Task SetProcessStatusPacked()
{
if (Working)
return;
Working = true;
var process = new WarehouseProcess
{
OrderId = _order.OrderId,
OrderId = Order.OrderId,
ProcessStatusEnum = "packed"
};
await _warehouseRepo.UpdateWarehouseOrderStatus(process);
_navigator.NavigateTo("/warehouse/orders/picked");
await WarehouseRepo.UpdateWarehouseOrderStatus(process);
Navigator.NavigateTo("/warehouse/orders/picked");
}
private async Task SetProcessStatusShipped()
{
if (Working)
return;
Working = true;
var process = new WarehouseProcess
{
OrderId = _order.OrderId,
OrderId = Order.OrderId,
ProcessStatusEnum = "shipped"
};
await _warehouseRepo.UpdateWarehouseOrderStatus(process);
_navigator.NavigateTo("/warehouse/orders/none");
await WarehouseRepo.UpdateWarehouseOrderStatus(process);
Navigator.NavigateTo("/warehouse/orders/none");
}
public void Dispose()
{
_interceptor.DisposeEvent();
Interceptor.DisposeEvent();
}
}

View file

@ -31,6 +31,7 @@ public partial class InformationModal
StateHasChanged();
}
// ReSharper disable once MemberCanBePrivate.Global
public void Hide()
{
_modalDisplay = "none;";

View file

@ -29,7 +29,7 @@ public partial class InventoryReorderModal
{
[Parameter] public string CompanyId { get; set; } = "";
[Parameter] public SalesItemView SalesItem { get; set; } = new();
[Inject] public ICustomerHistoryRepository CustomerHistoryCrmRepo { get; set; }
[Inject] public ICustomerHistoryRepository HistoryRepo { get; set; }
[Parameter] public EventCallback<DraftItem> OnSelected { get; set; }
private List<ProductHistoryView>? History { get; set; } = new();
private DraftItem SelectedItem { get; set; } = new();
@ -43,7 +43,7 @@ public partial class InventoryReorderModal
if (string.IsNullOrWhiteSpace(SalesItem.Sku))
return;
History = await CustomerHistoryCrmRepo.FetchHistory(CompanyId, SalesItem.Sku);
History = await HistoryRepo.FetchHistory(CompanyId, SalesItem.Sku);
if (!History.Any())
await Task.Delay(1000);
SelectedItem.Item = SalesItem;

View file

@ -44,19 +44,19 @@
</NotAuthorized>
</AuthorizeView>
<AuthorizeView Roles="Admin,Office,Warehouse">
<AuthorizeView Roles="Admin,Warehouse">
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/office/dk">
<NavLink class="nav-link ps-2" href="/office/country/dk">
<i class="bi-people pe-2" style="font-size:1.3em;" aria-hidden="true"></i> Danmark
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/office/no">
<NavLink class="nav-link ps-2" href="/office/country/no">
<i class="bi-file-spreadsheet pe-2" style="font-size:1.3em;" aria-hidden="true"></i> Norge
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/office/se">
<NavLink class="nav-link ps-2" href="/office/country/se">
<i class="bi-file-spreadsheet pe-2" style="font-size:1.3em;" aria-hidden="true"></i> Sverige
</NavLink>
</div>
@ -75,7 +75,7 @@
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/companies">
<NavLink class="nav-link ps-2" href="/customers">
<i class="bi-building pe-2" style="font-size:1.3em;" aria-hidden="true"></i> Firmaer
</NavLink>
</div>

View file

@ -41,7 +41,7 @@
</div>
<div class="row mb-2">
<div class="col-sm-12">
<PaginationComponent MetaData="_metaData" Spread="2" SelectedPage="SelectedPage" />
<PaginationComponent MetaData="ResponseMeta" Spread="2" SelectedPage="SelectedPage" />
</div>
</div>
<div class="row text-white">
@ -53,10 +53,10 @@
</div>
</div>
@if (_items.Any())
@if (Items.Any())
{
<ul class="list-group list-group-flush">
@foreach (var item in _items)
@foreach (var item in Items)
{
<li class="list-group-item">
<div class="row align-middle">

View file

@ -28,21 +28,20 @@ public partial class PriceListModal : IDisposable
{
[Parameter] public string CountryCode { get; set; } = "dk";
[Parameter] public EventCallback<SelectedSku> OnSelected { get; set; }
[Inject] public IAdvisorCatalogRepository ItemRepo { get; set; }
[Inject] public IAdvisorCatalogRepository Catalog { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public UserProfileService UserProfileService { get; set; }
[Inject] public UserProfileService ProfileService { get; set; }
private string _modalDisplay = "";
private bool _showBackdrop;
private List<SalesItemView> _items { get; set; } = new();
private MetaData? _metaData { get; set; } = new();
private List<SalesItemView> Items { get; set; } = new();
private MetaData? ResponseMeta { get; set; } = new();
private CatalogPaging _paging = new();
private UserPref _userPref = new();
protected override async Task OnInitializedAsync()
{
_userPref = await UserProfileService.GetPreferences();
_paging.CountryCode = CountryCode;
_userPref = await ProfileService.GetPreferences();
_paging.OrderBy = _userPref.ItemSort;
_paging.SearchColumn = _userPref.ItemSearch;
_paging.PageSize = Convert.ToInt32(_userPref.PageSize);
@ -59,13 +58,13 @@ public partial class PriceListModal : IDisposable
private async Task SelectedPage(int page)
{
_items = new List<SalesItemView>();
Items = new List<SalesItemView>();
_paging.PageNumber = page;
await GetSalesItems();
}
private async Task SetSearchPhrase(string searchTerm)
{
_items = new List<SalesItemView>();
Items = new List<SalesItemView>();
_paging.PageNumber = 1;
_paging.SearchTerm = searchTerm;
await GetSalesItems();
@ -73,14 +72,14 @@ public partial class PriceListModal : IDisposable
private async Task GetSalesItems()
{
var pagingResponse = await ItemRepo.GetSalesItemsPaged(_paging);
_items = pagingResponse.Items!;
_metaData = pagingResponse.MetaData;
var pagingResponse = await Catalog.GetSalesItemsPaged(_paging);
Items = pagingResponse.Items!;
ResponseMeta = pagingResponse.MetaData;
}
private async Task SetPageSize(string pageSize)
{
_items = new List<SalesItemView>();
Items = new List<SalesItemView>();
_paging.PageSize = Convert.ToInt32(pageSize);
_paging.PageNumber = 1;
await GetSalesItems();
@ -88,7 +87,7 @@ public partial class PriceListModal : IDisposable
private async Task SetSearchCol(string columnName)
{
_items = new List<SalesItemView>();
Items = new List<SalesItemView>();
_paging.PageNumber = 1;
_paging.SearchColumn = columnName;
await GetSalesItems();
@ -96,7 +95,7 @@ public partial class PriceListModal : IDisposable
private async Task SetSortCol(string orderBy)
{
_items = new List<SalesItemView>();
Items = new List<SalesItemView>();
_paging.OrderBy = orderBy;
await GetSalesItems();
}

View file

@ -29,7 +29,7 @@ public partial class ProductHistoryModal
// [Parameter] public EventCallback<decimal> OnSelected { get; set; }
[Parameter] public string CompanyId { get; set; } = "";
[Parameter] public string ItemSku { get; set; } = "";
[Inject] public ICustomerHistoryRepository CustomerHistoryCrmRepo { get; set; }
[Inject] public ICustomerHistoryRepository HistoryRepo { get; set; }
private List<ProductHistoryView>? History { get; set; }
private string ProductName { get; set; } = "";
private string _modalDisplay = "";
@ -37,7 +37,7 @@ public partial class ProductHistoryModal
protected override async Task OnParametersSetAsync()
{
History = await CustomerHistoryCrmRepo.FetchHistory(CompanyId, ItemSku);
History = await HistoryRepo.FetchHistory(CompanyId, ItemSku);
if (History.Any())
{
ProductName = History[0].Description;

View file

@ -29,7 +29,7 @@ public partial class ProductPriceHistoryModal
[Parameter] public EventCallback<decimal> OnSelected { get; set; }
[Parameter] public string CompanyId { get; set; } = "";
[Parameter] public string Sku { get; set; } = "";
[Inject] public ICustomerHistoryRepository CustomerHistoryCrmRepo { get; set; }
[Inject] public ICustomerHistoryRepository HistoryRepo { get; set; }
private List<ProductHistoryView>? History { get; set; }
private string ProductName { get; set; } = "";
private string _modalDisplay = "";
@ -40,7 +40,7 @@ public partial class ProductPriceHistoryModal
if (string.IsNullOrWhiteSpace(Sku))
return;
History = await CustomerHistoryCrmRepo.FetchHistory(CompanyId, Sku);
History = await HistoryRepo.FetchHistory(CompanyId, Sku);
if (History.Any())
{
ProductName = History[0].Description;

View file

@ -6,8 +6,12 @@ body {
.draft-expires-msg {
font-size: 0.8em;
}
.spinner {
height: 48px;
.busy-signal {
float: right;
z-index: 100;
position: relative;
top: 1px;
right: 10px;
}
.workDate {
font-variant: small-caps;

View file

@ -60,9 +60,4 @@ public class CatalogPaging
/// Set product group filter
/// </summary>
public string SelectGroup { get; set; } = "";
/// <summary>
/// Country code
/// </summary>
public string CountryCode { get; set; } = "dk";
}

View file

@ -71,6 +71,4 @@ public class CustomerPaging
/// </summary>
public int HasFolded { get; set; }
public string CountryCode { get; set; } = "dk";
}