submit position for label
parent
38afcfd242
commit
7ae95c9291
|
@ -1,7 +1,11 @@
|
|||
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
|
||||
PRODUCT_ID = "{{PRODUCT_ID}}", // #32420
|
||||
LABEL_PAPER_POSITION = "{{LABEL_PAPER_POSITION}}"; // could be a number between 1 and 12 or combination like 1,3,7
|
||||
|
||||
const labelPaperPosition = LABEL_PAPER_POSITION.split(",");
|
||||
|
||||
/*
|
||||
const PRODUCT_NAME = "Gizmo die Eidechse",
|
||||
PRODUCT_COLOR = "Farbe Grün/Blau/Orange",
|
||||
|
@ -9,7 +13,7 @@ const PRODUCT_NAME = "Gizmo die Eidechse",
|
|||
PRODUCT_ID = "#32420"; */
|
||||
|
||||
window.onload = () => {
|
||||
for (let i = 0; i < 12; i++) {
|
||||
for (let i = 1; i <= 12; i++) {
|
||||
let labels = document.getElementById("labels");
|
||||
|
||||
/* CONTAINER */
|
||||
|
@ -17,84 +21,86 @@ window.onload = () => {
|
|||
const label = document.createElement("div");
|
||||
label.className = "label";
|
||||
|
||||
/* FIRST */
|
||||
if (labelPaperPosition.indexOf(i.toString()) !== -1) {
|
||||
/* FIRST */
|
||||
|
||||
const backgroundImage = document.createElement("div");
|
||||
backgroundImage.className = "background-image";
|
||||
const backgroundImage = document.createElement("div");
|
||||
backgroundImage.className = "background-image";
|
||||
|
||||
const content = document.createElement("div");
|
||||
content.className = "content";
|
||||
const content = document.createElement("div");
|
||||
content.className = "content";
|
||||
|
||||
const productName = PRODUCT_NAME.split(" ");
|
||||
const productName = PRODUCT_NAME.split(" ");
|
||||
|
||||
const productNameFirst = document.createElement("h1");
|
||||
productNameFirst.innerHTML = productName[0];
|
||||
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 productNameRemainingPart = document.createElement("h1");
|
||||
productNameRemainingPart.innerHTML = productName.slice(1).join(" ");
|
||||
productNameRemainingPart.style = "margin: 0";
|
||||
|
||||
const productColor = document.createElement("p");
|
||||
productColor.innerHTML = PRODUCT_COLOR;
|
||||
productColor.className = "product-color";
|
||||
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 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 productId = document.createElement("p");
|
||||
productId.innerHTML = PRODUCT_ID;
|
||||
productId.className = "product-id";
|
||||
|
||||
content.appendChild(productNameFirst);
|
||||
content.appendChild(productNameRemainingPart);
|
||||
content.appendChild(productColor);
|
||||
content.appendChild(productColorCharacteristics);
|
||||
content.appendChild(productId);
|
||||
content.appendChild(productNameFirst);
|
||||
content.appendChild(productNameRemainingPart);
|
||||
content.appendChild(productColor);
|
||||
content.appendChild(productColorCharacteristics);
|
||||
content.appendChild(productId);
|
||||
|
||||
/* container */
|
||||
/* container */
|
||||
|
||||
const container = document.createElement("div");
|
||||
container.className = "container";
|
||||
const container = document.createElement("div");
|
||||
container.className = "container";
|
||||
|
||||
const childrenImg = document.createElement("img");
|
||||
childrenImg.src = "../../groupsData/shx-product-label/children.png";
|
||||
childrenImg.alt = "children";
|
||||
childrenImg.className = "children";
|
||||
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 manufacturerInfo = document.createElement("div");
|
||||
manufacturerInfo.className = "manufacturer-info";
|
||||
|
||||
const manufacturer = document.createElement("p");
|
||||
manufacturer.innerHTML = "Hersteller:";
|
||||
const manufacturer = document.createElement("p");
|
||||
manufacturer.innerHTML = "Hersteller:";
|
||||
|
||||
const manufacturer2 = document.createElement("p");
|
||||
manufacturer2.innerHTML = "Jan Umbach";
|
||||
const manufacturer2 = document.createElement("p");
|
||||
manufacturer2.innerHTML = "Jan Umbach";
|
||||
|
||||
const manufacturer3 = document.createElement("p");
|
||||
manufacturer3.innerHTML = "Klosterstraße 10";
|
||||
const manufacturer3 = document.createElement("p");
|
||||
manufacturer3.innerHTML = "Klosterstraße 10";
|
||||
|
||||
const manufacturer4 = document.createElement("p");
|
||||
manufacturer4.innerHTML = "D-34286 Spangenberg";
|
||||
const manufacturer4 = document.createElement("p");
|
||||
manufacturer4.innerHTML = "D-34286 Spangenberg";
|
||||
|
||||
manufacturerInfo.appendChild(manufacturer);
|
||||
manufacturerInfo.appendChild(manufacturer2);
|
||||
manufacturerInfo.appendChild(manufacturer3);
|
||||
manufacturerInfo.appendChild(manufacturer4);
|
||||
manufacturerInfo.appendChild(manufacturer);
|
||||
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";
|
||||
const ceImg = document.createElement("img");
|
||||
ceImg.src = "../../groupsData/shx-product-label/ce.svg";
|
||||
ceImg.alt = "ce";
|
||||
ceImg.className = "ce";
|
||||
|
||||
container.appendChild(childrenImg);
|
||||
container.appendChild(manufacturerInfo);
|
||||
container.appendChild(ceImg);
|
||||
container.appendChild(childrenImg);
|
||||
container.appendChild(manufacturerInfo);
|
||||
container.appendChild(ceImg);
|
||||
|
||||
content.appendChild(container);
|
||||
content.appendChild(container);
|
||||
|
||||
label.appendChild(backgroundImage);
|
||||
label.appendChild(content);
|
||||
label.appendChild(backgroundImage);
|
||||
label.appendChild(content);
|
||||
}
|
||||
|
||||
labels.appendChild(label);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,11 @@
|
|||
"repeatPossible": true,
|
||||
"scriptPath": "script.py",
|
||||
"parameters": [
|
||||
{
|
||||
"parameterName": "label_paper_position",
|
||||
"type": "text",
|
||||
"displayName": "Position auf dem A4 Blatt (Beginnend mit 1 von oben links) (Mit Komma trennbar wie z. B. 1,3,7)"
|
||||
},
|
||||
{
|
||||
"parameterName": "product_type_id",
|
||||
"type": "select",
|
||||
|
|
|
@ -9,12 +9,14 @@ from libs.utils import utils
|
|||
|
||||
json_object = json.loads(sys.argv[1])
|
||||
product_type_id = json_object["product_type_id"]
|
||||
label_paper_position = json_object["label_paper_position"]
|
||||
|
||||
if product_type_id is None:
|
||||
if product_type_id is None or label_paper_position is None:
|
||||
print("Missing required parameters")
|
||||
sys.exit(1)
|
||||
|
||||
product_type_id = product_type_id["value"]
|
||||
label_paper_position = label_paper_position["value"]
|
||||
|
||||
|
||||
product_type_ids = {}
|
||||
|
@ -30,7 +32,7 @@ def add_product_type_id(product_type_id, product_name, product_color, product_co
|
|||
with open("../../groups/shx-product-label/index.json", "r") as file:
|
||||
content = json.load(file)
|
||||
|
||||
products = content["tasks"][0]["parameters"][0]["options"]
|
||||
products = content["tasks"][0]["parameters"][1]["options"]
|
||||
|
||||
for product in products:
|
||||
data = product.split("; ")
|
||||
|
@ -80,6 +82,7 @@ if __name__ == "__main__":
|
|||
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"])
|
||||
indexjs = indexjs.replace("{{LABEL_PAPER_POSITION}}", label_paper_position)
|
||||
|
||||
with open("index.js", "w") as file:
|
||||
file.write(indexjs)
|
||||
|
|
Loading…
Reference in New Issue