mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Implement details owned machine admin page.
This commit is contained in:
@@ -46,8 +46,24 @@ namespace cicm_web.Areas.Admin.Controllers
|
|||||||
{
|
{
|
||||||
if(id == null) return NotFound();
|
if(id == null) return NotFound();
|
||||||
|
|
||||||
OwnedMachine ownedMachine = await _context.OwnedMachines
|
OwnedMachineViewModel ownedMachine = await _context.OwnedMachines
|
||||||
.Include(o => o.Machine).FirstOrDefaultAsync(m => m.Id == id);
|
.Include(o => o.Machine)
|
||||||
|
.Select(o => new OwnedMachineViewModel
|
||||||
|
{
|
||||||
|
AcquisitionDate = o.AcquisitionDate,
|
||||||
|
Boxed = o.Boxed,
|
||||||
|
LastStatusDate = o.LastStatusDate,
|
||||||
|
LostDate = o.LostDate,
|
||||||
|
Machine =
|
||||||
|
$"{o.Machine.Company.Name} {o.Machine.Name}",
|
||||||
|
Manuals = o.Manuals,
|
||||||
|
SerialNumber = o.SerialNumber,
|
||||||
|
SerialNumberVisible =
|
||||||
|
o.SerialNumberVisible,
|
||||||
|
Status = o.Status,
|
||||||
|
User = o.User.UserName,
|
||||||
|
Id = o.Id
|
||||||
|
}).FirstOrDefaultAsync(m => m.Id == id);
|
||||||
if(ownedMachine == null) return NotFound();
|
if(ownedMachine == null) return NotFound();
|
||||||
|
|
||||||
return View(ownedMachine);
|
return View(ownedMachine);
|
||||||
|
|||||||
@@ -9,9 +9,27 @@ namespace cicm_web.Areas.Admin.Models
|
|||||||
{
|
{
|
||||||
[DataType(DataType.Date)]
|
[DataType(DataType.Date)]
|
||||||
[DisplayName("Acquired")]
|
[DisplayName("Acquired")]
|
||||||
public DateTime AcquisitionDate { get; set; }
|
public DateTime AcquisitionDate { get; set; }
|
||||||
public StatusType Status { get; set; }
|
public StatusType Status { get; set; }
|
||||||
public string Machine { get; set; }
|
public string Machine { get; set; }
|
||||||
public string User { get; set; }
|
public string User { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Date when sold, traded, or otherwise lost")]
|
||||||
|
public DateTime? LostDate { get; set; }
|
||||||
|
[DisplayName("Last status check date")]
|
||||||
|
public DateTime? LastStatusDate { get; set; }
|
||||||
|
[DisplayName("Available for trade or sale")]
|
||||||
|
public bool Trade { get; set; }
|
||||||
|
[DisplayName("Has original boxes")]
|
||||||
|
public bool Boxed { get; set; }
|
||||||
|
[DisplayName("Has original manuals")]
|
||||||
|
public bool Manuals { get; set; }
|
||||||
|
[DisplayName("Serial number")]
|
||||||
|
public string SerialNumber { get; set; }
|
||||||
|
[DisplayName("Serial number visible to other users")]
|
||||||
|
public bool SerialNumberVisible { get; set; }
|
||||||
|
|
||||||
|
public string LostDateDisplay => LostDate?.ToLongDateString() ?? "Never";
|
||||||
|
public string LastStatusDateDisplay => LastStatusDate?.ToLongDateString() ?? "Never";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
@model Cicm.Database.Models.OwnedMachine
|
@model cicm_web.Areas.Admin.Models.OwnedMachineViewModel
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Details";
|
ViewData["Title"] = "Details";
|
||||||
@@ -7,72 +7,85 @@
|
|||||||
<h1>Details</h1>
|
<h1>Details</h1>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h4>OwnedMachine</h4>
|
<h4>Owned machine</h4>
|
||||||
<hr />
|
<hr />
|
||||||
<dl class="row">
|
<dl class="row">
|
||||||
<dt class = "col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.AcquisitionDate)
|
@Html.DisplayNameFor(model => model.AcquisitionDate)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class = "col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.AcquisitionDate)
|
@Html.DisplayFor(model => model.AcquisitionDate)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class = "col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.LostDate)
|
@Html.DisplayNameFor(model => model.LostDate)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class = "col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.LostDate)
|
@Html.DisplayFor(model => model.LostDateDisplay)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class = "col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.Status)
|
@Html.DisplayNameFor(model => model.Status)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class = "col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.Status)
|
@Html.DisplayFor(model => model.Status)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class = "col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.LastStatusDate)
|
@Html.DisplayNameFor(model => model.LastStatusDate)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class = "col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.LastStatusDate)
|
@Html.DisplayFor(model => model.LastStatusDateDisplay)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class = "col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.Trade)
|
@Html.DisplayNameFor(model => model.Trade)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class = "col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.Trade)
|
@Html.DisplayFor(model => model.Trade)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class = "col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.Boxed)
|
@Html.DisplayNameFor(model => model.Boxed)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class = "col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.Boxed)
|
@Html.DisplayFor(model => model.Boxed)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class = "col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.Manuals)
|
@Html.DisplayNameFor(model => model.Manuals)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class = "col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.Manuals)
|
@Html.DisplayFor(model => model.Manuals)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class = "col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.SerialNumber)
|
@Html.DisplayNameFor(model => model.SerialNumber)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class = "col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.SerialNumber)
|
@Html.DisplayFor(model => model.SerialNumber)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class = "col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.SerialNumberVisible)
|
@Html.DisplayNameFor(model => model.SerialNumberVisible)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class = "col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.SerialNumberVisible)
|
@Html.DisplayFor(model => model.SerialNumberVisible)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class = "col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.Machine)
|
@Html.DisplayNameFor(model => model.Machine)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class = "col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.Machine.Name)
|
@Html.DisplayFor(model => model.Machine)
|
||||||
|
</dd>
|
||||||
|
<dt class="col-sm-2">
|
||||||
|
@Html.DisplayNameFor(model => model.User)
|
||||||
|
</dt>
|
||||||
|
<dd class="col-sm-10">
|
||||||
|
@Html.DisplayFor(model => model.User)
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a asp-action="Edit" asp-route-id="@Model.Id">Edit</a> |
|
<a asp-action="Edit"
|
||||||
<a asp-action="Index">Back to List</a>
|
asp-route-id="@Model.Id"
|
||||||
</div>
|
class="btn btn-primary">
|
||||||
|
Edit
|
||||||
|
</a>
|
||||||
|
<a asp-action="Index"
|
||||||
|
class="btn btn-secondary">
|
||||||
|
Back to List
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||||
<Version>3.0.99.681</Version>
|
<Version>3.0.99.684</Version>
|
||||||
<Company>Canary Islands Computer Museum</Company>
|
<Company>Canary Islands Computer Museum</Company>
|
||||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||||
<Product>Canary Islands Computer Museum Website</Product>
|
<Product>Canary Islands Computer Museum Website</Product>
|
||||||
|
|||||||
Reference in New Issue
Block a user