publish v0.10.16
This commit is contained in:
parent
128c29c798
commit
331a9fbcf7
71 changed files with 491 additions and 672 deletions
|
@ -50,7 +50,3 @@
|
|||
</tbody>
|
||||
</table>
|
||||
}
|
||||
else
|
||||
{
|
||||
<LoaderBallTriangle />
|
||||
}
|
|
@ -78,5 +78,5 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<LoaderBallTriangle />
|
||||
<LoaderThreeDots />
|
||||
}
|
|
@ -54,5 +54,5 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<LoaderBallTriangle />
|
||||
<LoaderThreeDots />
|
||||
}
|
|
@ -84,5 +84,5 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<LoaderBallTriangle />
|
||||
<LoaderThreeDots />
|
||||
}
|
|
@ -51,5 +51,5 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<LoaderBallTriangle />
|
||||
<LoaderThreeDots />
|
||||
}
|
|
@ -15,53 +15,65 @@
|
|||
//
|
||||
*@
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr class="bg-black bg-opacity-50 text-white">
|
||||
<th scope="col">Farvekode</th>
|
||||
<th scope="col">Betydning</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="color-code">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<img class="state the-good rounded-circle me-1" src="state.png" alt="state"/>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
Er besøgt.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
</div>
|
||||
<div class="col-10">
|
||||
Er nylig besøgt
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<img class="state the-bad rounded-circle me-1" src="state.png" alt="state"/>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
Planlæg besøg.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
</div>
|
||||
<div class="col-10">
|
||||
Planlagt besøg
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<img class="state the-ugly rounded-circle me-1" src="state.png" alt="state"/>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
Besøges nu!
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
</div>
|
||||
<div class="col-10">
|
||||
Besøgsinterval overskredet
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<img class="state the-draw rounded-circle me-1" src="state.png" alt="state"/>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
Opdater besøgsdato og/eller CVR/ORG nummer.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
</div>
|
||||
<div class="col-10">
|
||||
Ajourfør besøgsdato/interval
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<img class="state no-vat rounded-circle me-1" src="state.png" alt="state"/>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
CVR/ORG nummer ugyldig
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<img class="state the-dead rounded-circle me-1" src="state.png" alt="state"/>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
Virksomhed ophørt!
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
Virksomhed ophørt
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -36,8 +36,7 @@
|
|||
{
|
||||
<tr @onclick="() => { ViewCustomer(company.CompanyId); }" style="cursor: pointer">
|
||||
<td class="state align-middle">
|
||||
<DisplayStateComponent StateClass="@(company.HasFolded == 1 ? "the-dead" : Utils.GetVisitState(company.NextVisit))">
|
||||
</DisplayStateComponent>
|
||||
<DisplayStateComponent StateClass="@(company.HasFolded == 1 ? "the-dead" : Utils.GetVisitState(company.NextVisit))" />
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
@company.Name
|
||||
|
@ -52,12 +51,8 @@
|
|||
@company.City
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<ActivityButton CompanyId="@company.CompanyId"
|
||||
ActionLink="/companies/$ID$/activities/new"
|
||||
ButtonText="Besøg"
|
||||
ButtonType="primary"
|
||||
Enabled="@company.ValidVat">
|
||||
</ActivityButton>
|
||||
<ActivityButton CompanyId="@company.CompanyId" ActionLink="/companies/$ID$/activities/new"
|
||||
ButtonText="Besøg" ButtonType="primary" Enabled="@company.ValidVat" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
@ -67,5 +62,5 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<LoaderBallTriangle />
|
||||
<LoaderThreeDots />
|
||||
}
|
|
@ -24,7 +24,7 @@ using Wonky.Entity.Views;
|
|||
|
||||
namespace Wonky.Client.Components
|
||||
{
|
||||
public partial class CompanyTableComponent
|
||||
public partial class CustomerTableComponent
|
||||
{
|
||||
[Parameter] public List<CompanyDto> Companies { get; set; } = new();
|
||||
[Parameter] public EventCallback<string> OnDelete { get; set; }
|
|
@ -15,7 +15,7 @@
|
|||
//
|
||||
*@
|
||||
|
||||
<img class="img-fluid float-start rounded-circle state @StateClass me-1" src="state.png" alt="state"/>
|
||||
<img class="img-fluid float-start border border-secondary rounded-circle state @StateClass me-1" src="state.png" alt="state"/>
|
||||
@code{
|
||||
[Parameter] public string StateClass { get; set; } = "";
|
||||
}
|
||||
|
|
|
@ -55,5 +55,5 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<LoaderBallTriangle />
|
||||
<LoaderThreeDots />
|
||||
}
|
|
@ -15,12 +15,7 @@
|
|||
//
|
||||
*@
|
||||
|
||||
@if (Loading)
|
||||
{
|
||||
<div class="m-5 @(Loading ? "visible" : "invisible")">
|
||||
<div class="d-flex justify-content-center">
|
||||
<!-- loader credit: samherbert.net/svg-loaders -->
|
||||
<img src="/svg-loaders/bars.svg" alt="loading ..."/>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@using Wonky.Client.Components
|
||||
|
||||
<PageTitle>Inno Web CRM</PageTitle>
|
|
@ -29,10 +29,10 @@ using Wonky.Entity.Models;
|
|||
using Wonky.Entity.Views;
|
||||
|
||||
namespace Wonky.Client.Components;
|
||||
public partial class AdvisorLandingComponent : IDisposable
|
||||
public partial class LandingComponentAdmin : IDisposable
|
||||
{
|
||||
[Inject] private UserPreferenceService _preferenceService { get; set; }
|
||||
[Inject] private ILogger<AdvisorLandingComponent> _logger { get; set; }
|
||||
[Inject] private ILogger<LandingComponentAdmin> _logger { get; set; }
|
||||
[Inject] private HttpInterceptorService _interceptor { get; set; }
|
||||
[Inject] private IToastService _toast { get; set; }
|
||||
[Inject] private ITaskItemHttpRepository _taskItemRepo { get; set; }
|
|
@ -19,6 +19,7 @@
|
|||
@using Wonky.Client.Components
|
||||
|
||||
<PageTitle>Inno Web CRM</PageTitle>
|
||||
|
||||
<AuthorizeView Roles="Advisor">
|
||||
<div class="alert bg-light border-dark">
|
||||
<div class="row">
|
||||
|
@ -26,22 +27,11 @@
|
|||
<h2 style="font-variant: all-small-caps">@(DateTime.Now.ToLongDateString())</h2>
|
||||
</div>
|
||||
<div class="col">
|
||||
<WorkDateComponent SelectedDate="@_today" OnChanged="GetTaskItems"></WorkDateComponent>
|
||||
<WorkDateComponent SelectedDate="@_today" OnChanged="GetWorkdateTasks" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<TaskItemTableComponent TaskItemList="_taskItems" OnCompleteTask="OnCompleteTask"
|
||||
OnDeleteTask="OnDeleteConfirmed" OnTaskCompleted="OnTaskCompleted" />
|
||||
</AuthorizeView>
|
||||
|
||||
<AuthorizeView Roles="Admin">
|
||||
<h2>Administrator</h2>
|
||||
</AuthorizeView>
|
||||
|
||||
<AuthorizeView Roles="Warehouse">
|
||||
<h2>Lager</h2>
|
||||
</AuthorizeView>
|
||||
|
||||
<AuthorizeView Roles="Supervisor">
|
||||
<h2>Supervisor</h2>
|
||||
</AuthorizeView>
|
107
Wonky.Client/Components/LandingComponentAdvisor.razor.cs
Normal file
107
Wonky.Client/Components/LandingComponentAdvisor.razor.cs
Normal file
|
@ -0,0 +1,107 @@
|
|||
|
||||
// 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 Blazored.LocalStorage;
|
||||
using Blazored.Toast.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.VisualBasic;
|
||||
using Wonky.Client.HttpInterceptors;
|
||||
using Wonky.Client.HttpRepository;
|
||||
using Wonky.Client.Services;
|
||||
using Wonky.Client.Shared;
|
||||
using Wonky.Entity.DTO;
|
||||
using Wonky.Entity.Models;
|
||||
using Wonky.Entity.Views;
|
||||
|
||||
namespace Wonky.Client.Components;
|
||||
public partial class LandingComponentAdvisor : IDisposable
|
||||
{
|
||||
[Inject] private UserPreferenceService _preferenceService { get; set; }
|
||||
[Inject] private ILogger<LandingComponentAdvisor> _logger { get; set; }
|
||||
[Inject] private HttpInterceptorService _interceptor { get; set; }
|
||||
[Inject] private IToastService _toast { get; set; }
|
||||
[Inject] private ITaskItemHttpRepository _taskItemRepo { get; set; }
|
||||
[Inject] private NavigationManager _navigator { get; set; }
|
||||
|
||||
private readonly JsonSerializerOptions _options = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
|
||||
};
|
||||
|
||||
private Preferences _prefs { get; set; } = new();
|
||||
private string _workDate { get; set; } = $"{DateTime.Now:yyyy-MM-dd}";
|
||||
private string _today { get; set; } = $"{DateTime.Now:yyyy-MM-dd}";
|
||||
private List<TaskItemDto>? _taskItems { get; set; } = new();
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_prefs = await _preferenceService.GetPreferences();
|
||||
if(!string.IsNullOrWhiteSpace(_prefs.WorkDate))
|
||||
_workDate = _prefs.WorkDate;
|
||||
|
||||
_interceptor.RegisterEvent();
|
||||
_interceptor.RegisterBeforeSendEvent();
|
||||
|
||||
//await GetTaskItems(_workDate);
|
||||
await GetAllTasks();
|
||||
}
|
||||
|
||||
private async Task GetAllTasks()
|
||||
{
|
||||
_taskItems = await _taskItemRepo.GetTaskList();
|
||||
}
|
||||
|
||||
private async Task OnCompleteTask(string taskItemId)
|
||||
{
|
||||
await _preferenceService.SetWorkDate(DateTime.Now);
|
||||
var item = _taskItems.Find(x => x.TaskItemId == taskItemId);
|
||||
_navigator.NavigateTo($"/companies/{item.ReferenceId}/activities/new");
|
||||
}
|
||||
|
||||
private async Task GetWorkdateTasks(string workDate)
|
||||
{
|
||||
_workDate = workDate;
|
||||
_taskItems = new List<TaskItemDto>();
|
||||
_taskItems = await _taskItemRepo.GetTaskList(workDate);
|
||||
}
|
||||
|
||||
private async Task OnTaskCompleted(string taskItemId)
|
||||
{
|
||||
var item = _taskItems.Find(x => x.TaskItemId == taskItemId);
|
||||
item.IsCompleted = true;
|
||||
await _taskItemRepo.UpdateTaskItem(taskItemId, item);
|
||||
_taskItems.Remove(item);
|
||||
_toast.ShowInfo("Opgaven er markeret som udført.");
|
||||
}
|
||||
|
||||
private async Task OnDeleteConfirmed(string taskItemId)
|
||||
{
|
||||
var item = _taskItems.First(x => x.TaskItemId == taskItemId);
|
||||
_taskItems.Remove(item);
|
||||
await _taskItemRepo.DeleteTaskItem(taskItemId);
|
||||
_toast.ShowInfo("Opgaven er slettet.");
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_interceptor.DisposeEvent();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
.workDate {
|
||||
font-size: 1.2em;
|
||||
font-weight: bold;
|
||||
font-variant: small-caps;
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
|
||||
namespace Wonky.Client.Components;
|
||||
|
||||
public partial class LoaderBallTriangle
|
||||
{
|
||||
private bool Loading { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Loading = true;
|
||||
|
||||
await Task.Delay(10000);
|
||||
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
|
||||
namespace Wonky.Client.Components;
|
||||
|
||||
public partial class LoaderBars
|
||||
{
|
||||
private bool Loading { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Loading = true;
|
||||
|
||||
await Task.Delay(10000);
|
||||
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
@*
|
||||
// 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]
|
||||
//
|
||||
*@
|
||||
|
||||
@if (Loading)
|
||||
{
|
||||
<div class="m-5 @(Loading ? "visible" : "invisible")">
|
||||
<div class="d-flex justify-content-center">
|
||||
<!-- loader credit: samherbert.net/svg-loaders -->
|
||||
<img src="/svg-loaders/tail-spin.svg" alt="loading ..."/>
|
||||
</div>
|
||||
</div>
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
|
||||
namespace Wonky.Client.Components;
|
||||
|
||||
public partial class LoaderSnake
|
||||
{
|
||||
private bool Loading { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Loading = true;
|
||||
|
||||
await Task.Delay(10000);
|
||||
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -20,7 +20,7 @@
|
|||
<div class="m-5 @(Loading ? "visible" : "invisible")">
|
||||
<div class="d-flex justify-content-center">
|
||||
<!-- loader credit: samherbert.net/svg-loaders -->
|
||||
<img src="/svg-loaders/ball-triangle" alt="loading ..."/>
|
||||
<img src="/svg-loaders/three-dots.svg" alt="loading ..."/>
|
||||
</div>
|
||||
</div>
|
||||
}
|
15
Wonky.Client/Components/LoaderThreeDots.razor.cs
Normal file
15
Wonky.Client/Components/LoaderThreeDots.razor.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Wonky.Client.Components;
|
||||
|
||||
public partial class LoaderThreeDots
|
||||
{
|
||||
[Parameter] public bool Loading { get; set; } = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(30000);
|
||||
Loading = false;
|
||||
}
|
||||
}
|
5
Wonky.Client/Components/OrderCreateComponent.razor
Normal file
5
Wonky.Client/Components/OrderCreateComponent.razor
Normal file
|
@ -0,0 +1,5 @@
|
|||
<h3>OrderCreateComponent</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
28
Wonky.Client/Components/OrderCreateComponent.razor.cs
Normal file
28
Wonky.Client/Components/OrderCreateComponent.razor.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using Wonky.Client.HttpInterceptors;
|
||||
using Wonky.Client.HttpRepository;
|
||||
using Wonky.Entity.DTO;
|
||||
|
||||
namespace Wonky.Client.Components;
|
||||
|
||||
public partial class OrderCreateComponent : IDisposable
|
||||
{
|
||||
[Parameter] public string CustomerId { get; set; } = "";
|
||||
|
||||
[Inject] private ICompanyHttpRepository _companyRepo { get; set; }
|
||||
[Inject] private HttpInterceptorService _interceptor { get; set; }
|
||||
|
||||
private CompanyDto _company { get; set; }
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
_interceptor.RegisterEvent();
|
||||
_interceptor.RegisterBeforeSendEvent();
|
||||
_company = await _companyRepo.GetCompanyById(CustomerId);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_interceptor.DisposeEvent();
|
||||
}
|
||||
}
|
|
@ -82,5 +82,5 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<LoaderBallTriangle />
|
||||
<LoaderThreeDots />
|
||||
}
|
|
@ -46,22 +46,22 @@
|
|||
</td>
|
||||
<td class="align-middle">
|
||||
<button type="button" class="btn btn-light border-dark" @onclick="() => CallConfirmationModal(task.TaskItemId)">
|
||||
Slet
|
||||
<i class="oi oi-circle-x"></i>
|
||||
</button>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<button type="button" class="btn btn-light border-dark" @onclick="() => TaskCompleted(task.TaskItemId)">
|
||||
Check <i class="oi oi-check"></i>
|
||||
<i class="oi oi-check"></i>
|
||||
</button>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
@if (task.TaskTypeEnum is "Recall")
|
||||
{
|
||||
<a class="btn btn-light border-dark pe-3" href="/companies/@task.ReferenceId">
|
||||
Ændre
|
||||
<a class="btn btn-light border-dark pe-3 me-2" href="/companies/@task.ReferenceId">
|
||||
<i class="oi oi-pencil"></i>
|
||||
</a>
|
||||
<button type="button" class="btn btn-primary" @onclick="() => CompleteTask(task.TaskItemId)">
|
||||
Besøg
|
||||
<i class="oi oi-map-marker"></i>
|
||||
</button>
|
||||
}
|
||||
</td>
|
||||
|
@ -73,5 +73,5 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<LoaderBallTriangle />
|
||||
<LoaderThreeDots />
|
||||
}
|
|
@ -35,11 +35,13 @@ public partial class VatAddressInputComponent : IDisposable
|
|||
{
|
||||
await OnValidSubmit.InvokeAsync(Address);
|
||||
}
|
||||
|
||||
private void HandleFieldChanged(object? sender, FieldChangedEventArgs e)
|
||||
{
|
||||
_formInvalid = !_editContext.Validate();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_editContext.OnFieldChanged -= HandleFieldChanged;
|
||||
|
|
|
@ -77,9 +77,5 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<LoaderBallTriangle />
|
||||
}
|
||||
|
||||
@code {
|
||||
|
||||
<LoaderThreeDots Loading="Loading" />
|
||||
}
|
|
@ -15,6 +15,7 @@ public partial class WarehouseListComponent
|
|||
private bool _readyToShip;
|
||||
|
||||
private List<WarehouseOrderView> _orders { get; set; }
|
||||
private bool Loading { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
@ -28,31 +29,39 @@ public partial class WarehouseListComponent
|
|||
|
||||
private async Task GetOrderStatusNone()
|
||||
{
|
||||
Loading = true;
|
||||
_orders = new List<WarehouseOrderView>();
|
||||
_orders = await _warehouseRepo.GetWarehouseOrderListByStatus("none");
|
||||
_readyToShip = false;
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
private async Task GetOrderStatusPicked()
|
||||
{
|
||||
Loading = true;
|
||||
_orders = new List<WarehouseOrderView>();
|
||||
_orders = await _warehouseRepo.GetWarehouseOrderListByStatus("picked");
|
||||
_readyToShip = false;
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
private async Task GetOrderStatusPacked()
|
||||
{
|
||||
Loading = true;
|
||||
_orders = new List<WarehouseOrderView>();
|
||||
_orders = await _warehouseRepo.GetWarehouseOrderListByStatus("packed");
|
||||
_readyToShip = true;
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
private async Task GetOrderStatusShipped()
|
||||
{
|
||||
Loading = true;
|
||||
_orders = new List<WarehouseOrderView>();
|
||||
var orderList = await _warehouseRepo.GetWarehouseOrderListByStatus("shipped");
|
||||
_orders = orderList.OrderByDescending(x => x.OrderDate).ToList();
|
||||
_readyToShip = false;
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
private async Task SetProcessStatusShipped()
|
||||
|
|
|
@ -56,6 +56,30 @@ public class CompanyHttpRepository : ICompanyHttpRepository
|
|||
_apiConfig = apiConfig.Value;
|
||||
}
|
||||
|
||||
public async Task<PagingResponse<CompanyDto>> GetAllCustomersPaged(CompanyPagingParams pagingParameters)
|
||||
{
|
||||
var queryString = new Dictionary<string, string>
|
||||
{
|
||||
["pageNumber"] = pagingParameters.PageNumber.ToString(),
|
||||
["pageSize"] = pagingParameters.PageSize.ToString(),
|
||||
["searchTerm"] = pagingParameters.SearchTerm,
|
||||
["searchColumn"] = pagingParameters.SearchColumn,
|
||||
["orderBy"] = pagingParameters.OrderBy,
|
||||
["isHidden"] = pagingParameters.IsHidden.ToString(),
|
||||
["hasFolded"] = pagingParameters.HasFolded.ToString()
|
||||
};
|
||||
var response = await _client.GetAsync(QueryHelpers.AddQueryString($"{_apiConfig.CrmCustomer}/page", queryString));
|
||||
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
|
||||
var pagingResponse = new PagingResponse<CompanyDto>
|
||||
{
|
||||
Items = JsonSerializer.Deserialize<List<CompanyDto>>(content, _options),
|
||||
MetaData = JsonSerializer.Deserialize<MetaData>(response.Headers.GetValues("X-Pagination").First(), _options)
|
||||
};
|
||||
return pagingResponse;
|
||||
|
||||
}
|
||||
public async Task<PagingResponse<CompanyDto>> GetCompaniesPaged(CompanyPagingParams pagingParameters)
|
||||
{
|
||||
var queryString = new Dictionary<string, string>
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Wonky.Client.HttpRepository;
|
|||
|
||||
public interface ICompanyHttpRepository
|
||||
{
|
||||
Task<PagingResponse<CompanyDto>> GetAllCustomersPaged(CompanyPagingParams pagingParameters);
|
||||
Task<PagingResponse<CompanyDto>> GetCompaniesPaged(CompanyPagingParams pagingParameters);
|
||||
Task<PagingResponse<CompanyDto>> GetAdminAdvisorCompaniesPaged(string userId, CompanyPagingParams pagingParameters);
|
||||
Task<CompanyDto> GetCompanyByAccount(string accountNumber);
|
||||
|
|
|
@ -352,7 +352,7 @@
|
|||
<div class="card-footer">
|
||||
@if (HideButtons)
|
||||
{
|
||||
<LoaderBallTriangle />
|
||||
<LoaderThreeDots />
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
@attribute [Authorize(Roles = "Advisor")]
|
||||
@page "/activity-today"
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="row mb-1 align-items-center">
|
||||
<div class="col-md-6">
|
||||
<h2 class="workDate">@(string.IsNullOrWhiteSpace(_workDate) ? "" : $"{DateTime.Parse(_workDate).ToLongDateString()}")</h2>
|
||||
|
@ -38,11 +36,15 @@
|
|||
{
|
||||
<a class="btn btn-primary" href="/sales-reports/new">RAPPORT</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if (ReportItemListView.ReportItems.Any())
|
||||
{
|
||||
<ActivityTableComponent Activities="ReportItemListView.ReportItems"></ActivityTableComponent>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<LoaderThreeDots Loading="Loading" />
|
||||
}
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ using Wonky.Entity.Views;
|
|||
|
||||
namespace Wonky.Client.Pages;
|
||||
|
||||
public partial class ActivityTodayListPage
|
||||
public partial class ActivityTodayListPage : IDisposable
|
||||
{
|
||||
[Inject] private UserPreferenceService _preferenceService { get; set; }
|
||||
[Inject] private ILogger<AdvisorLandingComponent> _logger { get; set; }
|
||||
[Inject] private ILogger<LandingComponentAdvisor> _logger { get; set; }
|
||||
[Inject] private HttpInterceptorService _interceptor { get; set; }
|
||||
[Inject] private NavigationManager _navigator { get; set; }
|
||||
[Inject] private IActivityHttpRepository _activityRepo { get; set; }
|
||||
|
@ -36,6 +36,7 @@ public partial class ActivityTodayListPage
|
|||
private Preferences _prefs { get; set; } = new();
|
||||
private string _workDate { get; set; } = $"{DateTime.Now:yyyy-MM-dd}";
|
||||
private bool _reportExist = false;
|
||||
private bool Loading { get; set; } = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
@ -45,7 +46,9 @@ public partial class ActivityTodayListPage
|
|||
|
||||
_interceptor.RegisterEvent();
|
||||
_interceptor.RegisterBeforeSendEvent();
|
||||
|
||||
_reportExist = await _reportRepo.ReportExist(_workDate);
|
||||
|
||||
await GetActivities(_workDate);
|
||||
}
|
||||
|
||||
|
@ -55,6 +58,7 @@ public partial class ActivityTodayListPage
|
|||
_workDate = workDate;
|
||||
ReportItemListView = new ReportItemListView();
|
||||
ReportItemListView = await _activityRepo.GetActivities(workDate);
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
@*
|
||||
// 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 Microsoft.AspNetCore.Authorization
|
||||
@attribute [Authorize(Roles = "Admin")]
|
||||
@page "/admin/users/office/{CountryCode}"
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header bg-dark text-white">
|
||||
<h3>Admins</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<AdminUserTableComponent UserList="_adminUsers"></AdminUserTableComponent>
|
||||
</div>
|
||||
</div>
|
|
@ -1,46 +0,0 @@
|
|||
// 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.Client.HttpInterceptors;
|
||||
using Wonky.Client.HttpRepository;
|
||||
using Wonky.Entity.DTO;
|
||||
using Wonky.Entity.Views;
|
||||
|
||||
namespace Wonky.Client.Pages;
|
||||
|
||||
public partial class AdminOfficeUserListPage : IDisposable
|
||||
{
|
||||
[Parameter] public string CountryCode { get; set; } = "";
|
||||
[Inject] private HttpInterceptorService _interceptor { get; set; }
|
||||
[Inject] private IUserHttpRepository _userRepo { get; set; }
|
||||
private List<UserListAdminView> _adminUsers { get; set; } = new();
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_interceptor.RegisterEvent();
|
||||
_interceptor.RegisterBeforeSendEvent();
|
||||
var AdvisorList = await _userRepo.GetAdminUsers();
|
||||
_adminUsers = AdvisorList
|
||||
.Where(x => x.CountryCode.ToLower() == CountryCode)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_interceptor.DisposeEvent();
|
||||
}
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
@*
|
||||
// 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]
|
||||
//
|
||||
*@
|
||||
|
||||
@page "/admin/users/office/{CountryCode}/{UserId}/view"
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@using Wonky.Client.Components
|
||||
@attribute [Authorize(Roles = "Admin")]
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header bg-dark text-white">
|
||||
<h3>Bruger info</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if (AdminUserInfo != null)
|
||||
{
|
||||
<EditForm EditContext="_editContext" OnValidSubmit="UpdateUser">
|
||||
<DataAnnotationsValidator/>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr class="align-middle">
|
||||
<th scope="col">
|
||||
Fornavn
|
||||
</th>
|
||||
<td>
|
||||
<InputText id="firstName" class="form-control" @bind-Value="_updateInfo.FirstName"/>
|
||||
<ValidationMessage For="@(() => _updateInfo.FirstName)"></ValidationMessage>
|
||||
</td>
|
||||
<th scope="col">
|
||||
Efternavn
|
||||
</th>
|
||||
<td>
|
||||
<InputText id="lastName" class="form-control" @bind-Value="_updateInfo.LastName"/>
|
||||
<ValidationMessage For="@(() => _updateInfo.LastName)"></ValidationMessage>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="align-middle">
|
||||
<th scope="col">
|
||||
Email
|
||||
</th>
|
||||
<td>
|
||||
<InputText id="email" class="form-control" @bind-Value="_updateInfo.Email"/>
|
||||
<ValidationMessage For="@(() => _updateInfo.Email)"></ValidationMessage>
|
||||
</td>
|
||||
<th scope="col">
|
||||
Mobilnummer
|
||||
</th>
|
||||
<td>
|
||||
<InputText id="phoneNumber" class="form-control" @bind-Value="_updateInfo.PhoneNumber"/>
|
||||
<ValidationMessage For="@(() => _updateInfo.PhoneNumber)"></ValidationMessage>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="align-middle">
|
||||
<th scope="col">
|
||||
Spærret
|
||||
</th>
|
||||
<td colspan="3">
|
||||
<InputCheckbox id="lockoutEnabled" class="form-check" @bind-Value="_updateInfo.LockoutEnabled"/>
|
||||
<ValidationMessage For="@(() => _updateInfo.LockoutEnabled)"></ValidationMessage>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button type="submit" class="btn btn-primary">Gem</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<a class="btn btn-primary" href="/admin/users/office/@CountryCode">Tilbage</a>
|
||||
</div>
|
||||
</div>
|
||||
</EditForm>
|
||||
<EditForm EditContext="_passwdContext" class="mt-5" >
|
||||
<DataAnnotationsValidator />
|
||||
<h3>NULSTIL ADGANGSKODE</h3>
|
||||
<div class="row mb-3">
|
||||
<label for="newPasswd" class="col-md-2 col-form-label">Ny</label>
|
||||
<div class="col-md-10">
|
||||
<InputText id="newPasswd" type="password" class="form-control" @bind-Value="@_passwords.NewPassword"/>
|
||||
<ValidationMessage For="@(() => _passwords.NewPassword)"></ValidationMessage>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label for="verifyPasswd" class="col-md-2 col-form-label">Bekræft</label>
|
||||
<div class="col-md-10">
|
||||
<InputText id="verifyPasswd" type="password" class="form-control" @bind-Value="@_passwords.ConfirmPassword"/>
|
||||
<ValidationMessage For="@(() => _passwords.ConfirmPassword)"></ValidationMessage>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col align-content-end">
|
||||
<button class="btn btn-warning" @onclick="SetPassword" disabled="@_pwInvalid">NULSTIL</button>
|
||||
</div>
|
||||
</div>
|
||||
</EditForm>
|
||||
}
|
||||
else
|
||||
{
|
||||
<LoaderBallTriangle />
|
||||
}
|
||||
</div>
|
||||
</div>
|
|
@ -1,108 +0,0 @@
|
|||
// 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.Security.Policy;
|
||||
using System.Text.Json;
|
||||
using Blazored.Toast.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Wonky.Client.HttpInterceptors;
|
||||
using Wonky.Client.HttpRepository;
|
||||
using Wonky.Entity.DTO;
|
||||
|
||||
namespace Wonky.Client.Pages;
|
||||
|
||||
public partial class AdminOfficeUserViewPage : IDisposable
|
||||
{
|
||||
[Parameter] public string UserId { get; set; } = "";
|
||||
[Parameter] public string CountryCode { get; set; } = "";
|
||||
[Inject] private HttpInterceptorService _interceptor { get; set; }
|
||||
[Inject] private IUserHttpRepository _userRepo { get; set; }
|
||||
[Inject] private ILogger<AdminAdvisorViewPage> _logger { get; set; }
|
||||
[Inject] private NavigationManager _navigator { get; set; }
|
||||
[Inject] private IToastService _toast { get; set; }
|
||||
private AdminUserInfoDto AdminUserInfo { get; set; } = new();
|
||||
private EditContext _editContext { get; set; }
|
||||
private UserUpdateDto _updateInfo { get; set; } = new();
|
||||
private AdminResetPasswordDto _passwords { get; set; } = new();
|
||||
private EditContext _passwdContext { get; set; }
|
||||
private bool _pwInvalid = true;
|
||||
|
||||
private readonly JsonSerializerOptions? _options = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
_editContext = new EditContext(_updateInfo);
|
||||
_passwdContext = new EditContext(_passwords);
|
||||
|
||||
_interceptor.RegisterEvent();
|
||||
_interceptor.RegisterBeforeSendEvent();
|
||||
|
||||
AdminUserInfo = await _userRepo.GetAdminUserInfo(UserId);
|
||||
|
||||
_updateInfo.Email = AdminUserInfo.Email;
|
||||
_updateInfo.CountryCode = AdminUserInfo.CountryCode;
|
||||
_updateInfo.FirstName = AdminUserInfo.FirstName;
|
||||
_updateInfo.LastName = AdminUserInfo.LastName;
|
||||
_updateInfo.PhoneNumber = AdminUserInfo.PhoneNumber;
|
||||
_updateInfo.LockoutEnabled = AdminUserInfo.LockoutEnabled;
|
||||
|
||||
_passwdContext.OnFieldChanged += PwHandleFieldChanged;
|
||||
_passwdContext.OnValidationStateChanged += PwValidationChanged;
|
||||
|
||||
}
|
||||
|
||||
private async Task UpdateUser()
|
||||
{
|
||||
_toast.ShowInfo("Sender data til server ...");
|
||||
await _userRepo.UpdateAdminUser(UserId, _updateInfo);
|
||||
}
|
||||
|
||||
private void PwHandleFieldChanged(object sender, FieldChangedEventArgs e)
|
||||
{
|
||||
_pwInvalid = !_passwdContext.Validate();
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
private void PwValidationChanged(object sender, ValidationStateChangedEventArgs e)
|
||||
{
|
||||
_pwInvalid = true;
|
||||
|
||||
_passwdContext.OnFieldChanged -= PwHandleFieldChanged;
|
||||
_passwdContext.OnValidationStateChanged -= PwValidationChanged;
|
||||
|
||||
_passwdContext = new EditContext(_passwords);
|
||||
|
||||
_passwdContext.OnFieldChanged += PwHandleFieldChanged;
|
||||
_passwdContext.OnValidationStateChanged += PwValidationChanged;
|
||||
}
|
||||
|
||||
private async Task SetPassword()
|
||||
{
|
||||
await _userRepo.ResetUserPassword(UserId, _passwords.NewPassword, _passwords.ConfirmPassword);
|
||||
_toast.ShowInfo("Password er nulstillet.");
|
||||
_passwords.NewPassword = "";
|
||||
_passwords.ConfirmPassword = "";
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_interceptor.DisposeEvent();
|
||||
_passwdContext.OnFieldChanged -= PwHandleFieldChanged;
|
||||
_passwdContext.OnValidationStateChanged -= PwValidationChanged;
|
||||
}
|
||||
}
|
|
@ -38,12 +38,12 @@
|
|||
<CompanySortComponent OnChanged="SetSortCol" />
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<PageSizeComponent OnChanged="SetPageSize"></PageSizeComponent>
|
||||
<PageSizeComponent OnChanged="SetPageSize" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<div class="col-md-10">
|
||||
<PaginationComponent MetaData="_metaData" Spread="2" SelectedPage="SelectedPage"></PaginationComponent>
|
||||
<PaginationComponent MetaData="_metaData" Spread="2" SelectedPage="SelectedPage" />
|
||||
</div>
|
||||
<div class="col-md-2 justify-content-end">
|
||||
<a class="btn btn-success" href="/companies/new">Opret kunde</a>
|
||||
|
@ -51,6 +51,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<CompanyTableComponent Companies="_companyList"></CompanyTableComponent>
|
||||
<CustomerTableComponent Companies="_companyList" />
|
||||
</div>
|
||||
</div>
|
|
@ -23,16 +23,14 @@ using Wonky.Entity.Requests;
|
|||
|
||||
namespace Wonky.Client.Pages;
|
||||
|
||||
public partial class AdminAdvisorCompanyListPage : IDisposable
|
||||
public partial class AllCustomersListPage : IDisposable
|
||||
{
|
||||
[Parameter] public string UserId { get; set; } = "";
|
||||
[Parameter] public string CountryCode { get; set; } = "";
|
||||
|
||||
[Inject] private ILogger<ActivityNewVisitPage> _logger { get; set; }
|
||||
[Inject] private HttpInterceptorService _interceptor { get; set; }
|
||||
[Inject] private UserPreferenceService _preferenceService { get; set; }
|
||||
[Inject] private ICompanyHttpRepository _companyRepo { get; set; }
|
||||
[Inject] private IUserHttpRepository _userRepo { get; set; }
|
||||
private MetaData _metaData { get; set; } = new();
|
||||
private CompanyPagingParams _paging = new();
|
||||
private Preferences _preferences { get; set; } = new();
|
||||
|
@ -54,15 +52,14 @@ public partial class AdminAdvisorCompanyListPage : IDisposable
|
|||
|
||||
_interceptor.RegisterEvent();
|
||||
_interceptor.RegisterBeforeSendEvent();
|
||||
|
||||
AdminUserInfo = await _userRepo.GetAdvisorInfo(UserId);
|
||||
// get companies
|
||||
await GetCompanies();
|
||||
}
|
||||
|
||||
private async Task GetCompanies()
|
||||
{
|
||||
var pagingResponse = await _companyRepo.GetAdminAdvisorCompaniesPaged(UserId, _paging);
|
||||
_companyList = new List<CompanyDto>();
|
||||
var pagingResponse = await _companyRepo.GetAllCustomersPaged(_paging);
|
||||
_companyList = pagingResponse.Items;
|
||||
_metaData = pagingResponse.MetaData;
|
||||
}
|
|
@ -21,7 +21,7 @@ using Wonky.Entity.Views;
|
|||
|
||||
namespace Wonky.Client.Pages;
|
||||
|
||||
public partial class AdminAdvisorUserListPage : IDisposable
|
||||
public partial class CrmUserListPage : IDisposable
|
||||
{
|
||||
[Parameter] public string CountryCode { get; set; } = "";
|
||||
[Inject] private HttpInterceptorService _interceptor { get; set; }
|
|
@ -130,7 +130,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<LoaderBallTriangle />
|
||||
<LoaderThreeDots />
|
||||
}
|
||||
</div>
|
||||
</div>
|
|
@ -24,13 +24,13 @@ using Wonky.Entity.DTO;
|
|||
|
||||
namespace Wonky.Client.Pages;
|
||||
|
||||
public partial class AdminAdvisorViewPage : IDisposable
|
||||
public partial class CrmUserViewPage : IDisposable
|
||||
{
|
||||
[Parameter] public string UserId { get; set; } = "";
|
||||
[Parameter] public string CountryCode { get; set; } = "";
|
||||
[Inject] private HttpInterceptorService _interceptor { get; set; }
|
||||
[Inject] private IUserHttpRepository _userRepo { get; set; }
|
||||
[Inject] private ILogger<AdminAdvisorViewPage> _logger { get; set; }
|
||||
[Inject] private ILogger<CrmUserViewPage> _logger { get; set; }
|
||||
[Inject] private NavigationManager _navigator { get; set; }
|
||||
[Inject] private IToastService _toast { get; set; }
|
||||
private AdminUserInfoDto AdminUserInfo { get; set; } = new();
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
@attribute [Authorize(Roles = "Advisor")]
|
||||
|
||||
<div class="sticky-top bg-success bg-opacity-50 rounded-2 px-3">
|
||||
<div class="sticky-top bg-dark text-light rounded-2 px-3">
|
||||
<div class="container-fluid pt-3">
|
||||
<div class="row mb-2">
|
||||
<div class="col-md-3">
|
||||
|
@ -34,12 +34,12 @@
|
|||
<CompanySortComponent OnChanged="SetSortCol" />
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<PageSizeComponent OnChanged="SetPageSize"></PageSizeComponent>
|
||||
<PageSizeComponent OnChanged="SetPageSize" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<div class="col-md-9">
|
||||
<PaginationComponent MetaData="_metaData" Spread="2" SelectedPage="SelectedPage"></PaginationComponent>
|
||||
<PaginationComponent MetaData="_metaData" Spread="2" SelectedPage="SelectedPage" />
|
||||
</div>
|
||||
<div class="col-md-3 justify-content-end">
|
||||
<a class="btn btn-success text-nowrap" href="/companies/new">Opret kunde</a>
|
||||
|
@ -48,4 +48,4 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<CompanyTableComponent Companies="_companyList" OnDelete="DeleteCompany"></CompanyTableComponent>
|
||||
<CustomerTableComponent Companies="_companyList" OnDelete="DeleteCompany" />
|
|
@ -85,7 +85,7 @@
|
|||
|
||||
<EditForm EditContext="_editContext" OnValidSubmit="SubmitCompanyForm">
|
||||
<DataAnnotationsValidator/>
|
||||
<InputText type="hidden" id="salesRepId" @bind-Value="_companyObject.SalesRepId"/>
|
||||
<InputText type="hidden" id="salesRepId" @bind-Value="_company.SalesRepId"/>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -109,8 +109,8 @@
|
|||
<InputDate id="nextVisit" class="form-control" @bind-Value="@(_nextVisit)" readonly />
|
||||
</td>
|
||||
<td>
|
||||
<InputNumber id="interval" class="form-control" @bind-Value="_companyObject.Interval"/>
|
||||
<ValidationMessage For="@(() => _companyObject.Interval)"></ValidationMessage>
|
||||
<InputNumber id="interval" class="form-control" @bind-Value="_company.Interval"/>
|
||||
<ValidationMessage For="@(() => _company.Interval)"></ValidationMessage>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -130,65 +130,65 @@
|
|||
<DisplayStateComponent StateClass="@RegState"></DisplayStateComponent>
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
<InputText id="vatNumber" class="form-control" @bind-Value="_companyObject.VatNumber"/>
|
||||
<ValidationMessage For="@(() => _companyObject.VatNumber)"></ValidationMessage>
|
||||
<InputText id="vatNumber" class="form-control" @bind-Value="_company.VatNumber"/>
|
||||
<ValidationMessage For="@(() => _company.VatNumber)"></ValidationMessage>
|
||||
</td>
|
||||
<td class="align-middle">Telefon</td>
|
||||
<td class="align-middle">
|
||||
<InputText id="phone" class="form-control" @bind-Value="_companyObject.Phone"/>
|
||||
<ValidationMessage For="@(() => _companyObject.Phone)"></ValidationMessage>
|
||||
<InputText id="phone" class="form-control" @bind-Value="_company.Phone"/>
|
||||
<ValidationMessage For="@(() => _company.Phone)"></ValidationMessage>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="align-middle">Firmanavn</td>
|
||||
<td class="align-middle"></td>
|
||||
<td>
|
||||
<InputText id="name" class="form-control" @bind-Value="_companyObject.Name"/>
|
||||
<ValidationMessage For="@(() => _companyObject.Name)"></ValidationMessage>
|
||||
<InputText id="name" class="form-control" @bind-Value="_company.Name"/>
|
||||
<ValidationMessage For="@(() => _company.Name)"></ValidationMessage>
|
||||
</td>
|
||||
<td class="align-middle">Attention</td>
|
||||
<td>
|
||||
<InputText id="attention" class="form-control" @bind-Value="_companyObject.Attention"/>
|
||||
<ValidationMessage For="@(() => _companyObject.Attention)"></ValidationMessage>
|
||||
<InputText id="attention" class="form-control" @bind-Value="_company.Attention"/>
|
||||
<ValidationMessage For="@(() => _company.Attention)"></ValidationMessage>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="align-middle">Adresse1</td>
|
||||
<td class="align-middle"></td>
|
||||
<td class="align-middle">
|
||||
<InputText id="address1" class="form-control" @bind-Value="_companyObject.Address1"/>
|
||||
<ValidationMessage For="@(() => _companyObject.Address1)"></ValidationMessage>
|
||||
<InputText id="address1" class="form-control" @bind-Value="_company.Address1"/>
|
||||
<ValidationMessage For="@(() => _company.Address1)"></ValidationMessage>
|
||||
</td>
|
||||
<td class="align-middle">Adresse2</td>
|
||||
<td class="align-middle">
|
||||
<InputText id="address2" class="form-control" @bind-Value="_companyObject.Address2"/>
|
||||
<ValidationMessage For="@(() => _companyObject.Address2)"></ValidationMessage>
|
||||
<InputText id="address2" class="form-control" @bind-Value="_company.Address2"/>
|
||||
<ValidationMessage For="@(() => _company.Address2)"></ValidationMessage>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="align-middle">Postnr</td>
|
||||
<td class="align-middle"></td>
|
||||
<td class="align-middle">
|
||||
<InputText id="zipCode" class="form-control" @bind-Value="_companyObject.ZipCode"/>
|
||||
<ValidationMessage For="@(() => _companyObject.ZipCode)"></ValidationMessage>
|
||||
<InputText id="zipCode" class="form-control" @bind-Value="_company.ZipCode"/>
|
||||
<ValidationMessage For="@(() => _company.ZipCode)"></ValidationMessage>
|
||||
</td>
|
||||
<td class="align-middle">Bynavn</td>
|
||||
<td class="align-middle">
|
||||
<InputText id="city" class="form-control" @bind-Value="_companyObject.City"/>
|
||||
<ValidationMessage For="@(() => _companyObject.City)"></ValidationMessage>
|
||||
<InputText id="city" class="form-control" @bind-Value="_company.City"/>
|
||||
<ValidationMessage For="@(() => _company.City)"></ValidationMessage>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="align-middle">Mobil</td>
|
||||
<td class="align-middle"></td>
|
||||
<td class="align-middle">
|
||||
<InputText id="mobile" class="form-control" @bind-Value="_companyObject.Mobile"/>
|
||||
<ValidationMessage For="@(() => _companyObject.Mobile)"></ValidationMessage>
|
||||
<InputText id="mobile" class="form-control" @bind-Value="_company.Mobile"/>
|
||||
<ValidationMessage For="@(() => _company.Mobile)"></ValidationMessage>
|
||||
</td>
|
||||
<td class="align-middle">Email</td>
|
||||
<td class="align-middle">
|
||||
<InputText id="email" class="form-control" @bind-Value="_companyObject.Email"/>
|
||||
<ValidationMessage For="@(() => _companyObject.Email)"></ValidationMessage>
|
||||
<InputText id="email" class="form-control" @bind-Value="_company.Email"/>
|
||||
<ValidationMessage For="@(() => _company.Email)"></ValidationMessage>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Wonky.Client.Pages
|
|||
[Inject] private HttpInterceptorService _interceptor { get; set; }
|
||||
[Inject] private VatInfoLookupService _vatService { get; set; }
|
||||
private EditContext _editContext { get; set; }
|
||||
private CompanyDto _companyObject { get; set; } = new();
|
||||
private CompanyDto _company { get; set; } = new();
|
||||
private VirkRegInfo _virkRegInfo { get; set; } = new();
|
||||
private List<VirkRegInfo> _vInfos { get; set; } = new();
|
||||
private VatAddress _vatAddress { get; set; } = new();
|
||||
|
@ -53,12 +53,12 @@ namespace Wonky.Client.Pages
|
|||
private string RegState = "";
|
||||
private DateTime _lastVisit { get; set; }
|
||||
private DateTime _nextVisit { get; set; }
|
||||
private bool _dk = false;
|
||||
private bool _dk { get; set; } = true;
|
||||
private bool _showInfos = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_editContext = new EditContext(_companyObject);
|
||||
_editContext = new EditContext(_company);
|
||||
|
||||
_editContext.OnFieldChanged += HandleFieldChanged;
|
||||
_editContext.OnValidationStateChanged += ValidationChanged;
|
||||
|
@ -66,14 +66,13 @@ namespace Wonky.Client.Pages
|
|||
var ux = await _storage.GetItemAsync<UserInfoView>("_xu");
|
||||
_dk = ux.CountryCode.ToLower() == "dk";
|
||||
|
||||
_companyObject.SalesRepId = ux.Id;
|
||||
_companyObject.CountryCode = ux.CountryCode.ToLower();
|
||||
_company.SalesRepId = ux.Id;
|
||||
_company.CountryCode = ux.CountryCode.ToLower();
|
||||
|
||||
_lastVisit = DateTime.Now;
|
||||
_nextVisit = DateTime.Now.AddDays(_companyObject.Interval * 7);
|
||||
|
||||
_companyObject.LastVisit = $"{_lastVisit:yyyy-MM-dd}";
|
||||
_companyObject.LastVisit = $"{_nextVisit:yyyy-MM-dd}";
|
||||
_nextVisit = DateTime.Now.AddDays(_company.Interval * 7);
|
||||
_company.LastVisit = $"{_lastVisit:yyyy-MM-dd}";
|
||||
_company.NextVisit = $"{_nextVisit:yyyy-MM-dd}";
|
||||
|
||||
_interceptor.RegisterEvent();
|
||||
_interceptor.RegisterBeforeSendEvent();
|
||||
|
@ -112,38 +111,38 @@ namespace Wonky.Client.Pages
|
|||
_showInfos = false;
|
||||
_virkRegInfo = (from x in _vInfos where x.VatNumber == vatNumber select x).First();
|
||||
RegState = _virkRegInfo.States[^1].State == "NORMAL" ? "the-good" : "the-ugly";
|
||||
_companyObject.Name = _virkRegInfo.Name;
|
||||
_companyObject.Address1 = _virkRegInfo.Address;
|
||||
_companyObject.Address2 = _virkRegInfo.CoName;
|
||||
_companyObject.ZipCode = _virkRegInfo.ZipCode;
|
||||
_companyObject.City = _virkRegInfo.City;
|
||||
_companyObject.VatNumber = _virkRegInfo.VatNumber;
|
||||
_companyObject.ValidVat = 1;
|
||||
_company.Name = _virkRegInfo.Name;
|
||||
_company.Address1 = _virkRegInfo.Address;
|
||||
_company.Address2 = _virkRegInfo.CoName;
|
||||
_company.ZipCode = _virkRegInfo.ZipCode;
|
||||
_company.City = _virkRegInfo.City;
|
||||
_company.VatNumber = _virkRegInfo.VatNumber;
|
||||
_company.ValidVat = 1;
|
||||
StateHasChanged();
|
||||
}
|
||||
private async Task SubmitCompanyForm()
|
||||
{
|
||||
_companyObject.LastVisit = $"{_lastVisit:yyyy-MM-dd}";
|
||||
_companyObject.NextVisit = $"{_nextVisit:yyyy-MM-dd}";
|
||||
_company.LastVisit = $"{_lastVisit:yyyy-MM-dd}";
|
||||
_company.NextVisit = $"{_nextVisit:yyyy-MM-dd}";
|
||||
|
||||
var newId = await _companyRepo.CreateCompany(_companyObject);
|
||||
var newId = await _companyRepo.CreateCompany(_company);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(newId))
|
||||
{
|
||||
_toast.ShowSuccess($"'{_companyObject.Name}' er oprettet i CRM.");
|
||||
_toast.ShowSuccess($"'{_company.Name}' er oprettet i CRM.");
|
||||
_navigator.NavigateTo($"/companies/{newId}");
|
||||
}
|
||||
else
|
||||
{
|
||||
_toast.ShowWarning($"'{_companyObject.Name}' IKKE oprettet.");
|
||||
_toast.ShowWarning($"'{_company.Name}' IKKE oprettet.");
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
|
||||
{
|
||||
_nextVisit = _lastVisit.AddDays(7 * _companyObject.Interval);
|
||||
_nextVisit = _lastVisit.AddDays(7 * _company.Interval);
|
||||
|
||||
if (!_companyObject.ValidDateSpan())
|
||||
if (!_company.ValidDateSpan())
|
||||
{
|
||||
_toast.ShowError("Dato for næste besøg skal ligge efter sidste besøg.");
|
||||
_formInvalid = true;
|
||||
|
@ -160,7 +159,7 @@ namespace Wonky.Client.Pages
|
|||
|
||||
_editContext.OnFieldChanged -= HandleFieldChanged;
|
||||
|
||||
_editContext = new EditContext(_companyObject);
|
||||
_editContext = new EditContext(_company);
|
||||
|
||||
_formInvalid = !_editContext.Validate();
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
<div class="card-header bg-dark text-white">
|
||||
<h3>@_company.Account - @_company.Name</h3>
|
||||
</div>
|
||||
@if (_dk && !_validVat)
|
||||
{
|
||||
<div class="card-body">
|
||||
<VatAddressInputComponent Address="vatAddress" OnValidSubmit="GetInfoFromAddress"/>
|
||||
</div>
|
||||
|
@ -61,7 +63,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
}
|
||||
<EditForm EditContext="_editContext" OnValidSubmit="SubmitUpdate">
|
||||
<DataAnnotationsValidator/>
|
||||
<div class="card-body">
|
||||
|
@ -163,7 +165,7 @@
|
|||
</DisplayStateComponent>
|
||||
</td>
|
||||
<td>
|
||||
<InputDate id="nextVisit" class="form-control" @bind-Value="@(_nextVisit)" readonly />
|
||||
<InputDate id="nextVisit" class="form-control" @bind-Value="@(_nextVisit)"/>
|
||||
</td>
|
||||
<th>
|
||||
Besøgt
|
||||
|
@ -210,7 +212,8 @@
|
|||
<ActivityButton ActionLink="@_actionLink"
|
||||
ButtonText="Besøg"
|
||||
ButtonType="primary"
|
||||
Enabled="@_enableActivity"></ActivityButton>
|
||||
Enabled="@_enableActivity">
|
||||
</ActivityButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -219,5 +222,5 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<LoaderBallTriangle/>
|
||||
<LoaderThreeDots />
|
||||
}
|
|
@ -63,6 +63,7 @@ public partial class CustomerViewPage : IDisposable
|
|||
private string _actionLink = "";
|
||||
private bool _working;
|
||||
private string _btnUpdateText = "Opdater";
|
||||
private bool _dk { get; set; } = true;
|
||||
|
||||
private readonly JsonSerializerOptions _options = new ()
|
||||
{
|
||||
|
@ -84,21 +85,20 @@ public partial class CustomerViewPage : IDisposable
|
|||
{
|
||||
var ux = await _storage.GetItemAsync<UserInfoView>("_xu");
|
||||
countryCode = ux.CountryCode;
|
||||
_dk = ux.CountryCode.ToLower() == "dk";
|
||||
|
||||
_interceptor.RegisterEvent();
|
||||
_interceptor.RegisterBeforeSendEvent();
|
||||
|
||||
_company = await _companyRepo.GetCompanyById(CompanyId);
|
||||
|
||||
_logger.LogDebug("CompanyView => _company <= {_company}", JsonSerializer.Serialize(_company, _options));
|
||||
|
||||
_orgVat = _company.VatNumber;
|
||||
_company.CountryCode = ux.CountryCode.ToLower();
|
||||
|
||||
_enableActivity = _company.ValidVat;
|
||||
// override if canvas which has account property as empty string or "NY"
|
||||
if (_company.Account == "NY" || string.IsNullOrWhiteSpace(_company.Account))
|
||||
_enableActivity = 1;
|
||||
|
||||
if (_dk)
|
||||
vatAddress = PrepareVatAddress(_company);
|
||||
|
||||
if (_company.Interval == 0)
|
||||
|
@ -106,41 +106,41 @@ public partial class CustomerViewPage : IDisposable
|
|||
|
||||
_lastVisit = DateTime.Parse(_company.LastVisit);
|
||||
_nextVisit = DateTime.Parse(_company.NextVisit);
|
||||
|
||||
if (_lastVisit.Year < 2020)
|
||||
{
|
||||
_lastVisit = DateTime.Parse("2020-01-01");
|
||||
}
|
||||
|
||||
if (!_company.ValidDateSpan())
|
||||
_nextVisit = _lastVisit.AddDays(_company.Interval * 7);
|
||||
|
||||
_visitState = Utils.GetVisitState($"{_nextVisit:yyyy-MM-dd}");
|
||||
|
||||
_actionLink = $"/companies/{CompanyId}/activities/new";
|
||||
|
||||
_actionLink = $"/companies/{CompanyId}/activities/new"; // used when drawing visit button
|
||||
if(_company.HasFolded == 1)
|
||||
{
|
||||
// this is only used if user has selected to show all customers
|
||||
_hasFolded = true;
|
||||
_vatState = "the-dead";
|
||||
_visitState = "the-dead";
|
||||
}
|
||||
else
|
||||
{
|
||||
// simple format validation if CRM indicates invalid vatNumber
|
||||
if (_company.ValidVat == 0 && !string.IsNullOrWhiteSpace(_company.VatNumber))
|
||||
_company.ValidVat = VatUtils.ValidateFormat(_company.CountryCode, _company.VatNumber) ? 1 : 0;
|
||||
_validVat = _company.ValidVat == 1;
|
||||
_vatState = _company.ValidVat == 1 ? "the-good" : "the-draw";
|
||||
// flags
|
||||
_validVat = _company.ValidVat == 1; // flag set if company has a valid vatNumber
|
||||
_vatState = _company.ValidVat == 1 ? "the-good" : "no-vat"; // assign css class
|
||||
}
|
||||
_editContext = new EditContext(_company);
|
||||
_editContext.OnFieldChanged += HandleFieldChanged;
|
||||
_editContext.OnValidationStateChanged += ValidationChanged;
|
||||
|
||||
}
|
||||
|
||||
private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
|
||||
{
|
||||
_nextVisit = _lastVisit.AddDays(_company.Interval * 7);
|
||||
|
||||
// simple format validation if CRM indicates invalid vatNumber
|
||||
if (!VatUtils.ValidateFormat(_company.CountryCode, _company.VatNumber))
|
||||
{
|
||||
_formInvalid = true;
|
||||
|
@ -151,6 +151,7 @@ public partial class CustomerViewPage : IDisposable
|
|||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void ValidationChanged(object sender, ValidationStateChangedEventArgs e)
|
||||
{
|
||||
_formInvalid = false;
|
||||
|
@ -167,6 +168,7 @@ public partial class CustomerViewPage : IDisposable
|
|||
|
||||
private async Task SubmitUpdate()
|
||||
{
|
||||
// simple format validation if CRM indicates invalid vatNumber
|
||||
if (!VatUtils.ValidateFormat(_company.CountryCode, _company.VatNumber))
|
||||
{
|
||||
_toast.ShowError($"CVR/VAT/ORG nummer mangler eller er ugyldig.");
|
||||
|
@ -178,21 +180,18 @@ public partial class CustomerViewPage : IDisposable
|
|||
_company.LastVisit = $"{_lastVisit:yyyy-MM-dd}";
|
||||
_company.NextVisit = $"{_nextVisit:yyyy-MM-dd}";
|
||||
_company.IsHidden = 0;
|
||||
// flag if backend should update ERP system
|
||||
if (_company.VatNumber != _orgVat)
|
||||
_company.UpdateErpVat = 1;
|
||||
|
||||
var x = JsonSerializer.Serialize(_company, _options);
|
||||
_logger.LogInformation(x);
|
||||
var success = await _companyRepo.UpdateCompany(CompanyId, _company );
|
||||
if (success)
|
||||
{
|
||||
_toast.ShowSuccess("Opdatering er afsendt. Der nogle minutter inden data er opdateret.");
|
||||
_toast.ShowSuccess("Opdatering er afsendt. Der går nogle minutter inden data er opdateret.");
|
||||
_company = await _companyRepo.GetCompanyById(_company.CompanyId);
|
||||
_company.ValidVat = 1;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
||||
_hideButtons = false;
|
||||
}
|
||||
|
||||
|
@ -205,11 +204,11 @@ public partial class CustomerViewPage : IDisposable
|
|||
HouseNumber = address.HouseNumber,
|
||||
ZipCode = address.ZipCode
|
||||
});
|
||||
|
||||
if (!_vInfos.Any())
|
||||
{
|
||||
_toast.ShowError($"Ingen virksomheder fundet.");
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectCompany(string vatNumber, bool syncAll)
|
||||
{
|
||||
_virkRegInfo = (from x in _vInfos where x.VatNumber == vatNumber select x).First();
|
||||
|
@ -226,7 +225,7 @@ public partial class CustomerViewPage : IDisposable
|
|||
{
|
||||
_company.VatNumber = _virkRegInfo.VatNumber;
|
||||
}
|
||||
|
||||
// empty list
|
||||
_vInfos = new List<VirkRegInfo>();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
@ -237,9 +236,10 @@ public partial class CustomerViewPage : IDisposable
|
|||
_editContext.OnFieldChanged -= HandleFieldChanged;
|
||||
_editContext.OnValidationStateChanged -= ValidationChanged;
|
||||
}
|
||||
|
||||
private static VatAddress PrepareVatAddress(CompanyDto model)
|
||||
{
|
||||
var digits = "123456789".ToCharArray();
|
||||
var digits = "1234567890".ToCharArray();
|
||||
// process address1
|
||||
var pos1 = model.Address1.IndexOfAny(digits);
|
||||
if (pos1 > 0)
|
||||
|
@ -262,6 +262,7 @@ public partial class CustomerViewPage : IDisposable
|
|||
HouseNumber = Regex.Replace(model.Address2[pos2..], "[^0-9]", "")
|
||||
};
|
||||
}
|
||||
// return empty model
|
||||
return new VatAddress();
|
||||
}
|
||||
}
|
|
@ -23,23 +23,21 @@
|
|||
|
||||
@attribute [Authorize(Roles = "Advisor,Admin,Office,Warehouse")]
|
||||
<div class="row mb-2">
|
||||
<div class="col col-md-4">
|
||||
<div class="col">
|
||||
<div class="text-center">
|
||||
<img class="grumpy-coder mb-2" src="@_app?.Image" alt="Wonky Logo"/>
|
||||
<h5><AppVersion></AppVersion></h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-2">
|
||||
<div class="col col-md-4">
|
||||
<div class="col">
|
||||
<h2 class="text-center">Piktogrammer</h2>
|
||||
<ColorCoding></ColorCoding>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-2">
|
||||
<div class="col col-md-4">
|
||||
<div class="col">
|
||||
<h2 class="text-center">Testede browsere</h2>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">Safari (macOS, iOS)</li>
|
||||
|
@ -51,9 +49,8 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-2">
|
||||
<div class="col col-md-4">
|
||||
<div class="col">
|
||||
<h2 class="text-center">Open Source</h2>
|
||||
<ul class="list-group">
|
||||
<a class="list-group-item list-group-item-action" href="https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor/" target="_blank">Blazor WebAssembly</a>
|
||||
|
@ -64,6 +61,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@code{
|
||||
|
||||
[Inject]
|
||||
|
|
|
@ -21,15 +21,20 @@
|
|||
@using Wonky.Client.Components;
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
|
||||
|
||||
@attribute [Authorize(Roles = "Advisor,Admin,Supervisor,Office,Warehouse")]
|
||||
|
||||
<AuthorizeView Roles="Advisor">
|
||||
<AdvisorLandingComponent />
|
||||
<LandingComponentAdvisor />
|
||||
</AuthorizeView>
|
||||
|
||||
<AuthorizeView Roles="Warehouse">
|
||||
<WarehouseListComponent />
|
||||
</AuthorizeView>
|
||||
|
||||
<AuthorizeView Roles="Admin">
|
||||
<LandingComponentAdmin />
|
||||
</AuthorizeView>
|
||||
|
||||
@code{
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
@attribute [Authorize(Roles = "Advisor,Admin")]
|
||||
|
||||
<div class="sticky-top bg-success bg-opacity-50 rounded-2 px-3">
|
||||
<div class="sticky-top bg-dark rounded-2 px-3">
|
||||
<div class="container-fluid pt-3">
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
<div class="col d-flex justify-content-center">
|
||||
@if (execLogin)
|
||||
{
|
||||
<LoaderBallTriangle />
|
||||
<LoaderThreeDots />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -21,7 +21,7 @@ using Wonky.Entity.Views;
|
|||
|
||||
namespace Wonky.Client.Pages;
|
||||
|
||||
public partial class AdvisorReportListPage : IDisposable
|
||||
public partial class ReportListPageAdvisor : IDisposable
|
||||
{
|
||||
[Inject] private IReportHttpRepository _reportRepo { get; set; }
|
||||
[Inject] private HttpInterceptorService _interceptor { get; set; }
|
|
@ -21,7 +21,7 @@ using Wonky.Entity.Views;
|
|||
|
||||
namespace Wonky.Client.Pages;
|
||||
|
||||
public partial class AdminReportListPage : IDisposable
|
||||
public partial class ReportListPageOffice : IDisposable
|
||||
{
|
||||
[Parameter] public string UserId { get; set; } = "";
|
||||
[Parameter] public string CountryCode { get; set; } = "";
|
|
@ -29,14 +29,14 @@ using Wonky.Entity.Views;
|
|||
|
||||
namespace Wonky.Client.Pages;
|
||||
|
||||
public partial class AdvisorReportNewPage : IDisposable
|
||||
public partial class ReportNewPageAdvisor : IDisposable
|
||||
{
|
||||
[Inject] private HttpInterceptorService _interceptor { get; set; }
|
||||
[Inject] private UserPreferenceService _userPrefs { get; set; }
|
||||
[Inject] private IActivityHttpRepository _activityRepo { get; set; }
|
||||
[Inject] private IReportHttpRepository _reportRepo { get; set; }
|
||||
[Inject] private NavigationManager _navigator { get; set; }
|
||||
[Inject] private ILogger<AdvisorReportNewPage> _logger { get; set; }
|
||||
[Inject] private ILogger<ReportNewPageAdvisor> _logger { get; set; }
|
||||
[Inject] private IToastService _toast { get; set; }
|
||||
private EditContext _editContext { get; set; }
|
||||
private ReportDto _report { get; set; } = new();
|
|
@ -20,7 +20,7 @@ using Wonky.Entity.Views;
|
|||
|
||||
namespace Wonky.Client.Pages;
|
||||
|
||||
public partial class AdvisorReportViewPage
|
||||
public partial class ReportViewPageAdvisor
|
||||
{
|
||||
[Parameter] public string ReportDate { get; set; }
|
||||
[Inject] private IReportHttpRepository _reportRepo { get; set; }
|
|
@ -21,7 +21,7 @@ using Wonky.Entity.Views;
|
|||
|
||||
namespace Wonky.Client.Pages;
|
||||
|
||||
public partial class AdminReportViewPage : IDisposable
|
||||
public partial class ReportViewPageOffice : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Country code from url parameter
|
|
@ -27,7 +27,7 @@ namespace Wonky.Client.Pages;
|
|||
public partial class TaskItemListPage : IDisposable
|
||||
{
|
||||
[Inject] public UserPreferenceService UserPrefs { get; set; }
|
||||
[Inject] public ILogger<AdvisorLandingComponent> Logger { get; set; }
|
||||
[Inject] public ILogger<LandingComponentAdvisor> Logger { get; set; }
|
||||
[Inject] private HttpInterceptorService _interceptor { get; set; }
|
||||
[Inject] private NavigationManager _navigator { get; set; }
|
||||
[Inject] private ITaskItemHttpRepository _taskItemRepo { get; set; }
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
@using Microsoft.AspNetCore.Authorization
|
||||
@using Wonky.Client.Components
|
||||
@attribute [Authorize(Roles = "Admin,Warehouse,Office")]
|
||||
@page "/warehouse/orders"
|
||||
|
||||
<WarehouseListComponent />
|
|
@ -100,5 +100,5 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<LoaderBallTriangle />
|
||||
<LoaderThreeDots />
|
||||
}
|
|
@ -13,6 +13,7 @@ public partial class WarehouseOrderViewPage : IDisposable
|
|||
[Inject] private NavigationManager _navigator { get; set; }
|
||||
|
||||
private WarehouseOrderView _order { get; set; } = new();
|
||||
private bool Loading { get; set; }
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
|
|
|
@ -28,7 +28,6 @@ public class VatInfoLookupService
|
|||
private readonly JsonSerializerOptions _options = new() { PropertyNameCaseInsensitive = true };
|
||||
private readonly HttpClient _client;
|
||||
private readonly IOptions<ApiConfig> _apiConfig;
|
||||
private readonly List<VirkRegInfo> _noData = new() { new VirkRegInfo { Name = "INGEN DATA" } };
|
||||
private readonly ApiConfig _config;
|
||||
|
||||
public VatInfoLookupService(HttpClient client, IOptions<ApiConfig> apiConfig)
|
||||
|
@ -40,28 +39,38 @@ public class VatInfoLookupService
|
|||
|
||||
public async Task<List<VirkRegInfo>> QueryVirkRegistry(VirkParams query)
|
||||
{
|
||||
Console.WriteLine(JsonSerializer.Serialize(query));
|
||||
|
||||
if(!ValidateCvrQuery(query))
|
||||
{
|
||||
throw new ArgumentException("CvrQuery does not validate");
|
||||
}
|
||||
|
||||
var queryString = new Dictionary<string, string>
|
||||
{
|
||||
["vatNumber"] = $"{query.VatNumber}",
|
||||
["streetName"] = $"{query.StreetName}",
|
||||
["houseNumber"] = $"{query.HouseNumber}",
|
||||
["zipCode"] = $"{query.ZipCode}"
|
||||
["zipCode"] = $"{query.ZipCode}",
|
||||
["entityName"] = $"{query.EntityName}"
|
||||
};
|
||||
var endpoint = QueryHelpers.AddQueryString(_config.ServiceVirk, queryString);
|
||||
var response = await _client.GetAsync(endpoint);
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
|
||||
Console.WriteLine(content);
|
||||
|
||||
var jsonResult = JsonSerializer.Deserialize<List<VirkRegInfo>>(content, _options);
|
||||
if (string.IsNullOrWhiteSpace(content) || !jsonResult.Any()) return _noData;
|
||||
if (!string.IsNullOrWhiteSpace(query.VatNumber)) return jsonResult;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(content) || !jsonResult.Any())
|
||||
return new List<VirkRegInfo>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(query.VatNumber))
|
||||
return jsonResult;
|
||||
|
||||
var result = jsonResult
|
||||
//.Where(x => x.States[^1].State == "NORMAL")
|
||||
.OrderBy(x => x.Name).ToList();
|
||||
|
||||
return result.Count == 0 ? _noData : result;
|
||||
return result.Count == 0 ? new List<VirkRegInfo>() : result;
|
||||
}
|
||||
|
||||
public async Task<List<VirkRegInfo>> QueryBrRegistry(string vatNumber)
|
||||
|
@ -70,19 +79,21 @@ public class VatInfoLookupService
|
|||
{
|
||||
["vatNumber"] = $"{vatNumber}"
|
||||
};
|
||||
|
||||
var endpoint = QueryHelpers.AddQueryString(_config.ServiceBrReg, queryString);
|
||||
var response = await _client.GetAsync(endpoint);
|
||||
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
var jsonResult = JsonSerializer.Deserialize<List<VirkRegInfo>>(content, _options);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(content) || !jsonResult.Any()) return _noData;
|
||||
if (string.IsNullOrWhiteSpace(content) || !jsonResult.Any())
|
||||
return new List<VirkRegInfo>();
|
||||
|
||||
var result = jsonResult
|
||||
//.Where(x => x.States[^1].State == "NORMAL")
|
||||
.OrderBy(x => x.Name).ToList();
|
||||
|
||||
return result.Count == 0 ? _noData : result;
|
||||
return result.Count == 0 ? new List<VirkRegInfo>() : result;
|
||||
}
|
||||
|
||||
public async Task<List<VirkRegInfo>> QueryViesRegistry(string vatNumber)
|
||||
|
@ -97,13 +108,13 @@ public class VatInfoLookupService
|
|||
var content = await response.Content.ReadAsStringAsync();
|
||||
var jsonResult = JsonSerializer.Deserialize<List<VirkRegInfo>>(content, _options);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(content) || !jsonResult.Any()) return _noData;
|
||||
if (string.IsNullOrWhiteSpace(content) || !jsonResult.Any()) return new List<VirkRegInfo>();
|
||||
|
||||
var result = jsonResult
|
||||
//.Where(x => x.States[^1].State == "NORMAL")
|
||||
.OrderBy(x => x.Name).ToList();
|
||||
|
||||
return result.Count == 0 ? _noData : result;
|
||||
return result.Count == 0 ? new List<VirkRegInfo>() : result;
|
||||
}
|
||||
|
||||
private static bool ValidateCvrQuery(VirkParams query)
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
{
|
||||
"appInfo": {
|
||||
"name": "Wonky Client",
|
||||
"version": "0.10.10",
|
||||
"version": "0.10.16",
|
||||
"rc": false,
|
||||
"sandBox": false,
|
||||
"image": "grumpy-coder.png"
|
||||
},
|
||||
"apiConfig": {
|
||||
"innoBaseUrl": "https://production.innotec.dk",
|
||||
"innoBaseUrl": "https://staging.innotec.dk",
|
||||
"glsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=",
|
||||
"glsId": "",
|
||||
"servcieVirk": "api/v2/services/virk",
|
||||
"serviceVirk": "api/v2/services/virk",
|
||||
"serviceBrReg": "api/v2/services/brReg",
|
||||
"servcieVies": "api/v2/services/vies",
|
||||
"crmAuth": "token",
|
||||
|
|
|
@ -12,7 +12,7 @@ body {
|
|||
.workDate {
|
||||
font-variant: small-caps;
|
||||
}
|
||||
/* visit / vat state classes */
|
||||
/* begin state elements */
|
||||
.state {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
|
@ -34,10 +34,13 @@ body {
|
|||
.the-draw {
|
||||
background-color: #9b02fc;
|
||||
}
|
||||
.the-dead {
|
||||
background-color: #262626;
|
||||
.no-vat {
|
||||
background-color: yellow;
|
||||
}
|
||||
/* end visit state classes*/
|
||||
.the-dead {
|
||||
background-color: black;
|
||||
}
|
||||
/* end state elements */
|
||||
|
||||
.btn.btn-edit {
|
||||
color: #030303;
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
<title>Inno Web CRM</title>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
|
||||
<link rel="mask-icon" href="safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="msapplication-TileColor" content="#ffaa00">
|
||||
<meta name="theme-color" content="#000">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png" />
|
||||
<link rel="mask-icon" href="safari-pinned-tab.svg" color="#5bbad5" />
|
||||
<meta name="msapplication-TileColor" content="#ffaa00" />
|
||||
<meta name="theme-color" content="#000" />
|
||||
<base href="/" />
|
||||
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="css/app.css" rel="stylesheet" />
|
||||
<link href="Wonky.Client.styles.css" rel="stylesheet" />
|
||||
<link href="_content/Blazored.Toast/blazored-toast.min.css" rel="stylesheet" />
|
||||
|
@ -21,7 +21,7 @@
|
|||
<div id="app">
|
||||
<div class="m-5 d-flex justify-content-center">
|
||||
<!-- loader credit: samherbert.net/svg-loaders -->
|
||||
<img src="svg-loaders/ball-triangle.svg" alt="loading ..."/>
|
||||
<img src="/svg-loaders/three-dots.svg" alt="loading ..."/>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
|
|
Loading…
Reference in a new issue