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.

357 lines
15KB

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