1{#**
2 * Copyright since 2007 PrestaShop SA and Contributors
3 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
4 *
5 * NOTICE OF LICENSE
6 *
7 * This source file is subject to the Open Software License (OSL 3.0)
8 * that is bundled with this package in the file LICENSE.md.
9 * It is also available through the world-wide-web at this URL:
10 * https://opensource.org/licenses/OSL-3.0
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@prestashop.com so we can send you a copy immediately.
14 *
15 * DISCLAIMER
16 *
17 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18 * versions in the future. If you wish to customize PrestaShop for your
19 * needs please refer to https://devdocs.prestashop.com/ for more information.
20 *
21 * @author    PrestaShop SA and Contributors <contact@prestashop.com>
22 * @copyright Since 2007 PrestaShop SA and Contributors
23 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
24 *#}
25
26{% block material_choice_tree_widget %}
27  <div class="material-choice-tree-container js-choice-tree-container{% if required %} required{% endif %}" id="{{ form.vars.id }}">
28  <div class="choice-tree-actions">
29    <span class="form-control-label js-toggle-choice-tree-action"
30          data-expanded-text="{{ 'Expand'|trans({}, 'Admin.Actions') }}"
31          data-expanded-icon="expand_more"
32          data-collapsed-text="{{ 'Collapse'|trans({}, 'Admin.Actions') }}"
33          data-collapsed-icon="expand_less"
34          data-action="expand"
35    >
36      <i class="material-icons">expand_more</i>
37      <span class="js-toggle-text">{{ 'Expand'|trans({}, 'Admin.Actions') }}</span>
38    </span>
39  </div>
40
41  <ul class="choice-tree">
42    {% for choice in choices_tree %}
43      {{ block('material_choice_tree_item_widget') }}
44    {% endfor %}
45  </ul>
46</div>
47{% endblock material_choice_tree_widget %}
48
49{% block material_choice_tree_item_widget %}
50  {% set has_children = choice[choice_children] is defined %}
51
52  <li class="{% if choice.has_selected_children %}expanded{% elseif has_children %}collapsed{% endif %}">
53    {% if multiple %}
54      {{ block('material_choice_tree_item_checkbox_widget') }}
55    {% else %}
56      {{ block('material_choice_tree_item_radio_widget') }}
57    {% endif %}
58
59    {% if has_children %}
60      <ul>
61        {% for item in choice[choice_children] %}
62          {% set choice = item %}
63          {{ block('material_choice_tree_item_widget') }}
64        {% endfor %}
65      </ul>
66    {% endif %}
67  </li>
68{% endblock material_choice_tree_item_widget %}
69
70{% block material_choice_tree_item_checkbox_widget %}
71  <div class="checkbox js-input-wrapper">
72    <div class="md-checkbox md-checkbox-inline">
73      <label>
74        <input type="checkbox"
75         {% if choice[choice_value] is not null %}
76           name="{{ form.vars.full_name }}[]"
77           value="{{ choice[choice_value] }}"
78           {% if choice[choice_value] in selected_values %}checked{% endif %}
79         {% endif %}
80         {% if disabled or choice[choice_value] in disabled_values %}disabled{% endif %}
81        >
82        <i class="md-checkbox-control"></i>
83        {{ choice[choice_label] }}
84      </label>
85    </div>
86  </div>
87{% endblock material_choice_tree_item_checkbox_widget %}
88
89{% block material_choice_tree_item_radio_widget %}
90  <div class="radio js-input-wrapper form-check form-check-radio">
91    <label class="form-check-label">
92      <input type="radio"
93       name="{{ form.vars.full_name }}"
94       value="{{ choice[choice_value] }}"
95       {% if choice[choice_value] in selected_values %}checked{% endif %}
96       {% if disabled or choice[choice_value] in disabled_values %}disabled{% endif %}
97       {% if required %}required{% endif %}
98      >
99      <i class="form-check-round"></i>
100      {{ choice[choice_label] }}
101    </label>
102  </div>
103{% endblock material_choice_tree_item_radio_widget %}
104