Update location con filtro
mostra TUTTE le posizioni, poi permette di filtrare/selezionare... da completare restyle grafico e verifica partial da rendere hidden ("_")
This commit is contained in:
@@ -18,12 +18,25 @@ namespace StockManMVC.Controllers
|
||||
public ActionResult Index(string LocTypeID)
|
||||
{
|
||||
if (LocTypeID == null) LocTypeID = "";
|
||||
ViewBag.SelLocType = LocTypeID;
|
||||
ViewBag.LocType = new SelectList(db.LocType, "ID", "Descr", LocTypeID);
|
||||
ViewBag.LocTypeID = new SelectList(db.LocType, "ID", "Descr", LocTypeID);
|
||||
var location = db.Location.Include(l => l.LocType);
|
||||
return View(location.ToList());
|
||||
}
|
||||
|
||||
|
||||
// GET: Location/ListByType/LocTypeID
|
||||
public ActionResult ListByType(string LocTypeID)
|
||||
{
|
||||
var CurrLocations = db.Location.Where(s => s.ID != "");
|
||||
if (LocTypeID.ToString() != "")
|
||||
{
|
||||
CurrLocations = db.Location.Where(s => s.LocTypeID == LocTypeID);
|
||||
}
|
||||
|
||||
ViewBag.LocTypeID = LocTypeID;
|
||||
return PartialView("_ListByType", CurrLocations.ToList());
|
||||
}
|
||||
|
||||
// GET: Locations/Details/5
|
||||
public ActionResult Details(string id)
|
||||
{
|
||||
|
||||
@@ -450,6 +450,7 @@
|
||||
<Content Include="Views\Items\ListByFamily.cshtml" />
|
||||
<Content Include="Views\ItemStocks\ListByLocation.cshtml" />
|
||||
<Content Include="Views\Shared\_LoginPartial.cshtml" />
|
||||
<Content Include="Views\Locations\_ListByType.cshtml" />
|
||||
<None Include="Web.IIS01_TK.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</None>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<strong>Configurazione Posizioni</strong>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
@Html.DropDownList("LocType", null, "-- Selezionare --", htmlAttributes: new { @class = "form-control" })
|
||||
@Html.DropDownList("LocTypeID", null, "-- TUTTI --", htmlAttributes: new { @class = "form-control" })
|
||||
</div>
|
||||
<div class="col-xs-4 text-right">
|
||||
<button class="btn btn-sm btn-success" title="Aggiunta nuovo Articolo" onclick="LoadCreateNew();"><i class="glyphicon glyphicon-plus" aria-hidden="true"></i> Aggiunta Nuova Famiglia</button>
|
||||
@@ -22,36 +22,7 @@
|
||||
</div>
|
||||
<div class="panel-body small">
|
||||
<div id="mainDiv" class="col-xs-12">
|
||||
<table class="table table-condensed table-responsive table-striped table-hover table-bordered">
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Descr)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.LocType.Descr)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
var delStyle = "";
|
||||
if (item.ItemFlux.Count + item.ItemFlux1.Count > 0) { delStyle = "disabled invisible"; }
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Descr)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LocType.Descr)
|
||||
</td>
|
||||
<td class="text-right" style="width: 7em;">
|
||||
<button class="btn btn-sm btn-primary" title="Modifica" onclick="LoadCurrEdit('@item.ID');"><i class="glyphicon glyphicon-edit"></i></button>
|
||||
<button class="btn btn-sm btn-danger @delStyle" title="Elimina" onclick="LoadCurrDelete('@item.ID');"><i class="glyphicon glyphicon-trash"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
</table>
|
||||
@Html.Partial("_ListByType")
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<div class="" id="divChild">
|
||||
@@ -65,14 +36,14 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
function refreshSelectedData() {
|
||||
var LocType = $("#LocType").val();
|
||||
$("#divLocation").load('@(Url.Action("LocationByType", "Locations", null, Request.Url.Scheme))?LocType=' + LocType);
|
||||
var LocTypeID = $("#LocTypeID").val();
|
||||
$("#mainDiv").load('@(Url.Action("ListByType", "Locations", null, Request.Url.Scheme))?LocTypeID=' + LocTypeID);
|
||||
|
||||
// modifico URL!
|
||||
history.replaceState('LocType=' + LocType, 'Locations', '?LocType=' + LocType)
|
||||
history.replaceState('LocTypeID=' + LocTypeID, 'Locations', '?LocTypeID=' + LocTypeID)
|
||||
}
|
||||
$(document).ready(function () {
|
||||
$("#LocType").change(function () {
|
||||
$("#LocTypeID").change(function () {
|
||||
refreshSelectedData();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
@model IEnumerable<StockManMVC.Models.Location>
|
||||
|
||||
<table class="table table-condensed table-responsive table-striped table-hover table-bordered">
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Descr)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.LocType.Descr)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
var delStyle = "";
|
||||
if (item.ItemFlux.Count + item.ItemFlux1.Count > 0) { delStyle = "disabled invisible"; }
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Descr)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LocType.Descr)
|
||||
</td>
|
||||
<td class="text-right" style="width: 7em;">
|
||||
<button class="btn btn-sm btn-primary" title="Modifica" onclick="LoadCurrEdit('@item.ID');"><i class="glyphicon glyphicon-edit"></i></button>
|
||||
<button class="btn btn-sm btn-danger @delStyle" title="Elimina" onclick="LoadCurrDelete('@item.ID');"><i class="glyphicon glyphicon-trash"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
Binary file not shown.
Reference in New Issue
Block a user