This commit is contained in:
Frede Hundewadt 2022-07-13 12:54:54 +02:00
parent bd4a7ac080
commit e63b04ec22
9 changed files with 40 additions and 31 deletions

View file

@ -27,14 +27,14 @@ else
<div class="badge text-bg-info mx-3">app version @_app?.Version</div> <div class="badge text-bg-info mx-3">app version @_app?.Version</div>
} }
@if (_app!.IsBeta) @if (_app!.Rc)
{ {
<div class="badge text-bg-warning mx-3">Beta version</div> <div class="badge text-bg-warning mx-3">release candidate</div>
} }
@if (_app!.SandBox) @if (_app!.Sandbox)
{ {
<div class="badge text-bg-danger mx-3">Sandkasse</div> <div class="badge text-bg-danger mx-3">sandbox</div>
} }
@code @code
{ {

View file

@ -50,14 +50,17 @@
</button> </button>
</td> </td>
<td class="align-middle"> <td class="align-middle">
<button type="button" class="btn btn-light border-dark position-relative" @onclick="() => TaskCompleted(task.TaskItemId)"> <button type="button" class="btn btn-light border-dark" @onclick="() => TaskCompleted(task.TaskItemId)">
Færdiggør Check <i class="oi oi-check"></i>
</button> </button>
</td> </td>
<td class="align-middle"> <td class="align-middle">
@if (task.TaskTypeEnum is "Recall" or "Revision") @if (task.TaskTypeEnum is "Recall")
{ {
<button type="button" class="btn btn-primary position-relative" @onclick="() => CompleteTask(task.TaskItemId)"> <a class="btn btn-light border-dark pe-3" href="/companies/@task.ReferenceId">
Ændre
</a>
<button type="button" class="btn btn-primary" @onclick="() => CompleteTask(task.TaskItemId)">
Besøg Besøg
</button> </button>
} }

View file

@ -108,11 +108,11 @@ public partial class ActivityNewVisitPage : IDisposable
_ux = await _storage.GetItemAsync<UserInfoView>("_xu"); _ux = await _storage.GetItemAsync<UserInfoView>("_xu");
_company = await _companyRepo.GetCompanyById(CompanyId); _company = await _companyRepo.GetCompanyById(CompanyId);
// variable to validate if customer needs update // variable to validate if customer needs phone number update
_phone = _company.Phone; _phone = _company.Phone;
if (string.IsNullOrWhiteSpace(_company.Phone) if (string.IsNullOrWhiteSpace(_company.Phone)
&& !string.IsNullOrWhiteSpace(_company.Account) && !string.IsNullOrWhiteSpace(_company.Account)
&& _company.Account != "NY") && _company.Account != "NY" && _company.Account.Length > 7)
{ {
_company.Phone = _company.Account[..8]; _company.Phone = _company.Account[..8];
} }
@ -170,7 +170,7 @@ public partial class ActivityNewVisitPage : IDisposable
if (_draft.ActivityStatusEnum == "order" && string.IsNullOrWhiteSpace(_draft.Phone)) if (_draft.ActivityStatusEnum == "order" && string.IsNullOrWhiteSpace(_draft.Phone))
{ {
_toast.ShowError("Ved nye bestillinger skal en kundes telefon nummer angives."); _toast.ShowError("Ved bestilling til ny kunde skal telefon nummer angives.");
return; return;
} }

View file

@ -106,7 +106,7 @@
<InputDate id="lastVisit" class="form-control" @bind-Value="@_lastVisit"/> <InputDate id="lastVisit" class="form-control" @bind-Value="@_lastVisit"/>
</td> </td>
<td> <td>
<InputDate id="nextVisit" class="form-control" @bind-Value="@(_nextVisit)"/> <InputDate id="nextVisit" class="form-control" @bind-Value="@(_nextVisit)" readonly />
</td> </td>
<td> <td>
<InputNumber id="interval" class="form-control" @bind-Value="_companyObject.Interval"/> <InputNumber id="interval" class="form-control" @bind-Value="_companyObject.Interval"/>

View file

@ -123,6 +123,9 @@ namespace Wonky.Client.Pages
} }
private async Task SubmitCompanyForm() private async Task SubmitCompanyForm()
{ {
_companyObject.LastVisit = $"{_lastVisit:yyyy-MM-dd}";
_companyObject.NextVisit = $"{_nextVisit:yyyy-MM-dd}";
var newId = await _companyRepo.CreateCompany(_companyObject); var newId = await _companyRepo.CreateCompany(_companyObject);
if (!string.IsNullOrWhiteSpace(newId)) if (!string.IsNullOrWhiteSpace(newId))
@ -138,9 +141,8 @@ namespace Wonky.Client.Pages
private void HandleFieldChanged(object sender, FieldChangedEventArgs e) private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
{ {
_companyObject.LastVisit = $"{_lastVisit:yyyy-MM-dd}"; _nextVisit = _lastVisit.AddDays(7 * _companyObject.Interval);
_companyObject.NextVisit = $"{_nextVisit:yyyy-MM-dd}";
if (!_companyObject.ValidDateSpan()) if (!_companyObject.ValidDateSpan())
{ {
_toast.ShowError("Dato for næste besøg skal ligge efter sidste besøg."); _toast.ShowError("Dato for næste besøg skal ligge efter sidste besøg.");

View file

@ -163,8 +163,7 @@
</DisplayStateComponent> </DisplayStateComponent>
</td> </td>
<td> <td>
<InputDate id="nextVisit" class="form-control" @bind-Value="@(_nextVisit)" /> <InputDate id="nextVisit" class="form-control" @bind-Value="@(_nextVisit)" readonly />
<ValidationMessage For="@(() => _company.NextVisit)">Dato kan ikke vær før sidste besøg</ValidationMessage>
</td> </td>
<th> <th>
Besøgt Besøgt
@ -186,7 +185,8 @@
Historik Historik
</th> </th>
<td> <td>
<button class="btn btn-warning" type="button" @onclick="@RefreshHistory">@_company.HistorySync</button> <label>@_company.HistorySync</label>
<button class="ms-2 btn btn-light border-dark" type="button" @onclick="@RefreshHistory" disabled="@_working">@_btnUpdateText</button>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -195,16 +195,16 @@
<div class="card-footer"> <div class="card-footer">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<button type="submit" class="btn btn-warning">Gem</button> <button type="submit" class="btn btn-light border-dark">Gem</button>
</div> </div>
<div class="col"> <div class="col">
<a class="btn btn-primary" href="/companies">Til Oversigt</a> <a class="btn btn-light border-dark" href="/companies">Til Oversigt</a>
</div> </div>
<div class="col"> <div class="col">
<a class="btn btn-info" href="/companies/@_company.CompanyId/h/i">Produktkøb</a> <a class="btn btn-light border-dark" href="/companies/@_company.CompanyId/h/i">Produktkøb</a>
</div> </div>
<div class="col"> <div class="col">
<a class="btn btn-info" href="/companies/@_company.CompanyId/h/p">Varelinjer</a> <a class="btn btn-light border-dark" href="/companies/@_company.CompanyId/h/p">Varelinjer</a>
</div> </div>
<div class="col"> <div class="col">
<ActivityButton ActionLink="@_actionLink" <ActivityButton ActionLink="@_actionLink"

View file

@ -61,6 +61,8 @@ public partial class CustomerViewPage : IDisposable
private int _enableActivity = 1; private int _enableActivity = 1;
private bool _hideButtons = false; private bool _hideButtons = false;
private string _actionLink = ""; private string _actionLink = "";
private bool _working;
private string _btnUpdateText = "Opdater";
private readonly JsonSerializerOptions _options = new () private readonly JsonSerializerOptions _options = new ()
{ {
@ -69,10 +71,14 @@ public partial class CustomerViewPage : IDisposable
private async Task RefreshHistory() private async Task RefreshHistory()
{ {
_working = true;
_btnUpdateText = "vent venligst ...";
_toast.ShowInfo("Vent mens data opdateres ..."); _toast.ShowInfo("Vent mens data opdateres ...");
_toast.ShowInfo("Der kan gå nogle minuutter inden data er klar ..."); _toast.ShowInfo("Der kan gå nogle minuutter inden data er klar ...");
var ts = await _historyRepo.UpdateProductHistory(_company.CompanyId, $"{DateTime.Parse(_company.HistorySync):yyyy-MM-dd}");; var ts = await _historyRepo.UpdateProductHistory(_company.CompanyId, $"{DateTime.Parse(_company.HistorySync):yyyy-MM-dd}");;
_company.HistorySync = ts.Replace("\"", ""); _company.HistorySync = ts.Replace("\"", "");
_btnUpdateText = "Opdater";
_working = false;
} }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
@ -135,9 +141,6 @@ public partial class CustomerViewPage : IDisposable
{ {
_nextVisit = _lastVisit.AddDays(_company.Interval * 7); _nextVisit = _lastVisit.AddDays(_company.Interval * 7);
_company.LastVisit = $"{_lastVisit:yyyy-MM-dd}";
_company.NextVisit = $"{_nextVisit:yyyy-MM-dd}";
if (!VatUtils.ValidateFormat(_company.CountryCode, _company.VatNumber)) if (!VatUtils.ValidateFormat(_company.CountryCode, _company.VatNumber))
{ {
_formInvalid = true; _formInvalid = true;

View file

@ -1,13 +1,13 @@
{ {
"appInfo": { "appInfo": {
"name": "Wonky Client", "name": "Wonky Client",
"version": "0.9.13", "version": "0.9.15",
"isBeta": true, "rc": true,
"sandBox": false, "sandBox": false,
"image": "grumpy-coder.png" "image": "grumpy-coder.png"
}, },
"apiConfig": { "apiConfig": {
"innoBaseUrl": "https://staging.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": "",
"virkUrl": "api/v2/services/virk", "virkUrl": "api/v2/services/virk",
@ -27,7 +27,8 @@
"adminUserUri": "api/v2/admin/users/office", "adminUserUri": "api/v2/admin/users/office",
"adminPasswdUri": "api/v2/admin/users/passwd", "adminPasswdUri": "api/v2/admin/users/passwd",
"adminReportUri": "reports", "adminReportUri": "reports",
"adminCompanyUri": "companies" "adminCompanyUri": "companies",
"warehouseUri": "api/v2/warehouse/orders"
}, },
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {

View file

@ -35,10 +35,10 @@ public class AppInfo
/// <summary> /// <summary>
/// Application beta version flag /// Application beta version flag
/// </summary> /// </summary>
public bool IsBeta { get; set; } public bool Rc { get; set; }
/// <summary> /// <summary>
/// Sandbox version /// Sandbox version
/// </summary> /// </summary>
public bool SandBox { get; set; } public bool Sandbox { get; set; }
} }