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.

394 lines
16KB

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