WIP: overlay for selecting products for documentation

This commit is contained in:
Frede Hundewadt 2023-05-17 13:59:39 +02:00
parent a4425ca955
commit 8480b30607
13 changed files with 131 additions and 25 deletions

View file

@ -20,20 +20,18 @@ using Wonky.Client.Local.Services;
namespace Wonky.Client.Components; namespace Wonky.Client.Components;
public partial class ReportActivityKmStartComponent public partial class ActivityKmStartComponent
{ {
// ######################################################################3 // ######################################################################3
[Inject] public UserPreferenceService PreferenceService { get; set; } [Inject] public UserPreferenceService PreferenceService { get; set; }
// ######################################################################3 // ######################################################################3
private int KmMorning { get; set; } private int KmMorning { get; set; }
private UserPreference Preferences { get; set; } = new();
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
Preferences = await PreferenceService.GetProfile(); KmMorning = await PreferenceService.GetKmMorning();
KmMorning = Preferences.KmMorning;
} }

View file

@ -35,6 +35,7 @@ public class UserPreferenceService
{ {
private readonly ILocalStorageService _localStorageService; private readonly ILocalStorageService _localStorageService;
private const string KeyName = "preferences"; private const string KeyName = "preferences";
private const string KeyKm = "kmstart";
public event Action<UserPreference>? OnChange; public event Action<UserPreference>? OnChange;
public UserPreferenceService(ILocalStorageService localStorageService) public UserPreferenceService(ILocalStorageService localStorageService)
@ -42,6 +43,19 @@ public class UserPreferenceService
_localStorageService = localStorageService; _localStorageService = localStorageService;
} }
public async Task SetKmMorning(int kmMorning)
{
await _localStorageService.SetItemAsync(KeyName, kmMorning);
}
public async Task<int> GetKmMorning()
{
return await _localStorageService.GetItemAsync<int>(KeyName);
}
public async Task SetDateConfirmed(bool confirmed) public async Task SetDateConfirmed(bool confirmed)
{ {
var preferences = await GetProfile(); var preferences = await GetProfile();
@ -54,17 +68,6 @@ public class UserPreferenceService
OnChange?.Invoke(newPreferences); OnChange?.Invoke(newPreferences);
} }
public async Task SetKmMorning(int kmMorning)
{
var preferences = await GetProfile();
var newPreferences = preferences
with
{
KmMorning = kmMorning
};
await _localStorageService.SetItemAsync(KeyName, newPreferences);
OnChange?.Invoke(newPreferences);
}
public async Task SetCompanyFilterPhrase(string filterPhrase) public async Task SetCompanyFilterPhrase(string filterPhrase)
{ {

View file

@ -25,10 +25,15 @@ namespace Wonky.Client.OverlayCustomer;
public partial class CustomerInventoryReorderOverlay public partial class CustomerInventoryReorderOverlay
{ {
// ##############################################################
[Inject] public ICrmCustomerHistoryRepository HistoryRepo { get; set; }
// ##############################################################
[Parameter] public EventCallback<DraftItem> OnSelected { get; set; }
[Parameter] public string CompanyId { get; set; } = ""; [Parameter] public string CompanyId { get; set; } = "";
[Parameter] public SalesItemView SalesItem { get; set; } = new(); [Parameter] public SalesItemView SalesItem { get; set; } = new();
[Inject] public ICrmCustomerHistoryRepository HistoryRepo { get; set; }
[Parameter] public EventCallback<DraftItem> OnSelected { get; set; } // ##############################################################
private List<ProductHistoryView>? History { get; set; } = new(); private List<ProductHistoryView>? History { get; set; } = new();
private DraftItem SelectedItem { get; set; } = new(); private DraftItem SelectedItem { get; set; } = new();
private string ProductName { get; set; } = ""; private string ProductName { get; set; } = "";
@ -36,6 +41,7 @@ public partial class CustomerInventoryReorderOverlay
private bool _showBackdrop; private bool _showBackdrop;
private bool ShowDraft { get; set; } private bool ShowDraft { get; set; }
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
if (string.IsNullOrWhiteSpace(SalesItem.Sku)) if (string.IsNullOrWhiteSpace(SalesItem.Sku))

View file

@ -0,0 +1,33 @@
@* Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
*@
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
@* <div class="modal-dialog modal-dialog-scrollable modal-fullscreen-lg-down modal-xl modal-lg"> *@
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"></h4>
<button type="button" class="btn-close" onclick="@Hide" data-bs-dismiss="modal" aria-label="Luk"></button>
</div>
<div class="modal-body">
</div>
</div>
</div>
</div>
@if (_showBackdrop)
{
<div class="modal-backdrop fade show"></div>
}

View file

@ -0,0 +1,53 @@
// Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
using Microsoft.AspNetCore.Components;
using Wonky.Entity.Views;
namespace Wonky.Client.OverlayDocuments;
public partial class ProductSelectionOverlay
{
//###############################################################
[Parameter] public List<ExternalProductListView> ProductListViews { get; set; } = new();
[Parameter] public EventCallback<ExternalProductVariantView> OnSelected { get; set; }
//###############################################################
private string _modalDisplay = "";
private bool _showBackdrop;
private async Task SelectProduct(ExternalProductVariantView product)
{
await OnSelected.InvokeAsync(product);
}
public void Show()
{
_modalDisplay = "block;";
_showBackdrop = true;
StateHasChanged();
}
public void Hide()
{
_modalDisplay = "none;";
_showBackdrop = false;
StateHasChanged();
}
}

View file

@ -24,7 +24,7 @@
<WorkDateComponent OnWorkDateChangedCallback="GetWorkDateActivities"/> <WorkDateComponent OnWorkDateChangedCallback="GetWorkDateActivities"/>
</div> </div>
<div class="col-sm-3"> <div class="col-sm-3">
<ReportActivityKmStartComponent/> <ActivityKmStartComponent/>
</div> </div>
<div class="col-sm-2 text-end"> <div class="col-sm-2 text-end">
@if (ReportExist) @if (ReportExist)

View file

@ -27,7 +27,7 @@
<WorkDateComponent OnWorkDateChangedCallback="SetWorkDateCallback"/> <WorkDateComponent OnWorkDateChangedCallback="SetWorkDateCallback"/>
</div> </div>
<div class="col-sm-4 text-end"> <div class="col-sm-4 text-end">
<ReportActivityKmStartComponent/> <ActivityKmStartComponent/>
</div> </div>
</div> </div>

View file

@ -16,7 +16,7 @@
@using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Components @using Wonky.Client.Components
@attribute [Authorize(Roles = "Advisor")] @attribute [Authorize(Roles = "Advisor")]
@page "/advisor/customers/{CompanyId}/workplaces/{WorkplaceId}/newdoc" @page "/advisor/customers/{CompanyId}/workplaces/{WorkplaceId}/doc"
<PageTitle>@Workplace.CompanyName - @Workplace.Name</PageTitle> <PageTitle>@Workplace.CompanyName - @Workplace.Name</PageTitle>
<div class="row -mb-3"> <div class="row -mb-3">
<div class="col-sm-4"> <div class="col-sm-4">

View file

@ -1,7 +1,7 @@
{ {
"appInfo": { "appInfo": {
"name": "Wonky Online", "name": "Wonky Online",
"version": "142.4", "version": "142.5",
"rc": true, "rc": true,
"sandBox": true, "sandBox": true,
"image": "grumpy-coder.png" "image": "grumpy-coder.png"

View file

@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations;
namespace Wonky.Entity.DTO;
public class KrvDocHeaderUpdateDto
{
[MaxLength(128)] public string ApprovedBy { get; set; } = "";
[MaxLength(10)] public string ApprovedDate { get; set; } = "";
[MaxLength(128)] public string AuthoredBy { get; set; } = "";
[MaxLength(128)] public string DocumentId { get; set; } = "";
[MaxLength(10)] public string FollowupDate { get; set; } = "";
}

View file

@ -18,4 +18,5 @@ public class ExternalProductVariantView
public string ErpSku { get; set; } = ""; public string ErpSku { get; set; } = "";
public string ShortName { get; set; } = ""; public string ShortName { get; set; } = "";
public string PictureLink { get; set; } = ""; public string PictureLink { get; set; } = "";
public bool Selected { get; set; }
} }

View file

@ -1,7 +1,7 @@
{ {
"sdk": { "sdk": {
"version": "6.0.0", "version": "8.0.0",
"rollForward": "latestMajor", "rollForward": "latestMajor",
"allowPrerelease": false "allowPrerelease": true
} }
} }