diff --git a/dmp-frontend/src/app/datasets/dataset.component.ts b/dmp-frontend/src/app/datasets/dataset.component.ts
index d55e6a17c..1fff01b91 100644
--- a/dmp-frontend/src/app/datasets/dataset.component.ts
+++ b/dmp-frontend/src/app/datasets/dataset.component.ts
@@ -86,7 +86,7 @@ export class DatasetsComponent implements OnInit {
this.datasetProfileDropDown.options = [];
this.saveAndDescribe = false;
this.statusDropDown = new DropdownField();
- this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}]
+ this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}, {key:'2', value:"Submitted"}, {key:'3', value:"Cancel"}]
}
diff --git a/dmp-frontend/src/app/dmps/dmp.component.ts b/dmp-frontend/src/app/dmps/dmp.component.ts
index 5f2cdfe14..7200e7ee9 100644
--- a/dmp-frontend/src/app/dmps/dmp.component.ts
+++ b/dmp-frontend/src/app/dmps/dmp.component.ts
@@ -75,7 +75,7 @@ export class DmpComponent implements OnInit{
this.projectsDropDown = new DropdownField();
this.projectsDropDown.options = [];
this.statusDropDown = new DropdownField();
- this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}]
+ this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}, {key:'2', value:"Submitted"}, {key:'3', value:"Cancel"}]
//this.projects = [];
this.dmpTableVisible = false;
this.dataSetVisibe = false;
@@ -269,12 +269,36 @@ deleteRow(dmp){
}
-clickFilters(element){
-console.log(element);
-if(element.textContent == "More filters")
- element.textContent = "Less Filters";
-else
-element.textContent = "More Filters";
+clickFilters(element){
+ if(element.textContent == "More filters")
+ element.textContent = "Less Filters";
+ else
+ element.textContent = "More Filters";
+ }
+
+SelectDMPStatus(dmp, event, oldValue){
+ console.log(dmp);
+ let cannotChangeStatus:boolean;
+ if(dmp.status == 2){
+ this.serverService.getDatasetForDmp({ "id": dmp.id }).subscribe(
+ response => {
+ response.forEach(dataset => {
+ if(dataset.status !==2 || dataset.status !==3){
+ cannotChangeStatus=true;
+ }
+ return;
+ });
+ if(cannotChangeStatus == true){
+ dmp.status = 0;
+ $("#messageForChangingStatus").modal("show");
+ }
+ },
+ error => {
+ console.log("could not retrieve dataset for dpm: "+dmp.id);
+ }
+ );
+ }
+
}
diff --git a/dmp-frontend/src/app/dmps/dmps.html b/dmp-frontend/src/app/dmps/dmps.html
index 56d272294..dee78a60f 100644
--- a/dmp-frontend/src/app/dmps/dmps.html
+++ b/dmp-frontend/src/app/dmps/dmps.html
@@ -115,7 +115,7 @@
-
@@ -197,6 +197,25 @@
+
+
+
+
+
+
The submitted status is available only when all the DMP's datasets are "Submitted" or "Cancel"
+
+
+
+
+
+
diff --git a/dmp-frontend/src/app/form/dynamic-form.component.html b/dmp-frontend/src/app/form/dynamic-form.component.html
index d61e4e872..f8ae86d96 100644
--- a/dmp-frontend/src/app/form/dynamic-form.component.html
+++ b/dmp-frontend/src/app/form/dynamic-form.component.html
@@ -31,8 +31,8 @@
-->
-
-
+
+
diff --git a/dmp-frontend/src/app/form/dynamic-form.component.ts b/dmp-frontend/src/app/form/dynamic-form.component.ts
index 10b4a52f7..56f581086 100644
--- a/dmp-frontend/src/app/form/dynamic-form.component.ts
+++ b/dmp-frontend/src/app/form/dynamic-form.component.ts
@@ -47,6 +47,7 @@ export class DynamicFormComponent implements OnInit {
@Input() dirtyValues: number = 0;
// pagination object
@Input() pagination: any = {};
+ finalizeStatus:boolean = false;
id: string;
datasetId: string;
//datasetProperties:string;
@@ -71,11 +72,7 @@ export class DynamicFormComponent implements OnInit {
ngOnInit() {
- this.route.fragment.subscribe(fragment => { this.fragment = fragment; }); //navigate to certain section of the page
-
-
- //let id = this.route.snapshot.paramMap.get('id'); //get the project id
-
+ //this.route.fragment.subscribe(fragment => { this.fragment = fragment; }); //navigate to certain section of the page, it doesn't use anymore
let sub = this.route.params.subscribe(params => {
this.id = params.id;
this.datasetId = params.datasetId;
@@ -93,6 +90,7 @@ export class DynamicFormComponent implements OnInit {
formValues = JSON.parse(data.properties);
flatList = flatten(formValues);
//this.patchForm(flatList);
+ if(data.status == 2) this.finalizeStatus=true;
}
//η κληση για το dataset profile pou htan prin pio panw anexarthth
@@ -213,10 +211,10 @@ export class DynamicFormComponent implements OnInit {
} catch (e) { }
}
- submitForm(){
+ submitForm(final){
this.serverService.getDatasetByID(this.datasetId).subscribe(
(data) => {
-
+ if (final) data.status = 2;
//is xml, so transform them to xml (it's json)
//data.properties = this.xml2jsonOBJ.json2xml_str(JSON.stringify(this.form.value));
data.properties = JSON.stringify(this.form.value);
@@ -237,14 +235,16 @@ export class DynamicFormComponent implements OnInit {
}
onSubmit() {
- this.submitForm();
+ let final = false;
+ this.submitForm(false);
this.payLoad = JSON.stringify(this.form.value);
}
SaveFinalize(){
- $("#confirmModal").modal("hide");
- this.submitForm();
+ $("#confirmModal").modal("hide");
+ let final = true;
+ this.submitForm(final);
}
shouldIShow(element) { //pagination , pages are declared in xml for every groupfield
diff --git a/dmp-frontend/src/app/form/fields/field-base.ts b/dmp-frontend/src/app/form/fields/field-base.ts
index 316321ed1..3b4e8aa5e 100644
--- a/dmp-frontend/src/app/form/fields/field-base.ts
+++ b/dmp-frontend/src/app/form/fields/field-base.ts
@@ -15,6 +15,7 @@ export class FieldBase{
attributes: Attribute;
regex:string;
url: string;
+ datatype: string;
constructor(options: {
value?: T,
@@ -29,7 +30,8 @@ export class FieldBase{
description?: string,
attributes?: Attribute,
regex?:string,
- url?: string
+ url?: string,
+ datatype?:string
} = {}) {
this.value = options.value;
this.key = options.key || '';
@@ -44,5 +46,6 @@ export class FieldBase{
this.attributes = options.attributes || new Attribute();
this.regex = options.regex || '';
this.url = options.url || "";
+ this.datatype = options.datatype || "";
}
}
\ No newline at end of file
diff --git a/dmp-frontend/src/app/pipes/various/status-to-string.ts b/dmp-frontend/src/app/pipes/various/status-to-string.ts
index dda3ed402..18e8b3a67 100644
--- a/dmp-frontend/src/app/pipes/various/status-to-string.ts
+++ b/dmp-frontend/src/app/pipes/various/status-to-string.ts
@@ -17,6 +17,12 @@ export class StatusToString implements PipeTransform {
else if(input == 1) {
return "Inactive";
}
+ else if(input == 2) {
+ return "Submitted";
+ }
+ else if(input == 3) {
+ return "Cancel";
+ }
else {
return input.toString();
}
diff --git a/dmp-frontend/src/app/services/dataModelBuilder.service.ts b/dmp-frontend/src/app/services/dataModelBuilder.service.ts
index 4b4d7b8b3..f6052bd3f 100644
--- a/dmp-frontend/src/app/services/dataModelBuilder.service.ts
+++ b/dmp-frontend/src/app/services/dataModelBuilder.service.ts
@@ -33,6 +33,7 @@ export class dataModelBuilder {
this.dataModel.semanticAttr = new Array(new Attribute);
this.dataModel.semanticAttr = this.getFieldsAttributes(data.definition.root.fields.field, data.ruleset.definition.root.functions.function, this.fields);
this.dataModel.sections = this.getSections(data.viewstyle.definition.root.sections.section, this.dataModel.groups);
+ //this.getDatatypes(data.definition.root);
this.dataModel.buildIndex();
this.checkDuplicateInObject('order', this.dataModel.groups[13].groupFields); //for future use , for composite field
@@ -298,6 +299,17 @@ export class dataModelBuilder {
return sects;
}
+ private getDatatypes(dataTypes){
+ if (dataTypes.datatypes.datatype.id == "compositeField"){
+ dataTypes.datatypes.datatype.fields.forEach(field => {
+ this.dataModel.fields.forEach(fieldinModel=>{
+ if (field.id == fieldinModel.key)
+ fieldinModel.datatype = "compositeField";
+ });
+ });
+ }
+ }
+
checkDuplicateInObject(propertyName, inputArray) {
let DuplicateArray = [];
inputArray.forEach(item => {