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.

516 lines
19KB

  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="clearfix"></div>
  112. <div class="row">
  113. <div class="col-6">
  114. <div class="row">
  115. <div class="col-12">
  116. {{ _self.order_modal_button('#modal-add-product-to-order', 'btn-success', "action.order.addOrderProduct", 'plus') }}
  117. {{ _self.order_modal_button('#modal-add-reduction-cart', 'btn-warning', "action.order.addReductionCart", 'shopping-basket') }}
  118. {{ _self.order_modal_button('#modal-add-reduction-credit', 'btn-warning', "action.order.addReductionCredit", 'backspace') }}
  119. </div>
  120. </div>
  121. </div>
  122. <div class="col"></div>
  123. <div class="col-5">
  124. <div class="table-responsive">
  125. <table class="table">
  126. <tbody>
  127. <tr>
  128. <th>Total produits TTC</th>
  129. <td>${order.totalOrderProductsWithTax}€</td>
  130. </tr>
  131. <template v-for="(orderReductionCart, key) in order.orderReductionCarts">
  132. <tr>
  133. <th>
  134. ${orderReductionCart.title}
  135. <button v-show="editionMode && modalExist('#modal-delete-reduction-cart')" type="button"
  136. class="btn-sm btn-danger"
  137. @click="modalDeleteOrderReductionCart(orderReductionCart.id)">
  138. <i class="fa fa-trash"></i>
  139. </button>
  140. </th>
  141. <td>${orderReductionCart.amount}€</td>
  142. </tr>
  143. </template>
  144. <template v-for="(orderReductionCredit, key) in order.orderReductionCredits">
  145. <tr>
  146. <th>${orderReductionCredit.title}
  147. <button v-show="editionMode && modalExist('#modal-delete-reduction-credit')"
  148. type="button" class="btn-sm btn-danger"
  149. @click="modalDeleteOrderReductionCredit(orderReductionCredit.id)">
  150. <i class="fa fa-trash"></i>
  151. </button>
  152. </th>
  153. <td>${orderReductionCredit.amount}€</td>
  154. </tr>
  155. </template>
  156. <tr>
  157. <th>Total produits après réductions TTC</th>
  158. <td>${order.totalOrderProductsWithTaxAndReductions}€</td>
  159. </tr>
  160. <tr>
  161. <th>Frais de livraisons TTC</th>
  162. <td>${order.deliveryPriceWithTaxAndReduction}€</td>
  163. </tr>
  164. {# <tr>
  165. <th>Total Taxes </th>
  166. <td>${order.totalWithTax}€</td>
  167. </tr>
  168. #}
  169. <tr>
  170. <th>Total TTC</th>
  171. <td>${order.totalWithTax}€</td>
  172. </tr>
  173. </tbody>
  174. </table>
  175. </div>
  176. </div>
  177. <div class="col-12">
  178. {#<button v-show="order.user" type="button" class="btn btn-danger" @click="switchEditionMode">
  179. <template v-if="editionMode">
  180. <i class="fa fa-eye"></i> {{ "action.order.viewMode"|trans }}
  181. </template>
  182. <template v-else>
  183. <i class="fa fa-pen"></i> {{ "action.order.editionMode"|trans }}
  184. </template>
  185. </button>#}
  186. {{ _self.order_modal_button('#modal-order-send-payment-link', 'btn-info float-right', "action.order.sendPaymentLink", 'credit-card') }}
  187. </div>
  188. </div>
  189. {% endmacro %}
  190. {% macro box_user_info() %}
  191. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  192. {% set value = ' <span v-if="order.user" v-html="order.user"></span>
  193. <span v-else v-html="order.visitor"></span>' %}
  194. {{ macros.box_info('bg-info', 'user',"field.default.user"|trans({}, 'lcshop'), value) }}
  195. {% endmacro box_user_info %}
  196. {% macro box_reference() %}
  197. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  198. {{ macros.box_info('bg-info', 'credit-card',"field.OrderShop.reference"|trans({}, 'lcshop'), ' ${order.reference}') }}
  199. {% endmacro %}
  200. {% macro box_validation_date() %}
  201. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  202. {% set value = '<span class="info-box-number" v-if="order.createdAt"> ${order.createdAt}</span>
  203. <span class="info-box-number" v-else> ${order.createdAt}</span>' %}
  204. {{ macros.box_info('bg-warning', 'calendar',"field.default.date"|trans({}, 'lcshop'), value) }}
  205. {% endmacro %}
  206. {% macro box_total_order() %}
  207. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  208. {{ macros.box_info('bg-danger', 'euro-sign',"field.OrderShop.total"|trans({}, 'lcshop'), ' ${order.totalWithTax} €') }}
  209. {% endmacro %}
  210. {% macro box_address_invoice() %}
  211. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  212. {% set value = '<span v-if="order.invoiceAddress!=false">
  213. <address v-html="order.invoiceAddress"></address>
  214. </span>
  215. <span v-else>
  216. Aucune adresse de facturation défini.
  217. </span>' %}
  218. {{ macros.box_info('bg-info', 'address-card',"field.default.invoiceAddress"|trans({}, 'lcshop'), value , _self.order_modal_button('#modal-order-invoice-address')) }}
  219. {% endmacro %}
  220. {% macro box_main_order() %}
  221. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  222. {{ macros.box_info('bg-info', 'basket',"field.OrderShop.mainOrder"|trans({}, 'lcshop'), '${order.mainOrder}') }}
  223. {% endmacro %}
  224. {% macro box_address_delivery() %}
  225. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  226. {% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
  227. {% trans_default_domain 'lcshop' %}
  228. {% block class %}bg-success{% endblock %}
  229. {% block icon %}map-marked-alt{% endblock %}
  230. {% block label %}{{ "field.default.deliveryAddress"|trans({}, 'lcshop')}}{% endblock %}
  231. {% block value %}
  232. <div v-if="order.deliveryType == 'home'">
  233. <strong>{{ "field.default.deliveryAddress"|trans({}, 'lcshop') }}</strong>
  234. <address v-html="order.deliveryAddress">
  235. </address>
  236. </div>
  237. <div v-else-if="order.deliveryType == 'point-sale'">
  238. <h6><strong>{{ "field.default.deliveryPointSale"|trans({}, 'lcshop') }} : </strong></h6>
  239. <address v-html="order.deliveryPointSale">
  240. </address>
  241. </div>
  242. <div v-else>
  243. Aucun lieu de livraison défini.
  244. </div>
  245. {% endblock %}
  246. {% block button %}
  247. {{ order_macros.order_modal_button('#modal-order-delivery-address') }}
  248. {% endblock %}
  249. {% endembed %}
  250. {% endmacro %}
  251. {% macro box_delivery_slot() %}
  252. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  253. {% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
  254. {% trans_default_domain 'lcshop' %}
  255. {% block class %}bg-success{% endblock %}
  256. {% block icon %}clock{% endblock %}
  257. {% block label %}{{ "field.default.deliveryAvailabilty"|trans({}, 'lcshop') }}{% endblock %}
  258. {% block value %}
  259. <div v-if="order.deliveryType == 'home'">
  260. <div v-html="order.deliveryAvailabilityZone">
  261. </div>
  262. </div>
  263. <div v-else-if="order.deliveryType == 'point-sale'">
  264. <div v-html="order.deliveryAvailabilityPointSale">
  265. </div>
  266. </div>
  267. <div v-else>
  268. Aucun créneau défini.
  269. </div>
  270. {% endblock %}
  271. {% block button %}
  272. {{ order_macros.order_modal_button('#modal-order-delivery-availability') }}
  273. {% endblock %}
  274. {% endembed %}
  275. {% endmacro %}
  276. {% macro box_payments() %}
  277. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  278. {{ macros.card_start("OrderShop.payment", 'danger') }}
  279. <table class="table table-striped">
  280. <tbody>
  281. <thead>
  282. <tr>
  283. <th>Mode de règlement</th>
  284. <th>Date</th>
  285. <th>Montant</th>
  286. <th>Actions</th>
  287. </tr>
  288. </thead>
  289. <tbody>
  290. <template v-for="(orderPayment, i) in order.orderPayments">
  291. <tr>
  292. <td>${orderPayment.meanPaymentText}</td>
  293. <td>${orderPayment.paidAtText}</td>
  294. <td>${orderPayment.amount}</td>
  295. <td>
  296. <button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')" class="btn-sm btn-info" type="button" @click="editOrderPayment(orderPayment.id)">
  297. <i class="fa fa-pen"></i>
  298. </button>
  299. <button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')"
  300. type="button" class="btn-sm btn-danger"
  301. @click="modalDeleteOrderPayment(orderPayment.id)">
  302. <i class="fa fa-trash"></i>
  303. </button>
  304. </td>
  305. </tr>
  306. </template>
  307. </tbody>
  308. </table>
  309. <div class="col-8">
  310. <div v-show="order.isOrderPaid">
  311. <h5>
  312. <span class="badge badge-success">
  313. <i class="icon fas fa-check"></i> Commande soldé
  314. </span>
  315. </h5>
  316. </div>
  317. <div v-show="order.isOrderPaid==false" >
  318. <h5>
  319. <span class="badge badge-error">
  320. <i class="icon fas fa-check"></i> Commande non soldé
  321. </span>
  322. </h5>
  323. </div>
  324. </div>
  325. <div class="col-4">
  326. <span class="float-right">Total : ${order.totalOrderPaid}</span>
  327. </div>
  328. {#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#}
  329. {{ _self.order_modal_button('#modal-order-payment', 'btn-info', "action.order.addOrderPayment") }}
  330. {{ macros.card_end() }}
  331. {% endmacro %}
  332. {% macro box_documents() %}
  333. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  334. {{ macros.card_start("OrderShop.payment", 'primary card-outline') }}
  335. <table class="table table-striped">
  336. <tbody>
  337. <thead>
  338. <tr>
  339. <th>Date</th>
  340. <th>Type</th>
  341. <th>Numéro</th>
  342. <th>Envoyé</th>
  343. <th>Actions</th>
  344. </tr>
  345. </thead>
  346. <tbody>
  347. <template v-for="(orderDocument, i) in order.orderDocuments">
  348. <tr>
  349. <td>${orderDocument.date}</td>
  350. <td>${orderDocument.type}</td>
  351. <td>${orderDocument.reference}</td>
  352. <td>${orderDocument.isSent}</td>
  353. <td>
  354. </td>
  355. </tr>
  356. </template>
  357. </tbody>
  358. </table>
  359. {{ macros.card_end() }}
  360. {% endmacro %}
  361. {% macro box_complementary() %}
  362. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  363. {{ macros.card_start("OrderShop.complementary", 'bg-outline-primary') }}
  364. <table class="table table-striped">
  365. <tbody>
  366. <thead>
  367. <tr>
  368. <th>Réference</th>
  369. <th>Date</th>
  370. <th>total</th>
  371. <th>Actions</th>
  372. </tr>
  373. </thead>
  374. <tbody>
  375. <template v-for="(complementaryOrderShop, i) in order.complementaryOrderShops">
  376. <tr>
  377. <td>${complementaryOrderShop.reference}</td>
  378. <td>${complementaryOrderShop.date}</td>
  379. <td>${complementaryOrderShop.total}</td>
  380. <td>
  381. </td>
  382. </tr>
  383. </template>
  384. </tbody>
  385. </table>
  386. {{ macros.card_end() }}
  387. {% endmacro %}
  388. {% macro box_tickets() %}
  389. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  390. {{ macros.card_start("OrderShop.complementary", 'bg-outline-primary') }}
  391. <table class="table table-striped">
  392. <tbody>
  393. <thead>
  394. <tr>
  395. <th>Date</th>
  396. <th>Status</th>
  397. <th>Subject</th>
  398. <th>Actions</th>
  399. </tr>
  400. </thead>
  401. <tbody>
  402. <template v-for="(ticket, i) in order.tickets">
  403. <tr>
  404. <td>${ticket.date}</td>
  405. <td>${ticket.status}</td>
  406. <td>${ticket.subject}</td>
  407. <td>
  408. </td>
  409. </tr>
  410. </template>
  411. </tbody>
  412. </table>
  413. {{ macros.card_end() }}
  414. {% endmacro %}
  415. {% macro box_status() %}
  416. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  417. {% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
  418. {% trans_default_domain 'lcshop' %}
  419. {% block class %}bg-success{% endblock %}
  420. {% block icon %}info{% endblock %}
  421. {% block label %}{{ "field.OrderShop.status"|trans({}, 'lcshop')}}{% endblock %}
  422. {% block value %}
  423. <strong> ${order.orderStatus}</strong>
  424. {% endblock %}
  425. {% block button %}
  426. {{ order_macros.order_modal_button('#modal-order-status') }}
  427. {% endblock %}
  428. {% endembed %}
  429. {% endmacro %}
  430. {% macro order_modal_button(modalId, class="btn-primary", trad="action.edit", icon=false) %}
  431. <button v-show="editionMode && modalExist('{{ modalId }}')" type="button" class="btn-sm {{ class }}"
  432. data-toggle="modal"
  433. data-target="{{ modalId }}">
  434. {% if icon %}
  435. <i class="fa fa-{{ icon }}"></i>
  436. {% endif %}
  437. {{ trad|trans }}
  438. </button>
  439. {% endmacro order_modal_button %}