WIP
This commit is contained in:
parent
6d15a7e88a
commit
4c8ea61749
53 changed files with 456 additions and 166 deletions
115
Wonky.Client/Overlay.System/SelectCustomerPagedOverlay.razor
Normal file
115
Wonky.Client/Overlay.System/SelectCustomerPagedOverlay.razor
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
@* 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 Wonky.Client.Components
|
||||||
|
@using Wonky.Client.Helpers
|
||||||
|
<div class="modal" tabindex="-1" role="dialog" style="display:@_modalDisplay">
|
||||||
|
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Pris Katalog</h5>
|
||||||
|
<button type="button" class="btn btn-danger" @onclick="@Hide" data-bs-dismiss="modal" aria-label="Luk"><i class="bi-x-lg"></i></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="sticky-top bg-dark rounded-2 p-3">
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<SearchCatalogColumnComponent OnChanged="SetSearchCol"/>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<SearchCatalogPhraseComponent OnChanged="SetSearchPhrase"/>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<SearchCatalogSortColumnComponent OnChanged="SetSortCol"/>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<PageSizeComponent OnChanged="SetPageSize"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-sm-12 text-center">
|
||||||
|
<PagerPagesComponent MetaData="PageData" Spread="2" SelectedPage="SetSelectedPage" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row text-white">
|
||||||
|
<div class="col-sm-3 fw-bold">Vare</div>
|
||||||
|
<div class="col-sm-2 fw-bold">Varenr</div>
|
||||||
|
<div class="col-sm-2 fw-bold">Fork</div>
|
||||||
|
<div class="col-sm-1 text-center fw-bold">Colli</div>
|
||||||
|
<div class="col-sm-4 text-center fw-bold">Stk / Pris</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (Items.Any())
|
||||||
|
{
|
||||||
|
<ul class="list-group list-group-flush">
|
||||||
|
@foreach (var item in Items)
|
||||||
|
{
|
||||||
|
<li class="list-group-item">
|
||||||
|
<div class="row align-middle">
|
||||||
|
<div class="col-sm-3 text-sm-start">
|
||||||
|
@item.Name
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-2 text-sm-start">
|
||||||
|
@item.Sku
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-2 text-sm-start">
|
||||||
|
@item.ShortName
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1 text-center">
|
||||||
|
@item.BoxSize
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<ul class="list-group">
|
||||||
|
@foreach (var rate in item.Rates)
|
||||||
|
{
|
||||||
|
<li class="list-group-item d-flex justify-content-between align-items-end">
|
||||||
|
<div class="text-sm-end me-1">@rate.Quantity</div>
|
||||||
|
<div class="text-sm-end me-1">@rate.Rate</div>
|
||||||
|
<div>
|
||||||
|
<a class="btn btn-primary btn-sm" data-bs-dismiss="modal" @onclick="@(() => SelectItem(item.SalesItemId, rate.Quantity, rate.Rate))">
|
||||||
|
<i class="bi-plus-lg"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
@if (_pager.PageSize > 10)
|
||||||
|
{
|
||||||
|
<div class="row mt-5 pb-5">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<PagerSimpleComponent MetaData="PageData" Spread="2" SelectedPage="SetSelectedPage" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div>Der er ingen data</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@if (_showBackdrop)
|
||||||
|
{
|
||||||
|
<div class="modal-backdrop fade show"></div>
|
||||||
|
}
|
134
Wonky.Client/Overlay.System/SelectCustomerPagedOverlay.razor.cs
Normal file
134
Wonky.Client/Overlay.System/SelectCustomerPagedOverlay.razor.cs
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
// 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 System.Text.Json;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Wonky.Client.HttpInterceptors;
|
||||||
|
using Wonky.Client.HttpRepository;
|
||||||
|
using Wonky.Client.Local.Services;
|
||||||
|
using Wonky.Client.Models;
|
||||||
|
using Wonky.Entity.Requests;
|
||||||
|
using Wonky.Entity.Views;
|
||||||
|
|
||||||
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
|
namespace Wonky.Client.Overlay.System;
|
||||||
|
|
||||||
|
public partial class SelectCustomerPagedOverlay : IDisposable
|
||||||
|
{
|
||||||
|
// ##############################################################
|
||||||
|
[Inject] public ICountryCatalogRepository CatalogRepo { get; set; }
|
||||||
|
[Inject] public HttpInterceptorService Interceptor { get; set; }
|
||||||
|
[Inject] public UserPreferenceService PreferenceService { get; set; }
|
||||||
|
[Inject] public ILogger<SelectCustomerPagedOverlay> Logger { get; set; }
|
||||||
|
|
||||||
|
// ##############################################################
|
||||||
|
[Parameter] public string CountryCode { get; set; } = "";
|
||||||
|
[Parameter] public EventCallback<SelectedSku> OnSelected { get; set; }
|
||||||
|
|
||||||
|
// ##############################################################
|
||||||
|
private string _modalDisplay = "";
|
||||||
|
private bool _showBackdrop;
|
||||||
|
private List<SalesItemView> Items { get; set; } = new();
|
||||||
|
private MetaData? PageData { get; set; } = new();
|
||||||
|
private CatalogPager _pager = new();
|
||||||
|
private UserPreference _userPreference = new();
|
||||||
|
|
||||||
|
protected override async Task OnParametersSetAsync()
|
||||||
|
{
|
||||||
|
Interceptor.RegisterEvent();
|
||||||
|
Interceptor.RegisterBeforeSendEvent();
|
||||||
|
await GetSalesItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
_userPreference = await PreferenceService.GetProfile();
|
||||||
|
_pager.OrderBy = _userPreference.ItemSort;
|
||||||
|
_pager.SearchColumn = _userPreference.ItemSearch;
|
||||||
|
_pager.PageSize = Convert.ToInt32(_userPreference.PageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task GetSalesItems()
|
||||||
|
{
|
||||||
|
var pagingResponse = await CatalogRepo.GetSalesItemsPaged(CountryCode, _pager);
|
||||||
|
if (pagingResponse == null)
|
||||||
|
Task.Delay(250);
|
||||||
|
Items = pagingResponse.Items!;
|
||||||
|
PageData = pagingResponse.MetaData;
|
||||||
|
Logger.LogDebug("PriceCatalogOverlay => Items <= {}", JsonSerializer.Serialize(Items));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectItem(string itemId, string quantity, string rate)
|
||||||
|
{
|
||||||
|
OnSelected.InvokeAsync(new SelectedSku { Quantity = quantity, Rate = rate, ItemId = itemId });
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SetSelectedPage(int page)
|
||||||
|
{
|
||||||
|
Items = new List<SalesItemView>();
|
||||||
|
_pager.PageNumber = page;
|
||||||
|
await GetSalesItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SetSearchPhrase(string searchTerm)
|
||||||
|
{
|
||||||
|
Items = new List<SalesItemView>();
|
||||||
|
_pager.PageNumber = 1;
|
||||||
|
_pager.SearchTerm = searchTerm;
|
||||||
|
await GetSalesItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SetPageSize(string pageSize)
|
||||||
|
{
|
||||||
|
Items = new List<SalesItemView>();
|
||||||
|
_pager.PageSize = Convert.ToInt32(pageSize);
|
||||||
|
_pager.PageNumber = 1;
|
||||||
|
await GetSalesItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SetSearchCol(string columnName)
|
||||||
|
{
|
||||||
|
Items = new List<SalesItemView>();
|
||||||
|
_pager.PageNumber = 1;
|
||||||
|
_pager.SearchColumn = columnName;
|
||||||
|
await GetSalesItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SetSortCol(string orderBy)
|
||||||
|
{
|
||||||
|
Items = new List<SalesItemView>();
|
||||||
|
_pager.OrderBy = orderBy;
|
||||||
|
await GetSalesItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Show()
|
||||||
|
{
|
||||||
|
_modalDisplay = "block;";
|
||||||
|
_showBackdrop = true;
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Hide()
|
||||||
|
{
|
||||||
|
_modalDisplay = "none;";
|
||||||
|
_showBackdrop = false;
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose() => Interceptor.DisposeEvent();
|
||||||
|
}
|
|
@ -33,5 +33,9 @@
|
||||||
@* TODO Supervisor landing page *@
|
@* TODO Supervisor landing page *@
|
||||||
</AuthorizeView>
|
</AuthorizeView>
|
||||||
|
|
||||||
|
<AuthorizeView Roles="Management">
|
||||||
|
@* TODO Supervisor landing page *@
|
||||||
|
</AuthorizeView>
|
||||||
|
|
||||||
@code{
|
@code{
|
||||||
}
|
}
|
||||||
|
|
6
Wonky.Client/Pages/ManagementPage.razor
Normal file
6
Wonky.Client/Pages/ManagementPage.razor
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
@page "/manager"
|
||||||
|
<h3>Manager</h3>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
}
|
|
@ -28,7 +28,7 @@
|
||||||
<a class="btn btn-primary" href="/supervisor" ><i class="bi-chevron-left"></i> Supervisor</a>
|
<a class="btn btn-primary" href="/supervisor" ><i class="bi-chevron-left"></i> Supervisor</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-2 text-end">
|
<div class="col-sm-2 text-end">
|
||||||
<a class="btn btn-primary" href="/supervisor/advisors/@AdvisorId/documents/new" ><i class="bi-plus-lg"></i> Ny dokument</a>
|
<a class="btn btn-primary" href="/supervisor/advisors/@AdvisorId/documents/new" ><i class="bi-plus-lg"></i> Dokument</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -34,19 +34,21 @@
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<h3>@Document.AdvisorName</h3>
|
<h3>@Document.AdvisorName</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-2">
|
|
||||||
@* placeholder *@
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-2 text-end">
|
<div class="col-sm-2 text-end">
|
||||||
|
<AuthorizeView Roles="Management">
|
||||||
|
<button type="button" class="btn btn-warning" @onclick="@RemoveDocument"><i class="bi-trash"></i> Slet</button>
|
||||||
|
</AuthorizeView>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1 text-end">
|
||||||
<div class="busy-signal @(Working ? "inno-visible" : "inno-hidden")">
|
<div class="busy-signal @(Working ? "inno-visible" : "inno-hidden")">
|
||||||
<div class="spinner-grow text-info" role="status">
|
<div class="spinner-grow inno" role="status">
|
||||||
<span class="visually-hidden">Loading...</span>
|
<span class="visually-hidden">Loading...</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<EditForm EditContext="FormContext" OnValidSubmit="SubmitDocument">
|
<div class="card">
|
||||||
<div class="card">
|
<EditForm EditContext="FormContext" OnValidSubmit="SubmitDocument">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row d-flex g-3">
|
<div class="row d-flex g-3">
|
||||||
<label for="supervisor" class="col-sm-1 col-form-label-sm">Supervisor</label>
|
<label for="supervisor" class="col-sm-1 col-form-label-sm">Supervisor</label>
|
||||||
|
@ -79,17 +81,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</EditForm>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<Authorized Context="Management">
|
|
||||||
<div class="col text-start">
|
|
||||||
<button type="button" class="btn btn-warning" @onclick="@RemoveDocument"><i class="bi-trash"></i> Slet</button>
|
|
||||||
</div>
|
|
||||||
</Authorized>
|
|
||||||
<div class="col text-end">
|
<div class="col text-end">
|
||||||
<button type="submit" class="btn btn-primary"><i class="bi-cloud-upload"></i> Gem</button>
|
<button type="submit" class="btn btn-primary"><i class="bi-cloud-arrow-up"></i> Gem</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</EditForm>
|
|
|
@ -30,65 +30,76 @@
|
||||||
<EditForm EditContext="NewUserContext" OnValidSubmit="CreateUserRequest">
|
<EditForm EditContext="NewUserContext" OnValidSubmit="CreateUserRequest">
|
||||||
<DataAnnotationsValidator/>
|
<DataAnnotationsValidator/>
|
||||||
<div class="row g-3 mb-3">
|
<div class="row g-3 mb-3">
|
||||||
<label for="firstName" class="col-sm-2 col-form-label">Fornavn</label>
|
@* firstName *@
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-6">
|
||||||
<InputText id="firstName" class="form-control" @bind-Value="NewUserInfo.FirstName"/>
|
<div class="form-floating">
|
||||||
|
<InputText id="firstName" class="form-control" @bind-Value="NewUserInfo.FirstName" placeholder="Fornavn"/>
|
||||||
<ValidationMessage For="@(() => NewUserInfo.FirstName)"></ValidationMessage>
|
<ValidationMessage For="@(() => NewUserInfo.FirstName)"></ValidationMessage>
|
||||||
|
<label for="firstName">Fornavn</label>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<label for="lastName" class="col-sm-2 col-form-label">Efternavn</label>
|
@* lastName *@
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-6">
|
||||||
<InputText id="lastName" class="form-control" @bind-Value="NewUserInfo.LastName"/>
|
<div class="form-floating">
|
||||||
|
<InputText id="lastName" class="form-control" @bind-Value="NewUserInfo.LastName" placeholder="Efternavn"/>
|
||||||
<ValidationMessage For="@(() => NewUserInfo.LastName)"></ValidationMessage>
|
<ValidationMessage For="@(() => NewUserInfo.LastName)"></ValidationMessage>
|
||||||
|
<label for="lastName">Efternavn</label>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<label for="email" class="col-sm-2 col-form-label">Email</label>
|
@* email *@
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-6">
|
||||||
<InputText id="email" class="form-control" @bind-Value="NewUserInfo.Email"/>
|
<div class="form-floating">
|
||||||
|
<InputText id="email" class="form-control" @bind-Value="NewUserInfo.Email" placeholder="Email"/>
|
||||||
<ValidationMessage For="@(() => NewUserInfo.Email)"></ValidationMessage>
|
<ValidationMessage For="@(() => NewUserInfo.Email)"></ValidationMessage>
|
||||||
|
<label for="email">Email</label>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<label for="phoneNumber" class="col-sm-2 col-form-label">Mobil</label>
|
@* phoneNumber *@
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-6">
|
||||||
<InputText id="phoneNumber" class="form-control" @bind-Value="NewUserInfo.PhoneNumber"/>
|
<div class="form-floating">
|
||||||
|
<InputText id="phoneNumber" class="form-control" @bind-Value="NewUserInfo.PhoneNumber" placeholder="Direkte Telefon Nr."/>
|
||||||
<ValidationMessage For="@(() => NewUserInfo.PhoneNumber)"></ValidationMessage>
|
<ValidationMessage For="@(() => NewUserInfo.PhoneNumber)"></ValidationMessage>
|
||||||
|
<label for="phoneNumber">Direkte Telefon Nr.</label>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<label for="salesRep" class="col-sm-2 col-form-label">Sælgernr</label>
|
@* salesRep *@
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-6">
|
||||||
<InputText id="salesRep" class="form-control" @bind-Value="NewUserInfo.SalesRep"/>
|
<div class="form-floating">
|
||||||
|
<InputText id="salesRep" class="form-control" @bind-Value="NewUserInfo.SalesRep" placeholder="Sælger"/>
|
||||||
<ValidationMessage For="@(() => NewUserInfo.SalesRep)"></ValidationMessage>
|
<ValidationMessage For="@(() => NewUserInfo.SalesRep)"></ValidationMessage>
|
||||||
|
<label for="salesRep">Sælger</label>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<label for="countryCode" class="col-sm-2 col-form-label">Landekode</label>
|
@* countrycode *@
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-6">
|
||||||
<InputText id="countryCode" class="form-control" @bind-Value="NewUserInfo.CountryCode"/>
|
<div class="form-floating">
|
||||||
|
<InputSelect id="countryCode" class="form-control" @bind-Value="NewUserInfo.CountryCode" placeholder="Landekode">
|
||||||
|
<option value="" disabled>Klik for valg</option>
|
||||||
|
<option value="DK">Danmark</option>
|
||||||
|
<option value="NO">Norge</option>
|
||||||
|
<option value="SE">Sverige</option>
|
||||||
|
</InputSelect>
|
||||||
<ValidationMessage For="@(() => NewUserInfo.CountryCode)"></ValidationMessage>
|
<ValidationMessage For="@(() => NewUserInfo.CountryCode)"></ValidationMessage>
|
||||||
|
<label for="countryCode">Landekode</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@*
|
|
||||||
<div class="ms-2 col-sm-4 form-check form-switch">
|
|
||||||
<label for="lockoutEnabled" class="form-check-label">Spærret</label>
|
|
||||||
<InputCheckbox id="lockoutEnabled" class="form-check-input" @bind-Value="NewUserInfo.LockoutEnabled"/>
|
|
||||||
<ValidationMessage For="@(() => NewUserInfo.LockoutEnabled)"></ValidationMessage>
|
|
||||||
</div>
|
</div>
|
||||||
*@
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
<div class="ms-2 col-sm-2 form-check form-switch">
|
<div class="ms-2 col-sm-2 form-check form-switch">
|
||||||
<InputCheckbox id="admin" class="form-check-input" @bind-Value="AssignedRoles.Admin"/>
|
<InputCheckbox id="admin" class="form-check-input" @bind-Value="AssignedRoles.Admin"/>
|
||||||
<label for="admin" class="form-check-label">Administrator</label>
|
<label for="admin" class="form-check-label">Administrator</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ms-2 col-sm-2 form-check form-switch">
|
||||||
|
<InputCheckbox id="warehouse" class="form-check-input" @bind-Value="AssignedRoles.Warehouse"/>
|
||||||
|
<label for="warehouse" class="form-check-label">Forsendelse</label>
|
||||||
|
</div>
|
||||||
<div class="ms-2 col-sm-2 form-check form-switch">
|
<div class="ms-2 col-sm-2 form-check form-switch">
|
||||||
<InputCheckbox id="office" class="form-check-input" @bind-Value="AssignedRoles.Office"/>
|
<InputCheckbox id="office" class="form-check-input" @bind-Value="AssignedRoles.Office"/>
|
||||||
<label for="office" class="form-check-label">Kontor</label>
|
<label for="office" class="form-check-label">Kontor</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="ms-2 col-sm-2 form-check form-switch">
|
<div class="ms-2 col-sm-2 form-check form-switch">
|
||||||
<InputCheckbox id="eshop" class="form-check-input" @bind-Value="AssignedRoles.EShop"/>
|
<InputCheckbox id="eshop" class="form-check-input" @bind-Value="AssignedRoles.EShop"/>
|
||||||
<label for="eshop" class="form-check-label">Kunde (EShop)</label>
|
<label for="eshop" class="form-check-label">WebShop Kunde</label>
|
||||||
</div>
|
|
||||||
<div class="ms-2 col-sm-2 form-check form-switch">
|
|
||||||
<InputCheckbox id="warehouse" class="form-check-input" @bind-Value="AssignedRoles.Warehouse"/>
|
|
||||||
<label for="warehouse" class="form-check-label">Forsendelse</label>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="ms-2 col-sm-2 form-check form-switch">
|
<div class="ms-2 col-sm-2 form-check form-switch">
|
||||||
<InputCheckbox id="management" class="form-check-input" @bind-Value="AssignedRoles.Management"/>
|
<InputCheckbox id="management" class="form-check-input" @bind-Value="AssignedRoles.Management"/>
|
||||||
|
@ -104,12 +115,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col">
|
<div class="col-sm-6">
|
||||||
|
<a class="btn btn-primary" href="/system/users"><i class="bi-back"></i> Tilbage</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col-sm-6 text-end">
|
||||||
<a class="btn btn-primary" href="/system/users">Tilbage</a>
|
|
||||||
</div>
|
|
||||||
<div class="col text-end">
|
|
||||||
<button type="submit" class="btn btn-primary" disabled="@ContextInvalid">Gem</button>
|
<button type="submit" class="btn btn-primary" disabled="@ContextInvalid">Gem</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -118,17 +127,19 @@
|
||||||
<p>Mindst 10 tegn bestående af store og små bogstaver samt tal. Password generator <a href="https://pw.nix.dk">pw.nix.dk</a></p>
|
<p>Mindst 10 tegn bestående af store og små bogstaver samt tal. Password generator <a href="https://pw.nix.dk">pw.nix.dk</a></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label for="newPasswd" class="col-md-2 col-form-label">Ny</label>
|
<div class="col-sm-6">
|
||||||
<div class="col-md-10">
|
<div class="form-floating">
|
||||||
<InputText id="newPasswd" class="form-control" @bind-Value="@PasswdInput.NewPassword"/>
|
<InputText id="newPasswd" class="form-control" @bind-Value="@PasswdInput.NewPassword" placeholder="Ny Adgangskode"/>
|
||||||
<ValidationMessage For="@(() => PasswdInput.NewPassword)"></ValidationMessage>
|
<ValidationMessage For="@(() => PasswdInput.NewPassword)"></ValidationMessage>
|
||||||
|
<label for="newPasswd">Ny Adgangskode</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-3">
|
<div class="col-sm-6">
|
||||||
<label for="verifyPasswd" class="col-md-2 col-form-label">Bekræft</label>
|
<div class="form-floating">
|
||||||
<div class="col-md-10">
|
<InputText id="verifyPasswd" class="form-control" @bind-Value="@PasswdInput.ConfirmPassword" placeholder="Gentag Adgangskode"/>
|
||||||
<InputText id="verifyPasswd" class="form-control" @bind-Value="@PasswdInput.ConfirmPassword"/>
|
|
||||||
<ValidationMessage For="@(() => PasswdInput.ConfirmPassword)"></ValidationMessage>
|
<ValidationMessage For="@(() => PasswdInput.ConfirmPassword)"></ValidationMessage>
|
||||||
|
<label for="verifyPasswd">Gentag Adgangskode</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</EditForm>
|
</EditForm>
|
||||||
|
|
|
@ -45,11 +45,8 @@ public partial class SystemUserCreatePage : IDisposable
|
||||||
private PasswordInput PasswdInput { get; set; } = new();
|
private PasswordInput PasswdInput { get; set; } = new();
|
||||||
private RoleAssignment AssignedRoles { get; set; } = new();
|
private RoleAssignment AssignedRoles { get; set; } = new();
|
||||||
|
|
||||||
private readonly JsonSerializerOptions _options = new JsonSerializerOptions
|
private readonly JsonSerializerOptions _options = new() { PropertyNameCaseInsensitive = true };
|
||||||
{
|
private bool _webShop;
|
||||||
PropertyNameCaseInsensitive = true
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
|
@ -90,6 +87,23 @@ public partial class SystemUserCreatePage : IDisposable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (AssignedRoles.EShop)
|
||||||
|
{
|
||||||
|
AssignedRoles.Admin = false;
|
||||||
|
AssignedRoles.Advisor = false;
|
||||||
|
AssignedRoles.EDoc = false;
|
||||||
|
AssignedRoles.Management = false;
|
||||||
|
AssignedRoles.Office = false;
|
||||||
|
AssignedRoles.Supervisor = false;
|
||||||
|
AssignedRoles.Warehouse = false;
|
||||||
|
_webShop = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_webShop = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NewUserInfo.Passwd = PasswdInput.NewPassword;
|
NewUserInfo.Passwd = PasswdInput.NewPassword;
|
||||||
ContextInvalid = !NewUserContext.Validate();
|
ContextInvalid = !NewUserContext.Validate();
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|
|
@ -21,10 +21,13 @@
|
||||||
|
|
||||||
<PageTitle>System Bruger Oversigt</PageTitle>
|
<PageTitle>System Bruger Oversigt</PageTitle>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col-sm-8">
|
||||||
<h3>System Bruger Oversigt</h3>
|
<h3>System Bruger Oversigt</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col-sm-3 text-end">
|
||||||
|
<a class="btn btn-primary" href="/system/users/create"><i class="bi-plus-lg"></i>Opret bruger</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1">
|
||||||
<div class="text-end">
|
<div class="text-end">
|
||||||
<div class="busy-signal" style="display:@(Working ? "block" : "none")">
|
<div class="busy-signal" style="display:@(Working ? "block" : "none")">
|
||||||
<div class="spinner-grow text-info" role="status">
|
<div class="spinner-grow text-info" role="status">
|
||||||
|
@ -35,27 +38,24 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-5">
|
||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
<div class="list-group-item">
|
<div class="list-group-item">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-1 mt-3">
|
<div class="col-sm-3">
|
||||||
|
<div class="fw-bold">Navn</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4 mt-3">
|
<div class="col-sm-3">
|
||||||
<div class="h4">Navn</div>
|
<div class="fw-bold">Email</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-3 mt-3">
|
<div class="col-sm-2">
|
||||||
<div class="h4">Email</div>
|
<div class="fw-bold">Telefon</div>
|
||||||
</div>
|
|
||||||
<div class="col-sm-2 mt-3">
|
|
||||||
<div class="h4">Telefon</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-2 text-end mt-1">
|
|
||||||
<a class="btn btn-primary" href="/system/users/create"><i class="bi-plus-lg"></i>Opret bruger</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-sm-4 text-end">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@if (UserList.Any())
|
@if (UserList.Any())
|
||||||
{
|
{
|
||||||
|
@ -63,10 +63,7 @@
|
||||||
{
|
{
|
||||||
<a class="list-group-item list-group-item-action" href="/system/users/@user.UserId">
|
<a class="list-group-item list-group-item-action" href="/system/users/@user.UserId">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-1">
|
<div class="col-sm-3">
|
||||||
@user.CountryCode @user.SalesRep
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-4">
|
|
||||||
@user.FullName
|
@user.FullName
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
|
@ -75,11 +72,12 @@
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
@user.PhoneNumber
|
@user.PhoneNumber
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-4">
|
||||||
@user.Description
|
@user.Description
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -30,6 +30,7 @@ public partial class SystemUserListPage : IDisposable
|
||||||
|
|
||||||
// #############################################################
|
// #############################################################
|
||||||
private List<UserInfoListView> UserList { get; set; } = new();
|
private List<UserInfoListView> UserList { get; set; } = new();
|
||||||
|
private List<UserInfoListView> DisplayList { get; set; } = new();
|
||||||
private bool Working { get; set; } = true;
|
private bool Working { get; set; } = true;
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +40,12 @@ public partial class SystemUserListPage : IDisposable
|
||||||
Interceptor.RegisterBeforeSendEvent();
|
Interceptor.RegisterBeforeSendEvent();
|
||||||
|
|
||||||
UserList = await UserRepo.GetUsers();
|
UserList = await UserRepo.GetUsers();
|
||||||
|
if (UserList.Any())
|
||||||
|
{
|
||||||
|
UserList = UserList.Where(x => !x.LockoutEnabled).ToList();
|
||||||
|
}
|
||||||
|
DisplayList = UserList;
|
||||||
|
|
||||||
Working = false;
|
Working = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,35 +112,37 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Roller</th>
|
<th scope="col">Roller</th>
|
||||||
<td>
|
<td colspan="5">
|
||||||
|
<div class="row">
|
||||||
<div class="ms-2 col-sm-2 form-check form-switch">
|
<div class="ms-2 col-sm-2 form-check form-switch">
|
||||||
<InputCheckbox id="admin" class="form-check-input" disabled="@ReadOnly" @bind-Value="AssignedRoles.Admin"/>
|
<InputCheckbox id="admin" class="form-check-input" @bind-Value="AssignedRoles.Admin"/>
|
||||||
<label for="admin" class="form-check-label">Administrator</label>
|
<label for="admin" class="form-check-label">Administrator</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="ms-2 col-sm-2 form-check form-switch">
|
<div class="ms-2 col-sm-2 form-check form-switch">
|
||||||
<InputCheckbox id="office" class="form-check-input" disabled="@ReadOnly" @bind-Value="AssignedRoles.Office"/>
|
<InputCheckbox id="warehouse" class="form-check-input" @bind-Value="AssignedRoles.Warehouse"/>
|
||||||
|
<label for="warehouse" class="form-check-label">Lager</label>
|
||||||
|
</div>
|
||||||
|
<div class="ms-2 col-sm-2 form-check form-switch">
|
||||||
|
<InputCheckbox id="office" class="form-check-input" @bind-Value="AssignedRoles.Office"/>
|
||||||
<label for="office" class="form-check-label">Kontor</label>
|
<label for="office" class="form-check-label">Kontor</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="ms-2 col-sm-2 form-check form-switch">
|
<div class="ms-2 col-sm-2 form-check form-switch">
|
||||||
<InputCheckbox id="eshop" class="form-check-input" disabled="@ReadOnly" @bind-Value="AssignedRoles.EShop"/>
|
<InputCheckbox id="eshop" class="form-check-input" @bind-Value="AssignedRoles.EShop"/>
|
||||||
<label for="eshop" class="form-check-label">Kunde</label>
|
<label for="eshop" class="form-check-label">WebShop Kunde</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="ms-2 col-sm-2 form-check form-switch">
|
<div class="ms-2 col-sm-2 form-check form-switch">
|
||||||
<InputCheckbox id="warehouse" class="form-check-input" disabled="@ReadOnly" @bind-Value="AssignedRoles.Warehouse"/>
|
<InputCheckbox id="management" class="form-check-input" @bind-Value="AssignedRoles.Management"/>
|
||||||
<label for="warehouse" class="form-check-label">Forsendelse</label>
|
|
||||||
</div>
|
|
||||||
<div class="ms-2 col-sm-2 form-check form-switch">
|
|
||||||
<InputCheckbox id="management" class="form-check-input" disabled="@ReadOnly" @bind-Value="AssignedRoles.Management"/>
|
|
||||||
<label for="management" class="form-check-label">Ledelse</label>
|
<label for="management" class="form-check-label">Ledelse</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="ms-2 col-sm-2 form-check form-switch">
|
<div class="ms-2 col-sm-2 form-check form-switch">
|
||||||
<InputCheckbox id="supervisor" class="form-check-input" disabled="@ReadOnly" @bind-Value="AssignedRoles.Supervisor"/>
|
<InputCheckbox id="supervisor" class="form-check-input" @bind-Value="AssignedRoles.Supervisor"/>
|
||||||
<label for="supervisor" class="form-check-label">Supervisor</label>
|
<label for="supervisor" class="form-check-label">Supervisor</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="ms-2 col-sm-2 form-check form-switch">
|
<div class="ms-2 col-sm-2 form-check form-switch">
|
||||||
<InputCheckbox id="advisor" class="form-check-input" disabled="@ReadOnly" @bind-Value="AssignedRoles.Advisor"/>
|
<InputCheckbox id="advisor" class="form-check-input" @bind-Value="AssignedRoles.Advisor"/>
|
||||||
<label for="advisor" class="form-check-label">Sælger</label>
|
<label for="advisor" class="form-check-label">Sælger</label>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -149,16 +151,16 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<button type="button" class="btn btn-danger" disabled="@ReadOnly" @onclick="@SendDeleteRequest">SLET</button>
|
<button type="button" class="btn btn-danger" disabled="@ReadOnly" @onclick="@SendDeleteRequest"><i class="bi-trash"></i> SLET</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<button type="button" class="btn btn-warning" @onclick="@(() => ReadOnly = !ReadOnly)">Rediger</button>
|
<button type="button" class="btn btn-warning" @onclick="@(() => ReadOnly = !ReadOnly)"><i class="bi-pencil"></i> Rediger</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<button type="submit" class="btn btn-primary" disabled="@ReadOnly">Gem</button>
|
<button type="submit" class="btn btn-primary" disabled="@ReadOnly"><i class="bi-cloud-arrow-up"></i> Gem</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<a class="btn btn-primary" href="/system/users">Tilbage</a>
|
<a class="btn btn-primary" href="/system/users"><i class="bi-back-lg"></i> Tilbage</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</EditForm>
|
</EditForm>
|
||||||
|
|
|
@ -131,8 +131,8 @@
|
||||||
<AuthorizeView Roles="Management">
|
<AuthorizeView Roles="Management">
|
||||||
<Authorized>
|
<Authorized>
|
||||||
<div class="nav-item px-3">
|
<div class="nav-item px-3">
|
||||||
<NavLink class="nav-link ps-2" href="/management">
|
<NavLink class="nav-link ps-2" href="/manager">
|
||||||
<i class="bi-people pe-2" style="font-size:1.3em;" aria-hidden="true"></i> Management
|
<i class="bi-people pe-2" style="font-size:1.3em;" aria-hidden="true"></i> Manager
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
</Authorized>
|
</Authorized>
|
||||||
|
|
|
@ -26,6 +26,8 @@ public class UserInfoListView
|
||||||
|
|
||||||
public string FullName { get; set; } = "";
|
public string FullName { get; set; } = "";
|
||||||
|
|
||||||
|
public bool LockoutEnabled { get; set; }
|
||||||
|
|
||||||
public string PhoneNumber { get; set; } = "";
|
public string PhoneNumber { get; set; } = "";
|
||||||
|
|
||||||
public string SalesRep { get; set; } = "";
|
public string SalesRep { get; set; } = "";
|
||||||
|
|
Loading…
Reference in a new issue