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.

275 lines
14KB

  1. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  2. {% import '@LcShop/backend/productfamily/macros.html.twig' as product_family_macros %}
  3. {% trans_default_domain 'lcshop' %}
  4. {# {% import _self as formMacros %} #}
  5. <div class="row">
  6. {{ macros.startCard(12, 'ProductFamily.products', 'light', true) }}
  7. <table class="table datagrid sortable lc-sortable-products products-collection-table" style="margin-bottom: 20px;"
  8. :data-index="formProducts.length"
  9. data-prototype="{{ product_family_macros.product_row(form.products.vars.prototype)|e('html_attr') }}">
  10. <thead>
  11. <tr>
  12. <th>
  13. </th>
  14. <th colspan="4" class="string" v-show="productsQuantityAsTitle == false">
  15. Titre
  16. <button v-on:click="emptyProductsField('title');"
  17. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  18. </th>
  19. <th colspan="2" class="string ">
  20. Quantité
  21. <button v-on:click="emptyProductsField('quantity');"
  22. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  23. </th>
  24. <th colspan="2" class="quantity">
  25. Unité
  26. <button v-on:click="emptyProductsField('unit');"
  27. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  28. </th>
  29. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  30. colspan="3" class="buyingPriceByRefUnit ">
  31. PA HT / ${ getUnitReference() }
  32. <button v-on:click="emptyProductsField('buyingPriceByRefUnit');"
  33. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  34. </th>
  35. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  36. colspan="3" class="priceByRefUnit">
  37. PA TTC / ${ getUnitReference() }
  38. <button v-on:click="emptyProductsField('buyingPriceByRefUnitWithTax');"
  39. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  40. </th>
  41. <th colspan="3" class="price main-info">
  42. PA HT
  43. <button v-show="productFamily.behaviorPrice == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'"
  44. v-on:click="emptyProductsField('buyingPrice');"
  45. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  46. </th>
  47. <th colspan="3" class="price"
  48. v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
  49. PA TTC
  50. <button v-on:click="emptyProductsField('buyingPriceWithTax');"
  51. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  52. </th>
  53. <th colspan="3" class="main-info">
  54. Coef
  55. <button v-on:click="emptyProductsField('multiplyingFactor');"
  56. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  57. </th>
  58. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  59. colspan="3" class="">
  60. PV HT / ${ getUnitReference() }
  61. <button v-on:click="emptyProductsField('priceByRefUnit');"
  62. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  63. </th>
  64. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  65. colspan="3" class="price">
  66. PV TTC / ${ getUnitReference() }
  67. <button v-on:click="emptyProductsField('priceByRefUnitWithTax');"
  68. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  69. </th>
  70. <th colspan="3" class="price">
  71. {# v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'"> #}
  72. PV HT
  73. <button v-show="productFamily.behaviorPrice == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'"
  74. v-on:click="emptyProductsField('price');"
  75. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  76. </th>
  77. <th colspan="3" class="price main-info">
  78. PV TTC
  79. <button v-show="productFamily.behaviorPrice == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'"
  80. v-on:click="emptyProductsField('priceWithTax');"
  81. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  82. </th>
  83. <th colspan="2" v-show="giftVoucherActive!= true">
  84. Marge HT
  85. </th>
  86. <th colspan="2" class=""
  87. v-show="behaviorExpirationDate== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT') }}'">
  88. <span style="text-transform: uppercase"> ${typeExpirationDate}</span>
  89. <button v-on:click="emptyProductsField('propertyExpirationDate');"
  90. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  91. </th>
  92. <th colspan="2"
  93. v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}'">
  94. Stock
  95. <button v-on:click="emptyProductsField('availableQuantity');"
  96. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  97. </th>
  98. <th colspan="2"
  99. v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' && behaviorStockWeek!= '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') }}'">
  100. Stock par défaut
  101. <button v-on:click="emptyProductsField('availableQuantityDefault');"
  102. class="btn btn-empty-field" type="button"><i class="fa fa-undo"></i></button>
  103. </th>
  104. <th colspan="2">
  105. Semaine / Commandés
  106. </th>
  107. {# <th colspan="4"
  108. v-show="giftVoucherActive== true">
  109. Réduction "Bon cadeaux"
  110. </th> #}
  111. <th colspan="3" class="">
  112. Action
  113. </th>
  114. </tr>
  115. </thead>
  116. <tbody class="products-collection">
  117. <template>
  118. <product-form v-for="(formProduct, name, index) in formProducts" v-bind:key="name"
  119. :key-form="name" ref="productForm" v-bind:product-family="productFamily"
  120. :template="formProduct"></product-form>
  121. </template>
  122. </tbody>
  123. <tfoot>
  124. <th>
  125. Rappel
  126. </th>
  127. <th colspan="4" class="string" v-show="productsQuantityAsTitle == false">
  128. ${title}
  129. </th>
  130. <th colspan="2" class="string ">
  131. ${productFamily.quantity}
  132. </th>
  133. <th colspan="2" class="quantity">
  134. ${productFamily.unitWording}
  135. </th>
  136. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  137. colspan="3" class="buyingPriceByRefUnit">
  138. ${productFamily.buyingPriceByRefUnit}
  139. </th>
  140. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  141. colspan="3" class="priceByRefUnit">
  142. ${productFamily.buyingPriceByRefUnitWithTax}
  143. </th>
  144. <th colspan="3" class="price main-info">
  145. ${productFamily.buyingPrice}
  146. </th>
  147. <th colspan="3" class="price"
  148. v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'">
  149. ${productFamily.buyingPriceWithTax}
  150. </th>
  151. <th colspan="3" class="main-info">
  152. ${productFamily.multiplyingFactor}
  153. </th>
  154. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  155. colspan="3" class="">
  156. ${productFamily.priceByRefUnit}
  157. </th>
  158. <th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'"
  159. colspan="3" class="price">
  160. ${productFamily.priceByRefUnitWithTax}
  161. </th>
  162. <th colspan="3" class="price">
  163. {# v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'"> #}
  164. ${productFamily.price}
  165. </th>
  166. <th colspan="3" class="price main-info">
  167. ${productFamily.priceWithTax}
  168. </th>
  169. <th colspan="2" class="price" v-show="giftVoucherActive!= true">
  170. ${productFamily.marginProfit}€<br/>
  171. ${productFamily.marginProfitPercent}%
  172. </td>
  173. <th colspan="2" class=""
  174. v-show="behaviorExpirationDate== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT') }}'">
  175. ${propertyExpirationDate}
  176. </th>
  177. <th colspan="2"
  178. v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}'">
  179. </th>
  180. <th colspan="2"
  181. v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' && behaviorStockWeek!= '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') }}'">
  182. </th>
  183. <th colspan="2">
  184. </th>
  185. {# <th colspan="4"
  186. v-show="giftVoucherActive== true">
  187. </th> #}
  188. <th colspan="3" class="">
  189. </th>
  190. </tfoot>
  191. </table>
  192. <div class="row" style="margin: 0 25px">
  193. <div class="col-3 form-group">
  194. {{ form_widget(form.productsQuantityAsTitle, {"attr":{'v-model' : 'productsQuantityAsTitle'}}) }}
  195. </div>
  196. <div class="col-3 form-group"></div>
  197. <div class="col-6 form-group float-right">
  198. <button type="button" class="add_tag_link btn-add-product btn btn-default" @click="addProductForm"><span
  199. class="fa fa-plus"></span> Ajouter une déclinaison
  200. </button>
  201. </div>
  202. <div class="col-12">
  203. <p>
  204. <strong>Aide à l'utilisation - Raccourci clavier</strong>
  205. <ul>
  206. <li><strong>TAB</strong> : Champ suivant</li>
  207. <li><strong>SHIFT + TAB</strong> : Champ précédent</li>
  208. <li><strong>FLÈCHE BAS</strong> : Déclinaison suivante</li>
  209. <li><strong>FLÈCHE HAUT</strong> : Déclinaison précédente</li>
  210. <li><strong>SHIFT + [+]</strong> : Ajout d'une nouvelle déclinaison</li>
  211. </ul>
  212. </p>
  213. </div>
  214. </div>
  215. <div class="clearfix"></div>
  216. {{ macros.endCard() }}
  217. </div>
  218. {% do form.products.setRendered %}
  219. <script>
  220. window.productForm = new Array();
  221. window.formProductTemplate = new Array();
  222. {% for keyForm,i in sortableProductsField %}
  223. {% set product = form.products[i] %}
  224. {# {% if product.vars.value.status >= 0 and (product.vars.value.originProduct is null or product.vars.value.originProduct == false) %} #}
  225. window.productForm[{{ keyForm }}] = {
  226. {% if product.vars.value.originProduct is defined %}originProduct: parseInt({{ product.vars.value.originProduct }}),{% endif %}
  227. {% if product.vars.value.status is defined %}status: parseInt({{ product.vars.value.status }}),{% endif %}
  228. {% if product.vars.value.position %}position: "{{ product.vars.value.position }}",{% endif %}
  229. {% if product.vars.value.title %}title: "{{ product.vars.value.title }}",{% endif %}
  230. {% if product.vars.value.quantity %}quantity: "{{ product.vars.value.quantity }}",{% endif %}
  231. {% if product.vars.value.unit %}unit: {{ product.vars.value.unit.id }},{% endif %}
  232. {% if product.vars.value.buyingPrice %}buyingPrice: parseFloat({{ product.vars.value.buyingPrice }}).toFixed(3),{% endif %}
  233. {% if product.vars.value.buyingPriceByRefUnit %}buyingPriceByRefUnit: parseFloat({{ product.vars.value.buyingPriceByRefUnit }}).toFixed(3),{% endif %}
  234. {% if product.vars.value.price %}price: parseFloat({{ product.vars.value.price }}).toFixed(3),{% endif %}
  235. {% if product.vars.value.priceByRefUnit %}priceByRefUnit: parseFloat({{ product.vars.value.priceByRefUnit }}).toFixed(3),{% endif %}
  236. {% if product.vars.value.availableQuantity %}availableQuantity: parseInt({{ product.vars.value.availableQuantity }}),{% endif %}
  237. {% if product.vars.value.availableQuantityDefault %}availableQuantityDefault: parseInt({{ product.vars.value.availableQuantityDefault }}),{% endif %}
  238. {% if product.vars.value.propertyExpirationDate %}propertyExpirationDate: "{{ product.vars.value.propertyExpirationDate }}",{% endif %}
  239. {% if product.vars.value.exportTitle %}exportTitle: "{{ product.vars.value.exportTitle }}",{% endif %}
  240. {% if product.vars.value.exportNote %}exportNote: "{{ product.vars.value.exportNote }}",{% endif %}
  241. {# {% if product.vars.value.giftVoucherReductionCart %}giftVoucherReductionCart: {{ product.vars.value.giftVoucherReductionCart.id }},{% endif %} #}
  242. {# {% if product.vars.value.expirationDate %}expirationDate: "{{ product.vars.value.expirationDate|date('d/m/Y') }}"{% endif %} #}
  243. };
  244. window.formProductTemplate[{{ keyForm }}] = '{{ product_family_macros.product_row(product, productsSalesStatistic['data'][product.vars.value.id]['data'])|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}';
  245. {# {% endif %} #}
  246. {% endfor %}
  247. </script>