1
0

template.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. $tester_invoice_fields = $template->getTesterInvoiceFields();
  3. $customer_invoice_fields = $template->getCustomerInvoiceFields();
  4. $template_keys = $template->getTemplateKeys();
  5. ?>
  6. <div class="container pt-3 my-4">
  7. <div class="row">
  8. <div class="col align-self-center">
  9. <h2><?=htmlspecialchars($template->name)?> Template</h2>
  10. </div>
  11. <div class="col-auto align-self-center">
  12. <a class="btn btn-outline-primary" href="/account/templates/<?=$template->id?>/edit">Edit</a>
  13. </div>
  14. </div>
  15. <div class="row">
  16. <div class="col-lg-6">
  17. <div class="card mb-3">
  18. <div class="card-header">
  19. Tester Invoice Fields
  20. </div>
  21. <div class="card-body">
  22. <?php
  23. if(empty($tester_invoice_fields)) {
  24. ?>
  25. None configured.
  26. <?php
  27. }
  28. else {
  29. ?>
  30. The following costs will be included in testers' invoices:
  31. <?php
  32. }
  33. ?>
  34. </div>
  35. <div class="list-group list-group-flush">
  36. <?php
  37. foreach($tester_invoice_fields as $field) {
  38. ?>
  39. <div class="list-group-item">
  40. <code><?=htmlspecialchars($field->name)?></code> as
  41. "<?=htmlspecialchars($field->label)?>"
  42. </div>
  43. <?php
  44. }
  45. ?>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="col-lg-6">
  50. <div class="card mb-3">
  51. <div class="card-header">
  52. Customer Invoice Fields
  53. </div>
  54. <div class="card-body">
  55. <?php
  56. if(empty($tester_invoice_fields)) {
  57. ?>
  58. None configured.
  59. <?php
  60. }
  61. else {
  62. ?>
  63. The following costs will be included in customer invoices:
  64. <?php
  65. }
  66. ?>
  67. </div>
  68. <div class="list-group list-group-flush">
  69. <?php
  70. foreach($customer_invoice_fields as $field) {
  71. ?>
  72. <div class="list-group-item">
  73. <code><?=htmlspecialchars($field->name)?></code> as
  74. "<?=htmlspecialchars($field->label)?>"
  75. </div>
  76. <?php
  77. }
  78. ?>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. <?php
  84. if($template_keys) {
  85. ?>
  86. <div class="card mb-3">
  87. <div class="card-header">
  88. Template Tags
  89. </div>
  90. <div class="card-body">
  91. <form method="get">
  92. This template has the following toggleable tags:
  93. <div class="form-group">
  94. <?php
  95. foreach($template_keys as $key) {
  96. $checked = in_array($key, $keys) ? "checked" : "";
  97. $id = sprintf("key-%s", $key);
  98. ?>
  99. <div class="custom-control custom-switch">
  100. <input type="checkbox" class="custom-control-input" name="keys[]" id="<?=$key?>" value="<?=$key?>" <?=$checked?> />
  101. <label class="custom-control-label" for="<?=$key?>"><?=$key?></label>
  102. </div>
  103. <?php
  104. }
  105. ?>
  106. </div>
  107. <button type="submit" class="btn btn-primary">Reload Page</button>
  108. </form>
  109. </div>
  110. </div>
  111. <?php
  112. }
  113. ?>
  114. <div class="card mb-3">
  115. <div class="card-header">
  116. Before Test Form Preview
  117. </div>
  118. <div class="card-body">
  119. <div class="row">
  120. <div class="col-md-6 offset-md-3">
  121. <?php
  122. $template->renderBeforeTestForm();
  123. ?>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. <div class="card mb-3">
  129. <div class="card-header">
  130. During Test Form Preview
  131. </div>
  132. <div class="card-body">
  133. <div class="row">
  134. <div class="col-md-6 offset-md-3">
  135. <?php
  136. $template->renderDuringTestForm();
  137. ?>
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. </div>