You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

macros.html.twig 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. {% macro startCard(col, zone = "default", card ='primary', fullWidth = false ) %}
  2. {% if col > 0 %}
  3. <div class="col-{{ col }}">{% endif %}
  4. <div class="card card-{{ card }}">
  5. <div class="card-header">
  6. <h3 class="card-title">
  7. {% set label = "group."~zone %}
  8. {{ label|trans({}, 'lcshop')|raw }}
  9. </h3>
  10. </div>
  11. <div class="card-body {{ fullWidth == true ? 'p-0' : 'row' }}">
  12. {% endmacro %}
  13. {% macro endCard(noCol = false) %}
  14. </div>
  15. </div>
  16. {% if noCol == false %}</div>{% endif %}
  17. {% endmacro %}
  18. {% macro productField(colspan, field, fieldName, fieldDisplay = false, displaySuffix="",attr="") %}
  19. {% if fieldDisplay == false %}{% set fieldDisplay = fieldName %}{% endif %}
  20. <td {{ attr|raw }} colspan="{{ colspan }}" class="{{ fieldName }}">
  21. <div class="value" v-show="{{ fieldName }}Inherited == false" v-on:click="{{ fieldName }}Inherited = true">
  22. <div v-if="{{ fieldName }}">
  23. {% verbatim %}{{ {% endverbatim %}{{ fieldDisplay }} {% verbatim %}}}{% endverbatim %}{{ displaySuffix }}
  24. </div>
  25. <div v-else class="inherited">
  26. {% verbatim %}{{ productFamily.{% endverbatim %}{{ fieldDisplay }} {% verbatim %}}}{% endverbatim %}{{ displaySuffix }}
  27. </div>
  28. </div>
  29. <div v-show="{{ fieldName }}Inherited == true">
  30. {{ form_widget(field, {'attr' : {'v-model' : fieldName , 'v-on:focusout': fieldName~'Inherited = false', '@change' : fieldName~'Updated'}}) }}
  31. </div>
  32. <button v-show="{{ fieldName }}" v-on:click="{{ fieldName }} = null; {{ fieldName }}Inherited = false; "
  33. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  34. </td>
  35. {% endmacro %}
  36. {% macro priceField(field, fieldTax, fieldName, behaviorPriceValue) %}
  37. <div class="form-group field-price col-12" v-show="behaviorPrice == '{{ behaviorPriceValue }}'">
  38. <div class="row">
  39. <div class="col-12">
  40. {{ form_label(field) }}
  41. </div>
  42. <div class="col-6">
  43. <div class="form-widget">
  44. <div class="input-group">
  45. {{ form_widget(field, {'attr' : {'v-model': fieldName, '@change' : fieldName~'Updated'}}) }}
  46. <div class="input-group-append">
  47. <span class="input-group-text">€ HT
  48. {% if behaviorPriceValue == 'by-reference-unit' %}/ ${ unitReference }{% endif %}
  49. </span>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. <div class="col-6">
  55. <div class="input-group">
  56. {{ form_widget(fieldTax, {'attr' : {'v-model': fieldName ~ 'WithTax', '@change' : fieldName~'WithTaxUpdated'}}) }}
  57. <div class="input-group-append">
  58. <span class="input-group-text">€ TTC
  59. {% if behaviorPriceValue == 'by-reference-unit' %}/ ${ unitReference }{% endif %}
  60. </span>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. {% endmacro %}
  67. {% macro reductionCatalogForm(form) %}
  68. {{ _self.startCard(6, 'ReductionCatalog.info') }}
  69. <div class="col-12">
  70. {{ form_row(form.title) }}
  71. </div>
  72. {# <div class="col-12">
  73. {{ form_row(form.fromQuantity) }}
  74. </div>
  75. #}
  76. <div class="col-12">
  77. {{ form_row(form.behaviorTaxRate, {"attr" : {":required": "reductionActive"}}) }}
  78. </div>
  79. <div class="col-12">
  80. {{ form_row(form.unit, {"attr" : {":required": "reductionActive"}}) }}
  81. </div>
  82. <div class="col-12">
  83. {{ form_row(form.value, {"attr" : {":required": "reductionActive"}}) }}
  84. </div>
  85. {{ _self.endCard() }}
  86. {{ _self.startCard(6, 'ReductionCatalog.conditions','success') }}
  87. <div class="col-12">
  88. <div class="form-group">
  89. <div class="form-group">
  90. {{ form_widget(form.permanent, {"attr" : {'v-model' : 'reductionPermanent' } }) }}
  91. </div>
  92. <div class="input-group" v-show="reductionPermanent == false">
  93. <div class="input-group-prepend">
  94. <span class="input-group-text"><i class="far fa-clock"></i></span>
  95. </div>
  96. <input type="text" class="form-control float-right date-time-range">
  97. <div class="hidden date-time-range-fields" style="display: none;">
  98. {{ form_widget(form.dateStart, {"attr" : {'class' : 'date-start'}}) }}
  99. {{ form_widget(form.dateEnd, {"attr" : {'class' : 'date-end'}}) }}
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. <div class="col-12">
  105. <div class="form-group">
  106. <div class="form-group">
  107. {{ form_widget(form.usersActive, {"attr" : {'v-model' : 'reductionUsersActive' } }) }}
  108. </div>
  109. <div class="form-widget" v-show="reductionUsersActive == true">
  110. {{ form_widget(form.users) }}
  111. </div>
  112. </div>
  113. </div>
  114. <div class="col-12">
  115. <div class="form-group">
  116. <div class="form-group">
  117. {{ form_widget(form.groupUsersActive, {"attr" : {'v-model' : 'reductionGroupUsersActive' } }) }}
  118. </div>
  119. <div class="form-widget" v-show="reductionGroupUsersActive == true">
  120. {{ form_widget(form.groupUsers) }}
  121. </div>
  122. </div>
  123. </div>
  124. {% if form.suppliers is defined %}
  125. <div class="col-12">
  126. <div class="form-group">
  127. <div class="form-group">
  128. {{ form_widget(form.suppliersActive, {"attr" : {'v-model' : 'reductionSuppliersActive' } }) }}
  129. </div>
  130. <div class="form-widget" v-show="reductionSuppliersActive == true">
  131. {{ form_widget(form.suppliers) }}
  132. </div>
  133. </div>
  134. </div>
  135. {% endif %}
  136. {% if form.productCategories is defined %}
  137. <div class="col-12">
  138. <div class="form-group">
  139. <div class="form-group">
  140. {{ form_widget(form.productCategoriesActive, {"attr" : {'v-model' : 'reductionProductCategoriesActive' } }) }}
  141. </div>
  142. <div class="form-widget" v-show="reductionProductCategoriesActive == true">
  143. {{ form_widget(form.productCategories) }}
  144. </div>
  145. </div>
  146. </div>
  147. {% endif %}
  148. {% if form.productFamilies is defined %}
  149. <div class="col-12">
  150. <div class="form-group">
  151. <div class="form-group">
  152. {{ form_widget(form.productFamiliesActive, {"attr" : {'v-model' : 'reductionProductFamiliesActive' } }) }}
  153. </div>
  154. <div class="form-widget" v-show="reductionProductFamiliesActive == true">
  155. {{ form_widget(form.productFamilies) }}
  156. </div>
  157. </div>
  158. </div>
  159. {% endif %}
  160. {{ _self.endCard() }}
  161. {% endmacro %}
  162. {% macro reductionCatalogFormValues(formValues, isProductFamilyForm= false) %}
  163. <script>
  164. window.mixinReductionValues = {
  165. {% if formValues.status == false and isProductFamilyForm %}reductionActive: false,{% endif %}
  166. {% if formValues.permanent is not null and formValues.permanent == false %}reductionPermanent: false,{% endif %}
  167. {% if formValues.users is not empty %}reductionUsersActive: true,{% endif %}
  168. {% if formValues.groupUsers is not empty %}reductionGroupUsersActive: true,{% endif %}
  169. {% if formValues.productFamilies is not empty %}reductionProductFamiliesActive: true,{% endif %}
  170. {% if formValues.productCategories is not empty %}reductionProductCategoriesActive: true,{% endif %}
  171. {% if formValues.suppliers is not empty %}reductionSuppliersActive: true,{% endif %}
  172. }
  173. </script>
  174. {% endmacro %}