128 lines
4.5 KiB
Plaintext
128 lines
4.5 KiB
Plaintext
@using EnVisage.Code.HtmlHelpers
|
|
@using Microsoft.AspNet.Identity
|
|
@using EnVisage.Code
|
|
@{
|
|
ViewBag.Title = "Clients";
|
|
}
|
|
|
|
@section scripts
|
|
{
|
|
<script type="text/javascript">
|
|
var ctr = 0;
|
|
var CompanyesArr = new Array();
|
|
init.push(function () {
|
|
$('#clients').dataTable({
|
|
"bProcessing": true,
|
|
"bServerSide": true,
|
|
"bAutoWidth": false,
|
|
"sAjaxSource": document.URL,
|
|
"sServerMethod": "POST",
|
|
"aoColumns": [
|
|
{ "mDataProp": "ClientNumber" },
|
|
{ "mDataProp": "Name" },
|
|
{ "mDataProp": "ProjectsCount" },
|
|
{
|
|
"mData": function (data, type, full) {
|
|
if (data.Companies.length > 0) {
|
|
var res = "";
|
|
for (var i = 0; i < data.Companies.length; i++) {
|
|
res += data.Companies[i] + ", ";
|
|
if (CompanyesArr.indexOf(data.Companies[i]) == -1) {
|
|
CompanyesArr.push(data.Companies[i]);
|
|
$('span.filterColumn>select')
|
|
.append('<option value="' + data.Companies[i] + '" class="">' + data.Companies[i] + '</option>');
|
|
}
|
|
}
|
|
|
|
$('span.filterColumn>select>option:first').val('All companies');
|
|
$('span.filterColumn>select>option:first').text('All companies');
|
|
return res.substr(0, res.length - 2);
|
|
}
|
|
else {
|
|
return "";
|
|
}
|
|
}
|
|
},
|
|
{ "mDataProp": "GlAccount" },
|
|
{
|
|
"mData": function (data, type, full) {
|
|
@if (SecurityManager.CheckSecurityObjectPermission(Areas.Clients, AccessLevel.Write))
|
|
{
|
|
<text>
|
|
ctr++;
|
|
return ('<a id="btnEdit' + ctr + '" onclick="return CheckLock(this.id, \'Clients\', \'_rplcmnt_\')" data-toggle="popover" data-placement="left" ' + 'class="btn btn-sm btn-primary popover-warning popover-dark" href="@Url.Action("Edit", "Clients", new {@id = "_rplcmnt_"})"><i class="fa fa-edit"></i> Edit</a> ' +
|
|
'<a id="btnDelete' + ctr + '" onclick="return CheckLock(this.id, \'Clients\', \'_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", "Clients", new {@id = "_rplcmnt_"})"') + ' ><i class="fa fa-trash-o"></i> Delete</a>')
|
|
.replace(/_rplcmnt_/g, data.Id);
|
|
</text>
|
|
}
|
|
else
|
|
{
|
|
<text>
|
|
return "";
|
|
</text>
|
|
}
|
|
}
|
|
}],
|
|
}).columnFilter({
|
|
"aoColumns": [
|
|
{ "type": "null" },
|
|
{ "type": "null" },
|
|
{ "type": "select" }
|
|
]
|
|
});
|
|
@if (SecurityManager.CheckSecurityObjectPermission(Areas.Clients, AccessLevel.Write))
|
|
{
|
|
<text>
|
|
$('#clients_wrapper .table-caption').html('<a class="btn btn-primary" href="@Url.Action("Edit", "Clients")"><i class="fa fa-plus"></i> Add Client</a>');
|
|
</text>
|
|
}
|
|
$('#clients_wrapper .dataTables_filter input').attr('placeholder', 'Search...');
|
|
$('#clients_wrapper .dataTables_processing').addClass("table-caption");
|
|
$('#clients_wrapper .dataTables_processing').html('<span class="h3"><img class="valign-middle" src="../Content/images/loadFA.gif"/></span>');
|
|
});
|
|
|
|
$(document).ready(function () {
|
|
setTimeout(function () {
|
|
$('.DT-lf-right>div:first').after('<div class="DT-search" style="vertical-align: middle"><div id="companies_filter" class="dataTables_filter"></div></div>');
|
|
$('#companies_filter').append($('span.filter_select'));
|
|
$('span.filter_select select').width(128);
|
|
$('span.filter_select select').height(28);
|
|
}, 500);
|
|
});
|
|
</script>
|
|
}
|
|
|
|
<div class="table-light table-responsive">
|
|
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="clients">
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
Number
|
|
</th>
|
|
<th>
|
|
Name
|
|
</th>
|
|
<th>
|
|
Number of Projects
|
|
</th>
|
|
<th>
|
|
Company
|
|
</th>
|
|
<th>
|
|
GL Account
|
|
</th>
|
|
<th>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tfoot style="display: none;">
|
|
<tr>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|