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, Message = result.Message,
IsSuccess = result.IsSuccess IsSuccess = result.IsSuccess
}; };
} }
} }

View file

@ -101,14 +101,27 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="alert border border-1 border-primary"> @* Office Note *@
<EditForm EditContext="OfficeNote"> @if (ReportItem.ProcessStatusEnum.ToLower() == "none" && !ReportItem.Express && AllowOfficeNoteUpdate())
<div class="row mb-2"> {
<label class="form-label mb-1" for="office-note">Ordre Note</label> <div class="alert border border-1 border-primary">
<InputTextArea class="form-control mb-1" id="office-note" rows="5" @bind-Value="_note.OfficeNote"></InputTextArea> <EditForm EditContext="OfficeNote">
</div> <div class="row mb-2">
<div class="row mb-1"> <label class="form-label mb-1" for="office-note">Note /Kontor ()</label>
<button class="btn btn-primary btn-lg" type="button" @onclick="UpdateOfficeNote" disabled="@_disabled" >Gem note</button> <InputTextArea class="form-control mb-1" id="office-note" rows="5" @bind-Value="_note.OfficeNote"></InputTextArea>
</div> <div>
</EditForm> Ordre noten lukkes efter @_graceTime minutter eller når den er plukket.
</div> </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 ActivityOfficeNote _note { get; set; } = new();
private EditContext OfficeNote { get; set; } private EditContext OfficeNote { get; set; }
private bool _disabled { get; set; } private bool _disabled { get; set; }
private int _graceTime { get; set; } = 60;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
@ -33,6 +34,7 @@ public partial class AdvisorViewActivityPage : IDisposable
ReportItem = await _activityRepo.GetReportItem(OrderId); ReportItem = await _activityRepo.GetReportItem(OrderId);
_note.ActivityId = ReportItem.ActivityId; _note.ActivityId = ReportItem.ActivityId;
_note.OfficeNote = ReportItem.OfficeNote; _note.OfficeNote = ReportItem.OfficeNote;
_logger.LogDebug("ReportItem => \n {}", JsonSerializer.Serialize(ReportItem));
} }
private void HandleFieldChanged(object sender, FieldChangedEventArgs e) private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
@ -48,6 +50,13 @@ public partial class AdvisorViewActivityPage : IDisposable
_toast.ShowInfo($"{ReportItem.ESalesNumber} - notat opdateret"); _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() public void Dispose()
{ {
_interceptor.DisposeEvent(); _interceptor.DisposeEvent();

View file

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

View file

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

View file

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