publish v0.10.16

This commit is contained in:
Frede Hundewadt 2022-07-28 17:22:51 +02:00
parent 128c29c798
commit 331a9fbcf7
71 changed files with 491 additions and 672 deletions

View file

@ -50,7 +50,3 @@
</tbody> </tbody>
</table> </table>
} }
else
{
<LoaderBallTriangle />
}

View file

@ -78,5 +78,5 @@
} }
else else
{ {
<LoaderBallTriangle /> <LoaderThreeDots />
} }

View file

@ -54,5 +54,5 @@
} }
else else
{ {
<LoaderBallTriangle /> <LoaderThreeDots />
} }

View file

@ -84,5 +84,5 @@
} }
else else
{ {
<LoaderBallTriangle /> <LoaderThreeDots />
} }

View file

@ -51,5 +51,5 @@
} }
else else
{ {
<LoaderBallTriangle /> <LoaderThreeDots />
} }

View file

@ -15,53 +15,65 @@
// //
*@ *@
<table class="table"> <ul class="list-group">
<thead> <li class="list-group-item">
<tr class="bg-black bg-opacity-50 text-white"> <div class="row">
<th scope="col">Farvekode</th> <div class="col-2">
<th scope="col">Betydning</th>
</tr>
</thead>
<tbody>
<tr>
<td class="color-code">
<img class="state the-good rounded-circle me-1" src="state.png" alt="state"/> <img class="state the-good rounded-circle me-1" src="state.png" alt="state"/>
</td> </div>
<td class="align-middle"> <div class="col-10">
Er besøgt. Er nylig besøgt
</td> </div>
</tr> </div>
<tr> </li>
<td class="align-middle"> <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"/> <img class="state the-bad rounded-circle me-1" src="state.png" alt="state"/>
</td> </div>
<td class="align-middle"> <div class="col-10">
Planlæg besøg. Planlagt besøg
</td> </div>
</tr> </div>
<tr> </li>
<td class="align-middle"> <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"/> <img class="state the-ugly rounded-circle me-1" src="state.png" alt="state"/>
</td> </div>
<td class="align-middle"> <div class="col-10">
Besøges nu! Besøgsinterval overskredet
</td> </div>
</tr> </div>
<tr> </li>
<td class="align-middle"> <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"/> <img class="state the-draw rounded-circle me-1" src="state.png" alt="state"/>
</td> </div>
<td class="align-middle"> <div class="col-10">
Opdater besøgsdato og/eller CVR/ORG nummer. Ajourfør besøgsdato/interval
</td> </div>
</tr> </div>
<tr> </li>
<td class="align-middle"> <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"/> <img class="state the-dead rounded-circle me-1" src="state.png" alt="state"/>
</td> </div>
<td class="align-middle"> <div class="col-10">
Virksomhed ophørt! Virksomhed ophørt
</td> </div>
</tr> </div>
</tbody> </li>
</table> </ul>

View file

@ -36,8 +36,7 @@
{ {
<tr @onclick="() => { ViewCustomer(company.CompanyId); }" style="cursor: pointer"> <tr @onclick="() => { ViewCustomer(company.CompanyId); }" style="cursor: pointer">
<td class="state align-middle"> <td class="state align-middle">
<DisplayStateComponent StateClass="@(company.HasFolded == 1 ? "the-dead" : Utils.GetVisitState(company.NextVisit))"> <DisplayStateComponent StateClass="@(company.HasFolded == 1 ? "the-dead" : Utils.GetVisitState(company.NextVisit))" />
</DisplayStateComponent>
</td> </td>
<td class="align-middle"> <td class="align-middle">
@company.Name @company.Name
@ -52,12 +51,8 @@
@company.City @company.City
</td> </td>
<td class="align-middle"> <td class="align-middle">
<ActivityButton CompanyId="@company.CompanyId" <ActivityButton CompanyId="@company.CompanyId" ActionLink="/companies/$ID$/activities/new"
ActionLink="/companies/$ID$/activities/new" ButtonText="Besøg" ButtonType="primary" Enabled="@company.ValidVat" />
ButtonText="Besøg"
ButtonType="primary"
Enabled="@company.ValidVat">
</ActivityButton>
</td> </td>
</tr> </tr>
} }
@ -67,5 +62,5 @@
} }
else else
{ {
<LoaderBallTriangle /> <LoaderThreeDots />
} }

View file

@ -24,7 +24,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Components namespace Wonky.Client.Components
{ {
public partial class CompanyTableComponent public partial class CustomerTableComponent
{ {
[Parameter] public List<CompanyDto> Companies { get; set; } = new(); [Parameter] public List<CompanyDto> Companies { get; set; } = new();
[Parameter] public EventCallback<string> OnDelete { get; set; } [Parameter] public EventCallback<string> OnDelete { get; set; }

View file

@ -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{ @code{
[Parameter] public string StateClass { get; set; } = ""; [Parameter] public string StateClass { get; set; } = "";
} }

View file

@ -55,5 +55,5 @@
} }
else else
{ {
<LoaderBallTriangle /> <LoaderThreeDots />
} }

View file

@ -15,12 +15,7 @@
// //
*@ *@
@if (Loading) @using Microsoft.AspNetCore.Authorization
{ @using Wonky.Client.Components
<div class="m-5 @(Loading ? "visible" : "invisible")">
<div class="d-flex justify-content-center"> <PageTitle>Inno Web CRM</PageTitle>
<!-- loader credit: samherbert.net/svg-loaders -->
<img src="/svg-loaders/bars.svg" alt="loading ..."/>
</div>
</div>
}

View file

@ -29,10 +29,10 @@ using Wonky.Entity.Models;
using Wonky.Entity.Views; using Wonky.Entity.Views;
namespace Wonky.Client.Components; namespace Wonky.Client.Components;
public partial class AdvisorLandingComponent : IDisposable public partial class LandingComponentAdmin : IDisposable
{ {
[Inject] private UserPreferenceService _preferenceService { get; set; } [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 HttpInterceptorService _interceptor { get; set; }
[Inject] private IToastService _toast { get; set; } [Inject] private IToastService _toast { get; set; }
[Inject] private ITaskItemHttpRepository _taskItemRepo { get; set; } [Inject] private ITaskItemHttpRepository _taskItemRepo { get; set; }

View file

@ -19,6 +19,7 @@
@using Wonky.Client.Components @using Wonky.Client.Components
<PageTitle>Inno Web CRM</PageTitle> <PageTitle>Inno Web CRM</PageTitle>
<AuthorizeView Roles="Advisor"> <AuthorizeView Roles="Advisor">
<div class="alert bg-light border-dark"> <div class="alert bg-light border-dark">
<div class="row"> <div class="row">
@ -26,22 +27,11 @@
<h2 style="font-variant: all-small-caps">@(DateTime.Now.ToLongDateString())</h2> <h2 style="font-variant: all-small-caps">@(DateTime.Now.ToLongDateString())</h2>
</div> </div>
<div class="col"> <div class="col">
<WorkDateComponent SelectedDate="@_today" OnChanged="GetTaskItems"></WorkDateComponent> <WorkDateComponent SelectedDate="@_today" OnChanged="GetWorkdateTasks" />
</div> </div>
</div> </div>
</div> </div>
<TaskItemTableComponent TaskItemList="_taskItems" OnCompleteTask="OnCompleteTask" <TaskItemTableComponent TaskItemList="_taskItems" OnCompleteTask="OnCompleteTask"
OnDeleteTask="OnDeleteConfirmed" OnTaskCompleted="OnTaskCompleted" /> 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> </AuthorizeView>

View 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();
}
}

View file

@ -0,0 +1,5 @@
.workDate {
font-size: 1.2em;
font-weight: bold;
font-variant: small-caps;
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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>
}

View file

@ -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;
}
}

View file

@ -20,7 +20,7 @@
<div class="m-5 @(Loading ? "visible" : "invisible")"> <div class="m-5 @(Loading ? "visible" : "invisible")">
<div class="d-flex justify-content-center"> <div class="d-flex justify-content-center">
<!-- loader credit: samherbert.net/svg-loaders --> <!-- 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>
</div> </div>
} }

View 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;
}
}

View file

@ -0,0 +1,5 @@
<h3>OrderCreateComponent</h3>
@code {
}

View 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();
}
}

View file

@ -82,5 +82,5 @@
} }
else else
{ {
<LoaderBallTriangle /> <LoaderThreeDots />
} }

View file

@ -46,22 +46,22 @@
</td> </td>
<td class="align-middle"> <td class="align-middle">
<button type="button" class="btn btn-light border-dark" @onclick="() => CallConfirmationModal(task.TaskItemId)"> <button type="button" class="btn btn-light border-dark" @onclick="() => CallConfirmationModal(task.TaskItemId)">
Slet <i class="oi oi-circle-x"></i>
</button> </button>
</td> </td>
<td class="align-middle"> <td class="align-middle">
<button type="button" class="btn btn-light border-dark" @onclick="() => TaskCompleted(task.TaskItemId)"> <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> </button>
</td> </td>
<td class="align-middle"> <td class="align-middle">
@if (task.TaskTypeEnum is "Recall") @if (task.TaskTypeEnum is "Recall")
{ {
<a class="btn btn-light border-dark pe-3" href="/companies/@task.ReferenceId"> <a class="btn btn-light border-dark pe-3 me-2" href="/companies/@task.ReferenceId">
Ændre <i class="oi oi-pencil"></i>
</a> </a>
<button type="button" class="btn btn-primary" @onclick="() => CompleteTask(task.TaskItemId)"> <button type="button" class="btn btn-primary" @onclick="() => CompleteTask(task.TaskItemId)">
Besøg <i class="oi oi-map-marker"></i>
</button> </button>
} }
</td> </td>
@ -73,5 +73,5 @@
} }
else else
{ {
<LoaderBallTriangle /> <LoaderThreeDots />
} }

View file

@ -35,11 +35,13 @@ public partial class VatAddressInputComponent : IDisposable
{ {
await OnValidSubmit.InvokeAsync(Address); await OnValidSubmit.InvokeAsync(Address);
} }
private void HandleFieldChanged(object? sender, FieldChangedEventArgs e) private void HandleFieldChanged(object? sender, FieldChangedEventArgs e)
{ {
_formInvalid = !_editContext.Validate(); _formInvalid = !_editContext.Validate();
StateHasChanged(); StateHasChanged();
} }
public void Dispose() public void Dispose()
{ {
_editContext.OnFieldChanged -= HandleFieldChanged; _editContext.OnFieldChanged -= HandleFieldChanged;

View file

@ -77,9 +77,5 @@
} }
else else
{ {
<LoaderBallTriangle /> <LoaderThreeDots Loading="Loading" />
}
@code {
} }

View file

@ -15,6 +15,7 @@ public partial class WarehouseListComponent
private bool _readyToShip; private bool _readyToShip;
private List<WarehouseOrderView> _orders { get; set; } private List<WarehouseOrderView> _orders { get; set; }
private bool Loading { get; set; }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
@ -28,31 +29,39 @@ public partial class WarehouseListComponent
private async Task GetOrderStatusNone() private async Task GetOrderStatusNone()
{ {
Loading = true;
_orders = new List<WarehouseOrderView>(); _orders = new List<WarehouseOrderView>();
_orders = await _warehouseRepo.GetWarehouseOrderListByStatus("none"); _orders = await _warehouseRepo.GetWarehouseOrderListByStatus("none");
_readyToShip = false; _readyToShip = false;
Loading = false;
} }
private async Task GetOrderStatusPicked() private async Task GetOrderStatusPicked()
{ {
Loading = true;
_orders = new List<WarehouseOrderView>(); _orders = new List<WarehouseOrderView>();
_orders = await _warehouseRepo.GetWarehouseOrderListByStatus("picked"); _orders = await _warehouseRepo.GetWarehouseOrderListByStatus("picked");
_readyToShip = false; _readyToShip = false;
Loading = false;
} }
private async Task GetOrderStatusPacked() private async Task GetOrderStatusPacked()
{ {
Loading = true;
_orders = new List<WarehouseOrderView>(); _orders = new List<WarehouseOrderView>();
_orders = await _warehouseRepo.GetWarehouseOrderListByStatus("packed"); _orders = await _warehouseRepo.GetWarehouseOrderListByStatus("packed");
_readyToShip = true; _readyToShip = true;
Loading = false;
} }
private async Task GetOrderStatusShipped() private async Task GetOrderStatusShipped()
{ {
Loading = true;
_orders = new List<WarehouseOrderView>(); _orders = new List<WarehouseOrderView>();
var orderList = await _warehouseRepo.GetWarehouseOrderListByStatus("shipped"); var orderList = await _warehouseRepo.GetWarehouseOrderListByStatus("shipped");
_orders = orderList.OrderByDescending(x => x.OrderDate).ToList(); _orders = orderList.OrderByDescending(x => x.OrderDate).ToList();
_readyToShip = false; _readyToShip = false;
Loading = false;
} }
private async Task SetProcessStatusShipped() private async Task SetProcessStatusShipped()

View file

@ -56,6 +56,30 @@ public class CompanyHttpRepository : ICompanyHttpRepository
_apiConfig = apiConfig.Value; _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) public async Task<PagingResponse<CompanyDto>> GetCompaniesPaged(CompanyPagingParams pagingParameters)
{ {
var queryString = new Dictionary<string, string> var queryString = new Dictionary<string, string>

View file

@ -23,6 +23,7 @@ namespace Wonky.Client.HttpRepository;
public interface ICompanyHttpRepository public interface ICompanyHttpRepository
{ {
Task<PagingResponse<CompanyDto>> GetAllCustomersPaged(CompanyPagingParams pagingParameters);
Task<PagingResponse<CompanyDto>> GetCompaniesPaged(CompanyPagingParams pagingParameters); Task<PagingResponse<CompanyDto>> GetCompaniesPaged(CompanyPagingParams pagingParameters);
Task<PagingResponse<CompanyDto>> GetAdminAdvisorCompaniesPaged(string userId, CompanyPagingParams pagingParameters); Task<PagingResponse<CompanyDto>> GetAdminAdvisorCompaniesPaged(string userId, CompanyPagingParams pagingParameters);
Task<CompanyDto> GetCompanyByAccount(string accountNumber); Task<CompanyDto> GetCompanyByAccount(string accountNumber);

View file

@ -352,7 +352,7 @@
<div class="card-footer"> <div class="card-footer">
@if (HideButtons) @if (HideButtons)
{ {
<LoaderBallTriangle /> <LoaderThreeDots />
} }
else else
{ {

View file

@ -20,8 +20,6 @@
@attribute [Authorize(Roles = "Advisor")] @attribute [Authorize(Roles = "Advisor")]
@page "/activity-today" @page "/activity-today"
<div class="card">
<div class="card-header">
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<div class="col-md-6"> <div class="col-md-6">
<h2 class="workDate">@(string.IsNullOrWhiteSpace(_workDate) ? "" : $"{DateTime.Parse(_workDate).ToLongDateString()}")</h2> <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> <a class="btn btn-primary" href="/sales-reports/new">RAPPORT</a>
} }
</div>
</div>
</div> @if (ReportItemListView.ReportItems.Any())
</div> {
</div>
</div>
<div class="card-body">
<ActivityTableComponent Activities="ReportItemListView.ReportItems"></ActivityTableComponent> <ActivityTableComponent Activities="ReportItemListView.ReportItems"></ActivityTableComponent>
</div> }
else
{
<LoaderThreeDots Loading="Loading" />
}

View file

@ -23,10 +23,10 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;
public partial class ActivityTodayListPage public partial class ActivityTodayListPage : IDisposable
{ {
[Inject] private UserPreferenceService _preferenceService { get; set; } [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 HttpInterceptorService _interceptor { get; set; }
[Inject] private NavigationManager _navigator { get; set; } [Inject] private NavigationManager _navigator { get; set; }
[Inject] private IActivityHttpRepository _activityRepo { get; set; } [Inject] private IActivityHttpRepository _activityRepo { get; set; }
@ -36,6 +36,7 @@ public partial class ActivityTodayListPage
private Preferences _prefs { get; set; } = new(); private Preferences _prefs { get; set; } = new();
private string _workDate { get; set; } = $"{DateTime.Now:yyyy-MM-dd}"; private string _workDate { get; set; } = $"{DateTime.Now:yyyy-MM-dd}";
private bool _reportExist = false; private bool _reportExist = false;
private bool Loading { get; set; } = true;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
@ -45,7 +46,9 @@ public partial class ActivityTodayListPage
_interceptor.RegisterEvent(); _interceptor.RegisterEvent();
_interceptor.RegisterBeforeSendEvent(); _interceptor.RegisterBeforeSendEvent();
_reportExist = await _reportRepo.ReportExist(_workDate); _reportExist = await _reportRepo.ReportExist(_workDate);
await GetActivities(_workDate); await GetActivities(_workDate);
} }
@ -55,6 +58,7 @@ public partial class ActivityTodayListPage
_workDate = workDate; _workDate = workDate;
ReportItemListView = new ReportItemListView(); ReportItemListView = new ReportItemListView();
ReportItemListView = await _activityRepo.GetActivities(workDate); ReportItemListView = await _activityRepo.GetActivities(workDate);
Loading = false;
} }
public void Dispose() public void Dispose()

View file

@ -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>

View file

@ -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();
}
}

View file

@ -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>

View file

@ -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;
}
}

View file

@ -38,12 +38,12 @@
<CompanySortComponent OnChanged="SetSortCol" /> <CompanySortComponent OnChanged="SetSortCol" />
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<PageSizeComponent OnChanged="SetPageSize"></PageSizeComponent> <PageSizeComponent OnChanged="SetPageSize" />
</div> </div>
</div> </div>
<div class="row mb-2"> <div class="row mb-2">
<div class="col-md-10"> <div class="col-md-10">
<PaginationComponent MetaData="_metaData" Spread="2" SelectedPage="SelectedPage"></PaginationComponent> <PaginationComponent MetaData="_metaData" Spread="2" SelectedPage="SelectedPage" />
</div> </div>
<div class="col-md-2 justify-content-end"> <div class="col-md-2 justify-content-end">
<a class="btn btn-success" href="/companies/new">Opret kunde</a> <a class="btn btn-success" href="/companies/new">Opret kunde</a>
@ -51,6 +51,6 @@
</div> </div>
</div> </div>
</div> </div>
<CompanyTableComponent Companies="_companyList"></CompanyTableComponent> <CustomerTableComponent Companies="_companyList" />
</div> </div>
</div> </div>

View file

@ -23,16 +23,14 @@ using Wonky.Entity.Requests;
namespace Wonky.Client.Pages; 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; } = ""; [Parameter] public string CountryCode { get; set; } = "";
[Inject] private ILogger<ActivityNewVisitPage> _logger { get; set; } [Inject] private ILogger<ActivityNewVisitPage> _logger { get; set; }
[Inject] private HttpInterceptorService _interceptor { get; set; } [Inject] private HttpInterceptorService _interceptor { get; set; }
[Inject] private UserPreferenceService _preferenceService { get; set; } [Inject] private UserPreferenceService _preferenceService { get; set; }
[Inject] private ICompanyHttpRepository _companyRepo { get; set; } [Inject] private ICompanyHttpRepository _companyRepo { get; set; }
[Inject] private IUserHttpRepository _userRepo { get; set; }
private MetaData _metaData { get; set; } = new(); private MetaData _metaData { get; set; } = new();
private CompanyPagingParams _paging = new(); private CompanyPagingParams _paging = new();
private Preferences _preferences { get; set; } = new(); private Preferences _preferences { get; set; } = new();
@ -54,15 +52,14 @@ public partial class AdminAdvisorCompanyListPage : IDisposable
_interceptor.RegisterEvent(); _interceptor.RegisterEvent();
_interceptor.RegisterBeforeSendEvent(); _interceptor.RegisterBeforeSendEvent();
AdminUserInfo = await _userRepo.GetAdvisorInfo(UserId);
// get companies // get companies
await GetCompanies(); await GetCompanies();
} }
private async Task 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; _companyList = pagingResponse.Items;
_metaData = pagingResponse.MetaData; _metaData = pagingResponse.MetaData;
} }

View file

@ -21,7 +21,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;
public partial class AdminAdvisorUserListPage : IDisposable public partial class CrmUserListPage : IDisposable
{ {
[Parameter] public string CountryCode { get; set; } = ""; [Parameter] public string CountryCode { get; set; } = "";
[Inject] private HttpInterceptorService _interceptor { get; set; } [Inject] private HttpInterceptorService _interceptor { get; set; }

View file

@ -130,7 +130,7 @@
} }
else else
{ {
<LoaderBallTriangle /> <LoaderThreeDots />
} }
</div> </div>
</div> </div>

View file

@ -24,13 +24,13 @@ using Wonky.Entity.DTO;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;
public partial class AdminAdvisorViewPage : IDisposable public partial class CrmUserViewPage : IDisposable
{ {
[Parameter] public string UserId { get; set; } = ""; [Parameter] public string UserId { get; set; } = "";
[Parameter] public string CountryCode { get; set; } = ""; [Parameter] public string CountryCode { get; set; } = "";
[Inject] private HttpInterceptorService _interceptor { get; set; } [Inject] private HttpInterceptorService _interceptor { get; set; }
[Inject] private IUserHttpRepository _userRepo { 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 NavigationManager _navigator { get; set; }
[Inject] private IToastService _toast { get; set; } [Inject] private IToastService _toast { get; set; }
private AdminUserInfoDto AdminUserInfo { get; set; } = new(); private AdminUserInfoDto AdminUserInfo { get; set; } = new();

View file

@ -21,7 +21,7 @@
@attribute [Authorize(Roles = "Advisor")] @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="container-fluid pt-3">
<div class="row mb-2"> <div class="row mb-2">
<div class="col-md-3"> <div class="col-md-3">
@ -34,12 +34,12 @@
<CompanySortComponent OnChanged="SetSortCol" /> <CompanySortComponent OnChanged="SetSortCol" />
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<PageSizeComponent OnChanged="SetPageSize"></PageSizeComponent> <PageSizeComponent OnChanged="SetPageSize" />
</div> </div>
</div> </div>
<div class="row mb-2"> <div class="row mb-2">
<div class="col-md-9"> <div class="col-md-9">
<PaginationComponent MetaData="_metaData" Spread="2" SelectedPage="SelectedPage"></PaginationComponent> <PaginationComponent MetaData="_metaData" Spread="2" SelectedPage="SelectedPage" />
</div> </div>
<div class="col-md-3 justify-content-end"> <div class="col-md-3 justify-content-end">
<a class="btn btn-success text-nowrap" href="/companies/new">Opret kunde</a> <a class="btn btn-success text-nowrap" href="/companies/new">Opret kunde</a>
@ -48,4 +48,4 @@
</div> </div>
</div> </div>
<CompanyTableComponent Companies="_companyList" OnDelete="DeleteCompany"></CompanyTableComponent> <CustomerTableComponent Companies="_companyList" OnDelete="DeleteCompany" />

View file

@ -85,7 +85,7 @@
<EditForm EditContext="_editContext" OnValidSubmit="SubmitCompanyForm"> <EditForm EditContext="_editContext" OnValidSubmit="SubmitCompanyForm">
<DataAnnotationsValidator/> <DataAnnotationsValidator/>
<InputText type="hidden" id="salesRepId" @bind-Value="_companyObject.SalesRepId"/> <InputText type="hidden" id="salesRepId" @bind-Value="_company.SalesRepId"/>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
@ -109,8 +109,8 @@
<InputDate id="nextVisit" class="form-control" @bind-Value="@(_nextVisit)" readonly /> <InputDate id="nextVisit" class="form-control" @bind-Value="@(_nextVisit)" readonly />
</td> </td>
<td> <td>
<InputNumber id="interval" class="form-control" @bind-Value="_companyObject.Interval"/> <InputNumber id="interval" class="form-control" @bind-Value="_company.Interval"/>
<ValidationMessage For="@(() => _companyObject.Interval)"></ValidationMessage> <ValidationMessage For="@(() => _company.Interval)"></ValidationMessage>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -130,65 +130,65 @@
<DisplayStateComponent StateClass="@RegState"></DisplayStateComponent> <DisplayStateComponent StateClass="@RegState"></DisplayStateComponent>
</td> </td>
<td class="align-middle"> <td class="align-middle">
<InputText id="vatNumber" class="form-control" @bind-Value="_companyObject.VatNumber"/> <InputText id="vatNumber" class="form-control" @bind-Value="_company.VatNumber"/>
<ValidationMessage For="@(() => _companyObject.VatNumber)"></ValidationMessage> <ValidationMessage For="@(() => _company.VatNumber)"></ValidationMessage>
</td> </td>
<td class="align-middle">Telefon</td> <td class="align-middle">Telefon</td>
<td class="align-middle"> <td class="align-middle">
<InputText id="phone" class="form-control" @bind-Value="_companyObject.Phone"/> <InputText id="phone" class="form-control" @bind-Value="_company.Phone"/>
<ValidationMessage For="@(() => _companyObject.Phone)"></ValidationMessage> <ValidationMessage For="@(() => _company.Phone)"></ValidationMessage>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="align-middle">Firmanavn</td> <td class="align-middle">Firmanavn</td>
<td class="align-middle"></td> <td class="align-middle"></td>
<td> <td>
<InputText id="name" class="form-control" @bind-Value="_companyObject.Name"/> <InputText id="name" class="form-control" @bind-Value="_company.Name"/>
<ValidationMessage For="@(() => _companyObject.Name)"></ValidationMessage> <ValidationMessage For="@(() => _company.Name)"></ValidationMessage>
</td> </td>
<td class="align-middle">Attention</td> <td class="align-middle">Attention</td>
<td> <td>
<InputText id="attention" class="form-control" @bind-Value="_companyObject.Attention"/> <InputText id="attention" class="form-control" @bind-Value="_company.Attention"/>
<ValidationMessage For="@(() => _companyObject.Attention)"></ValidationMessage> <ValidationMessage For="@(() => _company.Attention)"></ValidationMessage>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="align-middle">Adresse1</td> <td class="align-middle">Adresse1</td>
<td class="align-middle"></td> <td class="align-middle"></td>
<td class="align-middle"> <td class="align-middle">
<InputText id="address1" class="form-control" @bind-Value="_companyObject.Address1"/> <InputText id="address1" class="form-control" @bind-Value="_company.Address1"/>
<ValidationMessage For="@(() => _companyObject.Address1)"></ValidationMessage> <ValidationMessage For="@(() => _company.Address1)"></ValidationMessage>
</td> </td>
<td class="align-middle">Adresse2</td> <td class="align-middle">Adresse2</td>
<td class="align-middle"> <td class="align-middle">
<InputText id="address2" class="form-control" @bind-Value="_companyObject.Address2"/> <InputText id="address2" class="form-control" @bind-Value="_company.Address2"/>
<ValidationMessage For="@(() => _companyObject.Address2)"></ValidationMessage> <ValidationMessage For="@(() => _company.Address2)"></ValidationMessage>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="align-middle">Postnr</td> <td class="align-middle">Postnr</td>
<td class="align-middle"></td> <td class="align-middle"></td>
<td class="align-middle"> <td class="align-middle">
<InputText id="zipCode" class="form-control" @bind-Value="_companyObject.ZipCode"/> <InputText id="zipCode" class="form-control" @bind-Value="_company.ZipCode"/>
<ValidationMessage For="@(() => _companyObject.ZipCode)"></ValidationMessage> <ValidationMessage For="@(() => _company.ZipCode)"></ValidationMessage>
</td> </td>
<td class="align-middle">Bynavn</td> <td class="align-middle">Bynavn</td>
<td class="align-middle"> <td class="align-middle">
<InputText id="city" class="form-control" @bind-Value="_companyObject.City"/> <InputText id="city" class="form-control" @bind-Value="_company.City"/>
<ValidationMessage For="@(() => _companyObject.City)"></ValidationMessage> <ValidationMessage For="@(() => _company.City)"></ValidationMessage>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="align-middle">Mobil</td> <td class="align-middle">Mobil</td>
<td class="align-middle"></td> <td class="align-middle"></td>
<td class="align-middle"> <td class="align-middle">
<InputText id="mobile" class="form-control" @bind-Value="_companyObject.Mobile"/> <InputText id="mobile" class="form-control" @bind-Value="_company.Mobile"/>
<ValidationMessage For="@(() => _companyObject.Mobile)"></ValidationMessage> <ValidationMessage For="@(() => _company.Mobile)"></ValidationMessage>
</td> </td>
<td class="align-middle">Email</td> <td class="align-middle">Email</td>
<td class="align-middle"> <td class="align-middle">
<InputText id="email" class="form-control" @bind-Value="_companyObject.Email"/> <InputText id="email" class="form-control" @bind-Value="_company.Email"/>
<ValidationMessage For="@(() => _companyObject.Email)"></ValidationMessage> <ValidationMessage For="@(() => _company.Email)"></ValidationMessage>
</td> </td>
</tr> </tr>
</tbody> </tbody>

View file

@ -45,7 +45,7 @@ namespace Wonky.Client.Pages
[Inject] private HttpInterceptorService _interceptor { get; set; } [Inject] private HttpInterceptorService _interceptor { get; set; }
[Inject] private VatInfoLookupService _vatService { get; set; } [Inject] private VatInfoLookupService _vatService { get; set; }
private EditContext _editContext { 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 VirkRegInfo _virkRegInfo { get; set; } = new();
private List<VirkRegInfo> _vInfos { get; set; } = new(); private List<VirkRegInfo> _vInfos { get; set; } = new();
private VatAddress _vatAddress { get; set; } = new(); private VatAddress _vatAddress { get; set; } = new();
@ -53,12 +53,12 @@ namespace Wonky.Client.Pages
private string RegState = ""; private string RegState = "";
private DateTime _lastVisit { get; set; } private DateTime _lastVisit { get; set; }
private DateTime _nextVisit { get; set; } private DateTime _nextVisit { get; set; }
private bool _dk = false; private bool _dk { get; set; } = true;
private bool _showInfos = true; private bool _showInfos = true;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
_editContext = new EditContext(_companyObject); _editContext = new EditContext(_company);
_editContext.OnFieldChanged += HandleFieldChanged; _editContext.OnFieldChanged += HandleFieldChanged;
_editContext.OnValidationStateChanged += ValidationChanged; _editContext.OnValidationStateChanged += ValidationChanged;
@ -66,14 +66,13 @@ namespace Wonky.Client.Pages
var ux = await _storage.GetItemAsync<UserInfoView>("_xu"); var ux = await _storage.GetItemAsync<UserInfoView>("_xu");
_dk = ux.CountryCode.ToLower() == "dk"; _dk = ux.CountryCode.ToLower() == "dk";
_companyObject.SalesRepId = ux.Id; _company.SalesRepId = ux.Id;
_companyObject.CountryCode = ux.CountryCode.ToLower(); _company.CountryCode = ux.CountryCode.ToLower();
_lastVisit = DateTime.Now; _lastVisit = DateTime.Now;
_nextVisit = DateTime.Now.AddDays(_companyObject.Interval * 7); _nextVisit = DateTime.Now.AddDays(_company.Interval * 7);
_company.LastVisit = $"{_lastVisit:yyyy-MM-dd}";
_companyObject.LastVisit = $"{_lastVisit:yyyy-MM-dd}"; _company.NextVisit = $"{_nextVisit:yyyy-MM-dd}";
_companyObject.LastVisit = $"{_nextVisit:yyyy-MM-dd}";
_interceptor.RegisterEvent(); _interceptor.RegisterEvent();
_interceptor.RegisterBeforeSendEvent(); _interceptor.RegisterBeforeSendEvent();
@ -112,38 +111,38 @@ namespace Wonky.Client.Pages
_showInfos = false; _showInfos = false;
_virkRegInfo = (from x in _vInfos where x.VatNumber == vatNumber select x).First(); _virkRegInfo = (from x in _vInfos where x.VatNumber == vatNumber select x).First();
RegState = _virkRegInfo.States[^1].State == "NORMAL" ? "the-good" : "the-ugly"; RegState = _virkRegInfo.States[^1].State == "NORMAL" ? "the-good" : "the-ugly";
_companyObject.Name = _virkRegInfo.Name; _company.Name = _virkRegInfo.Name;
_companyObject.Address1 = _virkRegInfo.Address; _company.Address1 = _virkRegInfo.Address;
_companyObject.Address2 = _virkRegInfo.CoName; _company.Address2 = _virkRegInfo.CoName;
_companyObject.ZipCode = _virkRegInfo.ZipCode; _company.ZipCode = _virkRegInfo.ZipCode;
_companyObject.City = _virkRegInfo.City; _company.City = _virkRegInfo.City;
_companyObject.VatNumber = _virkRegInfo.VatNumber; _company.VatNumber = _virkRegInfo.VatNumber;
_companyObject.ValidVat = 1; _company.ValidVat = 1;
StateHasChanged(); StateHasChanged();
} }
private async Task SubmitCompanyForm() private async Task SubmitCompanyForm()
{ {
_companyObject.LastVisit = $"{_lastVisit:yyyy-MM-dd}"; _company.LastVisit = $"{_lastVisit:yyyy-MM-dd}";
_companyObject.NextVisit = $"{_nextVisit: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)) if (!string.IsNullOrWhiteSpace(newId))
{ {
_toast.ShowSuccess($"'{_companyObject.Name}' er oprettet i CRM."); _toast.ShowSuccess($"'{_company.Name}' er oprettet i CRM.");
_navigator.NavigateTo($"/companies/{newId}"); _navigator.NavigateTo($"/companies/{newId}");
} }
else else
{ {
_toast.ShowWarning($"'{_companyObject.Name}' IKKE oprettet."); _toast.ShowWarning($"'{_company.Name}' IKKE oprettet.");
} }
} }
private void HandleFieldChanged(object sender, FieldChangedEventArgs e) 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."); _toast.ShowError("Dato for næste besøg skal ligge efter sidste besøg.");
_formInvalid = true; _formInvalid = true;
@ -160,7 +159,7 @@ namespace Wonky.Client.Pages
_editContext.OnFieldChanged -= HandleFieldChanged; _editContext.OnFieldChanged -= HandleFieldChanged;
_editContext = new EditContext(_companyObject); _editContext = new EditContext(_company);
_formInvalid = !_editContext.Validate(); _formInvalid = !_editContext.Validate();

View file

@ -28,6 +28,8 @@
<div class="card-header bg-dark text-white"> <div class="card-header bg-dark text-white">
<h3>@_company.Account - @_company.Name</h3> <h3>@_company.Account - @_company.Name</h3>
</div> </div>
@if (_dk && !_validVat)
{
<div class="card-body"> <div class="card-body">
<VatAddressInputComponent Address="vatAddress" OnValidSubmit="GetInfoFromAddress"/> <VatAddressInputComponent Address="vatAddress" OnValidSubmit="GetInfoFromAddress"/>
</div> </div>
@ -61,7 +63,7 @@
</tbody> </tbody>
</table> </table>
} }
}
<EditForm EditContext="_editContext" OnValidSubmit="SubmitUpdate"> <EditForm EditContext="_editContext" OnValidSubmit="SubmitUpdate">
<DataAnnotationsValidator/> <DataAnnotationsValidator/>
<div class="card-body"> <div class="card-body">
@ -163,7 +165,7 @@
</DisplayStateComponent> </DisplayStateComponent>
</td> </td>
<td> <td>
<InputDate id="nextVisit" class="form-control" @bind-Value="@(_nextVisit)" readonly /> <InputDate id="nextVisit" class="form-control" @bind-Value="@(_nextVisit)"/>
</td> </td>
<th> <th>
Besøgt Besøgt
@ -210,7 +212,8 @@
<ActivityButton ActionLink="@_actionLink" <ActivityButton ActionLink="@_actionLink"
ButtonText="Besøg" ButtonText="Besøg"
ButtonType="primary" ButtonType="primary"
Enabled="@_enableActivity"></ActivityButton> Enabled="@_enableActivity">
</ActivityButton>
</div> </div>
</div> </div>
</div> </div>
@ -219,5 +222,5 @@
} }
else else
{ {
<LoaderBallTriangle/> <LoaderThreeDots />
} }

View file

@ -63,6 +63,7 @@ public partial class CustomerViewPage : IDisposable
private string _actionLink = ""; private string _actionLink = "";
private bool _working; private bool _working;
private string _btnUpdateText = "Opdater"; private string _btnUpdateText = "Opdater";
private bool _dk { get; set; } = true;
private readonly JsonSerializerOptions _options = new () private readonly JsonSerializerOptions _options = new ()
{ {
@ -84,21 +85,20 @@ public partial class CustomerViewPage : IDisposable
{ {
var ux = await _storage.GetItemAsync<UserInfoView>("_xu"); var ux = await _storage.GetItemAsync<UserInfoView>("_xu");
countryCode = ux.CountryCode; countryCode = ux.CountryCode;
_dk = ux.CountryCode.ToLower() == "dk";
_interceptor.RegisterEvent(); _interceptor.RegisterEvent();
_interceptor.RegisterBeforeSendEvent(); _interceptor.RegisterBeforeSendEvent();
_company = await _companyRepo.GetCompanyById(CompanyId); _company = await _companyRepo.GetCompanyById(CompanyId);
_logger.LogDebug("CompanyView => _company <= {_company}", JsonSerializer.Serialize(_company, _options));
_orgVat = _company.VatNumber; _orgVat = _company.VatNumber;
_company.CountryCode = ux.CountryCode.ToLower(); _company.CountryCode = ux.CountryCode.ToLower();
_enableActivity = _company.ValidVat; _enableActivity = _company.ValidVat;
// override if canvas which has account property as empty string or "NY" // override if canvas which has account property as empty string or "NY"
if (_company.Account == "NY" || string.IsNullOrWhiteSpace(_company.Account)) if (_company.Account == "NY" || string.IsNullOrWhiteSpace(_company.Account))
_enableActivity = 1; _enableActivity = 1;
if (_dk)
vatAddress = PrepareVatAddress(_company); vatAddress = PrepareVatAddress(_company);
if (_company.Interval == 0) if (_company.Interval == 0)
@ -106,41 +106,41 @@ public partial class CustomerViewPage : IDisposable
_lastVisit = DateTime.Parse(_company.LastVisit); _lastVisit = DateTime.Parse(_company.LastVisit);
_nextVisit = DateTime.Parse(_company.NextVisit); _nextVisit = DateTime.Parse(_company.NextVisit);
if (_lastVisit.Year < 2020) if (_lastVisit.Year < 2020)
{
_lastVisit = DateTime.Parse("2020-01-01"); _lastVisit = DateTime.Parse("2020-01-01");
}
if (!_company.ValidDateSpan()) if (!_company.ValidDateSpan())
_nextVisit = _lastVisit.AddDays(_company.Interval * 7); _nextVisit = _lastVisit.AddDays(_company.Interval * 7);
_visitState = Utils.GetVisitState($"{_nextVisit:yyyy-MM-dd}"); _visitState = Utils.GetVisitState($"{_nextVisit:yyyy-MM-dd}");
_actionLink = $"/companies/{CompanyId}/activities/new"; // used when drawing visit button
_actionLink = $"/companies/{CompanyId}/activities/new";
if(_company.HasFolded == 1) if(_company.HasFolded == 1)
{ {
// this is only used if user has selected to show all customers
_hasFolded = true; _hasFolded = true;
_vatState = "the-dead"; _vatState = "the-dead";
_visitState = "the-dead"; _visitState = "the-dead";
} }
else else
{ {
// simple format validation if CRM indicates invalid vatNumber
if (_company.ValidVat == 0 && !string.IsNullOrWhiteSpace(_company.VatNumber)) if (_company.ValidVat == 0 && !string.IsNullOrWhiteSpace(_company.VatNumber))
_company.ValidVat = VatUtils.ValidateFormat(_company.CountryCode, _company.VatNumber) ? 1 : 0; _company.ValidVat = VatUtils.ValidateFormat(_company.CountryCode, _company.VatNumber) ? 1 : 0;
_validVat = _company.ValidVat == 1; // flags
_vatState = _company.ValidVat == 1 ? "the-good" : "the-draw"; _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 = new EditContext(_company);
_editContext.OnFieldChanged += HandleFieldChanged; _editContext.OnFieldChanged += HandleFieldChanged;
_editContext.OnValidationStateChanged += ValidationChanged; _editContext.OnValidationStateChanged += ValidationChanged;
} }
private void HandleFieldChanged(object sender, FieldChangedEventArgs e) private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
{ {
_nextVisit = _lastVisit.AddDays(_company.Interval * 7); _nextVisit = _lastVisit.AddDays(_company.Interval * 7);
// simple format validation if CRM indicates invalid vatNumber
if (!VatUtils.ValidateFormat(_company.CountryCode, _company.VatNumber)) if (!VatUtils.ValidateFormat(_company.CountryCode, _company.VatNumber))
{ {
_formInvalid = true; _formInvalid = true;
@ -151,6 +151,7 @@ public partial class CustomerViewPage : IDisposable
} }
StateHasChanged(); StateHasChanged();
} }
private void ValidationChanged(object sender, ValidationStateChangedEventArgs e) private void ValidationChanged(object sender, ValidationStateChangedEventArgs e)
{ {
_formInvalid = false; _formInvalid = false;
@ -167,6 +168,7 @@ public partial class CustomerViewPage : IDisposable
private async Task SubmitUpdate() private async Task SubmitUpdate()
{ {
// simple format validation if CRM indicates invalid vatNumber
if (!VatUtils.ValidateFormat(_company.CountryCode, _company.VatNumber)) if (!VatUtils.ValidateFormat(_company.CountryCode, _company.VatNumber))
{ {
_toast.ShowError($"CVR/VAT/ORG nummer mangler eller er ugyldig."); _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.LastVisit = $"{_lastVisit:yyyy-MM-dd}";
_company.NextVisit = $"{_nextVisit:yyyy-MM-dd}"; _company.NextVisit = $"{_nextVisit:yyyy-MM-dd}";
_company.IsHidden = 0; _company.IsHidden = 0;
// flag if backend should update ERP system
if (_company.VatNumber != _orgVat) if (_company.VatNumber != _orgVat)
_company.UpdateErpVat = 1; _company.UpdateErpVat = 1;
var x = JsonSerializer.Serialize(_company, _options);
_logger.LogInformation(x);
var success = await _companyRepo.UpdateCompany(CompanyId, _company ); var success = await _companyRepo.UpdateCompany(CompanyId, _company );
if (success) 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 = await _companyRepo.GetCompanyById(_company.CompanyId);
_company.ValidVat = 1; _company.ValidVat = 1;
StateHasChanged(); StateHasChanged();
} }
_hideButtons = false; _hideButtons = false;
} }
@ -205,11 +204,11 @@ public partial class CustomerViewPage : IDisposable
HouseNumber = address.HouseNumber, HouseNumber = address.HouseNumber,
ZipCode = address.ZipCode ZipCode = address.ZipCode
}); });
if (!_vInfos.Any()) if (!_vInfos.Any())
{
_toast.ShowError($"Ingen virksomheder fundet."); _toast.ShowError($"Ingen virksomheder fundet.");
} }
}
private void SelectCompany(string vatNumber, bool syncAll) private void SelectCompany(string vatNumber, bool syncAll)
{ {
_virkRegInfo = (from x in _vInfos where x.VatNumber == vatNumber select x).First(); _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; _company.VatNumber = _virkRegInfo.VatNumber;
} }
// empty list
_vInfos = new List<VirkRegInfo>(); _vInfos = new List<VirkRegInfo>();
StateHasChanged(); StateHasChanged();
} }
@ -237,9 +236,10 @@ public partial class CustomerViewPage : IDisposable
_editContext.OnFieldChanged -= HandleFieldChanged; _editContext.OnFieldChanged -= HandleFieldChanged;
_editContext.OnValidationStateChanged -= ValidationChanged; _editContext.OnValidationStateChanged -= ValidationChanged;
} }
private static VatAddress PrepareVatAddress(CompanyDto model) private static VatAddress PrepareVatAddress(CompanyDto model)
{ {
var digits = "123456789".ToCharArray(); var digits = "1234567890".ToCharArray();
// process address1 // process address1
var pos1 = model.Address1.IndexOfAny(digits); var pos1 = model.Address1.IndexOfAny(digits);
if (pos1 > 0) if (pos1 > 0)
@ -262,6 +262,7 @@ public partial class CustomerViewPage : IDisposable
HouseNumber = Regex.Replace(model.Address2[pos2..], "[^0-9]", "") HouseNumber = Regex.Replace(model.Address2[pos2..], "[^0-9]", "")
}; };
} }
// return empty model
return new VatAddress(); return new VatAddress();
} }
} }

View file

@ -23,23 +23,21 @@
@attribute [Authorize(Roles = "Advisor,Admin,Office,Warehouse")] @attribute [Authorize(Roles = "Advisor,Admin,Office,Warehouse")]
<div class="row mb-2"> <div class="row mb-2">
<div class="col col-md-4"> <div class="col">
<div class="text-center"> <div class="text-center">
<img class="grumpy-coder mb-2" src="@_app?.Image" alt="Wonky Logo"/> <img class="grumpy-coder mb-2" src="@_app?.Image" alt="Wonky Logo"/>
<h5><AppVersion></AppVersion></h5> <h5><AppVersion></AppVersion></h5>
</div> </div>
</div> </div>
</div> </div>
<div class="row mb-2"> <div class="row mb-2">
<div class="col col-md-4"> <div class="col">
<h2 class="text-center">Piktogrammer</h2> <h2 class="text-center">Piktogrammer</h2>
<ColorCoding></ColorCoding> <ColorCoding></ColorCoding>
</div> </div>
</div> </div>
<div class="row mb-2"> <div class="row mb-2">
<div class="col col-md-4"> <div class="col">
<h2 class="text-center">Testede browsere</h2> <h2 class="text-center">Testede browsere</h2>
<ul class="list-group"> <ul class="list-group">
<li class="list-group-item">Safari (macOS, iOS)</li> <li class="list-group-item">Safari (macOS, iOS)</li>
@ -51,9 +49,8 @@
</ul> </ul>
</div> </div>
</div> </div>
<div class="row mb-2"> <div class="row mb-2">
<div class="col col-md-4"> <div class="col">
<h2 class="text-center">Open Source</h2> <h2 class="text-center">Open Source</h2>
<ul class="list-group"> <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> <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>
</div> </div>
@code{ @code{
[Inject] [Inject]

View file

@ -21,15 +21,20 @@
@using Wonky.Client.Components; @using Wonky.Client.Components;
@using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Advisor,Admin,Supervisor,Office,Warehouse")] @attribute [Authorize(Roles = "Advisor,Admin,Supervisor,Office,Warehouse")]
<AuthorizeView Roles="Advisor"> <AuthorizeView Roles="Advisor">
<AdvisorLandingComponent /> <LandingComponentAdvisor />
</AuthorizeView> </AuthorizeView>
<AuthorizeView Roles="Warehouse"> <AuthorizeView Roles="Warehouse">
<WarehouseListComponent /> <WarehouseListComponent />
</AuthorizeView> </AuthorizeView>
<AuthorizeView Roles="Admin">
<LandingComponentAdmin />
</AuthorizeView>
@code{ @code{
} }

View file

@ -21,7 +21,7 @@
@attribute [Authorize(Roles = "Advisor,Admin")] @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="container-fluid pt-3">
<div class="row mb-3"> <div class="row mb-3">
<div class="col"> <div class="col">

View file

@ -61,7 +61,7 @@
<div class="col d-flex justify-content-center"> <div class="col d-flex justify-content-center">
@if (execLogin) @if (execLogin)
{ {
<LoaderBallTriangle /> <LoaderThreeDots />
} }
</div> </div>
</div> </div>

View file

@ -21,7 +21,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;
public partial class AdvisorReportListPage : IDisposable public partial class ReportListPageAdvisor : IDisposable
{ {
[Inject] private IReportHttpRepository _reportRepo { get; set; } [Inject] private IReportHttpRepository _reportRepo { get; set; }
[Inject] private HttpInterceptorService _interceptor { get; set; } [Inject] private HttpInterceptorService _interceptor { get; set; }

View file

@ -21,7 +21,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;
public partial class AdminReportListPage : IDisposable public partial class ReportListPageOffice : IDisposable
{ {
[Parameter] public string UserId { get; set; } = ""; [Parameter] public string UserId { get; set; } = "";
[Parameter] public string CountryCode { get; set; } = ""; [Parameter] public string CountryCode { get; set; } = "";

View file

@ -29,14 +29,14 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;
public partial class AdvisorReportNewPage : IDisposable public partial class ReportNewPageAdvisor : IDisposable
{ {
[Inject] private HttpInterceptorService _interceptor { get; set; } [Inject] private HttpInterceptorService _interceptor { get; set; }
[Inject] private UserPreferenceService _userPrefs { get; set; } [Inject] private UserPreferenceService _userPrefs { get; set; }
[Inject] private IActivityHttpRepository _activityRepo { get; set; } [Inject] private IActivityHttpRepository _activityRepo { get; set; }
[Inject] private IReportHttpRepository _reportRepo { get; set; } [Inject] private IReportHttpRepository _reportRepo { get; set; }
[Inject] private NavigationManager _navigator { 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; } [Inject] private IToastService _toast { get; set; }
private EditContext _editContext { get; set; } private EditContext _editContext { get; set; }
private ReportDto _report { get; set; } = new(); private ReportDto _report { get; set; } = new();

View file

@ -20,7 +20,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;
public partial class AdvisorReportViewPage public partial class ReportViewPageAdvisor
{ {
[Parameter] public string ReportDate { get; set; } [Parameter] public string ReportDate { get; set; }
[Inject] private IReportHttpRepository _reportRepo { get; set; } [Inject] private IReportHttpRepository _reportRepo { get; set; }

View file

@ -21,7 +21,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;
public partial class AdminReportViewPage : IDisposable public partial class ReportViewPageOffice : IDisposable
{ {
/// <summary> /// <summary>
/// Country code from url parameter /// Country code from url parameter

View file

@ -27,7 +27,7 @@ namespace Wonky.Client.Pages;
public partial class TaskItemListPage : IDisposable public partial class TaskItemListPage : IDisposable
{ {
[Inject] public UserPreferenceService UserPrefs { get; set; } [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 HttpInterceptorService _interceptor { get; set; }
[Inject] private NavigationManager _navigator { get; set; } [Inject] private NavigationManager _navigator { get; set; }
[Inject] private ITaskItemHttpRepository _taskItemRepo { get; set; } [Inject] private ITaskItemHttpRepository _taskItemRepo { get; set; }

View file

@ -1,6 +1,4 @@
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Components @using Wonky.Client.Components
@attribute [Authorize(Roles = "Admin,Warehouse,Office")]
@page "/warehouse/orders" @page "/warehouse/orders"
<WarehouseListComponent /> <WarehouseListComponent />

View file

@ -100,5 +100,5 @@
} }
else else
{ {
<LoaderBallTriangle /> <LoaderThreeDots />
} }

View file

@ -13,6 +13,7 @@ public partial class WarehouseOrderViewPage : IDisposable
[Inject] private NavigationManager _navigator { get; set; } [Inject] private NavigationManager _navigator { get; set; }
private WarehouseOrderView _order { get; set; } = new(); private WarehouseOrderView _order { get; set; } = new();
private bool Loading { get; set; }
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {

View file

@ -28,7 +28,6 @@ public class VatInfoLookupService
private readonly JsonSerializerOptions _options = new() { PropertyNameCaseInsensitive = true }; private readonly JsonSerializerOptions _options = new() { PropertyNameCaseInsensitive = true };
private readonly HttpClient _client; private readonly HttpClient _client;
private readonly IOptions<ApiConfig> _apiConfig; private readonly IOptions<ApiConfig> _apiConfig;
private readonly List<VirkRegInfo> _noData = new() { new VirkRegInfo { Name = "INGEN DATA" } };
private readonly ApiConfig _config; private readonly ApiConfig _config;
public VatInfoLookupService(HttpClient client, IOptions<ApiConfig> apiConfig) public VatInfoLookupService(HttpClient client, IOptions<ApiConfig> apiConfig)
@ -40,28 +39,38 @@ public class VatInfoLookupService
public async Task<List<VirkRegInfo>> QueryVirkRegistry(VirkParams query) public async Task<List<VirkRegInfo>> QueryVirkRegistry(VirkParams query)
{ {
Console.WriteLine(JsonSerializer.Serialize(query));
if(!ValidateCvrQuery(query)) if(!ValidateCvrQuery(query))
{
throw new ArgumentException("CvrQuery does not validate"); throw new ArgumentException("CvrQuery does not validate");
}
var queryString = new Dictionary<string, string> var queryString = new Dictionary<string, string>
{ {
["vatNumber"] = $"{query.VatNumber}", ["vatNumber"] = $"{query.VatNumber}",
["streetName"] = $"{query.StreetName}", ["streetName"] = $"{query.StreetName}",
["houseNumber"] = $"{query.HouseNumber}", ["houseNumber"] = $"{query.HouseNumber}",
["zipCode"] = $"{query.ZipCode}" ["zipCode"] = $"{query.ZipCode}",
["entityName"] = $"{query.EntityName}"
}; };
var endpoint = QueryHelpers.AddQueryString(_config.ServiceVirk, queryString); var endpoint = QueryHelpers.AddQueryString(_config.ServiceVirk, queryString);
var response = await _client.GetAsync(endpoint); var response = await _client.GetAsync(endpoint);
var content = await response.Content.ReadAsStringAsync(); var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
var jsonResult = JsonSerializer.Deserialize<List<VirkRegInfo>>(content, _options); 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 var result = jsonResult
//.Where(x => x.States[^1].State == "NORMAL") //.Where(x => x.States[^1].State == "NORMAL")
.OrderBy(x => x.Name).ToList(); .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) public async Task<List<VirkRegInfo>> QueryBrRegistry(string vatNumber)
@ -70,19 +79,21 @@ public class VatInfoLookupService
{ {
["vatNumber"] = $"{vatNumber}" ["vatNumber"] = $"{vatNumber}"
}; };
var endpoint = QueryHelpers.AddQueryString(_config.ServiceBrReg, queryString); var endpoint = QueryHelpers.AddQueryString(_config.ServiceBrReg, queryString);
var response = await _client.GetAsync(endpoint); var response = await _client.GetAsync(endpoint);
var content = await response.Content.ReadAsStringAsync(); var content = await response.Content.ReadAsStringAsync();
var jsonResult = JsonSerializer.Deserialize<List<VirkRegInfo>>(content, _options); 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 var result = jsonResult
//.Where(x => x.States[^1].State == "NORMAL") //.Where(x => x.States[^1].State == "NORMAL")
.OrderBy(x => x.Name).ToList(); .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) public async Task<List<VirkRegInfo>> QueryViesRegistry(string vatNumber)
@ -97,13 +108,13 @@ public class VatInfoLookupService
var content = await response.Content.ReadAsStringAsync(); var content = await response.Content.ReadAsStringAsync();
var jsonResult = JsonSerializer.Deserialize<List<VirkRegInfo>>(content, _options); 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 var result = jsonResult
//.Where(x => x.States[^1].State == "NORMAL") //.Where(x => x.States[^1].State == "NORMAL")
.OrderBy(x => x.Name).ToList(); .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) private static bool ValidateCvrQuery(VirkParams query)

View file

@ -1,16 +1,16 @@
{ {
"appInfo": { "appInfo": {
"name": "Wonky Client", "name": "Wonky Client",
"version": "0.10.10", "version": "0.10.16",
"rc": false, "rc": false,
"sandBox": false, "sandBox": false,
"image": "grumpy-coder.png" "image": "grumpy-coder.png"
}, },
"apiConfig": { "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=", "glsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=",
"glsId": "", "glsId": "",
"servcieVirk": "api/v2/services/virk", "serviceVirk": "api/v2/services/virk",
"serviceBrReg": "api/v2/services/brReg", "serviceBrReg": "api/v2/services/brReg",
"servcieVies": "api/v2/services/vies", "servcieVies": "api/v2/services/vies",
"crmAuth": "token", "crmAuth": "token",

View file

@ -12,7 +12,7 @@ body {
.workDate { .workDate {
font-variant: small-caps; font-variant: small-caps;
} }
/* visit / vat state classes */ /* begin state elements */
.state { .state {
width: 16px; width: 16px;
height: 16px; height: 16px;
@ -34,10 +34,13 @@ body {
.the-draw { .the-draw {
background-color: #9b02fc; background-color: #9b02fc;
} }
.the-dead { .no-vat {
background-color: #262626; background-color: yellow;
} }
/* end visit state classes*/ .the-dead {
background-color: black;
}
/* end state elements */
.btn.btn-edit { .btn.btn-edit {
color: #030303; color: #030303;

View file

@ -5,14 +5,14 @@
<title>Inno Web CRM</title> <title>Inno Web CRM</title>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <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="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="32x32" href="favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png" />
<link rel="mask-icon" href="safari-pinned-tab.svg" color="#5bbad5"> <link rel="mask-icon" href="safari-pinned-tab.svg" color="#5bbad5" />
<meta name="msapplication-TileColor" content="#ffaa00"> <meta name="msapplication-TileColor" content="#ffaa00" />
<meta name="theme-color" content="#000"> <meta name="theme-color" content="#000" />
<base href="/" /> <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="css/app.css" rel="stylesheet" />
<link href="Wonky.Client.styles.css" rel="stylesheet" /> <link href="Wonky.Client.styles.css" rel="stylesheet" />
<link href="_content/Blazored.Toast/blazored-toast.min.css" rel="stylesheet" /> <link href="_content/Blazored.Toast/blazored-toast.min.css" rel="stylesheet" />
@ -21,7 +21,7 @@
<div id="app"> <div id="app">
<div class="m-5 d-flex justify-content-center"> <div class="m-5 d-flex justify-content-center">
<!-- loader credit: samherbert.net/svg-loaders --> <!-- 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>
</div> </div>
<script src="/bootstrap/js/bootstrap.bundle.min.js"></script> <script src="/bootstrap/js/bootstrap.bundle.min.js"></script>