@@ -10,79 +10,87 @@ use Payplug\Payments\Block\InstallmentPlanInfo as Info;
1010 * @var Escaper $escaper
1111 */
1212$ specificInfo = $ block ->getAdminSpecificInformation ();
13+ $ title = $ block ->getMethod ()->getTitle ();
1314?>
14- <?= $ escaper ->escapeHtml ($ block -> getMethod ()-> getTitle ( )) ?>
15+ <?= $ escaper ->escapeHtml (__ ( $ title )) ?>
1516<?php if ($ specificInfo ) : ?>
16- <p><?= $ specificInfo ['status ' ]; ?> </p>
17- <p><?= __ ('Installment plan id ' ); ?> : <?= $ specificInfo ['installment_plan_id ' ]; ?> </p>
17+ <p><?= $ specificInfo ['status ' ]; ?> </p>
18+ <p><?= __ ('Installment plan id ' ); ?> : <?= $ specificInfo ['installment_plan_id ' ]; ?> </p>
1819
19- <table class="data-table admin__table-primary">
20- <tr>
21- <th><?= __ ('Date ' ); ?> </th>
22- <th><?= __ ('Amount ' ); ?> </th>
23- <th><?= __ ('Status ' ); ?> </th>
24- <th></th>
25- </tr>
26- <?php foreach ($ specificInfo ['payments ' ] as $ key => $ paymentInfo ) : ?>
27- <tr>
28- <td><?= $ paymentInfo ['date ' ]; ?> </td>
29- <td><?= $ paymentInfo ['amount ' ]; ?> </td>
30- <td><?= $ paymentInfo ['status ' ]; ?> </td>
31- <td>
32- <?php if (!empty ($ paymentInfo ['details ' ])) : ?>
33- <button type="button" class="toggle-details" data-toggle="collapse" data-target="#payment-detail-<?= $ key ; ?> " role="button" aria-expanded="false" aria-controls="payment-detail-<?= $ key ; ?> ">
34- <?= __ ('Details ' ); ?>
35- </button>
36- <?php endif ; ?>
37- </td>
38- </tr>
20+ <table class="data-table admin__table-primary">
21+ <tr>
22+ <th><?= $ escaper ->escapeHtml (__ ('Date ' )) ?> </th>
23+ <th><?= $ escaper ->escapeHtml (__ ('Amount ' )) ?> </th>
24+ <th><?= $ escaper ->escapeHtml (__ ('Status ' )) ?> </th>
25+ <th></th>
26+ </tr>
27+ <?php foreach ($ specificInfo ['payments ' ] as $ key => $ paymentInfo ) : ?>
28+ <tr>
29+ <td><?= $ escaper ->escapeHtml ($ paymentInfo ['date ' ]) ?> </td>
30+ <td><?= $ escaper ->escapeHtml ($ paymentInfo ['amount ' ]) ?> </td>
31+ <td><?= $ escaper ->escapeHtml ($ paymentInfo ['status ' ]) ?> </td>
32+ <td>
3933 <?php if (!empty ($ paymentInfo ['details ' ])) : ?>
40- <tr class="collapse" id="payment-detail-<?= $ key ; ?> " style="display: none;">
41- <td colspan="4">
42- <table class="data-table admin__table-secondary">
43- <?php foreach ($ paymentInfo ['details ' ] as $ label => $ value ) : ?>
44- <tr>
45- <th><?= $ escaper ->escapeHtml (__ ($ label )) ?> :</th>
46- <td>
47- <?= /* @noEscape */ nl2br ($ escaper ->escapeHtml (implode ("\n" , $ block ->getValueAsArray ($ value , true )))) ?>
48- </td>
49- </tr>
50- <?php endforeach ; ?>
51- </table>
34+ <button type="button"
35+ class="toggle-details"
36+ data-toggle="collapse"
37+ data-target="#payment-detail-<?= $ escaper ->escapeHtmlAttr ($ key ) ?> "
38+ role="button"
39+ aria-expanded="false"
40+ aria-controls="payment-detail-<?= $ escaper ->escapeHtmlAttr ($ key ) ?> ">
41+ <?= __ ('Details ' ); ?>
42+ </button>
43+ <?php endif ; ?>
44+ </td>
45+ </tr>
46+ <?php if (!empty ($ paymentInfo ['details ' ])) : ?>
47+ <tr class="collapse"
48+ id="payment-detail-<?= $ escaper ->escapeHtmlAttr ($ key ) ?> "
49+ style="display: none;">
50+ <td colspan="4">
51+ <table class="data-table admin__table-secondary">
52+ <?php foreach ($ paymentInfo ['details ' ] as $ label => $ value ) : ?>
53+ <tr>
54+ <th><?= $ escaper ->escapeHtml (__ ($ label )) ?> :</th>
55+ <td>
56+ <?= /* @noEscape */ nl2br ($ escaper ->escapeHtml (implode ("\n" , $ block ->getValueAsArray ($ value , true )))) ?>
5257 </td>
5358 </tr>
54- <?php endif ; ?>
55- <?php endforeach ; ?>
56- </table>
57-
58- <?php if ($ specificInfo ['can_abort ' ]) : ?>
59- <a class="action-default"
60- href="<?= $ block ->getUrl ('payplug_payments_admin/order/installmentPlanAbort ' , ['order_id ' => $ block ->getInfo ()->getOrder ()->getId (), 'form_key ' => $ block ->getFormKey ()]); ?> "
61- onclick="return confirmAbortInstallmentPlan()"
62- >
63- <?= __ ('Abort ' ); ?>
64- </a>
59+ <?php endforeach ; ?>
60+ </table>
61+ </td>
62+ </tr>
6563 <?php endif ; ?>
64+ <?php endforeach ; ?>
65+ </table>
66+
67+ <?php if ($ specificInfo ['can_abort ' ]) : ?>
68+ <a class="action-default"
69+ href="<?= $ block ->getUrl ('payplug_payments_admin/order/installmentPlanAbort ' , ['order_id ' => $ block ->getInfo ()->getOrder ()->getId (), 'form_key ' => $ block ->getFormKey ()]); ?> "
70+ onclick="return confirmAbortInstallmentPlan()">
71+ <?= __ ('Abort ' ); ?>
72+ </a>
73+ <?php endif ; ?>
6674<?php endif ;?>
6775
6876<?= $ block ->getChildHtml () ?>
6977
7078<script type="text/javascript">
71- function confirmAbortInstallmentPlan() {
72- return confirm('<?= __ ('Are you sure you want to abort the installment plan? ' ); ?> ');
73- }
74- document.addEventListener('DOMContentLoaded', function () {
75- const toggleButtons = document.querySelectorAll('.toggle-details');
76- toggleButtons.forEach(function (button) {
77- button.addEventListener('click', function () {
78- const targetId = this.getAttribute('data-target');
79- const targetElement = document.querySelector(targetId);
80- if (targetElement.style.display === 'none' || targetElement.style.display === '') {
81- targetElement.style.display = 'table-row';
82- } else {
83- targetElement.style.display = 'none';
84- }
85- });
79+ function confirmAbortInstallmentPlan() {
80+ return confirm('<?= __ ('Are you sure you want to abort the installment plan? ' ); ?> ');
81+ }
82+ document.addEventListener('DOMContentLoaded', function() {
83+ const toggleButtons = document.querySelectorAll('.toggle-details');
84+ toggleButtons.forEach(function(button) {
85+ button.addEventListener('click', function() {
86+ const targetId = this.getAttribute('data-target');
87+ const targetElement = document.querySelector(targetId);
88+ if (targetElement.style.display === 'none' || targetElement.style.display === '') {
89+ targetElement.style.display = 'table-row';
90+ } else {
91+ targetElement.style.display = 'none';
92+ }
8693 });
8794 });
88- </script>
95+ });
96+ </script>
0 commit comments