diff --git a/src/Service/JobOrderHandler/CMBJobOrderHandler.php b/src/Service/JobOrderHandler/CMBJobOrderHandler.php index cfdab814..a7712042 100644 --- a/src/Service/JobOrderHandler/CMBJobOrderHandler.php +++ b/src/Service/JobOrderHandler/CMBJobOrderHandler.php @@ -26,6 +26,7 @@ use App\Entity\Rider; use App\Entity\JORejection; use App\Entity\Warranty; use App\Entity\Customer; +use App\Entity\ServiceCharge; use App\Ramcar\InvoiceCriteria; use App\Ramcar\CMBServiceType; @@ -2674,6 +2675,7 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface // db loaded $params['bmfgs'] = $em->getRepository(BatteryManufacturer::class)->findAll(); $params['promos'] = $em->getRepository(Promo::class)->findAll(); + $params['service_charges'] = $em->getRepository(ServiceCharge::class)->findAll(); // list of hubs $hubs = $em->getRepository(Hub::class)->findBy([], ['name' => 'ASC']); diff --git a/templates/job-order/cmb.form.onestep.html.twig b/templates/job-order/cmb.form.onestep.html.twig index 08d20ee3..6662facf 100644 --- a/templates/job-order/cmb.form.onestep.html.twig +++ b/templates/job-order/cmb.form.onestep.html.twig @@ -489,24 +489,26 @@ + +
@@ -1647,16 +1649,15 @@ $(function() { var html = '
'; html += '
'; html += '
'; - html += ''; + {% for key, sc in service_charges %} + html += ''; {% endfor %} html += ''; - html += ''; html += '
'; html += '
'; html += '
'; - html += ''; + html += ''; html += '
'; html += '
'; html += ''; @@ -1664,6 +1665,9 @@ $(function() { html += '
'; $('#sc-section').append(html); + + // trigger change in select + $('#sc-section').find('.sc-select').last().change(); return false; }); @@ -1674,6 +1678,11 @@ $(function() { $(this).closest('.row').remove(); return false; }); + + $('body').on('change', '.sc-select', function(e) { + var amount = $(this).children('option:selected').data('amount'); + $(this).closest('.row').find('.sc-amount').val(amount); + }); }); {% endblock %}