From 7aed20019c822b61465131f05605639655401f25 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Mon, 29 Jun 2020 08:18:39 +0000 Subject: [PATCH] Fix displaying of images. #432 --- .../JobOrderHandler/CMBJobOrderHandler.php | 16 ++--- .../job-order/cmb.form.onestep.html.twig | 71 +++++++++++++++++-- 2 files changed, 75 insertions(+), 12 deletions(-) diff --git a/src/Service/JobOrderHandler/CMBJobOrderHandler.php b/src/Service/JobOrderHandler/CMBJobOrderHandler.php index 0b7c629f..b10b1cfa 100644 --- a/src/Service/JobOrderHandler/CMBJobOrderHandler.php +++ b/src/Service/JobOrderHandler/CMBJobOrderHandler.php @@ -1508,25 +1508,25 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface $a_other_images = $jo_extra->getAfterOtherImages(); if ($b_speed_img != null) - $pic_array[] = $b_speed_img; + $pic_array['before_speed_img'] = $b_speed_img; if ($a_speed_img != null) - $pic_array[] = $a_speed_img; + $pic_array['after_speed_img'] = $a_speed_img; if ($b_plate_img != null) - $pic_array[] = $b_plate_img; + $pic_array['before_plate_img'] = $b_plate_img; if ($a_plate_img != null) - $pic_array[] = $a_plate_img; + $pic_array['after_plate_img'] = $a_plate_img; if ($b_batt_img != null) - $pic_array[] = $b_batt_img; + $pic_array['before_batt_img'] = $b_batt_img; if ($a_batt_img != null) - $pic_array[] = $a_batt_img; + $pic_array['after_batt_img'] = $a_batt_img; foreach($b_other_images as $b_img) { - $pic_array[] = $b_img; + $pic_array['b_other_images'][] = $b_img; } foreach ($a_other_images as $a_img) { - $pic_array[] = $a_img; + $pic_array['a_other_images'][] = $a_img; } } diff --git a/templates/job-order/cmb.form.onestep.html.twig b/templates/job-order/cmb.form.onestep.html.twig index 7c0646c8..b3dd9c1f 100644 --- a/templates/job-order/cmb.form.onestep.html.twig +++ b/templates/job-order/cmb.form.onestep.html.twig @@ -508,11 +508,74 @@
- - {% for picture in jo_pictures %} -
- {% endfor %} + +
+ {% for key, picture in jo_pictures %} + {% if key == 'before_speed_img' %} +
+ +
+
+ {% endif %} + {% if key == 'after_speed_img' %} +
+ +
+
+ {% endif %} + {% if key == 'before_plate_img' %} +
+ +
+
+ {% endif %} + {% if key == 'after_plate_img' %} +
+ +
+
+ {% endif %} + {% if key == 'before_batt_img' %} +
+ +
+
+ {% endif %} + {% if key == 'after_batt_img' %} +
+ +
+
+ {% endif %} + {% endfor %} +
+
+
+
+ {% for key, picture in jo_pictures %} + {% if key == 'b_other_images' %} + {% for pic in jo_pictures['b_other_images'] %} +
+
+
+ {% endfor %} + {% endif %} + {% endfor %} +
+
+
+ +
+ {% for key, picture in jo_pictures %} + {% if key == 'a_other_images' %} + {% for pic in jo_pictures['a_other_images'] %} +
+
+
+ {% endfor %} + {% endif %} + {% endfor %}
{% endif %}