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.

205 lines
8.5KB

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