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.

macros.html.twig 22KB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  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. Total produits après réduc TTC :
  253. <strong class="float-right"> ${order.totalOrderProductsWithTaxAndReductions} €</strong><br/>
  254. Total marge produits :
  255. <strong class="float-right">${order.totalMargin} € / ${order.totalMarginPercent} %</strong><br/>
  256. Frais de livraisons TTC :
  257. <strong class="float-right">${order.deliveryPriceWithTaxAndReduction} €</strong><br/>
  258. Total commandes :
  259. <strong class="float-right"> ${order.totalWithTax} €</strong><br/>
  260. {% endblock %}
  261. {% endembed %}
  262. {% endmacro %}
  263. {% macro box_address_invoice() %}
  264. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  265. {% set value = '<span v-if="order.invoiceAddress!=false">
  266. <address v-html="order.invoiceAddress"></address>
  267. </span>
  268. <span v-else>
  269. Aucune adresse de facturation défini.
  270. </span>' %}
  271. {{ macros.box_info('bg-info', 'address-card',"field.default.invoiceAddress"|trans({}, 'lcshop'), value , _self.order_modal_button('#modal-order-invoice-address')) }}
  272. {% endmacro %}
  273. {% macro box_main_order() %}
  274. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  275. {% set value = '${order.mainOrder.reference} <a :href="order.mainOrder.link">[Afficher]</a>' %}
  276. {{ macros.box_info('bg-danger', 'link',"field.OrderShop.mainOrder"|trans({}, 'lcshop'), value) }}
  277. {% endmacro %}
  278. {% macro box_address_delivery() %}
  279. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  280. {% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
  281. {% trans_default_domain 'lcshop' %}
  282. {% block class %}bg-success{% endblock %}
  283. {% block icon %}map-marked-alt{% endblock %}
  284. {% block label %}{{ "field.default.deliveryAddress"|trans({}, 'lcshop') }}{% endblock %}
  285. {% block value %}
  286. <div v-if="order.deliveryAddress">
  287. <address v-html="order.deliveryAddress">
  288. </address>
  289. </div>
  290. <div v-else>
  291. Aucun lieu de livraison défini.
  292. </div>
  293. {% endblock %}
  294. {% block button %}
  295. {{ order_macros.order_modal_button('#modal-order-delivery-address') }}
  296. {% endblock %}
  297. {% endembed %}
  298. {% endmacro %}
  299. {% macro box_delivery_slot() %}
  300. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  301. {% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
  302. {% trans_default_domain 'lcshop' %}
  303. {% block class %}bg-success{% endblock %}
  304. {% block icon %}clock{% endblock %}
  305. {% block label %}{{ "field.default.deliveryAvailabilty"|trans({}, 'lcshop') }}{% endblock %}
  306. {% block value %}
  307. <div v-if="order.deliveryType == 'home'">
  308. <div v-html="order.deliveryAvailabilityZone != null ? order.deliveryAvailabilityZone : order.deliveryDate">
  309. </div>
  310. </div>
  311. <div v-else-if="order.deliveryType == 'point-sale'">
  312. <div v-html="order.deliveryAvailabilityPointSale != null ? order.deliveryAvailabilityPointSale : order.deliveryDate">
  313. </div>
  314. </div>
  315. <div v-else>
  316. Aucun créneau défini.
  317. </div>
  318. {% endblock %}
  319. {% block button %}
  320. {{ order_macros.order_modal_button('#modal-order-delivery-availability') }}
  321. {% endblock %}
  322. {% endembed %}
  323. {% endmacro %}
  324. {% macro box_payments() %}
  325. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  326. {% set tools = '<div v-show="order.isOrderPaid">
  327. <h5>
  328. <span class="badge badge-success">
  329. <i class="icon fas fa-check"></i> Commande soldé
  330. </span>
  331. </h5>
  332. </div>
  333. <div v-show="order.isOrderPaid==false" >
  334. <h5>
  335. <span class="badge badge-error">
  336. <i class="icon fas fa-check"></i> Commande non soldé
  337. </span>
  338. </h5>
  339. </div>' %}
  340. {{ macros.card_start("OrderShop.payment", 'danger card-outline', false, tools) }}
  341. <table class="table table-striped" style="margin-bottom: 15px">
  342. <tbody>
  343. <thead>
  344. <tr>
  345. <th v-if="order.countComplementaryOrderShops > 0">Référence</th>
  346. <th>Mode de règlement</th>
  347. <th>Date</th>
  348. <th>Montant</th>
  349. <th>Actions</th>
  350. </tr>
  351. </thead>
  352. <tbody>
  353. <template v-for="(orderPayment, i) in order.orderPayments">
  354. <tr>
  355. <td v-if="order.countComplementaryOrderShops > 0">
  356. ${orderPayment.orderReference}
  357. </td>
  358. <td>${orderPayment.meanPaymentText}</td>
  359. <td>${orderPayment.paidAtText}</td>
  360. <td>${orderPayment.amount}</td>
  361. <td>
  362. <button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')"
  363. class="btn-sm btn-info" type="button" @click="editOrderPayment(orderPayment.id)">
  364. <i class="fa fa-pen"></i>
  365. </button>
  366. <button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')"
  367. type="button" class="btn-sm btn-danger"
  368. @click="modalDeleteOrderPayment(orderPayment.id)">
  369. <i class="fa fa-trash"></i>
  370. </button>
  371. </td>
  372. </tr>
  373. </template>
  374. </tbody>
  375. </table>
  376. <div class="col-11">
  377. {{ _self.order_modal_button('#modal-order-payment', 'btn-info', "action.order.addOrderPayment") }}
  378. <strong class="float-right">Total règlement : ${order.totalOrderPaid} €</strong>
  379. {#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#}
  380. </div>
  381. {{ macros.card_end() }}
  382. {% endmacro %}
  383. {% macro box_documents() %}
  384. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  385. {{ macros.card_start("OrderShop.documents", 'primary card-outline') }}
  386. <table class="table table-striped">
  387. <tbody>
  388. <thead>
  389. <tr>
  390. <th v-if="order.countComplementaryOrderShops > 0">Référence</th>
  391. <th>Date</th>
  392. <th>Type</th>
  393. <th>Numéro</th>
  394. <th>Actions</th>
  395. </tr>
  396. </thead>
  397. <tbody>
  398. <template v-for="(orderDocument, i) in order.orderDocuments">
  399. <tr>
  400. <td v-if="order.countComplementaryOrderShops > 0">
  401. ${orderDocument.orderReference}
  402. </td>
  403. <td>${orderDocument.date}</td>
  404. <td>Facture</td>
  405. <td>${orderDocument.reference}</td>
  406. <td>
  407. <a :href="'./?entity=Document&action=downloadInvoice&id='+orderDocument.id"
  408. class="btn-sm btn-default">Télécharger</a>
  409. </td>
  410. </tr>
  411. </template>
  412. </tbody>
  413. </table>
  414. {{ macros.card_end() }}
  415. {% endmacro %}
  416. {% macro box_complementary() %}
  417. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  418. {{ macros.card_start("OrderShop.complementary", 'primary card-outline') }}
  419. <table class="table table-striped">
  420. <tbody>
  421. <thead>
  422. <tr>
  423. <th>Réference</th>
  424. <th>Date</th>
  425. <th>total</th>
  426. <th>Actions</th>
  427. </tr>
  428. </thead>
  429. <tbody>
  430. <template v-for="(complementaryOrderShop, i) in order.complementaryOrderShops">
  431. <tr>
  432. <td>${complementaryOrderShop.reference}</td>
  433. <td>${complementaryOrderShop.date}</td>
  434. <td>${complementaryOrderShop.total}</td>
  435. <td>
  436. <a :href="complementaryOrderShop.link" class="btn-sm btn-default">Afficher</a>
  437. </td>
  438. </tr>
  439. </template>
  440. </tbody>
  441. </table>
  442. {{ macros.card_end() }}
  443. {% endmacro %}
  444. {% macro box_tickets() %}
  445. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  446. {{ macros.card_start("OrderShop.tickets", 'warning card-outline') }}
  447. <table class="table table-striped">
  448. <tbody>
  449. <thead>
  450. <tr>
  451. <th>Date</th>
  452. <th>Status</th>
  453. <th>Subject</th>
  454. <th>Actions</th>
  455. </tr>
  456. </thead>
  457. <tbody>
  458. <template v-for="(ticket, i) in order.tickets">
  459. <tr>
  460. <td>${ticket.date}</td>
  461. <td>${ticket.status}</td>
  462. <td>${ticket.subject}</td>
  463. <td>
  464. <a :href="ticket.link" class="btn-sm btn-default">Afficher</a>
  465. </td>
  466. </tr>
  467. </template>
  468. </tbody>
  469. </table>
  470. {{ macros.card_end() }}
  471. {% endmacro %}
  472. {% macro box_status() %}
  473. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  474. {% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
  475. {% trans_default_domain 'lcshop' %}
  476. {% block class %}bg-success{% endblock %}
  477. {% block icon %}info{% endblock %}
  478. {% block label %}{{ "field.OrderShop.status"|trans({}, 'lcshop') }}{% endblock %}
  479. {% block value %}
  480. <strong> ${order.orderStatus}</strong>
  481. {% endblock %}
  482. {% block button %}
  483. {{ order_macros.order_modal_button('#modal-order-status') }}
  484. {% endblock %}
  485. {% endembed %}
  486. {% endmacro %}
  487. {% macro order_modal_button(modalId, class="btn-primary", trad="action.edit", icon=false) %}
  488. <button v-show="editionMode && modalExist('{{ modalId }}')" type="button" class="btn-sm {{ class }}"
  489. data-toggle="modal"
  490. data-target="{{ modalId }}">
  491. {% if icon %}
  492. <i class="fa fa-{{ icon }}"></i>
  493. {% endif %}
  494. {{ trad|trans }}
  495. </button>
  496. {% endmacro order_modal_button %}