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.

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