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();
|
||||
|
||||
OwnedMachine ownedMachine = await _context.OwnedMachines
|
||||
.Include(o => o.Machine).FirstOrDefaultAsync(m => m.Id == id);
|
||||
OwnedMachineViewModel ownedMachine = await _context.OwnedMachines
|
||||
.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();
|
||||
|
||||
return View(ownedMachine);
|
||||
|
||||
@@ -13,5 +13,23 @@ namespace cicm_web.Areas.Admin.Models
|
||||
public StatusType Status { get; set; }
|
||||
public string Machine { 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";
|
||||
@@ -7,7 +7,7 @@
|
||||
<h1>Details</h1>
|
||||
|
||||
<div>
|
||||
<h4>OwnedMachine</h4>
|
||||
<h4>Owned machine</h4>
|
||||
<hr />
|
||||
<dl class="row">
|
||||
<dt class="col-sm-2">
|
||||
@@ -20,7 +20,7 @@
|
||||
@Html.DisplayNameFor(model => model.LostDate)
|
||||
</dt>
|
||||
<dd class="col-sm-10">
|
||||
@Html.DisplayFor(model => model.LostDate)
|
||||
@Html.DisplayFor(model => model.LostDateDisplay)
|
||||
</dd>
|
||||
<dt class="col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Status)
|
||||
@@ -32,7 +32,7 @@
|
||||
@Html.DisplayNameFor(model => model.LastStatusDate)
|
||||
</dt>
|
||||
<dd class="col-sm-10">
|
||||
@Html.DisplayFor(model => model.LastStatusDate)
|
||||
@Html.DisplayFor(model => model.LastStatusDateDisplay)
|
||||
</dd>
|
||||
<dt class="col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Trade)
|
||||
@@ -68,11 +68,24 @@
|
||||
@Html.DisplayNameFor(model => model.Machine)
|
||||
</dt>
|
||||
<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>
|
||||
</dl>
|
||||
</div>
|
||||
<div>
|
||||
<a asp-action="Edit" asp-route-id="@Model.Id">Edit</a> |
|
||||
<a asp-action="Index">Back to List</a>
|
||||
<a asp-action="Edit"
|
||||
asp-route-id="@Model.Id"
|
||||
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">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<Version>3.0.99.681</Version>
|
||||
<Version>3.0.99.684</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
|
||||
Reference in New Issue
Block a user