wip v0.3-beta

This commit is contained in:
Frede Hundewadt 2022-05-31 19:07:39 +02:00
parent 003474e5fb
commit 1abd19f4c0
128 changed files with 1155 additions and 750 deletions

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -0,0 +1,13 @@
@if (Enabled)
{
<a type="button" class="btn btn-primary" href="/company/@CompanyId/activity">Opret Besøg</a>
}
else
{
<a type="button" class="btn btn-primary disabled" aria-disabled="true">Opret Besøg</a>
}
@code {
[Parameter] public string? CompanyId { get; set; }
[Parameter] public bool Enabled { get; set; }
}

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@<div> *@<div>

View file

@ -1,23 +1,24 @@
@using Wonky.Entity.Configuration
@using Microsoft.Extensions.Options
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@
<span class="version">@Name</span> <span class="version">@Version</span>@if(IsBeta){<span class="version">-beta</span>} <span class="version">@Version</span>@if(IsBeta){<span class="version">-beta</span>}
@code @code
{ {
private const string Version = "0.2.48"; private const string Version = "0.3";
private const string Name = "wwo";
private const bool IsBeta = true; private const bool IsBeta = true;
} }

View file

@ -1,4 +0,0 @@
a, a:link, a:hover, a:visited, a:active {
color: #ffaa00;
}

View file

@ -0,0 +1,50 @@
<table class="table">
<thead>
<tr>
<th scope="col">Farvekode</th>
<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"/>
</td>
<td>
Ok
</td>
</tr>
<tr>
<td>
<img class="state the-bad rounded-circle me-1" src="state.png" alt="state"/>
</td>
<td>
Planlæg besøg
</td>
</tr>
<tr>
<td>
<img class="state the-ugly rounded-circle me-1" src="state.png" alt="state"/>
</td>
<td>
Inteval overskredet
</td>
</tr>
<tr>
<td>
<img class="state the-draw rounded-circle me-1" src="state.png" alt="state"/>
</td>
<td>
Opdatering nødvendig
</td>
</tr>
<tr>
<td>
<img class="state the-dead rounded-circle me-1" src="state.png" alt="state"/>
</td>
<td>
Virksomhed ophørt
</td>
</tr>
</tbody>
</table>

View file

@ -0,0 +1,4 @@
.color-code {
max-width: 40px;
}

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,16 +1,16 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,16 +1,16 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -1,38 +1,51 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@
@using Wonky.Client.Components; @using Wonky.Client.Components;
@using Wonky.Client.Helpers; @using Wonky.Client.Helpers;
@if (Companies.Any()) @if (Companies.Any())
{ {
<ul class="list-group list-group-flush"> <table class="table">
<thead>
<tr>
<th scope="col"></th>
<th scope="col">Navn</th>
<th scope="col">Konto</th>
<th scope="col">Bynavn</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@foreach (var company in Companies) @foreach (var company in Companies)
{ {
<li class="d-flex justify-content-between align-items-start list-group-item list-group-item-action" style="cursor:pointer" @onclick="() => NavigateCompany(company.CompanyId)"> <tr>
<div class="me-auto"> <td><DisplayStateComponent StateClass="@(company.HasFolded == 1 ? "the-dead" : Utils.GetVisitState(company.NextVisit))"></DisplayStateComponent></td>
<div class="fw-bold mb-1"> <td>@company.Name</td>
<DisplayStateComponent StateClass="@(company.HasFolded == 1 ? "the-dead" : Utils.GetVisitState(company.NextVisit))"></DisplayStateComponent>@company.Name <td>@company.Account</td>
</div> <td>@company.City</td>
<span class="fw-bold me-1">Konto:</span>@company.Account<span class="fw-bold mx-1">Bynavn:</span>@company.City <td>
</div> <a class="btn btn-info" href="/company/@company.CompanyId">Vis</a>
<span class="badge bg-primary">Vis</span> <CreateActivityButton CompanyId="@company.CompanyId" Enabled="@company.ValidVat"></CreateActivityButton>
</li> </td>
</tr>
} }
</ul> </tbody>
</table>
} }
else else
{ {

View file

@ -1,35 +1,46 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
using Blazored.LocalStorage;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Wonky.Client.Helpers;
using Wonky.Client.Services;
using Wonky.Client.Shared; using Wonky.Client.Shared;
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Views;
namespace Wonky.Client.Components namespace Wonky.Client.Components
{ {
public partial class CompanyTable public partial class CompanyTable
{ {
[Parameter] public List<DtoNgCompany> 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; }
[Parameter] public EventCallback<string> OnSelect { get; set; } [Parameter] public EventCallback<string> OnSelect { get; set; }
[Inject] public NavigationManager NavManager { get; set; } [Inject] public NavigationManager NavManager { get; set; }
[Inject] public VatUtils VatUtils { get; set; }
[Inject] public ILocalStorageService Storage { get; set; }
private Confirmation _confirmation = new (); private Confirmation _confirmation = new ();
private string _companyId = string.Empty; private string _companyId = string.Empty;
private UserInfoView _user = new();
protected override async Task OnInitializedAsync()
{
_user = await Storage.GetItemAsync<UserInfoView>("_xu").ConfigureAwait(true);
}
private void CallConfirmationModal(string companyId) private void CallConfirmationModal(string companyId)
{ {
_companyId = companyId; _companyId = companyId;

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,18 +1,61 @@
@using Microsoft.AspNetCore.Authorization
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@
@attribute [Authorize]
<PageTitle>Innotec Danmark A/S</PageTitle> <PageTitle>Innotec Danmark A/S</PageTitle>
<AuthorizeView>
<Authorized>
<h5>@_workDate</h5>
<hr />
<h5>Dagens aktivitet</h5>
<table class="table">
<thead>
<tr>
<th scope="col">Kunde</th>
<th scope="col">Demo</th>
<th scope="col">Salg</th>
<th scope="col">Sum</th>
</tr>
</thead>
<tbody>
@if (Activities != null)
{
foreach (var activity in Activities)
{
<tr>
<td>
@activity.Company.Name
</td>
<td>
@activity.Demo
</td>
<td>
@activity.SalesResume
</td>
<td>
@activity.OrderAmount
</td>
</tr>
}
}
</tbody>
</table>
</Authorized>
</AuthorizeView>

View file

@ -1,25 +1,56 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
using Blazored.LocalStorage;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.VisualBasic;
using Wonky.Client.HttpRepository;
using Wonky.Client.Services;
using Wonky.Client.Shared;
using Wonky.Entity.DTO;
using Wonky.Entity.Models;
namespace Wonky.Client.Components namespace Wonky.Client.Components;
public partial class Home
{ {
public partial class Home [Inject] public ILocalStorageService Storage { get; set; }
[Inject] public ILogger<Home> Logger { get; set; }
[Inject] public UserPreferenceService Prefernces { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public IActivityHttpRepository ActivityRepo { get; set; }
private Preferences _prefs = new();
private string _workDate;
private List<ReportActivity> Activities { get; set; }
protected override async Task OnInitializedAsync()
{ {
[Parameter] public RenderFragment? LoginContent { get; set; } if (string.IsNullOrWhiteSpace(await Storage.GetItemAsStringAsync("_xa").ConfigureAwait(true)))
Navigator.NavigateTo("/login/home");
_prefs = await Prefernces.GetPreferences();
if (string.IsNullOrWhiteSpace(_prefs.WorkDate))
{
await Prefernces.SetWorkDate(DateTime.Now);
}
_workDate = DateTime.Parse(_prefs.WorkDate).ToLongDateString();
Activities = await ActivityRepo.GetActivities(_prefs.WorkDate).ConfigureAwait(true);
} }
} }

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -17,6 +17,7 @@ using Blazored.Toast.Services;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Models; using Wonky.Entity.Models;
using Wonky.Entity.Views;
namespace Wonky.Client.Components; namespace Wonky.Client.Components;

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,16 +1,16 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,16 +1,16 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@
@ -18,10 +18,6 @@
@using System.Security.Claims @using System.Security.Claims
<AuthorizeView> <AuthorizeView>
<Authorized> <Authorized>
@context.User.Identity.Name @context.User.Identity?.Name
<a href="Logout">Log af</a>
</Authorized> </Authorized>
<NotAuthorized>
<a href="Login">Log ind</a>
</NotAuthorized>
</AuthorizeView> </AuthorizeView>

View file

@ -1,29 +1,24 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@@using Wonky.Client.Components *@
@page "/About"
<div class="row mb-2">
<div class="img-fluid text-center">
<img src="grumpy-coder.png" alt="Wonky Logo"/>
</div>
</div>
<div class="row">
<div class="col text-center">
<AppVersion />
</div>
</div>
@using System.Security.Claims
<AuthorizeView>
<Authorized>
<a class="btn btn-outline-light" href="logout">Log af</a>
<a class="btn btn-outline-light" href="info">INFO</a>
</Authorized>
</AuthorizeView>

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -0,0 +1,100 @@
using System.Globalization;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Rendering;
namespace Wonky.Client.Helpers;
public class InputDateTime<TValue> : InputDate<TValue>
{
private const string DateFormat = "yyyy-MM-ddTHH:mm";
/// <inheritdoc />
protected override void BuildRenderTree ( RenderTreeBuilder builder )
{
builder.OpenElement( 0, "input" );
builder.AddMultipleAttributes( 1, AdditionalAttributes );
builder.AddAttribute( 2, "type", "datetime-local" );
builder.AddAttribute( 3, "class", CssClass );
builder.AddAttribute( 4, "value", BindConverter.FormatValue( CurrentValueAsString ) );
builder.AddAttribute( 5, "onchange", EventCallback.Factory.CreateBinder<string>( this, __value => CurrentValueAsString = __value, CurrentValueAsString ) );
builder.CloseElement();
}
/// <inheritdoc />
protected override string FormatValueAsString ( TValue value )
{
switch ( value )
{
case DateTime dateTimeValue:
return BindConverter.FormatValue( dateTimeValue, DateFormat, CultureInfo.InvariantCulture );
case DateTimeOffset dateTimeOffsetValue:
return BindConverter.FormatValue( dateTimeOffsetValue, DateFormat, CultureInfo.InvariantCulture );
default:
return string.Empty; // Handles null for Nullable<DateTime>, etc.
}
}
/// <inheritdoc />
protected override bool TryParseValueFromString ( string value, out TValue result, out string validationErrorMessage )
{
// Unwrap nullable types. We don't have to deal with receiving empty values for nullable
// types here, because the underlying InputBase already covers that.
var targetType = Nullable.GetUnderlyingType( typeof( TValue ) ) ?? typeof( TValue );
bool success;
if ( targetType == typeof( DateTime ) )
{
success = TryParseDateTime( value, out result );
}
else if ( targetType == typeof( DateTimeOffset ) )
{
success = TryParseDateTimeOffset( value, out result );
}
else
{
throw new InvalidOperationException( $"The type '{targetType}' is not a supported date type." );
}
if ( success )
{
validationErrorMessage = null;
return true;
}
else
{
validationErrorMessage = string.Format( ParsingErrorMessage, FieldIdentifier.FieldName );
return false;
}
}
static bool TryParseDateTime ( string value, out TValue result )
{
var success = BindConverter.TryConvertToDateTime( value, CultureInfo.InvariantCulture, DateFormat, out var parsedValue );
if ( success )
{
result = (TValue)(object)parsedValue;
return true;
}
else
{
result = default;
return false;
}
}
static bool TryParseDateTimeOffset ( string value, out TValue result )
{
var success = BindConverter.TryConvertToDateTimeOffset( value, CultureInfo.InvariantCulture, DateFormat, out var parsedValue );
if ( success )
{
result = (TValue)(object)parsedValue;
return true;
}
else
{
result = default;
return false;
}
}
}

View file

@ -9,16 +9,16 @@
// <copyright file="Squid.cs" company="FCS"> // <copyright file="Squid.cs" company="FCS">
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// </copyright> // </copyright>
// <summary>Derived from https:github.com/csharpvitamins/CSharpVitamins.ShortGuid</summary> // <summary>Derived from https:github.com/csharpvitamins/CSharpVitamins.ShortGuid</summary>

View file

@ -1,19 +1,20 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
using System; using System;
using Wonky.Entity.DTO;
namespace Wonky.Client.Helpers; namespace Wonky.Client.Helpers;

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -102,7 +102,7 @@ namespace Wonky.Client.HttpInterceptors
_toast.ShowInfo(message); _toast.ShowInfo(message);
break; break;
default: _navigation.NavigateTo("/500"); default: _navigation.NavigateTo("/500");
message = "500 - Internal server error"; message = "500 - Intern server fejl";
break; break;
} }
throw new HttpResponseException(message); throw new HttpResponseException(message);

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -25,7 +25,9 @@ using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Wonky.Entity.Configuration; using Wonky.Entity.Configuration;
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Models;
using Wonky.Entity.Requests; using Wonky.Entity.Requests;
using Wonky.Entity.Views;
namespace Wonky.Client.HttpRepository; namespace Wonky.Client.HttpRepository;
@ -62,7 +64,7 @@ public class ActivityHttpRepository : IActivityHttpRepository
? new List<ReportActivity>() ? new List<ReportActivity>()
: JsonSerializer.Deserialize<List<ReportActivity>>(content, _options); : JsonSerializer.Deserialize<List<ReportActivity>>(content, _options);
} }
public async Task<PagingResponse<DtoNgActivity>> GetActivityPaged(ActivityPagingParams pagingParameters) public async Task<PagingResponse<ActivityDto>> GetActivityPaged(ActivityPagingParams pagingParameters)
{ {
var queryString = new Dictionary<string, string> var queryString = new Dictionary<string, string>
{ {
@ -77,16 +79,16 @@ public class ActivityHttpRepository : IActivityHttpRepository
var content = await response.Content.ReadAsStringAsync(); var content = await response.Content.ReadAsStringAsync();
var pagingResponse = new PagingResponse<DtoNgActivity> var pagingResponse = new PagingResponse<ActivityDto>
{ {
Items = JsonSerializer.Deserialize<List<DtoNgActivity>>(content, _options), Items = JsonSerializer.Deserialize<List<ActivityDto>>(content, _options),
MetaData = JsonSerializer.Deserialize<MetaData>( MetaData = JsonSerializer.Deserialize<MetaData>(
response.Headers.GetValues("X-Pagination").First(), _options) response.Headers.GetValues("X-Pagination").First(), _options)
}; };
return pagingResponse; return pagingResponse;
} }
public async Task<ActivityResponseView> CreateActivity(DtoNgActivity model) public async Task<ActivityResponseView> CreateActivity(ActivityDto model)
{ {
Console.WriteLine(JsonSerializer.Serialize(model)); Console.WriteLine(JsonSerializer.Serialize(model));
var response = await _client.PostAsJsonAsync($"{_apiConfig.ActivityEndpoint}", model).ConfigureAwait(true); var response = await _client.PostAsJsonAsync($"{_apiConfig.ActivityEndpoint}", model).ConfigureAwait(true);
@ -95,11 +97,11 @@ public class ActivityHttpRepository : IActivityHttpRepository
return result!; return result!;
} }
public async Task<DtoNgActivity> GetActivity(string id) public async Task<ActivityDto> GetActivity(string id)
{ {
var salesItem = await _client var salesItem = await _client
.GetFromJsonAsync<DtoNgActivity>($"{_apiConfig.ActivityEndpoint}/{id}").ConfigureAwait(true); .GetFromJsonAsync<ActivityDto>($"{_apiConfig.ActivityEndpoint}/{id}").ConfigureAwait(true);
return salesItem ?? new DtoNgActivity(); return salesItem ?? new ActivityDto();
} }
public async Task<ActivityResponseView> AcceptOffer(string id) public async Task<ActivityResponseView> AcceptOffer(string id)

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -54,7 +54,7 @@ public class CompanyHttpRepository : ICompanyHttpRepository
_apiConfig = apiConfig.Value; _apiConfig = apiConfig.Value;
} }
public async Task<PagingResponse<DtoNgCompany>> GetCompaniesPaged(CompanyPagingParams pagingParameters) public async Task<PagingResponse<CompanyDto>> GetCompaniesPaged(CompanyPagingParams pagingParameters)
{ {
var queryString = new Dictionary<string, string> var queryString = new Dictionary<string, string>
{ {
@ -70,38 +70,38 @@ public class CompanyHttpRepository : ICompanyHttpRepository
var content = await response.Content.ReadAsStringAsync(); var content = await response.Content.ReadAsStringAsync();
var pagingResponse = new PagingResponse<DtoNgCompany> var pagingResponse = new PagingResponse<CompanyDto>
{ {
Items = JsonSerializer.Deserialize<List<DtoNgCompany>>(content, _options), Items = JsonSerializer.Deserialize<List<CompanyDto>>(content, _options),
MetaData = JsonSerializer.Deserialize<MetaData>(response.Headers.GetValues("X-Pagination").First(), _options) MetaData = JsonSerializer.Deserialize<MetaData>(response.Headers.GetValues("X-Pagination").First(), _options)
}; };
return pagingResponse; return pagingResponse;
} }
public async Task<DtoNgCompany> GetCompanyByAccount(string accountNumber) public async Task<CompanyDto> GetCompanyByAccount(string accountNumber)
{ {
var company = await _client.GetFromJsonAsync<DtoNgCompany>($"{_apiConfig.CustomerEndpoint}/account/{accountNumber}"); var company = await _client.GetFromJsonAsync<CompanyDto>($"{_apiConfig.CustomerEndpoint}/account/{accountNumber}");
return company ?? new DtoNgCompany(); return company ?? new CompanyDto();
} }
public async Task<DtoNgCompany> GetCompanyById(string companyId) public async Task<CompanyDto> GetCompanyById(string companyId)
{ {
var company = await _client.GetFromJsonAsync<DtoNgCompany>($"{_apiConfig.CustomerEndpoint}/{companyId}"); var company = await _client.GetFromJsonAsync<CompanyDto>($"{_apiConfig.CustomerEndpoint}/{companyId}");
return company ?? new DtoNgCompany(); return company ?? new CompanyDto();
} }
public async Task<string> CreateCompany(DtoNgCompany dtoNgCompany) public async Task<string> CreateCompany(CompanyDto companyDto)
{ {
var response = await _client.PostAsJsonAsync($"{_apiConfig.CustomerEndpoint}", dtoNgCompany); var response = await _client.PostAsJsonAsync($"{_apiConfig.CustomerEndpoint}", companyDto);
var content = await response.Content.ReadAsStringAsync(); var content = await response.Content.ReadAsStringAsync();
var result = JsonSerializer.Deserialize<DtoNgCompany>(content); var result = JsonSerializer.Deserialize<CompanyDto>(content);
Console.WriteLine(content); Console.WriteLine(content);
return result.CompanyId; return result.CompanyId;
} }
public async Task UpdateCompany(DtoNgCompany dtoNgCompany) public async Task UpdateCompany(CompanyDto companyDto)
{ {
await _client.PutAsJsonAsync($"{_apiConfig.CustomerEndpoint}/{dtoNgCompany.CompanyId}", dtoNgCompany); await _client.PutAsJsonAsync($"{_apiConfig.CustomerEndpoint}/{companyDto.CompanyId}", companyDto);
} }
public async Task DeleteCompany(string companyId) public async Task DeleteCompany(string companyId)

View file

@ -1,30 +1,32 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
using System.Threading.Tasks; using System.Threading.Tasks;
using Wonky.Client.Features; using Wonky.Client.Features;
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Models;
using Wonky.Entity.Requests; using Wonky.Entity.Requests;
using Wonky.Entity.Views;
namespace Wonky.Client.HttpRepository; namespace Wonky.Client.HttpRepository;
public interface IActivityHttpRepository public interface IActivityHttpRepository
{ {
Task<PagingResponse<DtoNgActivity>> GetActivityPaged(ActivityPagingParams pagingParameters); Task<PagingResponse<ActivityDto>> GetActivityPaged(ActivityPagingParams pagingParameters);
Task<DtoNgActivity> GetActivity(string id); Task<ActivityDto> GetActivity(string id);
Task<ActivityResponseView> CreateActivity(DtoNgActivity model); Task<ActivityResponseView> CreateActivity(ActivityDto model);
Task<ActivityResponseView> AcceptOffer(string id); Task<ActivityResponseView> AcceptOffer(string id);
Task<List<ReportActivity>?> GetActivities(string activityDate); Task<List<ReportActivity>?> GetActivities(string activityDate);
} }

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -22,10 +22,10 @@ namespace Wonky.Client.HttpRepository;
public interface ICompanyHttpRepository public interface ICompanyHttpRepository
{ {
Task<PagingResponse<DtoNgCompany>> GetCompaniesPaged(CompanyPagingParams pagingParameters); Task<PagingResponse<CompanyDto>> GetCompaniesPaged(CompanyPagingParams pagingParameters);
Task<DtoNgCompany> GetCompanyByAccount(string accountNumber); Task<CompanyDto> GetCompanyByAccount(string accountNumber);
Task<DtoNgCompany> GetCompanyById(string companyId); Task<CompanyDto> GetCompanyById(string companyId);
Task<string> CreateCompany(DtoNgCompany dtoNgCompany); Task<string> CreateCompany(CompanyDto companyDto);
Task UpdateCompany(DtoNgCompany dtoNgCompany); Task UpdateCompany(CompanyDto companyDto);
Task DeleteCompany(string companyId); Task DeleteCompany(string companyId);
} }

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -17,6 +17,7 @@ using System.Threading.Tasks;
using Wonky.Client.Features; using Wonky.Client.Features;
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Requests; using Wonky.Entity.Requests;
using Wonky.Entity.Views;
namespace Wonky.Client.HttpRepository; namespace Wonky.Client.HttpRepository;

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -26,6 +26,7 @@ using Microsoft.Extensions.Options;
using Wonky.Entity.Configuration; using Wonky.Entity.Configuration;
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Requests; using Wonky.Entity.Requests;
using Wonky.Entity.Views;
namespace Wonky.Client.HttpRepository; namespace Wonky.Client.HttpRepository;

View file

@ -1,4 +1,5 @@
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Views;
namespace Wonky.Client.Models; namespace Wonky.Client.Models;

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@
@ -57,7 +57,7 @@
<div class="card bg-light"> <div class="card bg-light">
<EditForm EditContext="_createCompany" OnValidSubmit="Create" class="card-body"> <EditForm EditContext="_createCompany" OnValidSubmit="Create" class="card-body">
<DataAnnotationsValidator /> <DataAnnotationsValidator />
<InputText type="hidden" id="salesRepId" @bind-Value="_dtoNgCompany.SalesRepId"/> <InputText type="hidden" id="salesRepId" @bind-Value="_companyDto.SalesRepId"/>
<table class="table"> <table class="table">
<thead> <thead>
@ -67,73 +67,73 @@
<th scope="row">Reg.nr.</th> <th scope="row">Reg.nr.</th>
<td class="state"><DisplayStateComponent StateClass="@RegState"></DisplayStateComponent></td> <td class="state"><DisplayStateComponent StateClass="@RegState"></DisplayStateComponent></td>
<td> <td>
<InputText id="vatNumber" class="form-control" @bind-Value="_dtoNgCompany.VatNumber"/> <InputText id="vatNumber" class="form-control" @bind-Value="_companyDto.VatNumber"/>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Firmanavn</th> <th scope="row">Firmanavn</th>
<td></td> <td></td>
<td> <td>
<InputText id="name" class="form-control" @bind-Value="_dtoNgCompany.Name"/> <InputText id="name" class="form-control" @bind-Value="_companyDto.Name"/>
<ValidationMessage For="@(() => _dtoNgCompany.Name)"></ValidationMessage> <ValidationMessage For="@(() => _companyDto.Name)"></ValidationMessage>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Adresse</th> <th scope="row">Adresse</th>
<td></td> <td></td>
<td> <td>
<InputText id="address1" class="form-control" @bind-Value="_dtoNgCompany.Address1"/> <InputText id="address1" class="form-control" @bind-Value="_companyDto.Address1"/>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Conavn</th> <th scope="row">Conavn</th>
<td></td> <td></td>
<td> <td>
<InputText id="address2" class="form-control" @bind-Value="_dtoNgCompany.Address2"/> <InputText id="address2" class="form-control" @bind-Value="_companyDto.Address2"/>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Postnr</th> <th scope="row">Postnr</th>
<td></td> <td></td>
<td> <td>
<InputText id="zipCode" class="form-control" @bind-Value="_dtoNgCompany.ZipCode"/> <InputText id="zipCode" class="form-control" @bind-Value="_companyDto.ZipCode"/>
<ValidationMessage For="@(() => _dtoNgCompany.ZipCode)"></ValidationMessage> <ValidationMessage For="@(() => _companyDto.ZipCode)"></ValidationMessage>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Bynavn</th> <th scope="row">Bynavn</th>
<td></td> <td></td>
<td> <td>
<InputText id="city" class="form-control" @bind-Value="_dtoNgCompany.City"/> <InputText id="city" class="form-control" @bind-Value="_companyDto.City"/>
<ValidationMessage For="@(() => _dtoNgCompany.City)"></ValidationMessage> <ValidationMessage For="@(() => _companyDto.City)"></ValidationMessage>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Telefon</th> <th scope="row">Telefon</th>
<td></td> <td></td>
<td> <td>
<InputText id="phone" class="form-control" @bind-Value="_dtoNgCompany.Phone"/> <InputText id="phone" class="form-control" @bind-Value="_companyDto.Phone"/>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Mobil</th> <th scope="row">Mobil</th>
<td></td> <td></td>
<td> <td>
<InputText id="mobile" class="form-control" @bind-Value="_dtoNgCompany.Mobile"/> <InputText id="mobile" class="form-control" @bind-Value="_companyDto.Mobile"/>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Email</th> <th scope="row">Email</th>
<td></td> <td></td>
<td> <td>
<InputText id="email" class="form-control" @bind-Value="_dtoNgCompany.Email"/> <InputText id="email" class="form-control" @bind-Value="_companyDto.Email"/>
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row">Attention</th> <th scope="row">Attention</th>
<td></td> <td></td>
<td> <td>
<InputText id="attention" class="form-control" @bind-Value="_dtoNgCompany.Attention"/> <InputText id="attention" class="form-control" @bind-Value="_companyDto.Attention"/>
</td> </td>
</tr> </tr>
</tbody> </tbody>

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -30,6 +30,7 @@ using Wonky.Client.Models;
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Models; using Wonky.Entity.Models;
using Wonky.Entity.Requests; using Wonky.Entity.Requests;
using Wonky.Entity.Views;
namespace Wonky.Client.Pages namespace Wonky.Client.Pages
{ {
@ -43,7 +44,7 @@ namespace Wonky.Client.Pages
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public VatInfoLookupService VatInfoLookupService { get; set; } [Inject] public VatInfoLookupService VatInfoLookupService { get; set; }
private List<VirkRegInfo> VInfos { get; set; } = new(); private List<VirkRegInfo> VInfos { get; set; } = new();
private DtoNgCompany _dtoNgCompany = new(); private CompanyDto _companyDto = new();
private VirkRegInfo _virkRegInfo = new(); private VirkRegInfo _virkRegInfo = new();
private EditContext _createCompany; private EditContext _createCompany;
private bool _formInvalid = true; private bool _formInvalid = true;
@ -53,12 +54,12 @@ namespace Wonky.Client.Pages
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
_vatUtils = new VatUtils(); _vatUtils = new VatUtils();
_createCompany = new EditContext(_dtoNgCompany); _createCompany = new EditContext(_companyDto);
_createCompany.OnFieldChanged += HandleFieldChanged; _createCompany.OnFieldChanged += HandleFieldChanged;
var ux = await StorageService.GetItemAsync<UserInfoView>("_xu"); var ux = await StorageService.GetItemAsync<UserInfoView>("_xu");
_dtoNgCompany.SalesRepId = ux.Id; _companyDto.SalesRepId = ux.Id;
_dtoNgCompany.CountryCode = ux.CountryCode; _companyDto.CountryCode = ux.CountryCode;
Interceptor.RegisterEvent(); Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent(); Interceptor.RegisterBeforeSendEvent();
} }
@ -93,24 +94,24 @@ namespace Wonky.Client.Pages
{ {
_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";
_dtoNgCompany.Name = _virkRegInfo.Name; _companyDto.Name = _virkRegInfo.Name;
_dtoNgCompany.Address1 = _virkRegInfo.Address; _companyDto.Address1 = _virkRegInfo.Address;
_dtoNgCompany.Address2 = _virkRegInfo.CoName; _companyDto.Address2 = _virkRegInfo.CoName;
_dtoNgCompany.ZipCode = _virkRegInfo.ZipCode; _companyDto.ZipCode = _virkRegInfo.ZipCode;
_dtoNgCompany.City = _virkRegInfo.City; _companyDto.City = _virkRegInfo.City;
_dtoNgCompany.VatNumber = _virkRegInfo.VatNumber; _companyDto.VatNumber = _virkRegInfo.VatNumber;
} }
private async Task Create() private async Task Create()
{ {
var newId = await CompanyRepo.CreateCompany(_dtoNgCompany); var newId = await CompanyRepo.CreateCompany(_companyDto);
Console.WriteLine(newId); Console.WriteLine(newId);
ToastService.ShowSuccess($"Godt så! '{_dtoNgCompany.Name}' er oprettet i CRM."); ToastService.ShowSuccess($"Godt så! '{_companyDto.Name}' er oprettet i CRM.");
Navigation.NavigateTo($"/company/id/{newId}"); Navigation.NavigateTo($"/company/id/{newId}");
} }
private void HandleFieldChanged(object sender, FieldChangedEventArgs e) private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
{ {
if (!_vatUtils.ValidateFormat(_dtoNgCompany.CountryCode, _dtoNgCompany.VatNumber)) if (!_vatUtils.ValidateFormat(_companyDto.CountryCode, _companyDto.VatNumber))
{ {
_formInvalid = false; _formInvalid = false;
} }
@ -124,7 +125,7 @@ namespace Wonky.Client.Pages
{ {
_formInvalid = true; _formInvalid = true;
_createCompany.OnFieldChanged -= HandleFieldChanged; _createCompany.OnFieldChanged -= HandleFieldChanged;
_createCompany = new EditContext(_dtoNgCompany); _createCompany = new EditContext(_companyDto);
_createCompany.OnFieldChanged += HandleFieldChanged; _createCompany.OnFieldChanged += HandleFieldChanged;
_createCompany.OnValidationStateChanged -= ValidationChanged; _createCompany.OnValidationStateChanged -= ValidationChanged;
} }

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@
@ -36,7 +36,7 @@
<PageSizeDropdown OnChanged="SetPageSize"></PageSizeDropdown> <PageSizeDropdown OnChanged="SetPageSize"></PageSizeDropdown>
</div> </div>
<div class="col"> <div class="col">
<a class="btn btn-success mb-1" href="/company/create">Nyt firma</a> <a class="btn btn-success mb-1" href="/company/create">Opret kunde</a>
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -32,7 +32,7 @@ namespace Wonky.Client.Pages
[Inject] private UserPreferenceService UserPrefService { get; set; } [Inject] private UserPreferenceService UserPrefService { get; set; }
[Inject] public ICompanyHttpRepository CompanyRepo { get; set; } [Inject] public ICompanyHttpRepository CompanyRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
public List<DtoNgCompany>? Companies { get; set; } = new(); public List<CompanyDto>? Companies { get; set; } = new();
public MetaData? MetaData { get; set; } = new(); public 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,21 +54,21 @@ namespace Wonky.Client.Pages
private async Task SelectedPage(int page) private async Task SelectedPage(int page)
{ {
Companies = new List<DtoNgCompany>(); Companies = new List<CompanyDto>();
_paging.PageNumber = page; _paging.PageNumber = page;
await GetCompanies(); await GetCompanies();
} }
private async Task SetSearchCol(string searchColumn) private async Task SetSearchCol(string searchColumn)
{ {
Companies = new List<DtoNgCompany>(); Companies = new List<CompanyDto>();
_paging.SearchColumn = searchColumn; _paging.SearchColumn = searchColumn;
_paging.PageNumber = 1; _paging.PageNumber = 1;
await GetCompanies(); await GetCompanies();
} }
private async Task SetPageSize(string pageSize) private async Task SetPageSize(string pageSize)
{ {
Companies = new List<DtoNgCompany>(); Companies = new List<CompanyDto>();
_paging.PageSize = Convert.ToInt32(pageSize); _paging.PageSize = Convert.ToInt32(pageSize);
_paging.PageNumber = 1; _paging.PageNumber = 1;
await GetCompanies(); await GetCompanies();
@ -76,7 +76,7 @@ namespace Wonky.Client.Pages
private async Task SetSearchPhrase(string searchTerm) private async Task SetSearchPhrase(string searchTerm)
{ {
Companies = new List<DtoNgCompany>(); Companies = new List<CompanyDto>();
_paging.PageNumber = 1; _paging.PageNumber = 1;
_paging.SearchTerm = searchTerm; _paging.SearchTerm = searchTerm;
await GetCompanies(); await GetCompanies();
@ -84,14 +84,14 @@ namespace Wonky.Client.Pages
private async Task SetSortCol(string orderBy) private async Task SetSortCol(string orderBy)
{ {
Companies = new List<DtoNgCompany>(); Companies = new List<CompanyDto>();
_paging.OrderBy = orderBy; _paging.OrderBy = orderBy;
await GetCompanies(); await GetCompanies();
} }
private async Task DeleteCompany(string companyId) private async Task DeleteCompany(string companyId)
{ {
Companies = new List<DtoNgCompany>(); Companies = new List<CompanyDto>();
await CompanyRepo.DeleteCompany(companyId); await CompanyRepo.DeleteCompany(companyId);
if (_paging.PageNumber > 1 && Companies.Count == 1) if (_paging.PageNumber > 1 && Companies.Count == 1)
_paging.PageNumber--; _paging.PageNumber--;

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@
@ -21,11 +21,11 @@
@attribute [Authorize(Roles = "Adviser")] @attribute [Authorize(Roles = "Adviser")]
@page "/company/{CompanyId}/update" @page "/company/{CompanyId}/update"
@if (DtoNgCompany != null) @if (CompanyDto != null)
{ {
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<div class="h2">@DtoNgCompany.Account - @DtoNgCompany.Name</div> <div class="h2">@CompanyDto.Account - @CompanyDto.Name</div>
</div> </div>
<div class="card-body"> <div class="card-body">
<VatNumberInputComponent OnValidSubmit="GetInfoFromVat"/> <VatNumberInputComponent OnValidSubmit="GetInfoFromVat"/>
@ -64,71 +64,71 @@
CVR/ORG CVR/ORG
</label> </label>
<div class="col-md-10"> <div class="col-md-10">
<InputText id="vatNumber" class="form-control" @bind-Value="DtoNgCompany.VatNumber"/> <InputText id="vatNumber" class="form-control" @bind-Value="CompanyDto.VatNumber"/>
<ValidationMessage For="@(() => DtoNgCompany.VatNumber)"></ValidationMessage> <ValidationMessage For="@(() => CompanyDto.VatNumber)"></ValidationMessage>
</div> </div>
</div> </div>
<div class="form-group row mb-1"> <div class="form-group row mb-1">
<label for="name" class="col-md-2 col-form-label">Firmanavn</label> <label for="name" class="col-md-2 col-form-label">Firmanavn</label>
<div class="col-md-10"> <div class="col-md-10">
<InputText id="name" class="form-control" @bind-Value="DtoNgCompany.Name"/> <InputText id="name" class="form-control" @bind-Value="CompanyDto.Name"/>
<ValidationMessage For="@(() => DtoNgCompany.Name)"></ValidationMessage> <ValidationMessage For="@(() => CompanyDto.Name)"></ValidationMessage>
</div> </div>
</div> </div>
<div class="form-group row mb-1"> <div class="form-group row mb-1">
<label for="address1" class="col-md-2 col-form-label">Adresse</label> <label for="address1" class="col-md-2 col-form-label">Adresse</label>
<div class="col-md-10"> <div class="col-md-10">
<InputText id="address1" class="form-control" @bind-Value="DtoNgCompany.Address1"/> <InputText id="address1" class="form-control" @bind-Value="CompanyDto.Address1"/>
<ValidationMessage For="@(() => DtoNgCompany.Address1)"></ValidationMessage> <ValidationMessage For="@(() => CompanyDto.Address1)"></ValidationMessage>
</div> </div>
</div> </div>
<div class="form-group row mb-1"> <div class="form-group row mb-1">
<label for="address2" class="col-md-2 col-form-label">Conavn</label> <label for="address2" class="col-md-2 col-form-label">Conavn</label>
<div class="col-md-10"> <div class="col-md-10">
<InputText id="address2" class="form-control" @bind-Value="DtoNgCompany.Address2"/> <InputText id="address2" class="form-control" @bind-Value="CompanyDto.Address2"/>
</div> </div>
</div> </div>
<div class="form-group row mb-1"> <div class="form-group row mb-1">
<label for="zipCode" class="col-md-2 col-form-label">Postnr</label> <label for="zipCode" class="col-md-2 col-form-label">Postnr</label>
<div class="col-md-10"> <div class="col-md-10">
<InputText id="zipCode" class="form-control" @bind-Value="DtoNgCompany.ZipCode"/> <InputText id="zipCode" class="form-control" @bind-Value="CompanyDto.ZipCode"/>
<ValidationMessage For="@(() => DtoNgCompany.ZipCode)"></ValidationMessage> <ValidationMessage For="@(() => CompanyDto.ZipCode)"></ValidationMessage>
</div> </div>
</div> </div>
<div class="form-group row mb-1"> <div class="form-group row mb-1">
<label for="city" class="col-md-2 col-form-label">Bynavn</label> <label for="city" class="col-md-2 col-form-label">Bynavn</label>
<div class="col-md-10"> <div class="col-md-10">
<InputText id="city" class="form-control" @bind-Value="DtoNgCompany.City"/> <InputText id="city" class="form-control" @bind-Value="CompanyDto.City"/>
<ValidationMessage For="@(() => DtoNgCompany.City)"></ValidationMessage> <ValidationMessage For="@(() => CompanyDto.City)"></ValidationMessage>
</div> </div>
</div> </div>
<div class="form-group row mb-1"> <div class="form-group row mb-1">
<label for="phone" class="col-md-2 col-form-label">Telefon</label> <label for="phone" class="col-md-2 col-form-label">Telefon</label>
<div class="col-md-10"> <div class="col-md-10">
<InputText id="phone" class="form-control" @bind-Value="DtoNgCompany.Phone"/> <InputText id="phone" class="form-control" @bind-Value="CompanyDto.Phone"/>
</div> </div>
</div> </div>
<div class="form-group row mb-1"> <div class="form-group row mb-1">
<label for="mobile" class="col-md-2 col-form-label">Mobil</label> <label for="mobile" class="col-md-2 col-form-label">Mobil</label>
<div class="col-md-10"> <div class="col-md-10">
<InputText id="mobile" class="form-control" @bind-Value="DtoNgCompany.Mobile"/> <InputText id="mobile" class="form-control" @bind-Value="CompanyDto.Mobile"/>
</div> </div>
</div> </div>
<div class="form-group row mb-1"> <div class="form-group row mb-1">
<label for="email" class="col-md-2 col-form-label">Email</label> <label for="email" class="col-md-2 col-form-label">Email</label>
<div class="col-md-10"> <div class="col-md-10">
<InputText id="email" class="form-control" @bind-Value="DtoNgCompany.Email"/> <InputText id="email" class="form-control" @bind-Value="CompanyDto.Email"/>
</div> </div>
</div> </div>
<div class="form-group row mb-1"> <div class="form-group row mb-1">
<label for="attention" class="col-md-2 col-form-label">Attention</label> <label for="attention" class="col-md-2 col-form-label">Attention</label>
<div class="col-md-10"> <div class="col-md-10">
<InputText id="attention" class="form-control" @bind-Value="DtoNgCompany.Attention"/> <InputText id="attention" class="form-control" @bind-Value="CompanyDto.Attention"/>
</div> </div>
</div> </div>
<div class="form-group row mb-1"> <div class="form-group row mb-1">
<label for="lastVisit" class="col-form-label col-md-2"> <label for="lastVisit" class="col-form-label col-md-2">
<DisplayStateComponent StateClass="@(_hasFolded ? "the-dead" : Utils.GetVisitState(DtoNgCompany.NextVisit))"></DisplayStateComponent> <DisplayStateComponent StateClass="@(_hasFolded ? "the-dead" : Utils.GetVisitState(CompanyDto.NextVisit))"></DisplayStateComponent>
Sidste besøg Sidste besøg
</label> </label>
<div class="col-md-4"> <div class="col-md-4">
@ -142,7 +142,7 @@
<div class="form-group row mb-1"> <div class="form-group row mb-1">
<label for="interval" class="col-form-label col-md-2">Interval (uger)</label> <label for="interval" class="col-form-label col-md-2">Interval (uger)</label>
<div class="col-md-4"> <div class="col-md-4">
<InputNumber id="interval" class="form-control" @bind-Value="DtoNgCompany.Interval"/> <InputNumber id="interval" class="form-control" @bind-Value="CompanyDto.Interval"/>
</div> </div>
</div> </div>
<div class="row mb-1"> <div class="row mb-1">
@ -158,7 +158,7 @@
<div class="card-footer"> <div class="card-footer">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<a class="btn btn-primary" href="/company/@DtoNgCompany.CompanyId">Tilbage</a> <a class="btn btn-primary" href="/company/@CompanyDto.CompanyId">Tilbage</a>
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -28,6 +28,7 @@ using Wonky.Client.Services;
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Models; using Wonky.Entity.Models;
using Wonky.Entity.Requests; using Wonky.Entity.Requests;
using Wonky.Entity.Views;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;
@ -42,7 +43,7 @@ public partial class CompanyUpdate : IDisposable
[Inject] public ILocalStorageService StorageService { get; set; } [Inject] public ILocalStorageService StorageService { get; set; }
[Parameter] public string Account { get; set; } = ""; [Parameter] public string Account { get; set; } = "";
[Parameter] public string CompanyId { get; set; } = ""; [Parameter] public string CompanyId { get; set; } = "";
private DtoNgCompany DtoNgCompany { get; set; } private CompanyDto CompanyDto { get; set; }
private EditContext _updateCompany { get; set; } private EditContext _updateCompany { get; set; }
private List<VirkRegInfo> VInfos { get; set; } = new(); private List<VirkRegInfo> VInfos { get; set; } = new();
private VirkRegInfo _virkRegInfo { get; set; } = new(); private VirkRegInfo _virkRegInfo { get; set; } = new();
@ -59,25 +60,25 @@ public partial class CompanyUpdate : IDisposable
_vatUtils = new VatUtils(); _vatUtils = new VatUtils();
Interceptor.RegisterEvent(); Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent(); Interceptor.RegisterBeforeSendEvent();
DtoNgCompany = await CompanyRepo.GetCompanyById(CompanyId); CompanyDto = await CompanyRepo.GetCompanyById(CompanyId);
LastVisit = DateTime.Parse(DtoNgCompany.LastVisit); LastVisit = DateTime.Parse(CompanyDto.LastVisit);
NextVisit = DateTime.Parse(DtoNgCompany.NextVisit); NextVisit = DateTime.Parse(CompanyDto.NextVisit);
_updateCompany = new EditContext(DtoNgCompany); _updateCompany = new EditContext(CompanyDto);
var ux = await StorageService.GetItemAsync<UserInfoView>("_xu"); var ux = await StorageService.GetItemAsync<UserInfoView>("_xu");
if (string.IsNullOrWhiteSpace(DtoNgCompany.CountryCode)) if (string.IsNullOrWhiteSpace(CompanyDto.CountryCode))
{ {
DtoNgCompany.CountryCode = ux.CountryCode; CompanyDto.CountryCode = ux.CountryCode;
} }
if(DtoNgCompany.HasFolded == 1) if(CompanyDto.HasFolded == 1)
{ {
_hasFolded = true; _hasFolded = true;
_vatState = "the-dead"; _vatState = "the-dead";
} }
else else
{ {
_vatState = _vatUtils.ValidateFormat(DtoNgCompany.CountryCode, DtoNgCompany.VatNumber) ? "the-good" : "the-draw"; _vatState = _vatUtils.ValidateFormat(CompanyDto.CountryCode, CompanyDto.VatNumber) ? "the-good" : "the-draw";
} }
vatAddress = PrepareVatAddress(); vatAddress = PrepareVatAddress();
} }
@ -85,49 +86,49 @@ public partial class CompanyUpdate : IDisposable
private VatAddress PrepareVatAddress() private VatAddress PrepareVatAddress()
{ {
var digits = "123456789".ToCharArray(); var digits = "123456789".ToCharArray();
var pos1 = DtoNgCompany.Address1.IndexOfAny(digits); var pos1 = CompanyDto.Address1.IndexOfAny(digits);
if (pos1 > 0) if (pos1 > 0)
{ {
return new VatAddress return new VatAddress
{ {
ZipCode = DtoNgCompany.ZipCode, ZipCode = CompanyDto.ZipCode,
StreetName = DtoNgCompany.Address1[..pos1], StreetName = CompanyDto.Address1[..pos1],
HouseNumber = Regex.Replace(DtoNgCompany.Address1[pos1..], "[^0-9]", "") HouseNumber = Regex.Replace(CompanyDto.Address1[pos1..], "[^0-9]", "")
}; };
} }
var pos2 = DtoNgCompany.Address2.IndexOfAny(digits); var pos2 = CompanyDto.Address2.IndexOfAny(digits);
if (pos2 > 0) if (pos2 > 0)
{ {
return new VatAddress return new VatAddress
{ {
ZipCode = DtoNgCompany.ZipCode, ZipCode = CompanyDto.ZipCode,
StreetName = DtoNgCompany.Address2[..pos2], StreetName = CompanyDto.Address2[..pos2],
HouseNumber = Regex.Replace(DtoNgCompany.Address2[pos2..], "[^0-9]", "") HouseNumber = Regex.Replace(CompanyDto.Address2[pos2..], "[^0-9]", "")
}; };
} }
return vatAddress; return vatAddress;
} }
private async Task Update() private async Task Update()
{ {
if (!string.IsNullOrWhiteSpace(DtoNgCompany.VatNumber) && !_vatUtils.ValidateFormat(DtoNgCompany.CountryCode, DtoNgCompany.VatNumber)) if (!string.IsNullOrWhiteSpace(CompanyDto.VatNumber) && !_vatUtils.ValidateFormat(CompanyDto.CountryCode, CompanyDto.VatNumber))
{ {
ToastService.ShowError($"CVR/VAT/ORG nummer er ugyldig."); ToastService.ShowError($"CVR/VAT/ORG nummer er ugyldig.");
StateHasChanged(); StateHasChanged();
return; return;
} }
DtoNgCompany.LastVisit = $"{LastVisit:yyyy-MM-dd}"; CompanyDto.LastVisit = $"{LastVisit:yyyy-MM-dd}";
DtoNgCompany.NextVisit = $"{NextVisit:yyyy-MM-dd}"; CompanyDto.NextVisit = $"{NextVisit:yyyy-MM-dd}";
Console.WriteLine(JsonSerializer.Serialize(DtoNgCompany)); Console.WriteLine(JsonSerializer.Serialize(CompanyDto));
await CompanyRepo.UpdateCompany(DtoNgCompany); await CompanyRepo.UpdateCompany(CompanyDto);
ToastService.ShowSuccess($"'{DtoNgCompany!.Name}' er opdateret."); ToastService.ShowSuccess($"'{CompanyDto!.Name}' er opdateret.");
Navigation.NavigateTo($"/company/{DtoNgCompany.CompanyId}"); Navigation.NavigateTo($"/company/{CompanyDto.CompanyId}");
} }
private async Task GetInfoFromVat(string vatNumber) private async Task GetInfoFromVat(string vatNumber)
{ {
if (string.IsNullOrWhiteSpace(vatNumber) || !_vatUtils.ValidateFormat(DtoNgCompany.CountryCode, DtoNgCompany.VatNumber)) if (string.IsNullOrWhiteSpace(vatNumber) || !_vatUtils.ValidateFormat(CompanyDto.CountryCode, CompanyDto.VatNumber))
{ {
ToastService.ShowError($"CVR er ugyldigt eller mangler"); ToastService.ShowError($"CVR er ugyldigt eller mangler");
return; return;
@ -162,12 +163,12 @@ public partial class CompanyUpdate : IDisposable
private void SelectCompany(string vatNumber) private void SelectCompany(string vatNumber)
{ {
_virkRegInfo = (from x in VInfos where x.VatNumber == vatNumber select x).First(); _virkRegInfo = (from x in VInfos where x.VatNumber == vatNumber select x).First();
DtoNgCompany.Name = _virkRegInfo.Name; CompanyDto.Name = _virkRegInfo.Name;
DtoNgCompany.Address1 = _virkRegInfo.CoName; CompanyDto.Address1 = _virkRegInfo.CoName;
DtoNgCompany.Address2 = _virkRegInfo.Address; CompanyDto.Address2 = _virkRegInfo.Address;
DtoNgCompany.ZipCode = _virkRegInfo.ZipCode; CompanyDto.ZipCode = _virkRegInfo.ZipCode;
DtoNgCompany.City = _virkRegInfo.City; CompanyDto.City = _virkRegInfo.City;
DtoNgCompany.VatNumber = _virkRegInfo.VatNumber; CompanyDto.VatNumber = _virkRegInfo.VatNumber;
} }
public void Dispose() public void Dispose()

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@
@ -21,56 +21,56 @@
@using Wonky.Client.Helpers @using Wonky.Client.Helpers
@attribute [Authorize(Roles = "Adviser")] @attribute [Authorize(Roles = "Adviser")]
@if (DtoNgCompany != null) @if (CompanyDto != null)
{ {
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<div class="h2"><img src="gravestone.png" class="img-fluid" style="float:left;width:48px;height:48px;display:@(_hasFolded ? "block" : "none")" alt="tombstone"/> @DtoNgCompany.Name</div> <div class="h2"><img src="gravestone.png" class="img-fluid" style="float:left;width:48px;height:48px;display:@(_hasFolded ? "block" : "none")" alt="tombstone"/> @CompanyDto.Name</div>
</div> </div>
<div class="card-body"> <div class="card-body">
<table class="table table-sm table-striped table-bordered"> <table class="table table-sm table-striped table-bordered">
<tbody> <tbody>
<tr> <tr>
<th scope="row">Konto</th> <th scope="row">Konto</th>
<td colspan="2">@DtoNgCompany.Account</td> <td colspan="2">@CompanyDto.Account</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Conavn</th> <th scope="row">Conavn</th>
<td colspan="2">@DtoNgCompany.Address1</td> <td colspan="2">@CompanyDto.Address1</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Adresse</th> <th scope="row">Adresse</th>
<td colspan="2">@DtoNgCompany.Address2</td> <td colspan="2">@CompanyDto.Address2</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Postnummer</th> <th scope="row">Postnummer</th>
<td colspan="2">@DtoNgCompany.ZipCode</td> <td colspan="2">@CompanyDto.ZipCode</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Bynavn</th> <th scope="row">Bynavn</th>
<td colspan="2">@DtoNgCompany.City</td> <td colspan="2">@CompanyDto.City</td>
</tr> </tr>
<tr> <tr>
<th scope="row">CVR</th> <th scope="row">CVR</th>
<td class="state"><DisplayStateComponent StateClass="@_vatState"></DisplayStateComponent></td> <td class="state"><DisplayStateComponent StateClass="@_vatState"></DisplayStateComponent></td>
<td>@DtoNgCompany.VatNumber</td> <td>@CompanyDto.VatNumber</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Telefon</th> <th scope="row">Telefon</th>
<td colspan="2">@DtoNgCompany.Phone</td> <td colspan="2">@CompanyDto.Phone</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Email</th> <th scope="row">Email</th>
<td colspan="2">@DtoNgCompany.Email</td> <td colspan="2">@CompanyDto.Email</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Sidste besøg</th> <th scope="row">Sidste besøg</th>
<td colspan="2">@DtoNgCompany.LastVisit</td> <td colspan="2">@CompanyDto.LastVisit</td>
</tr> </tr>
<tr> <tr>
<th scope="row">Næste besøg</th> <th scope="row">Næste besøg</th>
<td class="state"><DisplayStateComponent StateClass="@(_hasFolded ? "the-dead" : Utils.GetVisitState(DtoNgCompany.NextVisit))"></DisplayStateComponent></td> <td class="state"><DisplayStateComponent StateClass="@(_hasFolded ? "the-dead" : Utils.GetVisitState(CompanyDto.NextVisit))"></DisplayStateComponent></td>
<td>@DtoNgCompany.NextVisit</td> <td>@CompanyDto.NextVisit</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -78,14 +78,14 @@
<div class="card-footer"> <div class="card-footer">
<div class="d-flex align-items-end"> <div class="d-flex align-items-end">
<a class="btn btn-primary mx-2" href="/companies">Tilbage</a> <a class="btn btn-primary mx-2" href="/companies">Tilbage</a>
<a class="btn btn-primary mx-2" href="/company/@(DtoNgCompany.CompanyId)/update">Rediger</a> <a class="btn btn-primary mx-2" href="/company/@(CompanyDto.CompanyId)/update">Rediger</a>
@if (_vatInvalid || string.IsNullOrWhiteSpace(DtoNgCompany.Address1)) @if (_vatInvalid || string.IsNullOrWhiteSpace(CompanyDto.Address1))
{ {
<a type="button" class="btn btn-primary mx-2 disabled" aria-disabled="true">Aktivitet</a> <a type="button" class="btn btn-primary mx-2 disabled" aria-disabled="true">Aktivitet</a>
} }
else else
{ {
<a type="button" class="btn btn-primary mx-2" href="/company/@DtoNgCompany.CompanyId/activity">Aktivitet</a> <a type="button" class="btn btn-primary mx-2" href="/company/@CompanyDto.CompanyId/activity">Aktivitet</a>
} }
</div> </div>
</div> </div>

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -35,7 +35,7 @@ public partial class CompanyView : IDisposable
[Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public VatInfoLookupService VatInfoLookup { get; set; } [Inject] public VatInfoLookupService VatInfoLookup { get; set; }
[Parameter] public string CompanyId { get; set; } = ""; [Parameter] public string CompanyId { get; set; } = "";
private DtoNgCompany DtoNgCompany { get; set; } = new (); private CompanyDto CompanyDto { get; set; } = new ();
private string _vatState { get; set; } = "the-dead"; private string _vatState { get; set; } = "the-dead";
private bool _hasFolded; private bool _hasFolded;
private bool _vatInvalid; private bool _vatInvalid;
@ -46,16 +46,16 @@ public partial class CompanyView : IDisposable
_vatUtils = new VatUtils(); _vatUtils = new VatUtils();
Interceptor.RegisterEvent(); Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent(); Interceptor.RegisterBeforeSendEvent();
DtoNgCompany = await CompanyRepo.GetCompanyById(CompanyId); CompanyDto = await CompanyRepo.GetCompanyById(CompanyId);
if(DtoNgCompany.HasFolded == 1) if(CompanyDto.HasFolded == 1)
{ {
_hasFolded = true; _hasFolded = true;
} }
else else
{ {
_vatInvalid = !_vatUtils.ValidateFormat(DtoNgCompany.CountryCode, DtoNgCompany.VatNumber); _vatInvalid = !_vatUtils.ValidateFormat(CompanyDto.CountryCode, CompanyDto.VatNumber);
_vatState = _vatInvalid ? "the-draw" : "the-good"; _vatState = _vatUtils.ValidateFormat(CompanyDto.CountryCode, CompanyDto.VatNumber) ? "the-good" : "the-draw";
} }
} }

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@
@ -68,7 +68,6 @@
<option value="noSale">Ingen salg</option> <option value="noSale">Ingen salg</option>
<option value="order">Bestilling</option> <option value="order">Bestilling</option>
<option value="quote">Tilbud</option> <option value="quote">Tilbud</option>
<option value="canvas">Kanvas</option>
</select> </select>
<ValidationMessage For="@(() => _poDraft.ActivityStatusEnum)"></ValidationMessage> <ValidationMessage For="@(() => _poDraft.ActivityStatusEnum)"></ValidationMessage>
</div> </div>
@ -117,14 +116,14 @@
</div> </div>
</div> </div>
<div class="row mb-1"> <div class="row mb-1">
<label for="orderMessage" class="col-md-2 col-form-label">Eksp. note</label> <label for="orderMessage" class="col-md-2 col-form-label">Note /Kontor</label>
<div class="col-md-10"> <div class="col-md-10">
<InputText id="orderMessage" class="form-control" @bind-Value="_poDraft.OrderMessage"/> <InputText id="orderMessage" class="form-control" @bind-Value="_poDraft.OrderMessage"/>
<ValidationMessage For="@(() => _poDraft.OrderMessage)"></ValidationMessage> <ValidationMessage For="@(() => _poDraft.OrderMessage)"></ValidationMessage>
</div> </div>
</div> </div>
<div class="row mb-1"> <div class="row mb-1">
<label for="crmNote" class="col-md-2 col-form-label">CRM note</label> <label for="crmNote" class="col-md-2 col-form-label">Note /Mig</label>
<div class="col-md-10"> <div class="col-md-10">
<InputText id="crmNote" class="form-control" @bind-Value="_poDraft.CrmNote"/> <InputText id="crmNote" class="form-control" @bind-Value="_poDraft.CrmNote"/>
<ValidationMessage For="@(() => _poDraft.CrmNote)"></ValidationMessage> <ValidationMessage For="@(() => _poDraft.CrmNote)"></ValidationMessage>

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -26,6 +26,7 @@ using Wonky.Client.Services;
using Wonky.Client.Shared; using Wonky.Client.Shared;
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Requests; using Wonky.Entity.Requests;
using Wonky.Entity.Views;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;
@ -45,8 +46,8 @@ public partial class CrmActivityCreate : IDisposable
private List<NgSalesItemView> SalesItems { get; set; } = new(); private List<NgSalesItemView> SalesItems { get; set; } = new();
private MetaData MetaData { get; set; } = new(); private MetaData MetaData { get; set; } = new();
private Preferences _prefs { get; set; } = new(); private Preferences _prefs { get; set; } = new();
private DtoNgActivity _poDraft { get; set; } = new(); private ActivityDto _poDraft { get; set; } = new();
private DtoNgCompany NgCompany = new(); private CompanyDto NgCompany = new();
private CatalogPagingParams _paging = new(); private CatalogPagingParams _paging = new();
private EditContext DraftContext { get; set; } private EditContext DraftContext { get; set; }
private bool _poFormInvalid { get; set; } = true; private bool _poFormInvalid { get; set; } = true;
@ -131,10 +132,10 @@ public partial class CrmActivityCreate : IDisposable
var ln = 0; var ln = 0;
// post to create activity endpoint // post to create activity endpoint
var lines = new List<DtoNgActivityLine>(); var lines = new List<ActivityLineDto>();
foreach (var item in DraftStateProvider.Draft.Items) foreach (var item in DraftStateProvider.Draft.Items)
{ {
var line = new DtoNgActivityLine{ var line = new ActivityLineDto{
Price = item.Price, Price = item.Price,
Discount = item.Discount, Discount = item.Discount,
Qty = item.Quantity, Qty = item.Quantity,

View file

@ -1,26 +1,28 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@
@page "/" @page "/"
@page "/index" @page "/index"
@inject IWebAssemblyHostEnvironment _hostEnvironment @page "/home"
@using Wonky.Client.Components; @using Wonky.Client.Components;
<Home></Home> <Home></Home>
@code{ @code{
} }

View file

@ -0,0 +1,40 @@
@*
// 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
@page "/info"
<AuthorizeView>
<Authorized>
<div class="row mb-2">
<div class="col text-center">
<img class="grumpy-coder" src="grumpy-coder.png" alt="Wonky Logo"/>
</div>
</div>
<div class="row">
<div class="col">
<ColorCoding></ColorCoding>
</div>
</div>
<div class="row">
<div class="col">
<h5>
App version <AppVersion></AppVersion>
</h5>
</div>
</div>
</Authorized>
</AuthorizeView>

View file

@ -0,0 +1,4 @@
.grumpy-coder {
width: 100px;
height: 100px;
}

View file

@ -1,58 +1,74 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@
@using Wonky.Client.Components @using Wonky.Client.Components
@page "/login/{returnUrl?}" @page "/login/{returnUrl?}"
<h3>Login</h3>
@if <section class=" text-center text-lg-start">
(ShowAuthError) @if (ShowAuthError)
{ {
<div class="alert alert-danger" role="alert"> <div class="alert alert-danger" role="alert">
@if (Error != null) @if (Error != null)
{ {
@Error @Error
} }
</div> </div>
} }
<EditForm Model="_dtoUserAuthentication" OnValidSubmit="ExecuteLogin" class="card card-body bg-light mt-5">
<DataAnnotationsValidator /> <div class="card mb-3">
<div class="form-group row"> <div class="row g-0 d-flex align-items-center">
<label for="email" class="col-md-2 col-form-label">Login</label> <div class="col-lg-4 d-none d-lg-flex">
<div class="col-md-10"> <img src="grumpy-coder.png" alt="Innotec Danmark"
<InputText type="email" id="email" class="form-control" class="w-100 rounded-t-5 rounded-tr-lg-0 rounded-bl-lg-5"/>
@bind-Value="_dtoUserAuthentication.Email" autocomplete="username" /> </div>
<ValidationMessage For="@(() => _dtoUserAuthentication.Email)" /> <div class="col-lg-8">
<div class="card-body py-5 px-md-5">
<EditForm Model="_userAuthenticationDto" OnValidSubmit="ExecuteLogin" class="form">
<DataAnnotationsValidator/>
<div class="input-group mb-4">
<span class="input-group-text" id="email-addon"><i class="oi oi-person"></i></span>
<InputText type="email" id="email" class="form-control" aria-described-by="email-addon"
placeholder="Email adresse"
@bind-Value="_userAuthenticationDto.Email" autocomplete="username"/>
<ValidationMessage For="@(() => _userAuthenticationDto.Email)"/>
</div>
<div class="input-group mb-4">
<span class="input-group-text" id="passwd-addon"><i class="oi oi-key"></i></span>
<InputText type="password" id="password" class="form-control" aria-described-by="passwd-addon"
placeholder="Adgangskode"
@bind-Value="_userAuthenticationDto.Password" autocomplete="current-password"/>
<ValidationMessage For="@(() => _userAuthenticationDto.Password)"/>
</div>
<div class="d-grid">
<button type="submit" class="btn btn-primary btn-lg mb-4" disabled="@execLogin">Login</button>
</div>
<div class="row mb-4">
<div class="col d-flex justify-content-center">
@if (execLogin)
{
<AppSpinner/>
}
</div>
</div>
</EditForm>
</div>
</div>
</div> </div>
</div> </div>
<div class="form-group row"> </section>
<label for="password" class="col-md-2 col-form-label">Kode</label>
<div class="col-md-10">
<InputText type="password" id="password" class="form-control"
@bind-Value="_dtoUserAuthentication.Password" autocomplete="current-password" />
<ValidationMessage For="@(() => _dtoUserAuthentication.Password)" />
</div>
</div>
<div class="row">
<div class="col-md-12 text-right">
<button type="submit" class="btn btn-success" disabled="@execLogin" >Login</button>
</div>
</div>
</EditForm>
@if (execLogin)
{
<AppSpinner/>
}

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -24,8 +24,9 @@ public partial class Login
{ {
[Inject] public NavigationManager NavigationManager { get; set; } [Inject] public NavigationManager NavigationManager { get; set; }
[Inject] public IAuthenticationService AuthenticationService { get; set; } [Inject] public IAuthenticationService AuthenticationService { get; set; }
[Parameter] public string ReturnUrl { get; set; } = ""; [Inject] public ILogger<Login> Logger { get; set; }
private DtoUserAuthentication _dtoUserAuthentication = new (); [Parameter] public string ReturnUrl { get; set; }
private UserAuthenticationDto _userAuthenticationDto = new ();
private bool ShowAuthError { get; set; } private bool ShowAuthError { get; set; }
private string? Error { get; set; } private string? Error { get; set; }
private bool execLogin = false; private bool execLogin = false;
@ -35,7 +36,7 @@ public partial class Login
ShowAuthError = false; ShowAuthError = false;
execLogin = true; execLogin = true;
var result = await AuthenticationService.Login(_dtoUserAuthentication); var result = await AuthenticationService.Login(_userAuthenticationDto);
if (!result.IsSuccess) if (!result.IsSuccess)
{ {
Error = result.ErrorMessage; Error = result.ErrorMessage;
@ -44,7 +45,8 @@ public partial class Login
} }
else else
{ {
var returnUrl = string.IsNullOrEmpty(ReturnUrl) ? "/companies" : ReturnUrl; Logger.LogInformation($"returnUrl={ReturnUrl}");
var returnUrl = string.IsNullOrWhiteSpace(ReturnUrl) ? "/companies" : ReturnUrl;
NavigationManager.NavigateTo(returnUrl); NavigationManager.NavigateTo(returnUrl);
} }
} }

View file

@ -0,0 +1,14 @@
.rounded-t-5 {
border-top-left-radius: 0.5rem;
border-top-right-radius: 0.5rem;
}
@media (min-width: 992px) {
.rounded-tr-lg-0 {
border-top-right-radius: 0;
}
.rounded-bl-lg-5 {
border-bottom-left-radius: 0.5rem;
}
}

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,19 +1,20 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
using System.Threading.Tasks; using System.Threading.Tasks;
using Blazored.LocalStorage;
using Wonky.Client.Services; using Wonky.Client.Services;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
@ -21,15 +22,14 @@ namespace Wonky.Client.Pages;
public partial class Logout public partial class Logout
{ {
[Inject] [Inject] public IAuthenticationService AuthenticationService { get; set; }
public IAuthenticationService AuthenticationService { get; set; } [Inject] public NavigationManager NavigationManager { get; set; }
[Inject] public ILocalStorageService LocalStorage { get; set; }
[Inject]
public NavigationManager NavigationManager { get; set; }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await AuthenticationService.Logout(); await AuthenticationService.Logout().ConfigureAwait(true);
NavigationManager.NavigateTo("/"); NavigationManager.NavigateTo("/");
} }
} }

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -24,6 +24,7 @@ using Wonky.Client.Components;
using Wonky.Client.Services; using Wonky.Client.Services;
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Requests; using Wonky.Entity.Requests;
using Wonky.Entity.Views;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -19,6 +19,7 @@ using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpRepository; using Wonky.Client.HttpRepository;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Views;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;

View file

@ -1,20 +1,21 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@
@using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Helpers
@attribute [Authorize(Roles = "Adviser")] @attribute [Authorize(Roles = "Adviser")]
@page "/sales-report" @page "/sales-report"
@ -23,7 +24,7 @@
<hr/> <hr/>
<div class="row mb-1"> <div class="row mb-1">
<label for="dayType" class="col-md-1 col-form-label">Dag</label> <label for="dayType" class="col-md-1 col-form-label">Dag</label>
<div class="col-md-4"> <div class="col-md-3">
<select id="dayType" class="form-select" @bind-Value="_reportDto.DayTypeEnum" @bind-Value:event="oninput" @onchange="CheckDayType"> <select id="dayType" class="form-select" @bind-Value="_reportDto.DayTypeEnum" @bind-Value:event="oninput" @onchange="CheckDayType">
<option value="" selected>"IKKE VALGT"</option> <option value="" selected>"IKKE VALGT"</option>
<option value="sales">Salgsdag</option> <option value="sales">Salgsdag</option>
@ -36,10 +37,33 @@
</select> </select>
<ValidationMessage For="@(() => _reportDto.DayTypeEnum)"></ValidationMessage> <ValidationMessage For="@(() => _reportDto.DayTypeEnum)"></ValidationMessage>
</div> </div>
<label for="reportDate" class="col-md-1 col-form-label">Dato</label> @if (_reportDto.DayTypeEnum == "sales")
<div class="col-md-4"> {
<InputDate id="reportDate" class="form-control" @bind-Value="@(_reportDate)"/> <label for="checkIn" class="col-md-1 col-form½">Begyndt</label>
</div> <div class="col-md-3 form-control">
<InputDateTime id="checkIn" class="form-control" @bind-Value="_reportDto.CheckIn"></InputDateTime>
<ValidationMessage For="@(() => _reportDto.CheckIn)"></ValidationMessage>
</div>
<label for="checkOut" class="col-md-1 col-form½">Afsluttet</label>
<div class="col-md-3 form-control">
<InputDateTime id="checkOut" class="form-control" @bind-Value="_reportDto.CheckOut"></InputDateTime>
<ValidationMessage For="@(() => _reportDto.CheckOut)"></ValidationMessage>
</div>
}
@if (_reportDto.DayTypeEnum.Contains("leave"))
{
<label for="checkIn" class="col-md-1 col-form½">Begyndt</label>
<div class="col-md-3 form-control">
<InputDate id="checkIn" class="form-control" @bind-Value="_reportDto.CheckIn"></InputDate>
<ValidationMessage For="@(() => _reportDto.CheckIn)"></ValidationMessage>
</div>
<label for="checkOut" class="col-md-1 col-form½">Afsluttet</label>
<div class="col-md-3 form-control">
<InputDate id="checkOut" class="form-control" @bind-Value="_reportDto.CheckOut"></InputDate>
<ValidationMessage For="@(() => _reportDto.CheckOut)"></ValidationMessage>
</div>
}
<div class="col-md-2"> <div class="col-md-2">
<button type="button" class="btn btn-info" @onclick="GetActivities">Hent</button> <button type="button" class="btn btn-info" @onclick="GetActivities">Hent</button>
</div> </div>
@ -68,7 +92,6 @@
<ValidationMessage For="@(() => _reportDto.DistancePrivate)"></ValidationMessage> <ValidationMessage For="@(() => _reportDto.DistancePrivate)"></ValidationMessage>
</div> </div>
</div> </div>
</EditForm> </EditForm>
<hr/> <hr/>
<h5>Besøg</h5> <h5>Besøg</h5>

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -20,6 +20,7 @@ using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpRepository; using Wonky.Client.HttpRepository;
using Wonky.Client.Services; using Wonky.Client.Services;
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Models;
namespace Wonky.Client.Pages; namespace Wonky.Client.Pages;
@ -28,8 +29,6 @@ public partial class SalesReport
[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; }
private DateTime _reportDate;
private EditContext _editContext { get; set; } private EditContext _editContext { get; set; }
private ActivityReportDto _reportDto = new(); private ActivityReportDto _reportDto = new();
private Preferences _prefs { get; set; } = new(); private Preferences _prefs { get; set; } = new();
@ -40,16 +39,16 @@ public partial class SalesReport
{ {
Interceptor.RegisterEvent(); Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent(); Interceptor.RegisterBeforeSendEvent();
_editContext = new EditContext(_reportDto);
_editContext = new EditContext(_reportDate);
_editContext.OnFieldChanged += HandleFieldChanged; _editContext.OnFieldChanged += HandleFieldChanged;
_editContext.OnValidationStateChanged += ValidationChanged; _editContext.OnValidationStateChanged += ValidationChanged;
_prefs = await UserPrefs.GetPreferences(); _prefs = await UserPrefs.GetPreferences();
_reportDate = string.IsNullOrWhiteSpace(_prefs.WorkDate) _reportDto.CheckIn = string.IsNullOrWhiteSpace(_prefs.WorkDate)
? DateTime.Now ? DateTime.Now
: DateTime.Parse(_prefs.WorkDate); : DateTime.Parse(_prefs.WorkDate);
await UserPrefs.SetWorkDate(_reportDate).ConfigureAwait(true); _reportDto.CheckOut = _reportDto.CheckIn;
await UserPrefs.SetWorkDate(_reportDto.CheckIn).ConfigureAwait(true);
} }
private void HandleFieldChanged(object sender, FieldChangedEventArgs e) private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
@ -73,9 +72,9 @@ public partial class SalesReport
private async Task GetActivities() private async Task GetActivities()
{ {
Activities = null; Activities = null;
await UserPrefs.SetWorkDate(_reportDate).ConfigureAwait(true); await UserPrefs.SetWorkDate(_reportDto.CheckIn).ConfigureAwait(true);
Activities = await ActivityRepo Activities = await ActivityRepo
.GetActivities($"{_reportDate:yyyy-MM-dd}") .GetActivities($"{_reportDto.CheckIn:yyyy-MM-dd}")
.ConfigureAwait(true); .ConfigureAwait(true);
} }

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -22,6 +22,7 @@ using Microsoft.Extensions.Options;
using Wonky.Client.Shared; using Wonky.Client.Shared;
using Wonky.Entity.Configuration; using Wonky.Entity.Configuration;
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Views;
namespace Wonky.Client.Services namespace Wonky.Client.Services
{ {
@ -43,53 +44,49 @@ namespace Wonky.Client.Services
_apiConfig = apiConfig; _apiConfig = apiConfig;
} }
public async Task<ApiResponseView> RegisterUser(DtoNgUserRegistration dtoNgUserRegistration) public async Task<AuthResponseView> Login(UserAuthenticationDto userAuthenticationDtoUserAuth)
{
var response = await _client
.PostAsJsonAsync(_apiConfig.Value.UserRegistration, dtoNgUserRegistration);
if (response.IsSuccessStatusCode)
return new ApiResponseView {IsSuccess = true};
var content = await response.Content
.ReadAsStringAsync()
;
var result = JsonSerializer.Deserialize<ApiResponseView>(content, _options);
return result ?? new ApiResponseView();
}
public async Task<AuthResponseView> Login(DtoUserAuthentication dtoUserAuth)
{ {
var credentials = new Dictionary<string, string> var credentials = new Dictionary<string, string>
{ {
["grant_type"] = "password", ["grant_type"] = "password",
["username"] = dtoUserAuth.Email, ["username"] = userAuthenticationDtoUserAuth.Email,
["password"] = dtoUserAuth.Password ["password"] = userAuthenticationDtoUserAuth.Password
}; };
var response = await _client
.PostAsync(_apiConfig.Value.TokenPath, new FormUrlEncodedContent(credentials));
var resContent = await response.Content.ReadAsStringAsync(); var response = await _client
.PostAsync(_apiConfig.Value.TokenPath, new FormUrlEncodedContent(credentials))
.ConfigureAwait(true);
var resContent = await response.Content.ReadAsStringAsync()
.ConfigureAwait(true);
// if not success - return error status // if not success - return error status
if (!response.IsSuccessStatusCode) if (!response.IsSuccessStatusCode)
return new AuthResponseView {IsSuccess = false, ErrorMessage = $"Kontroller indtastning"}; return new AuthResponseView
{
IsSuccess = false, ErrorMessage = $"Kontroller indtastning"
};
// process response content // process response content
var data = JsonSerializer.Deserialize<AuthResponseView>(resContent, _options); var data = JsonSerializer.Deserialize<AuthResponseView>(resContent, _options);
await _localStorage.SetItemAsync("_xa", data.AccessToken); await _localStorage.SetItemAsync("_xa", data.AccessToken)
await _localStorage.SetItemAsync("_xr", data.RefreshToken); .ConfigureAwait(true);
await _localStorage.SetItemAsync("_xr", data.RefreshToken)
.ConfigureAwait(true);
await _localStorage.SetItemAsync("_xe", await _localStorage.SetItemAsync("_xe",
(int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds + data.ExpiresIn - 60); (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds + data.ExpiresIn - 60)
.ConfigureAwait(true);
// set default request headers using access_token // set default request headers using access_token
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", data.AccessToken); _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", data.AccessToken);
var userInfo = await UserInfo(); var userInfo = await UserInfo();
await _localStorage.SetItemAsync("_xu", userInfo); await _localStorage.SetItemAsync("_xu", userInfo)
.ConfigureAwait(true);
// notify system on state change // notify system on state change
((AuthStateProvider)_authStateProvider).NotifyUserAuthenticationAsync(data.AccessToken); ((AuthStateProvider)_authStateProvider).NotifyUserAuthenticationAsync(data.AccessToken);
@ -100,50 +97,62 @@ namespace Wonky.Client.Services
public async Task<string> RefreshToken() public async Task<string> RefreshToken()
{ {
var refreshToken = await _localStorage.GetItemAsync<string>("_xr"); var refreshToken = await _localStorage.GetItemAsync<string>("_xr")
.ConfigureAwait(true);
var credentials = new Dictionary<string, string> var credentials = new Dictionary<string, string>
{ {
["grant_type"] = "refresh_token", ["grant_type"] = "refresh_token",
["refresh_token"] = refreshToken ["refresh_token"] = refreshToken
}; };
var response = await _client.PostAsync(_apiConfig.Value.TokenPath, new FormUrlEncodedContent(credentials)); var response = await _client.PostAsync(_apiConfig.Value.TokenPath, new FormUrlEncodedContent(credentials))
.ConfigureAwait(true);
if (!response.IsSuccessStatusCode) return string.Empty; if (!response.IsSuccessStatusCode) return string.Empty;
var resContent = await response.Content.ReadAsStringAsync(); var resContent = await response.Content.ReadAsStringAsync()
.ConfigureAwait(true);
var data = JsonSerializer.Deserialize<AuthResponseView>(resContent, _options); var data = JsonSerializer.Deserialize<AuthResponseView>(resContent, _options);
// set default request headers using access_token // set default request headers using access_token
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", data.AccessToken); _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", data.AccessToken);
await _localStorage.SetItemAsync("_xa", data.AccessToken); await _localStorage.SetItemAsync("_xa", data.AccessToken)
await _localStorage.SetItemAsync("_xr", data.RefreshToken); .ConfigureAwait(true);
await _localStorage.SetItemAsync("_xr", data.RefreshToken)
.ConfigureAwait(true);
await _localStorage.SetItemAsync("_xe", await _localStorage.SetItemAsync("_xe",
(int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds + data.ExpiresIn - 60); (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds + data.ExpiresIn - 60)
.ConfigureAwait(true);
return data.AccessToken; return data.AccessToken;
} }
public async Task Logout() public async Task Logout()
{ {
// clear localStorage await _localStorage.ClearAsync()
await _localStorage.RemoveItemAsync("_xa"); .ConfigureAwait(true);
await _localStorage.RemoveItemAsync("_xr");
await _localStorage.RemoveItemAsync("_xu");
await _localStorage.RemoveItemAsync("_xe");
// notify system on user logout
((AuthStateProvider)_authStateProvider).NotifyUserLogout(); ((AuthStateProvider)_authStateProvider).NotifyUserLogout();
// remove request headers
_client.DefaultRequestHeaders.Authorization = null; _client.DefaultRequestHeaders.Authorization = null;
} }
public async Task<UserInfoView> UserInfo(bool write = false) public async Task<UserInfoView> UserInfo(bool write = false)
{ {
var infoResponse = await _client.GetAsync(_apiConfig.Value.UserInfo); var infoResponse = await _client.GetAsync(_apiConfig.Value.UserInfo)
var infoContent = await infoResponse.Content.ReadAsStringAsync(); .ConfigureAwait(true);
var infoContent = await infoResponse.Content.ReadAsStringAsync()
.ConfigureAwait(true);
var userInfo = JsonSerializer.Deserialize<UserInfoView>(infoContent, _options); var userInfo = JsonSerializer.Deserialize<UserInfoView>(infoContent, _options);
if(write) if(write)
await _localStorage.SetItemAsync("_xu", userInfo); await _localStorage.SetItemAsync("_xu", userInfo).ConfigureAwait(true);
return userInfo ?? new UserInfoView(); return userInfo ?? new UserInfoView();
} }

View file

@ -1,27 +1,27 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
using System.Threading.Tasks; using System.Threading.Tasks;
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Views;
namespace Wonky.Client.Services namespace Wonky.Client.Services
{ {
public interface IAuthenticationService public interface IAuthenticationService
{ {
Task<ApiResponseView> RegisterUser(DtoNgUserRegistration dtoNgUserRegistration); Task<AuthResponseView> Login(UserAuthenticationDto userAuthenticationDtoUserAuth);
Task<AuthResponseView> Login(DtoUserAuthentication dtoUserAuth);
Task Logout(); Task Logout();
Task<string> RefreshToken(); Task<string> RefreshToken();
Task<UserInfoView> UserInfo(bool write = false); Task<UserInfoView> UserInfo(bool write = false);

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -36,7 +36,8 @@ public class RefreshTokenService
public async Task<string> TryRefreshToken() public async Task<string> TryRefreshToken()
{ {
var authState = await _authStateProvider.GetAuthenticationStateAsync(); var authState = await _authStateProvider.GetAuthenticationStateAsync()
.ConfigureAwait(true);
var user = authState.User; var user = authState.User;

View file

@ -28,7 +28,10 @@ public class UserPreferenceService
{ {
WorkDate = $"{workDate:yyyy-MM-dd}" WorkDate = $"{workDate:yyyy-MM-dd}"
}; };
await _localStorageService.SetItemAsync("preferences", newPreferences);
await _localStorageService.SetItemAsync("preferences", newPreferences)
.ConfigureAwait(true);
OnChange?.Invoke(newPreferences); OnChange?.Invoke(newPreferences);
} }
public async Task SetCompanySearch(string companySearch) public async Task SetCompanySearch(string companySearch)
@ -36,47 +39,70 @@ public class UserPreferenceService
var preferences = await GetPreferences(); var preferences = await GetPreferences();
var newPreferences = preferences var newPreferences = preferences
with { CompanySearch = companySearch }; with { CompanySearch = companySearch };
await _localStorageService.SetItemAsync("preferences", newPreferences);
await _localStorageService.SetItemAsync("preferences", newPreferences)
.ConfigureAwait(true);
OnChange?.Invoke(newPreferences); OnChange?.Invoke(newPreferences);
} }
public async Task SetCompanySort(string companySort) public async Task SetCompanySort(string companySort)
{ {
var preferences = await GetPreferences(); var preferences = await GetPreferences()
.ConfigureAwait(true);
var newPreferences = preferences var newPreferences = preferences
with { CompanySort = companySort }; with { CompanySort = companySort };
await _localStorageService.SetItemAsync("preferences", newPreferences);
await _localStorageService.SetItemAsync("preferences", newPreferences)
.ConfigureAwait(true);
OnChange?.Invoke(newPreferences); OnChange?.Invoke(newPreferences);
} }
public async Task SetItemSearch(string itemSearch) public async Task SetItemSearch(string itemSearch)
{ {
var preferences = await GetPreferences(); var preferences = await GetPreferences()
.ConfigureAwait(true);
var newPreferences = preferences var newPreferences = preferences
with { ItemSearch = itemSearch }; with { ItemSearch = itemSearch };
await _localStorageService.SetItemAsync("preferences", newPreferences);
await _localStorageService.SetItemAsync("preferences", newPreferences)
.ConfigureAwait(true);
OnChange?.Invoke(newPreferences); OnChange?.Invoke(newPreferences);
} }
public async Task SetItemSort(string itemSort) public async Task SetItemSort(string itemSort)
{ {
var preferences = await GetPreferences(); var preferences = await GetPreferences()
.ConfigureAwait(true);
var newPreferences = preferences var newPreferences = preferences
with { ItemSort = itemSort }; with { ItemSort = itemSort };
await _localStorageService.SetItemAsync("preferences", newPreferences);
await _localStorageService.SetItemAsync("preferences", newPreferences)
.ConfigureAwait(true);
OnChange?.Invoke(newPreferences); OnChange?.Invoke(newPreferences);
} }
public async Task SetPageSize(string pageSize) public async Task SetPageSize(string pageSize)
{ {
var preferences = await GetPreferences(); var preferences = await GetPreferences()
.ConfigureAwait(true);
var newPreferences = preferences var newPreferences = preferences
with { PageSize = pageSize }; with { PageSize = pageSize };
await _localStorageService.SetItemAsync("preferences", newPreferences);
await _localStorageService.SetItemAsync("preferences", newPreferences)
.ConfigureAwait(true);
OnChange?.Invoke(newPreferences); OnChange?.Invoke(newPreferences);
} }
public async Task<Preferences> GetPreferences() public async Task<Preferences> GetPreferences()
{ {
return await _localStorageService.GetItemAsync<Preferences>("preferences") return await _localStorageService.GetItemAsync<Preferences>("preferences").ConfigureAwait(true)
?? new Preferences(); ?? new Preferences();
} }
} }

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -50,8 +50,11 @@ public class VatInfoLookupService
["zipCode"] = $"{query.ZipCode}" ["zipCode"] = $"{query.ZipCode}"
}; };
var endpoint = QueryHelpers.AddQueryString(_apiConfig.Value.CvrLookup, queryString); var endpoint = QueryHelpers.AddQueryString(_apiConfig.Value.CvrLookup, queryString);
var response = await _client.GetAsync(endpoint); var response = await _client.GetAsync(endpoint)
var content = await response.Content.ReadAsStringAsync(); .ConfigureAwait(true);
var content = await response.Content.ReadAsStringAsync()
.ConfigureAwait(true);
var jsonResult = JsonSerializer.Deserialize<List<VirkRegInfo>>(content, _options); var jsonResult = JsonSerializer.Deserialize<List<VirkRegInfo>>(content, _options);
@ -70,6 +73,7 @@ public class VatInfoLookupService
{ {
if (!string.IsNullOrWhiteSpace(query.VatNumber)) if (!string.IsNullOrWhiteSpace(query.VatNumber))
return true; return true;
return !string.IsNullOrWhiteSpace(query.HouseNumber) && !string.IsNullOrWhiteSpace(query.StreetName) && return !string.IsNullOrWhiteSpace(query.HouseNumber) && !string.IsNullOrWhiteSpace(query.StreetName) &&
!string.IsNullOrWhiteSpace(query.ZipCode); !string.IsNullOrWhiteSpace(query.ZipCode);
} }

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -18,6 +18,7 @@ using System.Security.Claims;
using Blazored.LocalStorage; using Blazored.LocalStorage;
using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.Authorization;
using Wonky.Entity.DTO; using Wonky.Entity.DTO;
using Wonky.Entity.Views;
namespace Wonky.Client.Shared namespace Wonky.Client.Shared
{ {
@ -37,21 +38,25 @@ namespace Wonky.Client.Shared
public override async Task<AuthenticationState> GetAuthenticationStateAsync() public override async Task<AuthenticationState> GetAuthenticationStateAsync()
{ {
// fetch token from localStorage // fetch token from localStorage
var token = await _storage.GetItemAsync<string>("_xa"); var token = await _storage.GetItemAsync<string>("_xa")
.ConfigureAwait(true);
if (string.IsNullOrEmpty(token)) if (string.IsNullOrEmpty(token))
// return anonymous if empty // return anonymous if empty
return _anonymous; return _anonymous;
// create an authorized user // create an authorized user
var userInfo = await _storage.GetItemAsync<UserInfoView>("_xu"); var userInfo = await _storage.GetItemAsync<UserInfoView>("_xu")
.ConfigureAwait(true);
if (userInfo == null) if (userInfo == null)
return _anonymous; return _anonymous;
// set client authorization header // set client authorization header
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", token); _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", token);
var exp = await _storage.GetItemAsync<string>("_xe"); var exp = await _storage.GetItemAsync<string>("_xe")
.ConfigureAwait(true);
var roles = ExtractRoles(userInfo); var roles = ExtractRoles(userInfo);
var claims = new List<Claim> var claims = new List<Claim>
@ -79,8 +84,12 @@ namespace Wonky.Client.Shared
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", token); _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", token);
// create an authorized user // create an authorized user
var userInfo = await _storage.GetItemAsync<UserInfoView>("_xu"); var userInfo = await _storage.GetItemAsync<UserInfoView>("_xu")
var exp = await _storage.GetItemAsync<string>("_xe"); .ConfigureAwait(true);
var exp = await _storage.GetItemAsync<string>("_xe")
.ConfigureAwait(true);
var roles = ExtractRoles(userInfo); var roles = ExtractRoles(userInfo);
var claims = new List<Claim> var claims = new List<Claim>
{ {
@ -102,6 +111,7 @@ namespace Wonky.Client.Shared
public void NotifyUserLogout() public void NotifyUserLogout()
{ {
var authState = Task.FromResult(_anonymous); var authState = Task.FromResult(_anonymous);
NotifyAuthenticationStateChanged(authState); NotifyAuthenticationStateChanged(authState);
} }

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@

View file

@ -1,15 +1,15 @@
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
@ -30,7 +30,8 @@ public partial class DraftStateProvider
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
Draft = await LocalStorageService.GetItemAsync<Draft>(Account); Draft = await LocalStorageService.GetItemAsync<Draft>(Account)
.ConfigureAwait(true);
if (Draft == null || Draft.Items.Count == 0) if (Draft == null || Draft.Items.Count == 0)
{ {
@ -49,12 +50,14 @@ public partial class DraftStateProvider
public async Task SaveChangesAsync() public async Task SaveChangesAsync()
{ {
await LocalStorageService.SetItemAsync(Account, Draft); await LocalStorageService.SetItemAsync(Account, Draft)
.ConfigureAwait(true);
} }
public async Task DeleteDraftAsync() public async Task DeleteDraftAsync()
{ {
Draft.Items.Clear(); Draft.Items.Clear();
await LocalStorageService.SetItemAsync(Account, Draft); await LocalStorageService.SetItemAsync(Account, Draft)
.ConfigureAwait(true);
} }
} }

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@
@ -24,7 +24,7 @@
<main> <main>
<div class="top-row px-4"> <div class="top-row px-4">
<AuthLinks /> <span><a href="About"><i class="oi oi-question-mark"></i></a></span> <TopbarNavigation />
</div> </div>
<div class="content px-4"> <div class="content px-4">

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@ *@
@ -21,7 +21,7 @@
<div class="top-row ps-3 navbar navbar-dark"> <div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href=""> <a class="navbar-brand" href="">
<AppVersion/> <TopbarDisplayUser></TopbarDisplayUser>
</a> </a>
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu"> <button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
@ -31,11 +31,6 @@
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu"> <div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
<nav class="flex-column"> <nav class="flex-column">
<div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<span class="oi oi-home" aria-hidden="true"></span> Start
</NavLink>
</div>
<AuthorizeView> <AuthorizeView>
<NotAuthorized> <NotAuthorized>
<div class="nav-item px-3"> <div class="nav-item px-3">
@ -47,6 +42,11 @@
</AuthorizeView> </AuthorizeView>
<AuthorizeView Roles="Adviser,Admin"> <AuthorizeView Roles="Adviser,Admin">
<Authorized> <Authorized>
<div class="nav-item px-3">
<NavLink class="nav-link" href="/" Match="NavLinkMatch.All">
<span class="oi oi-home" aria-hidden="true"></span> Start
</NavLink>
</div>
<div class="nav-item px-3"> <div class="nav-item px-3">
<NavLink class="nav-link" href="companies"> <NavLink class="nav-link" href="companies">
<span class="oi oi-list-rich" aria-hidden="true"></span> Firmaer <span class="oi oi-list-rich" aria-hidden="true"></span> Firmaer
@ -62,6 +62,12 @@
<span class="oi oi-list-rich" aria-hidden="true"></span> Dagsrapport <span class="oi oi-list-rich" aria-hidden="true"></span> Dagsrapport
</NavLink> </NavLink>
</div> </div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="info">
<span class="oi oi-list-rich" aria-hidden="true"></span> Info
</NavLink>
</div>
</Authorized> </Authorized>
</AuthorizeView> </AuthorizeView>
</nav> </nav>

View file

@ -11,10 +11,10 @@
<PackageReference Include="Blazored.LocalStorage" Version="4.2.0" /> <PackageReference Include="Blazored.LocalStorage" Version="4.2.0" />
<PackageReference Include="Blazored.Toast" Version="3.2.2" /> <PackageReference Include="Blazored.Toast" Version="3.2.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="6.0.4" /> <PackageReference Include="Microsoft.AspNetCore.Authorization" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="6.0.4" /> <PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.4" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.4" PrivateAssets="all" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.5" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />

View file

@ -1,16 +1,16 @@
@* @*
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // 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] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
*@@using System.Net.Http *@@using System.Net.Http

View file

@ -6,6 +6,12 @@
"Microsoft": "Information" "Microsoft": "Information"
} }
}, },
"app": {
"name": "Willy Wonka",
"version": "0.3",
"isBeta": true,
"image": "grumpy-coder.png"
},
"apiConfig": { "apiConfig": {
"baseAddress": "https://staging.innotec.dk", "baseAddress": "https://staging.innotec.dk",
"tokenPath": "token", "tokenPath": "token",

View file

@ -9,10 +9,10 @@
/* visit / vat state classes */ /* visit / vat state classes */
.state { .state {
width: 24px; width: 8px;
height: 24px; height: 8px;
min-width: 24px; min-width: 8px;
min-height: 24px; min-height: 8px;
} }
.text-inno { .text-inno {
color: #ffaa00; color: #ffaa00;
@ -20,12 +20,6 @@
.tombstone { .tombstone {
background-image: url(../gravestone.png); background-image: url(../gravestone.png);
} }
.the-dead {
background-color: black;
}
.the-draw {
background-color: purple;
}
.the-good { .the-good {
background-color: green; background-color: green;
} }
@ -35,6 +29,12 @@
.the-ugly { .the-ugly {
background-color: red; background-color: red;
} }
.the-draw {
background-color: purple;
}
.the-dead {
background-color: black;
}
/* end visit state classes*/ /* end visit state classes*/
html, body { html, body {

Some files were not shown because too many files have changed in this diff Show more