added - show closed companies
This commit is contained in:
parent
2c68d27c2f
commit
e41bbd32db
8 changed files with 38 additions and 25 deletions
|
@ -38,10 +38,16 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<div class="col-md-9">
|
<div class="col-3">
|
||||||
<PaginationComponent MetaData="_metaData" Spread="2" SelectedPage="SelectedPage" />
|
<div class="form-check">
|
||||||
|
<input type="checkbox" id="folded" class="form-check-input" checked="@_includeFolded" @onclick="OnFoldedClick" >
|
||||||
|
<label for="folded" class="form-check-label">Ophørte</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 justify-content-end">
|
<div class="col-6">
|
||||||
|
<PaginationComponent MetaData="_metaData" Spread="2" SelectedPage="SelectedPage"/>
|
||||||
|
</div>
|
||||||
|
<div class="col-3 justify-content-end">
|
||||||
<a class="btn btn-success text-nowrap" href="/companies/new">Opret kunde</a>
|
<a class="btn btn-success text-nowrap" href="/companies/new">Opret kunde</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -38,6 +38,7 @@ namespace Wonky.Client.Pages
|
||||||
private CompanyPagingParams _paging = new();
|
private CompanyPagingParams _paging = new();
|
||||||
private Preferences _preferences { get; set; } = new();
|
private Preferences _preferences { get; set; } = new();
|
||||||
private string _savedSearch { get; set; } = "";
|
private string _savedSearch { get; set; } = "";
|
||||||
|
private bool _includeFolded { get; set; }
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
@ -46,6 +47,7 @@ namespace Wonky.Client.Pages
|
||||||
_paging.OrderBy = _preferences.CompanySort;
|
_paging.OrderBy = _preferences.CompanySort;
|
||||||
_paging.SearchColumn = _preferences.CompanySearch;
|
_paging.SearchColumn = _preferences.CompanySearch;
|
||||||
_paging.PageSize = Convert.ToInt32(_preferences.PageSize);
|
_paging.PageSize = Convert.ToInt32(_preferences.PageSize);
|
||||||
|
_paging.HasFolded = _includeFolded ? 1 : 0;
|
||||||
|
|
||||||
// load saved search
|
// load saved search
|
||||||
_savedSearch = _preferences.CompanyFilterPhrase;
|
_savedSearch = _preferences.CompanyFilterPhrase;
|
||||||
|
@ -58,6 +60,14 @@ namespace Wonky.Client.Pages
|
||||||
await GetCompanies();
|
await GetCompanies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task OnFoldedClick()
|
||||||
|
{
|
||||||
|
_includeFolded = !_includeFolded;
|
||||||
|
_companyList = new List<CompanyDto>();
|
||||||
|
_paging.PageNumber = 1;
|
||||||
|
_paging.HasFolded = _includeFolded ? 1 : 0;
|
||||||
|
await GetCompanies();
|
||||||
|
}
|
||||||
private async Task SelectedPage(int page)
|
private async Task SelectedPage(int page)
|
||||||
{
|
{
|
||||||
_companyList = new List<CompanyDto>();
|
_companyList = new List<CompanyDto>();
|
||||||
|
|
|
@ -37,22 +37,22 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-8">
|
<div class="col-lg-8">
|
||||||
<div class="card-body py-5 px-md-5">
|
<div class="card-body py-5 px-md-5">
|
||||||
<EditForm Model="_userAuthenticationDto" OnValidSubmit="ExecuteLogin" class="form">
|
<EditForm Model="_credentialDto" OnValidSubmit="ExecuteLogin" class="form">
|
||||||
<DataAnnotationsValidator/>
|
<DataAnnotationsValidator/>
|
||||||
<div class="input-group mb-4">
|
<div class="input-group mb-4">
|
||||||
<span class="input-group-text" id="email-addon"><i class="oi oi-person"></i></span>
|
<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"
|
<InputText type="email" id="email" class="form-control" aria-described-by="email-addon"
|
||||||
placeholder="Email adresse"
|
placeholder="Email adresse"
|
||||||
@bind-Value="_userAuthenticationDto.Email" autocomplete="username"/>
|
@bind-Value="_credentialDto.Email" autocomplete="username"/>
|
||||||
<ValidationMessage For="@(() => _userAuthenticationDto.Email)"/>
|
<ValidationMessage For="@(() => _credentialDto.Email)"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-group mb-4">
|
<div class="input-group mb-4">
|
||||||
<span class="input-group-text" id="passwd-addon"><i class="oi oi-key"></i></span>
|
<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"
|
<InputText type="password" id="password" class="form-control" aria-described-by="passwd-addon"
|
||||||
placeholder="Adgangskode"
|
placeholder="Adgangskode"
|
||||||
@bind-Value="_userAuthenticationDto.Password" autocomplete="current-password"/>
|
@bind-Value="_credentialDto.Password" autocomplete="current-password"/>
|
||||||
<ValidationMessage For="@(() => _userAuthenticationDto.Password)"/>
|
<ValidationMessage For="@(() => _credentialDto.Password)"/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
|
|
|
@ -26,7 +26,7 @@ public partial class Login
|
||||||
[Inject] public IAuthenticationService AuthenticationService { get; set; }
|
[Inject] public IAuthenticationService AuthenticationService { get; set; }
|
||||||
[Inject] public ILogger<Login> Logger { get; set; }
|
[Inject] public ILogger<Login> Logger { get; set; }
|
||||||
[Parameter] public string ReturnUrl { get; set; }
|
[Parameter] public string ReturnUrl { get; set; }
|
||||||
private UserAuthenticationDto _userAuthenticationDto = new ();
|
private CredentialDto _credentialDto = 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;
|
||||||
|
@ -36,7 +36,7 @@ public partial class Login
|
||||||
ShowAuthError = false;
|
ShowAuthError = false;
|
||||||
execLogin = true;
|
execLogin = true;
|
||||||
|
|
||||||
var result = await AuthenticationService.Login(_userAuthenticationDto);
|
var result = await AuthenticationService.Login(_credentialDto);
|
||||||
if (!result.IsSuccess)
|
if (!result.IsSuccess)
|
||||||
{
|
{
|
||||||
Error = result.ErrorMessage;
|
Error = result.ErrorMessage;
|
||||||
|
|
|
@ -44,17 +44,17 @@ namespace Wonky.Client.Services
|
||||||
_apiConfig = apiConfig;
|
_apiConfig = apiConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<AuthResponseView> Login(UserAuthenticationDto userAuthenticationDtoUserAuth)
|
public async Task<AuthResponseView> Login(CredentialDto credentials)
|
||||||
{
|
{
|
||||||
var credentials = new Dictionary<string, string>
|
var credForm = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
["grant_type"] = "password",
|
["grant_type"] = "password",
|
||||||
["username"] = userAuthenticationDtoUserAuth.Email,
|
["username"] = credentials.Email,
|
||||||
["password"] = userAuthenticationDtoUserAuth.Password
|
["password"] = credentials.Password
|
||||||
};
|
};
|
||||||
|
|
||||||
var response = await _client
|
var response = await _client
|
||||||
.PostAsync(_apiConfig.Value.CrmAuth, new FormUrlEncodedContent(credentials));
|
.PostAsync(_apiConfig.Value.CrmAuth, new FormUrlEncodedContent(credForm));
|
||||||
|
|
||||||
var resContent = await response.Content.ReadAsStringAsync();
|
var resContent = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
@ -111,10 +111,7 @@ namespace Wonky.Client.Services
|
||||||
{
|
{
|
||||||
((AuthStateProvider)_authStateProvider).NotifyUserLogout();
|
((AuthStateProvider)_authStateProvider).NotifyUserLogout();
|
||||||
_client.DefaultRequestHeaders.Authorization = null;
|
_client.DefaultRequestHeaders.Authorization = null;
|
||||||
await _localStorage.RemoveItemAsync("_xa");
|
await _localStorage.ClearAsync();
|
||||||
await _localStorage.RemoveItemAsync("_xr");
|
|
||||||
await _localStorage.RemoveItemAsync("_xe");
|
|
||||||
await _localStorage.RemoveItemAsync("_xu");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UserInfoView> UserInfo(bool write = false)
|
public async Task<UserInfoView> UserInfo(bool write = false)
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Wonky.Client.Services
|
||||||
{
|
{
|
||||||
public interface IAuthenticationService
|
public interface IAuthenticationService
|
||||||
{
|
{
|
||||||
Task<AuthResponseView> Login(UserAuthenticationDto userAuthenticationDtoUserAuth);
|
Task<AuthResponseView> Login(CredentialDto credentials);
|
||||||
Task Logout();
|
Task Logout();
|
||||||
Task<string> RefreshToken();
|
Task<string> RefreshToken();
|
||||||
Task<UserInfoView> UserInfo(bool write = false);
|
Task<UserInfoView> UserInfo(bool write = false);
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
{
|
{
|
||||||
"appInfo": {
|
"appInfo": {
|
||||||
"name": "Wonky Client",
|
"name": "Wonky Client",
|
||||||
"version": "0.10.54",
|
"version": "0.10.61",
|
||||||
"rc": true,
|
"rc": false,
|
||||||
"sandBox": false,
|
"sandBox": true,
|
||||||
"image": "grumpy-coder.png"
|
"image": "grumpy-coder.png"
|
||||||
},
|
},
|
||||||
"apiConfig": {
|
"apiConfig": {
|
||||||
"innoBaseUrl": "https://app.innotec.dk",
|
"innoBaseUrl": "https://dev.innotec.dk",
|
||||||
"glsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=",
|
"glsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=",
|
||||||
"glsId": "",
|
"glsId": "",
|
||||||
"serviceVirk": "api/v2/services/virk",
|
"serviceVirk": "api/v2/services/virk",
|
||||||
|
|
|
@ -17,7 +17,7 @@ using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Wonky.Entity.DTO;
|
namespace Wonky.Entity.DTO;
|
||||||
|
|
||||||
public class UserAuthenticationDto
|
public class CredentialDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// User identification
|
/// User identification
|
Loading…
Reference in a new issue