website_livechat.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <data>
  4. <!--
  5. Integrate Livechat in Common Frontend for Website
  6. Template registering all the assets required to execute the Livechat from a page containing Odoo
  7. -->
  8. <template id="loader" inherit_id="website.layout" name="Livechat : include loader on Website">
  9. <xpath expr="//div[@id='wrapwrap']" position="after">
  10. <t t-if="not no_livechat and website and website.channel_id">
  11. <script>
  12. <t t-call="im_livechat.loader">
  13. <t t-set="info" t-value="website.get_livechat_channel_info()"/>
  14. </t>
  15. </script>
  16. </t>
  17. </xpath>
  18. </template>
  19. <!-- Page Layout -->
  20. <template id="channel_page" name="Livechat Channel Satisfaction Page">
  21. <t t-call="website.layout">
  22. <div id="wrap">
  23. <div class="container">
  24. <h1><span>Livechat Channel</span> <small t-field="channel.name" /></h1>
  25. <div t-field="channel.website_description" class="oe_structure mt16" />
  26. <div class="row mt32">
  27. <div class="col-lg-8">
  28. <t t-if="len(ratings) &gt; 0">
  29. <div class="row">
  30. <div class="col-lg-12 mb32">
  31. <h3>Statistics</h3>
  32. <div class="row">
  33. <div class="col-lg-4 d-flex justify-content-end flex-column">
  34. <div class="card bg-success text-white" t-attf-style="height: #{160 + int(percentage['great'])}px;">
  35. <div class="card-body text-center">
  36. <img src="/rating/static/src/img/rating_5.png" style="height:40px" alt="Happy face"/>
  37. </div>
  38. <div class="card-body text-center">
  39. <h2 style="margin: 0">
  40. <b style="font-size: 30px">
  41. <t t-esc="percentage['great']" />
  42. </b>
  43. <small>%</small>
  44. </h2>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="col-lg-4 d-flex justify-content-end flex-column">
  49. <div class="card bg-warning text-white" t-attf-style="height: #{160 + int(percentage['okay'])}px;">
  50. <div class="card-body text-center">
  51. <img src="/rating/static/src/img/rating_3.png" style="height:40px" alt="Neutral face"/>
  52. </div>
  53. <div class="card-body text-center">
  54. <h2 style="margin: 0">
  55. <b style="font-size: 30px">
  56. <t t-esc="percentage['okay']" />
  57. </b>
  58. <small>%</small>
  59. </h2>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="col-lg-4 d-flex justify-content-end flex-column">
  64. <div class="card bg-danger text-white" t-attf-style="height: #{160 + int(percentage['bad'])}px;">
  65. <div class="card-body text-center">
  66. <img src="/rating/static/src/img/rating_1.png" style="height:40px" alt="Sad face"/>
  67. </div>
  68. <div class="card-body text-center">
  69. <h2 style="margin: 0">
  70. <b style="font-size: 30px">
  71. <t t-esc="percentage['bad']" />
  72. </b>
  73. <small>%</small>
  74. </h2>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <div class="row">
  82. <div class="col-lg-12 mb32">
  83. <h3>The <t t-esc="len(ratings)"/> last feedbacks</h3>
  84. <div>
  85. <t t-foreach="ratings" t-as="rating">
  86. <img t-attf-src='/rating/static/src/img/rating_#{int(rating.rating)}.png' t-att-alt="rating.res_name" width="48px" height="48px"/>
  87. <t t-if="(rating_index+1) % 5 == 0">
  88. <br/>
  89. </t>
  90. </t>
  91. </div>
  92. </div>
  93. </div>
  94. </t>
  95. <t t-if="len(ratings) == 0">
  96. <h4 style="text-align:center">There are no ratings for this channel for now.</h4>
  97. </t>
  98. </div>
  99. <div class="col-lg-4 mb32">
  100. <h3>The Team</h3>
  101. <t t-foreach="team" t-as="user">
  102. <div class="d-flex mt-3">
  103. <img t-att-src="image_data_uri(user.avatar_128)" class="o_image_64_cover rounded o_livechat_operator_avatar" t-att-alt="user.livechat_username or user.name"/>
  104. <div class="flex-grow-1">
  105. <h5>
  106. <t t-if="user.livechat_username">
  107. <t t-esc="user.livechat_username"/>
  108. </t>
  109. <t t-else="">
  110. <t t-esc="user.name"/>
  111. </t>
  112. </h5>
  113. <div class="col-lg-12">
  114. <div class="row gx-0">
  115. <t t-if="user.partner_id.id in ratings_per_user">
  116. <div class="col-lg-4 ps-0 pe-0">
  117. <img t-attf-src='/rating/static/src/img/rating_5.png' alt="Great" width="16px" height="16px"/>
  118. <span class="align-middle"><t t-esc="ratings_per_user[user.partner_id.id]['great']"/>%</span>
  119. </div>
  120. <div class="col-lg-4 ps-0 pe-0">
  121. <img t-attf-src='/rating/static/src/img/rating_3.png' alt="Okay" width="16px" height="16px"/>
  122. <span class="align-middle"><t t-esc="ratings_per_user[user.partner_id.id]['okay']"/>%</span>
  123. </div>
  124. <div class="col-lg-4 ps-0 pe-0">
  125. <img t-attf-src='/rating/static/src/img/rating_1.png' alt="Bad" width="16px" height="16px"/>
  126. <span class="align-middle"><t t-esc="ratings_per_user[user.partner_id.id]['bad']"/>%</span>
  127. </div>
  128. </t>
  129. <t t-else="">
  130. <div class="col-lg-12 ps-0 pe-0 o_livechat_no_rating">Not rated yet</div>
  131. </t>
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. </t>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. </t>
  142. </template>
  143. <template id="channel_list_page" name="Livechat Channel List Page">
  144. <t t-call="website.layout">
  145. <div id="wrap">
  146. <div class="oe_structure" id="oe_structure_website_livechat_channel_list_1"/>
  147. <div class="container">
  148. <h1 class="pt-3">Livechat Support Channels</h1>
  149. <div class="row mt32 mb32">
  150. <t t-if="not len(channels)">
  151. <div class="col-lg-6 offset-lg-3">
  152. There are no public livechat channels to show.
  153. </div>
  154. </t>
  155. <t t-if="len(channels)">
  156. <div class="col-lg-6">
  157. <t t-foreach="channels" t-as="channel">
  158. <div t-attf-class="d-flex#{' mt-3' if channel_index else ''}">
  159. <a t-attf-href="/livechat/channel/#{ slug(channel)}">
  160. <img t-att-src="channel.image_128 and image_data_uri(channel.image_128) or '/web/static/img/placeholder.png'" t-att-alt="channel.name" class="o_image_64_cover"/>
  161. </a>
  162. <div class="flex-grow-1 h-100 my-auto">
  163. <h4><t t-esc="channel.name"/></h4>
  164. </div>
  165. </div>
  166. </t>
  167. </div>
  168. </t>
  169. </div>
  170. </div>
  171. <div class="oe_structure" id="oe_structure_website_livechat_channel_list_2"/>
  172. </div>
  173. </t>
  174. </template>
  175. </data>
  176. </odoo>