diff --git a/Wonky.Client/Components/AdvisorLandingComponent.razor.cs b/Wonky.Client/Components/AdvisorLandingComponent.razor.cs index 101b4f00..272a27d8 100644 --- a/Wonky.Client/Components/AdvisorLandingComponent.razor.cs +++ b/Wonky.Client/Components/AdvisorLandingComponent.razor.cs @@ -13,6 +13,7 @@ // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // +using System.Reflection.Metadata; using System.Text.Json; using Blazored.LocalStorage; using Blazored.Toast.Services; @@ -22,30 +23,45 @@ using Microsoft.VisualBasic; using Wonky.Client.HttpInterceptors; using Wonky.Client.HttpRepository; using Wonky.Client.Local.Services; +using Wonky.Client.Models; using Wonky.Client.Shared; using Wonky.Entity.DTO; using Wonky.Entity.Models; using Wonky.Entity.Views; +#pragma warning disable CS8618 namespace Wonky.Client.Components; public partial class AdvisorLandingComponent { + // ############################################################## [Inject] public UserPreferenceService PreferenceService { get; set; } + [Inject] public IDrawerCabinetService DrawerCabinetService { get; set; } + [Inject] public IUserInfoService UserInfo { get; set; } + [Inject] public ICountryCatalogRepository CatalogRepo { get; set; } - private readonly JsonSerializerOptions JsonOptions = new JsonSerializerOptions + + // ############################################################## + private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions { PropertyNameCaseInsensitive = true, PropertyNamingPolicy = JsonNamingPolicy.CamelCase }; - private UserPreference Profiles { get; set; } = new(); - private DateTime SelectedDate { get; set; } + // private DateTime SelectedDate { get; set; } protected override async Task OnInitializedAsync() { Profiles = await PreferenceService.GetProfile(); - SelectedDate = string.IsNullOrWhiteSpace(Profiles.WorkDate) ? DateTime.Now : DateTime.Parse(Profiles.WorkDate); - + // SelectedDate = string.IsNullOrWhiteSpace(Profiles.WorkDate) ? DateTime.Parse(Profiles.WorkDate) : DateTime.Today; } + + // protected override async Task OnAfterRenderAsync(bool firstRender) + // { + // if (firstRender) + // { + // var countryCode = await UserInfo.GetCountryCode(); + // var _ = await DrawerCabinetService.GetCatalogDrawer(countryCode); + // } + // } } diff --git a/Wonky.Client/Components/CustomerInvoiceListComponent.razor b/Wonky.Client/Components/CustomerInvoiceListComponent.razor index 45aaecc9..5beb3918 100644 --- a/Wonky.Client/Components/CustomerInvoiceListComponent.razor +++ b/Wonky.Client/Components/CustomerInvoiceListComponent.razor @@ -15,7 +15,7 @@ @using Wonky.Entity.Views @using System.Linq.Expressions -@if (InvoiceList.Any()) +@if (Invoices.Any()) {
@@ -37,7 +37,7 @@
- @foreach (var invoice in InvoiceList) + @foreach (var invoice in Invoices) {
diff --git a/Wonky.Client/Components/CustomerInvoiceListComponent.razor.cs b/Wonky.Client/Components/CustomerInvoiceListComponent.razor.cs index 36f496c0..7d0a3378 100644 --- a/Wonky.Client/Components/CustomerInvoiceListComponent.razor.cs +++ b/Wonky.Client/Components/CustomerInvoiceListComponent.razor.cs @@ -20,10 +20,17 @@ namespace Wonky.Client.Components; public partial class CustomerInvoiceListComponent { - [Parameter] public string CompanyId { get; set; } = ""; - [Parameter] public List InvoiceList { get; set; } = new(); + [Parameter] public List Invoices { get; set; } = new(); [Parameter] public EventCallback OnShowInvoice { get; set; } - + + protected override void OnParametersSet() + { + if (Invoices.Any()) + { + Invoices = Invoices.OrderByDescending(x => x.DocumentDate).ToList(); + } + } + private async Task ShowInvoice(string invoiceId) { await OnShowInvoice.InvokeAsync(invoiceId); diff --git a/Wonky.Client/HttpRepository/CrmContactRepository.cs b/Wonky.Client/HttpRepository/CrmContactRepository.cs index df8fd670..66cde4a9 100644 --- a/Wonky.Client/HttpRepository/CrmContactRepository.cs +++ b/Wonky.Client/HttpRepository/CrmContactRepository.cs @@ -50,7 +50,7 @@ public class CrmContactRepository : ICrmContactRepository /// /// /// - public async Task CreateContact(ContactDto contact) + public async Task PostContact(ContactDto contact) { var response = await _client.PostAsJsonAsync( $"{_conf.CrmCustomers}/{contact.CompanyId}/contacts", contact, _options); @@ -100,7 +100,7 @@ public class CrmContactRepository : ICrmContactRepository /// /// /// - public async Task UpdateContact(ContactDto contact) + public async Task PutContact(ContactDto contact) { await _client.PutAsJsonAsync( $"{_conf.CrmCustomers}/{contact.CompanyId}/contacts/{contact.ContactId}", contact, _options); diff --git a/Wonky.Client/HttpRepository/CrmCustomerHistoryRepository.cs b/Wonky.Client/HttpRepository/CrmCustomerHistoryRepository.cs index 55298c30..68146ecf 100644 --- a/Wonky.Client/HttpRepository/CrmCustomerHistoryRepository.cs +++ b/Wonky.Client/HttpRepository/CrmCustomerHistoryRepository.cs @@ -45,8 +45,20 @@ public class CrmCustomerHistoryRepository : ICrmCustomerHistoryRepository _api = configuration.Value; } + + public async Task> GetInvoiceList(string companyId) + { + var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/invoices/list"); + var content = await response.Content.ReadAsStringAsync(); + if (!response.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) + { + return new List(); + } + return JsonSerializer.Deserialize>(content, _options) ?? new List(); + } + - public async Task FetchInvoiceList(string companyId) + public async Task GetInvoiceListHeader(string companyId) { var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/invoices"); var content = await response.Content.ReadAsStringAsync(); @@ -58,7 +70,7 @@ public class CrmCustomerHistoryRepository : ICrmCustomerHistoryRepository } - public async Task FetchInvoice(string companyId, string invoiceId) + public async Task GetInvoice(string companyId, string invoiceId) { var content = await _client .GetFromJsonAsync($"{_api.CrmCustomers}/{companyId}/invoices/{invoiceId}", _options); @@ -66,7 +78,7 @@ public class CrmCustomerHistoryRepository : ICrmCustomerHistoryRepository } - public async Task> FetchInventory(string companyId) + public async Task> GetInventory(string companyId) { var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmInventoryExt}"); var content = await response.Content.ReadAsStringAsync(); @@ -112,7 +124,7 @@ public class CrmCustomerHistoryRepository : ICrmCustomerHistoryRepository } - public async Task GetRecycledInvoiceList(string companyId, string syncDate, bool force) + public async Task RequestErpSync(string companyId, string syncDate, bool force) { var x = await _client.GetAsync($"{_api.SyncInvoice}/{companyId}/{syncDate}?force={force}"); var content = await x.Content.ReadAsStringAsync(); diff --git a/Wonky.Client/HttpRepository/ICrmContactRepository.cs b/Wonky.Client/HttpRepository/ICrmContactRepository.cs index 47681d20..803fb703 100644 --- a/Wonky.Client/HttpRepository/ICrmContactRepository.cs +++ b/Wonky.Client/HttpRepository/ICrmContactRepository.cs @@ -28,7 +28,7 @@ public interface ICrmContactRepository /// /// /// - Task CreateContact(ContactDto contact); + Task PostContact(ContactDto contact); /// /// Get Contact @@ -58,5 +58,5 @@ public interface ICrmContactRepository /// /// /// - Task UpdateContact(ContactDto contact); + Task PutContact(ContactDto contact); } \ No newline at end of file diff --git a/Wonky.Client/HttpRepository/ICrmCustomerHistoryRepository.cs b/Wonky.Client/HttpRepository/ICrmCustomerHistoryRepository.cs index 71e880f4..77048762 100644 --- a/Wonky.Client/HttpRepository/ICrmCustomerHistoryRepository.cs +++ b/Wonky.Client/HttpRepository/ICrmCustomerHistoryRepository.cs @@ -22,12 +22,19 @@ namespace Wonky.Client.HttpRepository; /// public interface ICrmCustomerHistoryRepository { + /// + /// Return invoice list without company information + /// + /// + /// + Task> GetInvoiceList(string companyId); + /// /// Fetch Invoice LIst /// /// /// - Task FetchInvoiceList(string companyId); + Task GetInvoiceListHeader(string companyId); /// /// Fetch given invoice for given customer @@ -35,14 +42,14 @@ public interface ICrmCustomerHistoryRepository /// /// /// - Task FetchInvoice(string companyId, string invoiceId); + Task GetInvoice(string companyId, string invoiceId); /// /// Fetch inventory from given customer /// /// /// - Task> FetchInventory(string companyId); + Task> GetInventory(string companyId); /// /// Fetch History for given customer @@ -58,7 +65,7 @@ public interface ICrmCustomerHistoryRepository /// /// Task> GetProductInvoiceLines(string companyId, int months); - + /// /// Fetch history for given customer and a given product /// @@ -74,5 +81,5 @@ public interface ICrmCustomerHistoryRepository /// /// /// - Task GetRecycledInvoiceList(string companyId, string syncDate, bool force); + Task RequestErpSync(string companyId, string syncDate, bool force); } \ No newline at end of file diff --git a/Wonky.Client/Local.Services/DrawerCabinetService.cs b/Wonky.Client/Local.Services/DrawerCabinetService.cs new file mode 100644 index 00000000..1d5b730c --- /dev/null +++ b/Wonky.Client/Local.Services/DrawerCabinetService.cs @@ -0,0 +1,291 @@ +using System.Text.Json; +using Blazored.LocalStorage; +using Wonky.Client.HttpRepository; +using Wonky.Client.Models; + +namespace Wonky.Client.Local.Services; + +public class DrawerCabinetService : IDrawerCabinetService +{ + private readonly JsonSerializerOptions _options = new () + { + PropertyNameCaseInsensitive = true + }; + private readonly ILogger _logger; + private readonly ILocalStorageService _asyncStorageService; + private readonly ISyncLocalStorageService _syncStorageService; + private readonly ICrmActivityRepository _activityRepo; + private readonly ICrmCustomerRepository _customerRepo; + private readonly ICrmCustomerHistoryRepository _historyRepo; + private readonly ICountryCatalogRepository _catalogRepo; + + /// + /// Constructor + /// + /// + /// + /// + /// + /// + /// + /// + public DrawerCabinetService( + ILogger logger, + ILocalStorageService asyncStorageService, + ISyncLocalStorageService syncStorageService, + ICountryCatalogRepository catalogRepo, + ICrmCustomerHistoryRepository historyRepo, + ICrmCustomerRepository customerRepo, + ICrmActivityRepository activityRepo) + { + _logger = logger; + _asyncStorageService = asyncStorageService; + _syncStorageService = syncStorageService; + _catalogRepo = catalogRepo; + _historyRepo = historyRepo; + _customerRepo = customerRepo; + _activityRepo = activityRepo; + } + + /// + /// Activity + /// + /// + /// + /// + public async Task GetActivityDrawerAsync(string companyId, bool force = false) + { + var drawer = await _asyncStorageService + .GetItemAsync($"{companyId}.{ActivityDrawer.Label}"); + if (drawer == null) force = true; + if (force) + { + var result = await _activityRepo.GetCustomerActivities(companyId); + drawer = new ActivityDrawer + { + LastDateModified = DateTime.Today, + Content = result + }; + await StoreActivityDrawerAsync(companyId, drawer); + } + _logger.LogDebug("ActivityDrawer {}", JsonSerializer.Serialize(drawer, _options)); + return drawer ?? new ActivityDrawer(); + } + + + /// + /// Sales Catalog + /// + /// + /// + /// + public async Task GetCatalogDrawerAsync(string countryCode, bool force = false) + { + var drawer = await _asyncStorageService + .GetItemAsync($"{countryCode}.{CatalogDrawer.Label}"); + + if (drawer == null) force = true; + if (force) + { + var result = await _catalogRepo.GetPriceList(countryCode); + drawer = new CatalogDrawer + { + LastDateModified = DateTime.Today, + Content = result + }; + await StoreCatalogDrawerAsync(countryCode, drawer); + } + _logger.LogDebug("CatalogDrawer {}", JsonSerializer.Serialize(drawer, _options)); + return drawer ?? new CatalogDrawer(); + } + + + /// + /// Company Info + /// + /// + /// + /// + public async Task GetInfoDrawerAsync(string companyId, bool force = false) + { + var drawer = await _asyncStorageService + .GetItemAsync($"{companyId}.{InfoDrawer.Label}"); + + if (drawer == null) force = true; + if (force) + { + var result = await _customerRepo.GetCompanyById(companyId); + drawer = new InfoDrawer + { + LastDateModified = DateTime.Today, + Content = result + }; + await StoreInfoDrawerAsync(companyId, drawer); + } + _logger.LogDebug("InfoDrawer {}", JsonSerializer.Serialize(drawer, _options)); + return drawer ?? new InfoDrawer(); + } + + + /// + /// Inventory + /// + /// + /// + /// + public async Task GetInventoryDrawerAsync(string companyId, bool force = false) + { + var drawer = await _asyncStorageService + .GetItemAsync($"{companyId}.{InventoryDrawer.Label}"); + + if (drawer == null) force = true; + if (force) + { + var result = await _historyRepo.GetInventory(companyId); + drawer = new InventoryDrawer + { + LastDateModified = DateTime.Today, + Content = result + }; + await StoreInventoryDrawerAsync(companyId, drawer); + } + _logger.LogDebug("InventoryDrawer {}", JsonSerializer.Serialize(drawer, _options)); + return drawer ?? new InventoryDrawer(); + } + + + /// + /// Invoices + /// + /// + /// + /// + public async Task GetInvoiceDrawerAsync(string companyId, bool force = false) + { + var drawer = await _asyncStorageService + .GetItemAsync($"{companyId}.{InvoiceDrawer.Label}"); + if (drawer == null) force = true; + if (force) + { + var result = await _historyRepo.GetInvoiceList(companyId); + drawer = new InvoiceDrawer + { + LastDateModified = DateTime.Today, + Content = result + }; + await StoreInvoiceDrawerAsync(companyId, drawer); + } + _logger.LogDebug("InvoiceDrawer {}", JsonSerializer.Serialize(drawer, _options)); + + return drawer ?? new InvoiceDrawer(); + } + + + /// + /// Statistic (invoice lines) + /// + /// + /// + /// + public async Task GetStatisticDrawerAsync(string companyId, bool force = false) + { + var drawer = await _asyncStorageService + .GetItemAsync($"{companyId}.{StatisticDrawer.Label}"); + + if (drawer == null) force = true; + if (force) + { + var result = await _historyRepo.GetProductInvoiceLines(companyId); + drawer = new StatisticDrawer + { + LastDateModified = DateTime.Today, + Content = result + }; + await StoreStatisticDrawerAsync(companyId, drawer); + } + _logger.LogDebug("StatisticDrawer {}", JsonSerializer.Serialize(drawer, _options)); + return drawer ?? new StatisticDrawer(); + } + + + /// + /// Store Activity + /// + /// + /// + public async Task StoreActivityDrawerAsync(string companyId, ActivityDrawer drawer) + { + if (drawer.Content.Any()) + { + drawer.Content = drawer.Content.OrderByDescending(x => x.OrderDate).ToList(); + } + await _asyncStorageService.SetItemAsync($"{companyId}.{ActivityDrawer.Label}", drawer); + } + + + /// + /// Store Sales Catalog + /// + /// + /// + public async Task StoreCatalogDrawerAsync(string countryCode, CatalogDrawer drawer) + { + await _asyncStorageService.SetItemAsync($"{countryCode}.{CatalogDrawer.Label}", drawer); + } + + + /// + /// Store Company Info + /// + /// + /// + public async Task StoreInfoDrawerAsync(string companyId, InfoDrawer drawer) + { + await _asyncStorageService.SetItemAsync($"{companyId}.{InfoDrawer.Label}", drawer); + } + + + /// + /// Store Inventory + /// + /// + /// + public async Task StoreInventoryDrawerAsync(string companyId, InventoryDrawer drawer) + { + if (drawer.Content.Any()) + { + drawer.Content = drawer.Content.OrderByDescending(x => x.LastInvoiceDate).ToList(); + } + await _asyncStorageService.SetItemAsync($"{companyId}.{InventoryDrawer.Label}", drawer); + } + + + /// + /// Store Invoices + /// + /// + /// + public async Task StoreInvoiceDrawerAsync(string companyId, InvoiceDrawer drawer) + { + if (drawer.Content.Any()) + { + drawer.Content = drawer.Content.OrderByDescending(x => x.DocumentDate).ToList(); + } + await _asyncStorageService.SetItemAsync($"{companyId}.{InvoiceDrawer.Label}", drawer); + } + + + /// + /// Store statistic (invoice lines) + /// + /// + /// + public async Task StoreStatisticDrawerAsync(string companyId, StatisticDrawer drawer) + { + if (drawer.Content.Any()) + { + drawer.Content = drawer.Content.OrderByDescending(x => x.DeliveryDate).ToList(); + } + await _asyncStorageService.SetItemAsync($"{companyId}.{StatisticDrawer.Label}", drawer); + } +} \ No newline at end of file diff --git a/Wonky.Client/Local.Services/IDrawerCabinetService.cs b/Wonky.Client/Local.Services/IDrawerCabinetService.cs new file mode 100644 index 00000000..2f1ea8c3 --- /dev/null +++ b/Wonky.Client/Local.Services/IDrawerCabinetService.cs @@ -0,0 +1,30 @@ +using System.Security.Authentication.ExtendedProtection; +using Wonky.Client.Models; +using Wonky.Entity.DTO; + +namespace Wonky.Client.Local.Services; + +public interface IDrawerCabinetService +{ + Task GetActivityDrawerAsync(string companyId, bool force = false); + Task GetCatalogDrawerAsync(string countryCode, bool force = false); + Task GetInfoDrawerAsync(string companyId, bool force = false); + Task GetInventoryDrawerAsync(string companyId, bool force = false); + Task GetInvoiceDrawerAsync(string companyId, bool force = false); + Task GetStatisticDrawerAsync(string companyId, bool force = false); + + Task StoreActivityDrawerAsync(string companyId, ActivityDrawer drawer); + Task StoreCatalogDrawerAsync(string countryCode, CatalogDrawer drawer); + Task StoreInfoDrawerAsync(string companyId, InfoDrawer drawer); + Task StoreInventoryDrawerAsync(string companyId, InventoryDrawer drawer); + Task StoreInvoiceDrawerAsync(string companyId, InvoiceDrawer drawer); + Task StoreStatisticDrawerAsync(string companyId, StatisticDrawer drawer); + + // void StoreActivityDrawer(string companyId, ActivityDrawer drawer); + // void StoreCatalogDrawer(string countryCode, CatalogDrawer drawer); + // void StoreInfoDrawer(string companyId, InfoDrawer drawer); + // void StoreInventoryDrawer(string companyId, InventoryDrawer drawer); + // void StoreInvoiceDrawer(string companyId, InvoiceDrawer drawer); + // void StoreStatisticDrawer(string companyId, StatisticDrawer drawer); + +} \ No newline at end of file diff --git a/Wonky.Client/Local.Services/IUserInfoService.cs b/Wonky.Client/Local.Services/IUserInfoService.cs index 5c169379..be823fd4 100644 --- a/Wonky.Client/Local.Services/IUserInfoService.cs +++ b/Wonky.Client/Local.Services/IUserInfoService.cs @@ -21,6 +21,7 @@ namespace Wonky.Client.Local.Services; public interface IUserInfoService { Task GetUserId(); + Task GetCountryCode(); Task GetUserInfo(); Task SetUserInfo(UserManagerEditView userInfo); Task IsSupervisor(); diff --git a/Wonky.Client/Local.Services/UserInfoService.cs b/Wonky.Client/Local.Services/UserInfoService.cs index 592dbb6f..0b327bb1 100644 --- a/Wonky.Client/Local.Services/UserInfoService.cs +++ b/Wonky.Client/Local.Services/UserInfoService.cs @@ -24,10 +24,10 @@ namespace Wonky.Client.Local.Services; public class UserInfoService : IUserInfoService { - private const string _infoKey = "_xui"; - private const string _refreshKey = "_xr"; - private const string _accessKey = "_xa"; - private const string _expiryKey = "_xe"; + private const string InfoKey = "_xui"; + private const string RefreshKey = "_xr"; + private const string AccessKey = "_xa"; + private const string ExpiryKey = "_xe"; private readonly ILocalStorageService _localStorageService; private readonly JsonSerializerOptions _options = new() { PropertyNameCaseInsensitive = true }; @@ -43,6 +43,12 @@ public class UserInfoService : IUserInfoService var x = await GetUserInfo(); return x.UserId; } + + public async Task GetCountryCode() + { + var x = await GetUserInfo(); + return x.CountryCode; + } public async Task IsSupervisor() @@ -54,48 +60,48 @@ public class UserInfoService : IUserInfoService public async Task GetUserInfo() { - return await _localStorageService.GetItemAsync(_infoKey); + return await _localStorageService.GetItemAsync(InfoKey); } public async Task SetUserInfo(UserManagerEditView userInfo) { - await _localStorageService.SetItemAsync(_infoKey, userInfo); + await _localStorageService.SetItemAsync(InfoKey, userInfo); } public async Task GetRefreshToken() { - return await _localStorageService.GetItemAsStringAsync(_refreshKey); + return await _localStorageService.GetItemAsStringAsync(RefreshKey); } public async Task SetRefreshToken(string token) { - await _localStorageService.SetItemAsStringAsync(_refreshKey, token); + await _localStorageService.SetItemAsStringAsync(RefreshKey, token); } public async Task GetAccessToken() { - return await _localStorageService.GetItemAsStringAsync(_accessKey); + return await _localStorageService.GetItemAsStringAsync(AccessKey); } public async Task SetAccessToken(string token) { - await _localStorageService.SetItemAsStringAsync(_accessKey, token); + await _localStorageService.SetItemAsStringAsync(AccessKey, token); } public async Task GetExpiration() { - return await _localStorageService.GetItemAsync(_expiryKey); + return await _localStorageService.GetItemAsync(ExpiryKey); } public async Task SetExpiration(long expiration) { - await _localStorageService.SetItemAsync(_expiryKey, expiration); + await _localStorageService.SetItemAsync(ExpiryKey, expiration); } } \ No newline at end of file diff --git a/Wonky.Client/Models/ActivityDrawer.cs b/Wonky.Client/Models/ActivityDrawer.cs new file mode 100644 index 00000000..26d0aa54 --- /dev/null +++ b/Wonky.Client/Models/ActivityDrawer.cs @@ -0,0 +1,11 @@ + +using Wonky.Entity.Views; + +namespace Wonky.Client.Models; + +public class ActivityDrawer +{ + public const string Label = "Activity"; + public DateTime LastDateModified { get; set; } + public List Content { get; set; } = new(); +} \ No newline at end of file diff --git a/Wonky.Client/Models/CatalogDrawer.cs b/Wonky.Client/Models/CatalogDrawer.cs new file mode 100644 index 00000000..4fa637b4 --- /dev/null +++ b/Wonky.Client/Models/CatalogDrawer.cs @@ -0,0 +1,10 @@ +using Wonky.Entity.Views; + +namespace Wonky.Client.Models; + +public class CatalogDrawer +{ + public const string Label = "Catalog"; + public DateTime LastDateModified { get; set; } + public List Content { get; set; } = new(); +} \ No newline at end of file diff --git a/Wonky.Client/Models/InfoDrawer.cs b/Wonky.Client/Models/InfoDrawer.cs new file mode 100644 index 00000000..ee633701 --- /dev/null +++ b/Wonky.Client/Models/InfoDrawer.cs @@ -0,0 +1,10 @@ +using Wonky.Entity.DTO; + +namespace Wonky.Client.Models; + +public class InfoDrawer +{ + public const string Label = "Info"; + public DateTime LastDateModified { get; set; } + public CompanyDto Content { get; set; } = new(); +} \ No newline at end of file diff --git a/Wonky.Client/Models/InventoryDrawer.cs b/Wonky.Client/Models/InventoryDrawer.cs new file mode 100644 index 00000000..16195595 --- /dev/null +++ b/Wonky.Client/Models/InventoryDrawer.cs @@ -0,0 +1,10 @@ +using Wonky.Entity.Views; + +namespace Wonky.Client.Models; + +public class InventoryDrawer +{ + public const string Label = "Inventory"; + public DateTime LastDateModified { get; set; } + public List Content { get; set; } = new(); +} \ No newline at end of file diff --git a/Wonky.Client/Models/InvoiceDrawer.cs b/Wonky.Client/Models/InvoiceDrawer.cs new file mode 100644 index 00000000..0415410b --- /dev/null +++ b/Wonky.Client/Models/InvoiceDrawer.cs @@ -0,0 +1,10 @@ +using Wonky.Entity.Views; + +namespace Wonky.Client.Models; + +public class InvoiceDrawer +{ + public const string Label = "Invoice"; + public DateTime LastDateModified { get; set; } + public List Content { get; set; } = new(); +} \ No newline at end of file diff --git a/Wonky.Client/Models/StatisticDrawer.cs b/Wonky.Client/Models/StatisticDrawer.cs new file mode 100644 index 00000000..729b8e79 --- /dev/null +++ b/Wonky.Client/Models/StatisticDrawer.cs @@ -0,0 +1,10 @@ +using Wonky.Entity.Views; + +namespace Wonky.Client.Models; + +public class StatisticDrawer +{ + public const string Label = "Statistic"; + public DateTime LastDateModified { get; set; } + public List Content { get; set; } = new(); +} \ No newline at end of file diff --git a/Wonky.Client/OverlayCustomer/CustomerActivityListOverlay.razor.cs b/Wonky.Client/OverlayCustomer/CustomerActivityListOverlay.razor.cs index 49726688..82928351 100644 --- a/Wonky.Client/OverlayCustomer/CustomerActivityListOverlay.razor.cs +++ b/Wonky.Client/OverlayCustomer/CustomerActivityListOverlay.razor.cs @@ -26,7 +26,23 @@ public partial class CustomerActivityListOverlay private string _modalDisplay = ""; private bool _showBackdrop; + + + /// + /// On Paramters Set + /// + protected override void OnParametersSet() + { + if (Activities.Any()) + { + Activities = Activities.OrderByDescending(x => x.OrderDate).ToList(); + } + } + + /// + /// Show Self + /// public void Show() { _modalDisplay = "block;"; @@ -34,6 +50,10 @@ public partial class CustomerActivityListOverlay StateHasChanged(); } + + /// + /// Hide Self + /// private void Hide() { _modalDisplay = "none;"; diff --git a/Wonky.Client/OverlayCustomer/CustomerActivityViewOverlay.razor b/Wonky.Client/OverlayCustomer/CustomerActivityViewOverlay.razor index e3beada5..a82e476c 100644 --- a/Wonky.Client/OverlayCustomer/CustomerActivityViewOverlay.razor +++ b/Wonky.Client/OverlayCustomer/CustomerActivityViewOverlay.razor @@ -18,84 +18,89 @@