fix pagina families: gestione elenco, modifica, delete... BOZZA dettaglio child

This commit is contained in:
Samuele E. Locatelli
2016-10-03 18:28:58 +02:00
parent 2f8024eba0
commit f8b004e681
19 changed files with 426 additions and 90 deletions
+69 -5
View File
@@ -305,11 +305,6 @@ namespace StockManMVC
})
.WithRetrieveDataMethod((context) =>
{
//var options = context.QueryOptions;
//string sItemID = options.GetAdditionalQueryOptionString("ItemID");
//if (String.IsNullOrEmpty(sItemID)) sItemID = "0";
//int ItemID = Convert.ToInt32(sItemID);
return new QueryResult<Models.vItemFlux2Save>()
{
Items = vItemFlux2SaveController.Select().ToList(),
@@ -318,6 +313,75 @@ namespace StockManMVC
})
);
//MVCGridDefinitionTable.Add("ItemsByFamGrid", new MVCGridBuilder<Models.Item>(gridDefaults, colDefaults) // aggiungo valori di default...
// .WithSorting(sorting: true, defaultSortColumn: "QtaPend", defaultSortDirection: SortDirection.Dsc)
// .WithAdditionalQueryOptionNames("id")
// //.WithRowCssClassExpression(p => p.QtaCurr == 0 ? "warning" : "") // commentata x ora, poi potrebbe servire...
// .WithQueryStringPrefix("")
// .AddColumns(cols =>
// {
// //Add your columns here
// cols.Add("ViewLink").WithColumnName("ViewLink")
// .WithSorting(false)
// .WithVisibility(true, false)
// .WithAllowChangeVisibility(false)
// .WithHeaderText("<a href='/Items' title='reset'><i class='glyphicon glyphicon-refresh' aria-hidden='true'></i></a>")
// .WithHtmlEncoding(false)
// .WithValueExpression((i, c) => c.UrlHelper.Action("Details", "Items", new { id = i.ID, StockItemID = i.ID, FluxItemID = i.ID }))
// .WithValueTemplate("<a href='{Value}' title='Vedi Dettagli'><i class='glyphicon glyphicon-search' aria-hidden='true'></i></a>");
// cols.Add("CodInt").WithColumnName("CodInt")
// .WithVisibility(false, true)
// .WithHeaderText("Cod. Articolo")
// .WithValueExpression(i => i.CodInt);
// cols.Add("Descr").WithColumnName("Descr")
// .WithHeaderText("Articolo")
// .WithValueExpression(i => i.Descr);
// cols.Add("CodExt").WithColumnName("CodExt")
// .WithVisibility(false, true)
// .WithHeaderText("Cod. Fornitore")
// .WithValueExpression(i => i.CodExt);
// cols.Add("DescrExt").WithColumnName("DescrExt")
// .WithVisibility(false, true)
// .WithHeaderText("Descr. Fornitore")
// .WithValueExpression(i => i.DescrExt);
// cols.Add("QtaMin").WithColumnName("QtaMin")
// .WithVisibility(false, true)
// .WithHeaderText("Qta Minima")
// .WithValueExpression(i => i.QtaMin.ToString());
// cols.Add("QtaBatch").WithColumnName("QtaBatch")
// .WithVisibility(false, true)
// .WithHeaderText("Lotto")
// .WithValueExpression(i => i.QtaBatch.ToString());
// cols.Add("QtaPend").WithColumnName("QtaPend")
// .WithHeaderText("Stock")
// .WithCellCssClassExpression(p => p.QtaPend >= p.QtaMin ? "success text-right" : "danger text-right")
// .WithSortColumnData("QtaPend")
// .WithValueExpression(i => i.QtaPend.ToString());
// cols.Add("CurrValue").WithColumnName("CurrValue")
// .WithVisibility(false, true)
// .WithHeaderText("€/pz")
// .WithValueExpression(i => i.CurrValue.ToString("C2"));
// cols.Add("TotVal").WithColumnName("TotVal")
// .WithVisibility(false, true)
// .WithHeaderText("Valore")
// .WithValueExpression(i => Convert.ToDecimal(i.CurrValue * i.QtaCurr).ToString("C2"));
// })
// .WithRetrieveDataMethod((context) =>
// {
// var options = context.QueryOptions;
// string FamilyID = options.GetAdditionalQueryOptionString("id");
// if (String.IsNullOrEmpty(FamilyID)) FamilyID = "";
// return new QueryResult<Models.Item>()
// {
// Items = ItemsController.SelectFamilyPage(FamilyID, (int)options.PageIndex, (int)options.ItemsPerPage).ToList(),
// TotalRecords = ItemsController.SelectFamilyCount(FamilyID)
// };
// })
// );
}
}
}
+3
View File
@@ -35,6 +35,9 @@ textarea {
.colAlt {
color: #C93;
}
.fontBig {
font-size: 2em;
}
/*------------------------------------------------------------------
[ Shortcuts / .shortcuts ]
*/
+4
View File
@@ -44,6 +44,10 @@ textarea {
color: #C93;
}
.fontBig{
font-size:2em;
}
/*------------------------------------------------------------------
[ Shortcuts / .shortcuts ]
+1 -1
View File
@@ -1 +1 @@
body{padding-top:50px;padding-bottom:20px;}.body-content{padding-left:15px;padding-right:15px;}.dl-horizontal dt{white-space:normal;}input,select,textarea{max-width:280px;}.deleted{text-decoration:line-through;}.padZL{padding-left:.2em;}.padZR{padding-right:.2em;}.padZRL{padding-left:.2em;padding-right:.2em;}.colAlt{color:#c93;}.shortcuts{text-align:center;}.shortcuts .shortcut{min-width:180px;min-height:100px;display:inline-block;padding:13.33333333px 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:10px;}.shortcuts .shortcut-sm{min-width:90px;min-height:60px;display:inline-block;padding:5px 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:10px;}.shortcuts .shortcut .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:40px;color:#333;}.shortcuts .shortcut-sm .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:40px;color:#333;}.shortcuts .shortcut:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0);}.shortcuts .shortcut-sm:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0);}.shortcuts .shortcut:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125);}.shortcuts .shortcut-sm:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125);}.shortcuts .shortcut:hover .shortcut-icon{color:#c93;}.shortcuts .shortcut-sm:hover .shortcut-icon{color:#666;}.shortcuts .shortcut-label{display:block;margin-top:.75em;font-weight:400;color:#666;}
body{padding-top:50px;padding-bottom:20px;}.body-content{padding-left:15px;padding-right:15px;}.dl-horizontal dt{white-space:normal;}input,select,textarea{max-width:280px;}.deleted{text-decoration:line-through;}.padZL{padding-left:.2em;}.padZR{padding-right:.2em;}.padZRL{padding-left:.2em;padding-right:.2em;}.colAlt{color:#c93;}.fontBig{font-size:2em;}.shortcuts{text-align:center;}.shortcuts .shortcut{min-width:180px;min-height:100px;display:inline-block;padding:13.33333333px 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:10px;}.shortcuts .shortcut-sm{min-width:90px;min-height:60px;display:inline-block;padding:5px 0;margin:0 2px 1em;vertical-align:top;text-decoration:none;background:#f3f3f3;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff,0%,#eee,100%);background-image:-moz-linear-gradient(top,#fff 0%,#eee 100%);background-image:linear-gradient(to bottom,#fff 0%,#eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffeeeeee',GradientType=0);border:1px solid #ddd;box-sizing:border-box;border-radius:10px;}.shortcuts .shortcut .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:40px;color:#333;}.shortcuts .shortcut-sm .shortcut-icon{width:100%;margin-top:0;margin-bottom:0;font-size:40px;color:#333;}.shortcuts .shortcut:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0);}.shortcuts .shortcut-sm:hover{background:#e8e8e8;background-image:-webkit-gradient(linear,left 0%,left 100%,from(#fafafa),to(#e1e1e1));background-image:-webkit-linear-gradient(top,#fafafa,0%,#e1e1e1,100%);background-image:-moz-linear-gradient(top,#fafafa 0%,#e1e1e1 100%);background-image:linear-gradient(to bottom,#fafafa 0%,#e1e1e1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffafafa',endColorstr='#ffe1e1e1',GradientType=0);}.shortcuts .shortcut:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125);}.shortcuts .shortcut-sm:active{box-shadow:inset 0 3px 5px rgba(0,0,0,.125);}.shortcuts .shortcut:hover .shortcut-icon{color:#c93;}.shortcuts .shortcut-sm:hover .shortcut-icon{color:#666;}.shortcuts .shortcut-label{display:block;margin-top:.75em;font-weight:400;color:#666;}
@@ -21,8 +21,12 @@ namespace StockManMVC.Controllers
}
// GET: ItemFamilies/Details/5
public ActionResult Details(string id)
public ActionResult Details(string id, string mode)
{
if (mode == null)
{
mode = "full";
}
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
@@ -32,7 +36,15 @@ namespace StockManMVC.Controllers
{
return HttpNotFound();
}
return View(itemFamily);
if (mode == "std")
{
return PartialView(itemFamily);
}
else
{
return View(itemFamily);
}
}
// GET: ItemFamilies/Create
@@ -59,8 +71,13 @@ namespace StockManMVC.Controllers
}
// GET: ItemFamilies/Edit/5
public ActionResult Edit(string id)
public ActionResult Edit(string id, string mode)
{
if (mode == null)
{
mode = "full";
}
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
@@ -70,7 +87,14 @@ namespace StockManMVC.Controllers
{
return HttpNotFound();
}
return View(itemFamily);
if (mode == "std")
{
return PartialView(itemFamily);
}
else
{
return View(itemFamily);
}
}
// POST: ItemFamilies/Edit/5
@@ -90,18 +114,30 @@ namespace StockManMVC.Controllers
}
// GET: ItemFamilies/Delete/5
public ActionResult Delete(string id)
public ActionResult Delete(string id, string mode)
{
if (mode == null)
{
mode = "full";
}
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
ItemFamily itemFamily = db.ItemFamily.Find(id);
ViewBag.mode = mode;
if (itemFamily == null)
{
return HttpNotFound();
}
return View(itemFamily);
if (mode == "std")
{
return PartialView(itemFamily);
}
else
{
return View(itemFamily);
}
}
// POST: ItemFamilies/Delete/5
@@ -201,7 +201,6 @@ namespace StockManMVC.Controllers
ViewBag.LocationID = new SelectList(db.Location.Where(o => o.LocType.IsStock), "ID", "Descr");
ViewBag.MovTypeID = new SelectList(db.MovType, "ID", "Descr", MovTypeID);
ViewBag.ItemID = new SelectList(db.Item, "ID", "Descr", ItemID);
ViewBag.OperatorID = new SelectList(db.Operator, "ID", "CodExt");
// in base al tipo di mov richiesto determino cosa mostrare...
switch (MovTypeID)
{
@@ -244,11 +243,13 @@ namespace StockManMVC.Controllers
string currOpID = "ND"; // default
try
{
Operator currOp = (Operator)db.Operator.Where(o => o.CodExt == User.Identity.Name || o.CodExt.Contains(User.Identity.Name) || o.ID == User.Identity.Name);
var trovato = db.Operator.SingleOrDefault(s => s.CodExt == User.Identity.Name || s.CodExt.Contains(User.Identity.Name) || s.ID == User.Identity.Name);
Operator currOp = (Operator)trovato;
currOpID = currOp.ID;
}
catch
{ }
catch(Exception exc)
{
}
itemFlux.OperatorID = currOpID; //@User.Identity.Name == cod.ext --> user dominio!
// verifico Qta: SE CAR > 0, se SCAR < 0, se MOV / rett libero...
@@ -32,6 +32,17 @@ namespace StockManMVC.Controllers
return answ;
}
/// <summary>
/// Selezione
/// </summary>
/// <param name="SearchVal"></param>
/// <returns></returns>
public static IEnumerable<Item> SelectFamily(string FamilyID)
{
StockManEntities db = new StockManEntities();
var answ = db.Item.Where(s => s.ItemFamilyID == FamilyID);
return answ;
}
/// <summary>
/// Ricerca con selezione parametri
/// </summary>
/// <param name="SearchVal"></param>
@@ -141,6 +152,43 @@ namespace StockManMVC.Controllers
{
return Order(SearchVal, OrderBy, Sort).Skip(startRowIndex * maximumRows).Take(maximumRows);
}
/// <summary>
/// Elenco x famiglia ordine qta desc
/// </summary>
/// <param name="FamilyID"></param>
/// <param name="startRowIndex"></param>
/// <param name="maximumRows"></param>
/// <returns></returns>
public static IEnumerable<Item> SelectFamilyPage(string FamilyID, int startRowIndex, int maximumRows)
{
StockManEntities db = new StockManEntities();
var answ = SelectFamily(FamilyID).OrderByDescending(x => x.QtaPend);
return answ.Skip(startRowIndex * maximumRows).Take(maximumRows);
}
/// <summary>
/// Elenco x famiglia ordine qta desc
/// </summary>
/// <param name="FamilyID"></param>
/// <param name="startRowIndex"></param>
/// <param name="maximumRows"></param>
/// <returns></returns>
public ActionResult ListByFamily(string FamilyID)
{
var item = db.Item;//.Include(i => i.ItemFamily);
if (FamilyID == null) FamilyID = "";
ViewBag.FamilyID = FamilyID;
return PartialView("ListByFamily", item);
}
/// <summary>
/// calcolo num risultati
/// </summary>
/// <param name="SearchVal"></param>
/// <returns></returns>
public static int SelectFamilyCount(string FamilyID)
{
return SelectFamily(FamilyID).Count();
}
// GET: Items/Consolidate/5?caller=callingController
public ActionResult Consolidate(int? id, string caller)
@@ -34,12 +34,12 @@ namespace StockManMVC.Controllers
{
SearchVal = "##########";
}
var answ = db.Operator.Where( s => s.CodExt == SearchVal
|| s.ID ==SearchVal
var answ = db.Operator.Where(s => s.CodExt == SearchVal
|| s.ID == SearchVal
);
return answ;
}
// GET: Operators/Details/5
public ActionResult Details(string id)
{
+1
View File
@@ -22,6 +22,7 @@ namespace StockManMVC.Models
public string ID { get; set; }
public string Descr { get; set; }
public Nullable<int> NumItems { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Item> Item { get; set; }
+8 -2
View File
@@ -107,9 +107,15 @@ namespace StockManMVC.Models
public class ItemFamilyMetadata
{
[Display(Name = "Codice")]
public string ID;
[StringLength(250)]
[Display(Name = "Categoria")]
public string Descr;
[Display(Name = "# Articoli")]
public string NumItems;
}
public class ItemStocksMetadata
@@ -139,10 +145,10 @@ namespace StockManMVC.Models
[DisplayFormat(DataFormatString = "{0:C2}", ApplyFormatInEditMode = true)]
public String TotVal;
[Display(Name = "Tot num Articoli")]
[Display(Name = "Articoli")]
public String NumArt;
[Display(Name = "Giacenza (totale)")]
[Display(Name = "Giacenza (qta tot)")]
public String TotCurr;
[Display(Name = "Mov. aperti")]
+3
View File
@@ -27,6 +27,7 @@
</Key>
<Property Name="ID" Type="nvarchar" MaxLength="50" Nullable="false" />
<Property Name="Descr" Type="nvarchar" MaxLength="50" Nullable="false" />
<Property Name="NumItems" Type="int" StoreGeneratedPattern="Computed" />
</EntityType>
<EntityType Name="ItemFlux">
<Key>
@@ -516,6 +517,7 @@ warning 6002: The table/view 'StockMan.dbo.vLocationVal' does not have a primary
<Property Name="ID" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="Descr" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
<NavigationProperty Name="Item" Relationship="StockManModel.FK_Item_ItemFamily" FromRole="ItemFamily" ToRole="Item" />
<Property Name="NumItems" Type="Int32" annotation:StoreGeneratedPattern="Computed" />
</EntityType>
<EntityType Name="Item">
<Key>
@@ -745,6 +747,7 @@ warning 6002: The table/view 'StockMan.dbo.vLocationVal' does not have a primary
<EntitySetMapping Name="ItemFamily">
<EntityTypeMapping TypeName="StockManModel.ItemFamily">
<MappingFragment StoreEntitySet="ItemFamily">
<ScalarProperty Name="NumItems" ColumnName="NumItems" />
<ScalarProperty Name="Descr" ColumnName="Descr" />
<ScalarProperty Name="ID" ColumnName="ID" />
</MappingFragment>
+1
View File
@@ -445,6 +445,7 @@
<Content Include="Views\Items\_ItemDetail.cshtml" />
<Content Include="Views\Items\Edit.cshtml" />
<Content Include="Views\ItemFluxes\CreatePrecompiled.cshtml" />
<Content Include="Views\Items\ListByFamily.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
+19 -9
View File
@@ -4,12 +4,17 @@
ViewBag.Title = "Delete";
}
<h2>Delete</h2>
<h3>Are you sure you want to delete this?</h3>
@if (ViewBag.mode == "full")
{
<h2>Delete</h2>
}
<h4>Sicuro di voler eliminare questo record?</h4>
<div>
<h4>ItemFamily</h4>
<hr />
@if (ViewBag.mode == "full")
{
<h4>ItemFamily</h4>
<hr />
}
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.Descr)
@@ -21,12 +26,17 @@
</dl>
@using (Html.BeginForm()) {
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-actions no-color">
<input type="submit" value="Delete" class="btn btn-default" /> |
@Html.ActionLink("Back to List", "Index")
<div class="form-actions no-color row">
<div class="col-sm-6">
<button type="submit" value="Delete" class="btn btn-danger form-control">Elimina <i class="glyphicon glyphicon-remove-circle"></i></button>
</div>
<div class="col-sm-6">
<a href="@Url.Action("", "ItemFamilies")" class="btn btn-info form-control">Annulla <i class="glyphicon glyphicon-retweet"></i></a>
</div>
</div>
}
</div>
+27 -20
View File
@@ -1,26 +1,33 @@
@model StockManMVC.Models.ItemFamily
@{
ViewBag.Title = "Details";
ViewBag.Title = "Famiglie Articoli";
}
<h2>Details</h2>
<div>
<h4>ItemFamily</h4>
@if (ViewBag.mode == "full")
{
<h2>Famiglie Articoli</h2>
<hr />
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.Descr)
</dt>
<dd>
@Html.DisplayFor(model => model.Descr)
</dd>
</dl>
}
<div class="panel panel-info">
<div class="panel-heading">
<div class="row">
<div class="col-sm-8">
<strong>@Html.DisplayFor(model => model.Descr)</strong>
</div>
<div class="col-sm-4">
<a href="@Url.Action("", "ItemFamilies")" class="btn btn-info btn-sm">reset <i class="glyphicon glyphicon-retweet"></i></a>
</div>
</div>
</div>
<div class="panel-body small">
@*@Html.Partial("_MVCGridToolbar", new StockManMVC.Models.MVCGridToolbarModel()
{
MVCGridName = "ItemsByFamGrid",
PageSize = true,
ColumnVisibility = false,
Export = false,
GlobalSearch = false
})
@Html.MVCGrid("ItemsByFamGrid")*@
</div>
</div>
<p>
@Html.ActionLink("Edit", "Edit", new { id = Model.ID }) |
@Html.ActionLink("Back to List", "Index")
</p>
+17 -13
View File
@@ -3,17 +3,21 @@
@{
ViewBag.Title = "Edit";
}
<h2>Edit</h2>
@if (ViewBag.mode == "full")
{
<h2>Edit</h2>
}
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>ItemFamily</h4>
<hr />
@if (ViewBag.mode == "full")
{
<h4>ItemFamily</h4>
<hr />
}
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(model => model.ID)
@@ -25,18 +29,18 @@
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
<div class="form-group no-color row">
<div class="col-sm-6">
<button type="submit" value="Save" class="btn btn-primary form-control">Salva modifiche <i class="glyphicon glyphicon-ok-circle"></i></button>
</div>
<div class="col-sm-6">
<a href="@Url.Action("", "ItemFamilies")" class="btn btn-info form-control">Annulla <i class="glyphicon glyphicon-retweet"></i></a>
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
+96 -25
View File
@@ -1,33 +1,104 @@
@model IEnumerable<StockManMVC.Models.ItemFamily>
@{
ViewBag.Title = "Index";
ViewBag.Title = "Famiglie Articoli";
}
<h2>Index</h2>
<div class="row" style="margin-top: 0.5em;">
<div class="col-xs-12">
<div class="panel panel-default">
<div class="panel-heading">
<div class="row">
<div class="col-xs-8">
<strong>Famiglie Articoli</strong>
</div>
<div class="col-xs-4 text-right">
@*@Html.ActionLink("Create New", "Create")*@
<a href="@Url.Action("Create", "ItemFamilies")" class="btn btn-success">
<i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
Aggiunta Nuova Famiglia
</a>
</div>
</div>
</div>
<div class="panel-body small">
<div class="col-xs-4">
<div class="" id="divChild">
@*qui inserisco la partial view...*@
</div>
</div>
<div class="col-xs-5">
<table class="table table-condensed table-responsive table-striped table-hover">
<tr>
<th>
</th>
<th>
@Html.DisplayNameFor(model => model.ID)
</th>
<th>
@Html.DisplayNameFor(model => model.Descr)
</th>
<th>
@Html.DisplayNameFor(model => model.NumItems)
</th>
<th></th>
</tr>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Descr)
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
var delStyle = "";
if (item.NumItems > 0) { delStyle = "disabled"; }
<tr id="@("row_"+item.ID)" class="singleRow">
<td>
<button class="btn btn-sm btn-default" title="Elenco Articoli" onclick="LoadCurrChild('@item.ID');"><i class="glyphicon glyphicon-search"></i></button>
</td>
<td>
@Html.DisplayFor(modelItem => item.ID)
</td>
<td>
@Html.DisplayFor(modelItem => item.Descr)
</td>
<td>
@Html.DisplayFor(modelItem => item.NumItems)
</td>
<td class="text-right">
<button class="btn btn-sm btn-default" title="Modifica" onclick="LoadCurrEdit('@item.ID');"><i class="glyphicon glyphicon-edit"></i></button>
<button class="btn btn-sm btn-default @delStyle" title="Elimina" onclick="LoadCurrDelete('@item.ID');"><i class="glyphicon glyphicon-trash"></i></button>
</td>
</tr>
}
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Descr)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
</td>
</tr>
}
</table>
</div>
<div class="col-xs-3 text-right">
<div class="" id="divCRUD">
@*qui inserisco la partial view...*@
</div>
</div>
</div>
</div>
</div>
</div>
</table>
<script type="text/javascript">
function LoadCurrChild(ID) {
$("#divChild").load('@(Url.Action("ListByFamily", "Items", null, Request.Url.Scheme))?FamilyID=' + ID + '?mode=std');
// fix colore righe tabella
$(".singleRow").removeClass("bg-info");
$("#row_" + ID).addClass("bg-info");
// modifico URL!
//history.replaceState('id=' + ID, 'ItemFamilies', '?id=' + ID)
//history.replaceState('difgFamilyID=' + ID, 'ItemFamilies', '?difgFamilyID=' + ID)
}
function LoadCurrEdit(ID) {
$("#divCRUD").load('@(Url.Action("Edit", "ItemFamilies", null, Request.Url.Scheme))/' + ID + '?mode=std');
//$("#divButtons").hide();
}
function LoadCurrDelete(ID) {
$("#divCRUD").load('@(Url.Action("Delete", "ItemFamilies", null, Request.Url.Scheme))/' + ID + '?mode=std');
//$("#divButtons").hide();
}
</script>
@@ -0,0 +1,79 @@
@model IEnumerable<StockManMVC.Models.Item>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Descr)
</th>
<th>
@Html.DisplayNameFor(model => model.CodInt)
</th>
@*<th>
@Html.DisplayNameFor(model => model.CodExt)
</th>
<th>
@Html.DisplayNameFor(model => model.DescrExt)
</th>
<th>
@Html.DisplayNameFor(model => model.QtaMin)
</th>
<th>
@Html.DisplayNameFor(model => model.QtaBatch)
</th>*@
<th>
@Html.DisplayNameFor(model => model.CurrValue)
</th>
@*<th>
@Html.DisplayNameFor(model => model.QtaCurr)
</th>*@
<th>
@Html.DisplayNameFor(model => model.QtaPend)
</th>
@*<th>
@Html.DisplayNameFor(model => model.ItemFamily.Descr)
</th>
<th></th>*@
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Descr)
</td>
<td>
@Html.DisplayFor(modelItem => item.CodInt)
</td>
@*<td>
@Html.DisplayFor(modelItem => item.CodExt)
</td>
<td>
@Html.DisplayFor(modelItem => item.DescrExt)
</td>
<td>
@Html.DisplayFor(modelItem => item.QtaMin)
</td>
<td>
@Html.DisplayFor(modelItem => item.QtaBatch)
</td>*@
<td>
@Html.DisplayFor(modelItem => item.CurrValue)
</td>
@*<td>
@Html.DisplayFor(modelItem => item.QtaCurr)
</td>*@
<td>
@Html.DisplayFor(modelItem => item.QtaPend)
</td>
@*<td>
@Html.DisplayFor(modelItem => item.ItemFamily.Descr)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
</td>*@
</tr>
}
</table>
-2
View File
@@ -72,9 +72,7 @@
</a>
<ul class="dropdown-menu">
<li>@Html.ActionLink("Test grid 1", "Grid", "Items")</li>
<li>@Html.ActionLink("Test grid 2", "TestGrid", "Items")</li>
<li class="divider"></li>
<li>@Html.ActionLink("Magazzino Articoli", "Index", "ItemStockStatus")</li>
<li>@Html.ActionLink("Stock", "Index", "ItemStocks")</li>
<li>@Html.ActionLink("Flux", "Index", "ItemFluxes")</li>
</ul>
Binary file not shown.