rebuilt v310.0
This commit is contained in:
parent
e75453e025
commit
03af77e0f0
13 changed files with 52 additions and 81 deletions
|
@ -91,10 +91,10 @@
|
|||
<button class="btn btn-sm btn-success" @onclick="@(() => ShowInventory(company.CompanyId))">Produkter</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<a class="btn btn-sm btn-primary" href="/office/customers/@company.CountryCode.ToLower()/@company.CompanyId/order">Bestilling</a>
|
||||
<a class="btn btn-sm btn-primary" href="/office/customers/@CountryCode/@company.CompanyId/order">Bestilling</a>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button class="btn btn-sm btn-secondary" @onclick="() => RequestBusinessCentralData(company.CompanyId, true)">BC<i class="bi-database-down"></i></button>
|
||||
<button class="btn btn-sm btn-secondary" @onclick="() => RequestBusinessCentralData(company.CompanyId, true)">BC <i class="bi-database-down"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -47,7 +47,6 @@ public partial class OfficeCountryCustomerListComponent : IDisposable
|
|||
[Parameter] public List<CompanyDto> CompanyList { get; set; } = new();
|
||||
// [Parameter] public EventCallback<DraftItem> OnOrderItem { get; set; }
|
||||
[CascadingParameter] public DraftStateProvider DraftProvider { get; set; }
|
||||
|
||||
[Parameter] public EventCallback<bool> SetWorking { get; set; }
|
||||
|
||||
// ******************************************************
|
||||
|
@ -71,61 +70,48 @@ public partial class OfficeCountryCustomerListComponent : IDisposable
|
|||
Interceptor.RegisterBeforeSendEvent();
|
||||
}
|
||||
|
||||
|
||||
private async Task RequestBusinessCentralData(string companyId, bool force)
|
||||
{
|
||||
await SetWorking.InvokeAsync(true);
|
||||
SelectedCompany = CompanyList.First(x => x.CompanyId == companyId);
|
||||
// call erp to crm sync before requesting invoices
|
||||
await Task.Delay(500);
|
||||
var newSyncDate = await HistoryRepo.RequestErpToCrmSync(companyId, SelectedCompany.HistorySync, force);
|
||||
while (string.IsNullOrWhiteSpace(newSyncDate))
|
||||
{
|
||||
await Task.Delay(500);
|
||||
}
|
||||
|
||||
await SetWorking.InvokeAsync(false);
|
||||
}
|
||||
|
||||
private async Task ShowInvoiceList(string companyId)
|
||||
{
|
||||
await SetWorking.InvokeAsync(true);
|
||||
SelectedCompany = CompanyList.First(x => x.CompanyId == companyId);
|
||||
// call erp to crm sync before requesting invoices
|
||||
await Task.Delay(500);
|
||||
await RequestBusinessCentralData(companyId, false);
|
||||
Logger.LogDebug("SelectedCompany => {}", SelectedCompany);
|
||||
await SetWorking.InvokeAsync(true);
|
||||
|
||||
await RequestBusinessCentralData(companyId, true);
|
||||
|
||||
InvoiceList = await HistoryRepo.GetInvoiceList(CountryCode, companyId);
|
||||
|
||||
InvoiceListOverlay.Show();
|
||||
await SetWorking.InvokeAsync(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private async Task ShowActivityList(string companyId)
|
||||
{
|
||||
await SetWorking.InvokeAsync(true);
|
||||
SelectedCompany = CompanyList.First(x => x.CompanyId == companyId);
|
||||
await Task.Delay(500);
|
||||
|
||||
await SetWorking.InvokeAsync(true);
|
||||
|
||||
ActivityList = await ActivityRepo.GetActivityList(companyId);
|
||||
await Task.Delay(500);
|
||||
|
||||
ActivityListOverlay.Show();
|
||||
|
||||
await SetWorking.InvokeAsync(false);
|
||||
}
|
||||
|
||||
|
||||
private async Task ShowInventory(string companyId)
|
||||
{
|
||||
await SetWorking.InvokeAsync(true);
|
||||
SelectedCompany = CompanyList.First(x => x.CompanyId == companyId);
|
||||
Logger.LogDebug("SelectedCompany => {}", JsonSerializer.Serialize(SelectedCompany));
|
||||
await Task.Delay(500);
|
||||
|
||||
await SetWorking.InvokeAsync(true);
|
||||
|
||||
await RequestBusinessCentralData(companyId, false);
|
||||
// request inventory
|
||||
await Task.Delay(500);
|
||||
ProductInventory = await HistoryRepo.GetInventory(SelectedCompany.CountryCode, SelectedCompany.CompanyId);
|
||||
await Task.Delay(500);
|
||||
Logger.LogDebug("ProductInventory => {}", JsonSerializer.Serialize(ProductInventory));
|
||||
// show the overlay
|
||||
|
||||
ProductInventory = await HistoryRepo.GetInventory(CountryCode, companyId);
|
||||
|
||||
InventoryListOverlay.Show();
|
||||
|
||||
await SetWorking.InvokeAsync(false);
|
||||
}
|
||||
|
||||
|
@ -136,6 +122,18 @@ public partial class OfficeCountryCustomerListComponent : IDisposable
|
|||
}
|
||||
|
||||
|
||||
private async Task RequestBusinessCentralData(string companyId, bool force)
|
||||
{
|
||||
SelectedCompany = CompanyList.First(x => x.CompanyId == companyId);
|
||||
|
||||
await SetWorking.InvokeAsync(true);
|
||||
|
||||
SelectedCompany.HistorySync = await HistoryRepo.RequestErpToCrmSync(companyId, SelectedCompany.HistorySync, force);
|
||||
|
||||
await SetWorking.InvokeAsync(false);
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Interceptor.DisposeEvent();
|
||||
|
|
|
@ -41,6 +41,7 @@ public partial class OfficeCustomerActivityListOverlay
|
|||
{
|
||||
_modalDisplay = "none;";
|
||||
_showBackdrop = false;
|
||||
ActivityList = new List<ReportItemView>();
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
|
@ -39,6 +39,7 @@ public partial class OfficeCustomerActivityViewOverlay
|
|||
{
|
||||
_modalDisplay = "none;";
|
||||
_showBackdrop = false;
|
||||
Activity = new ReportItemView();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ public partial class OfficeCustomerInventoryItemHistoryOverlay
|
|||
{
|
||||
_modalDisplay = "none;";
|
||||
_showBackdrop = false;
|
||||
History = new List<ProductHistoryView>();
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
|
@ -48,8 +48,6 @@ public partial class OfficeCustomerInventoryItemReorderOverlay
|
|||
return;
|
||||
|
||||
History = await HistoryRepo.GetSkuHistory(Company.CountryCode, Company.CompanyId, SalesItem.Sku);
|
||||
// if (!History.Any())
|
||||
// await Task.Delay(500);
|
||||
SelectedItem.Item = SalesItem;
|
||||
SelectedItem.Discount = 0;
|
||||
SelectedItem.Quantity = 1;
|
||||
|
|
|
@ -40,12 +40,7 @@ public partial class OfficeCustomerInvoiceListOverlay
|
|||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
// extract company from customer invoices
|
||||
Logger.LogDebug("OfficeInvoiceListOverlay => company => {}", JsonSerializer.Serialize(Company));
|
||||
// if there is invoices -> order by document date
|
||||
if (InvoiceList.Invoices.Any())
|
||||
Invoices = InvoiceList.Invoices.OrderByDescending(x => x.DocumentDate).ToList();
|
||||
Logger.LogDebug("invoices => {}", JsonSerializer.Serialize(Invoices));
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
|
@ -68,6 +63,7 @@ public partial class OfficeCustomerInvoiceListOverlay
|
|||
|
||||
private void Hide()
|
||||
{
|
||||
InvoiceList = new InvoiceListView();
|
||||
_modalDisplay = "none;";
|
||||
_showBackdrop = false;
|
||||
StateHasChanged();
|
||||
|
|
|
@ -38,44 +38,19 @@ public partial class OfficeCustomerInvoiceViewOverlay : IDisposable
|
|||
private string _modalDisplay = "";
|
||||
private bool _showBackdrop;
|
||||
private InvoiceView Invoice { get; set; } = new();
|
||||
// private string SasAmount { get; set; } = "0.00";
|
||||
// private string NormalAmount { get; set; } = "0.00";
|
||||
// private string DiscountAmount { get; set; } = "0.00";
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
Interceptor.RegisterEvent();
|
||||
Interceptor.RegisterBeforeSendEvent();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(InvoiceId))
|
||||
if (string.IsNullOrWhiteSpace(InvoiceId))
|
||||
{
|
||||
Invoice = await HistoryRepo.GetInvoice( CountryCode, CompanyId, InvoiceId);
|
||||
// CalculateDisplaySums();
|
||||
return;
|
||||
}
|
||||
Invoice = await HistoryRepo.GetInvoice(CountryCode, CompanyId, InvoiceId);
|
||||
}
|
||||
|
||||
// private void CalculateDisplaySums()
|
||||
// {
|
||||
// var invoiceAmount = decimal.Parse(Invoice.InvoiceAmount);
|
||||
// var normalLines = Invoice.Lines.Where(x => !x.Sas && !x.Price.Contains("-"));
|
||||
// var normalSale = (
|
||||
// from line in normalLines
|
||||
// let price = int.Parse(line.Qty) * decimal.Parse(line.Price)
|
||||
// select decimal.Parse(line.Qty) == 0
|
||||
// ? price : price + price * decimal.Parse(line.Qty) / 100).Sum();
|
||||
// NormalAmount = $"{normalSale:N2}";
|
||||
//
|
||||
// var sasLines = Invoice.Lines.Where(x => x.Sas && !x.Price.Contains("-"));
|
||||
// var sasSale = (
|
||||
// from line in sasLines
|
||||
// let price = int.Parse(line.Qty) * decimal.Parse(line.Price)
|
||||
// select price).Sum();
|
||||
// SasAmount = $"{sasSale:N2}";
|
||||
//
|
||||
// if (normalSale > invoiceAmount)
|
||||
// DiscountAmount = $"{normalSale - invoiceAmount:N2}";
|
||||
// }
|
||||
|
||||
public void Show()
|
||||
{
|
||||
_modalDisplay = "block;";
|
||||
|
|
|
@ -49,12 +49,9 @@ public partial class OfficeCustomerListInventoryOverlay
|
|||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
// sort the base Inventory
|
||||
if (Inventory.Count <= 0) return;
|
||||
Inventory = Utils.SortInventory(Inventory, SortColumn, Descending);
|
||||
// initialize FilteredList
|
||||
ApplyInventoryFilter(DisplayFilter);
|
||||
|
||||
Logger.LogDebug("OfficeCustomerListInventoryOverlay {}", JsonSerializer.Serialize(DisplayList));
|
||||
}
|
||||
|
||||
|
||||
|
@ -106,6 +103,7 @@ public partial class OfficeCustomerListInventoryOverlay
|
|||
{
|
||||
_modalDisplay = "none;";
|
||||
_showBackdrop = false;
|
||||
Inventory = new List<ProductInventoryItemView>();
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
|
@ -80,6 +80,7 @@ public partial class OfficeCustomerOrderInventoryListOverlay : IDisposable
|
|||
{
|
||||
_modalDisplay = "none;";
|
||||
_showBackdrop = false;
|
||||
Inventory = new List<ProductInventoryItemView>();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ public partial class OfficeCustomerOrderInventoryReorderOverlay
|
|||
SelectedItem = new DraftItem();
|
||||
_modalDisplay = "none;";
|
||||
_showBackdrop = false;
|
||||
ProductHistory = new List<ProductHistoryView>();
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"appInfo": {
|
||||
"name": "Wonky Online",
|
||||
"version": "309.0",
|
||||
"rc": true,
|
||||
"version": "310.0",
|
||||
"rc": false,
|
||||
"sandBox": true,
|
||||
"image": "grumpy-coder.png",
|
||||
"sdk": "dotnet 8.0"
|
||||
|
|
|
@ -14,8 +14,9 @@ sed -i "s|\"version\":.*|\"version\": \"$1\",|g" "${FILE}"
|
|||
sed -i 's|\"rc\":.*|\"rc\": true,|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}"
|
||||
# need debugging in next build
|
||||
#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|\"Microsoft\": \"Debug\",|\"Microsoft\": \"None\",|g' "${FILE}"
|
||||
|
||||
|
|
Loading…
Reference in a new issue