mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
- Added method rowNumber to controller system/Filters
- Fixed JSs to count the number of record in InfoCenter and to send messages
This commit is contained in:
@@ -11,29 +11,17 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* javascript file for infocenter overview page
|
||||
*/
|
||||
$(document).ready(
|
||||
function()
|
||||
{
|
||||
//bootstrap table
|
||||
$("#tableDataset").addClass('table table-bordered table-responsive');
|
||||
*/
|
||||
|
||||
// Checks if the table contains data (rows)
|
||||
if ($('#tableDataset').find('tbody:empty').length == 0
|
||||
&& $('#tableDataset').find('tr:empty').length == 0)
|
||||
{
|
||||
$("#tableDataset").tablesorter(
|
||||
{
|
||||
widgets: ["zebra", "filter"]
|
||||
});
|
||||
}
|
||||
appendTableActionsHtml();
|
||||
setTableActions();
|
||||
}
|
||||
);
|
||||
/**
|
||||
* Javascript file for infocenter overview page
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
|
||||
appendTableActionsHtml();
|
||||
// setTableActions();
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* adds person table additional actions html (above and beneath it)
|
||||
@@ -44,7 +32,7 @@ function appendTableActionsHtml()
|
||||
var url = currurl.replace(/infocenter\/InfoCenter(.*)/, "Messages/write");
|
||||
|
||||
var formHtml = '<form id="sendMsgsForm" method="post" action="'+ url +'" target="_blank"></form>';
|
||||
$("#filterForm").before(formHtml);
|
||||
$("#datasetActionsTop").before(formHtml);
|
||||
|
||||
var selectAllHtml =
|
||||
'<a href="javascript:void(0)" class="selectAll">' +
|
||||
@@ -56,16 +44,36 @@ function appendTableActionsHtml()
|
||||
'<a href="javascript:void(0)" class="sendMsgsLink">' +
|
||||
'<i class="fa fa-envelope"></i> Nachricht senden</a>';
|
||||
|
||||
var personcount = $("#tableDataset tbody tr").length;
|
||||
var persontext = personcount === 1 ? "Person" : "Personen";
|
||||
var countHtml = $("#tableDataset tbody tr").length +" "+persontext;
|
||||
var personcount = 0;
|
||||
|
||||
$.ajax({
|
||||
url: window.location.pathname.replace('infocenter/InfoCenter', 'Filters/rowNumber'),
|
||||
method: "GET"
|
||||
})
|
||||
.done(function(data, textStatus, jqXHR) {
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
if (data.rowNumber != null)
|
||||
{
|
||||
personcount = data.rowNumber;
|
||||
|
||||
var persontext = personcount === 1 ? "Person" : "Personen";
|
||||
var countHtml = personcount + " " + persontext;
|
||||
|
||||
$("#datasetActionsTop, #datasetActionsBottom").append(
|
||||
"<div class='pull-left'>" + selectAllHtml + " " + messageHtml + "</div>"+
|
||||
"<div class='pull-right'>" + countHtml + "</div>"+
|
||||
"<div class='clearfix'></div>"
|
||||
);
|
||||
$("#datasetActionsBottom").append("<br><br>");
|
||||
}
|
||||
|
||||
setTableActions();
|
||||
}
|
||||
|
||||
}).fail(function(jqXHR, textStatus, errorThrown) {});
|
||||
|
||||
$("#datasetActionsTop, #datasetActionsBottom").append(
|
||||
"<div class='pull-left'>"+selectAllHtml+" "+ messageHtml+"</div>"+
|
||||
"<div class='pull-right'>"+countHtml+"</div>"+
|
||||
"<div class='clearfix'></div>"
|
||||
);
|
||||
$("#datasetActionsBottom").append("<br><br>");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +82,7 @@ function appendTableActionsHtml()
|
||||
function setTableActions()
|
||||
{
|
||||
$(".sendMsgsLink").click(function() {
|
||||
var idsel = $("#tableDataset input:checked[name=PersonId\\[\\]]");
|
||||
var idsel = $("#filterTableDataset input:checked[name=PersonId\\[\\]]");
|
||||
if(idsel.length > 0)
|
||||
{
|
||||
var form = $("#sendMsgsForm");
|
||||
@@ -91,15 +99,15 @@ function setTableActions()
|
||||
$(".selectAll").click(function()
|
||||
{
|
||||
//select only trs if not filtered by tablesorter
|
||||
var trs = $("#tableDataset tbody tr").not(".filtered");
|
||||
var trs = $("#filterTableDataset tbody tr").not(".filtered");
|
||||
trs.find("input[name=PersonId\\[\\]]").prop("checked", true);
|
||||
}
|
||||
);
|
||||
|
||||
$(".unselectAll").click(function()
|
||||
{
|
||||
var trs = $("#tableDataset tbody tr").not(".filtered");
|
||||
var trs = $("#filterTableDataset tbody tr").not(".filtered");
|
||||
trs.find("input[name=PersonId\\[\\]]").prop("checked", false);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user