the-good the-bad and the-ugly
This commit is contained in:
parent
7bbb1529dd
commit
b193209bc3
17 changed files with 121 additions and 521 deletions
|
@ -2,7 +2,7 @@ namespace Wonky.Client;
|
||||||
|
|
||||||
public class AppId
|
public class AppId
|
||||||
{
|
{
|
||||||
public string Version { get; set; } = "0.2.6";
|
public string Version { get; set; } = "0.2.7";
|
||||||
public string Name { get; set; } = "Wonky Online";
|
public string Name { get; set; } = "Wonky Online";
|
||||||
|
|
||||||
public bool IsBeta { get; set; } = false;
|
public bool IsBeta { get; set; } = false;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
@foreach (var company in Companies)
|
@foreach (var company in Companies)
|
||||||
{
|
{
|
||||||
<div class="row p-2 mb-1 border-bottom">
|
<div class="row p-2 mb-1 border-bottom">
|
||||||
|
<div class="state rounded-circle @(VisitState(company.LastVisit))"></div>
|
||||||
<div class="col-sm-4">@company.Name</div>
|
<div class="col-sm-4">@company.Name</div>
|
||||||
<div class="col-sm-2">@company.Account</div>
|
<div class="col-sm-2">@company.Account</div>
|
||||||
<div class="col-sm-4">@company.City</div>
|
<div class="col-sm-4">@company.City</div>
|
||||||
|
|
|
@ -30,6 +30,14 @@ namespace Wonky.Client.Components
|
||||||
private Confirmation _confirmation = new ();
|
private Confirmation _confirmation = new ();
|
||||||
private string _companyId = string.Empty;
|
private string _companyId = string.Empty;
|
||||||
|
|
||||||
|
private string VisitState(string nextVisit)
|
||||||
|
{
|
||||||
|
var theUgly = DateTime.Parse(nextVisit);
|
||||||
|
var theBad = theUgly.AddDays(-14);
|
||||||
|
if (DateTime.Now >= theUgly)
|
||||||
|
return "the-ugly";
|
||||||
|
return DateTime.Now >= theBad ? "the-bad" : "the-good";
|
||||||
|
}
|
||||||
private void CallConfirmationModal(string companyId)
|
private void CallConfirmationModal(string companyId)
|
||||||
{
|
{
|
||||||
_companyId = companyId;
|
_companyId = companyId;
|
||||||
|
|
|
@ -1,109 +0,0 @@
|
||||||
@*
|
|
||||||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the Affero GNU 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
|
|
||||||
// Affero GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the Affero GNU General Public License
|
|
||||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
|
||||||
//
|
|
||||||
*@
|
|
||||||
<EditForm Model="AdrContext" OnValidSubmit="FetchAddressData">
|
|
||||||
<div class="row mb-3">
|
|
||||||
<DataAnnotationsValidator/>
|
|
||||||
<div class="col">
|
|
||||||
<input type="text" id="streetName" class="form-control" placeholder="Vejnavn"
|
|
||||||
@bind-value="AdrQuery.StreetName" required />
|
|
||||||
<ValidationMessage For="@(() => AdrQuery.StreetName)"></ValidationMessage>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<input type="text" id="houseNumber" class="form-control" placeholder="Husnummer"
|
|
||||||
@bind-value="AdrQuery.HouseNumber" required/>
|
|
||||||
<ValidationMessage For="@(() => AdrQuery.HouseNumber)"></ValidationMessage>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<input type="text" id="zipCode" class="form-control" placeholder="Postnummer"
|
|
||||||
@bind-value="AdrQuery.ZipCode" required/>
|
|
||||||
<ValidationMessage For="@(() => AdrQuery.ZipCode)"></ValidationMessage>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<button class="btn btn-primary" type="submit">Vis</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</EditForm>
|
|
||||||
<div style="@(ShowAdrResult ? "" : "display:none;")">
|
|
||||||
@if (_adrInfos.Any())
|
|
||||||
{
|
|
||||||
<div class="row mb-3">
|
|
||||||
@foreach (var info in _adrInfos)
|
|
||||||
{
|
|
||||||
@if(info.Name == "INGEN DATA")
|
|
||||||
{
|
|
||||||
<div class="card mx-3 mb-3 col-sm-12 col-md-6 col-lg-4" style="width: 30rem;">
|
|
||||||
<div class="card-header">@info.Name</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<div class="card mx-3 mb-3 col-sm-12 col-md-6 col-lg-4 @(info.States[^1].State == "NORMAL" ? "border-success" : "border-warning")" style="width: 30rem;">
|
|
||||||
<div class="card-header @(info.States[^1].State == "NORMAL" ? "bg-success text-white" : "bg-light")">
|
|
||||||
<div class="card-title"><i class="@(info.States[^1].State == "NORMAL" ? "oi oi-check" : "oi oi-warning")"></i><span> @info.Name</span></div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-3 fw-bold">
|
|
||||||
Reg.nr.
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
@info.VatNumber
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-3 fw-bold">
|
|
||||||
Conavn
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
@info.CoName
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-3 fw-bold">
|
|
||||||
Adresse
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
@info.Address
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-3 fw-bold">
|
|
||||||
Postnr
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
@info.ZipCode
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-3 fw-bold">
|
|
||||||
Bynavn
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
@info.City
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<AppSpinner/>
|
|
||||||
}
|
|
||||||
</div>
|
|
|
@ -1,92 +0,0 @@
|
||||||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the Affero GNU 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
|
|
||||||
// Affero GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the Affero GNU General Public License
|
|
||||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
|
||||||
//
|
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Microsoft.AspNetCore.Components.Forms;
|
|
||||||
using Wonky.Client.HttpInterceptors;
|
|
||||||
using Wonky.Client.Services;
|
|
||||||
using Wonky.Entity.Models;
|
|
||||||
using Wonky.Entity.Requests;
|
|
||||||
|
|
||||||
namespace Wonky.Client.Components;
|
|
||||||
|
|
||||||
public partial class RegLookupAddress : IDisposable
|
|
||||||
{
|
|
||||||
private Query AdrQuery { get; set; } = new();
|
|
||||||
private EditContext AdrContext { get; set; }
|
|
||||||
private List<VirkRegInfo> _adrInfos { get; set; } = new();
|
|
||||||
private bool ShowAdrResult;
|
|
||||||
private bool AdrInvalid = true;
|
|
||||||
[Inject] public VirkRegistryService AdrQueryService { get; set; }
|
|
||||||
[Inject] public HttpInterceptorService Interceptor { get; set; }
|
|
||||||
|
|
||||||
protected override void OnInitialized()
|
|
||||||
{
|
|
||||||
ShowAdrResult = false;
|
|
||||||
AdrContext = new EditContext(AdrQuery);
|
|
||||||
AdrContext.OnFieldChanged += HandleAdrChanged;
|
|
||||||
AdrContext.OnValidationStateChanged += AdrValidationChanged;
|
|
||||||
Interceptor.RegisterEvent();
|
|
||||||
Interceptor.RegisterBeforeSendEvent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task FetchAddressData()
|
|
||||||
{
|
|
||||||
ShowAdrResult = true;
|
|
||||||
|
|
||||||
var query = new VirkParams
|
|
||||||
{
|
|
||||||
VatNumber = "",
|
|
||||||
HouseNumber = AdrQuery.HouseNumber,
|
|
||||||
StreetName = AdrQuery.StreetName,
|
|
||||||
ZipCode = AdrQuery.ZipCode
|
|
||||||
};
|
|
||||||
_adrInfos = await AdrQueryService.QueryVirkRegistry(query).ConfigureAwait(true);
|
|
||||||
}
|
|
||||||
private void HandleAdrChanged(object sender, FieldChangedEventArgs e)
|
|
||||||
{
|
|
||||||
AdrInvalid = !AdrContext.Validate();
|
|
||||||
StateHasChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AdrValidationChanged(object sender, ValidationStateChangedEventArgs e)
|
|
||||||
{
|
|
||||||
AdrInvalid = true;
|
|
||||||
AdrContext.OnFieldChanged -= HandleAdrChanged;
|
|
||||||
AdrContext = new EditContext(AdrQuery);
|
|
||||||
AdrContext.OnFieldChanged += HandleAdrChanged;
|
|
||||||
AdrContext.NotifyValidationStateChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Interceptor.DisposeEvent();
|
|
||||||
AdrContext.OnFieldChanged -= HandleAdrChanged;
|
|
||||||
AdrContext.OnValidationStateChanged -= AdrValidationChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Query
|
|
||||||
{
|
|
||||||
[Required(ErrorMessage = "Vejnavn skal udfyldes", AllowEmptyStrings = false)]
|
|
||||||
public string StreetName { get; set; } = "";
|
|
||||||
|
|
||||||
[Required(ErrorMessage = "Husnummer skal udfyldes")]
|
|
||||||
public string HouseNumber { get; set; } = "";
|
|
||||||
|
|
||||||
[Required(ErrorMessage = "Postnummer skal udfyldes")]
|
|
||||||
public string ZipCode { get; set; } = "";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,101 +0,0 @@
|
||||||
@*
|
|
||||||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the Affero GNU 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
|
|
||||||
// Affero GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the Affero GNU General Public License
|
|
||||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
|
||||||
//
|
|
||||||
*@
|
|
||||||
|
|
||||||
<EditForm EditContext="_regContext" OnValidSubmit="FetchRegData">
|
|
||||||
<DataAnnotationsValidator />
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="col">
|
|
||||||
<InputText id="cvrLookup" class="form-control" placeholder="reg.nr. eks. 26991765"
|
|
||||||
@bind-Value="VatNumber" required />
|
|
||||||
<ValidationMessage For="@(() => VatNumber)"></ValidationMessage>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<button class="btn btn-success" type="submit" autocomplete="off" >Vis</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</EditForm>
|
|
||||||
|
|
||||||
<div style="@(_showVatResult ? "" : "display:none;")">
|
|
||||||
@if (_vatInfos.Any())
|
|
||||||
{
|
|
||||||
<div class="row mb-3">
|
|
||||||
@foreach (var info in _vatInfos)
|
|
||||||
{
|
|
||||||
@if(info.Name == "INGEN DATA")
|
|
||||||
{
|
|
||||||
<div class="card mx-3 mb-3 col-sm-12 col-md-6 col-lg-4" style="width: 30rem;">
|
|
||||||
<div class="card-header">@info.Name</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<div class=" card mx-3 mb-3 col-sm-12 col-md-6 col-lg-4 @(info.States[^1].State == "NORMAL" ? "border-success" : "border-warning")" style="width: 30rem;">
|
|
||||||
<div class="card-header @(info.States[^1].State == "NORMAL" ? "bg-success text-white" : "bg-light")">
|
|
||||||
<div class="card-title"><i class="@(info.States[^1].State == "NORMAL" ? "oi oi-check" : "oi oi-warning")"></i><span> @info.Name</span></div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-3 fw-bold">
|
|
||||||
Reg.nr.
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
@info.VatNumber
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-3 fw-bold">
|
|
||||||
Conavn
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
@info.CoName
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-3 fw-bold">
|
|
||||||
Adresse
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
@info.Address
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-3 fw-bold">
|
|
||||||
Postnr
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
@info.ZipCode
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-3 fw-bold">
|
|
||||||
Bynavn
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
@info.City
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<AppSpinner/>
|
|
||||||
}
|
|
||||||
</div>
|
|
|
@ -1,82 +0,0 @@
|
||||||
// Copyright (C) 2022 FCS Frede's Computer Services.
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the Affero GNU 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
|
|
||||||
// Affero GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the Affero GNU General Public License
|
|
||||||
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
|
||||||
//
|
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Microsoft.AspNetCore.Components.Forms;
|
|
||||||
using Wonky.Client.HttpInterceptors;
|
|
||||||
using Wonky.Client.Services;
|
|
||||||
using Wonky.Entity.Models;
|
|
||||||
using Wonky.Entity.Requests;
|
|
||||||
|
|
||||||
namespace Wonky.Client.Components;
|
|
||||||
|
|
||||||
public partial class RegLookupVatNo : IDisposable
|
|
||||||
{
|
|
||||||
private EditContext _regContext { get; set; }
|
|
||||||
private List<VirkRegInfo> _vatInfos { get; set; } = new();
|
|
||||||
private bool _showVatResult = true;
|
|
||||||
private bool _regInvalid = true;
|
|
||||||
|
|
||||||
[Required] private string VatNumber { get; set; } = "";
|
|
||||||
[Inject] private VirkRegistryService RegQueryService { get; set; }
|
|
||||||
[Inject] private HttpInterceptorService Interceptor { get; set; }
|
|
||||||
|
|
||||||
protected override void OnInitialized()
|
|
||||||
{
|
|
||||||
_showVatResult = false;
|
|
||||||
_regContext = new EditContext(VatNumber);
|
|
||||||
_regContext.OnFieldChanged += HandleRegChanged;
|
|
||||||
Interceptor.RegisterEvent();
|
|
||||||
Interceptor.RegisterBeforeSendEvent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HandleRegChanged(object sender, FieldChangedEventArgs e)
|
|
||||||
{
|
|
||||||
_regInvalid = !_regContext.Validate();
|
|
||||||
StateHasChanged();
|
|
||||||
}
|
|
||||||
private async Task FetchRegData()
|
|
||||||
{
|
|
||||||
_showVatResult = true;
|
|
||||||
|
|
||||||
var query = new VirkParams
|
|
||||||
{
|
|
||||||
VatNumber = VatNumber,
|
|
||||||
HouseNumber = "",
|
|
||||||
StreetName = "",
|
|
||||||
ZipCode = ""
|
|
||||||
};
|
|
||||||
_vatInfos = await RegQueryService.QueryVirkRegistry(query).ConfigureAwait(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RegValidationChanged(object sender, ValidationStateChangedEventArgs e)
|
|
||||||
{
|
|
||||||
_vatInfos.Clear();
|
|
||||||
_regInvalid = true;
|
|
||||||
_regContext.OnFieldChanged -= HandleRegChanged;
|
|
||||||
_regContext = new EditContext(VatNumber);
|
|
||||||
_regContext.OnFieldChanged += HandleRegChanged;
|
|
||||||
_regContext.NotifyValidationStateChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Interceptor.DisposeEvent();
|
|
||||||
_regContext.OnFieldChanged -= HandleRegChanged;
|
|
||||||
_regContext.OnValidationStateChanged -= RegValidationChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -17,9 +17,9 @@
|
||||||
|
|
||||||
@if (string.IsNullOrEmpty(VatNumber))
|
@if (string.IsNullOrEmpty(VatNumber))
|
||||||
{
|
{
|
||||||
<div class="state rounded-circle mx-3 alert alert-info"></div>
|
<span class="state the-bad rounded-circle mx-3"></span>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div class="state rounded-circle mx-3 alert @(CurrentRegState == "NORMAL" ? "alert-success" : "alert-danger" )"></div>
|
<span class="state rounded-circle mx-3 @(CurrentRegState == "NORMAL" ? "the-good" : "the-ugly" )"></span>
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,18 +24,16 @@ namespace Wonky.Client.Components;
|
||||||
public partial class RegStateVatNumber
|
public partial class RegStateVatNumber
|
||||||
{
|
{
|
||||||
[Inject] public VirkRegistryService VirkRegistryService { get; set; }
|
[Inject] public VirkRegistryService VirkRegistryService { get; set; }
|
||||||
|
|
||||||
[Parameter] public string VatNumber { get; set; } = "";
|
[Parameter] public string VatNumber { get; set; } = "";
|
||||||
|
|
||||||
private VirkRegInfo VirkRegInfo { get; set; } = new();
|
private VirkRegInfo VirkRegInfo { get; set; } = new();
|
||||||
private readonly VirkParams _VirkParams = new();
|
private readonly VirkParams _VirkParams = new();
|
||||||
private string CurrentRegState = "UKENDT";
|
private string CurrentRegState = "UKENDT";
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
_VirkParams.VatNumber = VatNumber;
|
|
||||||
if (!string.IsNullOrEmpty(VatNumber))
|
if (!string.IsNullOrEmpty(VatNumber))
|
||||||
{
|
{
|
||||||
|
_VirkParams.VatNumber = VatNumber;
|
||||||
var result = await VirkRegistryService.QueryVirkRegistry(_VirkParams);
|
var result = await VirkRegistryService.QueryVirkRegistry(_VirkParams);
|
||||||
VirkRegInfo = result.Any() ? result[0] : new VirkRegInfo();
|
VirkRegInfo = result.Any() ? result[0] : new VirkRegInfo();
|
||||||
if (VirkRegInfo.States.Any())
|
if (VirkRegInfo.States.Any())
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
.state {
|
|
||||||
max-width: 16px;
|
|
||||||
max-height: 16px;
|
|
||||||
float: left;
|
|
||||||
}
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Microsoft.AspNetCore.Components.Forms;
|
using Microsoft.AspNetCore.Components.Forms;
|
||||||
|
using Wonky.Client.Models;
|
||||||
|
|
||||||
namespace Wonky.Client.Components;
|
namespace Wonky.Client.Components;
|
||||||
public partial class VatNumberInputComponent : IDisposable
|
public partial class VatNumberInputComponent : IDisposable
|
||||||
|
@ -8,6 +9,7 @@ public partial class VatNumberInputComponent : IDisposable
|
||||||
private string VatNumber { get; set; } = "";
|
private string VatNumber { get; set; } = "";
|
||||||
private EditContext? _editVatNumber;
|
private EditContext? _editVatNumber;
|
||||||
private bool _formInvalid = true;
|
private bool _formInvalid = true;
|
||||||
|
|
||||||
[Parameter] public EventCallback<string> OnValidSubmit { get; set; }
|
[Parameter] public EventCallback<string> OnValidSubmit { get; set; }
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,9 +38,7 @@ namespace Wonky.Client.Pages
|
||||||
private VirkRegInfo _virkRegInfo = new();
|
private VirkRegInfo _virkRegInfo = new();
|
||||||
private EditContext _editContext;
|
private EditContext _editContext;
|
||||||
private bool _formInvalid = true;
|
private bool _formInvalid = true;
|
||||||
private VirkParams _virkParams = new();
|
|
||||||
private List<VirkRegInfo> VInfos { get; set; } = new();
|
private List<VirkRegInfo> VInfos { get; set; } = new();
|
||||||
[Required] public string VatToLookup { 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; }
|
||||||
[Inject] public IToastService ToastService { get; set; }
|
[Inject] public IToastService ToastService { get; set; }
|
||||||
|
|
|
@ -23,45 +23,18 @@
|
||||||
|
|
||||||
@if (_companyDto != null)
|
@if (_companyDto != null)
|
||||||
{
|
{
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="col">
|
|
||||||
<VatNumberInputComponent OnValidSubmit="GetInfoFromVat" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="col">
|
|
||||||
<VatAddressInputComponent OnValidSubmit="GetInfoFromAddress" />
|
|
||||||
@if (VInfos.Any())
|
|
||||||
{
|
|
||||||
@foreach (var info in VInfos)
|
|
||||||
{
|
|
||||||
<div class="row">
|
|
||||||
<div class="col">
|
|
||||||
@info.VatNumber
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
@info.Name
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
@info.States[^1].State
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<button class="btn btn-primary" @onclick="@(() => SelectCompany(info.VatNumber))">OVERFØR</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<RegStateVatNumber VatNumber="@_companyDto.VatNumber"></RegStateVatNumber>
|
||||||
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<EditForm EditContext="_editContext" OnValidSubmit="Update" class="card card-body bg-light mt-5">
|
<EditForm EditContext="_editContext" OnValidSubmit="Update">
|
||||||
<DataAnnotationsValidator/>
|
<DataAnnotationsValidator/>
|
||||||
<div class="form-group row mb-2">
|
<div class="form-group row mb-2">
|
||||||
<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="_companyDto.Name"/>
|
<InputText id="name" class="form-control" @bind-Value="_companyDto.Name"/>
|
||||||
<ValidationMessage For="@(() => _companyDto.Name)" />
|
<ValidationMessage For="@(() => _companyDto.Name)"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row mb-2">
|
<div class="form-group row mb-2">
|
||||||
|
@ -80,7 +53,7 @@
|
||||||
<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="_companyDto.ZipCode"/>
|
<InputText id="zipCode" class="form-control" @bind-Value="_companyDto.ZipCode"/>
|
||||||
<ValidationMessage For="@(() => _companyDto.ZipCode)" />
|
<ValidationMessage For="@(() => _companyDto.ZipCode)"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row mb-2">
|
<div class="form-group row mb-2">
|
||||||
|
@ -94,7 +67,7 @@
|
||||||
<label for="vatNumber" class="col-md-2 col-form-label">CVR/ORG</label>
|
<label for="vatNumber" class="col-md-2 col-form-label">CVR/ORG</label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<InputText id="vatNumber" class="form-control" @bind-Value="_companyDto.VatNumber"/>
|
<InputText id="vatNumber" class="form-control" @bind-Value="_companyDto.VatNumber"/>
|
||||||
<ValidationMessage For="@(() => _companyDto.VatNumber)" />
|
<ValidationMessage For="@(() => _companyDto.VatNumber)"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row mb-2">
|
<div class="form-group row mb-2">
|
||||||
|
@ -118,22 +91,26 @@
|
||||||
<div class="form-group row mb-2">
|
<div class="form-group row mb-2">
|
||||||
<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="_companyDto.Attention" />
|
<InputText id="attention" class="form-control" @bind-Value="_companyDto.Attention"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group row mb-2">
|
||||||
<label for="lastVisit" class="col-form-label">Sidste besøg</label>
|
<label for="lastVisit" class="col-form-label col-md-2">Sidste besøg</label>
|
||||||
<input type="date" id="lastVisit" class="form-control" value="@LastVisit"
|
<div class="col-md-3">
|
||||||
@onchange="@(e => LastVisitChanged(DateTime.Parse(e.Value.ToString())))"/>
|
<InputDate id="lastVisit" class="form-control" @bind-Value="@LastVisit"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group row mb-2">
|
||||||
<label for="nextVisit" class="col-form-label">Næste besøg</label>
|
<label for="nextVisit" class="col-form-label col-md-2">Næste besøg</label>
|
||||||
<input type="date" id="nextVisit" class="form-control" value="@NextVisit"
|
<div class="col-md-3">
|
||||||
@onchange="@(e => NextVisitChanged(DateTime.Parse(e.Value.ToString())))"/>
|
<InputDate id="nextVisit" class="form-control" @bind-Value="@(NextVisit)"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group row mb-2">
|
||||||
<label for="interval">Interval</label>
|
<label for="interval" class="col-form-label col-md-2">Besøgs interval Interval</label>
|
||||||
<InputNumber id="interval" class="form-control" @bind-Value="_companyDto.Interval" />
|
<div class="col-md-3">
|
||||||
|
<InputNumber id="interval" class="form-control" @bind-Value="_companyDto.Interval"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<div class="col-md-12 text-right">
|
<div class="col-md-12 text-right">
|
||||||
|
@ -143,8 +120,8 @@
|
||||||
</EditForm>
|
</EditForm>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<div class="row align-content-end">
|
<div class="row">
|
||||||
<div class="col align-items-end">
|
<div class="col">
|
||||||
<a class="btn btn-primary" href="/companies">Tilbage</a>
|
<a class="btn btn-primary" href="/companies">Tilbage</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,15 +13,11 @@
|
||||||
// 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.Globalization;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Blazored.Toast.Services;
|
using Blazored.Toast.Services;
|
||||||
using Wonky.Client.HttpInterceptors;
|
using Wonky.Client.HttpInterceptors;
|
||||||
using Wonky.Client.HttpRepository;
|
using Wonky.Client.HttpRepository;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Microsoft.AspNetCore.Components.Forms;
|
using Microsoft.AspNetCore.Components.Forms;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Wonky.Client.Models;
|
using Wonky.Client.Models;
|
||||||
using Wonky.Client.Services;
|
using Wonky.Client.Services;
|
||||||
using Wonky.Entity.DTO;
|
using Wonky.Entity.DTO;
|
||||||
|
@ -32,13 +28,6 @@ namespace Wonky.Client.Pages;
|
||||||
|
|
||||||
public partial class CompanyUpdate : IDisposable
|
public partial class CompanyUpdate : IDisposable
|
||||||
{
|
{
|
||||||
private CompanyDto _companyDto;
|
|
||||||
private EditContext _editContext;
|
|
||||||
private bool _formInvalid = true;
|
|
||||||
private DateTime LastVisit { get; set; }
|
|
||||||
private DateTime NextVisit { get; set; }
|
|
||||||
private List<VirkRegInfo> VInfos { get; set; }
|
|
||||||
private VirkRegInfo _virkRegInfo { get; set; } = new();
|
|
||||||
[Inject] public ICompanyHttpRepository CompanyRepo { get; set; }
|
[Inject] public ICompanyHttpRepository CompanyRepo { get; set; }
|
||||||
[Inject] public HttpInterceptorService Interceptor { get; set; }
|
[Inject] public HttpInterceptorService Interceptor { get; set; }
|
||||||
[Inject] public IToastService ToastService { get; set; }
|
[Inject] public IToastService ToastService { get; set; }
|
||||||
|
@ -46,6 +35,13 @@ public partial class CompanyUpdate : IDisposable
|
||||||
[Inject] public NavigationManager Navigation { get; set; }
|
[Inject] public NavigationManager Navigation { get; set; }
|
||||||
[Inject] public VirkRegistryService VirkRegistryService { get; set; }
|
[Inject] public VirkRegistryService VirkRegistryService { get; set; }
|
||||||
[Parameter] public string Account { get; set; } = null!;
|
[Parameter] public string Account { get; set; } = null!;
|
||||||
|
private CompanyDto _companyDto;
|
||||||
|
private EditContext _editContext;
|
||||||
|
private bool _formInvalid = true;
|
||||||
|
private List<VirkRegInfo> VInfos { get; set; } = new();
|
||||||
|
private VirkRegInfo _virkRegInfo { get; set; } = new();
|
||||||
|
private DateTime LastVisit { get; set; }
|
||||||
|
private DateTime NextVisit { get; set; }
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
@ -61,65 +57,61 @@ public partial class CompanyUpdate : IDisposable
|
||||||
private async Task Update()
|
private async Task Update()
|
||||||
{
|
{
|
||||||
// todo convert date input to ISO string
|
// todo convert date input to ISO string
|
||||||
|
_companyDto.LastVisit = $"{LastVisit:yyyy-MM-dd}";
|
||||||
|
_companyDto.NextVisit = $"{NextVisit:yyyy-MM-dd}";
|
||||||
|
|
||||||
await CompanyRepo.UpdateCompany(_companyDto);
|
await CompanyRepo.UpdateCompany(_companyDto);
|
||||||
ToastService.ShowSuccess($"Godt så. Firma '{_companyDto!.Name}' er opdateret.");
|
ToastService.ShowSuccess($"Godt så. Firma '{_companyDto!.Name}' er opdateret.");
|
||||||
Navigation.NavigateTo($"/company/{_companyDto.CompanyId}");
|
Navigation.NavigateTo($"/company/{_companyDto.CompanyId}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task GetInfoFromAddress(VatAddress address)
|
private async Task GetInfoFromAddress(VatAddress address)
|
||||||
|
{
|
||||||
|
VInfos = await VirkRegistryService.QueryVirkRegistry(
|
||||||
|
new VirkParams
|
||||||
|
{
|
||||||
|
StreetName = address.StreetName,
|
||||||
|
HouseNumber = address.HouseNumber,
|
||||||
|
ZipCode = address.ZipCode
|
||||||
|
});
|
||||||
|
if (!VInfos.Any())
|
||||||
{
|
{
|
||||||
VInfos = await VirkRegistryService.QueryVirkRegistry(
|
ToastService.ShowError($"Ingen virksomheder fundet.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private async Task GetInfoFromVat(string vatNumber)
|
||||||
|
{
|
||||||
|
var result = await VirkRegistryService
|
||||||
|
.QueryVirkRegistry(
|
||||||
new VirkParams
|
new VirkParams
|
||||||
{
|
{
|
||||||
StreetName = address.StreetName,
|
VatNumber = vatNumber
|
||||||
HouseNumber = address.HouseNumber,
|
|
||||||
ZipCode = address.ZipCode
|
|
||||||
});
|
});
|
||||||
if (!VInfos.Any())
|
if (!result.Any())
|
||||||
{
|
|
||||||
ToastService.ShowError($"Ingen virksomheder fundet.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private async Task GetInfoFromVat(string vatNumber)
|
|
||||||
{
|
{
|
||||||
var result = await VirkRegistryService
|
ToastService.ShowError($"Firma med CVR '{vatNumber}' findes ikke.");
|
||||||
.QueryVirkRegistry(new VirkParams {VatNumber = vatNumber});
|
return;
|
||||||
|
|
||||||
if (!result.Any())
|
|
||||||
{
|
|
||||||
ToastService.ShowError($"Firma med CVR '{vatNumber}' findes ikke.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ToastService.ShowSuccess($"Data for '{vatNumber}' er hentet.");
|
|
||||||
_virkRegInfo = result[0];
|
|
||||||
_companyDto.Name = _virkRegInfo.Name;
|
|
||||||
_companyDto.Address1 = _virkRegInfo.CoName;
|
|
||||||
_companyDto.Address2 = _virkRegInfo.Address;
|
|
||||||
_companyDto.ZipCode = _virkRegInfo.ZipCode;
|
|
||||||
_companyDto.City = _virkRegInfo.City;
|
|
||||||
_companyDto.VatNumber = _virkRegInfo.VatNumber;
|
|
||||||
}
|
}
|
||||||
|
ToastService.ShowSuccess($"Data for '{vatNumber}' er hentet.");
|
||||||
private void SelectCompany(string vatNumber)
|
_virkRegInfo = result[0];
|
||||||
{
|
_companyDto.Name = _virkRegInfo.Name;
|
||||||
_virkRegInfo = (from x in VInfos where x.VatNumber == vatNumber select x).First();
|
_companyDto.Address1 = _virkRegInfo.CoName;
|
||||||
_companyDto.Name = _virkRegInfo.Name;
|
_companyDto.Address2 = _virkRegInfo.Address;
|
||||||
_companyDto.Address1 = _virkRegInfo.CoName;
|
_companyDto.ZipCode = _virkRegInfo.ZipCode;
|
||||||
_companyDto.Address2 = _virkRegInfo.Address;
|
_companyDto.City = _virkRegInfo.City;
|
||||||
_companyDto.ZipCode = _virkRegInfo.ZipCode;
|
_companyDto.VatNumber = _virkRegInfo.VatNumber;
|
||||||
_companyDto.City = _virkRegInfo.City;
|
|
||||||
_companyDto.VatNumber = _virkRegInfo.VatNumber;
|
|
||||||
}
|
|
||||||
private void LastVisitChanged(DateTime lastDate)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NextVisitChanged(DateTime nextDate)
|
private void SelectCompany(string vatNumber)
|
||||||
{
|
{
|
||||||
|
_virkRegInfo = (from x in VInfos where x.VatNumber == vatNumber select x).First();
|
||||||
}
|
_companyDto.Name = _virkRegInfo.Name;
|
||||||
|
_companyDto.Address1 = _virkRegInfo.CoName;
|
||||||
|
_companyDto.Address2 = _virkRegInfo.Address;
|
||||||
|
_companyDto.ZipCode = _virkRegInfo.ZipCode;
|
||||||
|
_companyDto.City = _virkRegInfo.City;
|
||||||
|
_companyDto.VatNumber = _virkRegInfo.VatNumber;
|
||||||
|
}
|
||||||
|
|
||||||
private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
|
private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,48 +23,48 @@
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="h3 card-header"><RegStateVatNumber VatNumber="@CompanyDto.VatNumber"/>@CompanyDto.Name</div>
|
|
||||||
<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">Navn</th>
|
<th scope="row">Navn</th>
|
||||||
<td>@CompanyDto.Name</td>
|
<td colspan="2">@CompanyDto.Name</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">CO navn</th>
|
<th scope="row">CO navn</th>
|
||||||
<td>@CompanyDto.Address1</td>
|
<td colspan="2">@CompanyDto.Address1</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Adresse</th>
|
<th scope="row">Adresse</th>
|
||||||
<td>@CompanyDto.Address2</td>
|
<td colspan="2">@CompanyDto.Address2</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Postnummer</th>
|
<th scope="row">Postnummer</th>
|
||||||
<td>@CompanyDto.ZipCode</td>
|
<td colspan="2">@CompanyDto.ZipCode</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Postnummer</th>
|
<th scope="row">Postnummer</th>
|
||||||
<td>@CompanyDto.City</td>
|
<td colspan="2">@CompanyDto.City</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">CVR</th>
|
<th scope="row">CVR</th>
|
||||||
|
<td><RegStateVatNumber VatNumber="@CompanyDto.VatNumber"></RegStateVatNumber></td>
|
||||||
<td>@CompanyDto.VatNumber</td>
|
<td>@CompanyDto.VatNumber</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Telefon</th>
|
<th scope="row">Telefon</th>
|
||||||
<td>@CompanyDto.Phone</td>
|
<td colspan="2">@CompanyDto.Phone</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Email</th>
|
<th scope="row">Email</th>
|
||||||
<td>@CompanyDto.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>@CompanyDto.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><div class="state rounded-circle @(VisitState(CompanyDto.LastVisit))"></div></td>
|
||||||
<td>@CompanyDto.NextVisit</td>
|
<td>@CompanyDto.NextVisit</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -76,7 +76,6 @@
|
||||||
<a class="btn btn-primary" href="/companies">Tilbage</a>
|
<a class="btn btn-primary" href="/companies">Tilbage</a>
|
||||||
<a class="btn btn-primary" href="/company/@CompanyDto.Account/Activity">Aktivitet</a>
|
<a class="btn btn-primary" href="/company/@CompanyDto.Account/Activity">Aktivitet</a>
|
||||||
<a href="/company/@CompanyDto.Account/update" class="btn btn-primary">Rediger</a>
|
<a href="/company/@CompanyDto.Account/update" class="btn btn-primary">Rediger</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -24,17 +24,11 @@ namespace Wonky.Client.Pages;
|
||||||
|
|
||||||
public partial class CompanyView : IDisposable
|
public partial class CompanyView : IDisposable
|
||||||
{
|
{
|
||||||
private CompanyDto CompanyDto { get; set; } = new ();
|
[Inject] public ICompanyHttpRepository CompanyRepo { get; set; }
|
||||||
|
[Inject] public HttpInterceptorService Interceptor { get; set; }
|
||||||
[Inject]
|
|
||||||
public ICompanyHttpRepository CompanyRepo { get; set; }
|
|
||||||
|
|
||||||
[Inject]
|
|
||||||
public HttpInterceptorService Interceptor { 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 CompanyDto CompanyDto { get; set; } = new ();
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
@ -53,6 +47,14 @@ public partial class CompanyView : IDisposable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string VisitState(string nextVisit)
|
||||||
|
{
|
||||||
|
var theUgly = DateTime.Parse(nextVisit);
|
||||||
|
var theBad = theUgly.AddDays(-14);
|
||||||
|
if (DateTime.Now >= theUgly)
|
||||||
|
return "the-ugly";
|
||||||
|
return DateTime.Now >= theBad ? "the-bad" : "the-good";
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -7,7 +7,19 @@
|
||||||
height: 48px;
|
height: 48px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.state {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
}
|
||||||
|
.the-good {
|
||||||
|
background-color: green;
|
||||||
|
}
|
||||||
|
.the-bad {
|
||||||
|
background-color: yellow;
|
||||||
|
}
|
||||||
|
.the-ugly {
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
|
||||||
html, body {
|
html, body {
|
||||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||||
|
|
Loading…
Reference in a new issue