warehouse button disable on click

This commit is contained in:
FH 2022-10-04 10:56:29 +02:00
parent c1331b3660
commit 3520dcd656
2 changed files with 9 additions and 5 deletions

View file

@ -108,15 +108,15 @@
<div class="col-md-4"> <div class="col-md-4">
@if (_order.ProcessStatusEnum.ToLower() == "none") @if (_order.ProcessStatusEnum.ToLower() == "none")
{ {
<button class="btn btn-lg btn-warning text-nowrap" type="button" @onclick="SetProcessStatusPicked">Sæt status plukket</button> <button class="btn btn-lg btn-warning text-nowrap" type="button" @onclick="SetProcessStatusPicked" disabled="@_working">Sæt status plukket</button>
} }
@if (_order.ProcessStatusEnum.ToLower() == "picked") @if (_order.ProcessStatusEnum.ToLower() == "picked")
{ {
<button class="btn btn-lg btn-danger text-nowrap" type="button" @onclick="SetProcessStatusPacked">Sæt status pakket</button> <button class="btn btn-lg btn-danger text-nowrap" type="button" @onclick="SetProcessStatusPacked" disabled="@_working">Sæt status pakket</button>
} }
@if (_order.ProcessStatusEnum.ToLower() == "packed") @if (_order.ProcessStatusEnum.ToLower() == "packed")
{ {
<button class="btn btn-lg btn-primary text-nowrap" type="button" @onclick="SetProcessStatusShipped">Sæt status afsendt</button> <button class="btn btn-lg btn-primary text-nowrap" type="button" @onclick="SetProcessStatusShipped" disabled="@_working">Sæt status afsendt</button>
} }
</div> </div>
</div> </div>

View file

@ -14,6 +14,7 @@
// //
using System.Text;
using System.Text.Json; using System.Text.Json;
using Blazored.Toast.Services; using Blazored.Toast.Services;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
@ -35,6 +36,7 @@ public partial class WarehouseOrderViewPage : IDisposable
private WarehouseOrderView _order { get; set; } = new(); private WarehouseOrderView _order { get; set; } = new();
private bool Loading { get; set; } private bool Loading { get; set; }
private bool _working { get; set; }
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
@ -48,7 +50,7 @@ public partial class WarehouseOrderViewPage : IDisposable
private async Task SetProcessStatusPicked() private async Task SetProcessStatusPicked()
{ {
_working = true;
var process = new WarehouseProcess var process = new WarehouseProcess
{ {
OrderId = _order.OrderId, OrderId = _order.OrderId,
@ -60,6 +62,7 @@ public partial class WarehouseOrderViewPage : IDisposable
private async Task SetProcessStatusPacked() private async Task SetProcessStatusPacked()
{ {
_working = true;
var process = new WarehouseProcess var process = new WarehouseProcess
{ {
OrderId = _order.OrderId, OrderId = _order.OrderId,
@ -71,13 +74,14 @@ public partial class WarehouseOrderViewPage : IDisposable
private async Task SetProcessStatusShipped() private async Task SetProcessStatusShipped()
{ {
_working = true;
var process = new WarehouseProcess var process = new WarehouseProcess
{ {
OrderId = _order.OrderId, OrderId = _order.OrderId,
ProcessStatusEnum = "shipped" ProcessStatusEnum = "shipped"
}; };
await _warehouseRepo.UpdateWarehouseOrderStatus(process); await _warehouseRepo.UpdateWarehouseOrderStatus(process);
_navigator.NavigateTo("/warehouse/orders/packed"); _navigator.NavigateTo("/warehouse/orders/none");
} }
public void Dispose() public void Dispose()