blob: 4b6dc4d7a6043a6c51d06a9383edaff6ac891a70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="web.SearchPanel" owl="1">
<div class="o_search_panel" t-att-class="props.className">
<section t-foreach="model.get('sections', s => !s.empty)" t-as="section" t-key="section.id"
t-attf-class="o_search_panel_section o_search_panel_{{ section.type }}"
>
<header class="o_search_panel_section_header text-uppercase">
<i t-attf-class="fa {{ section.icon }} o_search_panel_section_icon mr-2"
t-att-style="section.color and ('color: ' + section.color)"
/>
<b t-esc="section.description"/>
</header>
<div t-if="section.errorMsg" class="alert alert-warning">
<span><t t-esc="section.errorMsg"/></span>
</div>
<ul t-else="" class="list-group d-block o_search_panel_field">
<t t-if="section.type === 'category'" t-call="web.SearchPanel.Category">
<t t-set="values" t-value="section.rootIds"/>
</t>
<t t-elif="section.groups">
<li t-foreach="section.sortedGroupIds" t-as="groupId" t-key="groupId"
class="o_search_panel_filter_group list-group-item border-0"
>
<!-- TODO: this is a workaround for issue https://github.com/odoo/owl/issues/695 (remove when solved) -->
<t t-set="_section" t-value="section"/>
<t t-set="group" t-value="section.groups.get(groupId)"/>
<header class="o_search_panel_group_header">
<div class="custom-control custom-checkbox">
<!-- TODO: "indeterminate" could not be set in the template and had to be set in
JS manually. See https://github.com/odoo/owl/issues/713 (adapt when solved)
-->
<input type="checkbox"
class="custom-control-input"
t-attf-id="{{ section.id }}_input_{{ groupId }})"
t-on-click="_toggleFilterGroup(section.id, group)"
/>
<label t-attf-for="{{ section.id }}_input_{{ groupId }})"
class="o_search_panel_label custom-control-label"
t-att-class="{ o_with_counters: group.enableCounters }"
t-att-title="group.tooltip or false"
>
<span class="o_search_panel_label_title">
<span t-if="group.hex_color" class="mr-1" t-attf-style="color: {{ group.hex_color }};">●</span>
<t t-esc="group.name"/>
</span>
</label>
</div>
</header>
<ul class="list-group d-block">
<t t-call="web.SearchPanel.FiltersGroup">
<t t-set="values" t-value="group.values"/>
<!-- TODO: this is a workaround for issue https://github.com/odoo/owl/issues/695 (remove when solved) -->
<t t-set="section" t-value="_section"/>
</t>
</ul>
</li>
<ul t-if="section.groups.get(false)" class="list-group d-block">
<t t-call="web.SearchPanel.FiltersGroup">
<t t-set="group" t-value="section.groups.get(false)"/>
<t t-set="values" t-value="group.values"/>
<!-- TODO: this is a workaround for issue https://github.com/odoo/owl/issues/695 (remove when solved) -->
<t t-set="section" t-value="section"/>
</t>
</ul>
</t>
<t t-else="" t-call="web.SearchPanel.FiltersGroup">
<t t-set="values" t-value="section.values"/>
</t>
</ul>
</section>
</div>
</t>
<t t-name="web.SearchPanel.Category" owl="1">
<t t-foreach="values" t-as="valueId" t-key="valueId">
<t t-set="value" t-value="section.values.get(valueId)"/>
<li class="o_search_panel_category_value list-group-item border-0">
<header class="list-group-item-action"
t-att-class="{ active: state.active[section.id] === valueId }"
t-on-click="_toggleCategory(section, value)"
>
<label class="o_search_panel_label mb0" t-att-class="{ o_with_counters: section.enableCounters }">
<div class="o_toggle_fold">
<i t-if="value.childrenIds.length"
t-attf-class="fa fa-caret-{{ state.expanded[section.id][valueId] ? 'down' : 'right' }}"
/>
</div>
<b t-if="value.bold" class="o_search_panel_label_title" t-esc="value.display_name"/>
<span t-else="" class="o_search_panel_label_title" t-esc="value.display_name"/>
</label>
<span t-if="section.enableCounters and value.__count gt 0"
class="o_search_panel_counter text-muted ml-2 small"
t-esc="value.__count"
/>
</header>
<ul t-if="value.childrenIds.length and state.expanded[section.id][valueId]" class="list-group d-block">
<t t-call="web.SearchPanel.Category">
<t t-set="values" t-value="value.childrenIds"/>
</t>
</ul>
</li>
</t>
</t>
<t t-name="web.SearchPanel.FiltersGroup" owl="1">
<li t-foreach="[...values.keys()]" t-as="valueId" t-key="valueId"
class="o_search_panel_filter_value list-group-item border-0"
>
<t t-set="value" t-value="values.get(valueId)"/>
<div class="custom-control custom-checkbox w-100">
<input type="checkbox"
t-attf-id="{{ section.id }}_input_{{ valueId }}"
t-att-checked="state.active[section.id][valueId]"
class="custom-control-input"
t-on-click="_toggleFilterValue(section.id, valueId)"
/>
<label class="o_search_panel_label custom-control-label"
t-attf-for="{{ section.id }}_input_{{ valueId }}"
t-att-title="(group and group.tooltip) or false">
<span class="o_search_panel_label_title" t-esc="value.display_name"/>
<span t-if="section.enableCounters and value.__count gt 0"
class="o_search_panel_counter text-muted ml-2 small"
t-esc="value.__count"
/>
</label>
</div>
</li>
</t>
</templates>
|