small cosmetic issues

This commit is contained in:
Frede Hundewadt 2023-03-17 17:20:16 +01:00
parent efd7a8a330
commit defb654022
9 changed files with 135 additions and 29 deletions

View file

@ -13,13 +13,11 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
*@
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Helpers
@using System.Text.Json
@attribute [Authorize(Roles = "Admin")]
@page "/system/sms"
<div id="msg-box" style="display:@(MsgSent ? "none" : "block" )">
<div id="msg-box" style="display:@(MsgSent ? "none" : "block")">
<div class="row">
<div class="h3 col-sm-10">
Drift Meddelelse (SMS)
@ -55,11 +53,70 @@
</div>
<div id="msg-box" style="display:@(MsgSent ? "block" : "none")">
<div class="row">
<div class="col-sm-2">
Status Kode: @SmsResponse.Code
</div>
<div class="col-sm-10">
Meddelelse: @SmsResponse.Message
<div class="col-10">
<table class="table table-striped">
<tbody>
<tr>
<th scope="col">Status Kode</th>
<td>@SmsResponse.Code</td>
</tr>
<tr>
<th scope="col">Id</th>
<td>@ClxMsg.Id</td>
</tr>
<tr>
<th scope="col">Til</th>
<td>
<div class="row">
@if (ClxMsg.To.Any())
{
@foreach (var to in ClxMsg.To)
{
@($"{to},")
}
}
</div>
</td>
</tr>
<tr>
<th scope="col">Fra</th>
<td>@ClxMsg.From</td>
</tr>
<tr>
<th scope="col">Annulleret</th>
<td>@ClxMsg.Cancelled</td>
</tr>
<tr>
<th scope="col">Meddelelse</th>
<td>@ClxMsg.Body</td>
</tr>
<tr>
<th scope="col">Type</th>
<td>@ClxMsg.Type</td>
</tr>
<tr>
<th scope="col">Oprettet</th>
<td>@ClxMsg.CreatedAt</td>
</tr>
<tr>
<th scope="col">Ændret</th>
<td>@ClxMsg.ModifiedAt</td>
</tr>
<tr>
<th scope="col">Rapport</th>
<td>@ClxMsg.DeliveryReport</td>
</tr>
<tr>
<th scope="col">Udløber</th>
<td>@ClxMsg.ExpireAt</td>
</tr>
<tr>
<th scope="col">Flash</th>
<td>@ClxMsg.FlashMessage</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>

View file

@ -8,19 +8,20 @@ using Wonky.Entity.DTO;
using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class SystemMaintenanceMessage
#pragma warning disable CS8618
public partial class SystemMaintenanceMessagePage : IDisposable
{
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public ISystemUserRepository UserRepo { get; set; }
[Inject] public ISystemSendSmsService SmsService { get; set; }
[Inject] public ILogger<SystemMaintenanceMessage> Logger { get; set; }
[Inject] public ILogger<SystemMaintenanceMessagePage> Logger { get; set; }
[Inject] public IToastService Toaster { get; set; }
private List<UserManagerListView> Users { get; set; }
private List<UserManagerListView> Users { get; set; } = new();
private ShortMessage Message { get; set; } = new();
private List<Recipient> Recipients { get; set; } = new();
private ApiResponseView SmsResponse { get; set; } = new();
private ClxMessage? ClxMsg { get; set; } = new();
private bool Working { get; set; } = true;
private bool MsgSent { get; set; }
@ -70,16 +71,21 @@ public partial class SystemMaintenanceMessage
SmsResponse = await SmsService.SendSms(Message);
if (SmsResponse.Code == 201)
{
ClxMsg = JsonSerializer.Deserialize<ClxMessage>(SmsResponse.Message);
MsgSent = true;
}
Working = false;
}
}
public void Dispose()
{
Interceptor.DisposeEvent();
}
}
internal sealed class Recipient
{
public bool Enabled { get; set; }
public string Name { get; set; }
public string Mobile { get; set; }
public string Name { get; init; } = "";
public string Mobile { get; init; } = "";
}

View file

@ -114,7 +114,7 @@
</div>
<div class="alert alert-info">
<h4>Password politik</h4>
<p>Mindst 10 tegn bestående af store og små bogstaver samt tal. Du kan teste pasword og danne stærke password på <a href="https://pw.nix.dk">pw.nix.dk</a></p>
<p>Mindst 10 tegn bestående af store og små bogstaver samt tal. Password generator <a href="https://pw.nix.dk">pw.nix.dk</a></p>
</div>
<div class="row mb-3">
<label for="newPasswd" class="col-md-2 col-form-label">Ny</label>

View file

@ -25,7 +25,11 @@
</div>
<div class="col">
<div class="text-end">
<a class="btn btn-primary" href="/system/users/create"><i class="bi-plus-lg"></i>Opret bruger</a>
<div class="busy-signal" style="display:@(Working ? "block" : "none")">
<div class="spinner-grow text-info" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
</div>
</div>
</div>
@ -36,15 +40,19 @@
<div class="row">
<div class="col-sm-1">
</div>
<div class="col-sm-5">
<div class="col-sm-4">
<div class="h4">Navn</div>
</div>
<div class="col-sm-4">
<div class="col-sm-3">
<div class="h4">Email</div>
</div>
<div class="col-sm-2">
<div class="h4">Telefon</div>
</div>
<div class="col-sm-2 text-end">
<a class="btn btn-primary" href="/system/users/create"><i class="bi-plus-lg"></i>Opret bruger</a>
</div>
</div>
</div>
@ -57,15 +65,16 @@
<div class="col-sm-1">
@user.CountryCode @user.SalesRep
</div>
<div class="col-sm-5">
<div class="col-sm-4">
@user.FullName
</div>
<div class="col-sm-4">
<div class="col-sm-3">
@user.Email
</div>
<div class="col-sm-2">
@user.PhoneNumber
</div>
<div class="col-sm-2"></div>
</div>
</a>
}

View file

@ -28,12 +28,14 @@ public partial class SystemUserListPage : IDisposable
private List<UserManagerListView> UserList { get; set; } = new();
private bool Working { get; set; } = true;
protected override async Task OnInitializedAsync()
{
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
UserList = await UserRepo.GetUsers();
Working = false;
}
public void Dispose()

View file

@ -77,7 +77,9 @@ public class AuthenticationService : IAuthenticationService
// process response content
var data = JsonSerializer.Deserialize<AuthResponseView>(resContent, _options);
_logger.LogDebug("Login => {}", JsonSerializer.Serialize(data, _options));
await _infoService.SetAccessToken(data.AccessToken);
await _infoService.SetRefreshToken(data.RefreshToken);
await _infoService.SetExpiration((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds + data.ExpiresIn - 60);

View file

@ -1,15 +1,15 @@
{
"appInfo": {
"name": "Wonky Online",
"version": "0.120.0",
"version": "0.120.4",
"rc": true,
"sandBox": false,
"image": "grumpy-coder.png"
},
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Debug",
"Default": "Information",
"System": "Information",
"Microsoft": "Information"
},
"Debug": {
@ -19,7 +19,7 @@
}
},
"apiConfig": {
"baseUrl": "https://dev.innotec.dk",
"baseUrl": "https://zeta.innotec.dk",
"catalog": "api/v2/catalog/country",
"crmCustomers": "api/v2/crm/companies",
"crmInventoryExt": "history/inventory",

View file

@ -34,5 +34,5 @@ public class UserManagerEditView
[MaxLength(20, ErrorMessage = "Der er afsat 20 tegn til Sælger No.")] public string SalesRep { get; set; } = "";
public string UserId { get; set; } = "";
public List<UserRoleAssignment> AssignedRoles { get; set; } = new();
public List<SubjectAssignment> AssignedSubjects { get; set; } = new();
public List<SubjectAssignment> Subjects { get; set; } = new();
}

View file

@ -0,0 +1,30 @@
using System.Text.Json.Serialization;
namespace Wonky.Entity.Views;
public class ClxMessage
{
[JsonPropertyName("id")]
public string Id { get; set; } = "";
[JsonPropertyName("to")]
public List<string> To { get; set; } = new();
[JsonPropertyName("from")]
public string From { get; set; } = "";
[JsonPropertyName("cancelled")]
public bool Cancelled { get; set; }
[JsonPropertyName("body")]
public string Body { get; set; } = "";
[JsonPropertyName("type")]
public string Type { get; set; } = "";
[JsonPropertyName("created_at")]
public string CreatedAt { get; set; } = "";
[JsonPropertyName("modified_at")]
public string ModifiedAt { get; set; } = "";
[JsonPropertyName("delivery_report")]
public string DeliveryReport { get; set; } = "";
[JsonPropertyName("expire_at")]
public string ExpireAt { get; set; } = "";
[JsonPropertyName("flash_message")]
public bool FlashMessage { get; set; }
}