EnVisageOnline/Beta/Source/EnVisage/Views/Status/Index.cshtml

83 lines
3.0 KiB
Plaintext

@using EnVisage.Code.HtmlHelpers
@using Microsoft.AspNet.Identity
@using EnVisage.Code
@{
ViewBag.Title = "Project Statuses";
}
@section scripts
{
<script type="text/javascript">
var ctr = 0;
init.push(function () {
$('#status').dataTable({
"bProcessing": true,
"bServerSide": true,
"bAutoWidth" : false,
"sAjaxSource": document.URL,
"sServerMethod": "POST",
"aoColumns": [
{ "mDataProp": "Name" },
{ "mDataProp": "Color" },
{ "mDataProp": "ProjectsCount" },
{ "mDataProp": "Probability100"},
{
"mData": function (data, type, full) {
@if (Html.CheckSecurityObjectPermission(Areas.ProjectStatuses, AccessLevel.Write))
{
<text>
ctr++;
return ('<a id="btnEdit' + ctr + '" onclick="return CheckLock(this.id, \'Project Statuses\', \'_rplcmnt_\')" data-toggle="popover" data-placement="left" ' + 'class="btn btn-sm btn-primary popover-warning popover-dark" href="@Url.Action("Edit", "Status", new {@id = "_rplcmnt_"})"><i class="fa fa-edit"></i> Edit</a> ' +
'<a id="btnDelete' + ctr + '" onclick="return CheckLock(this.id, \'Project Statuses\', \'_rplcmnt_\')" data-toggle="popover" data-placement="left" ' + (data.ProjectsCount > 0 ? 'class="btn btn-sm btn-danger popover-warning popover-dark disabled" href="javascript:void(0);"' : 'class="btn btn-sm btn-danger popover-warning popover-dark" href="@Url.Action("Delete", "Status", new {@id = "_rplcmnt_"})"') + ' ><i class="fa fa-trash-o"></i> Delete</a>')
.replace(/_rplcmnt_/g, data.Id);
</text>
}
else
{
<text>
return "";
</text>
}
}
}],
"fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
var tdColor = $('td:eq(1)', nRow).html();
if(tdColor != null && tdColor != "")
$('td:eq(1)', nRow).html("<div class='colorDetails' style='background-color:#" + tdColor + "'>&nbsp;</div>");
}
});
@if (Html.CheckSecurityObjectPermission(Areas.ProjectStatuses, AccessLevel.Write))
{
<text>
$('#status_wrapper .table-caption').html('<a class="btn btn-primary" href="@Url.Action("Edit", "Status")"><i class="fa fa-plus"></i> Add Status</a>');
</text>
}
$('#status_wrapper .dataTables_filter input').attr('placeholder', 'Search...');
$('#status_wrapper .dataTables_processing').addClass("table-caption");
$('#status_wrapper .dataTables_processing').html('<span class="h3"><img class="valign-middle" src="../Content/images/loadFA.gif"/></span>');
});
</script>
}
<div class="table-light table-responsive">
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="status">
<thead>
<tr>
<th>
Status
</th>
<th>
Color
</th>
<th>
Number of Projects
</th>
<th>
100% probability
</th>
<th></th>
</tr>
</thead>
</table>
</div>