Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / templates / webpages / part / _shop.html
diff --git a/templates/webpages/part/_shop.html b/templates/webpages/part/_shop.html
new file mode 100644 (file)
index 0000000..3c65b4d
--- /dev/null
@@ -0,0 +1,89 @@
+[%- USE HTML %][%- USE L -%][%- USE P -%][%- USE LxERP -%]
+[%- USE Dumper %]
+[%- USE JavaScript -%]
+<div id="shop_variables">
+ <h2>[% LxERP.t8("Active shops:") %]</h2>
+ <table width="100%">
+  <thead>
+  <tr class="listheading">
+   <th>[% LxERP.t8("Shop") %]</th>
+   <th>[% LxERP.t8("Active") %]</th>
+   <th>[% LxERP.t8("Shop part") %]</th>
+   <th>[% LxERP.t8("Price source") %]</th>
+   <th>[% LxERP.t8("Price") %]</th>
+   <th>[% LxERP.t8("Stock Local/Shop") %]</th>
+   <th>[% LxERP.t8("Last update") %]</th>
+   <th>[% LxERP.t8("Action") %]</th>
+   <th>[% LxERP.t8("Action") %]</th>
+   <th>[% LxERP.t8("Action") %]</th>
+  </tr>
+  </thead>
+  [%#  L.dump(SELF.part) %]
+  [%- FOREACH shop_part = SELF.part.shop_parts %]
+  [% IF !shop_part.shop.obsolete %]
+
+  <tr class="listrow">
+   <td>[% HTML.escape( shop_part.shop.description ) %]</td>
+   <td>[% L.html_tag('span', shop_part.active, id => 'shop_part_active_' _ shop_part.id ) %]</td>
+   <td>
+    [% IF shop_part.shop.use_part_longdescription %]
+      [% L.html_tag('span', shop_part.part.notes, id => 'shop_part_description_' _ shop_part.id ) %]
+    [% ELSE %]
+      [% L.html_tag('span', shop_part.shop_description, id => 'shop_part_description_' _ shop_part.id ) %]
+    [% END %]
+  </td>
+   <td>[% L.html_tag('span',LxERP.t8(), id => 'active_price_source_' _ shop_part.id) %] </td>
+   <td>[% L.html_tag('span','Price', id => 'price_' _ shop_part.id) %]</td>
+   <td>[% L.html_tag('span','Stock', id => 'stock_' _ shop_part.id) %]</td>
+   <td>[% L.html_tag('span', shop_part.last_update.to_kivitendo('precision' => 'minute'), id => 'shop_part_last_update_' _ shop_part.id ) %]</td>
+   <td>[% L.button_tag("kivi.ShopPart.edit_shop_part(" _ shop_part.id _ ")", LxERP.t8("Edit"))  %]</td>
+   <td>[% L.button_tag("kivi.ShopPart.update_shop_part(" _ shop_part.id _ ")", LxERP.t8("Upload"))  %]</td>
+   <td>[% L.button_tag("kivi.ShopPart.get_all_categories(" _ shop_part.id _ ")", LxERP.t8("Shopcategories"))  %]<br>
+    [% IF shop_part.shop_category %]
+      [% IF shop_part.shop_category.1.size > 1%]
+        [% FOREACH cat = shop_part.shop_category %]
+          [% HTML.escape(cat.1) %]<br>
+        [% END %]
+      [% ELSE %]
+        [% HTML.escape(shop_part.shop_category.1) %]<br>
+      [% END %]
+    [% END %]
+   </td>
+  </tr>
+  <script type="text/javascript">
+    $(function() {
+      kivi.ShopPart.update_price_n_price_source([% shop_part.id %],'[% shop_part.active_price_source %]');
+      kivi.ShopPart.update_stock([% shop_part.id %]);
+    });
+  </script>
+  [% END %]
+  [%- END %]
+  [%- FOREACH shop = SELF.shops_not_assigned %]
+  <tr>
+   <td>[% HTML.escape( shop.description ) %]</td>
+   <td></td>
+   <td></td>
+   <td></td>
+   <td></td>
+   <td></td>
+   <td>[% L.button_tag("kivi.ShopPart.create_shop_part(" _ id _ ", " _ shop.id _ ")", LxERP.t8("Add"))  %]</td>
+  </tr>
+  </thead>
+  [%- END %]
+</table>
+
+
+[% # L.dump(shop_part) %]
+<h2>[% LxERP.t8("Shopimages - valid for all shops") %]</h2>
+  [%- IF shop_part.part_id %]
+    <script type="text/javascript">
+      $(function() {
+        kivi.ShopPart.show_images([% shop_part.part_id %]);
+      });
+    </script>
+    <div id="shop_images" border=1 ></div>
+  [%- ELSE %]
+    <div id="shop_images" border=1 >[% LxERP.t8('To upload images: Please create shoppart first') %]</div>
+  [%- END %]
+</div>
+