Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

510 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. <address v-html="order.deliveryAddress">
  233. </address>
  234. </div>
  235. <div v-else-if="order.deliveryType == 'point-sale'">
  236. <address v-html="order.deliveryPointSale">
  237. </address>
  238. </div>
  239. <div v-else>
  240. Aucun lieu de livraison défini.
  241. </div>
  242. {% endblock %}
  243. {% block button %}
  244. {{ order_macros.order_modal_button('#modal-order-delivery-address') }}
  245. {% endblock %}
  246. {% endembed %}
  247. {% endmacro %}
  248. {% macro box_delivery_slot() %}
  249. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  250. {% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
  251. {% trans_default_domain 'lcshop' %}
  252. {% block class %}bg-success{% endblock %}
  253. {% block icon %}clock{% endblock %}
  254. {% block label %}{{ "field.default.deliveryAvailabilty"|trans({}, 'lcshop') }}{% endblock %}
  255. {% block value %}
  256. <div v-if="order.deliveryType == 'home'">
  257. <div v-html="order.deliveryAvailabilityZone">
  258. </div>
  259. </div>
  260. <div v-else-if="order.deliveryType == 'point-sale'">
  261. <div v-html="order.deliveryAvailabilityPointSale">
  262. </div>
  263. </div>
  264. <div v-else>
  265. Aucun créneau défini.
  266. </div>
  267. {% endblock %}
  268. {% block button %}
  269. {{ order_macros.order_modal_button('#modal-order-delivery-availability') }}
  270. {% endblock %}
  271. {% endembed %}
  272. {% endmacro %}
  273. {% macro box_payments() %}
  274. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  275. {% set tools = '<div v-show="order.isOrderPaid">
  276. <h5>
  277. <span class="badge badge-success">
  278. <i class="icon fas fa-check"></i> Commande soldé
  279. </span>
  280. </h5>
  281. </div>
  282. <div v-show="order.isOrderPaid==false" >
  283. <h5>
  284. <span class="badge badge-error">
  285. <i class="icon fas fa-check"></i> Commande non soldé
  286. </span>
  287. </h5>
  288. </div>' %}
  289. {{ macros.card_start("OrderShop.payment", 'danger card-outline', false, tools) }}
  290. <table class="table table-striped" style="margin-bottom: 15px">
  291. <tbody>
  292. <thead>
  293. <tr>
  294. <th>Mode de règlement</th>
  295. <th>Date</th>
  296. <th>Montant</th>
  297. <th>Actions</th>
  298. </tr>
  299. </thead>
  300. <tbody>
  301. <template v-for="(orderPayment, i) in order.orderPayments">
  302. <tr>
  303. <td>${orderPayment.meanPaymentText}</td>
  304. <td>${orderPayment.paidAtText}</td>
  305. <td>${orderPayment.amount}</td>
  306. <td>
  307. <button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')" class="btn-sm btn-info" type="button" @click="editOrderPayment(orderPayment.id)">
  308. <i class="fa fa-pen"></i>
  309. </button>
  310. <button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')"
  311. type="button" class="btn-sm btn-danger"
  312. @click="modalDeleteOrderPayment(orderPayment.id)">
  313. <i class="fa fa-trash"></i>
  314. </button>
  315. </td>
  316. </tr>
  317. </template>
  318. </tbody>
  319. </table>
  320. <div class="col-11">
  321. {{ _self.order_modal_button('#modal-order-payment', 'btn-info', "action.order.addOrderPayment") }}
  322. <strong class="float-right">Total règlement : ${order.totalOrderPaid} €</strong>
  323. {#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#}
  324. </div>
  325. {{ macros.card_end() }}
  326. {% endmacro %}
  327. {% macro box_documents() %}
  328. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  329. {{ macros.card_start("OrderShop.documents", 'primary card-outline') }}
  330. <table class="table table-striped">
  331. <tbody>
  332. <thead>
  333. <tr>
  334. <th>Date</th>
  335. <th>Type</th>
  336. <th>Numéro</th>
  337. <th>Actions</th>
  338. </tr>
  339. </thead>
  340. <tbody>
  341. <template v-for="(orderDocument, i) in order.orderDocuments">
  342. <tr>
  343. <td>${orderDocument.date}</td>
  344. <td>Facture</td>
  345. <td>${orderDocument.reference}</td>
  346. <td>
  347. <a :href="'./?entity=Document&action=downloadInvoice&id='+i" class="btn-sm btn-default">Télécharger</a>
  348. </td>
  349. </tr>
  350. </template>
  351. </tbody>
  352. </table>
  353. {{ macros.card_end() }}
  354. {% endmacro %}
  355. {% macro box_complementary() %}
  356. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  357. {{ macros.card_start("OrderShop.complementary", 'bg-outline-primary') }}
  358. <table class="table table-striped">
  359. <tbody>
  360. <thead>
  361. <tr>
  362. <th>Réference</th>
  363. <th>Date</th>
  364. <th>total</th>
  365. <th>Actions</th>
  366. </tr>
  367. </thead>
  368. <tbody>
  369. <template v-for="(complementaryOrderShop, i) in order.complementaryOrderShops">
  370. <tr>
  371. <td>${complementaryOrderShop.reference}</td>
  372. <td>${complementaryOrderShop.date}</td>
  373. <td>${complementaryOrderShop.total}</td>
  374. <td>
  375. </td>
  376. </tr>
  377. </template>
  378. </tbody>
  379. </table>
  380. {{ macros.card_end() }}
  381. {% endmacro %}
  382. {% macro box_tickets() %}
  383. {% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
  384. {{ macros.card_start("OrderShop.complementary", 'bg-outline-primary') }}
  385. <table class="table table-striped">
  386. <tbody>
  387. <thead>
  388. <tr>
  389. <th>Date</th>
  390. <th>Status</th>
  391. <th>Subject</th>
  392. <th>Actions</th>
  393. </tr>
  394. </thead>
  395. <tbody>
  396. <template v-for="(ticket, i) in order.tickets">
  397. <tr>
  398. <td>${ticket.date}</td>
  399. <td>${ticket.status}</td>
  400. <td>${ticket.subject}</td>
  401. <td>
  402. </td>
  403. </tr>
  404. </template>
  405. </tbody>
  406. </table>
  407. {{ macros.card_end() }}
  408. {% endmacro %}
  409. {% macro box_status() %}
  410. {% embed '@LcShop/backend/default/block/embed_box.twig' %}
  411. {% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
  412. {% trans_default_domain 'lcshop' %}
  413. {% block class %}bg-success{% endblock %}
  414. {% block icon %}info{% endblock %}
  415. {% block label %}{{ "field.OrderShop.status"|trans({}, 'lcshop')}}{% endblock %}
  416. {% block value %}
  417. <strong> ${order.orderStatus}</strong>
  418. {% endblock %}
  419. {% block button %}
  420. {{ order_macros.order_modal_button('#modal-order-status') }}
  421. {% endblock %}
  422. {% endembed %}
  423. {% endmacro %}
  424. {% macro order_modal_button(modalId, class="btn-primary", trad="action.edit", icon=false) %}
  425. <button v-show="editionMode && modalExist('{{ modalId }}')" type="button" class="btn-sm {{ class }}"
  426. data-toggle="modal"
  427. data-target="{{ modalId }}">
  428. {% if icon %}
  429. <i class="fa fa-{{ icon }}"></i>
  430. {% endif %}
  431. {{ trad|trans }}
  432. </button>
  433. {% endmacro order_modal_button %}