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.

623 lines
24KB

  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_step_reach() %}
  351. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  352. {% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
  353. {% trans_default_domain 'lcshop' %}
  354. {% block class %}bg-info{% endblock %}
  355. {% block icon %}list-ol{% endblock %}
  356. {% block label %}Étape atteinte{% endblock %}
  357. {% block value %}
  358. <div v-if="order.hasReach == 1">
  359. Adresse de livraison
  360. </div>
  361. <div v-if="order.hasReach == 2">
  362. Adresse de facturation
  363. </div>
  364. <div v-if="order.hasReach == 3">
  365. Page de paiement
  366. </div>
  367. <div v-if="order.hasReach ==null">
  368. Aucune
  369. </div>
  370. {% endblock %}
  371. {% endembed %}
  372. {% endmacro %}
  373. {% macro box_payments() %}
  374. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  375. {% set tools = '<div v-show="order.isOrderPaid">
  376. <h5>
  377. <span class="badge badge-success">
  378. <i class="icon fas fa-check"></i> Commande soldé
  379. </span>
  380. </h5>
  381. </div>
  382. <div v-show="order.isOrderPaid==false" >
  383. <h5>
  384. <span class="badge badge-error">
  385. <i class="icon fas fa-check"></i> Commande non soldé
  386. </span>
  387. </h5>
  388. </div>' %}
  389. {{ macros.card_start("OrderShop.payment", 'danger card-outline', false, tools) }}
  390. <table class="table table-striped" style="margin-bottom: 15px">
  391. <tbody>
  392. <thead>
  393. <tr>
  394. <th v-if="order.countComplementaryOrderShops > 0">Référence</th>
  395. <th>Mode de règlement</th>
  396. <th>Date</th>
  397. <th>Montant</th>
  398. <th>Actions</th>
  399. </tr>
  400. </thead>
  401. <tbody>
  402. <template v-for="(orderPayment, i) in order.orderPayments">
  403. <tr>
  404. <td v-if="order.countComplementaryOrderShops > 0">
  405. ${orderPayment.orderReference}
  406. </td>
  407. <td>${orderPayment.meanPaymentText}</td>
  408. <td>${orderPayment.paidAtText}</td>
  409. <td>${orderPayment.amount}</td>
  410. <td>
  411. <button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')"
  412. class="btn-sm btn-info" type="button" @click="editOrderPayment(orderPayment.id)">
  413. <i class="fa fa-pen"></i>
  414. </button>
  415. <button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')"
  416. type="button" class="btn-sm btn-danger"
  417. @click="modalDeleteOrderPayment(orderPayment.id)">
  418. <i class="fa fa-trash"></i>
  419. </button>
  420. </td>
  421. </tr>
  422. </template>
  423. </tbody>
  424. </table>
  425. <div class="col-11">
  426. {{ _self.order_modal_button('#modal-order-payment', 'btn-info', "action.order.addOrderPayment") }}
  427. <strong class="float-right">Total règlement : ${order.totalOrderPaid} €</strong>
  428. {#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#}
  429. </div>
  430. {{ macros.card_end() }}
  431. {% endmacro %}
  432. {% macro box_documents() %}
  433. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  434. {{ macros.card_start("OrderShop.documents", 'primary card-outline') }}
  435. <table class="table table-striped">
  436. <tbody>
  437. <thead>
  438. <tr>
  439. <th v-if="order.countComplementaryOrderShops > 0">Référence</th>
  440. <th>Date</th>
  441. <th>Type</th>
  442. <th>Numéro</th>
  443. <th>Actions</th>
  444. </tr>
  445. </thead>
  446. <tbody>
  447. <template v-for="(orderDocument, i) in order.orderDocuments">
  448. <tr>
  449. <td v-if="order.countComplementaryOrderShops > 0">
  450. ${orderDocument.orderReference}
  451. </td>
  452. <td>${orderDocument.date}</td>
  453. <td>Facture</td>
  454. <td>${orderDocument.reference}</td>
  455. <td>
  456. <a :href="'./?entity=Document&action=downloadInvoice&id='+orderDocument.id"
  457. class="btn-sm btn-default">Télécharger</a>
  458. </td>
  459. </tr>
  460. </template>
  461. </tbody>
  462. </table>
  463. {{ macros.card_end() }}
  464. {% endmacro %}
  465. {% macro box_complementary() %}
  466. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  467. {{ macros.card_start("OrderShop.complementary", 'primary card-outline') }}
  468. <table class="table table-striped">
  469. <tbody>
  470. <thead>
  471. <tr>
  472. <th>Réference</th>
  473. <th>Date</th>
  474. <th>total</th>
  475. <th>Actions</th>
  476. </tr>
  477. </thead>
  478. <tbody>
  479. <template v-for="(complementaryOrderShop, i) in order.complementaryOrderShops">
  480. <tr>
  481. <td>${complementaryOrderShop.reference}</td>
  482. <td>${complementaryOrderShop.date}</td>
  483. <td>${complementaryOrderShop.total}</td>
  484. <td>
  485. <a :href="complementaryOrderShop.link" class="btn-sm btn-default">Afficher</a>
  486. </td>
  487. </tr>
  488. </template>
  489. </tbody>
  490. </table>
  491. {{ macros.card_end() }}
  492. {% endmacro %}
  493. {% macro box_tickets() %}
  494. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  495. {{ macros.card_start("OrderShop.tickets", 'warning card-outline') }}
  496. <table class="table table-striped">
  497. <tbody>
  498. <thead>
  499. <tr>
  500. <th>Date</th>
  501. <th>Status</th>
  502. <th>Subject</th>
  503. <th>Actions</th>
  504. </tr>
  505. </thead>
  506. <tbody>
  507. <template v-for="(ticket, i) in order.tickets">
  508. <tr>
  509. <td>${ticket.date}</td>
  510. <td>${ticket.status}</td>
  511. <td>${ticket.subject}</td>
  512. <td>
  513. <a :href="ticket.link" class="btn-sm btn-default">Afficher</a>
  514. </td>
  515. </tr>
  516. </template>
  517. </tbody>
  518. </table>
  519. {{ macros.card_end() }}
  520. {% endmacro %}
  521. {% macro box_status() %}
  522. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  523. {% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
  524. {% trans_default_domain 'lcshop' %}
  525. {% block class %}bg-success{% endblock %}
  526. {% block icon %}info{% endblock %}
  527. {% block label %}{{ "field.OrderShop.status"|trans({}, 'lcshop') }}{% endblock %}
  528. {% block value %}
  529. <strong> ${order.orderStatus}</strong>
  530. {% endblock %}
  531. {% block button %}
  532. {{ order_macros.order_modal_button('#modal-order-status-histories', 'btn-secondary', 'action.history') }}
  533. {{ order_macros.order_modal_button('#modal-order-status') }}
  534. {% endblock %}
  535. {% endembed %}
  536. {% endmacro %}
  537. {% macro order_modal_button(modalId, class="btn-primary", trad="action.edit", icon=false) %}
  538. <button v-show="editionMode && modalExist('{{ modalId }}')" type="button" class="btn-sm {{ class }}"
  539. data-toggle="modal"
  540. data-target="{{ modalId }}">
  541. {% if icon %}
  542. <i class="fa fa-{{ icon }}"></i>
  543. {% endif %}
  544. {{ trad|trans }}
  545. </button>
  546. {% endmacro order_modal_button %}