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.

599 lines
23KB

  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 v-if="order.countComplementaryOrderShops > 0">Compléments</span>
  13. </th>
  14. <th>
  15. <span>Prix achat HT </span>
  16. </th>
  17. <th>
  18. <span>Prix HT</span>
  19. </th>
  20. <th>
  21. <span>Prix TTC </span>
  22. </th>
  23. <th>
  24. <span>Marge </span>
  25. </th>
  26. <th>
  27. <span>Disponibilité</span>
  28. </th>
  29. <th>
  30. <span>Quantité</span>
  31. </th>
  32. <th>
  33. <span>Total</span>
  34. </th>
  35. <th :class="editionMode ? '' : 'hidden'">
  36. Actions
  37. </th>
  38. </tr>
  39. </thead>
  40. {% endmacro %}
  41. {% macro products() %}
  42. <tbody>
  43. <template v-for="(orderProduct, key) in orderProducts">
  44. <order-product ref="orderProductBLOP" :order-product="orderProduct" :edition-mode="editionMode"
  45. :template="templateTest"
  46. :key-item="key"></order-product>
  47. </template>
  48. </tbody>
  49. {% endmacro %}
  50. {% macro productsTemplate(form_order_products=null) %}
  51. <tr :class=" orderProduct.isRedelivery ? 'redelivery order-product-item' : 'order-product-item'">
  52. <td :class="editionMode ? '' : 'hidden'">
  53. <input type="checkbox" :value="orderProduct.id" class="order-product-checkbox"/>
  54. </td>
  55. <td colspan="2">
  56. <a :href="orderProduct.editLink" target="_blank">
  57. <img :src="orderProduct.image" :alt="orderProduct.title"/>
  58. {% verbatim %}{{orderProduct.title}}{% endverbatim %}
  59. <span v-show="orderProduct.hasRedelivery">
  60. - <i class="fa fa-undo" data-toggle="tooltip" :title="orderProduct.redeliveryOrderShop"></i>
  61. </span>
  62. <span v-show="orderProduct.isRedelivery">
  63. - <i class="fa fa-undo" data-toggle="tooltip" title="Ce produit est une relivraison"></i>
  64. </span>
  65. </a>
  66. </td>
  67. <td>
  68. <span v-if="orderProduct.complementaryReference"> {% verbatim %}{{orderProduct.complementaryReference}}{% endverbatim %}</span>
  69. </td>
  70. <td>
  71. {% verbatim %}{{orderProduct.buyingPrice}}{% endverbatim %} €
  72. </td>
  73. <td>
  74. {% verbatim %}{{orderProduct.price}}{% endverbatim %}€
  75. </td>
  76. <td>
  77. {% verbatim %}{{orderProduct.priceWithTax}}{% endverbatim %} €
  78. </td>
  79. <td>
  80. {% verbatim %}{{orderProduct.totalMargin}}{% endverbatim %} € /
  81. {% verbatim %}{{orderProduct.marginPercent}}{% endverbatim %} %
  82. </td>
  83. <td>
  84. {% verbatim %}{{orderProduct.availableQuantity}}{% endverbatim %}
  85. </td>
  86. <td>
  87. {% if form_order_products is not null %}
  88. <div :class="editionMode && orderProduct.isRedelivery ==false ? '' : 'hidden'">
  89. {{ form_widget(form_order_products.orderProducts.vars.prototype.quantityOrder, {'attr' : {'ref': 'fieldQuantity', 'v-model' : 'orderProduct.quantityOrder', '@change' : 'updateOrderProducts'}}) }}
  90. {{ form_widget(form_order_products.orderProducts.vars.prototype.product, {'attr' : {'ref' : 'fieldProduct', 'v-model' : 'orderProduct.product'}}) }}
  91. {#{{ form_widget(form_order_products.orderProducts.vars.prototype.id, {'attr' : {'ref' : 'fieldId', 'v-model' : 'orderProduct.id'}}) }}#}
  92. <button type="button" class="btn-remove-product btn btn-default" @click="deleteOrderProduct()">
  93. <i class="fa fa-trash"></i>
  94. </button>
  95. </div>
  96. <div :class="editionMode && orderProduct.isRedelivery ==false ? 'hidden' : ''">
  97. {% verbatim %}{{ orderProduct.quantityOrder }}{% endverbatim %}
  98. </div>
  99. {% else %}
  100. {% verbatim %}{{ orderProduct.quantityOrder }}{% endverbatim %}
  101. {% endif %}
  102. </td>
  103. <td>
  104. {% verbatim %}{{orderProduct.totalWithTaxAndReduction}}{% endverbatim %} €
  105. </td>
  106. <td :class="editionMode ? '' : 'hidden'">
  107. <div class="dropdown" :class="editionMode ? '' : 'hidden'">
  108. <button class="btn-sm btn-info dropdown-toggle" type="button" id="dropdownMenu"
  109. data-toggle="dropdown" aria-expanded="false">
  110. Actions
  111. </button>
  112. <div class="dropdown-menu" aria-labelledby="dropdownMenu">
  113. <button v-show="modalExist('#modal-add-redelivery-order-product') && orderProduct.hasRedelivery == false"
  114. type="button" class="dropdown-item" @click="modalAddRedeliveryOrderProduct">
  115. Générer une relivraison
  116. </button>
  117. <button v-show="modalExist('#modal-add-reduction-credit')" type="button" class="dropdown-item"
  118. @click="modalAddReductionCredit">
  119. Générer un avoir
  120. </button>
  121. </div>
  122. </div>
  123. </td>
  124. </tr>
  125. {% endmacro %}
  126. {% macro tableTotal() %}
  127. </table>
  128. <div class="clearfix"></div>
  129. <div class="row">
  130. <div class="col-6">
  131. <div class="row">
  132. <div class="col-12">
  133. {{ _self.order_modal_button('#modal-add-product-to-order', 'btn-success', "action.order.addOrderProduct", 'plus') }}
  134. {{ _self.order_modal_button('#modal-add-order-reduction-cart', 'btn-warning', "action.order.addReductionCart", 'shopping-basket') }}
  135. {{ _self.order_modal_button('#modal-add-order-reduction-credit', 'btn-warning', "action.order.addReductionCredit", 'backspace') }}
  136. </div>
  137. </div>
  138. </div>
  139. <div class="col-5">
  140. <div class="table-responsive">
  141. <table class="table">
  142. <tbody>
  143. <tr>
  144. <th>Total produits TTC</th>
  145. <td>${order.totalOrderProductsWithTax} €</td>
  146. </tr>
  147. <template v-for="(orderReductionCart, key) in order.orderReductionCarts">
  148. <tr>
  149. <th>
  150. ${orderReductionCart.title}
  151. <button v-show="editionMode && modalExist('#modal-delete-reduction-cart')" type="button"
  152. class="btn-sm btn-danger"
  153. @click="modalDeleteOrderReductionCart(orderReductionCart.id)">
  154. <i class="fa fa-trash"></i>
  155. </button>
  156. </th>
  157. <td>${orderReductionCart.amount} €</td>
  158. </tr>
  159. </template>
  160. <template v-for="(orderReductionCredit, key) in order.orderReductionCredits">
  161. <tr>
  162. <th>${orderReductionCredit.title}
  163. <button v-show="editionMode && modalExist('#modal-delete-reduction-credit')"
  164. type="button" class="btn-sm btn-danger"
  165. @click="modalDeleteOrderReductionCredit(orderReductionCredit.id)">
  166. <i class="fa fa-trash"></i>
  167. </button>
  168. </th>
  169. <td>${orderReductionCredit.amount} €</td>
  170. </tr>
  171. </template>
  172. <tr>
  173. <th>Total produits après réductions TTC</th>
  174. <td>${order.totalOrderProductsWithTaxAndReductions} €</td>
  175. </tr>
  176. <tr>
  177. <th>Total marge produits</th>
  178. <td>${order.totalMargin} € <br/> ${order.totalMarginPercent} %</td>
  179. </tr>
  180. <tr>
  181. <th>Frais de livraisons TTC</th>
  182. <td>${order.deliveryPriceWithTaxAndReduction} €</td>
  183. </tr>
  184. <tr>
  185. <th>Total TTC</th>
  186. <td>${order.totalWithTax} €</td>
  187. </tr>
  188. </tbody>
  189. </table>
  190. </div>
  191. </div>
  192. <div class="col"></div>
  193. <div class="col-12">
  194. {#<button v-show="order.user" type="button" class="btn btn-danger" @click="switchEditionMode">
  195. <template v-if="editionMode">
  196. <i class="fa fa-eye"></i> {{ "action.order.viewMode"|trans }}
  197. </template>
  198. <template v-else>
  199. <i class="fa fa-pen"></i> {{ "action.order.editionMode"|trans }}
  200. </template>
  201. </button>#}
  202. {{ _self.order_modal_button('#modal-order-send-payment-link', 'btn-info float-right', "action.order.sendPaymentLink", 'credit-card') }}
  203. </div>
  204. </div>
  205. {% endmacro %}
  206. {% macro box_user_info() %}
  207. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  208. {% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
  209. {% trans_default_domain 'lcshop' %}
  210. {% block class %}bg-info{% endblock %}
  211. {% block icon %}credit-card{% endblock %}
  212. {% block label %}{{ "field.OrderShop.reference"|trans({}, 'lcshop') }}{% endblock %}
  213. {% block value %}
  214. <span v-if="order.user" v-html="order.user"></span>
  215. <span v-else v-html="order.visitor"></span>
  216. {% endblock %}
  217. {% block button %}
  218. <a class="btn btn-sm btn-secondary" target="_blank" :href="order.userLink">
  219. Voir la fiche
  220. </a>
  221. {% endblock %}
  222. {% endembed %}
  223. {% endmacro box_user_info %}
  224. {% macro box_reference() %}
  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-info{% endblock %}
  229. {% block icon %}credit-card{% endblock %}
  230. {% block label %}{{ "field.OrderShop.reference"|trans({}, 'lcshop') }}{% endblock %}
  231. {% block value %}
  232. ${order.reference}<br/>
  233. <span v-if="order.countComplementaryOrderShops > 0">
  234. ${order.countComplementaryOrderShops} commande(s) complémentaire(s)
  235. </span>
  236. {% endblock %}
  237. {% endembed %}
  238. {% endmacro %}
  239. {% macro box_validation_date() %}
  240. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  241. {% set value = '<span class="info-box-number" v-if="order.createdAt"> ${order.createdAt}</span>
  242. <span class="info-box-number" v-else> ${order.createdAt}</span>' %}
  243. {{ macros.box_info('bg-warning', 'calendar',"field.default.date"|trans({}, 'lcshop'), value) }}
  244. {% endmacro %}
  245. {% macro box_total_order() %}
  246. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  247. {% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
  248. {% trans_default_domain 'lcshop' %}
  249. {% block class %}bg-danger{% endblock %}
  250. {% block icon %}euro-sign{% endblock %}
  251. {% block infoBox %}
  252. <table style="width: 100%">
  253. <tr>
  254. <td>
  255. Total produits TTC :<i class="icon info" data-toggle="tooltip" title="Après reduction"></i>
  256. </td>
  257. <td>
  258. <strong class="float-right"> ${order.totalOrderProductsWithTaxAndReductions} €</strong><br/>
  259. </td>
  260. </tr>
  261. <tr>
  262. <td>
  263. Total marge produits :
  264. </td>
  265. <td>
  266. <strong class="float-right">${order.totalMargin} € / ${order.totalMarginPercent} %</strong><br/>
  267. </td>
  268. </tr>
  269. <tr>
  270. <td>
  271. Frais de livraisons TTC :
  272. </td>
  273. <td>
  274. <strong class="float-right">${order.deliveryPriceWithTaxAndReduction} €</strong><br/>
  275. </td>
  276. </tr>
  277. <tr>
  278. <td>
  279. Total commandes :
  280. </td>
  281. <td>
  282. <strong class="float-right"> ${order.totalWithTax} €</strong><br/>
  283. </td>
  284. </tr>
  285. </table>
  286. {% endblock %}
  287. {% endembed %}
  288. {% endmacro %}
  289. {% macro box_address_invoice() %}
  290. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  291. {% set value = '<span v-if="order.invoiceAddress!=false">
  292. <address v-html="order.invoiceAddress"></address>
  293. </span>
  294. <span v-else>
  295. Aucune adresse de facturation défini.
  296. </span>' %}
  297. {{ macros.box_info('bg-info', 'address-card',"field.default.invoiceAddress"|trans({}, 'lcshop'), value , _self.order_modal_button('#modal-order-invoice-address')) }}
  298. {% endmacro %}
  299. {% macro box_main_order() %}
  300. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  301. {% set value = '${order.mainOrder.reference} <a :href="order.mainOrder.link">[Afficher]</a>' %}
  302. {{ macros.box_info('bg-danger', 'link',"field.OrderShop.mainOrder"|trans({}, 'lcshop'), value) }}
  303. {% endmacro %}
  304. {% macro box_address_delivery() %}
  305. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  306. {% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
  307. {% trans_default_domain 'lcshop' %}
  308. {% block class %}bg-success{% endblock %}
  309. {% block icon %}map-marked-alt{% endblock %}
  310. {% block label %}{{ "field.default.deliveryAddress"|trans({}, 'lcshop') }}{% endblock %}
  311. {% block value %}
  312. <div v-if="order.deliveryAddress">
  313. <address v-html="order.deliveryAddress">
  314. </address>
  315. </div>
  316. <div v-else>
  317. Aucun lieu de livraison défini.
  318. </div>
  319. {% endblock %}
  320. {% block button %}
  321. {{ order_macros.order_modal_button('#modal-order-delivery-address') }}
  322. {% endblock %}
  323. {% endembed %}
  324. {% endmacro %}
  325. {% macro box_delivery_slot() %}
  326. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  327. {% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
  328. {% trans_default_domain 'lcshop' %}
  329. {% block class %}bg-success{% endblock %}
  330. {% block icon %}clock{% endblock %}
  331. {% block label %}{{ "field.default.deliveryAvailabilty"|trans({}, 'lcshop') }}{% endblock %}
  332. {% block value %}
  333. <div v-if="order.deliveryType == 'home'">
  334. <div v-html="order.deliveryAvailabilityZone != null ? order.deliveryAvailabilityZone : order.deliveryDate">
  335. </div>
  336. </div>
  337. <div v-else-if="order.deliveryType == 'point-sale'">
  338. <div v-html="order.deliveryAvailabilityPointSale != null ? order.deliveryAvailabilityPointSale : order.deliveryDate">
  339. </div>
  340. </div>
  341. <div v-else>
  342. Aucun créneau défini.
  343. </div>
  344. {% endblock %}
  345. {% block button %}
  346. {{ order_macros.order_modal_button('#modal-order-delivery-availability') }}
  347. {% endblock %}
  348. {% endembed %}
  349. {% endmacro %}
  350. {% macro box_payments() %}
  351. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  352. {% set tools = '<div v-show="order.isOrderPaid">
  353. <h5>
  354. <span class="badge badge-success">
  355. <i class="icon fas fa-check"></i> Commande soldé
  356. </span>
  357. </h5>
  358. </div>
  359. <div v-show="order.isOrderPaid==false" >
  360. <h5>
  361. <span class="badge badge-error">
  362. <i class="icon fas fa-check"></i> Commande non soldé
  363. </span>
  364. </h5>
  365. </div>' %}
  366. {{ macros.card_start("OrderShop.payment", 'danger card-outline', false, tools) }}
  367. <table class="table table-striped" style="margin-bottom: 15px">
  368. <tbody>
  369. <thead>
  370. <tr>
  371. <th v-if="order.countComplementaryOrderShops > 0">Référence</th>
  372. <th>Mode de règlement</th>
  373. <th>Date</th>
  374. <th>Montant</th>
  375. <th>Actions</th>
  376. </tr>
  377. </thead>
  378. <tbody>
  379. <template v-for="(orderPayment, i) in order.orderPayments">
  380. <tr>
  381. <td v-if="order.countComplementaryOrderShops > 0">
  382. ${orderPayment.orderReference}
  383. </td>
  384. <td>${orderPayment.meanPaymentText}</td>
  385. <td>${orderPayment.paidAtText}</td>
  386. <td>${orderPayment.amount}</td>
  387. <td>
  388. <button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')"
  389. class="btn-sm btn-info" type="button" @click="editOrderPayment(orderPayment.id)">
  390. <i class="fa fa-pen"></i>
  391. </button>
  392. <button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')"
  393. type="button" class="btn-sm btn-danger"
  394. @click="modalDeleteOrderPayment(orderPayment.id)">
  395. <i class="fa fa-trash"></i>
  396. </button>
  397. </td>
  398. </tr>
  399. </template>
  400. </tbody>
  401. </table>
  402. <div class="col-11">
  403. {{ _self.order_modal_button('#modal-order-payment', 'btn-info', "action.order.addOrderPayment") }}
  404. <strong class="float-right">Total règlement : ${order.totalOrderPaid} €</strong>
  405. {#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#}
  406. </div>
  407. {{ macros.card_end() }}
  408. {% endmacro %}
  409. {% macro box_documents() %}
  410. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  411. {{ macros.card_start("OrderShop.documents", 'primary card-outline') }}
  412. <table class="table table-striped">
  413. <tbody>
  414. <thead>
  415. <tr>
  416. <th v-if="order.countComplementaryOrderShops > 0">Référence</th>
  417. <th>Date</th>
  418. <th>Type</th>
  419. <th>Numéro</th>
  420. <th>Actions</th>
  421. </tr>
  422. </thead>
  423. <tbody>
  424. <template v-for="(orderDocument, i) in order.orderDocuments">
  425. <tr>
  426. <td v-if="order.countComplementaryOrderShops > 0">
  427. ${orderDocument.orderReference}
  428. </td>
  429. <td>${orderDocument.date}</td>
  430. <td>Facture</td>
  431. <td>${orderDocument.reference}</td>
  432. <td>
  433. <a :href="'./?entity=Document&action=downloadInvoice&id='+orderDocument.id"
  434. class="btn-sm btn-default">Télécharger</a>
  435. </td>
  436. </tr>
  437. </template>
  438. </tbody>
  439. </table>
  440. {{ macros.card_end() }}
  441. {% endmacro %}
  442. {% macro box_complementary() %}
  443. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  444. {{ macros.card_start("OrderShop.complementary", 'primary card-outline') }}
  445. <table class="table table-striped">
  446. <tbody>
  447. <thead>
  448. <tr>
  449. <th>Réference</th>
  450. <th>Date</th>
  451. <th>total</th>
  452. <th>Actions</th>
  453. </tr>
  454. </thead>
  455. <tbody>
  456. <template v-for="(complementaryOrderShop, i) in order.complementaryOrderShops">
  457. <tr>
  458. <td>${complementaryOrderShop.reference}</td>
  459. <td>${complementaryOrderShop.date}</td>
  460. <td>${complementaryOrderShop.total}</td>
  461. <td>
  462. <a :href="complementaryOrderShop.link" class="btn-sm btn-default">Afficher</a>
  463. </td>
  464. </tr>
  465. </template>
  466. </tbody>
  467. </table>
  468. {{ macros.card_end() }}
  469. {% endmacro %}
  470. {% macro box_tickets() %}
  471. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  472. {{ macros.card_start("OrderShop.tickets", 'warning card-outline') }}
  473. <table class="table table-striped">
  474. <tbody>
  475. <thead>
  476. <tr>
  477. <th>Date</th>
  478. <th>Status</th>
  479. <th>Subject</th>
  480. <th>Actions</th>
  481. </tr>
  482. </thead>
  483. <tbody>
  484. <template v-for="(ticket, i) in order.tickets">
  485. <tr>
  486. <td>${ticket.date}</td>
  487. <td>${ticket.status}</td>
  488. <td>${ticket.subject}</td>
  489. <td>
  490. <a :href="ticket.link" class="btn-sm btn-default">Afficher</a>
  491. </td>
  492. </tr>
  493. </template>
  494. </tbody>
  495. </table>
  496. {{ macros.card_end() }}
  497. {% endmacro %}
  498. {% macro box_status() %}
  499. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  500. {% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
  501. {% trans_default_domain 'lcshop' %}
  502. {% block class %}bg-success{% endblock %}
  503. {% block icon %}info{% endblock %}
  504. {% block label %}{{ "field.OrderShop.status"|trans({}, 'lcshop') }}{% endblock %}
  505. {% block value %}
  506. <strong> ${order.orderStatus}</strong>
  507. {% endblock %}
  508. {% block button %}
  509. {{ order_macros.order_modal_button('#modal-order-status') }}
  510. {% endblock %}
  511. {% endembed %}
  512. {% endmacro %}
  513. {% macro order_modal_button(modalId, class="btn-primary", trad="action.edit", icon=false) %}
  514. <button v-show="editionMode && modalExist('{{ modalId }}')" type="button" class="btn-sm {{ class }}"
  515. data-toggle="modal"
  516. data-target="{{ modalId }}">
  517. {% if icon %}
  518. <i class="fa fa-{{ icon }}"></i>
  519. {% endif %}
  520. {{ trad|trans }}
  521. </button>
  522. {% endmacro order_modal_button %}