aggiunta dinamica di una porta esistente
This commit is contained in:
@@ -54,22 +54,47 @@
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="newCompModalLabel">Insert new company</h1>
|
||||
<h1 class="modal-title fs-5" id="newCompModalLabel">Insert or update Doors</h1>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="w-100">
|
||||
|
||||
<div class="mb-2 d-flex justify-content-between">
|
||||
@if (currDoor != null)
|
||||
{
|
||||
<input class="form-input" @bind-value="@doorExtCode" />
|
||||
<input class="form-input w-25" @bind-value="@doorQuantity" type="number" disabled/>
|
||||
<button class="btn btn-sm btn-danger" @onclick="()=>addOrRemoveOneDoor(currDoor, false)"><i class="fa-solid fa-minus"></i> <i class="fa-solid fa-1"></i></button>
|
||||
<button class="btn btn-sm btn-success" @onclick="()=>addOrRemoveOneDoor(currDoor, true)"><i class="fa-solid fa-plus"></i> <i class="fa-solid fa-1"></i></button>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (DoorsList != null)
|
||||
{
|
||||
@foreach (var door in DoorsList)
|
||||
{
|
||||
<button class="btn btn-sm btn-danger"><i class="fa-solid fa-pen-to-square"></i></button>
|
||||
<input value="@door.DoorExtCode" disabled/>
|
||||
<input @bind-value="@door.Quantity" type="number" />
|
||||
}
|
||||
<table class="table table-sm table-striped table-responsive-md border border-dark">
|
||||
<thead>
|
||||
<tr class="bg-dark text-light">
|
||||
<td></td>
|
||||
<td>Door Type</td>
|
||||
<th>Door external code</th>
|
||||
<th>Doors Number</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var door in DoorsList)
|
||||
{
|
||||
<tr>
|
||||
<td><button class="btn btn-sm btn-warning" @onclick="()=>SetCurrDoor(door)"><i class="fa-solid fa-pen-to-square"></i></button></td>
|
||||
<td>@door.TypeId</td>
|
||||
<td>@door.DoorExtCode</td>
|
||||
<td>@door.Quantity</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
|
||||
|
||||
@* <div class="form-floating">
|
||||
<input id="orderCodExt" @bind-value="@orderCodExt" class="form-control w-100 w-100w-100 my-1" />
|
||||
<label for="orderCodExt" class="form-label">Order external code</label>
|
||||
@@ -81,8 +106,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" @onclick="()=>addNewOrder(context.User.Identity?.Name!)">Save changes</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="()=>emptyModal()" data-bs-dismiss="modal">Close</button>
|
||||
@* <button type="button" class="btn btn-primary" @onclick="()=>addNewOrder(context.User.Identity?.Name!)">Save changes</button>*@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -52,6 +52,18 @@ namespace WebDoorCreator.UI.Pages
|
||||
get => _orderDescr;
|
||||
set => _orderDescr = value;
|
||||
}
|
||||
protected string _doorExtCode = "";
|
||||
protected string doorExtCode
|
||||
{
|
||||
get => _doorExtCode;
|
||||
set => _doorExtCode = value;
|
||||
}
|
||||
protected int _doorQuantity = 0;
|
||||
protected int doorQuantity
|
||||
{
|
||||
get => _doorQuantity;
|
||||
set => _doorQuantity = value;
|
||||
}
|
||||
|
||||
private List<CompanyModel>? ListRecords = null;
|
||||
|
||||
@@ -67,6 +79,7 @@ namespace WebDoorCreator.UI.Pages
|
||||
|
||||
protected bool isModRole { get; set; } = false;
|
||||
protected int currDoorType { get; set; } = 0;
|
||||
protected DoorModel? currDoor { get; set; } = null;
|
||||
|
||||
protected async Task addNewOrder(string userName)
|
||||
{
|
||||
@@ -97,6 +110,18 @@ namespace WebDoorCreator.UI.Pages
|
||||
await Task.Delay(1);
|
||||
currDoorType = doorType;
|
||||
}
|
||||
protected async Task SetCurrDoor(DoorModel door)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
currDoor = door;
|
||||
doorExtCode = currDoor.DoorExtCode;
|
||||
doorQuantity = currDoor.Quantity;
|
||||
}
|
||||
protected async Task emptyModal()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
currDoor = null;
|
||||
}
|
||||
|
||||
|
||||
protected async Task addOrModDoor(string userName)
|
||||
@@ -125,6 +150,23 @@ namespace WebDoorCreator.UI.Pages
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task addOrRemoveOneDoor(DoorModel door, bool isAdd)
|
||||
{
|
||||
if (door != null)
|
||||
{
|
||||
if (isAdd)
|
||||
{
|
||||
doorQuantity = doorQuantity + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
doorQuantity = doorQuantity - 1;
|
||||
}
|
||||
|
||||
door.Quantity = doorQuantity;
|
||||
var done = await WDService.DoorsAddMod(door);
|
||||
}
|
||||
}
|
||||
protected async Task catchCurrOrder(int orderId)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
|
||||
Reference in New Issue
Block a user