Aggiunta gestione (standardizzata) dell'anagrafica operatore...

This commit is contained in:
Samuele E. Locatelli
2016-10-06 10:44:12 +02:00
parent 0558519ff1
commit ff4e276eb2
10 changed files with 249 additions and 218 deletions
+39 -23
View File
@@ -19,9 +19,7 @@ namespace StockManMVC.Controllers
{
return View(db.Operator.ToList());
}
/// <summary>
/// Selezione operatore da ricerca chiave...
/// </summary>
@@ -40,25 +38,21 @@ namespace StockManMVC.Controllers
return answ;
}
// GET: Operators/Details/5
public ActionResult Details(string id)
// GET: Operators/Create (mode=std|full, opzionale)
public ActionResult Create(string mode)
{
if (id == null)
if (mode == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
mode = "full";
}
Operator @operator = db.Operator.Find(id);
if (@operator == null)
if (mode == "std")
{
return HttpNotFound();
return PartialView();
}
else
{
return View();
}
return View(@operator);
}
// GET: Operators/Create
public ActionResult Create()
{
return View();
}
// POST: Operators/Create
@@ -78,9 +72,13 @@ namespace StockManMVC.Controllers
return View(@operator);
}
// GET: Operators/Edit/5
public ActionResult Edit(string id)
// GET: Operators/Edit/5 (mode=std|full, opzionale)
public ActionResult Edit(string id, string mode)
{
if (mode == null)
{
mode = "full";
}
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
@@ -90,7 +88,14 @@ namespace StockManMVC.Controllers
{
return HttpNotFound();
}
return View(@operator);
if (mode == "std")
{
return PartialView(@operator);
}
else
{
return View(@operator);
}
}
// POST: Operators/Edit/5
@@ -109,9 +114,13 @@ namespace StockManMVC.Controllers
return View(@operator);
}
// GET: Operators/Delete/5
public ActionResult Delete(string id)
// GET: Operators/Delete/5 (mode=std|full, opzionale)
public ActionResult Delete(string id, string mode)
{
if (mode == null)
{
mode = "full";
}
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
@@ -121,7 +130,14 @@ namespace StockManMVC.Controllers
{
return HttpNotFound();
}
return View(@operator);
if (mode == "std")
{
return PartialView(@operator);
}
else
{
return View(@operator);
}
}
// POST: Operators/Delete/5
-1
View File
@@ -420,7 +420,6 @@
<Content Include="Views\Items\Index.cshtml" />
<Content Include="Views\Operators\Create.cshtml" />
<Content Include="Views\Operators\Delete.cshtml" />
<Content Include="Views\Operators\Details.cshtml" />
<Content Include="Views\Operators\Edit.cshtml" />
<Content Include="Views\Operators\Index.cshtml" />
<Content Include="Views\ItemFluxes\Create.cshtml" />
+1 -1
View File
@@ -44,7 +44,7 @@
MVCGridName = "ItemsGrid",
PageSize = true,
ColumnVisibility = true,
Export = true,
Export = false,
GlobalSearch = true
})
@Html.MVCGrid("ItemsGrid")
+1 -1
View File
@@ -1,7 +1,7 @@
@model StockManMVC.Models.Location
@{
ViewBag.Title = "Create";
ViewBag.Title = "Nuova Posizione";
}
@using (Html.BeginForm())
+46 -44
View File
@@ -1,64 +1,66 @@
@model StockManMVC.Models.Operator
@{
ViewBag.Title = "Create";
ViewBag.Title = "Nuovo Operatore";
}
<h2>Create</h2>
@using (Html.BeginForm())
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Operator</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.ID, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.ID, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.ID, "", new { @class = "text-danger" })
</div>
<div class="panel panel-success">
<div class="panel-heading">
<strong>Crea nuovo Operatore</strong>
</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="panel-body">
<div class="form-horizontal">
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.ID, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.ID, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.ID, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.LastName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.LastName, "", 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.FirstName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.FirstName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.FirstName, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.LastName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.LastName, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.FirstName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.FirstName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.FirstName, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group no-color row">
<div class="col-sm-6">
<button type="submit" value="Create" class="btn btn-success form-control">Crea nuovo <i class="glyphicon glyphicon-ok-circle"></i></button>
</div>
<div class="col-sm-6">
<a href="@Url.Action("", "Operators")" class="btn btn-info form-control">Annulla <i class="glyphicon glyphicon-retweet"></i></a>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
+41 -32
View File
@@ -1,48 +1,57 @@
@model StockManMVC.Models.Operator
@{
ViewBag.Title = "Delete";
ViewBag.Title = "Delete Operatore";
}
<h2>Delete</h2>
<div class="panel panel-danger">
<div class="panel-heading">
<strong>Eliminazione record</strong>
</div>
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>Operator</h4>
<hr />
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.CodExt)
</dt>
<div class="panel-body">
<h4>Sicuro di voler eliminare questo record?</h4>
<div>
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.CodExt)
</dt>
<dd>
@Html.DisplayFor(model => model.CodExt)
</dd>
<dd>
@Html.DisplayFor(model => model.CodExt)
</dd>
<dt>
@Html.DisplayNameFor(model => model.LastName)
</dt>
<dt>
@Html.DisplayNameFor(model => model.LastName)
</dt>
<dd>
@Html.DisplayFor(model => model.LastName)
</dd>
<dd>
@Html.DisplayFor(model => model.LastName)
</dd>
<dt>
@Html.DisplayNameFor(model => model.FirstName)
</dt>
<dt>
@Html.DisplayNameFor(model => model.FirstName)
</dt>
<dd>
@Html.DisplayFor(model => model.FirstName)
</dd>
<dd>
@Html.DisplayFor(model => model.FirstName)
</dd>
</dl>
</dl>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@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("", "Operators")" class="btn btn-info form-control">Annulla <i class="glyphicon glyphicon-retweet"></i></a>
</div>
</div>
}
</div>
}
</div>
</div>
@@ -1,42 +0,0 @@
@model StockManMVC.Models.Operator
@{
ViewBag.Title = "Details";
}
<h2>Details</h2>
<div>
<h4>Operator</h4>
<hr />
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.CodExt)
</dt>
<dd>
@Html.DisplayFor(model => model.CodExt)
</dd>
<dt>
@Html.DisplayNameFor(model => model.LastName)
</dt>
<dd>
@Html.DisplayFor(model => model.LastName)
</dd>
<dt>
@Html.DisplayNameFor(model => model.FirstName)
</dt>
<dd>
@Html.DisplayFor(model => model.FirstName)
</dd>
</dl>
</div>
<p>
@Html.ActionLink("Edit", "Edit", new { id = Model.ID }) |
@Html.ActionLink("Back to List", "Index")
</p>
+38 -37
View File
@@ -4,55 +4,56 @@
ViewBag.Title = "Edit";
}
<h2>Edit</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Operator</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(model => model.ID)
<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 class="panel panel-primary">
<div class="panel-heading">
<strong>Modifica Operatore</strong>
</div>
<div class="form-group">
@Html.LabelFor(model => model.LastName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.LastName, "", new { @class = "text-danger" })
</div>
</div>
<div class="panel-body">
<div class="form-horizontal">
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(model => model.ID)
<div class="form-group">
@Html.LabelFor(model => model.FirstName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.FirstName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.FirstName, "", 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">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
<div class="form-group">
@Html.LabelFor(model => model.LastName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.LastName, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.FirstName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.FirstName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.FirstName, "", 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-primary form-control">Salva modifiche <i class="glyphicon glyphicon-ok-circle"></i></button>
</div>
<div class="col-sm-6">
<a href="@Url.Action("", "Operators")" class="btn btn-info form-control">Annulla <i class="glyphicon glyphicon-retweet"></i></a>
</div>
</div>
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
+83 -37
View File
@@ -1,45 +1,91 @@
@model IEnumerable<StockManMVC.Models.Operator>
@{
ViewBag.Title = "Index";
ViewBag.Title = "COnfigurazione Operatori";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.CodExt)
</th>
<th>
@Html.DisplayNameFor(model => model.LastName)
</th>
<th>
@Html.DisplayNameFor(model => model.FirstName)
</th>
<th></th>
</tr>
<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>Configurazione Operatori</strong>
</div>
<div class="col-xs-4 text-right">
<button class="btn btn-sm btn-success" title="Aggiunta nuovo Operatore" onclick="LoadCreateNew();"><i class="glyphicon glyphicon-plus" aria-hidden="true"></i> Aggiunta Operatore</button>
</div>
</div>
</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.CodExt)
</th>
<th>
@Html.DisplayNameFor(model => model.LastName)
</th>
<th>
@Html.DisplayNameFor(model => model.FirstName)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.CodExt)
</td>
<td>
@Html.DisplayFor(modelItem => item.LastName)
</td>
<td>
@Html.DisplayFor(modelItem => item.FirstName)
</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>
}
@foreach (var item in Model)
{
var delStyle = "";
if (item.ItemFlux.Count > 0 || item.ID == "ND") { delStyle = "disabled invisible"; }
<tr>
<td>
@Html.DisplayFor(modelItem => item.CodExt)
</td>
<td>
@Html.DisplayFor(modelItem => item.LastName)
</td>
<td>
@Html.DisplayFor(modelItem => item.FirstName)
</td>
<td>
<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>
</table>
</div>
<div class="col-xs-6">
<div class="" id="divChild">
@*qui inserisco la partial view...*@
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function LoadCreateNew() {
reduceMainDiv();
$("#divChild").load('@(Url.Action("Create", "Operators", null, Request.Url.Scheme))?mode=std');
}
function LoadCurrEdit(ID) {
reduceMainDiv();
$("#divChild").load('@(Url.Action("Edit", "Operators", null, Request.Url.Scheme))/' + ID + '?mode=std');
}
function LoadCurrDelete(ID) {
reduceMainDiv();
$("#divChild").load('@(Url.Action("Delete", "Operators", null, Request.Url.Scheme))/' + ID + '?mode=std');
}
function reduceMainDiv() {
$("#mainDiv").removeClass("col-xs-12");
$("#mainDiv").addClass("col-xs-6");
}
</script>
Binary file not shown.