rename popup to overlay - empty string bug in call to product check overlay

This commit is contained in:
Frede Hundewadt 2023-01-24 16:27:21 +01:00
parent 391aab22d1
commit 950c70e05e
19 changed files with 75 additions and 49 deletions

View file

@ -32,7 +32,11 @@
<a class="btn btn-success d-block" href="/office/users/advisors/@user.CountryCode.ToLower()/@user.UserId/customers">Kunder</a>
</div>
<div class="col-sm-2">
<a class="btn btn-info d-block" href="/office/users/advisors/@user.CountryCode.ToLower()/@user.UserId/view">Rediger</a>
<AuthorizeView Roles="Admin">
<Authorized>
<a class="btn btn-info d-block" href="/office/users/advisors/@user.CountryCode.ToLower()/@user.UserId/view">Rediger</a>
</Authorized>
</AuthorizeView>
</div>
</div>
</div>

View file

@ -19,7 +19,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Components;
public partial class OfficeCountrySalesRepListComponent
public partial class OfficeCountryAdvisorListComponent
{
[Parameter] public List<UserListAdminView> UserList { get; set; } = new();
}

View file

@ -220,7 +220,7 @@ else
<td class="align-middle text-black text-end fw-bold">@($"{DraftProvider.Draft.Total:N2}")</td>
<td></td>
<td class="align-middle text-end">
<button class="btn btn-primary" type="button" @onclick="CallPriceListModal">
<button class="btn btn-primary" type="button" @onclick="ShowPriceListOverlay">
<i class="bi-plus"></i> Ny linje
</button>
</td>
@ -256,7 +256,7 @@ else
<td class="align-middle" style="min-width:200px;">
<div class="input-group">
<input type="number" class="form-control" @bind-value="@Price"/>
<button class="btn btn-warning" type="button" @onclick="CallPriceHistoryModal">
<button class="btn btn-warning" type="button" @onclick="ShowPriceHistoryOverlay">
<i class="bi-list-ul"></i>
</button>
</div>
@ -330,20 +330,26 @@ else
<a class="btn btn-warning" href="/advisor/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)"><i class="bi-cloud-arrow-up"></i> @ButtonText</button>
<button type="button" class="btn btn-warning" @onclick="CallConfirmCheckOverlay" disabled="@(PoFormInvalid || Working)"><i class="bi-cloud-arrow-up"></i> @ButtonText</button>
</div>
</div>
}
<ConfirmWorkDateModal BodyMessage="@PromptDateConfirm"
OnOkClicked="WorkDateConfirmCallback" @ref="ConfirmWorkDateModal"/>
<PriceCatalogModal CountryCode="@Company.CountryCode.ToLower()"
OnSelected="PriceListCallback" @ref="PriceCatalogModal"/>
<ProductHistoryModal CompanyId="@CompanyId" ItemSku="@SelectedItem.Sku" @ref="HistoryModal"/>
<ConfirmWorkDateOverlay BodyMessage="@PromptDateConfirm"
OnOkClicked="WorkDateConfirmCallback" @ref="WorkDateOverlay"/>
<PriceCatalogOverlay CountryCode="@Company.CountryCode.ToLower()"
OnSelected="PriceListCallback" @ref="CatalogOverlay"/>
<ProductHistoryOverlay CompanyId="@CompanyId" ItemSku="@SelectedItem.Sku" @ref="ProductOverlay"/>
<ProductPriceHistoryModal CompanyId="@CompanyId" Sku="@SelectedItem.Sku"
OnSelected="PriceHistoryCallback" @ref="PriceHistoryModal"/>
<ConfirmProductCheckModal BodyMessage="" CompanyId="@CompanyId" Products="CheckList"
OnOkClicked="ConfirmProductCheckCallback" @ref="ConfirmProductCheckModal" />
OnSelected="PriceHistoryCallback" @ref="PriceOverlay"/>
<ConfirmProductCheckOverlay BodyMessage="" CompanyId="@CompanyId" Products="CheckList"
OnOkClicked="ConfirmProductCheckCallback" @ref="ProductCheckOverlay" />
<CustomerInvoiceOverlay CustomerInvoices="CompanyInvoices" @ref="InvoiceOverlay" />
<CustomerInventoryOverlay CompanyName="@Company.Name" CompanyId="@CompanyId" CountryCode="@Company.CountryCode"
OnInventorySelected="OnInventoryCallback" Inventory="Inventory" @ref="InventoryOverlay" />

View file

@ -69,21 +69,24 @@ public partial class AdvisorActivityCreatePage : IDisposable
private DateTime SelectedDate { get; set; }
private string OldPhone { get; set; } = "";
private string PromptDateConfirm { get; set; } = "";
// MODAL DIALOGS
private PriceCatalogModal PriceCatalogModal { get; set; } = new();
private ProductHistoryModal HistoryModal { get; set; } = new();
private ProductPriceHistoryModal PriceHistoryModal { get; set; } = new();
private ConfirmWorkDateModal ConfirmWorkDateModal { get; set; } = new();
private ConfirmProductCheckModal ConfirmProductCheckModal { get; set; } = new();
// OVERLAY PAGES
private PriceCatalogOverlay CatalogOverlay { get; set; } = new();
private ProductHistoryOverlay ProductOverlay { get; set; } = new();
private ProductPriceHistoryModal PriceOverlay { get; set; } = new();
private ConfirmWorkDateOverlay WorkDateOverlay { get; set; } = new();
private ConfirmProductCheckOverlay ProductCheckOverlay { get; set; } = new();
private CustomerInvoiceOverlay InvoiceOverlay { get; set; } = new();
private CustomerInventoryOverlay InventoryOverlay { get; set; } = new();
private List<ProductInventoryView> Inventory { get; set; } = new();
private List<ProductInventoryView> CheckList { get; set; } = new();
private InvoiceListView CompanyInvoices { get; set; } = new();
private string ButtonText { get; set; } = "Gem besøg";
private bool OrgWarning { get; set; }
private CustomerInvoiceOverlay InvoiceOverlay { get; set; }
private InvoiceListView CompanyInvoices { get; set; } = new();
private CustomerInventoryOverlay InventoryOverlay { get; set; } = new();
private List<ProductInventoryView> Inventory { get; set; } = new();
/// <summary>
/// Page initialization
/// </summary>
@ -146,7 +149,7 @@ public partial class AdvisorActivityCreatePage : IDisposable
if (!UserPrefs.DateConfirmed)
{
PromptDateConfirm = $"Aktiviteter oprettes med dato {SelectedDate.ToShortDateString()}. Er dette OK?";
ConfirmWorkDateModal.Show();
WorkDateOverlay.Show();
}
// Lines may already have been added from the company inventory page
if (DraftProvider.Draft.DraftType == "order")
@ -164,6 +167,7 @@ public partial class AdvisorActivityCreatePage : IDisposable
Logger.LogDebug("ShowInventoryOverlay - wait for inventory");
InventoryOverlay.Show();
Inventory = await HistoryRepo.FetchInventory(CompanyId);
await Task.Delay(500);
}
@ -223,7 +227,7 @@ public partial class AdvisorActivityCreatePage : IDisposable
}
}
private async Task CallConfirmProductCheckModel()
private async Task CallConfirmCheckOverlay()
{
// check if new account
if (string.IsNullOrWhiteSpace(Company.Account)
@ -241,9 +245,10 @@ public partial class AdvisorActivityCreatePage : IDisposable
Logger.LogDebug("pStorage => {}", pStorage);
// fetch pDate from storage
var pDate = await Storage.GetItemAsync<string>($"{CompanyId}-pDate");
if (string.IsNullOrWhiteSpace(pDate))
pDate = $"{DateTime.Now.AddDays(-1):yyyy-MM-dd}";
Logger.LogDebug("pDate => {}", pDate);
if (string.IsNullOrWhiteSpace(pStorage))
await Task.Delay(1000);
// check if product data is valid and updated today
if (string.IsNullOrWhiteSpace(pStorage) || pDate.Replace("\"", "") != $"{DateTime.Now:yyyy-MM-dd}")
{
@ -277,12 +282,12 @@ public partial class AdvisorActivityCreatePage : IDisposable
}
// Show CheckList modal
ConfirmProductCheckModal.Show();
ProductCheckOverlay.Show();
}
private async Task ConfirmProductCheckCallback()
{
ConfirmProductCheckModal.Hide();
ProductCheckOverlay.Hide();
await CreateActivity();
foreach (var item in CheckList)
{
@ -298,7 +303,7 @@ public partial class AdvisorActivityCreatePage : IDisposable
private async Task WorkDateConfirmCallback()
{
await Profiles.SetDateConfirmed(true);
ConfirmWorkDateModal.Hide();
WorkDateOverlay.Hide();
StateHasChanged();
}
@ -316,9 +321,9 @@ public partial class AdvisorActivityCreatePage : IDisposable
/// <summary>
/// Show Price list modal
/// </summary>
private void CallPriceListModal()
private void ShowPriceListOverlay()
{
PriceCatalogModal.Show();
CatalogOverlay.Show();
}
/// <summary>
@ -340,10 +345,10 @@ public partial class AdvisorActivityCreatePage : IDisposable
/// <summary>
/// Show Price History modal
/// </summary>
private void CallPriceHistoryModal()
private void ShowPriceHistoryOverlay()
{
if(ShowItem)
PriceHistoryModal.Show();
PriceOverlay.Show();
}
/// <summary>

View file

@ -80,13 +80,18 @@ public partial class AdvisorCustomerInvoiceListPage : IDisposable
}
Logger.LogDebug("pulling invoices from backend");
// pull invoices
var invoices = await HistoryRepo.FetchInvoiceList(_companyId);
var companyInvoices = await HistoryRepo.FetchInvoiceList(_companyId);
if (companyInvoices.Invoices.Any())
companyInvoices.Invoices = companyInvoices.Invoices
.OrderByDescending(x => x.DocumentDate)
.ToList();
// send invoices to storage
await Storage.SetItemAsync($"{_companyId}-invoices", invoices);
await Storage.SetItemAsync($"{_companyId}-invoices", companyInvoices);
await Storage.SetItemAsync($"{_companyId}-iDate", $"{DateTime.Now:yyyy-MM-dd}");
Logger.LogDebug("return invoices from backend");
Working = false;
return invoices;
return companyInvoices;
}
public void Dispose()

View file

@ -225,4 +225,4 @@
</div>
</div>
<PriceCatalogModal OnSelected="PriceListCallback" @ref="PriceCatalog"/>
<PriceCatalogOverlay OnSelected="PriceListCallback" @ref="PriceCatalog"/>

View file

@ -59,7 +59,7 @@ public partial class OfficeCustomerCreatePhoneOrderPage : IDisposable
private bool ReportClosed { get; set; }
private bool PoFormInvalid { get; set; } = true;
private bool Working { get; set; }
private PriceCatalogModal PriceCatalog { get; set; } = new();
private PriceCatalogOverlay PriceCatalog { get; set; } = new();
protected override async Task OnInitializedAsync()

View file

@ -27,7 +27,7 @@
<h3>Sælgere</h3>
</div>
<div class="card-body">
<OfficeCountrySalesRepListComponent UserList="SalesReps" />
<OfficeCountryAdvisorListComponent UserList="SalesReps" />
</div>
</div>

View file

@ -107,6 +107,11 @@
<EditForm EditContext="_passwdContext" class="mt-5" >
<DataAnnotationsValidator />
<h3>NULSTIL ADGANGSKODE</h3>
<div class="alert-info">
<h4>Password politik</h4>
<p>Mindst 10 tegn bestående af store og små bogstaver samt tal.</p>
<p>Du kan teste pasword og danne stærke password på <a href="https://pw.nix.dk">pw.nix.dk</a></p>
</div>
<div class="row mb-3">
<label for="newPasswd" class="col-md-2 col-form-label">Ny</label>
<div class="col-md-10">

View file

@ -18,7 +18,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Shared;
public partial class ConfirmProductCheckModal
public partial class ConfirmProductCheckOverlay
{
private string _modalDisplay = "";
private bool _showBackdrop;

View file

@ -17,7 +17,7 @@ using Microsoft.AspNetCore.Components;
namespace Wonky.Client.Shared;
public partial class ConfirmWorkDateModal
public partial class ConfirmWorkDateOverlay
{
private string _modalDisplay = "";
private bool _showBackdrop;

View file

@ -22,7 +22,8 @@ public partial class CustomerInvoiceOverlay
{
Company = CustomerInvoices.Company;
Logger.LogDebug("company => {}", JsonSerializer.Serialize(Company));
Invoices = CustomerInvoices.Invoices;
if (CustomerInvoices.Invoices.Any())
Invoices = CustomerInvoices.Invoices.OrderByDescending(x => x.DocumentDate).ToList();
Logger.LogDebug("invoices => {}", JsonSerializer.Serialize(Invoices));
}

View file

@ -24,7 +24,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Shared;
public partial class PriceCatalogModal : IDisposable
public partial class PriceCatalogOverlay : IDisposable
{
[Parameter] public string CountryCode { get; set; } = "";
[Parameter] public EventCallback<SelectedSku> OnSelected { get; set; }

View file

@ -24,7 +24,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Shared;
public partial class ProductHistoryModal
public partial class ProductHistoryOverlay
{
// [Parameter] public EventCallback<decimal> OnSelected { get; set; }
[Parameter] public string CompanyId { get; set; } = "";

View file

@ -1,14 +1,14 @@
{
"appInfo": {
"name": "Wonky Online",
"version": "0.106.6",
"version": "0.106.13",
"rc": true,
"sandBox": false,
"image": "grumpy-coder.png"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
},