EnVisageOnline/Main/Source/EnVisage/Views/ScenarioGroup/Index.cshtml

66 lines
2.4 KiB
Plaintext

@using EnVisage.Code.HtmlHelpers
@using Microsoft.AspNet.Identity
@using EnVisage.Code
@{
ViewBag.Title = "Scenario Groups";
}
@section scripts
{
<script type="text/javascript">
var ctr = 0;
init.push(function () {
$('#scenariogroup').dataTable({
"bProcessing": true,
"bServerSide": true,
"bAutoWidth" : false,
"sAjaxSource": document.URL,
"sServerMethod": "POST",
"aoColumns": [
{ "mDataProp": "Name" },
{
"mData": function (data, type, full) {
@if (SecurityManager.CheckSecurityObjectPermission(Areas.Scenarios, AccessLevel.Write))
{
<text>
ctr++;
return ('<a id="btnEdit' + ctr + '" onclick="return CheckLock(this.id, \'ScenarioGroup\', \'_rplcmnt_\')" data-toggle="popover" data-placement="left" ' + 'class="btn btn-sm btn-primary popover-warning popover-dark" href="@Url.Action("Edit", "ScenarioGroup", new {@id = "_rplcmnt_"})"><i class="fa fa-edit"></i> Edit</a> ' +
'<a id="btnDelete' + ctr + '" onclick="return CheckLock(this.id, \'ScenarioGroup\', \'_rplcmnt_\')" data-toggle="popover" data-placement="left" class="btn btn-sm btn-danger popover-warning popover-dark" href="@Url.Action("Delete", "ScenarioGroup", new {@id = "_rplcmnt_"})" ><i class="fa fa-trash-o"></i> Delete</a>')
.replace(/_rplcmnt_/g, data.Id);
</text>
}
else
{
<text>
return "";
</text>
}
}
}],
});
@if (SecurityManager.CheckSecurityObjectPermission(Areas.Scenarios, AccessLevel.Write))
{
<text>
$('#scenariogroup_wrapper .table-caption').html('<a class="btn btn-primary" href="@Url.Action("Edit", "ScenarioGroup")"><i class="fa fa-plus"></i> Add Scenario Group</a>');
</text>
}
$('#scenariogroup_wrapper .dataTables_filter input').attr('placeholder', 'Search...');
$('#scenariogroup_wrapper .dataTables_processing').addClass("table-caption");
$('#scenariogroup_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="scenariogroup">
<thead>
<tr>
<th>
Group Name
</th>
<th></th>
</tr>
</thead>
</table>
</div>