EnVisageOnline/Main-RMO/Source/EnVisage/Views/GLAccount/Index.cshtml

77 lines
2.9 KiB
Plaintext

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