group recepition comments in documentListRow()

This commit is contained in:
Uwe Steinmann 2017-07-18 13:36:28 +02:00
parent 00b4817bc7
commit d879cc6114

View File

@ -2094,15 +2094,21 @@ $(document).ready( function() {
$allcomments = array('-1'=>array(), '1'=>array());
foreach ($receiptStatus as $r) {
$rstat[''.$r['status']]++;
if($r['comment'])
$allcomments[''.$r['status']][] = htmlspecialchars($r['comment']);
if($r['comment']) {
// $allcomments[''.$r['status']][] = htmlspecialchars($r['comment']);
$m5 = md5(trim($r['comment']));
if($allcomments[''.$r['status']][$m5])
$allcomments[''.$r['status']][$m5]['n']++;
else
$allcomments[''.$r['status']][$m5] = array('n'=>1, 'c'=>htmlspecialchars(trim($r['comment'])));
}
}
$totalreceipts = $rstat['-1'] + $rstat['0'] + $rstat['1'];
if($totalreceipts) {
$content .= ";
<div class=\"progress\">
<div class=\"bar bar-success\" style=\"width: ".round($rstat['1']/$totalreceipts*100)."%;\">".($rstat['1'] ? $rstat['1']."/".$totalreceipts : '').($allcomments['1'] ? " ".$this->printPopupBox('<i class="icon-comment"></i>', implode('<br />', $allcomments['1']), true) : "")."</div>
<div class=\"bar bar-danger\" style=\"width: ".round($rstat['-1']/$totalreceipts*100)."%;\">".($rstat['-1'] ? $rstat['-1']."/".$totalreceipts : '').($allcomments['-1'] ? " ".$this->printPopupBox('<i class="icon-comment"></i>', implode('<br />', $allcomments['-1']), true) : "")."</div>
<div class=\"bar bar-success\" style=\"width: ".round($rstat['1']/$totalreceipts*100)."%;\">".($rstat['1'] ? $rstat['1']."/".$totalreceipts : '').($allcomments['1'] ? " ".$this->printPopupBox('<i class="icon-comment"></i>', implode('<br />', formatComment($allcomments['1'])), true) : "")."</div>
<div class=\"bar bar-danger\" style=\"width: ".round($rstat['-1']/$totalreceipts*100)."%;\">".($rstat['-1'] ? $rstat['-1']."/".$totalreceipts : '').($allcomments['-1'] ? " ".$this->printPopupBox('<i class="icon-comment"></i>', implode('<br />', formatComment($allcomments['-1'])), true) : "")."</div>
</div>";
}
}