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.

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