diff --git a/Wonky.Client/Components/AppVersion.razor b/Wonky.Client/Components/AppVersion.razor index 909b1ba5..6f2a0082 100644 --- a/Wonky.Client/Components/AppVersion.razor +++ b/Wonky.Client/Components/AppVersion.razor @@ -20,14 +20,14 @@ @if (_app!.Rc) { -
RC
+
NEXT
} @_app!.Sdk @code { - [Inject] IOptions? AppInfo { get; set; } + [Inject] IOptions? AppInfo { get; set; } private AppInfo? _app; // private bool _production = true; diff --git a/Wonky.Client/Components/CustomerInventoryListComponent.razor b/Wonky.Client/Components/CustomerInventoryListComponent.razor index 3b38bc43..4153de9e 100644 --- a/Wonky.Client/Components/CustomerInventoryListComponent.razor +++ b/Wonky.Client/Components/CustomerInventoryListComponent.razor @@ -59,7 +59,7 @@
@product.Description
@if (product.Discontinued) diff --git a/Wonky.Client/Components/CustomerInventoryListComponent.razor.cs b/Wonky.Client/Components/CustomerInventoryListComponent.razor.cs index 129691b0..9b52d8bd 100644 --- a/Wonky.Client/Components/CustomerInventoryListComponent.razor.cs +++ b/Wonky.Client/Components/CustomerInventoryListComponent.razor.cs @@ -15,9 +15,11 @@ using Blazored.LocalStorage; using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Options; using Wonky.Client.Enums; using Wonky.Client.Helpers; using Wonky.Client.Models; +using Wonky.Entity.Configuration; using Wonky.Entity.Views; namespace Wonky.Client.Components; @@ -28,7 +30,8 @@ public partial class CustomerInventoryListComponent // ##############################################3333############ [Inject] public ILocalStorageService Storage { get; set; } [Inject] public ILogger Logger { get; set; } - + [Inject] private IOptions Config { get; set; } + // ##############################################3333############ [Parameter] public List Inventory { get; set; } = new(); [Parameter] public string CompanyId { get; set; } = ""; @@ -40,9 +43,11 @@ public partial class CustomerInventoryListComponent private bool Descending { get; set; } = true; private string DisplayFilter { get; set; } = ""; private SortColumn SortColumn { get; set; } = SortColumn.LastInvoiceDate; - + private ApiConfig _config = new(); + protected override void OnParametersSet() { + _config = Config.Value; // sort the base Inventory Inventory = Utils.SortInventory(Inventory, SortColumn, Descending); // initialize FilteredList diff --git a/Wonky.Client/Components/CustomerProductCheckListComponent.razor b/Wonky.Client/Components/CustomerProductCheckListComponent.razor index 6cfcbcd6..99fdfbde 100644 --- a/Wonky.Client/Components/CustomerProductCheckListComponent.razor +++ b/Wonky.Client/Components/CustomerProductCheckListComponent.razor @@ -70,7 +70,7 @@
@product.Description
diff --git a/Wonky.Client/Components/CustomerProductCheckListComponent.razor.cs b/Wonky.Client/Components/CustomerProductCheckListComponent.razor.cs index fbe0f67f..97075a73 100644 --- a/Wonky.Client/Components/CustomerProductCheckListComponent.razor.cs +++ b/Wonky.Client/Components/CustomerProductCheckListComponent.razor.cs @@ -16,9 +16,11 @@ using System.Security.Policy; using Blazored.LocalStorage; using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Options; using Wonky.Client.Enums; using Wonky.Client.Helpers; using Wonky.Client.Models; +using Wonky.Entity.Configuration; using Wonky.Entity.Views; #pragma warning disable CS8618 @@ -27,6 +29,7 @@ public partial class CustomerProductCheckListComponent { // ############################################################## [Inject] public ILocalStorageService Storage { get; set; } + [Inject] private IOptions Config { get; set; } // ############################################################## [Parameter] public List Inventory { get; set; } = new(); @@ -37,10 +40,11 @@ public partial class CustomerProductCheckListComponent private string DisplayFilter { get; set; } = ""; private List DisplayList { get; set; } = new(); private SortColumn SortColumn { get; set; } = SortColumn.LastInvoiceDate; - + private ApiConfig _config = new(); protected override void OnParametersSet() { + _config = Config.Value; Inventory = Utils.SortInventory(Inventory, SortColumn, Descending); ApplyInventoryFilter(DisplayFilter); } diff --git a/Wonky.Client/Components/PrintCatalogComponent.razor b/Wonky.Client/Components/PrintCatalogComponent.razor index 9e042063..d68e8acb 100644 --- a/Wonky.Client/Components/PrintCatalogComponent.razor +++ b/Wonky.Client/Components/PrintCatalogComponent.razor @@ -45,7 +45,7 @@ @salesItem.Name diff --git a/Wonky.Client/Components/PrintCatalogComponent.razor.cs b/Wonky.Client/Components/PrintCatalogComponent.razor.cs index bfe4bc50..b0c9faf6 100644 --- a/Wonky.Client/Components/PrintCatalogComponent.razor.cs +++ b/Wonky.Client/Components/PrintCatalogComponent.razor.cs @@ -14,13 +14,24 @@ // using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Options; +using Wonky.Entity.Configuration; using Wonky.Entity.Views; namespace Wonky.Client.Components; public partial class PrintCatalogComponent { + // ######################################################################3 + [Inject] private IOptions Config { get; set; } + // ######################################################################3 [Parameter] public List ItemList { get; set; } = new(); [Parameter] public string CountryName { get; set; } = ""; + + private ApiConfig _config = new(); + protected override void OnInitialized() + { + _config = Config.Value; + } } \ No newline at end of file diff --git a/Wonky.Client/Components/ProductPriceListComponent.razor b/Wonky.Client/Components/ProductPriceListComponent.razor index 9d4d39c1..94d632bf 100644 --- a/Wonky.Client/Components/ProductPriceListComponent.razor +++ b/Wonky.Client/Components/ProductPriceListComponent.razor @@ -33,7 +33,7 @@ @salesItem.Name diff --git a/Wonky.Client/Components/ProductPriceListComponent.razor.cs b/Wonky.Client/Components/ProductPriceListComponent.razor.cs index d680037b..3895044a 100644 --- a/Wonky.Client/Components/ProductPriceListComponent.razor.cs +++ b/Wonky.Client/Components/ProductPriceListComponent.razor.cs @@ -15,6 +15,8 @@ using Blazored.Toast.Services; using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Options; +using Wonky.Entity.Configuration; using Wonky.Entity.Views; #pragma warning disable CS8618 @@ -24,4 +26,10 @@ public partial class ProductPriceListComponent { [Parameter] public List ItemList { get; set; } = new(); [Inject] public IToastService ToastService { get; set; } + [Inject] private IOptions Config { get; set; } + private ApiConfig _config = new(); + protected override void OnInitialized() + { + _config = Config.Value; + } } \ No newline at end of file diff --git a/Wonky.Client/Helpers/Utils.cs b/Wonky.Client/Helpers/Utils.cs index 1a55960b..a2048001 100644 --- a/Wonky.Client/Helpers/Utils.cs +++ b/Wonky.Client/Helpers/Utils.cs @@ -17,6 +17,7 @@ using System.Net.Mail; using System.Text.RegularExpressions; using Wonky.Client.Enums; using Wonky.Client.Models; +using Wonky.Entity.Configuration; using Wonky.Entity.DTO; using Wonky.Entity.Views; @@ -99,7 +100,7 @@ public static class Utils } - public static List GenerateDocListView(IEnumerable products) + public static List GenerateDocListView(IEnumerable products, ApiConfig config) { var result = new List(); @@ -115,7 +116,7 @@ public static class Utils VariantId = variant.VariantId, VariantName = variant.VariantName, DocumentDate = variant.Docs[0].DocumentDate, - PictureLink = $"https://filer.innotec.dk/images/{variant.VendorItemNo}.png" + PictureLink = $"{config.AssetUrl}/images/{variant.VendorItemNo}.png" }; var docs = variant.Docs.OrderBy(x => x.DocumentTypeEnum).ToList(); diff --git a/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor b/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor index 588cb0a0..020ec202 100644 --- a/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor +++ b/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor @@ -171,7 +171,7 @@
+ onerror="this.onerror=null;this.src='@(_config.AssetUrl)/images/no-image.png?height=100'"/>
diff --git a/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor.cs b/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor.cs index 342007d0..14d88927 100644 --- a/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor.cs +++ b/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor.cs @@ -18,6 +18,7 @@ using System.Text.Json; using Blazored.Toast.Services; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; +using Microsoft.Extensions.Options; using Wonky.Client.HttpInterceptors; using Wonky.Client.HttpRepository; using Wonky.Client.Local.Services; @@ -26,6 +27,7 @@ using Wonky.Client.Shared; using Wonky.Entity.DTO; using Wonky.Entity.Views; using Wonky.Client.Helpers; +using Wonky.Entity.Configuration; #pragma warning disable CS8618 namespace Wonky.Client.Pages; @@ -43,6 +45,7 @@ public partial class AdvisorCustomerWorkplaceViewEditPage : IDisposable [Inject] public IUserInfoService UserInfo { get; set; } [Inject] public IClipboardService Clipboard { get; set; } [Inject] public IToastService Toaster { get; set; } + [Inject] private IOptions Config { get; set; } // ############################################################# [Parameter] public string CompanyId { get; set; } = ""; @@ -73,6 +76,7 @@ public partial class AdvisorCustomerWorkplaceViewEditPage : IDisposable private const string LinkSendingStyle = "btn btn-warning"; private string _linkButtonText = LinkText; private string _linkButtonStyle = LinkStyle; + private ApiConfig _config = new(); private ConfirmActionModal ConfirmActionVariant { get; set; } private DocView SelectedItem { get; set; } = new(); @@ -84,7 +88,7 @@ public partial class AdvisorCustomerWorkplaceViewEditPage : IDisposable WorkplaceContext = new EditContext(Workplace); WorkplaceContext.OnFieldChanged += HandleFieldChanged!; WorkplaceContext.OnValidationStateChanged += ValidationChanged!; - + _config = Config.Value; Interceptor.RegisterEvent(); Interceptor.RegisterBeforeSendEvent(); var x = await Workplaces.GetWorkplaces(CompanyId); @@ -94,7 +98,7 @@ public partial class AdvisorCustomerWorkplaceViewEditPage : IDisposable Workplace = await Workplaces.GetWorkplace(CompanyId, WorkplaceId); WorkplaceDocInfo = await WorkplaceRepo.GetDocuments(CompanyId, WorkplaceId); - DocViews = Utils.GenerateDocListView(WorkplaceDocInfo.Products); + DocViews = Utils.GenerateDocListView(WorkplaceDocInfo.Products, _config); Working = false; } @@ -236,7 +240,7 @@ public partial class AdvisorCustomerWorkplaceViewEditPage : IDisposable Toaster.ShowInfo("Produkt dokument er slettet."); // update browser WorkplaceDocInfo.Products.Remove(item); - DocViews = Utils.GenerateDocListView(WorkplaceDocInfo.Products); + DocViews = Utils.GenerateDocListView(WorkplaceDocInfo.Products, _config); SelectedItem = new DocView(); Working = false; } diff --git a/Wonky.Client/Pages/BusinessCustomerLandingPage.razor b/Wonky.Client/Pages/BusinessCustomerLandingPage.razor index 7d62c5d8..aef20667 100644 --- a/Wonky.Client/Pages/BusinessCustomerLandingPage.razor +++ b/Wonky.Client/Pages/BusinessCustomerLandingPage.razor @@ -14,26 +14,83 @@ *@ @using Microsoft.AspNetCore.Authorization -@using System.Text.Json +@using Wonky.Client.Components @attribute [Authorize(Roles = "EShop")] @page "/b2b/{countryCode}/{companyId}"
@if (!string.IsNullOrWhiteSpace(_businessInfo.Name)) { - @JsonSerializer.Serialize(_businessInfo) + + + + + + + + + + + + + + + + + + + +
@_businessInfo.Name
@_businessInfo.Address1
@_businessInfo.Address2
@_businessInfo.ZipCode @_businessInfo.City
@_businessInfo.Phone
@_businessInfo.Email
+ } -
@if (!string.IsNullOrWhiteSpace(_advisorInfo.Name)) { - @JsonSerializer.Serialize(_advisorInfo) + + + + + + + + + + + + + +
Konsulent
@_advisorInfo.Name@_advisorInfo.Email@_advisorInfo.Phone
}
@if (_productInventory.Any()) { - @JsonSerializer.Serialize(_productInventory) + + + + + + + + @foreach (var product in _productInventory) + { + + + + + + + + } + +
Produkter
+ @product.Description + @product.LastInvoiceDate@product.Description@product.Quantity
+ } + else + { + }
\ No newline at end of file diff --git a/Wonky.Client/Pages/BusinessCustomerLandingPage.razor.cs b/Wonky.Client/Pages/BusinessCustomerLandingPage.razor.cs index 68bb1930..24c197ef 100644 --- a/Wonky.Client/Pages/BusinessCustomerLandingPage.razor.cs +++ b/Wonky.Client/Pages/BusinessCustomerLandingPage.razor.cs @@ -1,6 +1,8 @@ using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Options; using Wonky.Client.HttpInterceptors; using Wonky.Client.HttpRepository; +using Wonky.Entity.Configuration; using Wonky.Entity.DTO; using Wonky.Entity.Views; @@ -13,6 +15,7 @@ public partial class BusinessCustomerLandingPage : IDisposable // ############################################################## [Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public IB2BRepository B2BRepo { get; set; } + [Inject] private IOptions Config { get; set; } // ############################################################## [Parameter] public string CountryCode { get; set; } = ""; @@ -23,15 +26,22 @@ public partial class BusinessCustomerLandingPage : IDisposable private B2BAdvisorInfo _advisorInfo = new(); private List _productHistory = new(); private List _productInventory = new(); - + private ApiConfig _config = new(); protected override async Task OnInitializedAsync() { Interceptor.RegisterEvent(); Interceptor.RegisterBeforeSendEvent(); + _config = Config.Value; _businessInfo = await B2BRepo.GetBusinessInfo(CompanyId); _advisorInfo = await B2BRepo.GetAdvisorInfo(CompanyId); _productInventory = await B2BRepo.GetCustomerInventory(CompanyId); + if (_productInventory.Any()) + { + _productInventory = _productInventory + .OrderByDescending(x => x.LastInvoiceDate) + .ToList(); + } } diff --git a/Wonky.Client/Pages/SystemUserListPage.razor.cs b/Wonky.Client/Pages/SystemUserListPage.razor.cs index 516ad4dd..56f35f0b 100644 --- a/Wonky.Client/Pages/SystemUserListPage.razor.cs +++ b/Wonky.Client/Pages/SystemUserListPage.razor.cs @@ -44,6 +44,7 @@ public partial class SystemUserListPage : IDisposable { UserList = UserList.Where(x => !x.LockoutEnabled).ToList(); } + DisplayList = UserList; Working = false; diff --git a/Wonky.Client/Pages/SystemUserViewEditPage.razor.cs b/Wonky.Client/Pages/SystemUserViewEditPage.razor.cs index c43f6734..7482c220 100644 --- a/Wonky.Client/Pages/SystemUserViewEditPage.razor.cs +++ b/Wonky.Client/Pages/SystemUserViewEditPage.razor.cs @@ -40,8 +40,7 @@ public partial class SystemUserViewEditPage : IDisposable // ############################################################# [Parameter] public string UserId { get; set; } = ""; - [Parameter] public string CountryCode { get; set; } = ""; - + // ############################################################# private UserManagerEditView UserInfo { get; set; } = new(); private EditContext UserEditContext { get; set; } @@ -66,10 +65,10 @@ public partial class SystemUserViewEditPage : IDisposable Interceptor.RegisterBeforeSendEvent(); UserInfo = await UserRepo.GetUserInfo(UserId); - + if (!string.IsNullOrWhiteSpace(UserInfo.CompanyId)) { - _customer = await CustomerRepo.GetByCustomerId(CountryCode, UserInfo.CompanyId); + _customer = await CustomerRepo.GetByCustomerId(UserInfo.CountryCode, UserInfo.CompanyId); } AssignedRoles = Mapper.MapEditAssignedRoles(UserInfo); diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index ea7e2e72..ae7ba5a5 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,7 +1,7 @@ { "appInfo": { "name": "Wonky Online", - "version": "191.0", + "version": "197.0", "rc": true, "sandBox": true, "image": "grumpy-coder.png", @@ -20,6 +20,7 @@ } }, "apiConfig": { + "assetUrl": "https://files.innotec.dk", "baseUrl": "https://dev.innotec.dk", "catalog": "api/v2/catalog/country", "crmCustomers": "api/v2/crm/companies", diff --git a/Wonky.Entity/Configuration/ApiConfig.cs b/Wonky.Entity/Configuration/ApiConfig.cs index 234ce52d..3f13ec04 100644 --- a/Wonky.Entity/Configuration/ApiConfig.cs +++ b/Wonky.Entity/Configuration/ApiConfig.cs @@ -18,6 +18,11 @@ namespace Wonky.Entity.Configuration; public class ApiConfig { + /// + /// Application Asset Url + /// + public string AssetUrl { get; set; } = ""; + /// /// Application base url /// diff --git a/eta-build.sh b/edu-build.sh similarity index 98% rename from eta-build.sh rename to edu-build.sh index 5f66e1b7..2e40fabc 100755 --- a/eta-build.sh +++ b/edu-build.sh @@ -6,7 +6,7 @@ if [[ -z $1 ]]; then fi FILE="$PWD/Wonky.Client/wwwroot/appsettings.json" -FOLDER="eta-${1}" +FOLDER="edu-${1}" sed -i "s|\"version\".*|\"version\": \"${1}\",|g" "${FILE}" sed -i 's|\"rc\".*|\"rc\": true,|g' "${FILE}" diff --git a/zeta-build.sh b/next-build.sh similarity index 94% rename from zeta-build.sh rename to next-build.sh index 1dbf5e26..ede7eb96 100755 --- a/zeta-build.sh +++ b/next-build.sh @@ -6,7 +6,7 @@ if [[ -z $1 ]]; then fi FILE="$PWD/Wonky.Client/wwwroot/appsettings.json" -FOLDER="zeta-${1}" +FOLDER="next-${1}" sed -i "s|\"version\":.*|\"version\": \"$1\",|g" "${FILE}" sed -i 's|\"rc\":.*|\"rc\": true,|g' "${FILE}" @@ -32,4 +32,4 @@ sed -i 's|\"Microsoft\": \"None\",|\"Microsoft\": \"Information\",|g' "${FILE}" sed -i 's|\"baseUrl\".*|\"baseUrl\": \"https://dev.innotec.dk\",|g' "${FILE}" -printf "\n==> done building: ${FOLDER} RC\n" +printf "\n==> done building: ${FOLDER} NEXT\n" diff --git a/prod-build.sh b/prod-build.sh new file mode 100755 index 00000000..c7d55155 --- /dev/null +++ b/prod-build.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +if [[ -z $1 ]]; then + echo "no version" + exit 1 +fi + +FILE="$PWD/Wonky.Client/wwwroot/appsettings.json" +FOLDER="prod-${1}" + +sed -i "s|\"version\":.*|\"version\": \"$1\",|g" "${FILE}" +sed -i 's|\"rc\":.*|\"rc\": false,|g' "${FILE}" +sed -i 's|\"sandBox\":.*|\"sandBox\": false,|g' "${FILE}" + +sed -i 's|\"Default": \"Debug\",|\"Default": \"None\",|g' "${FILE}" +sed -i 's|\"System": \"Debug\",|\"System": \"None\",|g' "${FILE}" +sed -i 's|\"Microsoft\": \"Information\",|\"Microsoft\": \"None\",|g' "${FILE}" + +sed -i 's|\"baseUrl\".*|\"baseUrl\": \"https://zeta.innotec.dk\",|g' "${FILE}" + +dotnet clean +dotnet publish -c release + +cp --recursive /a/projects/inno/a/Wonky.Client/Wonky.Client/bin/Release/net7.0/publish/ "/a/projects/inno/version-sync/client/${FOLDER}" + +# RESET TO DEVELOPMENT +sed -i 's|\"sandBox\".*|\"sandBox\": true,|g' "${FILE}" + +sed -i 's|\"Default": \"None\",|\"Default": \"Debug\",|g' "${FILE}" +sed -i 's|\"System": \"None\",|\"System": \"Debug\",|g' "${FILE}" +sed -i 's|\"Microsoft\": \"None\",|\"Microsoft\": \"Information\",|g' "${FILE}" + +sed -i 's|\"baseUrl\".*|\"baseUrl\": \"https://dev.innotec.dk\",|g' "${FILE}" + +printf "\n==> done building: ${FOLDER} PROD\n"