Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

199 lines
8.4KB

  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", 'v-model' : 'reductionBehaviorTaxRate'}}) }}
  78. </div>
  79. <div class="col-12">
  80. {{ form_row(form.unit, {"attr" : {":required": "reductionActive", 'v-model' : 'reductionUnit'}}) }}
  81. </div>
  82. <div class="col-12">
  83. {{ form_row(form.value, {"attr" : {":required": "reductionActive", 'v-model' : 'reductionValue'}}) }}
  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.behaviorTaxRate %}reductionBehaviorTaxRate: '{{ formValues.behaviorTaxRate }}',{% endif %}
  168. {% if formValues.value %}reductionValue: parseFloat({{ formValues.value }}),{% endif %}
  169. {% if formValues.unit %}reductionUnit: "{{ formValues.unit }}",{% endif %}
  170. {% if formValues.users is not empty %}reductionUsersActive: true,{% endif %}
  171. {% if formValues.groupUsers is not empty %}reductionGroupUsersActive: true,{% endif %}
  172. {% if formValues.productFamilies is not empty %}reductionProductFamiliesActive: true,{% endif %}
  173. {% if formValues.productCategories is not empty %}reductionProductCategoriesActive: true,{% endif %}
  174. {% if formValues.suppliers is not empty %}reductionSuppliersActive: true,{% endif %}
  175. }
  176. </script>
  177. {% endmacro %}