Merge branch 'feature/AddCharts' into develop
This commit is contained in:
@@ -1,15 +1,31 @@
|
||||
<div class="input-group input-group-sm">
|
||||
row/pag:
|
||||
<select @bind="@numRecord" class="form-control form-control-sm">
|
||||
<option value="5">5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="25">25</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
</select>
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-10 text-left">
|
||||
<div class="row">
|
||||
<div class="col-9">
|
||||
paginazione
|
||||
</div>
|
||||
<div class="col-3">
|
||||
@totalCount records
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-lg-2 text-right">
|
||||
<div class="input-group input-group-sm">
|
||||
row/pag:
|
||||
<select @bind="@numRecord" class="form-control form-control-sm">
|
||||
<option value="5">5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="25">25</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public int totalCount { get; set; } = 0;
|
||||
|
||||
protected int _numRecord { get; set; } = 10;
|
||||
|
||||
|
||||
@@ -99,10 +99,10 @@ namespace MP.Stats.Data
|
||||
return Task.FromResult(dbController.StatOdlGetAll(numRecord, searchVal).ToArray());
|
||||
}
|
||||
|
||||
public Task<MP.Data.DatabaseModels.ResScarti[]> StatScartiGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo, int numRecord, string searchVal = "")
|
||||
public Task<MP.Data.DatabaseModels.ResScarti[]> StatScartiGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo, string searchVal = "")
|
||||
{
|
||||
// filtra e restituisce SOLO i primi record...
|
||||
return Task.FromResult(dbController.StatScartiGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).Take(numRecord).ToArray());
|
||||
return Task.FromResult(dbController.StatScartiGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
}
|
||||
|
||||
public Task<MP.Data.DatabaseModels.UserActionLog[]> StatUserLogGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo, int numRecord, string searchVal = "")
|
||||
|
||||
@@ -29,6 +29,13 @@
|
||||
<None Include="compilerconfig.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazorise" Version="0.9.3.6" />
|
||||
<PackageReference Include="Blazorise.Bootstrap" Version="0.9.3.6" />
|
||||
<PackageReference Include="Blazorise.Charts" Version="0.9.3.6" />
|
||||
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.3.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="logs\.placeholder">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
||||
+50
-50
@@ -5,13 +5,12 @@
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-2 h2">Registro Scarti</div>
|
||||
<div class="col-6 col-lg-10">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter"></SelectionFilter>
|
||||
<div class="col-6 col-lg-3 h2">Registro Scarti</div>
|
||||
<div class="col-6 col-lg-9">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="card-body py-0">
|
||||
@if (currRecord != null)
|
||||
{
|
||||
@*<BasketEditor Basket="@currBasket" DataReset="ResetData" DataUpdated="UpdateData"></BasketEditor>*@
|
||||
@@ -22,54 +21,55 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Macchina</th>
|
||||
<th>Data</th>
|
||||
<th>ODL/Commessa</th>
|
||||
<th>Articolo</th>
|
||||
<th class="text-right">Descrizione</th>
|
||||
<th class="text-right">Qta</th>
|
||||
<th class="text-right">Operatore</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.DataOraRif, @record.IdxMacchina, @record.Causale)">
|
||||
<td>
|
||||
<div>@record.CodMacchina</div>
|
||||
<div class="small">@record.IdxMacchina</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.DataOraRif.ToString("yyyy.MM.dd")</div>
|
||||
<div class="small">@record.DataOraRif.ToString("ddd HH:mm.ss")</div>
|
||||
</td>
|
||||
<td>@record.IdxOdl | @record.KeyRichiesta</td>
|
||||
<td>@record.CodArticolo</td>
|
||||
<td class="text-right">
|
||||
<div class="row">
|
||||
<div class="col">[@record.Causale]</div>
|
||||
<div class="col text-right">@record.Descrizione</div>
|
||||
</div>
|
||||
<div class="small">@record.Note</div>
|
||||
</td>
|
||||
<td class="text-right">@record.Qta</td>
|
||||
<td class="text-right">@record.Cognome @record.Nome (@record.MatrOpr)</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-12 table-secondary">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter"></SelectionFilter>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Macchina</th>
|
||||
<th>Data</th>
|
||||
<th>ODL/Commessa</th>
|
||||
<th>Articolo</th>
|
||||
<th class="text-right">Descrizione</th>
|
||||
<th class="text-right">Qta</th>
|
||||
<th class="text-right">Operatore</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.DataOraRif, @record.IdxMacchina, @record.Causale)">
|
||||
<td>
|
||||
<div>@record.CodMacchina</div>
|
||||
<div class="small">@record.IdxMacchina</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.DataOraRif.ToString("yyyy.MM.dd")</div>
|
||||
<div class="small">@record.DataOraRif.ToString("ddd HH:mm.ss")</div>
|
||||
</td>
|
||||
<td>@record.IdxOdl | @record.KeyRichiesta</td>
|
||||
<td>@record.CodArticolo</td>
|
||||
<td class="text-right">
|
||||
<div class="row">
|
||||
<div class="col">[@record.Causale]</div>
|
||||
<div class="col text-right">@record.Descrizione</div>
|
||||
</div>
|
||||
<div class="small">@record.Note</div>
|
||||
</td>
|
||||
<td class="text-right">@record.Qta</td>
|
||||
<td class="text-right">@record.Cognome @record.Nome (@record.MatrOpr)</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<div class="row">
|
||||
<div class="col-8 col-lg-10">
|
||||
</div>
|
||||
<div class="col-4 col-lg-2">
|
||||
<DataPager numRecord="@numRecord" numRecordChanged="ForceReload" />
|
||||
</div>
|
||||
</div>
|
||||
<DataPager numRecord="@numRecord" numRecordChanged="ForceReload" totalCount="@SearchRecords.Count()" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -2,6 +2,8 @@
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Stats.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Stats.Pages
|
||||
@@ -14,6 +16,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
private MP.Data.DatabaseModels.ResScarti[] ListRecords;
|
||||
|
||||
private MP.Data.DatabaseModels.ResScarti[] SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
@@ -43,7 +47,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
ListRecords = await StatService.StatScartiGetAll(currFilter.DateStart, currFilter.DateEnd, currFilter.IdxMacchina, currFilter.IdxOdl, currFilter.KeyRichiesta, currFilter.CodArticolo, numRecord, MessageService.SearchVal);
|
||||
SearchRecords = await StatService.StatScartiGetAll(currFilter.DateStart, currFilter.DateEnd, currFilter.IdxMacchina, currFilter.IdxOdl, currFilter.KeyRichiesta, currFilter.CodArticolo, MessageService.SearchVal);
|
||||
ListRecords = SearchRecords.Take(numRecord).ToArray();
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
@page "/test"
|
||||
|
||||
<Heading Size="HeadingSize.Is1">Test</Heading>
|
||||
|
||||
<Button class="btn btn-info btn-sm" Clicked="@(async () => await HandleRedraw())">Redraw</Button>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<LineChart @ref="lineChart" TItem="double" OptionsObject="horizontalLineChartOptions" />
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<PieChart @ref="pieChart" TItem="double" OptionsObject="horizontalLineChartOptions" />
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<HorizontalBarChart @ref="barChartHoriz" TItem="double" OptionsObject="horizontalLineChartOptions" />
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<BarChart @ref="barChart" TItem="double" OptionsObject="horizontalLineChartOptions" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
PieChart<double> pieChart;
|
||||
LineChart<double> lineChart;
|
||||
HorizontalBarChart<double> barChartHoriz;
|
||||
BarChart<double> barChart;
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await HandleRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
object horizontalLineChartOptions = new
|
||||
{
|
||||
//Title = new
|
||||
//{
|
||||
// Display = true,
|
||||
// Text = "Line chart sample"
|
||||
//},
|
||||
//Scales = new
|
||||
//{
|
||||
// XAxes = new object[]
|
||||
// {
|
||||
// new {
|
||||
// //ScaleLabel = new {
|
||||
// //Display = true, LabelString = "value" },
|
||||
// Stacked = true
|
||||
// }
|
||||
// }
|
||||
//},
|
||||
Tooltips = new
|
||||
{
|
||||
Mode = "nearest",
|
||||
Intersect = false
|
||||
},
|
||||
Hover = new
|
||||
{
|
||||
Mode = "nearest",
|
||||
Intersect = false
|
||||
},
|
||||
Legend = new
|
||||
{
|
||||
Display = true,
|
||||
FullWidth = true
|
||||
},
|
||||
AspectRatio = 2.5
|
||||
};
|
||||
|
||||
async Task HandleRedraw()
|
||||
{
|
||||
await pieChart.Clear();
|
||||
await pieChart.AddLabelsDatasetsAndUpdate(Labels, GetPieChartDataset());
|
||||
|
||||
await lineChart.Clear();
|
||||
await lineChart.AddLabelsDatasetsAndUpdate(Labels, GetLineChartDataset());
|
||||
|
||||
await barChart.Clear();
|
||||
await barChart.AddLabelsDatasetsAndUpdate(Labels, GetBarChartDataset());
|
||||
|
||||
await barChartHoriz.Clear();
|
||||
await barChartHoriz.AddLabelsDatasetsAndUpdate(Labels, GetHorizBarChartDataset());
|
||||
}
|
||||
|
||||
PieChartDataset<double> GetPieChartDataset()
|
||||
{
|
||||
return new PieChartDataset<double>
|
||||
{
|
||||
Label = "# of randoms",
|
||||
Data = RandomizeData(),
|
||||
BackgroundColor = backgroundColors,
|
||||
BorderColor = borderColors
|
||||
};
|
||||
}
|
||||
|
||||
LineChartDataset<double> GetLineChartDataset()
|
||||
{
|
||||
return new LineChartDataset<double>
|
||||
{
|
||||
Label = "# of randoms",
|
||||
Data = RandomizeData(),
|
||||
BackgroundColor = backgroundColors,
|
||||
BorderColor = borderColors,
|
||||
Fill = true,
|
||||
PointRadius = 2,
|
||||
BorderDash = new List<int> { }
|
||||
};
|
||||
}
|
||||
|
||||
BarChartDataset<double> GetBarChartDataset()
|
||||
{
|
||||
return new BarChartDataset<double>
|
||||
{
|
||||
Label = "# of randoms",
|
||||
Data = RandomizeData(),
|
||||
BackgroundColor = backgroundColors,
|
||||
BorderColor = borderColors,
|
||||
HoverBorderWidth = 5
|
||||
};
|
||||
}
|
||||
BarChartDataset<double> GetHorizBarChartDataset()
|
||||
{
|
||||
return new BarChartDataset<double>
|
||||
{
|
||||
Label = "# of randoms",
|
||||
Data = RandomizeData(),
|
||||
BackgroundColor = backgroundColors,
|
||||
BorderColor = borderColors,
|
||||
HoverBorderWidth = 5
|
||||
};
|
||||
}
|
||||
|
||||
string[] Labels = { "Red", "Blue", "Yellow", "Green", "Purple", "Orange" };
|
||||
List<string> backgroundColors = new List<string> { ChartColor.FromRgba(255, 99, 132, 0.2f), ChartColor.FromRgba(54, 162, 235, 0.2f), ChartColor.FromRgba(255, 206, 86, 0.2f), ChartColor.FromRgba(75, 192, 192, 0.2f), ChartColor.FromRgba(153, 102, 255, 0.2f), ChartColor.FromRgba(255, 159, 64, 0.2f) };
|
||||
List<string> borderColors = new List<string> { ChartColor.FromRgba(255, 99, 132, 1f), ChartColor.FromRgba(54, 162, 235, 1f), ChartColor.FromRgba(255, 206, 86, 1f), ChartColor.FromRgba(75, 192, 192, 1f), ChartColor.FromRgba(153, 102, 255, 1f), ChartColor.FromRgba(255, 159, 64, 1f) };
|
||||
|
||||
List<double> RandomizeData()
|
||||
{
|
||||
var r = new Random(DateTime.Now.Millisecond);
|
||||
|
||||
return new List<double> { r.Next(3, 30) * r.NextDouble(), r.Next(3, 30) * r.NextDouble(), r.Next(3, 30) * r.NextDouble(), r.Next(3, 30) * r.NextDouble(), r.Next(3, 30) * r.NextDouble(), r.Next(3, 30) * r.NextDouble() };
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,15 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>MP.STATS</title>
|
||||
<base href="~/" />
|
||||
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
|
||||
@*<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />*@
|
||||
|
||||
<!-- inside of head section -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.0/css/all.css">
|
||||
|
||||
<link href="_content/Blazorise/blazorise.css" rel="stylesheet" />
|
||||
<link href="_content/Blazorise.Bootstrap/blazorise.bootstrap.css" rel="stylesheet" />
|
||||
|
||||
<link href="css/site.css" rel="stylesheet" />
|
||||
<link href="MP.Stats.styles.css" rel="stylesheet" />
|
||||
</head>
|
||||
@@ -32,6 +40,16 @@
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
<!-- inside of body section and after the div/app tag -->
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js" integrity="sha384-+YQ4JLhjyBLPDQt//I+STsc9iw4uQqACwlvpslubQzn4u2UU2UFM80nGisd026JF" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
|
||||
|
||||
<script src="_content/Blazorise/blazorise.js"></script>
|
||||
<script src="_content/Blazorise.Bootstrap/blazorise.bootstrap.js"></script>
|
||||
<script src="_content/Blazorise.Charts/blazorise.charts.js"></script>
|
||||
|
||||
<script src="_framework/blazor.server.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
+10
-1
@@ -10,9 +10,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Microsoft.AspNetCore.Localization;
|
||||
using System.Globalization;
|
||||
using Blazorise;
|
||||
using Blazorise.Bootstrap;
|
||||
using Blazorise.Icons.FontAwesome;
|
||||
|
||||
namespace MP.Stats
|
||||
{
|
||||
@@ -76,6 +78,13 @@ namespace MP.Stats
|
||||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddBlazorise(options =>
|
||||
{
|
||||
options.ChangeTextOnKeyPress = true; // optional
|
||||
})
|
||||
.AddBootstrapProviders()
|
||||
.AddFontAwesomeIcons();
|
||||
|
||||
services.AddLocalization();
|
||||
|
||||
services.AddRazorPages();
|
||||
|
||||
@@ -8,3 +8,5 @@
|
||||
@using Microsoft.JSInterop
|
||||
@using MP.Stats
|
||||
@using MP.Stats.Shared
|
||||
@using Blazorise
|
||||
@using Blazorise.Charts
|
||||
Reference in New Issue
Block a user