This commit is contained in:
Frede Hundewadt 2022-09-08 08:50:23 +02:00
parent fdab3dc2bb
commit 1e8ecff5ad
6 changed files with 41 additions and 17 deletions

View file

@ -85,6 +85,5 @@ public class ReportHttpRepository :IReportHttpRepository
Message = result.Message,
IsSuccess = result.IsSuccess
};
}
}

View file

@ -101,14 +101,27 @@
</tr>
</tbody>
</table>
<div class="alert border border-1 border-primary">
<EditForm EditContext="OfficeNote">
<div class="row mb-2">
<label class="form-label mb-1" for="office-note">Ordre Note</label>
<InputTextArea class="form-control mb-1" id="office-note" rows="5" @bind-Value="_note.OfficeNote"></InputTextArea>
</div>
<div class="row mb-1">
<button class="btn btn-primary btn-lg" type="button" @onclick="UpdateOfficeNote" disabled="@_disabled" >Gem note</button>
</div>
</EditForm>
</div>
@* Office Note *@
@if (ReportItem.ProcessStatusEnum.ToLower() == "none" && !ReportItem.Express && AllowOfficeNoteUpdate())
{
<div class="alert border border-1 border-primary">
<EditForm EditContext="OfficeNote">
<div class="row mb-2">
<label class="form-label mb-1" for="office-note">Note /Kontor ()</label>
<InputTextArea class="form-control mb-1" id="office-note" rows="5" @bind-Value="_note.OfficeNote"></InputTextArea>
<div>
Ordre noten lukkes efter @_graceTime minutter eller når den er plukket.
</div>
</div>
<div class="row mb-1">
<button class="btn btn-primary btn-lg" type="button" @onclick="UpdateOfficeNote" disabled="@_disabled">Opdater Note /Kontor</button>
</div>
</EditForm>
</div>
}
else
{
<div class="alert alert-dark">
<h4 class="text-center">@ReportItem.OfficeNote</h4>
</div>
}

View file

@ -23,6 +23,7 @@ public partial class AdvisorViewActivityPage : IDisposable
private ActivityOfficeNote _note { get; set; } = new();
private EditContext OfficeNote { get; set; }
private bool _disabled { get; set; }
private int _graceTime { get; set; } = 60;
protected override async Task OnInitializedAsync()
{
@ -33,6 +34,7 @@ public partial class AdvisorViewActivityPage : IDisposable
ReportItem = await _activityRepo.GetReportItem(OrderId);
_note.ActivityId = ReportItem.ActivityId;
_note.OfficeNote = ReportItem.OfficeNote;
_logger.LogDebug("ReportItem => \n {}", JsonSerializer.Serialize(ReportItem));
}
private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
@ -48,6 +50,13 @@ public partial class AdvisorViewActivityPage : IDisposable
_toast.ShowInfo($"{ReportItem.ESalesNumber} - notat opdateret");
}
private bool AllowOfficeNoteUpdate()
{
if (!DateTime.TryParse(ReportItem.CreateTimestamp, out var createTs))
return false;
return DateTime.Now < createTs.AddMinutes(_graceTime);
}
public void Dispose()
{
_interceptor.DisposeEvent();

View file

@ -1,8 +1,8 @@
{
"appInfo": {
"name": "Wonky Client",
"version": "0.14.5",
"rc": true,
"version": "0.15.1",
"rc": false,
"sandBox": false,
"image": "grumpy-coder.png"
},
@ -31,7 +31,7 @@
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
},

View file

@ -48,5 +48,5 @@ public class ReportItemLine
/// <summary>
/// Flag line as picked
/// </summary>
public bool Checked { get; set; }
public bool Picked { get; set; }
}

View file

@ -25,12 +25,15 @@ public class ReportItemView
/// Lines
/// </summary>
public List<ReportItemLine> Lines { get; set; } = new();
/// <summary>
/// Activity entity id
/// </summary>
public string ActivityId { get; set; } = "";
/// <summary>
/// Entity CreateTimestamp as string
/// </summary>
public string CreateTimestamp { get; set; } = "";
/// <summary>
/// Closed sale
/// </summary>
public bool Closed { get; set; }