checked components for possible uninitialized variables
This commit is contained in:
parent
d2d28be3bc
commit
77a82e60ac
18 changed files with 44 additions and 38 deletions
|
@ -20,7 +20,7 @@ namespace Wonky.Client.Components;
|
|||
|
||||
public partial class AdvisorActivityTableComponent
|
||||
{
|
||||
[Parameter] public List<ReportItemView> ActivityList { get; set; }
|
||||
[Parameter] public List<ReportItemView> ActivityList { get; set; } = new();
|
||||
[Inject] public NavigationManager Navigator { get; set; }
|
||||
|
||||
// private void ShowOrder(string companyId, string orderId)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
@using Microsoft.AspNetCore.Authorization
|
||||
@using Wonky.Client.Components
|
||||
|
||||
<PageTitle>Inno Web CRM</PageTitle>
|
||||
<PageTitle>Innotec Admin</PageTitle>
|
||||
|
||||
@*<div class="card mb-3" style="max-width: 300px">
|
||||
<div class="row g-0">
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
@using Microsoft.AspNetCore.Authorization
|
||||
@using Wonky.Client.Components
|
||||
|
||||
<PageTitle>Inno Web CRM</PageTitle>
|
||||
<PageTitle>Innotec Rådgiver</PageTitle>
|
||||
|
||||
<AuthorizeView Roles="Advisor">
|
||||
<div class="bg-dark text-white rounded-2 mb-2 py-2">
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Wonky.Client.Components;
|
|||
|
||||
public partial class OfficeActivityTableComponent
|
||||
{
|
||||
[Parameter] public List<ReportItemView> ActivityList { get; set; }
|
||||
[Parameter] public List<ReportItemView> ActivityList { get; set; } = new();
|
||||
[Inject] public NavigationManager Navigator { get; set; }
|
||||
|
||||
private static string GetProcessStatus(string processStatus)
|
||||
|
|
|
@ -21,5 +21,5 @@ namespace Wonky.Client.Components;
|
|||
|
||||
public partial class OfficeAdvisorTableComponent
|
||||
{
|
||||
[Parameter] public List<UserListAdminView> UserList { get; set; }
|
||||
[Parameter] public List<UserListAdminView> UserList { get; set; } = new();
|
||||
}
|
|
@ -20,7 +20,7 @@ namespace Wonky.Client.Components;
|
|||
|
||||
public partial class OfficeReportTableComponent
|
||||
{
|
||||
[Parameter] public List<NgSalesReportListView> ReportList { get; set; }
|
||||
[Parameter] public List<NgSalesReportListView> ReportList { get; set; } = new();
|
||||
[Parameter] public string UserId { get; set; } = "";
|
||||
[Parameter] public string CountryCode { get; set; } = "";
|
||||
}
|
|
@ -21,5 +21,5 @@ namespace Wonky.Client.Components;
|
|||
|
||||
public partial class OfficeUserTableComponent
|
||||
{
|
||||
[Parameter] public List<UserListAdminView> UserList { get; set; }
|
||||
[Parameter] public List<UserListAdminView> UserList { get; set; } = new();
|
||||
}
|
|
@ -25,9 +25,10 @@ namespace Wonky.Client.Components;
|
|||
|
||||
public partial class ProductInventoryTableComponent
|
||||
{
|
||||
[CascadingParameter] DraftStateProvider DraftStateProvider { get; set; }
|
||||
[CascadingParameter] public DraftStateProvider DraftStateProvider { get; set; } = new();
|
||||
[Parameter] public List<ProductInventoryView> ProductList { get; set; } = new();
|
||||
[Parameter] public string CompanyId { get; set; } = "";
|
||||
|
||||
[Inject] public ICatalogHttpRepository Catalog { get; set; }
|
||||
// private variables
|
||||
private SalesItemView SalesItem { get; set; } = new();
|
||||
|
|
|
@ -20,5 +20,5 @@ namespace Wonky.Client.Components;
|
|||
|
||||
public partial class ReportActivityLedgerComponent
|
||||
{
|
||||
[Parameter] public ReportData ReportData { get; set; }
|
||||
[Parameter] public ReportData ReportData { get; set; } = new();
|
||||
}
|
|
@ -20,7 +20,6 @@ namespace Wonky.Client.Components;
|
|||
|
||||
public partial class ReportDistanceLedgerComponent
|
||||
{
|
||||
[Parameter]
|
||||
public ReportData ReportData { get; set; }
|
||||
[Parameter] public ReportData ReportData { get; set; } = new();
|
||||
|
||||
}
|
|
@ -21,7 +21,6 @@ namespace Wonky.Client.Components;
|
|||
|
||||
public partial class ReportSummaryComponent
|
||||
{
|
||||
[Parameter]
|
||||
public ReportData ReportData { get; set; }
|
||||
[Parameter] public ReportData ReportData { get; set; } = new();
|
||||
|
||||
}
|
|
@ -25,7 +25,7 @@ namespace Wonky.Client.Components
|
|||
{
|
||||
public partial class TaskItemTableComponent
|
||||
{
|
||||
[Parameter] public List<TaskItemDto>? TaskItemList { get; set; } = new();
|
||||
[Parameter] public List<TaskItemDto> TaskItemList { get; set; } = new();
|
||||
[Parameter] public EventCallback<string> OnDeleteTask { get; set; }
|
||||
[Parameter] public EventCallback<string> OnCompleteTask { get; set; }
|
||||
[Parameter] public EventCallback<string> OnTaskCompleted { get; set; }
|
||||
|
|
|
@ -105,13 +105,13 @@ namespace Wonky.Client.HttpInterceptors
|
|||
_authenticationService.Logout();
|
||||
_navigation.NavigateTo($"/login/{currDoc}");
|
||||
message = "Venligst login ...";
|
||||
_toast.ShowWarning(message);
|
||||
_toast.ShowInfo(message);
|
||||
break;
|
||||
case HttpStatusCode.Conflict:
|
||||
break;
|
||||
case HttpStatusCode.InternalServerError:
|
||||
message = "Der er interne problemer på serveren ...";
|
||||
_toast.ShowError(message);
|
||||
// message = "Der er interne problemer på serveren ...";
|
||||
// _toast.ShowError(message);
|
||||
break;
|
||||
default:
|
||||
_toast.ShowError(message);
|
||||
|
|
|
@ -53,9 +53,8 @@ public class CrmReportHttpRepository :ICrmReportHttpRepository
|
|||
}
|
||||
public async Task<bool> ReportExist(string workDate)
|
||||
{
|
||||
var result =
|
||||
await _client
|
||||
.GetFromJsonAsync<SalesReportClosedView>($"{_apiConfig.CrmReports}/exist/{workDate}");
|
||||
var result = await _client.GetFromJsonAsync<SalesReportClosedView>(
|
||||
$"{_apiConfig.CrmReports}/exist/{workDate}");
|
||||
return result.ReportClosed;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<WorkDateComponent OnChangedCallback="SetWorkDateCallback"/>
|
||||
</div>
|
||||
<div class="col-sm-4 text-end">
|
||||
<AdvisorActivityKmStartComponent disabled/>
|
||||
<AdvisorActivityKmStartComponent />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -297,7 +297,7 @@
|
|||
</table>
|
||||
</div>
|
||||
</EditForm>
|
||||
<ConfirmationModal BodyMessage="@Prompt" OnOkClicked="ConfirmSaveCallback" @ref="ConfirmReportModal"/>
|
||||
<ConfirmationModal BodyMessage="@Prompt" OnOkClicked="ConfirmReportCallback" @ref="ConfirmReportModal"/>
|
||||
|
||||
@if (Working)
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ public partial class CrmReportNewPage : IDisposable
|
|||
private bool FormInvalid { get; set; } = true;
|
||||
private bool NoFigures { get; set; } = true;
|
||||
private bool Working { get; set; } = true;
|
||||
private DateTime _workDate { get; set; } = DateTime.Now;
|
||||
private DateTime _workDate { get; set; }
|
||||
private TimeOnly _checkIn { get; set; } = new(12, 0);
|
||||
private TimeOnly _checkOut { get; set; } = new(12, 0);
|
||||
private DateTime BeginLeave { get; set; } = DateTime.Now;
|
||||
|
@ -65,11 +65,12 @@ public partial class CrmReportNewPage : IDisposable
|
|||
ReportContext.OnValidationStateChanged += ValidationChanged;
|
||||
|
||||
Prefs = await PrefService.GetPreferences();
|
||||
_workDate = DateTime.Now;
|
||||
if (!string.IsNullOrWhiteSpace(Prefs.WorkDate))
|
||||
_workDate = DateTime.Parse(Prefs.WorkDate);
|
||||
|
||||
if(await CrmReportRepo.ReportExist(Prefs.WorkDate))
|
||||
Navigator.NavigateTo($"/sales-reports/view/{Prefs.WorkDate}");
|
||||
|
||||
// if(await CrmReportRepo.ReportExist(Prefs.WorkDate))
|
||||
// Navigator.NavigateTo($"/sales-reports/view/{_workDate:yyyy-MM-dd}");
|
||||
|
||||
BeginLeave = _workDate;
|
||||
EndLeave = _workDate;
|
||||
|
@ -81,7 +82,10 @@ public partial class CrmReportNewPage : IDisposable
|
|||
Report.Figures.KmEvening = 0;
|
||||
Report.Figures.Distance = 0;
|
||||
Report.Figures.DistancePrivateMonth = 0;
|
||||
|
||||
Working = false;
|
||||
Logger.LogDebug("OnInitializedAsync => GetKeyFigures");
|
||||
await GetKeyFigures();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -91,8 +95,13 @@ public partial class CrmReportNewPage : IDisposable
|
|||
/// <param name="e"></param>
|
||||
private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
|
||||
{
|
||||
Console.WriteLine($"e FieldName => {e.FieldIdentifier.FieldName}");
|
||||
// Console.WriteLine($"e FieldName => {e.FieldIdentifier.FieldName}");
|
||||
FormInvalid = !ReportContext.Validate();
|
||||
if (Report.Figures.KmEvening - Report.Figures.KmMorning > 1000)
|
||||
{
|
||||
Toaster.ShowError($"KM tal '{Report.Figures.KmEvening - Report.Figures.KmMorning}'. Er du sikker på at det er rigtigt?", "KM tal");
|
||||
}
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
@ -114,7 +123,7 @@ public partial class CrmReportNewPage : IDisposable
|
|||
/// <summary>
|
||||
/// Save report confirmed callback
|
||||
/// </summary>
|
||||
private async Task ConfirmSaveCallback()
|
||||
private async Task ConfirmReportCallback()
|
||||
{
|
||||
// attempt to eliminate doubled click on submit button
|
||||
if (Working)
|
||||
|
@ -122,12 +131,7 @@ public partial class CrmReportNewPage : IDisposable
|
|||
Working = true;
|
||||
|
||||
var result = await CrmReportRepo.PostReport($"{_workDate:yyyy-MM-dd}", Report);
|
||||
// if (!result.IsSuccess)
|
||||
// {
|
||||
// Working = false;
|
||||
// Toaster.ShowError($"{result.Message}", $"HTTP Status {result.Code}");
|
||||
// return;
|
||||
// }
|
||||
Toaster.ShowInfo($"{result.Message}", $"HTTP Status");
|
||||
|
||||
// reset km and date confirmation
|
||||
await PrefService.SetKmMorning(0);
|
||||
|
@ -194,7 +198,9 @@ public partial class CrmReportNewPage : IDisposable
|
|||
|
||||
// pop confirmation
|
||||
// create a prompt for popup confirmation
|
||||
Prompt = Report.Figures.Distance > 1000 ? $"'{Report.Figures.Distance}'KM tal er meget højt. Er du sikker på at det er rigtigt? Gem rapport for {_workDate.ToLongDateString()}?" : $"Gem Rapport for {_workDate.ToLongDateString()}?";
|
||||
var warning = Report.Figures.KmEvening - Report.Figures.KmMorning > 1000 ?
|
||||
$"KM tal '{Report.Figures.KmEvening - Report.Figures.KmMorning}'. Er du sikker på at det er rigtigt?<br/></br>" : "";
|
||||
Prompt = $"{warning}Gem rapport for {_workDate.ToLongDateString()}?";
|
||||
ConfirmReportModal.Show();
|
||||
}
|
||||
|
||||
|
@ -236,6 +242,8 @@ public partial class CrmReportNewPage : IDisposable
|
|||
/// </summary>
|
||||
private async Task GetKeyFigures()
|
||||
{
|
||||
if (Working)
|
||||
return;
|
||||
Working = true;
|
||||
|
||||
Report.Figures = new ReportFiguresDto();
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Bekræft Venligst</h5>
|
||||
<h2 class="modal-title">Bekræft Venligst</h2>
|
||||
<button type="button" class="btn-close" @onclick="Hide" data-bs-dismiss="modal" aria-label="Luk"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h3 class="fw-bold">@BodyMessage</h3>
|
||||
@((MarkupString) BodyMessage)
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" @onclick="Hide">Afbryd</button>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"appInfo": {
|
||||
"name": "Wonky Client",
|
||||
"version": "0.81.1",
|
||||
"version": "0.83.2",
|
||||
"rc": true,
|
||||
"sandBox": false,
|
||||
"image": "grumpy-coder.png"
|
||||
|
|
Loading…
Reference in a new issue