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.

143 lines
7.4 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Copyright (C) 2018 MuK IT GmbH
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU Affero General Public License as
  6. published by the Free Software Foundation, either version 3 of the
  7. License, or (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. -->
  15. <templates id="template" xml:space="preserve">
  16. <t t-name="SearchPanel.SectionHeader">
  17. <header class="o_search_panel_section_header text-uppercase">
  18. <i t-attf-class="mr-1 fa #{section.icon} o_search_panel_section_icon" t-attf-style="#{section.color ? ('color: ' + section.color) : ''}"/>
  19. <b><t t-esc="section.description"/></b>
  20. </header>
  21. </t>
  22. <t t-name="SearchPanel.Category">
  23. <section class="o_search_panel_section o_search_panel_category">
  24. <t t-call="SearchPanel.SectionHeader">
  25. <t t-set="section" t-value="category"/>
  26. </t>
  27. <ul class="list-group d-block">
  28. <li class="o_search_panel_category_value border-0 list-group-item" t-att-data-category-id="category.id">
  29. <header t-att-class="'list-group-item-action' + (!category.activeValueId ? ' active' : '')">
  30. <label class="o_search_panel_label mb0 d-block">
  31. <span class="o_search_panel_label_title"><b>All</b></span>
  32. </label>
  33. </header>
  34. </li>
  35. <t t-call="SearchPanel.CategoryValues">
  36. <t t-set="values" t-value="category.rootIds"/>
  37. </t>
  38. </ul>
  39. </section>
  40. </t>
  41. <t t-name="SearchPanel.CategoryValues">
  42. <t t-foreach="values" t-as="valueId">
  43. <t t-set="value" t-value="category.values[valueId]"/>
  44. <li class="o_search_panel_category_value border-0 list-group-item" t-att-data-id="value.id" t-att-data-category-id="category.id">
  45. <header t-att-class="'list-group-item-action' + (value.id === category.activeValueId ? ' active' : '')">
  46. <label t-att-for="value.display_name" class="o_search_panel_label mb0 d-block">
  47. <i t-if="value.childrenIds.length" t-att-class="'fa fa-fw pull-right o_toggle_fold ' + (value.folded ? 'fa-caret-left' : 'fa-caret-down')"/>
  48. <span class="o_search_panel_label_title"><t t-esc="value.display_name"/></span>
  49. </label>
  50. </header>
  51. <ul t-if="!value.folded" class="list-group d-block">
  52. <t t-call="SearchPanel.CategoryValues">
  53. <t t-set="values" t-value="value.childrenIds"/>
  54. </t>
  55. </ul>
  56. </li>
  57. </t>
  58. </t>
  59. <t t-name="SearchPanel.Filter">
  60. <section class="o_search_panel_section o_search_panel_filter">
  61. <t t-call="SearchPanel.SectionHeader">
  62. <t t-set="section" t-value="filter"/>
  63. </t>
  64. <ul class="list-group d-block">
  65. <t t-if="filter.groups" t-call="SearchPanel.FilterGroups">
  66. <t t-set="groups" t-value="filter.groups"/>
  67. </t>
  68. <t t-else="" t-call="SearchPanel.FilterValues">
  69. <t t-set="sortedValueIds" t-value="filter.sortedValueIds"/>
  70. <t t-set="values" t-value="filter.values"/>
  71. </t>
  72. </ul>
  73. </section>
  74. </t>
  75. <t t-name="SearchPanel.FilterGroups">
  76. <li t-foreach="filter.sortedGroupIds" t-as="groupId" t-att-data-group-id="groupId" t-att-data-filter-id="filter.id"
  77. class="o_search_panel_filter_group list-group-item border-0">
  78. <t t-set="group" t-value="groups[groupId]"/>
  79. <div class="custom-control custom-checkbox">
  80. <t t-set="inputId" t-value="_.uniqueId('input_')"/>
  81. <input type="checkbox" t-att-id="inputId" t-att-checked="group.state === 'checked' ? 'checked' : undefined" class="custom-control-input"/>
  82. <label t-att-for="inputId" class="o_search_panel_label custom-control-label d-block" t-att-title="group.tooltip">
  83. <i t-att-class="'fa fa-fw pull-right o_toggle_fold ' + (group.folded ? 'fa-caret-left' : 'fa-caret-down')"/>
  84. <span class="o_search_panel_label_title"><t t-esc="group.name"/></span>
  85. </label>
  86. </div>
  87. <ul t-if="!group.folded" class="list-group d-block">
  88. <t t-call="SearchPanel.FilterValues">
  89. <t t-set="sortedValueIds" t-value="group.sortedValueIds"/>
  90. <t t-set="values" t-value="group.values"/>
  91. </t>
  92. </ul>
  93. </li>
  94. <ul t-if="groups['false']" class="list-group d-block">
  95. <t t-call="SearchPanel.FilterValues">
  96. <t t-set="group" t-value="groups['false']"/>
  97. <t t-set="sortedValueIds" t-value="group.sortedValueIds"/>
  98. <t t-set="values" t-value="group.values"/>
  99. </t>
  100. </ul>
  101. </t>
  102. <t t-name="SearchPanel.FilterValues">
  103. <li t-foreach="sortedValueIds" t-as="valueId" t-att-data-value-id="valueId" t-att-data-filter-id="filter.id"
  104. class="o_search_panel_filter_value list-group-item border-0">
  105. <t t-set="value" t-value="values[valueId]"/>
  106. <div class="custom-control custom-checkbox">
  107. <t t-set="inputId" t-value="_.uniqueId('input_')"/>
  108. <input type="checkbox" t-att-id="inputId" t-att-checked="value.checked ? 'checked' : undefined" class="custom-control-input"/>
  109. <label t-att-for="inputId" class="o_search_panel_label custom-control-label d-block" t-att-title="group &amp;&amp; group.tooltip">
  110. <span class="o_search_panel_label_title"><t t-esc="value.name"/></span>
  111. <span t-if="value.count > 0" class="pull-right text-muted mr-2 mt-1 small"><t t-esc="value.count"/></span>
  112. <span t-if="filter.disableCounters" class="pull-right text-muted mr-2 mt-1 small">?</span>
  113. </label>
  114. </div>
  115. </li>
  116. </t>
  117. <t t-name="SearchPanel.MobileSummary">
  118. <t t-set="emptySelection" t-value="!categories.length &amp; !filterValues.length"/>
  119. <summary class="d-flex align-items-center">
  120. <div class="text-truncate font-italic ml-2 mr-auto">
  121. <t t-if="emptySelection">Filters...</t>
  122. <span t-foreach="categories" t-as="category" class="o_search_panel_category mr-1">
  123. <i t-if="category.icon" t-attf-class="o_search_panel_section_icon fa fa-w #{category.icon}" t-attf-style="#{category.color ? ('color: ' + category.color) : undefined}"/>
  124. <t t-esc="category.breadcrumb.join(separator)"/>
  125. </span>
  126. <span t-foreach="filterValues" t-as="filterValue" class="o_search_panel_filter mr-1">
  127. <i t-if="filterValue.icon" t-attf-class="o_search_panel_section_icon fa fa-w #{filterValue.icon}" t-attf-style="#{filterValue.color ? ('color: ' + filterValue.color) : undefined}"/>
  128. <t t-esc="filterValue.name"/>
  129. </span>
  130. </div>
  131. <i class="fa fa-fw fa-chevron-left"/>
  132. </summary>
  133. </t>
  134. </templates>