Files
Disco/Disco.Web/Views/Shared/_JobTableRender.cshtml
T
Gary Sharp a099d68915 Permissions & Authorization for Users #24
Initial Release; Includes Database and MVC refactoring
2013-10-10 19:13:16 +11:00

122 lines
5.2 KiB
Plaintext

@model Disco.Models.BI.Job.JobTableModel
@{
Html.BundleDeferred("~/ClientScripts/Modules/Disco-DataTableHelpers");
}
<div class="jobTable">
@if (Model != null && Model.Items.Count() > 0)
{
<table class="jobTable@(Model.IsSmallTable ? " smallTable" : string.Empty)@(Model.HideClosedJobs ? " hideStatusClosed" : string.Empty)@(Model.EnablePaging ? " enablePaging" : string.Empty)@(Model.EnableFilter ? " enableFilter" : string.Empty)">
<thead>
<tr>
@if (Model.ShowId)
{ <th class="id">Ref
</th> }
@if (Model.ShowStatus)
{ <th class="status">Status
</th> }
@if (Model.ShowDates)
{ <th class="dates">Dates
</th> }
@if (Model.ShowType)
{ <th class="type">Type
</th> }
@if (Model.ShowDevice)
{<th class="device">Device
</th> }
@if (Model.ShowUser)
{ <th class="user">User
</th> }
@if (Model.ShowTechnician)
{ <th class="technician">Technician
</th> }
@if (Model.ShowLocation)
{ <th class="location">Location
</th> }
</tr>
</thead>
<tbody>
@foreach (var item in Model.Items)
{
<tr data-id="@(item.Id)" data-status="@(Model.ShowStatus ? item.StatusId : null)">
@if (Model.ShowId)
{ <td class="id">
@if (Authorization.Has(Claims.Job.Show))
{
@Html.ActionLink(item.Id.ToString(), MVC.Job.Show(item.Id))
}
else
{
@item.Id.ToString()
}
</td> }
@if (Model.ShowStatus)
{ <td class="status">
<span class="icon JobStatus@(item.StatusId)"></span>
@item.StatusDescription
</td> }
@if (Model.ShowDates)
{ <td class="dates">
@CommonHelpers.FriendlyDate(item.OpenedDate)
- @CommonHelpers.FriendlyDate(item.ClosedDate)
</td>}
@if (Model.ShowType)
{ <td class="type">
<span title="@item.TypeDescription">@item.TypeId</span>
</td>}
@if (Model.ShowDevice)
{ <td class="device">
@if (item.DeviceSerialNumber != null)
{
if (Authorization.Has(Claims.Device.Show))
{
@Html.ActionLink(item.DeviceSerialNumber, MVC.Device.Show(item.DeviceSerialNumber), new { Title = item.DeviceModelDescription })
}
else
{
<span title="@item.DeviceModelDescription">@item.DeviceSerialNumber</span>
}
}
else
{
<span class="smallMessage">N/A</span>
}
</td> }
@if (Model.ShowUser)
{<td class="user">
@if (item.UserId != null)
{
if (Authorization.Has(Claims.User.Show))
{
@Html.ActionLink(string.Format("{0} ({1})", item.UserDisplayName, item.UserId), MVC.User.Show(item.UserId))
}
else
{
@(string.Format("{0} ({1})", item.UserDisplayName, item.UserId))
}
}
else
{
<span class="smallMessage">N/A</span>
}
</td>}
@if (Model.ShowTechnician)
{ <td class="technician">
<span title="@item.OpenedTechUserDisplayName">@item.OpenedTechUserId
</span>
</td>}
@if (Model.ShowLocation)
{ <td class="technician">
<span>@(item.Location ?? "Unknown")
</span>
</td>}
</tr>
}
</tbody>
</table>
}
else
{
<span class="smallMessage">No Jobs Found</span>
}
</div>