Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

317 lines
19KB

  1. {% extends '@LcShop/backend/default/list.html.twig' %}
  2. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  3. {% import '@LcShop/backend/productfamily/macros.html.twig' as product_family_macros %}
  4. {% block table %}
  5. <script>
  6. window.mixinUnitValues = {
  7. unitsList: {{ getUnitsList()|json_encode|raw }}
  8. };
  9. window.mixinPriceValues = {
  10. taxRatesList: {{ getTaxRatesList()|json_encode|raw }}
  11. };
  12. window.appProductFamilyValues = {};
  13. window.productUnitPriceValues = {};
  14. window.productForm ={};
  15. window.formProductTemplate = {};
  16. </script>
  17. <ul id="product-family-advanced-types-list">
  18. {% for i,advancedType in advancedTypes %}
  19. {% set formValues = advancedType.vars.value %}
  20. {% set productFamily = paginator.currentPageResults[i] %}
  21. <script>
  22. window.appProductFamilyValues[{{ i }}] = {
  23. title: "{{ productFamily.title }}",
  24. behaviorCountStock: "{{ productFamily.behaviorCountStock }}",
  25. behaviorStockWeek: "{{ productFamily.behaviorStockWeek }}",
  26. availableQuantity: "{{ productFamily.availableQuantity }}",
  27. availableQuantityDefault: "{{ productFamily.availableQuantityDefault }}",
  28. {% if productFamily.propertyNoveltyExpirationDate %}propertyNoveltyExpirationDate: {{ productFamily.propertyNoveltyExpirationDate }},{% endif %}
  29. typeExpirationDate: "{{ productFamily.typeExpirationDate }}",
  30. behaviorExpirationDate: "{{ productFamily.behaviorExpirationDate }}",
  31. propertyExpirationDate: "{{ productFamily.propertyExpirationDate }}",
  32. {% if productFamily.activeProducts %}activeProducts: {{ productFamily.activeProducts }},{% endif %}
  33. };
  34. window.productUnitPriceValues[{{ i }}] = {
  35. {% if productFamily.activeProducts %}activeProducts: {{ productFamily.activeProducts }},{% endif %}
  36. behaviorPrice: "{{ productFamily.behaviorPrice }}",
  37. unit: parseInt({{ productFamily.unit.id }}),
  38. {% if productFamily.taxRate %}taxRate: parseInt({{ productFamily.taxRate.id }}),{% endif %}
  39. {% if productFamily.supplierTaxRate %}supplierTaxRate: parseInt({{ productFamily.supplierTaxRate.id }}),{% endif %}
  40. quantity: "{{ productFamily.quantity }}",
  41. price: parseFloat({{ productFamily.price }}).toFixed(3),
  42. priceByRefUnit: parseFloat({{ productFamily.priceByRefUnit }}).toFixed(3),
  43. buyingPrice: parseFloat({{ productFamily.buyingPrice }}).toFixed(3),
  44. buyingPriceByRefUnit: parseFloat({{ productFamily.buyingPriceByRefUnit }}).toFixed(3),
  45. }
  46. </script>
  47. <li class="product-family-advanced-type-item">
  48. <div id="product-family-advanced-type-{{ i }}" class="product-family-advanced-type">
  49. {{ form_start(advancedType, {"attr": {"ref": 'advanced-type'}}) }}
  50. <product-unit-price ref="productUnitPrice" inline-template key-form="productfamily">
  51. <div class="row">
  52. {{ form_row(advancedType.unit, {"attr":{'v-model': 'unit', '@change': "unitUpdated"}}) }}
  53. <div class="input-group">
  54. {{ form_widget(advancedType.quantity, {'attr' : {'v-model': 'quantity', '@change': "quantityUpdated"}}) }}
  55. <div class="input-group-append">
  56. <span class="input-group-text">${ unitWording }</span>
  57. </div>
  58. </div>
  59. {{ macros.priceField(advancedType.buyingPrice, advancedType.buyingPriceWithTax, 'buyingPrice', 'by-piece') }}
  60. {{ macros.priceField(advancedType.buyingPriceByRefUnit, advancedType.buyingPriceByRefUnitWithTax, 'buyingPriceByRefUnit', 'by-reference-unit') }}
  61. <div class="input-group">
  62. {{ form_widget(advancedType.multiplyingFactor, {'attr': {'v-model':'multiplyingFactor', '@change' : 'multiplyingFactorUpdated'}}) }}
  63. <div class="input-group-append">
  64. <span class="input-group-text">X</span>
  65. </div>
  66. </div>
  67. {{ macros.priceField(advancedType.price, advancedType.priceWithTax, 'price', 'by-piece') }}
  68. {{ macros.priceField(advancedType.priceByRefUnit, advancedType.priceByRefUnitWithTax, 'priceByRefUnit', 'by-reference-unit') }}
  69. </div>
  70. </product-unit-price>
  71. <table class="table datagrid sortable lc-sortable-products products-collection-table"
  72. :data-index="formProducts.length"
  73. data-prototype="{{ product_family_macros.product_row(advancedType.products.vars.prototype)|e('html_attr') }}">
  74. <thead>
  75. <tr>
  76. <th>
  77. </th>
  78. <th colspan="4" class="string">
  79. Titre
  80. </th>
  81. <th colspan="2" class="string ">
  82. Quantité
  83. </th>
  84. <th colspan="2" class="quantity">
  85. Unité
  86. </th>
  87. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  88. colspan="3" class="buyingPriceByRefUnit">
  89. PA HT / ${ getUnitReference() }
  90. </th>
  91. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  92. colspan="3" class="priceByRefUnit">
  93. PA TTC / ${ getUnitReference() }
  94. </th>
  95. <th colspan="3" class="price"
  96. v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
  97. PA HT
  98. </th>
  99. <th colspan="3" class="price">
  100. PA TTC
  101. </th>
  102. <th colspan="3" class="">
  103. Coef
  104. </th>
  105. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  106. colspan="3" class="">
  107. PV HT / ${ getUnitReference() }
  108. </th>
  109. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  110. colspan="3" class="price">
  111. PV TTC / ${ getUnitReference() }
  112. </th>
  113. <th colspan="3" class="price"
  114. v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
  115. PV HT
  116. </th>
  117. <th colspan="3" class="price">
  118. PV TTC
  119. </th>
  120. <th colspan="2">
  121. Marge HT
  122. </th>
  123. <th colspan="2" class=""
  124. v-show="behaviorExpirationDate== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT') }}'">
  125. <span style="text-transform: uppercase"> ${typeExpirationDate}</span>
  126. </th>
  127. <th colspan="2"
  128. v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}'">
  129. Stock
  130. </th>
  131. <th colspan="2"
  132. v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' && behaviorStockWeek!= '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') }}'">
  133. Stock par défaut
  134. </th>
  135. <th colspan="2"
  136. v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' || behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}'">
  137. Semaine / Commandés
  138. </th>
  139. <th colspan="2" class="">
  140. Action
  141. </th>
  142. </tr>
  143. </thead>
  144. <tbody class="products-collection">
  145. <template>
  146. <product-form v-for="(formProduct, blop) in formProducts" v-bind:key="formProductKey[blop]"
  147. :key-form="formProductKey[blop]" ref="productForm" v-bind:product-family="productFamily"
  148. :template="formProduct"></product-form>
  149. </template>
  150. </tbody>
  151. <tfoot>
  152. <th>
  153. Rappel
  154. </th>
  155. <th colspan="4" class="string">
  156. ${title}
  157. </th>
  158. <th colspan="2" class="string ">
  159. ${productFamily.quantity}
  160. </th>
  161. <th colspan="2" class="quantity">
  162. ${productFamily.unitWording}
  163. </th>
  164. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  165. colspan="3" class="buyingPriceByRefUnit">
  166. ${productFamily.buyingPriceByRefUnit}
  167. </th>
  168. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  169. colspan="3" class="priceByRefUnit">
  170. ${productFamily.buyingPriceByRefUnitWithTax}
  171. </th>
  172. <th colspan="3" class="price"
  173. v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
  174. ${productFamily.buyingPrice}
  175. </th>
  176. <th colspan="3" class="price">
  177. ${productFamily.buyingPriceWithTax}
  178. </th>
  179. <th colspan="3" class="">
  180. ${productFamily.multiplyingFactor}
  181. </th>
  182. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  183. colspan="3" class="">
  184. ${productFamily.priceByRefUnit}
  185. </th>
  186. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  187. colspan="3" class="price">
  188. ${productFamily.priceByRefUnitWithTax}
  189. </th>
  190. <th colspan="3" class="price"
  191. v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
  192. ${productFamily.price}
  193. </th>
  194. <th colspan="3" class="price">
  195. ${productFamily.priceWithTax}
  196. </th>
  197. <th colspan="2" class="price">
  198. ${productFamily.marginProfit}€<br/>
  199. ${productFamily.marginProfitPercent}%
  200. </td>
  201. <th colspan="2" class=""
  202. v-show="behaviorExpirationDate== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT') }}'">
  203. ${propertyExpirationDate}
  204. </th>
  205. <th colspan="2"
  206. v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}'">
  207. </th>
  208. <th colspan="2"
  209. v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' && behaviorStockWeek!= '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') }}'">
  210. </th>
  211. <th colspan="2"
  212. v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' || behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}'">
  213. </th>
  214. <th colspan="2" class="">
  215. </th>
  216. </tfoot>
  217. </table>
  218. <button type="button" class="add_tag_link btn-add-product btn btn-default" @click="addProductForm"><span
  219. class="fa fa-plus"></span> Ajouter une déclinaison
  220. </button>
  221. <p>
  222. <strong>Aide à l'utilisation - Raccourci clavier</strong>
  223. <ul>
  224. <li><strong>TAB</strong> : Champ suivant</li>
  225. <li><strong>SHIFT + TAB</strong> : Champ précédent</li>
  226. <li><strong>FLÈCHE BAS</strong> : Déclinaison suivante</li>
  227. <li><strong>FLÈCHE HAUT</strong> : Déclinaison précédente</li>
  228. <li><strong>SHIFT + [+]</strong> : Ajout d'une nouvelle déclinaison</li>
  229. </ul>
  230. </p>
  231. <div class="clearfix"></div>
  232. {% do advancedType.products.setRendered %}
  233. <script>
  234. window.productForm[{{ i }}] ={};
  235. window.formProductTemplate[{{ i }}] = {};
  236. {% for keyForm,y in sortableProductsField[i] %}
  237. {% set product = advancedType.products[y] %}
  238. window.productForm[{{ i }}][{{ keyForm }}] = {
  239. {% if product.vars.value.position %}position: "{{ product.vars.value.position }}",{% endif %}
  240. {% if product.vars.value.title %}title: "{{ product.vars.value.title }}",{% endif %}
  241. {% if product.vars.value.quantity %}quantity: "{{ product.vars.value.quantity }}",{% endif %}
  242. {% if product.vars.value.unit %}unit: {{ product.vars.value.unit.id }},{% endif %}
  243. {% if product.vars.value.buyingPrice %}buyingPrice: parseFloat({{ product.vars.value.buyingPrice }}).toFixed(3),{% endif %}
  244. {% if product.vars.value.buyingPriceByRefUnit %}buyingPriceByRefUnit: parseFloat({{ product.vars.value.buyingPriceByRefUnit }}).toFixed(3),{% endif %}
  245. {% if product.vars.value.price %}price: parseFloat({{ product.vars.value.price }}).toFixed(3),{% endif %}
  246. {% if product.vars.value.priceByRefUnit %}priceByRefUnit: parseFloat({{ product.vars.value.priceByRefUnit }}).toFixed(3),{% endif %}
  247. {% if product.vars.value.availableQuantity %}availableQuantity: parseInt({{ product.vars.value.availableQuantity }}),{% endif %}
  248. {% if product.vars.value.availableQuantityDefault %}availableQuantityDefault: parseInt({{ product.vars.value.availableQuantityDefault }}),{% endif %}
  249. {% if product.vars.value.propertyExpirationDate %}propertyExpirationDate: "{{ product.vars.value.propertyExpirationDate }}",{% endif %}
  250. {#{% if product.vars.value.expirationDate %}expirationDate: "{{ product.vars.value.expirationDate|date('d/m/Y') }}"{% endif %}#}
  251. };
  252. window.formProductTemplate[{{ i }}][{{ keyForm }}] = '{{ product_family_macros.product_row(product, totalProductOrdered[i][product.vars.value.id])|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}';
  253. {% endfor %}
  254. </script>
  255. {{ form_end(advancedType) }}
  256. </div>
  257. </li>
  258. {% endfor %}
  259. </ul>
  260. {% endblock table %}
  261. {% block head_stylesheets %}
  262. {{ parent() }}
  263. {% endblock %}
  264. {% block plugin_javascript %}
  265. {{ parent() }}
  266. {% endblock %}
  267. {% block script_javascript %}
  268. {{ parent() }}
  269. {% include '@LcShop/backend/default/block/script-vuejs.html.twig' %}
  270. <script src="{{ asset('assets/js/backend/script/productfamily/vuejs-advanced-edition-product-family.js')|lc_cache }}"></script>
  271. {% endblock %}