diff --git a/client/public/style.css b/client/public/style.css
index 5772a61d..2b21cb9d 100644
--- a/client/public/style.css
+++ b/client/public/style.css
@@ -136,3 +136,11 @@ ul.sideMenu > li > ul > li > ul > li > div {
/* margin-top: 24px;*/
/*}*/
+/* Otherwise, the drop-down lists look as if they are disabled */
+.ant-select-selector > .ant-select-selection-placeholder {
+ color: rgba(0, 0, 0, 0.88);
+}
+
+.disable-link{
+ pointer-events: none;
+}
diff --git a/client/src/components/header/SiteHeader.tsx b/client/src/components/header/SiteHeader.tsx
index 1650e0b7..cf7d533b 100644
--- a/client/src/components/header/SiteHeader.tsx
+++ b/client/src/components/header/SiteHeader.tsx
@@ -8,37 +8,6 @@ import { LinkWithQuery } from '../LinkWithQuery';
const { Header } = Layout;
-const items: MenuProps['items'] = [
- {
- label: Tailoring,
- // Tailoring,
- key: 'tailoring',
- icon: ,
- },
- {
- label: Dokumentation,
- // label: Dokumentation,
- key: 'dokumentation',
- icon: ,
- },
- {
- label: Produktvorlagen,
- // label: Produktvorlagen,
- key: 'productTemplates',
- icon: ,
- },
- {
- label: (
- Info
- //
- // Home
- //
- ),
- key: 'info',
- icon: ,
- },
-];
-
//
//
// Home
@@ -59,13 +28,55 @@ const items: MenuProps['items'] = [
export const SiteHeader = (props: any) => {
const { tailoringParameter } = useTailoring();
- // const navigate = useNavigate();
-
- // const handleMenuClick = ({ key: string }) => {
- // if (key) {
- // navigate(key);
- // }
- // };
+ const items: MenuProps['items'] = [
+ {
+ label: Tailoring,
+ key: 'tailoring',
+ icon: ,
+ },
+ {
+ label: (
+
+ Dokumentation
+
+ ),
+ key: 'dokumentation',
+ icon: ,
+ disabled: !tailoringParameter.projectTypeId,
+ },
+ {
+ label: (
+
+ Produktvorlagen
+
+ ),
+ key: 'productTemplates',
+ icon: ,
+ disabled: !tailoringParameter.projectTypeId,
+ },
+ {
+ label: (
+
+ Info
+
+ ),
+ key: 'info',
+ icon: ,
+ disabled: !tailoringParameter.modelVariantId,
+ },
+ ];
const { error, image } = useImage(tailoringParameter.modelVariantId + '/ALLG-Logo-Farbe.gif');
diff --git a/client/src/components/projekthandbuch/documentation/content/Content.tsx b/client/src/components/projekthandbuch/documentation/content/Content.tsx
index 190b034b..f282fae6 100644
--- a/client/src/components/projekthandbuch/documentation/content/Content.tsx
+++ b/client/src/components/projekthandbuch/documentation/content/Content.tsx
@@ -11,6 +11,7 @@ import {
fixLinksInText,
flatten,
getJsonDataFromXml,
+ getMenuItemByAttributeValue,
getSearchStringFromHash,
replaceUrlInText,
} from '../../../../shares/utils';
@@ -1949,10 +1950,13 @@ export function Content() {
);
};
+ const disciplineMenuEntry = getMenuItemByAttributeValue(navigationData, 'key', disciplineId);
+ const headerLabel = disciplineMenuEntry ? disciplineMenuEntry.label : '';
+
return {
id: 'externalTemplateContent', //jsonDataFromXml.attributes.id,
// menuEntryId: jsonDataFromXml.attributes.id,
- header: 'Disziplin', //jsonDataFromXml.attributes.name,
+ header: headerLabel, //jsonDataFromXml.attributes.name,
descriptionText: '',
tableEntries: [],
dataSource: data,
diff --git a/client/src/components/projekthandbuch/documentation/navigation/Navigation.tsx b/client/src/components/projekthandbuch/documentation/navigation/Navigation.tsx
index ba2fb2dd..1df2c6ad 100644
--- a/client/src/components/projekthandbuch/documentation/navigation/Navigation.tsx
+++ b/client/src/components/projekthandbuch/documentation/navigation/Navigation.tsx
@@ -794,16 +794,18 @@ export function Navigation() {
jsonDataFromXml.getElementsByTagName('ExterneKopiervorlage').map((externalMasterTemplate) => {
const productRef = externalMasterTemplate.getElementsByTagName('ProduktRef')[0];
- const productToDisciplineEntryKey = productToDisciplineMap.get(productRef.attributes.id)!.key;
-
- if (!disciplineEntriesMap.get(productToDisciplineEntryKey)) {
- disciplineEntriesMap.set(productToDisciplineEntryKey, {
- key: 'td_' + productToDisciplineEntryKey, // TODO: check !
- parent: target,
- label: productToDisciplineMap.get(productRef.attributes.id)!.title, // TODO: check !
- dataType: NavTypeEnum.TEMPLATE_DISCIPLINE,
- onClick: (item: any) => handleSelectedItem(item.key),
- });
+ if (productRef.attributes.id) {
+ const productToDisciplineEntryKey = productToDisciplineMap.get(productRef.attributes.id)!.key;
+
+ if (!disciplineEntriesMap.get(productToDisciplineEntryKey)) {
+ disciplineEntriesMap.set(productToDisciplineEntryKey, {
+ key: 'td_' + productToDisciplineEntryKey, // TODO: check !
+ parent: target,
+ label: productToDisciplineMap.get(productRef.attributes.id)!.title, // TODO: check !
+ dataType: NavTypeEnum.TEMPLATE_DISCIPLINE,
+ onClick: (item: any) => handleSelectedItem(item.key),
+ });
+ }
}
});
diff --git a/client/src/components/projekthandbuch/produktvorlagen/SubmitArea.tsx b/client/src/components/projekthandbuch/produktvorlagen/SubmitArea.tsx
index 86889dd9..66912832 100644
--- a/client/src/components/projekthandbuch/produktvorlagen/SubmitArea.tsx
+++ b/client/src/components/projekthandbuch/produktvorlagen/SubmitArea.tsx
@@ -59,6 +59,7 @@ export function SubmitArea() {
if (product) {
productOfProjectMap.set(product.product.id, {
productName: product.product.title,
+ disciplineName: product.discipline.title,
responsible: '',
participants: [],
chapters: getChaptersData(product.topics),
diff --git a/server/src/main/java/online/projektassistent/server/model/ProductOfProject.java b/server/src/main/java/online/projektassistent/server/model/ProductOfProject.java
index 72daf97b..2f5099e2 100644
--- a/server/src/main/java/online/projektassistent/server/model/ProductOfProject.java
+++ b/server/src/main/java/online/projektassistent/server/model/ProductOfProject.java
@@ -1,10 +1,9 @@
package online.projektassistent.server.model;
-import java.util.List;
-import java.util.Objects;
-
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
+import java.util.List;
+import java.util.Objects;
@SuppressWarnings("unused")
public class ProductOfProject {
@@ -12,6 +11,8 @@ public class ProductOfProject {
@NotBlank(message = "productName is mandatory")
private String productName;
+ private String disciplineName;
+
@NotBlank(message = "responsible is mandatory")
private String responsible;
@@ -24,6 +25,10 @@ public String getProductName() {
return productName;
}
+ public String getDisciplineName() {
+ return disciplineName;
+ }
+
public String getResponsible() {
return responsible;
}
diff --git a/server/src/main/java/online/projektassistent/server/model/SingleProduct.java b/server/src/main/java/online/projektassistent/server/model/SingleProduct.java
index 6338f65e..901447c2 100644
--- a/server/src/main/java/online/projektassistent/server/model/SingleProduct.java
+++ b/server/src/main/java/online/projektassistent/server/model/SingleProduct.java
@@ -1,10 +1,9 @@
package online.projektassistent.server.model;
-import java.util.List;
-import java.util.Objects;
-
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
+import java.util.List;
+import java.util.Objects;
@SuppressWarnings("unused")
public class SingleProduct {
@@ -12,6 +11,8 @@ public class SingleProduct {
@NotBlank(message = "productName is mandatory")
private String productName;
+ private String disciplineName;
+
@NotBlank(message = "responsible is mandatory")
private String responsible;
@@ -26,6 +27,10 @@ public String getProductName() {
return productName;
}
+ public String getDisciplineName() {
+ return disciplineName;
+ }
+
public String getResponsible() {
return responsible;
}
diff --git a/server/src/main/java/online/projektassistent/server/util/ProductBuilder.java b/server/src/main/java/online/projektassistent/server/util/ProductBuilder.java
index 99ef4679..5d21f153 100644
--- a/server/src/main/java/online/projektassistent/server/util/ProductBuilder.java
+++ b/server/src/main/java/online/projektassistent/server/util/ProductBuilder.java
@@ -36,10 +36,10 @@ public class ProductBuilder implements Placeholders {
private final Logger logger = LoggerFactory.getLogger(ProductBuilder.class);
/**
- * Creates a single product and returns a byte array in doxc format
+ * Creates a single product and returns a byte array in docx format
*
* @param singleProduct container for all parameters
- * @return bytes in doxc format
+ * @return bytes in docx format
*/
public byte[] createSingleProduct(SingleProduct singleProduct) throws IOException {
Map dataParams = new HashMap<>();
@@ -84,7 +84,7 @@ public Path createMultipleProducts(MultiProducts multiProducts) throws IOExcepti
}
/**
- * Creates multiple doxc files in temp directory
+ * Creates multiple docx files in temp directory
*
* @param products list of product parameters
* @param dataParams map with project parameters
@@ -109,7 +109,13 @@ private Map createProductTempFiles(List products
template.write(out);
Files.write(tempFile, out.toByteArray());
}
- productsMap.put(FileUtil.sanitizeFilename(product.getProductName()) + ".docx", tempFile);
+
+ String sanitizedDirectory = product.getDisciplineName();
+ String sanitizedFilename = FileUtil.sanitizeFilename(product.getProductName());
+
+ String filename = sanitizedDirectory != null ? sanitizedDirectory + "/" + sanitizedFilename : sanitizedFilename;
+
+ productsMap.put(filename + ".docx", tempFile);
} catch (InvalidFormatException e) {
throw new RuntimeException(e);
}