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.

533 lines
21KB

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