working ...

This commit is contained in:
Frede Hundewadt 2023-07-31 07:00:40 +02:00
parent f1bdaf6ceb
commit b4b6420ea7
21 changed files with 170 additions and 29 deletions

View file

@ -20,14 +20,14 @@
@if (_app!.Rc)
{
<div class="badge text-bg-warning mx-2 pt-2">RC</div>
<div class="badge text-bg-warning mx-2 pt-2">NEXT</div>
}
<di class="badge text-bg-info mx-2 pt-2">@_app!.Sdk</di>
@code
{
[Inject] IOptions<AppInfo?>? AppInfo { get; set; }
[Inject] IOptions<AppInfo>? AppInfo { get; set; }
private AppInfo? _app;
// private bool _production = true;

View file

@ -59,7 +59,7 @@
<div class="position-relative">
<div class="product-image">
<img class="img-fluid img-thumbnail" src="@product.PictureLink?height=100"
onerror="this.onerror=null;this.src='https://filer.innotec.dk/images/no-image.png?height=100'"
onerror="this.onerror=null;this.src='@(_config.AssetUrl)/images/no-image.png?height=100'"
alt="@product.Description"/>
</div>
@if (product.Discontinued)

View file

@ -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<CustomerInventoryListComponent> Logger { get; set; }
[Inject] private IOptions<ApiConfig> Config { get; set; }
// ##############################################3333############
[Parameter] public List<ProductInventoryItemView> 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

View file

@ -70,7 +70,7 @@
</div>
<div class="col-sm-2">
<img class="img-fluid img-thumbnail" src="@product.PictureLink?height=100"
onerror="this.onerror=null;this.src='https://filer.innotec.dk/images/no-image.png?height=100'"
onerror="this.onerror=null;this.src='@(_config.AssetUrl)/images/no-image.png?height=100'"
alt="@product.Description"/>
</div>
<div class="col-sm-1" @onclick="@(() => ProductCheck(product.Sku))">

View file

@ -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<ApiConfig> Config { get; set; }
// ##############################################################
[Parameter] public List<ProductInventoryItemView> Inventory { get; set; } = new();
@ -37,10 +40,11 @@ public partial class CustomerProductCheckListComponent
private string DisplayFilter { get; set; } = "";
private List<ProductInventoryItemView> 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);
}

View file

@ -45,7 +45,7 @@
<td>
<img class="img-fluid img-thumbnail"
src="@salesItem.PictureLink?height=100"
onerror="this.onerror=null;this.src='https://filer.innotec.dk/images/no-image.png?height=100'"
onerror="this.onerror=null;this.src='@(_config.AssetUrl)/images/no-image.png?height=100'"
alt="@salesItem.Name"/>
</td>
<td class="align-middle">

View file

@ -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<ApiConfig> Config { get; set; }
// ######################################################################3
[Parameter] public List<SalesItemView> ItemList { get; set; } = new();
[Parameter] public string CountryName { get; set; } = "";
private ApiConfig _config = new();
protected override void OnInitialized()
{
_config = Config.Value;
}
}

View file

@ -33,7 +33,7 @@
<tr>
<td>
<img class="img-fluid img-thumbnail" src="@(salesItem.PictureLink)?height=100"
onerror="this.onerror=null;this.src='https://filer.innotec.dk/images/no-image.png?height=100'"
onerror="this.onerror=null;this.src='@(_config.AssetUrl)/images/no-image.png?height=100'"
alt="@salesItem.Name"/>
</td>
<td class="align-middle">

View file

@ -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<SalesItemView> ItemList { get; set; } = new();
[Inject] public IToastService ToastService { get; set; }
[Inject] private IOptions<ApiConfig> Config { get; set; }
private ApiConfig _config = new();
protected override void OnInitialized()
{
_config = Config.Value;
}
}

View file

@ -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<DocView> GenerateDocListView(IEnumerable<WorkplaceProduct> products)
public static List<DocView> GenerateDocListView(IEnumerable<WorkplaceProduct> products, ApiConfig config)
{
var result = new List<DocView>();
@ -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();

View file

@ -171,7 +171,7 @@
</div>
<div class="col-sm-2">
<img class="img-fluid img-thumbnail" src="@(docView.PictureLink)?height=100"
onerror="this.onerror=null;this.src='https://filer.innotec.dk/images/no-image.png?height=100'"/>
onerror="this.onerror=null;this.src='@(_config.AssetUrl)/images/no-image.png?height=100'"/>
</div>
</div>
</div>

View file

@ -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<ApiConfig> 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;
}

View file

@ -14,26 +14,83 @@
*@
@using Microsoft.AspNetCore.Authorization
@using System.Text.Json
@using Wonky.Client.Components
@attribute [Authorize(Roles = "EShop")]
@page "/b2b/{countryCode}/{companyId}"
<div>
@if (!string.IsNullOrWhiteSpace(_businessInfo.Name))
{
@JsonSerializer.Serialize(_businessInfo)
<table class="table">
<thead>
</thead>
<tbody>
<tr>
<td>@_businessInfo.Name</td>
</tr>
<tr>
<td>@_businessInfo.Address1</td>
</tr>
<tr>
<td>@_businessInfo.Address2</td>
</tr>
<tr>
<td>@_businessInfo.ZipCode @_businessInfo.City</td>
</tr>
<tr><td>@_businessInfo.Phone</td></tr>
<tr><td>@_businessInfo.Email</td></tr>
</tbody>
</table>
}
</div>
<div>
@if (!string.IsNullOrWhiteSpace(_advisorInfo.Name))
{
@JsonSerializer.Serialize(_advisorInfo)
<table class="table">
<thead>
<tr>
<th>Konsulent</th>
</tr>
</thead>
<tbody>
<tr>
<td>@_advisorInfo.Name</td>
<td>@_advisorInfo.Email</td>
<td>@_advisorInfo.Phone</td>
</tr>
</tbody>
</table>
}
</div>
<div>
@if (_productInventory.Any())
{
@JsonSerializer.Serialize(_productInventory)
<table class="table">
<thead>
<tr>
<th>Produkter</th>
</tr>
</thead>
<tbody>
@foreach (var product in _productInventory)
{
<tr>
<td>
<img src="@(product.PictureLink)?height=100" alt="@product.Description"
onerror="this.onerror=null;this.src='@(_config.AssetUrl)/images/no-image.png?height=100'"/>
</td>
<td>@product.LastInvoiceDate</td>
<td>@product.Description</td>
<td>@product.Quantity</td>
<td><button type="button" class="btn btn-primary">Genbestil</button></td>
</tr>
}
</tbody>
</table>
}
else
{
<WorkingThreeDots />
}
</div>

View file

@ -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<ApiConfig> Config { get; set; }
// ##############################################################
[Parameter] public string CountryCode { get; set; } = "";
@ -23,15 +26,22 @@ public partial class BusinessCustomerLandingPage : IDisposable
private B2BAdvisorInfo _advisorInfo = new();
private List<ProductHistoryView> _productHistory = new();
private List<ProductInventoryItemView> _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();
}
}

View file

@ -44,6 +44,7 @@ public partial class SystemUserListPage : IDisposable
{
UserList = UserList.Where(x => !x.LockoutEnabled).ToList();
}
DisplayList = UserList;
Working = false;

View file

@ -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);

View file

@ -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",

View file

@ -18,6 +18,11 @@ namespace Wonky.Entity.Configuration;
public class ApiConfig
{
/// <summary>
/// Application Asset Url
/// </summary>
public string AssetUrl { get; set; } = "";
/// <summary>
/// Application base url
/// </summary>

View file

@ -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}"

View file

@ -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"

35
prod-build.sh Executable file
View file

@ -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"