Fix for renewal form when adding employess.
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 27 Apr 2018 20:46:13 +0000 (16:46 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 27 Apr 2018 20:46:13 +0000 (16:46 -0400)
Fixing the employee adding. Now totals the amount correctly.

views/admin/billing/renew.html

index 9fd53b8..fa09afa 100644 (file)
@@ -188,7 +188,8 @@ jQuery(document).ready(function($){
         }
 
         var html = '<tr><td>';
-        html += '<input checked id="employee-' + employee.id + '" type="checkbox" name="employees[' + employee.id + ']" value="' + employee.id + '">';
+        html += '<input data-amount="' + invoiceAmount +  '" ';
+        html += 'checked id="employee-' + employee.id + '" type="checkbox" name="employees[' + employee.id + ']" value="' + employee.id + '">';
         html += '</td><td>';
         html += '<label for="employee-' + employee.id + '">';
         html += employee.label;
@@ -199,6 +200,7 @@ jQuery(document).ready(function($){
         html += invoiceAmount;
         html += '</td></tr>';
         $('#glm-billing-employees').append(html);
+        getPageTotal();
     }
 
     $('#billing-invoice-select').change(function(){
@@ -243,7 +245,7 @@ jQuery(document).ready(function($){
     });
 
     // trigger total if changing employees
-    $('input[name^=employees]').change(function(){
+    $('#glm-billing-employees').on('click', 'input[name^=employees]' ,function(){
         getPageTotal();
     });