diff --git a/Wonky.Client/Pages/CrmActivityCreate.razor.cs b/Wonky.Client/Pages/CrmActivityCreate.razor.cs
index 3896677e..5a8e3f68 100644
--- a/Wonky.Client/Pages/CrmActivityCreate.razor.cs
+++ b/Wonky.Client/Pages/CrmActivityCreate.razor.cs
@@ -67,6 +67,7 @@ public partial class CrmActivityCreate : IDisposable
private bool InvalidActivity { get; set; } = true;
private bool InvalidCanvas { get; set; } = true;
private UserInfoView Ux { get; set; } = new();
+ private DateTime _workDate { get; set; } = DateTime.Now;
protected override async Task OnInitializedAsync()
{
@@ -75,6 +76,11 @@ public partial class CrmActivityCreate : IDisposable
_prefs = await UserPrefs.GetPreferences();
+ if (!string.IsNullOrWhiteSpace(_prefs.WorkDate))
+ _workDate = DateTime.Parse(_prefs.WorkDate);
+
+ _poDraft.ActivityDate = $"{_workDate:yyyy-MM-dd}" ;
+
_paging.SearchColumn = _prefs.ItemSearch ?? "name";
_paging.PageSize = Convert.ToInt32(_prefs.PageSize);
@@ -87,7 +93,7 @@ public partial class CrmActivityCreate : IDisposable
_poDraft.CompanyId = NgCompany.CompanyId;
_poDraft.BcId = NgCompany.BcId;
_poDraft.SalesRepId = Ux.Id;
- _poDraft.ActivityDate = _prefs.WorkDate;
+
_poDraft.ActivityStatusEnum = "noSale";
_poDraft.VisitTypeEnum = NgCompany.Account is "" or "NY" ? "new" : "recall";
@@ -119,7 +125,7 @@ public partial class CrmActivityCreate : IDisposable
private void SetWorkDate(string workDate)
{
- _logger.LogInformation("WorkDateComponent.OnChanged() => {workDate}", workDate);
+ _logger.LogInformation("WorkDateComponent.OnChanged(SetWorkDate(workDate)) => {workDate}", workDate);
_poDraft.ActivityDate = workDate;
}
@@ -127,6 +133,7 @@ public partial class CrmActivityCreate : IDisposable
{
HideButtons = true;
_poDraft.ActivityDate = _prefs.WorkDate;
+
var activityType = _poDraft.ActivityTypeEnum switch
{
"phone" => "T",
@@ -165,11 +172,6 @@ public partial class CrmActivityCreate : IDisposable
{
InvalidActivityType = string.IsNullOrWhiteSpace(_poDraft.ActivityTypeEnum);
}
- private void CheckStatus()
- {
- InvalidStatusType = string.IsNullOrWhiteSpace(_poDraft.ActivityStatusEnum);
- }
-
private async Task DeleteDraft()
{
await DraftStateProvider.DeleteDraftAsync();
@@ -264,17 +266,18 @@ public partial class CrmActivityCreate : IDisposable
private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
{
- InvalidCanvas = InvalidActivityType;
- InvalidActivity = InvalidActivityType
- || _poFormInvalid
- || DraftStateProvider.Draft.Items.Count == 0
- || (_poDraft.ActivityStatusEnum == "offer" && string.IsNullOrWhiteSpace(_poDraft.EMail));
+ // InvalidCanvas = InvalidActivityType;
+ // InvalidActivity = InvalidActivityType
+ // || _poFormInvalid
+ // || DraftStateProvider.Draft.Items.Count == 0
+ // || (_poDraft.ActivityStatusEnum == "offer" && string.IsNullOrWhiteSpace(_poDraft.EMail));
- if (InvalidCanvas || InvalidActivity)
- {
- _poFormInvalid = true;
- return;
- }
+ // if (InvalidCanvas || InvalidActivity)
+ // {
+ // _poFormInvalid = true;
+ // return;
+ // }
+
_poFormInvalid = !DraftContext.Validate();
StateHasChanged();
}
diff --git a/Wonky.Client/Pages/SalesReport.razor b/Wonky.Client/Pages/SalesReport.razor
index 897ac654..96bb320c 100644
--- a/Wonky.Client/Pages/SalesReport.razor
+++ b/Wonky.Client/Pages/SalesReport.razor
@@ -20,10 +20,6 @@
@page "/sales-report"
-
workDate: @_workDate
-
checkIn: @_reportDto.CheckIn
-
checkOut: @_reportDto.CheckOut
-