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

72 lines
2.8 KiB
Plaintext

@using EnVisage.Code.HtmlHelpers
@using Microsoft.AspNet.Identity
@using EnVisage.Code
@{
ViewBag.Title = "Cost Centers";
}
@section scripts
{
<script type="text/javascript">
var ctr = 0;
init.push(function () {
$('#creditDepartment').dataTable({
"bProcessing": true,
"bServerSide": true,
"bAutoWidth" : false,
"sAjaxSource": document.URL,
"sServerMethod": "POST",
"aoColumns": [
{ "mDataProp": "Name" },
{ "mDataProp": "CreditNumber" },
{ "mDataProp": "ExpenditureCount" },
{
"mData": function (data, type, full) {
@if (SecurityManager.CheckSecurityObjectPermission(Areas.CreditDepartments, AccessLevel.Write))
{
<text>
ctr++;
return ('<a id="btnEdit' + ctr + '" onclick="return CheckLock(this.id, \'CreditDepartment\', \'_rplcmnt_\')" data-toggle="popover" data-placement="left" ' + 'class="btn btn-sm btn-primary popover-warning popover-dark" href="@Url.Action("Edit", "CreditDepartment", new {@id = "_rplcmnt_"})"><i class="fa fa-edit"></i> Edit</a> ' +
'<a id="btnDelete' + ctr + '" onclick="return CheckLock(this.id, \'CreditDepartment\', \'_rplcmnt_\')" data-toggle="popover" data-placement="left" ' + (data.ExpenditureCount > 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", "CreditDepartment", 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.CreditDepartments, AccessLevel.Write))
{
<text>
$('#creditDepartment_wrapper .table-caption').html('<a class="btn btn-primary" href="@Url.Action("Edit", "CreditDepartment")"><i class="fa fa-plus"></i> Add Cost Center</a>');
</text>
}
$('#creditDepartment_wrapper .dataTables_filter input').attr('placeholder', 'Search...');
$('#creditDepartment_wrapper .dataTables_processing').addClass("table-caption");
$('#creditDepartment_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="creditDepartment">
<thead>
<tr>
<th>
Department
</th>
<th>
Cost Center
</th>
<th>
Number of Expenditures
</th>
<th></th>
</tr>
</thead>
</table>
</div>