This commit is contained in:
Diamantis Tziotzios 2024-01-09 09:42:58 +02:00
parent 6bd3302788
commit 536ba9b900
9 changed files with 72 additions and 53 deletions

View File

@ -1422,7 +1422,7 @@ public class DataManagementPlanManager {
for (Researcher researcher : dmpEntity.getResearchers()) { for (Researcher researcher : dmpEntity.getResearchers()) {
XWPFRun runResearcher = systemFieldParagraph.createRun(); XWPFRun runResearcher = systemFieldParagraph.createRun();
runResearcher.addBreak(); runResearcher.addBreak();
runResearcher.setText("" + researcher.getLabel()); runResearcher.setText(researcher.getLabel());
runResearcher.setColor("116a78"); runResearcher.setColor("116a78");
} }
break; break;
@ -1430,7 +1430,7 @@ public class DataManagementPlanManager {
for (Organisation organisation : dmpEntity.getOrganisations()) { for (Organisation organisation : dmpEntity.getOrganisations()) {
XWPFRun runOrganisation = systemFieldParagraph.createRun(); XWPFRun runOrganisation = systemFieldParagraph.createRun();
runOrganisation.addBreak(); runOrganisation.addBreak();
runOrganisation.setText("" + organisation.getLabel()); runOrganisation.setText(organisation.getLabel());
runOrganisation.setColor("116a78"); runOrganisation.setColor("116a78");
} }
break; break;
@ -1581,6 +1581,12 @@ public class DataManagementPlanManager {
//runDatasetTitle.setBold(true); //runDatasetTitle.setBold(true);
//runDatasetTitle.setFontSize(12); //runDatasetTitle.setFontSize(12);
XWPFParagraph descriptionParagraph = document.createParagraph();
XWPFRun descriptionParagraphRun = descriptionParagraph.createRun();
descriptionParagraphRun.setText("Description: ");
descriptionParagraphRun.setColor("000000");
wordBuilder.addParagraphContent(datasetEntity.getDescription(), document, ParagraphStyle.HTML, BigInteger.ZERO, 0);
XWPFParagraph datasetTemplateParagraph = document.createParagraph(); XWPFParagraph datasetTemplateParagraph = document.createParagraph();
// datasetTemplateParagraph.setStyle("Heading3"); // datasetTemplateParagraph.setStyle("Heading3");
XWPFRun runDatasetTemplate1 = datasetTemplateParagraph.createRun(); XWPFRun runDatasetTemplate1 = datasetTemplateParagraph.createRun();

View File

@ -5,15 +5,15 @@ import { ValidationErrorModel } from "@common/forms/validation/error-model/valid
import { ValidationContext } from "@common/forms/validation/validation-context"; import { ValidationContext } from "@common/forms/validation/validation-context";
export class DmpBlueprintEditor { export class DmpBlueprintEditor {
public id: string; public id: string;
public label: string; public label: string;
public definition: DmpBlueprintDefinitionEditor = new DmpBlueprintDefinitionEditor(); public definition: DmpBlueprintDefinitionEditor = new DmpBlueprintDefinitionEditor();
public status: number; public status: number;
public created: Date; public created: Date;
public modified: Date; public modified: Date;
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel(); public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
fromModel(item: DmpBlueprint): DmpBlueprintEditor { fromModel(item: DmpBlueprint): DmpBlueprintEditor {
this.id = item.id; this.id = item.id;
this.label = item.label; this.label = item.label;
this.definition = new DmpBlueprintDefinitionEditor().fromModel(item.definition); this.definition = new DmpBlueprintDefinitionEditor().fromModel(item.definition);
@ -51,9 +51,9 @@ export class DmpBlueprintEditor {
export class DmpBlueprintDefinitionEditor { export class DmpBlueprintDefinitionEditor {
public sections: SectionDmpBlueprintEditor[] = new Array<SectionDmpBlueprintEditor>(); public sections: SectionDmpBlueprintEditor[] = new Array<SectionDmpBlueprintEditor>();
fromModel(item: DmpBlueprintDefinition): DmpBlueprintDefinitionEditor { fromModel(item: DmpBlueprintDefinition): DmpBlueprintDefinitionEditor {
if (item.sections) { item.sections.map(x => this.sections.push(new SectionDmpBlueprintEditor().fromModel(x))); } if (item.sections) { item.sections.map(x => this.sections.push(new SectionDmpBlueprintEditor().fromModel(x))); }
return this; return this;
} }
@ -62,7 +62,7 @@ export class DmpBlueprintDefinitionEditor {
const formBuilder = new FormBuilder(); const formBuilder = new FormBuilder();
const formGroup = formBuilder.group({}); const formGroup = formBuilder.group({});
const sectionsFormArray = new Array<FormGroup>(); const sectionsFormArray = new Array<FormGroup>();
this.sections.forEach(item => { this.sections.sort((a, b) => a.ordinal - b.ordinal).forEach(item => {
const form: FormGroup = item.buildForm(); const form: FormGroup = item.buildForm();
sectionsFormArray.push(form); sectionsFormArray.push(form);
}); });
@ -72,23 +72,23 @@ export class DmpBlueprintDefinitionEditor {
} }
export class SectionDmpBlueprintEditor { export class SectionDmpBlueprintEditor {
public id: string; public id: string;
public label: string; public label: string;
public description: string; public description: string;
public ordinal: number; public ordinal: number;
public fields: FieldInSectionEditor[] = new Array<FieldInSectionEditor>(); public fields: FieldInSectionEditor[] = new Array<FieldInSectionEditor>();
public hasTemplates: boolean; public hasTemplates: boolean;
public descriptionTemplates: DescriptionTemplatesInSectionEditor[] = new Array<DescriptionTemplatesInSectionEditor>(); public descriptionTemplates: DescriptionTemplatesInSectionEditor[] = new Array<DescriptionTemplatesInSectionEditor>();
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel(); public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
fromModel(item: SectionDmpBlueprint): SectionDmpBlueprintEditor { fromModel(item: SectionDmpBlueprint): SectionDmpBlueprintEditor {
this.id = item.id; this.id = item.id;
this.label = item.label; this.label = item.label;
this.description = item.description; this.description = item.description;
this.ordinal = item.ordinal; this.ordinal = item.ordinal;
if (item.fields) { item.fields.map(x => this.fields.push(new FieldInSectionEditor().fromModel(x))); } if (item.fields) { item.fields.map(x => this.fields.push(new FieldInSectionEditor().fromModel(x))); }
this.hasTemplates = item.hasTemplates; this.hasTemplates = item.hasTemplates;
if (item.descriptionTemplates) { item.descriptionTemplates.map(x => this.descriptionTemplates.push(new DescriptionTemplatesInSectionEditor().fromModel(x))); } if (item.descriptionTemplates) { item.descriptionTemplates.map(x => this.descriptionTemplates.push(new DescriptionTemplatesInSectionEditor().fromModel(x))); }
return this; return this;
} }
@ -101,14 +101,14 @@ export class SectionDmpBlueprintEditor {
ordinal: [{ value: this.ordinal, disabled: disabled }, context.getValidation('ordinal')], ordinal: [{ value: this.ordinal, disabled: disabled }, context.getValidation('ordinal')],
hasTemplates: [{ value: this.hasTemplates, disabled: disabled }, context.getValidation('hasTemplates')] hasTemplates: [{ value: this.hasTemplates, disabled: disabled }, context.getValidation('hasTemplates')]
}); });
const formBuilder = new FormBuilder(); const formBuilder = new FormBuilder();
const fieldsFormArray = new Array<FormGroup>(); const fieldsFormArray = new Array<FormGroup>();
this.fields.forEach(item => { this.fields.sort((a, b) => a.ordinal - b.ordinal).forEach(item => {
const form: FormGroup = item.buildForm(); const form: FormGroup = item.buildForm();
fieldsFormArray.push(form); fieldsFormArray.push(form);
}); });
formGroup.addControl('fields', formBuilder.array(fieldsFormArray)); formGroup.addControl('fields', formBuilder.array(fieldsFormArray));
const descriptionTemplatesFormArray = new Array<FormGroup>(); const descriptionTemplatesFormArray = new Array<FormGroup>();
this.descriptionTemplates.forEach(item => { this.descriptionTemplates.forEach(item => {
const form: FormGroup = item.buildForm(); const form: FormGroup = item.buildForm();
descriptionTemplatesFormArray.push(form); descriptionTemplatesFormArray.push(form);
@ -130,25 +130,25 @@ export class SectionDmpBlueprintEditor {
} }
export class FieldInSectionEditor { export class FieldInSectionEditor {
public id: string; public id: string;
public category: FieldCategory; public category: FieldCategory;
public type: number; public type: number;
public label: string; public label: string;
public placeholder: string; public placeholder: string;
public description: string; public description: string;
public required: boolean; public required: boolean;
public ordinal: number; public ordinal: number;
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel(); public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
fromModel(item: FieldInSection): FieldInSectionEditor { fromModel(item: FieldInSection): FieldInSectionEditor {
this.id = item.id; this.id = item.id;
this.category = item.category; this.category = item.category;
this.type = item.type; this.type = item.type;
this.label = item.label; this.label = item.label;
this.placeholder = item.placeholder; this.placeholder = item.placeholder;
this.description = item.description; this.description = item.description;
this.required = item.required; this.required = item.required;
this.ordinal = item.ordinal; this.ordinal = item.ordinal;
return this; return this;
} }
@ -182,19 +182,19 @@ export class FieldInSectionEditor {
} }
export class DescriptionTemplatesInSectionEditor { export class DescriptionTemplatesInSectionEditor {
public id: string; public id: string;
public descriptionTemplateId: string; public descriptionTemplateId: string;
public label: string; public label: string;
public minMultiplicity: number; public minMultiplicity: number;
public maxMultiplicity: number; public maxMultiplicity: number;
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel(); public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
fromModel(item: DescriptionTemplatesInSection): DescriptionTemplatesInSectionEditor { fromModel(item: DescriptionTemplatesInSection): DescriptionTemplatesInSectionEditor {
this.id = item.id; this.id = item.id;
this.descriptionTemplateId = item.descriptionTemplateId; this.descriptionTemplateId = item.descriptionTemplateId;
this.label = item.label; this.label = item.label;
this.minMultiplicity = item.minMultiplicity; this.minMultiplicity = item.minMultiplicity;
this.maxMultiplicity = item.maxMultiplicity; this.maxMultiplicity = item.maxMultiplicity;
return this; return this;
} }
@ -253,4 +253,4 @@ export class DescriptionTemplatesInSectionEditor {
// }); // });
// return formGroup; // return formGroup;
// } // }
// } // }

View File

@ -249,6 +249,9 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
removeField(sectionIndex: number, fieldIndex: number): void { removeField(sectionIndex: number, fieldIndex: number): void {
this.fieldsArray(sectionIndex).removeAt(fieldIndex); this.fieldsArray(sectionIndex).removeAt(fieldIndex);
this.fieldsArray(sectionIndex).controls.forEach((field, index) => {
field.get('ordinal').setValue(index + 1);
});
} }
systemFieldsArray(sectionIndex: number): FormArray { systemFieldsArray(sectionIndex: number): FormArray {
@ -366,6 +369,9 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
drop(event: CdkDragDrop<string[]>, sectionIndex: number) { drop(event: CdkDragDrop<string[]>, sectionIndex: number) {
moveItemInArray(this.fieldsArray(sectionIndex).controls, event.previousIndex, event.currentIndex); moveItemInArray(this.fieldsArray(sectionIndex).controls, event.previousIndex, event.currentIndex);
moveItemInArray(this.fieldsArray(sectionIndex).value, event.previousIndex, event.currentIndex); moveItemInArray(this.fieldsArray(sectionIndex).value, event.previousIndex, event.currentIndex);
this.fieldsArray(sectionIndex).controls.forEach((field, index) => {
field.get('ordinal').setValue(index + 1);
});
} }
dropSections(event: CdkDragDrop<string[]>) { dropSections(event: CdkDragDrop<string[]>) {

View File

@ -84,7 +84,7 @@
<div class="col-auto formForStep0" id="editor-form" *ngIf="this.step === 0 && this.isNew"> <div class="col-auto formForStep0" id="editor-form" *ngIf="this.step === 0 && this.isNew">
<div class="col-12 blueprint-section" [hidden]="this.step !== 0"> <div class="col-12 blueprint-section" [hidden]="this.step !== 0">
<div class=""> <div class="">
<div class="heading2">0.1 Title of DMP *</div> <div class="heading2">Title of DMP *</div>
<mat-form-field> <mat-form-field>
<mat-label>Title</mat-label> <mat-label>Title</mat-label>
<input matInput type="text" name="label" [formControl]="formGroup.get('label')" required> <input matInput type="text" name="label" [formControl]="formGroup.get('label')" required>
@ -95,13 +95,13 @@
</mat-form-field> </mat-form-field>
</div> </div>
<div class=""> <div class="">
<div class="heading2">0.2 Description of DMP *</div> <div class="heading2">Description of DMP *</div>
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" <rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'"
[placeholder]="'Fill with description'" [required]="true"> [placeholder]="'Fill with description'" [required]="true">
</rich-text-editor-component> </rich-text-editor-component>
</div> </div>
<div class="" style="margin-top: 3%;"> <div class="" style="margin-top: 3%;">
<div class="heading2">0.3 Blueprint of DMP *</div> <div class="heading2">Blueprint of DMP *</div>
<mat-form-field> <mat-form-field>
<mat-label>Select blueprint</mat-label> <mat-label>Select blueprint</mat-label>
<app-single-auto-complete [required]="false" [formControl]="formGroup.get('profile')" placeholder="Select blueprint" [configuration]="dmpBlueprintAutoCompleteConfiguration"> <app-single-auto-complete [required]="false" [formControl]="formGroup.get('profile')" placeholder="Select blueprint" [configuration]="dmpBlueprintAutoCompleteConfiguration">

View File

@ -425,5 +425,13 @@ a:hover {
::ng-deep .input-form .mat-form-field-appearance-outline .mat-form-field-infix { ::ng-deep .input-form .mat-form-field-appearance-outline .mat-form-field-infix {
font-size: 1rem; font-size: 1rem;
padding: 0.6em 0 1em 0 !important; // padding: 0.6em 0 1em 0 !important;
} }
::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix {
padding: 1em 0 1em 0 !important;
}
// ::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix {
// padding: 0rem 0rem 0.4rem 0rem !important;
// }

View File

@ -332,7 +332,7 @@
vertical-align: bottom; vertical-align: bottom;
} }
::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix { :host ::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix {
padding: 0rem 0rem 0.4rem 0rem !important; padding: 0rem 0rem 0.4rem 0rem !important;
} }

View File

@ -318,7 +318,7 @@
"DATASET-TEMPLATE-REMOVE-USER": "Remove Editor", "DATASET-TEMPLATE-REMOVE-USER": "Remove Editor",
"DATASET-TEMPLATE-NO-USERS-YET": "... No editors yet", "DATASET-TEMPLATE-NO-USERS-YET": "... No editors yet",
"DATASET-TEMPLATE-VALIDATE-AND-ADD-USER": "Validate and Add Editor", "DATASET-TEMPLATE-VALIDATE-AND-ADD-USER": "Validate and Add Editor",
"DATASET-TEMPLATE-DESCRIPTION-PLACEHOLDER": "Dataset template description", "DATASET-TEMPLATE-DESCRIPTION-PLACEHOLDER": "Template description",
"UNTITLED": "Untitled", "UNTITLED": "Untitled",
"QUESTION": "Question", "QUESTION": "Question",
"TEMPLATE-OUTLINE": "Template outline", "TEMPLATE-OUTLINE": "Template outline",
@ -1159,7 +1159,7 @@
"DATASET-SELECTION": "Dataset selection", "DATASET-SELECTION": "Dataset selection",
"DESCRIPTION-INFO": "Description info", "DESCRIPTION-INFO": "Description info",
"LICENSE-INFO": "License", "LICENSE-INFO": "License",
"DATASET": "Dataset", "DATASET": "Description",
"PREVIOUS": "Previous", "PREVIOUS": "Previous",
"NEXT": "Next" "NEXT": "Next"
}, },

View File

@ -1,6 +1,5 @@
[ [
"DatasetProfileEditorModel.description", "DatasetProfileEditorModel.description",
"DatasetProfileEditorModel.type",
"DatasetProfileEditorModel.label", "DatasetProfileEditorModel.label",
"SectionEditorModel.title", "SectionEditorModel.title",
"SectionEditorModel.description", "SectionEditorModel.description",