WebshopApi: ShopPart Controller
[kivitendo-erp.git] / templates / webpages / shop_part / categories.html
1 [%- USE HTML %]
2 [%- USE T8 %]
3 [%- USE L -%]
4 [%- USE P -%]
5 [%- USE LxERP -%]
6 [%- USE Dumper -%]
7
8 [%  LxERP.t8("Part") %]: [% HTML.escape(SELF.shop_part.part.displayable_name) %]<br>
9 [%  LxERP.t8("Shop") %]: [% HTML.escape(SELF.shop_part.shop.description) %]
10 <br>
11 [% # Dumper.dump_html(SELF.shop_part.shop_category) %]
12 <br>
13 [% # Dumper.dump_html(CATEGORIES) %]
14
15 <form action="controller.pl" method="post">
16   [% BLOCK recurse %]
17     [% # path = '' %]<!-- TODO: Pfad wg neuer Kategorie im Shop anlegen -->
18     [% FOREACH obj = data %]
19       <ul>
20         <li>
21         [% checked = '' %]
22         [% # path = path _ obj.name %]
23         [% # test = path.split('\|') %]
24         [% # Dumper.dump_html(SELF.shop_part.shop_category) %]
25         [% IF SELF.shop_part.shop_category.1.grep(obj.name).size %]
26           [% checked = 'checked' %]
27         [% ELSE %]
28           [% FOREACH cat_row = SELF.shop_part.shop_category %]
29             [% IF cat_row.1.grep(obj.name).size %]
30               [% checked = 'checked' %]
31             [% END %]
32           [% END %]
33         [% END %]
34           [% L.checkbox_tag('categories[]',value=obj.id, checked=checked) %][% HTML.escape(obj.name) %][% L.hidden_tag("cat_id_" _ obj.id, obj.name) %]</li>
35         [% IF obj.childrenCount >= 1 %]
36           [% # path = path _ '|' %]
37           [% INCLUDE recurse data=obj.children %]
38         [% END %]
39       </ul>
40     [% END %]
41   [% END %]
42   <div><h2>[% LxERP.t8("Shopcategories") %]</h2>
43       [% FOREACH row = CATEGORIES %]
44 <!-- TODO: Is still hardcoded 'Root' is shopware specified -->
45         [% IF row.name == 'Root' %]
46           [% IF row.childrenCount >= 1 %]
47             [% path = '' %]
48             [% INCLUDE recurse data=row.children path=path %]
49           [% END %]
50         [% END %]
51       [% END %]
52   </div>
53     [% L.button_tag("kivi.ShopPart.save_categories(" _ SELF.shop_part.id _", " _ SELF.shop_part.shop.id _")", LxERP.t8("Save"))  %]</td>
54 </form>
55