fix parziale: levati errori e rimanda (x items) a pagina COMPLETA (non partial) x gestione errori...
This commit is contained in:
@@ -256,7 +256,6 @@ namespace StockManMVC.Controllers
|
||||
}
|
||||
|
||||
|
||||
|
||||
// GET: Items/Create
|
||||
public ActionResult Create()
|
||||
{
|
||||
@@ -332,9 +331,13 @@ namespace StockManMVC.Controllers
|
||||
db.Entry(item).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Details", "Items", new { ID = item.ID, StockItemID = item.ID, FluxItemID = item.ID });
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
ViewBag.ItemFamilyID = new SelectList(db.ItemFamily, "ID", "Descr", item.ItemFamilyID);
|
||||
return View(item);
|
||||
return View("Edit", item);
|
||||
}
|
||||
|
||||
// GET: Items/Delete/5
|
||||
|
||||
@@ -129,4 +129,24 @@ namespace StockManMVC.Models
|
||||
[Display(Name = "Mov. aperti")]
|
||||
public String TotPend;
|
||||
}
|
||||
|
||||
public class OperatorMetadata
|
||||
{
|
||||
[Display(Name = "ID interno")]
|
||||
[Required]
|
||||
public String ID;
|
||||
|
||||
[Display(Name = "ID esterno")]
|
||||
[Required]
|
||||
public String CodExt;
|
||||
|
||||
[Display(Name = "Cognome")]
|
||||
[Required]
|
||||
public String LastName;
|
||||
|
||||
[Display(Name = "Nome")]
|
||||
[Required]
|
||||
public String FirstName;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,4 +39,10 @@ namespace StockManMVC.Models
|
||||
public partial class ItemFamily
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[MetadataType(typeof(OperatorMetadata))]
|
||||
public partial class Operator
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -441,6 +441,7 @@
|
||||
<Content Include="Views\MagStatus\_StockByLocation.cshtml" />
|
||||
<Content Include="Views\MagStatus\_confirmMove.cshtml" />
|
||||
<Content Include="Views\Items\_ItemDetail.cshtml" />
|
||||
<Content Include="Views\Items\Edit.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
@model StockManMVC.Models.Item
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Edit";
|
||||
}
|
||||
|
||||
<h2>Edit</h2>
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>Articolo</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
@Html.HiddenFor(model => model.ID)
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.ItemFamily.Descr, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.DropDownList("ItemFamilyID", null, htmlAttributes: new { @class = "form-control" })
|
||||
@Html.ValidationMessageFor(model => model.ItemFamilyID, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.Descr, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.Descr, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.Descr, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.CodInt, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.CodInt, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.CodInt, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.CodExt, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.CodExt, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.CodExt, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.DescrExt, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.DescrExt, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.DescrExt, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.QtaMin, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.QtaMin, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.QtaMin, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.QtaBatch, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.QtaBatch, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.QtaBatch, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.CurrValue, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.CurrValue, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.CurrValue, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group no-color row">
|
||||
<div class="col-sm-6">
|
||||
<button type="submit" value="Save" class="btn btn-sm btn-primary form-control">Salva Modifiche <i class="glyphicon glyphicon-ok-circle"></i></button>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<a href="@Url.Action("Details", "Items", new { id=Model.ID, StockItemID= Model.ID, FluxItemID= Model.ID })" class="btn btn-sm btn-info form-control">Torna ad Articolo <i class="glyphicon glyphicon-retweet"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
}
|
||||
|
||||
@section Scripts {
|
||||
@Scripts.Render("~/bundles/jqueryval")
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
|
||||
<div class="form-horizontal">
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
@Html.HiddenFor(model => model.ID)
|
||||
@@ -89,6 +89,17 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$("form").validate({
|
||||
|
||||
submitHandler: function (form) {
|
||||
alert("This is a valid form!");
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@section Scripts {
|
||||
@Scripts.Render("~/bundles/jqueryval")
|
||||
}
|
||||
|
||||
@@ -100,10 +100,12 @@
|
||||
@Scripts.Render("~/bundles/bootstrap")
|
||||
<!-- Code to wire up your DatePicker -->
|
||||
<script type="text/javascript">
|
||||
//$(function () {
|
||||
// // This will make every element with the class "date-picker" into a DatePicker element
|
||||
// $('.date-picker').datepicker();
|
||||
//})
|
||||
// fix globalize!
|
||||
Globalize.locale("it");
|
||||
var culture = "it";
|
||||
Globalize(culture);
|
||||
|
||||
// fix datekeeper
|
||||
if (!Modernizr.inputtypes.date) {
|
||||
$('input[type=date]').datepicker({
|
||||
// Consistent format with the HTML5 picker
|
||||
@@ -121,36 +123,6 @@
|
||||
@Scripts.Render("~/bundles/jqueryval")
|
||||
|
||||
|
||||
@*<script type="text/javascript">
|
||||
$("form").validate({
|
||||
|
||||
showErrors: function (errorMap, errorList) {
|
||||
|
||||
// Clean up any tooltips for valid elements
|
||||
$.each(this.validElements(), function (index, element) {
|
||||
var $element = $(element);
|
||||
|
||||
$element.data("title", "") // Clear the title - there is no error associated anymore
|
||||
.removeClass("error")
|
||||
.tooltip("destroy");
|
||||
});
|
||||
|
||||
// Create new tooltips for invalid elements
|
||||
$.each(errorList, function (index, error) {
|
||||
var $element = $(error.element);
|
||||
|
||||
$element.tooltip("destroy") // Destroy any pre-existing tooltip so we can repopulate with new tooltip content
|
||||
.data("title", error.message)
|
||||
.addClass("error")
|
||||
.tooltip(); // Create a new tooltip based on the error messsage we just set in the title
|
||||
});
|
||||
},
|
||||
|
||||
submitHandler: function (form) {
|
||||
alert("This is a valid form!");
|
||||
}
|
||||
});
|
||||
</script>*@
|
||||
@RenderSection("scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user