user listing - editing - role assignment - operational messages
This commit is contained in:
parent
02fb20ca8a
commit
efd7a8a330
18 changed files with 354 additions and 54 deletions
|
@ -88,6 +88,10 @@
|
||||||
<th scope="col">Lev.Postnr By</th>
|
<th scope="col">Lev.Postnr By</th>
|
||||||
<td>@ReportItem.DlvZipCity</td>
|
<td>@ReportItem.DlvZipCity</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Email</th>
|
||||||
|
<td colspan="3">@ReportItem.Company.Email</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<table class="table table-sm table-striped table-bordered">
|
<table class="table table-sm table-striped table-bordered">
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
using System.Net.Mail;
|
using System.Net.Mail;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using Wonky.Client.Models;
|
using Wonky.Client.Models;
|
||||||
|
|
||||||
namespace Wonky.Client.Helpers;
|
namespace Wonky.Client.Helpers;
|
||||||
|
@ -23,6 +24,29 @@ namespace Wonky.Client.Helpers;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class Utils
|
public static class Utils
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Sanitize string by removing everything but digits
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="digitString"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string StringToDigits(string digitString)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(digitString))
|
||||||
|
return "";
|
||||||
|
var regexObj = new Regex(@"[^\d]");
|
||||||
|
return regexObj.Replace(digitString, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validate string is only numbers
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="check"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private static bool IsDigitsOnly(string check)
|
||||||
|
{
|
||||||
|
return check.All(c => c is >= '0' and <= '9');
|
||||||
|
}
|
||||||
|
|
||||||
public static bool Validate(ValidateType validateType, string toValidate)
|
public static bool Validate(ValidateType validateType, string toValidate)
|
||||||
{
|
{
|
||||||
return validateType switch
|
return validateType switch
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class VatUtils
|
||||||
if (string.IsNullOrWhiteSpace(vatNumber) || string.IsNullOrWhiteSpace(countryCode))
|
if (string.IsNullOrWhiteSpace(vatNumber) || string.IsNullOrWhiteSpace(countryCode))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var sanitisedVat = SanitizeVatNumber(vatNumber);
|
var sanitisedVat = Utils.StringToDigits(vatNumber);
|
||||||
|
|
||||||
return countryCode.ToUpperInvariant() switch
|
return countryCode.ToUpperInvariant() switch
|
||||||
{
|
{
|
||||||
|
@ -42,30 +42,7 @@ public class VatUtils
|
||||||
_ => false
|
_ => false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sanitize Vat remove everything but digits
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="vatNumber"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string SanitizeVatNumber(string vatNumber)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(vatNumber))
|
|
||||||
return "";
|
|
||||||
var regexObj = new Regex(@"[^\d]");
|
|
||||||
return regexObj.Replace(vatNumber, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Validate string is only numbers
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="check"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static bool IsDigitsOnly(string check)
|
|
||||||
{
|
|
||||||
return check.All(c => c is >= '0' and <= '9');
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Validate Danish Vat number format
|
/// Validate Danish Vat number format
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
33
Wonky.Client/HttpRepository/ISystemSendSmsService.cs
Normal file
33
Wonky.Client/HttpRepository/ISystemSendSmsService.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
// 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.Entity.DTO;
|
||||||
|
using Wonky.Entity.Views;
|
||||||
|
|
||||||
|
namespace Wonky.Client.HttpRepository;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for sending emai
|
||||||
|
/// </summary>
|
||||||
|
public interface ISystemSendSmsService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Send Mail
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="messageType"></param>
|
||||||
|
/// <param name="message"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<ApiResponseView> SendSms(ShortMessage message);
|
||||||
|
}
|
66
Wonky.Client/HttpRepository/SystemSendSmsService.cs
Normal file
66
Wonky.Client/HttpRepository/SystemSendSmsService.cs
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
// Copyright (C) 2022 FCS Frede's Computer Services.
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
||||||
|
//
|
||||||
|
|
||||||
|
using System.Net.Http.Json;
|
||||||
|
using System.Text.Json;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Wonky.Entity.Configuration;
|
||||||
|
using Wonky.Entity.DTO;
|
||||||
|
using Wonky.Entity.Views;
|
||||||
|
|
||||||
|
namespace Wonky.Client.HttpRepository;
|
||||||
|
|
||||||
|
public class SystemSendSmsService : ISystemSendSmsService
|
||||||
|
{
|
||||||
|
private readonly JsonSerializerOptions? _options = new JsonSerializerOptions
|
||||||
|
{
|
||||||
|
PropertyNameCaseInsensitive = true
|
||||||
|
};
|
||||||
|
|
||||||
|
private readonly NavigationManager _navigation;
|
||||||
|
private ILogger<SystemSendSmsService> _logger;
|
||||||
|
private readonly HttpClient _client;
|
||||||
|
private readonly ApiConfig _api;
|
||||||
|
|
||||||
|
public SystemSendSmsService(HttpClient client, ILogger<SystemSendSmsService> logger,
|
||||||
|
NavigationManager navigation, IOptions<ApiConfig> configuration)
|
||||||
|
{
|
||||||
|
_client = client;
|
||||||
|
_logger = logger;
|
||||||
|
_navigation = navigation;
|
||||||
|
_api = configuration.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Send Mail
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<ApiResponseView> SendSms(ShortMessage message)
|
||||||
|
{
|
||||||
|
var response = await _client.PostAsJsonAsync($"{_api.ServicesSms}", message, _options);
|
||||||
|
if (!response.IsSuccessStatusCode)
|
||||||
|
return new ApiResponseView
|
||||||
|
{
|
||||||
|
Code = (int)response.StatusCode,
|
||||||
|
Message = $"{response.ReasonPhrase}: {await response.Content.ReadAsStringAsync()}",
|
||||||
|
IsSuccess = false,
|
||||||
|
Id = ""
|
||||||
|
};
|
||||||
|
var content = await response.Content.ReadAsStringAsync();
|
||||||
|
return JsonSerializer.Deserialize<ApiResponseView>(content, _options);
|
||||||
|
}
|
||||||
|
}
|
|
@ -63,12 +63,12 @@
|
||||||
|
|
||||||
<label for="officeNote" class="col-form-label-sm col-sm-1">Ordre Note</label>
|
<label for="officeNote" class="col-form-label-sm col-sm-1">Ordre Note</label>
|
||||||
<div class="col-sm-5">
|
<div class="col-sm-5">
|
||||||
<textarea id="officeNote" class="form-control" value="@ReportItem.OfficeNote" readonly=""/>
|
<textarea id="officeNote" class="form-control" value="@ReportItem.OfficeNote" readonly/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label for="crmNote" class="col-form-label-sm col-sm-1">Crm Note</label>
|
<label for="crmNote" class="col-form-label-sm col-sm-1">Crm Note</label>
|
||||||
<div class="col-sm-5">
|
<div class="col-sm-5">
|
||||||
<textarea id="crmNote" class="form-control" value="@ReportItem.CrmNote" readonly=""/>
|
<textarea id="crmNote" class="form-control" value="@ReportItem.CrmNote" readonly/>
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
|
|
|
@ -257,7 +257,7 @@ public partial class AdvisorActivityCreatePage : IDisposable
|
||||||
if (OrgWarning)
|
if (OrgWarning)
|
||||||
return;
|
return;
|
||||||
OrgWarning = true;
|
OrgWarning = true;
|
||||||
if (Company.CountryCode.ToLower() == "se" && VatUtils.SanitizeVatNumber(Activity.VatNumber).Length < 10 &&
|
if (Company.CountryCode.ToLower() == "se" && Utils.StringToDigits(Activity.VatNumber).Length < 10 &&
|
||||||
Activity.ActivityStatusEnum == "order")
|
Activity.ActivityStatusEnum == "order")
|
||||||
{
|
{
|
||||||
Toaster.ShowWarning("Org nummer er ufuldstændig. Skal opdateres før bestilling kan sendes. ", "ADVARSEL");
|
Toaster.ShowWarning("Org nummer er ufuldstændig. Skal opdateres før bestilling kan sendes. ", "ADVARSEL");
|
||||||
|
@ -573,7 +573,7 @@ public partial class AdvisorActivityCreatePage : IDisposable
|
||||||
|
|
||||||
if (Activity.ActivityStatusEnum.ToLower() is "order" or "quote"
|
if (Activity.ActivityStatusEnum.ToLower() is "order" or "quote"
|
||||||
&& Company.CountryCode.ToLower() == "se"
|
&& Company.CountryCode.ToLower() == "se"
|
||||||
&& VatUtils.SanitizeVatNumber(Activity.VatNumber).Length < 10)
|
&& Utils.StringToDigits(Activity.VatNumber).Length < 10)
|
||||||
{
|
{
|
||||||
ShowOrgWarning();
|
ShowOrgWarning();
|
||||||
PoFormInvalid = true;
|
PoFormInvalid = true;
|
||||||
|
|
|
@ -101,6 +101,10 @@
|
||||||
<th scope="col">Lev.Postnr By</th>
|
<th scope="col">Lev.Postnr By</th>
|
||||||
<td>@ReportItem.DlvZipCity</td>
|
<td>@ReportItem.DlvZipCity</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Email</th>
|
||||||
|
<td colspan="3">@ReportItem.Company.Email</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<table class="table table-sm table-striped table-bordered">
|
<table class="table table-sm table-striped table-bordered">
|
||||||
|
|
65
Wonky.Client/Pages/SystemMaintenanceMessage.razor
Normal file
65
Wonky.Client/Pages/SystemMaintenanceMessage.razor
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
@* Copyright (C) 2022 FCS Frede's Computer Services.
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
|
||||||
|
*@
|
||||||
|
@using Microsoft.AspNetCore.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 class="row">
|
||||||
|
<div class="h3 col-sm-10">
|
||||||
|
Drift Meddelelse (SMS)
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-2 text-end">
|
||||||
|
<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 class="row mb-5">
|
||||||
|
<div class="col-sm-12 d-grid mx-auto">
|
||||||
|
<textarea id="message" cols="50" rows="5" @bind-Value:event="oninput" @bind-Value="Message.Body"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row ms-2">
|
||||||
|
@foreach (var recipient in Recipients)
|
||||||
|
{
|
||||||
|
<div class="form-check col-sm-2">
|
||||||
|
<input type="checkbox" id="@recipient.Mobile" class="form-check-input" @bind-Value:event="onchange" @bind-Value="recipient.Enabled"/>
|
||||||
|
<label class="form-check-label" for="@recipient.Mobile">@recipient.Name</label>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 text-end">
|
||||||
|
<button class="btn btn-primary" type="button" @onclick="SendMessage">Send besked</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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>
|
||||||
|
</div>
|
||||||
|
</div>
|
85
Wonky.Client/Pages/SystemMaintenanceMessage.razor.cs
Normal file
85
Wonky.Client/Pages/SystemMaintenanceMessage.razor.cs
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
using System.Text.Json;
|
||||||
|
using Blazored.Toast.Services;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Wonky.Client.Helpers;
|
||||||
|
using Wonky.Client.HttpInterceptors;
|
||||||
|
using Wonky.Client.HttpRepository;
|
||||||
|
using Wonky.Entity.DTO;
|
||||||
|
using Wonky.Entity.Views;
|
||||||
|
|
||||||
|
namespace Wonky.Client.Pages;
|
||||||
|
|
||||||
|
public partial class SystemMaintenanceMessage
|
||||||
|
{
|
||||||
|
[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 IToastService Toaster { get; set; }
|
||||||
|
|
||||||
|
private List<UserManagerListView> Users { get; set; }
|
||||||
|
private ShortMessage Message { get; set; } = new();
|
||||||
|
private List<Recipient> Recipients { get; set; } = new();
|
||||||
|
private ApiResponseView SmsResponse { get; set; } = new();
|
||||||
|
private bool Working { get; set; } = true;
|
||||||
|
private bool MsgSent { get; set; }
|
||||||
|
|
||||||
|
private readonly JsonSerializerOptions _options = new JsonSerializerOptions
|
||||||
|
{
|
||||||
|
PropertyNameCaseInsensitive = true
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
Interceptor.RegisterEvent();
|
||||||
|
Interceptor.RegisterBeforeSendEvent();
|
||||||
|
|
||||||
|
Users = await UserRepo.GetUsers();
|
||||||
|
|
||||||
|
var allRecipients = Users.Where(x => Utils.StringToDigits(x.PhoneNumber) != string.Empty)
|
||||||
|
.Select(x => new Recipient
|
||||||
|
{
|
||||||
|
Mobile = Utils.StringToDigits(x.PhoneNumber),
|
||||||
|
Name = x.FullName
|
||||||
|
}).ToList();
|
||||||
|
Recipients = (from r in allRecipients select r).DistinctBy(x => x.Mobile).ToList();
|
||||||
|
|
||||||
|
Working = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SendMessage()
|
||||||
|
{
|
||||||
|
Working = true;
|
||||||
|
var recipients = (from recipient in Recipients where recipient.Enabled select recipient.Mobile).ToList();
|
||||||
|
if (!recipients.Any())
|
||||||
|
{
|
||||||
|
Toaster.ShowError("Der er ingen modtagere valgt!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(Message.Body))
|
||||||
|
{
|
||||||
|
Toaster.ShowError("Meddelelsesfeltet er tomt!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Message.From = "Innotec IT";
|
||||||
|
Message.To = string.Join(",", recipients);
|
||||||
|
|
||||||
|
Logger.LogDebug("{}", JsonSerializer.Serialize(Message, _options));
|
||||||
|
|
||||||
|
SmsResponse = await SmsService.SendSms(Message);
|
||||||
|
if (SmsResponse.Code == 201)
|
||||||
|
{
|
||||||
|
MsgSent = true;
|
||||||
|
}
|
||||||
|
Working = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal sealed class Recipient
|
||||||
|
{
|
||||||
|
public bool Enabled { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Mobile { get; set; }
|
||||||
|
}
|
|
@ -15,7 +15,10 @@
|
||||||
|
|
||||||
|
|
||||||
@using Microsoft.AspNetCore.Authorization
|
@using Microsoft.AspNetCore.Authorization
|
||||||
|
@using Microsoft.AspNetCore.Authorization.Infrastructure
|
||||||
@using Wonky.Client.Components
|
@using Wonky.Client.Components
|
||||||
|
@using System.Security.Principal
|
||||||
|
@using Wonky.Client.Models
|
||||||
@attribute [Authorize(Roles = "Admin")]
|
@attribute [Authorize(Roles = "Admin")]
|
||||||
@page "/system/users/{UserId}"
|
@page "/system/users/{UserId}"
|
||||||
|
|
||||||
|
@ -27,7 +30,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@if (!string.IsNullOrWhiteSpace(UserInfo.UserId))
|
@if (!string.IsNullOrWhiteSpace(UserData.UserId))
|
||||||
{
|
{
|
||||||
<EditForm EditContext="UserEditContext" OnValidSubmit="UpdateUser">
|
<EditForm EditContext="UserEditContext" OnValidSubmit="UpdateUser">
|
||||||
<DataAnnotationsValidator/>
|
<DataAnnotationsValidator/>
|
||||||
|
@ -40,15 +43,15 @@
|
||||||
Fornavn
|
Fornavn
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<InputText id="firstName" class="form-control" @bind-Value="UserInfo.FirstName" readonly="@ReadOnly" />
|
<InputText id="firstName" class="form-control" @bind-Value="UserData.FirstName" readonly="@ReadOnly" />
|
||||||
<ValidationMessage For="@(() => UserInfo.FirstName)"></ValidationMessage>
|
<ValidationMessage For="@(() => UserData.FirstName)"></ValidationMessage>
|
||||||
</td>
|
</td>
|
||||||
<th scope="col">
|
<th scope="col">
|
||||||
Efternavn
|
Efternavn
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<InputText id="lastName" class="form-control" @bind-Value="UserInfo.LastName" readonly="@ReadOnly" />
|
<InputText id="lastName" class="form-control" @bind-Value="UserData.LastName" readonly="@ReadOnly" />
|
||||||
<ValidationMessage For="@(() => UserInfo.LastName)"></ValidationMessage>
|
<ValidationMessage For="@(() => UserData.LastName)"></ValidationMessage>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="align-middle">
|
<tr class="align-middle">
|
||||||
|
@ -56,15 +59,15 @@
|
||||||
Email
|
Email
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<InputText id="email" class="form-control" @bind-Value="UserInfo.Email" readonly="@ReadOnly" />
|
<InputText id="email" class="form-control" @bind-Value="UserData.Email" readonly="@ReadOnly" />
|
||||||
<ValidationMessage For="@(() => UserInfo.Email)"></ValidationMessage>
|
<ValidationMessage For="@(() => UserData.Email)"></ValidationMessage>
|
||||||
</td>
|
</td>
|
||||||
<th scope="col">
|
<th scope="col">
|
||||||
Mobilnummer
|
Mobilnummer
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<InputText id="phoneNumber" class="form-control" @bind-Value="UserInfo.PhoneNumber" readonly="@ReadOnly" />
|
<InputText id="phoneNumber" class="form-control" @bind-Value="UserData.PhoneNumber" readonly="@ReadOnly" />
|
||||||
<ValidationMessage For="@(() => UserInfo.PhoneNumber)"></ValidationMessage>
|
<ValidationMessage For="@(() => UserData.PhoneNumber)"></ValidationMessage>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="align-middle">
|
<tr class="align-middle">
|
||||||
|
@ -72,24 +75,41 @@
|
||||||
Sælgernr.
|
Sælgernr.
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<InputText id="salesRep" class="form-control" @bind-Value="UserInfo.SalesRep" readonly="@ReadOnly" />
|
<InputText id="salesRep" class="form-control" @bind-Value="UserData.SalesRep" readonly="@ReadOnly" />
|
||||||
<ValidationMessage For="@(() => UserInfo.SalesRep)"></ValidationMessage>
|
<ValidationMessage For="@(() => UserData.SalesRep)"></ValidationMessage>
|
||||||
</td>
|
</td>
|
||||||
<th scope="col">
|
<th scope="col">
|
||||||
Landekode
|
Landekode
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<InputText id="countryCode" class="form-control" @bind-Value="UserInfo.CountryCode" readonly="@ReadOnly" />
|
<InputText id="countryCode" class="form-control" @bind-Value="UserData.CountryCode" readonly="@ReadOnly" />
|
||||||
<ValidationMessage For="@(() => UserInfo.CountryCode)"></ValidationMessage>
|
<ValidationMessage For="@(() => UserData.CountryCode)"></ValidationMessage>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="align-middle">
|
<tr class="align-middle">
|
||||||
<th scope="col">
|
<th scope="col">
|
||||||
Spærret
|
Spærret
|
||||||
</th>
|
</th>
|
||||||
<td colspan="3">
|
<td>
|
||||||
<InputCheckbox id="lockoutEnabled" class="form-check" @bind-Value="UserInfo.LockoutEnabled"/>
|
<InputCheckbox id="lockoutEnabled" class="form-check" @bind-Value="UserData.LockoutEnabled" disabled="@ReadOnly"/>
|
||||||
<ValidationMessage For="@(() => UserInfo.LockoutEnabled)"></ValidationMessage>
|
<ValidationMessage For="@(() => UserData.LockoutEnabled)"></ValidationMessage>
|
||||||
|
</td>
|
||||||
|
<th scope="col">Beskrivelse</th>
|
||||||
|
<td>
|
||||||
|
<InputText id="description" class="form-control" @bind-Value="@UserData.Description" readonly="@ReadOnly"/>
|
||||||
|
<ValidationMessage For="@(() => UserData.Description)"></ValidationMessage>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Roller</th>
|
||||||
|
<td>
|
||||||
|
@foreach (var role in UserData.AssignedRoles)
|
||||||
|
{
|
||||||
|
<div class="form-check">
|
||||||
|
<InputCheckbox id="@(role.Name)" class="form-check-input" @bind-Value="role.Assigned" disabled="@ReadOnly" />
|
||||||
|
<label class="form-check-label">@role.Name</label>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -111,10 +131,9 @@
|
||||||
<EditForm EditContext="PasswdContext" class="mt-5" >
|
<EditForm EditContext="PasswdContext" class="mt-5" >
|
||||||
<DataAnnotationsValidator />
|
<DataAnnotationsValidator />
|
||||||
<h3>NULSTIL ADGANGSKODE</h3>
|
<h3>NULSTIL ADGANGSKODE</h3>
|
||||||
<div class="alert-info">
|
<div class="alert alert-info">
|
||||||
<h4>Password politik</h4>
|
<div class="h4">Password politik</div>
|
||||||
<p>Mindst 10 tegn bestående af store og små bogstaver samt tal.</p>
|
<div>Mindst 10 tegn bestående af store og små bogstaver samt tal. Kodeordsgenerator <a href="https://pw.nix.dk">pw.nix.dk</a></div>
|
||||||
<p>Du kan teste pasword og danne stærke password på <a href="https://pw.nix.dk">pw.nix.dk</a></p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label for="newPasswd" class="col-md-2 col-form-label">Ny</label>
|
<label for="newPasswd" class="col-md-2 col-form-label">Ny</label>
|
||||||
|
@ -132,7 +151,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col align-content-end">
|
<div class="col align-content-end">
|
||||||
<button class="btn btn-warning" @onclick="SetPassword" disabled="@PwInvalid">NULSTIL</button>
|
<button class="btn btn-danger" @onclick="SetPassword" disabled="@PwInvalid">NULSTIL</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</EditForm>
|
</EditForm>
|
||||||
|
|
|
@ -35,7 +35,7 @@ public partial class SystemUserViewEditPage : IDisposable
|
||||||
[Inject] public ISystemUserRepository UserRepo { get; set; }
|
[Inject] public ISystemUserRepository UserRepo { get; set; }
|
||||||
[Inject] public ILogger<SystemUserViewEditPage> Logger { get; set; }
|
[Inject] public ILogger<SystemUserViewEditPage> Logger { get; set; }
|
||||||
[Inject] public IToastService Toaster { get; set; }
|
[Inject] public IToastService Toaster { get; set; }
|
||||||
private UserManagerEditView UserInfo { get; set; } = new();
|
private UserManagerEditView UserData { get; set; } = new();
|
||||||
private EditContext UserEditContext { get; set; }
|
private EditContext UserEditContext { get; set; }
|
||||||
private ResetPasswordDto Passwords { get; set; } = new();
|
private ResetPasswordDto Passwords { get; set; } = new();
|
||||||
private EditContext PasswdContext { get; set; }
|
private EditContext PasswdContext { get; set; }
|
||||||
|
@ -53,9 +53,9 @@ public partial class SystemUserViewEditPage : IDisposable
|
||||||
Interceptor.RegisterEvent();
|
Interceptor.RegisterEvent();
|
||||||
Interceptor.RegisterBeforeSendEvent();
|
Interceptor.RegisterBeforeSendEvent();
|
||||||
|
|
||||||
UserInfo = await UserRepo.GetUserInfo(UserId);
|
UserData = await UserRepo.GetUserInfo(UserId);
|
||||||
|
|
||||||
UserEditContext = new EditContext(UserInfo);
|
UserEditContext = new EditContext(UserData);
|
||||||
PasswdContext = new EditContext(Passwords);
|
PasswdContext = new EditContext(Passwords);
|
||||||
|
|
||||||
PasswdContext.OnFieldChanged += PwHandleFieldChanged!;
|
PasswdContext.OnFieldChanged += PwHandleFieldChanged!;
|
||||||
|
@ -68,7 +68,7 @@ public partial class SystemUserViewEditPage : IDisposable
|
||||||
ReadOnly = true;
|
ReadOnly = true;
|
||||||
Working = true;
|
Working = true;
|
||||||
Toaster.ShowInfo("Sender data til server ...");
|
Toaster.ShowInfo("Sender data til server ...");
|
||||||
await UserRepo.UpdateUserInfo(UserId, UserInfo);
|
await UserRepo.UpdateUserInfo(UserId, UserData);
|
||||||
Working = false;
|
Working = false;
|
||||||
Toaster.ShowInfo("Bruger er opdateret ...");
|
Toaster.ShowInfo("Bruger er opdateret ...");
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ builder.Services.AddScoped<ISystemUserRepository, SystemUserRepository>();
|
||||||
builder.Services.AddScoped<IOrderProcessRepository, OrderProcessRepository>();
|
builder.Services.AddScoped<IOrderProcessRepository, OrderProcessRepository>();
|
||||||
// mail service
|
// mail service
|
||||||
builder.Services.AddScoped<ISystemSendMailService, SystemSendMailService>();
|
builder.Services.AddScoped<ISystemSendMailService, SystemSendMailService>();
|
||||||
|
builder.Services.AddScoped<ISystemSendSmsService, SystemSendSmsService>();
|
||||||
// interceptor
|
// interceptor
|
||||||
builder.Services.AddScoped<HttpInterceptorService>();
|
builder.Services.AddScoped<HttpInterceptorService>();
|
||||||
// storage
|
// storage
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
"servicesGlsId": "",
|
"servicesGlsId": "",
|
||||||
"servicesGlsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=",
|
"servicesGlsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=",
|
||||||
"servicesMail": "api/v2/services/sendmail",
|
"servicesMail": "api/v2/services/sendmail",
|
||||||
|
"servicesSms": "api/v2/services/sms",
|
||||||
"servicesVatDk": "api/v2/services/virk",
|
"servicesVatDk": "api/v2/services/virk",
|
||||||
"serviceVatEu": "api/v2/services/vies",
|
"serviceVatEu": "api/v2/services/vies",
|
||||||
"servicesVatNo": "api/v2/services/brReg",
|
"servicesVatNo": "api/v2/services/brReg",
|
||||||
|
|
|
@ -108,6 +108,10 @@ public class ApiConfig
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ServicesMail { get; set; } = "";
|
public string ServicesMail { get; set; } = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// url for sending Short Message
|
||||||
|
/// </summary>
|
||||||
|
public string ServicesSms { get; set; } = "";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// VAT registrar url Denmark
|
/// VAT registrar url Denmark
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
12
Wonky.Entity/DTO/ShortMessage.cs
Normal file
12
Wonky.Entity/DTO/ShortMessage.cs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Wonky.Entity.DTO;
|
||||||
|
|
||||||
|
public class ShortMessage
|
||||||
|
{
|
||||||
|
[Required] [MaxLength(11)] public string From { get; set; } = "";
|
||||||
|
|
||||||
|
[Required] [MaxLength(1000)] public string To { get; set; } = "";
|
||||||
|
|
||||||
|
[Required] [MaxLength(100)] public string Body { get; set; } = "";
|
||||||
|
}
|
|
@ -31,7 +31,7 @@ public class UserManagerEditView
|
||||||
public bool LockoutEnabled { get; set; }
|
public bool LockoutEnabled { get; set; }
|
||||||
public string Passwd { get; set; } = "";
|
public string Passwd { get; set; } = "";
|
||||||
[Required(ErrorMessage = "Telefon nummer skal udfyldes")][MaxLength(20, ErrorMessage = "Der er afsat 20 tegn til telefon nummber")] public string PhoneNumber { get; set; } = "";
|
[Required(ErrorMessage = "Telefon nummer skal udfyldes")][MaxLength(20, ErrorMessage = "Der er afsat 20 tegn til telefon nummber")] public string PhoneNumber { get; set; } = "";
|
||||||
[Required(ErrorMessage = "Medarbejder ID skal udfyldes")][MaxLength(20, ErrorMessage = "Der er afsat 20 tegn til medarbejder ID")] public string SalesRep { get; set; } = "";
|
[MaxLength(20, ErrorMessage = "Der er afsat 20 tegn til Sælger No.")] public string SalesRep { get; set; } = "";
|
||||||
public string UserId { get; set; } = "";
|
public string UserId { get; set; } = "";
|
||||||
public List<UserRoleAssignment> AssignedRoles { get; set; } = new();
|
public List<UserRoleAssignment> AssignedRoles { get; set; } = new();
|
||||||
public List<SubjectAssignment> AssignedSubjects { get; set; } = new();
|
public List<SubjectAssignment> AssignedSubjects { get; set; } = new();
|
||||||
|
|
|
@ -54,4 +54,9 @@ public class ReportItemCustomer
|
||||||
/// Company address address line 2
|
/// Company address address line 2
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Address2 { get; set; } = "";
|
public string Address2 { get; set; } = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Company email address
|
||||||
|
/// </summary>
|
||||||
|
public string Email { get; set; } = "";
|
||||||
}
|
}
|
Loading…
Reference in a new issue