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

84 lines
3.3 KiB
Plaintext

@using EnVisage.Code.HtmlHelpers
@using Microsoft.AspNet.Identity
@using EnVisage.Code
@{
ViewBag.Title = "Units of Measure";
}
@section scripts
{
<script type="text/javascript">
var ctr = 0;
init.push(function () {
$('#uom').dataTable({
"bProcessing": true,
"bServerSide": true,
"bAutoWidth" : false,
"sAjaxSource": document.URL,
"sServerMethod": "POST",
"aoColumns": [
{ "mDataProp": "Name" },
{ "mDataProp": "UOMValue" },
//{ "mDataProp": "ExpenditureCategoryCount" },
{
"mData": function (data, type, full) {
if (data.ExpenditureCategoryCount > 0) {
return ('<a href="@Url.Action("Index", "ExpenditureCategory", new {@UOM = "_rplcmnt_ _rplcmnt1_"})">' + data.ExpenditureCategoryCount + '</a>')
.replace(/_rplcmnt_/g, data.Name).replace(/_rplcmnt1_/g, data.UOMValue);
} else {
return data.ExpenditureCategoryCount;
}
}
},
{
"mData": function (data, type, full) {
@if (SecurityManager.CheckSecurityObjectPermission(Areas.UnitsOfMeasure, AccessLevel.Write))
{
<text>
ctr++;
return ('<a id="btnEdit' + ctr + '" onclick="return CheckLock(this.id, \'UnitOfMeasure\', \'_rplcmnt_\')" data-toggle="popover" data-placement="left" ' + 'class="btn btn-sm btn-primary popover-warning popover-dark" href="@Url.Action("Edit", "UnitOfMeasure", new {@id = "_rplcmnt_"})"><i class="fa fa-edit"></i> Edit</a> ' +
'<a id="btnDelete' + ctr + '" onclick="return CheckLock(this.id, \'UnitOfMeasure\', \'_rplcmnt_\')" data-toggle="popover" data-placement="left" ' + (data.ExpenditureCategoryCount > 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", "UnitOfMeasure", 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.UnitsOfMeasure, AccessLevel.Write))
{
<text>
$('#uom_wrapper .table-caption').html('<a class="btn btn-primary" href="@Url.Action("Edit", "UnitOfMeasure")"><i class="fa fa-plus"></i> Add Unit of Measure</a>');
</text>
}
$('#uom_wrapper .dataTables_filter input').attr('placeholder', 'Search...');
$('#uom_wrapper .dataTables_processing').addClass("table-caption");
$('#uom_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="uom">
<thead>
<tr>
<th>
Unit of Measure Name
</th>
<th>
Value
</th>
<th>
Number of Expenditure Categories
</th>
<th></th>
</tr>
</thead>
</table>
</div>