PageRenderTime 43ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/opencart_v1.4/upload/admin/view/template/sale/coupon_form.tpl

http://coderstalk.googlecode.com/
Smarty Template | 227 lines | 213 code | 14 blank | 0 comment | 18 complexity | 106469d24c5b8890f69d729323365b5f MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.1, AGPL-3.0
  1. <?php echo $header; ?>
  2. <?php if ($error_warning) { ?>
  3. <div class="warning"><?php echo $error_warning; ?></div>
  4. <?php } ?>
  5. <div class="box">
  6. <div class="left"></div>
  7. <div class="right"></div>
  8. <div class="heading">
  9. <h1><?php echo $heading_title; ?></h1>
  10. <div class="buttons"><a onclick="$('#form').submit();" class="button"><span><?php echo $button_save; ?></span></a><a onclick="location='<?php echo $cancel; ?>';" class="button"><span><?php echo $button_cancel; ?></span></a></div>
  11. </div>
  12. <div class="content">
  13. <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
  14. <div class="tabs">
  15. <?php foreach ($languages as $language) { ?>
  16. <a tab="#language<?php echo $language['language_id']; ?>"><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /> <?php echo $language['name']; ?></a>
  17. <?php } ?>
  18. </div>
  19. <?php foreach ($languages as $language) { ?>
  20. <div id="language<?php echo $language['language_id']; ?>">
  21. <table class="form">
  22. <tr>
  23. <td><span class="required">*</span> <?php echo $entry_name; ?></td>
  24. <td><input name="coupon_description[<?php echo $language['language_id']; ?>][name]" value="<?php echo isset($coupon_description[$language['language_id']]) ? $coupon_description[$language['language_id']]['name'] : ''; ?>" />
  25. <?php if (isset($error_name[$language['language_id']])) { ?>
  26. <span class="error"><?php echo $error_name[$language['language_id']]; ?></span>
  27. <?php } ?></td>
  28. </tr>
  29. <tr>
  30. <td><span class="required">*</span> <?php echo $entry_description; ?></td>
  31. <td><textarea name="coupon_description[<?php echo $language['language_id']; ?>][description]" cols="40" rows="5"><?php echo isset($coupon_description[$language['language_id']]) ? $coupon_description[$language['language_id']]['description'] : ''; ?></textarea>
  32. <?php if (isset($error_description[$language['language_id']])) { ?>
  33. <span class="error"><?php echo $error_description[$language['language_id']]; ?></span>
  34. <?php } ?></td>
  35. </tr>
  36. </table>
  37. </div>
  38. <?php } ?>
  39. <table class="form">
  40. <tr>
  41. <td><span class="required">*</span> <?php echo $entry_code; ?></td>
  42. <td><input type="text" name="code" value="<?php echo $code; ?>" />
  43. <?php if ($error_code) { ?>
  44. <span class="error"><?php echo $error_code; ?></span>
  45. <?php } ?></td>
  46. </tr>
  47. <tr>
  48. <td><?php echo $entry_type; ?></td>
  49. <td><select name="type">
  50. <?php if ($type == 'P') { ?>
  51. <option value="P" selected="selected"><?php echo $text_percent; ?></option>
  52. <?php } else { ?>
  53. <option value="P"><?php echo $text_percent; ?></option>
  54. <?php } ?>
  55. <?php if ($type == 'F') { ?>
  56. <option value="F" selected="selected"><?php echo $text_amount; ?></option>
  57. <?php } else { ?>
  58. <option value="F"><?php echo $text_amount; ?></option>
  59. <?php } ?>
  60. </select></td>
  61. </tr>
  62. <tr>
  63. <td><?php echo $entry_discount; ?></td>
  64. <td><input type="text" name="discount" value="<?php echo $discount; ?>" /></td>
  65. </tr>
  66. <tr>
  67. <td><?php echo $entry_total; ?></td>
  68. <td><input type="text" name="total" value="<?php echo $total; ?>" /></td>
  69. </tr>
  70. <tr>
  71. <td><?php echo $entry_logged; ?></td>
  72. <td><?php if ($logged) { ?>
  73. <input type="radio" name="logged" value="1" checked="checked" />
  74. <?php echo $text_yes; ?>
  75. <input type="radio" name="logged" value="0" />
  76. <?php echo $text_no; ?>
  77. <?php } else { ?>
  78. <input type="radio" name="logged" value="1" />
  79. <?php echo $text_yes; ?>
  80. <input type="radio" name="logged" value="0" checked="checked" />
  81. <?php echo $text_no; ?>
  82. <?php } ?></td>
  83. </tr>
  84. <tr>
  85. <td><?php echo $entry_shipping; ?></td>
  86. <td><?php if ($shipping) { ?>
  87. <input type="radio" name="shipping" value="1" checked="checked" />
  88. <?php echo $text_yes; ?>
  89. <input type="radio" name="shipping" value="0" />
  90. <?php echo $text_no; ?>
  91. <?php } else { ?>
  92. <input type="radio" name="shipping" value="1" />
  93. <?php echo $text_yes; ?>
  94. <input type="radio" name="shipping" value="0" checked="checked" />
  95. <?php echo $text_no; ?>
  96. <?php } ?></td>
  97. </tr>
  98. <tr>
  99. <td><?php echo $entry_product; ?></td>
  100. <td><table>
  101. <tr>
  102. <td style="padding: 0;" colspan="3"><select id="category" style="margin-bottom: 5px;" onchange="getProducts();">
  103. <?php foreach ($categories as $category) { ?>
  104. <option value="<?php echo $category['category_id']; ?>"><?php echo $category['name']; ?></option>
  105. <?php } ?>
  106. </select></td>
  107. </tr>
  108. <tr>
  109. <td style="padding: 0;"><select multiple="multiple" id="product" size="10" style="width: 200px;">
  110. </select></td>
  111. <td style="vertical-align: middle;"><input type="button" value="--&gt;" onclick="addProduct();" />
  112. <br />
  113. <input type="button" value="&lt;--" onclick="removeProduct();" /></td>
  114. <td style="padding: 0;"><select multiple="multiple" id="coupon" size="10" style="width: 200px;">
  115. </select></td>
  116. </tr>
  117. </table>
  118. <div id="coupon_product">
  119. <?php foreach ($coupon_product as $product_id) { ?>
  120. <input type="hidden" name="coupon_product[]" value="<?php echo $product_id; ?>" />
  121. <?php } ?>
  122. </div></td>
  123. </tr>
  124. <tr>
  125. <td><?php echo $entry_date_start; ?></td>
  126. <td><input type="text" name="date_start" value="<?php echo $date_start; ?>" size="12" id="date_start" /></td>
  127. </tr>
  128. <tr>
  129. <td><?php echo $entry_date_end; ?></td>
  130. <td><input type="text" name="date_end" value="<?php echo $date_end; ?>" size="12" id="date_end" /></td>
  131. </tr>
  132. <tr>
  133. <td><?php echo $entry_uses_total; ?></td>
  134. <td><input type="text" name="uses_total" value="<?php echo $uses_total; ?>" /></td>
  135. </tr>
  136. <tr>
  137. <td><?php echo $entry_uses_customer; ?></td>
  138. <td><input type="text" name="uses_customer" value="<?php echo $uses_customer; ?>" /></td>
  139. </tr>
  140. <tr>
  141. <td><?php echo $entry_status; ?></td>
  142. <td><select name="status">
  143. <?php if ($status) { ?>
  144. <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
  145. <option value="0"><?php echo $text_disabled; ?></option>
  146. <?php } else { ?>
  147. <option value="1"><?php echo $text_enabled; ?></option>
  148. <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
  149. <?php } ?>
  150. </select></td>
  151. </tr>
  152. </table>
  153. </form>
  154. </div>
  155. </div>
  156. <script type="text/javascript"><!--
  157. function addProduct() {
  158. $('#product :selected').each(function() {
  159. $(this).remove();
  160. $('#coupon option[value=\'' + $(this).attr('value') + '\']').remove();
  161. $('#coupon').append('<option value="' + $(this).attr('value') + '">' + $(this).text() + '</option>');
  162. $('#coupon_product input[value=\'' + $(this).attr('value') + '\']').remove();
  163. $('#coupon_product').append('<input type="hidden" name="coupon_product[]" value="' + $(this).attr('value') + '" />');
  164. });
  165. }
  166. function removeProduct() {
  167. $('#coupon :selected').each(function() {
  168. $(this).remove();
  169. $('#coupon_product input[value=\'' + $(this).attr('value') + '\']').remove();
  170. });
  171. }
  172. function getProducts() {
  173. $('#product option').remove();
  174. $.ajax({
  175. url: 'index.php?route=sale/coupon/category&category_id=' + $('#category').attr('value'),
  176. dataType: 'json',
  177. success: function(data) {
  178. for (i = 0; i < data.length; i++) {
  179. $('#product').append('<option value="' + data[i]['product_id'] + '">' + data[i]['name'] + '</option>');
  180. }
  181. }
  182. });
  183. }
  184. function getProduct() {
  185. $('#coupon option').remove();
  186. $.ajax({
  187. url: 'index.php?route=sale/coupon/product',
  188. type: 'POST',
  189. dataType: 'json',
  190. data: $('#coupon_product input'),
  191. success: function(data) {
  192. $('#coupon_product input').remove();
  193. for (i = 0; i < data.length; i++) {
  194. $('#coupon').append('<option value="' + data[i]['product_id'] + '">' + data[i]['name'] + '</option>');
  195. $('#coupon_product').append('<input type="hidden" name="coupon_product[]" value="' + data[i]['product_id'] + '" />');
  196. }
  197. }
  198. });
  199. }
  200. getProducts();
  201. getProduct();
  202. //--></script>
  203. <script type="text/javascript" src="view/javascript/jquery/ui/ui.datepicker.js"></script>
  204. <script type="text/javascript"><!--
  205. $(document).ready(function() {
  206. $('#date_start').datepicker({dateFormat: 'yy-mm-dd'});
  207. $('#date_end').datepicker({dateFormat: 'yy-mm-dd'});
  208. });
  209. //--></script>
  210. <script type="text/javascript"><!--
  211. $.tabs('.tabs a');
  212. //--></script>
  213. <?php echo $footer; ?>