diff --git a/groupTasks/groups/shx-product-label/backPage.html b/groupTasks/groups/old-shx-product-label/backPage.html
similarity index 100%
rename from groupTasks/groups/shx-product-label/backPage.html
rename to groupTasks/groups/old-shx-product-label/backPage.html
diff --git a/groupTasks/groups/shx-product-label/frontPage.html b/groupTasks/groups/old-shx-product-label/frontPage.html
similarity index 100%
rename from groupTasks/groups/shx-product-label/frontPage.html
rename to groupTasks/groups/old-shx-product-label/frontPage.html
diff --git a/groupTasks/groups/old-shx-product-label/index.js b/groupTasks/groups/old-shx-product-label/index.js
new file mode 100644
index 0000000..fa23691
--- /dev/null
+++ b/groupTasks/groups/old-shx-product-label/index.js
@@ -0,0 +1,141 @@
+const PRODUCT_NAME = "{{PRODUCT_NAME}}", // Gizmo die Eidechse
+ PRODUCT_COLOR = "{{PRODUCT_COLOR}}", // Farbe Grün/Blau/Orange
+ PRODUCT_COLOR_CHARACTERISTICS = "{{PRODUCT_COLOR_CHARACTERISTICS}}", // (Glänzend)
+ PRODUCT_ID = "{{PRODUCT_ID}}"; // #32420
+
+window.onload = () => {
+ for (let i = 0; i < 10; i++) {
+ let labels = document.getElementById("labels");
+
+ /* CONTAINER */
+
+ const container = document.createElement("div");
+ container.className = "container";
+
+ /* FIRST */
+
+ const div = document.createElement("div");
+
+ const background = document.createElement("div");
+ background.className = "background";
+
+ const content = document.createElement("div");
+ content.className = "content";
+
+ const productName = document.createElement("h1");
+ productName.innerHTML = PRODUCT_NAME;
+
+ const productColor = document.createElement("p");
+ productColor.innerHTML = PRODUCT_COLOR;
+ productColor.className = "product-color";
+
+ const productColorCharacteristics = document.createElement("p");
+ productColorCharacteristics.innerHTML = PRODUCT_COLOR_CHARACTERISTICS;
+ productColorCharacteristics.className = "product-color";
+
+ const productId = document.createElement("p");
+ productId.innerHTML = PRODUCT_ID;
+ productId.className = "product-id";
+
+ const contentDiv = document.createElement("div");
+
+ contentDiv.appendChild(productName);
+ contentDiv.appendChild(productColor);
+ contentDiv.appendChild(productColorCharacteristics);
+ contentDiv.appendChild(productId);
+
+ content.appendChild(contentDiv);
+
+ div.appendChild(background);
+ div.appendChild(content);
+
+ container.appendChild(div);
+
+ /* SECOND */
+
+ const div2 = document.createElement("div");
+
+ const manufacturerInfo = document.createElement("div");
+ manufacturerInfo.className = "manufacturer-info";
+
+ const manufacturer = document.createElement("p");
+ manufacturer.innerHTML = "Hersteller: Jan Umbach";
+
+ const address = document.createElement("p");
+ address.innerHTML = "Tannenwäldchen 20";
+
+ const zipCity = document.createElement("p");
+ zipCity.innerHTML = "D-34212 Melsungen";
+
+ manufacturerInfo.appendChild(manufacturer);
+ manufacturerInfo.appendChild(address);
+ manufacturerInfo.appendChild(zipCity);
+
+ div2.appendChild(manufacturerInfo);
+
+ const additionalInfo = document.createElement("div");
+ additionalInfo.className = "additional-info";
+
+ const additionalInfoText = document.createElement("p");
+ additionalInfoText.innerHTML = "Made in Germany";
+
+ const imgContainer = document.createElement("div");
+ imgContainer.className = "img-container";
+
+ const childrenImg = document.createElement("img");
+ childrenImg.src = "../../groupsData/shx-product-label/children.jpg";
+ childrenImg.alt = "children";
+ childrenImg.className = "children";
+
+ const ceImg = document.createElement("img");
+ ceImg.src = "../../groupsData/shx-product-label/ce.svg";
+ ceImg.alt = "ce";
+ ceImg.className = "ce";
+
+ imgContainer.appendChild(childrenImg);
+ imgContainer.appendChild(ceImg);
+
+ additionalInfo.appendChild(additionalInfoText);
+ additionalInfo.appendChild(imgContainer);
+
+ div2.appendChild(additionalInfo);
+
+ container.appendChild(div2);
+
+ labels.appendChild(container);
+ }
+};
+
+/*
+
+
+
+
+
+
+
Gizmo die Eidechse
+
Farbe Grün/Blau/Orange
+
(Glänzend)
+
#32420
+
+
+
+
+
+
+
Hersteller: Jan Umbach
+
Tannenwäldchen 20
+
D-34212 Melsungen
+
+
+
+
Made in Germany
+
+
+

+

+
+
+
+
+*/
diff --git a/groupTasks/groups/old-shx-product-label/oldindex.json b/groupTasks/groups/old-shx-product-label/oldindex.json
new file mode 100644
index 0000000..270e064
--- /dev/null
+++ b/groupTasks/groups/old-shx-product-label/oldindex.json
@@ -0,0 +1,30 @@
+{
+ "category": "Shinnex",
+ "name": "Produktschilder ausdrucken",
+ "globalInputs": [],
+ "tasks": [
+ {
+ "name": "Produktschilder ausdrucken",
+ "onFinish": "next",
+ "undoPossible": false,
+ "repeatPossible": true,
+ "scriptPath": "script.py",
+ "parameters": [
+ {
+ "parameterName": "product_type_id",
+ "type": "select",
+ "displayName": "Produkttyp auswählen",
+ "options": [
+ "#32420 Gizmo die Eidechse - Grün, Blau, Orange (Glänzend)",
+ "#92784 Gizmo die Eidechse - Glitzer Grün (Seidenmatt)",
+ "#36521 Charlie das Häschen - Hellbraun (Matt)",
+ "#48273 Charlie das Häschen - Gold (Glänzend)",
+ "#71936 Ruby die Schlange - Feuerrot (Glänzend)",
+ "#58324 Ruby die Schlange - Rot/Blau (Glänzend)"
+ ],
+ "global": false
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/groupTasks/groups/old-shx-product-label/script.py b/groupTasks/groups/old-shx-product-label/script.py
new file mode 100644
index 0000000..456dd05
--- /dev/null
+++ b/groupTasks/groups/old-shx-product-label/script.py
@@ -0,0 +1,90 @@
+import json
+import subprocess
+import sys
+import os
+
+sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))
+
+from libs.utils import utils
+
+json_object = json.loads(sys.argv[1])
+product_type_id = json_object["product_type_id"]
+
+if product_type_id is None:
+ print("Missing required parameters")
+ sys.exit(1)
+
+product_type_id = product_type_id["value"]
+
+
+product_type_ids = {}
+
+def add_product_type_id(product_type_id, product_name, product_color, product_color_characteristics):
+ product_type_ids[product_type_id] = {
+ "product_id": f"#{product_type_id}",
+ "product_name": product_name,
+ "product_color": f"Farbe {product_color}",
+ "product_color_characteristics": f"({product_color_characteristics})"
+ }
+
+add_product_type_id("32420", "Gizmo die Eidechse", "Grün/Blau/Orange", "Glänzend")
+add_product_type_id("92784", "Gizmo die Eidechse", "Glitzer Grün", "Seidenmatt")
+add_product_type_id("36521", "Charlie das Häschen", "Hellbraun", "Matt")
+add_product_type_id("48273", "Charlie das Häschen", "Gold", "Glänzend")
+add_product_type_id("71936", "Ruby die Schlange", "Feuerrot", "Glänzend")
+add_product_type_id("58324", "Ruby die Schlange", "Rot/Blau", "Glänzend")
+
+
+def createPdf(sourceHtml, outputPdf):
+ command = [
+ "google-chrome-stable",
+ "--headless",
+ "--no-sandbox",
+ "--disable-gpu",
+ "--print-to-pdf=" + outputPdf,
+ "--run-all-compositor-stages-before-draw",
+ "--virtual-time-budget=10000",
+ sourceHtml,
+ ]
+
+ process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ _, stderr = process.communicate()
+
+ if process.returncode != 0:
+ print("Error creating PDF")
+ print(stderr)
+ sys.exit(1)
+
+if __name__ == "__main__":
+ utils.move_files_back_from_old_files()
+
+ # replace placeholders in index.js
+ p_type_id = product_type_id.split(" ")[0].split("#")[1]
+
+ if p_type_id not in product_type_ids:
+ print("Product type not found")
+ sys.exit(1)
+
+ print(f"Creating product label for product type #{p_type_id}")
+
+ product = product_type_ids[p_type_id]
+
+ with open("index.js", "r") as file:
+ indexjs = file.read()
+
+ indexjs = indexjs.replace("{{PRODUCT_ID}}", product["product_id"])
+ indexjs = indexjs.replace("{{PRODUCT_NAME}}", product["product_name"])
+ indexjs = indexjs.replace("{{PRODUCT_COLOR}}", product["product_color"])
+ indexjs = indexjs.replace("{{PRODUCT_COLOR_CHARACTERISTICS}}", product["product_color_characteristics"])
+
+ with open("index.js", "w") as file:
+ file.write(indexjs)
+
+ # create front page
+
+ createPdf("frontPage.html", "frontOutput.pdf")
+ createPdf("backPage.html", "backOutput.pdf")
+
+ utils.merge_pdfs("frontOutput.pdf", "backOutput.pdf", "Produktschilder.pdf")
+
+ utils.clear_workspace(["frontOutput.pdf", "backOutput.pdf", "backPage.html", "frontPage.html", "index.js", "style.css"])
\ No newline at end of file
diff --git a/groupTasks/groups/shx-product-label/style.css b/groupTasks/groups/old-shx-product-label/style.css
similarity index 100%
rename from groupTasks/groups/shx-product-label/style.css
rename to groupTasks/groups/old-shx-product-label/style.css
diff --git a/groupTasks/groups/shx-product-label/index.html b/groupTasks/groups/shx-product-label/index.html
new file mode 100644
index 0000000..5e2ae5b
--- /dev/null
+++ b/groupTasks/groups/shx-product-label/index.html
@@ -0,0 +1,150 @@
+
+
+
+
+
+ Document
+
+
+
+
+
+
+
diff --git a/groupTasks/groups/shx-product-label/index.js b/groupTasks/groups/shx-product-label/index.js
index fa23691..fad561d 100644
--- a/groupTasks/groups/shx-product-label/index.js
+++ b/groupTasks/groups/shx-product-label/index.js
@@ -2,28 +2,37 @@ const PRODUCT_NAME = "{{PRODUCT_NAME}}", // Gizmo die Eidechse
PRODUCT_COLOR = "{{PRODUCT_COLOR}}", // Farbe Grün/Blau/Orange
PRODUCT_COLOR_CHARACTERISTICS = "{{PRODUCT_COLOR_CHARACTERISTICS}}", // (Glänzend)
PRODUCT_ID = "{{PRODUCT_ID}}"; // #32420
+/*
+const PRODUCT_NAME = "Gizmo die Eidechse",
+ PRODUCT_COLOR = "Farbe Grün/Blau/Orange",
+ PRODUCT_COLOR_CHARACTERISTICS = "(Glänzend)",
+ PRODUCT_ID = "#32420"; */
window.onload = () => {
- for (let i = 0; i < 10; i++) {
+ for (let i = 0; i < 12; i++) {
let labels = document.getElementById("labels");
/* CONTAINER */
- const container = document.createElement("div");
- container.className = "container";
+ const label = document.createElement("div");
+ label.className = "label";
/* FIRST */
- const div = document.createElement("div");
-
- const background = document.createElement("div");
- background.className = "background";
+ const backgroundImage = document.createElement("div");
+ backgroundImage.className = "background-image";
const content = document.createElement("div");
content.className = "content";
- const productName = document.createElement("h1");
- productName.innerHTML = PRODUCT_NAME;
+ const productName = PRODUCT_NAME.split(" ");
+
+ const productNameFirst = document.createElement("h1");
+ productNameFirst.innerHTML = productName[0];
+
+ const productNameRemainingPart = document.createElement("h1");
+ productNameRemainingPart.innerHTML = productName.slice(1).join(" ");
+ productNameRemainingPart.style = "margin: 0";
const productColor = document.createElement("p");
productColor.innerHTML = PRODUCT_COLOR;
@@ -37,105 +46,56 @@ window.onload = () => {
productId.innerHTML = PRODUCT_ID;
productId.className = "product-id";
- const contentDiv = document.createElement("div");
+ content.appendChild(productNameFirst);
+ content.appendChild(productNameRemainingPart);
+ content.appendChild(productColor);
+ content.appendChild(productColorCharacteristics);
+ content.appendChild(productId);
- contentDiv.appendChild(productName);
- contentDiv.appendChild(productColor);
- contentDiv.appendChild(productColorCharacteristics);
- contentDiv.appendChild(productId);
+ /* container */
- content.appendChild(contentDiv);
+ const container = document.createElement("div");
+ container.className = "container";
- div.appendChild(background);
- div.appendChild(content);
-
- container.appendChild(div);
-
- /* SECOND */
-
- const div2 = document.createElement("div");
+ const childrenImg = document.createElement("img");
+ childrenImg.src = "../../groupsData/shx-product-label/children.png";
+ childrenImg.alt = "children";
+ childrenImg.className = "children";
const manufacturerInfo = document.createElement("div");
manufacturerInfo.className = "manufacturer-info";
const manufacturer = document.createElement("p");
- manufacturer.innerHTML = "Hersteller: Jan Umbach";
+ manufacturer.innerHTML = "Hersteller:";
- const address = document.createElement("p");
- address.innerHTML = "Tannenwäldchen 20";
+ const manufacturer2 = document.createElement("p");
+ manufacturer2.innerHTML = "Jan Umbach";
- const zipCity = document.createElement("p");
- zipCity.innerHTML = "D-34212 Melsungen";
+ const manufacturer3 = document.createElement("p");
+ manufacturer3.innerHTML = "Klosterstraße 10";
+
+ const manufacturer4 = document.createElement("p");
+ manufacturer4.innerHTML = "D-34286 Spangenberg";
manufacturerInfo.appendChild(manufacturer);
- manufacturerInfo.appendChild(address);
- manufacturerInfo.appendChild(zipCity);
-
- div2.appendChild(manufacturerInfo);
-
- const additionalInfo = document.createElement("div");
- additionalInfo.className = "additional-info";
-
- const additionalInfoText = document.createElement("p");
- additionalInfoText.innerHTML = "Made in Germany";
-
- const imgContainer = document.createElement("div");
- imgContainer.className = "img-container";
-
- const childrenImg = document.createElement("img");
- childrenImg.src = "../../groupsData/shx-product-label/children.jpg";
- childrenImg.alt = "children";
- childrenImg.className = "children";
+ manufacturerInfo.appendChild(manufacturer2);
+ manufacturerInfo.appendChild(manufacturer3);
+ manufacturerInfo.appendChild(manufacturer4);
const ceImg = document.createElement("img");
ceImg.src = "../../groupsData/shx-product-label/ce.svg";
ceImg.alt = "ce";
ceImg.className = "ce";
- imgContainer.appendChild(childrenImg);
- imgContainer.appendChild(ceImg);
+ container.appendChild(childrenImg);
+ container.appendChild(manufacturerInfo);
+ container.appendChild(ceImg);
- additionalInfo.appendChild(additionalInfoText);
- additionalInfo.appendChild(imgContainer);
+ content.appendChild(container);
- div2.appendChild(additionalInfo);
+ label.appendChild(backgroundImage);
+ label.appendChild(content);
- container.appendChild(div2);
-
- labels.appendChild(container);
+ labels.appendChild(label);
}
};
-
-/*
-
-
-
-
-
-
-
Gizmo die Eidechse
-
Farbe Grün/Blau/Orange
-
(Glänzend)
-
#32420
-
-
-
-
-
-
-
Hersteller: Jan Umbach
-
Tannenwäldchen 20
-
D-34212 Melsungen
-
-
-
-
Made in Germany
-
-
-

-

-
-
-
-
-*/
diff --git a/groupTasks/groups/shx-product-label/index.json b/groupTasks/groups/shx-product-label/index.json
index 270e064..626b6f0 100644
--- a/groupTasks/groups/shx-product-label/index.json
+++ b/groupTasks/groups/shx-product-label/index.json
@@ -15,12 +15,15 @@
"type": "select",
"displayName": "Produkttyp auswählen",
"options": [
- "#32420 Gizmo die Eidechse - Grün, Blau, Orange (Glänzend)",
- "#92784 Gizmo die Eidechse - Glitzer Grün (Seidenmatt)",
- "#36521 Charlie das Häschen - Hellbraun (Matt)",
- "#48273 Charlie das Häschen - Gold (Glänzend)",
- "#71936 Ruby die Schlange - Feuerrot (Glänzend)",
- "#58324 Ruby die Schlange - Rot/Blau (Glänzend)"
+ "#32420; Gizmo die Eidechse; Grün, Blau, Orange; (Glänzend)",
+ "#92784; Gizmo die Eidechse; Glitzer Grün; (Seidenmatt)",
+ "#36521; Charlie das Häschen; Hellbraun; (Matt)",
+ "#48273; Charlie das Häschen; Gold; (Glänzend)",
+ "#71936; Ruby die Schlange; Feuerrot; (Glänzend)",
+ "#58324; Ruby die Schlange; Rot/Blau; (Glänzend)",
+ "#21433; Bruno der Dino; Grün/Blau/Orange; (Glänzend)",
+ "#57953; Bruno der Dino; Rot/Blau; (Glänzend)",
+ "#90578; Bruno der Dino; Gold; (Glänzend)"
],
"global": false
}
diff --git a/groupTasks/groups/shx-product-label/script.py b/groupTasks/groups/shx-product-label/script.py
index 456dd05..4dd0fa9 100644
--- a/groupTasks/groups/shx-product-label/script.py
+++ b/groupTasks/groups/shx-product-label/script.py
@@ -24,16 +24,19 @@ def add_product_type_id(product_type_id, product_name, product_color, product_co
"product_id": f"#{product_type_id}",
"product_name": product_name,
"product_color": f"Farbe {product_color}",
- "product_color_characteristics": f"({product_color_characteristics})"
+ "product_color_characteristics": product_color_characteristics
}
-add_product_type_id("32420", "Gizmo die Eidechse", "Grün/Blau/Orange", "Glänzend")
-add_product_type_id("92784", "Gizmo die Eidechse", "Glitzer Grün", "Seidenmatt")
-add_product_type_id("36521", "Charlie das Häschen", "Hellbraun", "Matt")
-add_product_type_id("48273", "Charlie das Häschen", "Gold", "Glänzend")
-add_product_type_id("71936", "Ruby die Schlange", "Feuerrot", "Glänzend")
-add_product_type_id("58324", "Ruby die Schlange", "Rot/Blau", "Glänzend")
+with open("../../groups/shx-product-label/index.json", "r") as file:
+ content = json.load(file)
+products = content["tasks"][0]["parameters"][0]["options"]
+
+for product in products:
+ data = product.split("; ")
+
+ # remove the # on the start
+ add_product_type_id(data[0][1:], data[1], data[2], data[3])
def createPdf(sourceHtml, outputPdf):
command = [
@@ -58,8 +61,9 @@ def createPdf(sourceHtml, outputPdf):
if __name__ == "__main__":
utils.move_files_back_from_old_files()
+ # remove the ; on the end of the id
# replace placeholders in index.js
- p_type_id = product_type_id.split(" ")[0].split("#")[1]
+ p_type_id = product_type_id.split(" ")[0].split("#")[1][:-1]
if p_type_id not in product_type_ids:
print("Product type not found")
@@ -82,9 +86,6 @@ if __name__ == "__main__":
# create front page
- createPdf("frontPage.html", "frontOutput.pdf")
- createPdf("backPage.html", "backOutput.pdf")
+ createPdf("index.html", "Produktschilder.pdf")
- utils.merge_pdfs("frontOutput.pdf", "backOutput.pdf", "Produktschilder.pdf")
-
- utils.clear_workspace(["frontOutput.pdf", "backOutput.pdf", "backPage.html", "frontPage.html", "index.js", "style.css"])
\ No newline at end of file
+ utils.clear_workspace(["index.html", "index.js"])
\ No newline at end of file
diff --git a/groupTasks/groupsData/shx-product-label/backPageBackground.svg b/groupTasks/groupsData/old-shx-product-label/backPageBackground.svg
similarity index 100%
rename from groupTasks/groupsData/shx-product-label/backPageBackground.svg
rename to groupTasks/groupsData/old-shx-product-label/backPageBackground.svg
diff --git a/groupTasks/groupsData/old-shx-product-label/ce.svg b/groupTasks/groupsData/old-shx-product-label/ce.svg
new file mode 100644
index 0000000..91dbd58
--- /dev/null
+++ b/groupTasks/groupsData/old-shx-product-label/ce.svg
@@ -0,0 +1,6 @@
+
+
+
diff --git a/groupTasks/groupsData/shx-product-label/children.jpg b/groupTasks/groupsData/old-shx-product-label/children.jpg
similarity index 100%
rename from groupTasks/groupsData/shx-product-label/children.jpg
rename to groupTasks/groupsData/old-shx-product-label/children.jpg
diff --git a/groupTasks/groupsData/shx-product-label/frontPageBackground.svg b/groupTasks/groupsData/old-shx-product-label/frontPageBackground.svg
similarity index 100%
rename from groupTasks/groupsData/shx-product-label/frontPageBackground.svg
rename to groupTasks/groupsData/old-shx-product-label/frontPageBackground.svg
diff --git a/groupTasks/groupsData/shx-product-label/background.svg b/groupTasks/groupsData/shx-product-label/background.svg
new file mode 100644
index 0000000..06986bb
--- /dev/null
+++ b/groupTasks/groupsData/shx-product-label/background.svg
@@ -0,0 +1,44 @@
+
diff --git a/groupTasks/groupsData/shx-product-label/children.png b/groupTasks/groupsData/shx-product-label/children.png
new file mode 100644
index 0000000..ebbcce9
Binary files /dev/null and b/groupTasks/groupsData/shx-product-label/children.png differ