1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header">
<div class="form-inline">
<EditForm Model="@ListLots" OnValidSubmit="@HandleValidSubmit">
<input type="datetime" @bind="dateDebut" placeholder="Date de début" class="form-control" id="DebDateDefaut">
<div class="input-group-append"><i class="fa fa-calendar"></i></div>
<input type="text" @bind="dateFin" placeholder="Date de fin" class="form-control" id="FinDateDefaut">
<div class="input-group-append"><i class="fa fa-calendar"></i></div>
<div class="input-group-append">
<button type="submit" class="btn btn-light ms-2">Rechercher</button>
</div>
</EditForm>
</div>
</div>
<div class="card-body">
<table id="file-datatable" class="display nowrap" width="100%">
<thead>
<tr>
<th>Date début</th>
<th>Date fin</th>
<th>Numéro</th>
<th>Trieurs</th>
</tr>
</thead>
<tbody>
@foreach(var lot in ListLots)
{
<tr @onclick="() => EditLot(lot.LotID)">
<td>@lot.Start</td>
<td>@lot.End</td>
<td>@lot.Numero</td>
<td>@lot.Trieurs</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
</div>
@code {
private List<Models.Lot> ListLots;
[Parameter] public DateTime dateDebut { get; set; }
[Parameter] public DateTime dateFin { get; set; }
protected override async Task OnInitializedAsync()
{
try
{
dateFin = DateTime.Now;
ListLots = await Http.GetFromJsonAsync<List<Models.Lot>>("api/Lots");
StateHasChanged();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
public void HandleValidSubmit()
{
var ListLots = Http.GetFromJsonAsync<List<Models.Lot>>("api/Lots/StartDebLot='"+dateDebut+"'&&StartFinLot='"+dateFin+"'");
// Process the valid form
} |
Partager