From 122294afbf6ec1f761b1599ee3422d597d2fae3a Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Sat, 18 Jan 2014 23:29:45 +0000
Subject: [PATCH] Update recipients count in realtime

Previously you had to click "Save Changes" for the count to be reflected on
ticket view page.
---
 include/staff/templates/collaborators.tmpl.php | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/staff/templates/collaborators.tmpl.php b/include/staff/templates/collaborators.tmpl.php
index 3136cc96d..20e5192ca 100644
--- a/include/staff/templates/collaborators.tmpl.php
+++ b/include/staff/templates/collaborators.tmpl.php
@@ -54,4 +54,18 @@ if(($users=$ticket->getCollaborators())) {?>
 } else {
     echo "Bro, not sure how you got here!";
 }
+
+if ($_POST && $ticket && $ticket->getNumCollaborators()) {
+    $recipients = sprintf('Recipients (%d of %d)',
+          $ticket->getNumActiveCollaborators(),
+          $ticket->getNumCollaborators());
+    ?>
+    <script type="text/javascript">
+        $(function() {
+            $('#emailcollab').show();
+            $('#recipients').html('<?php echo $recipients; ?>');
+            });
+    </script>
+<?php
+}
 ?>
-- 
GitLab