395 line
17KB

  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. {{ _self.order_modal_button('#modal-order-send-payment-link', 'btn-info', "action.order.sendPaymentLink", 'credit-card') }}
  238. </div>
  239. </div>
  240. {% endmacro %}
  241. {% macro mainInfo() %}
  242. {#${order.id}#}
  243. <div class="col-3">
  244. <div class="info-box">
  245. <span class="info-box-icon bg-info">
  246. <i class="far fa-user"></i></span>
  247. <div class="info-box-content">
  248. <span class="info-box-text">{{ "field.default.user"|trans({}, 'lcshop') }}</span>
  249. <strong v-if="order.user" v-html="order.user"></strong>
  250. <strong v-else v-html="order.visitor"></strong>
  251. </div>
  252. </div>
  253. </div>
  254. <div class="col-3">
  255. <div class="info-box">
  256. <span class="info-box-icon bg-success">
  257. <i class="far fa-calendar"></i></span>
  258. <div class="info-box-content">
  259. <span class="info-box-text">{{ "field.default.date"|trans({}, 'lcshop') }}</span>
  260. <span class="info-box-number" v-if="order.createdAt"> ${order.createdAt}</span>
  261. <span class="info-box-number" v-else> ${order.createdAt}</span>
  262. </div>
  263. </div>
  264. </div>
  265. <div class="col-3">
  266. <div class="info-box">
  267. <span class="info-box-icon bg-warning">
  268. <i class="fa fa-euro-sign"></i></span>
  269. <div class="info-box-content">
  270. <span class="info-box-text">{{ "field.OrderShop.total"|trans({}, 'lcshop') }}</span>
  271. <strong> ${order.totalWithTax} €</strong>
  272. </div>
  273. </div>
  274. </div>
  275. <div class="col-3">
  276. <div class="info-box">
  277. <span class="info-box-icon bg-danger">
  278. <i class="fa fa-info"></i></span>
  279. <div class="info-box-content">
  280. <span class="info-box-text">{{ "field.OrderShop.status"|trans({}, 'lcshop') }}</span>
  281. <strong> ${order.orderStatus}</strong>
  282. {{ _self.order_modal_button('#modal-order-status') }}
  283. </div>
  284. </div>
  285. </div>
  286. {#
  287. <div class="col-3">
  288. <strong>{{ "field.OrderShop.status"|trans }} </strong><br/>
  289. <span>${order.orderStatus}</span>
  290. <button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-order-status">
  291. {{ "action.edit"|trans }}
  292. </button>
  293. </div>#}
  294. {% endmacro mainInfo %}
  295. {% macro address_invoice() %}
  296. <div class="info-box">
  297. <span class="info-box-icon bg-info">
  298. <i class="fa fa-address-card"></i></span>
  299. <div class="info-box-content">
  300. <strong>{{ "field.default.invoiceAddress"|trans({}, 'lcshop') }}</strong>
  301. <address v-html="order.invoiceAddress">
  302. </address>
  303. {{ _self.order_modal_button('#modal-order-invoice-address') }}
  304. </div>
  305. </div>
  306. <div class="info-box">
  307. <span class="info-box-icon bg-success">
  308. <i class="fa fa-map-marked-alt"></i></span>
  309. <div class="info-box-content">
  310. <div v-if="order.deliveryType == 'home'">
  311. <strong>{{ "field.default.deliveryAddress"|trans({}, 'lcshop') }}</strong>
  312. <address v-html="order.deliveryAddress">
  313. </address>
  314. </div>
  315. <div v-else-if="order.deliveryType == 'point-sale'">
  316. <h6><strong>{{ "field.default.deliveryPointSale"|trans({}, 'lcshop') }} : </strong></h6>
  317. <address v-html="order.deliveryPointSale">
  318. </address>
  319. </div>
  320. <div v-else>
  321. Aucun lieu de livraison défini.
  322. </div>
  323. {{ _self.order_modal_button('#modal-order-delivery-address') }}
  324. </div>
  325. </div>
  326. <div class="info-box">
  327. <span class="info-box-icon bg-danger">
  328. <i class="fa fa-clock"></i></span>
  329. <div class="info-box-content">
  330. <h6><strong>{{ "field.default.deliveryAvailabilty"|trans({}, 'lcshop') }} : </strong></h6>
  331. <div v-if="order.deliveryType == 'home'">
  332. <div v-html="order.deliveryAvailabilityZone">
  333. </div>
  334. </div>
  335. <div v-else-if="order.deliveryType == 'point-sale'">
  336. <div v-html="order.deliveryAvailabilityPointSale">
  337. </div>
  338. </div>
  339. {{ _self.order_modal_button('#modal-order-delivery-availability') }}
  340. </div>
  341. </div>
  342. </div>
  343. {% endmacro addressInfo %}
  344. {% macro order_modal_button(modalId, class="btn-default", trad="action.edit", icon=false) %}
  345. <button v-show="editionMode && modalExist('{{ modalId }}')" type="button" class="btn {{ class }}"
  346. data-toggle="modal"
  347. data-target="{{ modalId }}">
  348. {% if icon %}
  349. <i class="fa fa-{{ icon }}"></i>
  350. {% endif %}
  351. {{ trad|trans }}
  352. </button>
  353. {% endmacro order_modal_button %}