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 17KB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. {% trans_default_domain 'lcshop' %}
  2. {% macro tableHead() %}
  3. <table id="order-products-list" class="table table-striped">
  4. <thead>
  5. <tr>
  6. <th :class="editionMode ? '' : 'hidden'">
  7. </th>
  8. <th colspan="2">
  9. <span>Produits / Producteurs</span>
  10. </th>
  11. <th>
  12. <span>Prix HT à l'unité</span>
  13. </th>
  14. <th>
  15. <span>Prix TTC à l'unité </span>
  16. </th>
  17. <th>
  18. <span>Marge </span>
  19. </th>
  20. <th>
  21. <span>Disponibilité</span>
  22. </th>
  23. <th>
  24. <span>Quantité</span>
  25. </th>
  26. <th>
  27. <span>Total</span>
  28. </th>
  29. <th :class="editionMode ? '' : 'hidden'">
  30. Actions
  31. </th>
  32. </tr>
  33. </thead>
  34. {% endmacro %}
  35. {% macro products() %}
  36. <tbody>
  37. <template v-for="(orderProduct, key) in orderProducts">
  38. <order-product ref="orderProductBLOP" :order-product="orderProduct" :edition-mode="editionMode"
  39. :template="templateTest"
  40. :key-item="key"></order-product>
  41. </template>
  42. </tbody>
  43. {% endmacro %}
  44. {% macro productsTemplate(form_order_products=null) %}
  45. <tr :class=" orderProduct.isRedelivery ? 'redelivery order-product-item' : 'order-product-item'">
  46. <td :class="editionMode ? '' : 'hidden'">
  47. <input type="checkbox" :value="orderProduct.id" class="order-product-checkbox" />
  48. </td>
  49. <td colspan="2">
  50. {% verbatim %}{{orderProduct.title}}{% endverbatim %}
  51. <span v-show="orderProduct.hasRedelivery">
  52. - <i class="fa fa-undo" data-toggle="tooltip" :title="orderProduct.redeliveryOrderShop" ></i>
  53. </span>
  54. <span v-show="orderProduct.isRedelivery">
  55. - <i class="fa fa-undo" data-toggle="tooltip" title="Ce produit fait l'objet d'une relivraison" ></i>
  56. </span>
  57. </td>
  58. <td>
  59. {% verbatim %}{{orderProduct.price}}{% endverbatim %}€
  60. </td>
  61. <td>
  62. {% verbatim %}{{orderProduct.priceWithTax}}{% endverbatim %}€
  63. </td>
  64. <td>
  65. {% verbatim %}{{orderProduct.buyingPrice}}{% endverbatim %}€ <br />
  66. {% verbatim %}{{orderProduct.totalMargin}}{% endverbatim %}€ /
  67. {% verbatim %}{{orderProduct.marginPercent}}{% endverbatim %}%
  68. </td>
  69. <td>
  70. {% verbatim %}{{orderProduct.availableQuantity}}{% endverbatim %}
  71. </td>
  72. <td>
  73. {% if form_order_products is not null %}
  74. <div :class="editionMode && orderProduct.isRedelivery ==false ? '' : 'hidden'">
  75. {{ form_widget(form_order_products.orderProducts.vars.prototype.quantityOrder, {'attr' : {'ref': 'fieldQuantity', 'v-model' : 'orderProduct.quantityOrder', '@change' : 'updateOrderProducts'}}) }}
  76. {{ form_widget(form_order_products.orderProducts.vars.prototype.product, {'attr' : {'ref' : 'fieldProduct', 'v-model' : 'orderProduct.product'}}) }}
  77. {#{{ form_widget(form_order_products.orderProducts.vars.prototype.id, {'attr' : {'ref' : 'fieldId', 'v-model' : 'orderProduct.id'}}) }}#}
  78. <button type="button" class="btn-remove-product btn btn-default" @click="deleteOrderProduct()">
  79. <i class="fa fa-trash"></i>
  80. </button>
  81. </div>
  82. <div :class="editionMode && orderProduct.isRedelivery ==false ? 'hidden' : ''">
  83. {% verbatim %}{{ orderProduct.quantityOrder }}{% endverbatim %}
  84. </div>
  85. {% else %}
  86. {% verbatim %}{{ orderProduct.quantityOrder }}{% endverbatim %}
  87. {% endif %}
  88. </td>
  89. <td>
  90. {% verbatim %}{{orderProduct.totalWithTaxAndReduction}}{% endverbatim %}€
  91. </td>
  92. <td :class="editionMode ? '' : 'hidden'">
  93. <div class="dropdown" :class="editionMode ? '' : 'hidden'">
  94. <button class="btn btn-info dropdown-toggle" type="button" id="dropdownMenu" data-toggle="dropdown" aria-expanded="false">
  95. Actions
  96. </button>
  97. <div class="dropdown-menu" aria-labelledby="dropdownMenu">
  98. <button v-show="orderProduct.hasRedelivery == false"type="button" class="dropdown-item" @click="modalAddRedeliveryOrderProduct">
  99. Relivraison
  100. </button>
  101. <button type="button" class="dropdown-item" >
  102. Avoirs groupé
  103. </button>
  104. </div>
  105. </div>
  106. </td>
  107. </tr>
  108. {% endmacro %}
  109. {% macro tableTotal() %}
  110. </table>
  111. <div class="col-12">
  112. <button type="button" class="dropdown-item" >
  113. Avoirs groupé
  114. </button>
  115. </div>
  116. <div class="clearfix"></div>
  117. <div class="row">
  118. <div class="col-6">
  119. <div class="row">
  120. <div class="col-12">
  121. {{ _self.order_modal_button('#modal-add-product-to-order', 'btn-success', "action.order.addOrderProduct", 'plus') }}
  122. {{ _self.order_modal_button('#modal-add-reduction-cart', 'btn-warning', "action.order.addReductionCart", 'shopping-basket') }}
  123. {{ _self.order_modal_button('#modal-add-reduction-credit', 'btn-warning', "action.order.addReductionCredit", 'backspace') }}
  124. </div>
  125. <div class="col-12" style="margin-top: 25px;">
  126. <h6><strong>Historiques des transactions</strong></h6>
  127. {#TODO: afficher si la commande est règlé et afficher une alerte si le montant des paiments est supérieur au montant total de la commande#}
  128. <table class="table table-striped">
  129. <tbody>
  130. <thead>
  131. <tr>
  132. <th>Mode de règlement</th>
  133. <th>Date</th>
  134. <th>Montant</th>
  135. <th>Actions</th>
  136. </tr>
  137. </thead>
  138. <tbody>
  139. <template v-for="(orderPayment, i) in order.orderPayments">
  140. <tr>
  141. <td>${orderPayment.meanPaymentText}</td>
  142. <td>${orderPayment.paidAtText}</td>
  143. <td>${orderPayment.amount}</td>
  144. <td>
  145. <button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')" class="btn-sm btn-info" type="button" @click="editOrderPayment(orderPayment.id)">
  146. <i class="fa fa-pen"></i>
  147. </button>
  148. <button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')"
  149. type="button" class="btn-sm btn-danger"
  150. @click="modalDeleteOrderPayment(orderPayment.id)">
  151. <i class="fa fa-trash"></i>
  152. </button>
  153. </td>
  154. </tr>
  155. </template>
  156. </tbody>
  157. </table>
  158. {{ _self.order_modal_button('#modal-order-payment', 'btn-info', "action.order.addOrderPayment") }}
  159. </div>
  160. <div class="col-8">
  161. <div v-show="order.isOrderPaid" class="alert alert-success alert-dismissible">
  162. <h5><i class="icon fas fa-check"></i> Commande soldé</h5>
  163. </div>
  164. <div v-show="order.isOrderPaid==false" class="alert alert-danger alert-dismissible">
  165. <h5><i class="icon fas fa-check"></i> Commande non soldé</h5>
  166. </div>
  167. </div>
  168. <div class="col-4">
  169. <span class="float-right">Total : ${order.totalOrderPaid}</span>
  170. </div>
  171. </div>
  172. </div>
  173. <div class="col"></div>
  174. <div class="col-5">
  175. <div class="table-responsive">
  176. <table class="table">
  177. <tbody>
  178. <tr>
  179. <th>Total produits TTC</th>
  180. <td>${order.totalOrderProductsWithTax}€</td>
  181. </tr>
  182. <template v-for="(orderReductionCart, key) in order.orderReductionCarts">
  183. <tr>
  184. <th>
  185. ${orderReductionCart.title}
  186. <button v-show="editionMode && modalExist('#modal-delete-reduction-cart')" type="button"
  187. class="btn-sm btn-danger"
  188. @click="modalDeleteOrderReductionCart(orderReductionCart.id)">
  189. <i class="fa fa-trash"></i>
  190. </button>
  191. </th>
  192. <td>${orderReductionCart.amount}€</td>
  193. </tr>
  194. </template>
  195. <template v-for="(orderReductionCredit, key) in order.orderReductionCredits">
  196. <tr>
  197. <th>${orderReductionCredit.title}
  198. <button v-show="editionMode && modalExist('#modal-delete-reduction-credit')"
  199. type="button" class="btn-sm btn-danger"
  200. @click="modalDeleteOrderReductionCredit(orderReductionCredit.id)">
  201. <i class="fa fa-trash"></i>
  202. </button>
  203. </th>
  204. <td>${orderReductionCredit.amount}€</td>
  205. </tr>
  206. </template>
  207. <tr>
  208. <th>Total produits après réductions TTC</th>
  209. <td>${order.totalOrderProductsWithTaxAndReductions}€</td>
  210. </tr>
  211. <tr>
  212. <th>Frais de livraisons TTC</th>
  213. <td>${order.deliveryPriceWithTaxAndReduction}€</td>
  214. </tr>
  215. {# <tr>
  216. <th>Total Taxes </th>
  217. <td>${order.totalWithTax}€</td>
  218. </tr>
  219. #}
  220. <tr>
  221. <th>Total TTC</th>
  222. <td>${order.totalWithTax}€</td>
  223. </tr>
  224. </tbody>
  225. </table>
  226. </div>
  227. </div>
  228. <div class="col-12">
  229. <button v-show="order.user" type="button" class="btn btn-danger" @click="switchEditionMode">
  230. <template v-if="editionMode">
  231. <i class="fa fa-eye"></i> {{ "action.order.viewMode"|trans }}
  232. </template>
  233. <template v-else>
  234. <i class="fa fa-pen"></i> {{ "action.order.editionMode"|trans }}
  235. </template>
  236. </button>
  237. <button v-show="editionMode" type="button" class="btn btn-info float-right">
  238. <i class="fa fa-credit-card"></i> Envoyer le lien de paiement
  239. </button>
  240. </div>
  241. </div>
  242. {% endmacro %}
  243. {% macro mainInfo() %}
  244. {#${order.id}#}
  245. <div class="col-3">
  246. <div class="info-box">
  247. <span class="info-box-icon bg-info">
  248. <i class="far fa-user"></i></span>
  249. <div class="info-box-content">
  250. <span class="info-box-text">{{ "field.default.user"|trans({}, 'lcshop') }}</span>
  251. <strong v-if="order.user" v-html="order.user"></strong>
  252. <strong v-else v-html="order.visitor"></strong>
  253. </div>
  254. </div>
  255. </div>
  256. <div class="col-3">
  257. <div class="info-box">
  258. <span class="info-box-icon bg-success">
  259. <i class="far fa-calendar"></i></span>
  260. <div class="info-box-content">
  261. <span class="info-box-text">{{ "field.default.date"|trans({}, 'lcshop') }}</span>
  262. <span class="info-box-number" v-if="order.createdAt"> ${order.createdAt}</span>
  263. <span class="info-box-number" v-else> ${order.createdAt}</span>
  264. </div>
  265. </div>
  266. </div>
  267. <div class="col-3">
  268. <div class="info-box">
  269. <span class="info-box-icon bg-warning">
  270. <i class="fa fa-euro-sign"></i></span>
  271. <div class="info-box-content">
  272. <span class="info-box-text">{{ "field.OrderShop.total"|trans({}, 'lcshop') }}</span>
  273. <strong> ${order.totalWithTax} €</strong>
  274. </div>
  275. </div>
  276. </div>
  277. <div class="col-3">
  278. <div class="info-box">
  279. <span class="info-box-icon bg-danger">
  280. <i class="fa fa-info"></i></span>
  281. <div class="info-box-content">
  282. <span class="info-box-text">{{ "field.OrderShop.status"|trans({}, 'lcshop') }}</span>
  283. <strong> ${order.orderStatus}</strong>
  284. {{ _self.order_modal_button('#modal-order-status') }}
  285. </div>
  286. </div>
  287. </div>
  288. {#
  289. <div class="col-3">
  290. <strong>{{ "field.OrderShop.status"|trans }} </strong><br/>
  291. <span>${order.orderStatus}</span>
  292. <button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-order-status">
  293. {{ "action.edit"|trans }}
  294. </button>
  295. </div>#}
  296. {% endmacro mainInfo %}
  297. {% macro addressInfo() %}
  298. <div class="col-4">
  299. <div class="info-box">
  300. <span class="info-box-icon bg-info">
  301. <i class="fa fa-address-card"></i></span>
  302. <div class="info-box-content">
  303. <strong>{{ "field.default.invoiceAddress"|trans({}, 'lcshop') }}</strong>
  304. <address v-html="order.invoiceAddress">
  305. </address>
  306. {{ _self.order_modal_button('#modal-order-invoice-address') }}
  307. </div>
  308. </div>
  309. </div>
  310. <div class="col-4">
  311. <div class="info-box">
  312. <span class="info-box-icon bg-success">
  313. <i class="fa fa-map-marked-alt"></i></span>
  314. <div class="info-box-content">
  315. <div v-if="order.deliveryType == 'home'">
  316. <strong>{{ "field.default.deliveryAddress"|trans({}, 'lcshop') }}</strong>
  317. <address v-html="order.deliveryAddress">
  318. </address>
  319. </div>
  320. <div v-else-if="order.deliveryType == 'point-sale'">
  321. <h6><strong>{{ "field.default.deliveryPointSale"|trans({}, 'lcshop') }} : </strong></h6>
  322. <address v-html="order.deliveryPointSale">
  323. </address>
  324. </div>
  325. <div v-else>
  326. Aucun lieu de livraison défini.
  327. </div>
  328. {{ _self.order_modal_button('#modal-order-delivery-address') }}
  329. </div>
  330. </div>
  331. </div>
  332. <div class="col-4">
  333. <div class="info-box">
  334. <span class="info-box-icon bg-danger">
  335. <i class="fa fa-clock"></i></span>
  336. <div class="info-box-content">
  337. <h6><strong>{{ "field.default.deliveryAvailabilty"|trans({}, 'lcshop') }} : </strong></h6>
  338. <div v-if="order.deliveryType == 'home'">
  339. <div v-html="order.deliveryAvailabilityZone">
  340. </div>
  341. </div>
  342. <div v-else-if="order.deliveryType == 'point-sale'">
  343. <div v-html="order.deliveryAvailabilityPointSale">
  344. </div>
  345. </div>
  346. {{ _self.order_modal_button('#modal-order-delivery-availability') }}
  347. </div>
  348. </div>
  349. </div>
  350. {% endmacro addressInfo %}
  351. {% macro order_modal_button(modalId, class="btn-default", trad="action.edit", icon=false) %}
  352. <button v-show="editionMode && modalExist('{{ modalId }}')" type="button" class="btn {{ class }}"
  353. data-toggle="modal"
  354. data-target="{{ modalId }}">
  355. {% if icon %}
  356. <i class="fa fa-{{ icon }}"></i>
  357. {% endif %}
  358. {{ trad|trans }}
  359. </button>
  360. {% endmacro order_modal_button %}