Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

261 line
10KB

  1. {% macro card_start(zone = "default", card ='primary', fullWidth = false, tools = false ) %}
  2. <div class="card card-{{ card }}">
  3. <div class="card-header">
  4. <h3 class="card-title">
  5. {% set label = "group."~zone %}
  6. {{ label|trans({}, 'lcshop')|raw }}
  7. </h3>
  8. {% if tools %}
  9. <div class="card-tools">
  10. {{ tools|raw }}
  11. </div>
  12. {% endif %}
  13. </div>
  14. <div class="card-body {{ fullWidth == true ? 'p-0' : 'row' }}">
  15. {% endmacro card_start %}
  16. {% macro card_end(overlay = false) %}
  17. </div>
  18. {% if overlay %}
  19. <div v-if="{{ overlay }}==true" class="overlay">
  20. <i class="fas fa-2x fa-sync-alt"></i>
  21. </div>
  22. {% endif %}
  23. </div>
  24. {% endmacro card_end %}
  25. {% macro startCard(col, zone = "default", card ='primary', fullWidth = false ) %}
  26. {% if col > 0 %}
  27. <div class="col-{{ col }}">{% endif %}
  28. <div class="card card-{{ card }}">
  29. <div class="card-header">
  30. <h3 class="card-title">
  31. {% set label = "group."~zone %}
  32. {{ label|trans({}, 'lcshop')|raw }}
  33. </h3>
  34. </div>
  35. <div class="card-body {{ fullWidth == true ? 'p-0' : 'row' }}">
  36. {% endmacro startCard %}
  37. {% macro cardOverlay(attr) %}
  38. </div>
  39. <div v-if="{{ attr }}==true" class="overlay">
  40. <i class="fas fa-2x fa-sync-alt"></i>
  41. </div>
  42. {% endmacro cardOverlay %}
  43. {% macro endCard(noCol = false) %}
  44. </div>
  45. </div>
  46. {% if noCol == false %}</div>{% endif %}
  47. {% endmacro endCard %}
  48. {% macro priceField(field, fieldTax, fieldName, behaviorPriceValue) %}
  49. <div class="form-group field-price col-12" v-show="behaviorPrice == '{{ behaviorPriceValue }}'">
  50. <div class="row">
  51. <div class="col-12">
  52. {{ form_label(field) }}
  53. </div>
  54. <div class="col-6">
  55. <div class="form-widget">
  56. <div class="input-group">
  57. {{ form_widget(field, {'attr' : {'v-model': fieldName, '@change' : fieldName~'Updated'}}) }}
  58. <div class="input-group-append">
  59. <span class="input-group-text">€ HT
  60. {% if behaviorPriceValue == 'by-reference-unit' %}/ ${ unitReference }{% endif %}
  61. </span>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. <div class="col-6">
  67. <div class="input-group">
  68. {{ form_widget(fieldTax, {'attr' : {'v-model': fieldName ~ 'WithTax', '@change' : fieldName~'WithTaxUpdated'}}) }}
  69. <div class="input-group-append">
  70. <span class="input-group-text">€ TTC
  71. {% if behaviorPriceValue == 'by-reference-unit' %}/ ${ unitReference }{% endif %}
  72. </span>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. {% endmacro %}
  79. {% macro autoresizeField(field) %}
  80. <tr>
  81. <td>{{ form_label(field) }}</td>
  82. <td>
  83. <div class="autoresize">
  84. {{ form_widget(field, {'attr' : {rows : '1'}}) }}
  85. </div>
  86. </td>
  87. </tr>
  88. {% endmacro autoresizeField %}
  89. {% macro fieldReductionList(form, field, filterOn = false, filterType='string') %}
  90. <div class="col-12">
  91. <div class="form-group">
  92. <div class="form-group">
  93. {{ form_widget(attribute(form, field~'Active'), {"attr" : {'v-model' : 'reduction'~field|uc_first~'Active' } }) }}
  94. </div>
  95. <div class="form-widget" v-show="reduction{{ field|uc_first }}Active == true">
  96. {% set attr = {
  97. 'ref' : 'reduction'~field|uc_first ,
  98. 'v-model' : 'reduction'~field|uc_first
  99. } %}
  100. {{ form_widget(attribute(form, field), {"attr" : attr }) }}
  101. </div>
  102. </div>
  103. </div>
  104. {% endmacro fieldReductionList %}
  105. {% macro fieldReductionDateRange(form) %}
  106. <div class="col-12">
  107. <div class="form-group">
  108. <div class="form-group">
  109. {{ form_widget(form.permanent, {"attr" : {'v-model' : 'reductionPermanent' } }) }}
  110. </div>
  111. <div class="input-group" v-show="reductionPermanent == false">
  112. <div class="input-group-prepend">
  113. <span class="input-group-text"><i class="far fa-clock"></i></span>
  114. </div>
  115. <input type="text" class="form-control float-right date-time-range">
  116. <div class="hidden date-time-range-fields" style="display: none;">
  117. {{ form_widget(form.dateStart, {"attr" : {'class' : 'date-start'}}) }}
  118. {{ form_widget(form.dateEnd, {"attr" : {'class' : 'date-end'}}) }}
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. {% endmacro fieldReductionDateRange %}
  124. {% macro fieldReductionValue(form) %}
  125. <div class="col-6">
  126. <div class="form-group">
  127. {{ form_label(form.value) }}
  128. <div class="input-group">
  129. {{ form_widget(form.value, {"attr" : {":required": "reductionActive", 'v-model' : 'reductionValue'}}) }}
  130. <div class="input-group-append">
  131. <span class="input-group-text">
  132. <span v-if="reductionUnit =='amount'">€</span>
  133. <span v-else-if="reductionUnit =='percent'">%</span>
  134. </span>
  135. </div>
  136. </div>
  137. </div>
  138. </div>
  139. {% endmacro fieldReductionValue %}
  140. {% macro fieldReductionBehaviorTaxRate(form) %}
  141. <div class="col-6" :class="reductionUnit == 'amount' ? '' : 'hidden'">
  142. {{ form_row(form.behaviorTaxRate, {"attr" : {":required": "reductionActive && reductionUnit=='amount'", 'v-model' : 'reductionBehaviorTaxRate'}}) }}
  143. </div>
  144. {% endmacro fieldReductionBehaviorTaxRate %}
  145. {% macro fieldReductionUnit(form) %}
  146. <div class="col-12">
  147. <div class="form-group">
  148. {{ form_label(form.unit) }}
  149. {% for field in form.unit %}
  150. {{ form_widget(field, {"attr" : {":required": "reductionActive", "v-model" : 'reductionUnit'}}) }}
  151. {% endfor %}
  152. </div>
  153. </div>
  154. {% endmacro fieldReductionUnit %}
  155. {% macro reductionCatalogForm(form) %}
  156. {{ _self.startCard(6, 'ReductionCatalog.info') }}
  157. <div class="col-12">
  158. {{ form_row(form.title, {'attr' : {":required": "reductionActive"}}) }}
  159. </div>
  160. {{ _self.fieldReductionUnit(form) }}
  161. {{ _self.fieldReductionValue(form) }}
  162. {{ _self.fieldReductionBehaviorTaxRate(form) }}
  163. {{ _self.endCard() }}
  164. {{ _self.startCard(6, 'ReductionCatalog.conditions','success') }}
  165. {{ _self.fieldReductionDateRange(form) }}
  166. {{ _self.fieldReductionList(form, 'groupUsers') }}
  167. {{ _self.fieldReductionList(form, 'users') }}
  168. {% if form.suppliers is defined %}
  169. {{ _self.fieldReductionList(form, 'suppliers') }}
  170. {% endif %}
  171. {% if form.productCategories is defined %}
  172. {{ _self.fieldReductionList(form, 'productCategories') }}
  173. {% endif %}
  174. {% if form.productFamilies is defined %}
  175. {{ _self.fieldReductionList(form, 'productFamilies') }}
  176. {% endif %}
  177. {{ _self.endCard() }}
  178. {% endmacro reductionCatalogForm %}
  179. {% macro reductionCatalogFormValues(formValues, isProductFamilyForm= false) %}
  180. <script>
  181. window.mixinReductionValues = {
  182. {% if formValues.status == false and isProductFamilyForm %}reductionActive: false,{% endif %}
  183. {% if formValues.permanent is not null and formValues.permanent == false %}reductionPermanent: false,{% endif %}
  184. {% if formValues.behaviorTaxRate %}reductionBehaviorTaxRate: '{{ formValues.behaviorTaxRate }}',{% endif %}
  185. {% if formValues.value %}reductionValue: parseFloat({{ formValues.value }}),{% endif %}
  186. {% if formValues.unit %}reductionUnit: "{{ formValues.unit }}",{% endif %}
  187. {% if formValues.groupUsers is not empty %}reductionGroupUsersActive: true,{% endif %}
  188. {% if formValues.groupUsers is not empty %}reductionGroupUsers: {{ formValues.groupUsers|json_encode }},{% endif %}
  189. {% if formValues.users is not empty %}reductionUsersActive: true,{% endif %}
  190. {% if formValues.users is not empty %}reductionUsers: {{ formValues.users|json_encode }},{% endif %}
  191. {% if formValues.suppliers is not empty %}reductionSuppliersActive: true,{% endif %}
  192. {% if formValues.suppliers is not empty %}reductionSuppliers: {{ formValues.suppliers|json_encode }},{% endif %}
  193. {% if formValues.productFamilies is not empty %}reductionProductFamiliesActive: true,{% endif %}
  194. {% if formValues.productFamilies is not empty %}reductionProductFamilies: {{ formValues.productFamilies|json_encode }},{% endif %}
  195. {% if formValues.productCategories is not empty %}reductionProductCategoriesActive: true,{% endif %}
  196. {% if formValues.productCategories is not empty %}reductionProductCategories: {{ formValues.productCategories|json_encode }},{% endif %}
  197. }
  198. </script>
  199. {% endmacro reductionCatalogFormValues %}
  200. {% macro box_info(class="bg-info", icon, label, value, button=false) %}
  201. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  202. {% trans_default_domain 'lcshop' %}
  203. {% block class %}{{ class }}{% endblock %}
  204. {% block icon %}{{ icon }}{% endblock %}
  205. {% block label %}{{ label|raw }}{% endblock %}
  206. {% block value %}{{ value|raw }}{% endblock %}
  207. {% if button %}
  208. {% block button %}{{ button|raw }}{% endblock %}
  209. {% endif %}
  210. {% endembed %}
  211. {% endmacro box_info %}
  212. {#{% macro modal(title, form) %}
  213. {% embed '@LcShop/backend/default/block/embed_modal.twig' %}
  214. {% trans_default_domain 'lcshop' %}
  215. {% block id %}{{ id }}{% endblock %}
  216. {% block title %}{{ title }}{% endblock %}
  217. {% block form_start %}
  218. {{ form_start(form) }}
  219. {% endblock %}
  220. {% block icon %}{{ icon }}{% endblock %}
  221. {% block label %}{{ label }}{% endblock %}
  222. {% block value %}
  223. {{ value }}
  224. {% endblock %}
  225. {% endembed %}
  226. {% endmacro box_info %}#}