new statuses, dmp change status after checking the datasets status, datatype in dataModelBuilder
This commit is contained in:
parent
fd6dc2c936
commit
37573cb729
|
@ -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"}]
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="status-name" class="col-form-label">Status:</label>
|
||||
<select class="form-control" id="statusid" [(ngModel)]="dmp.status" name="statusDropDown">
|
||||
<select class="form-control" id="statusid" [(ngModel)]="dmp.status" name="statusDropDown" (change)="SelectDMPStatus(dmp, $event, oldValue);">
|
||||
<option *ngFor="let opt of statusDropDown.options" [value]="opt.key">{{opt.value}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
@ -197,6 +197,25 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal" tabindex="-1" id="messageForChangingStatus" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Change Staus</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>The submitted status is available only when all the DMP's datasets are "Submitted" or "Cancel"</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--Modal for DMPs-->
|
||||
<!-- <modal *ngIf="item && show" [(show)]="show" [item]="item" [(dataSetVisibe)]="dataSetVisibe"></modal> -->
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
</div> -->
|
||||
|
||||
<div>
|
||||
<button type="submit" class="btn btn-default btncustom" [disabled]="!form.valid">Save</button>
|
||||
<button type="button" class="btn btn-default btncustom" [disabled]="!form.valid" data-toggle="modal" data-target="#confirmModal">Finalize</button>
|
||||
<button type="submit" class="btn btn-default btncustom" [disabled]="!form.valid || finalizeStatus">Save</button>
|
||||
<button type="button" class="btn btn-default btncustom" [disabled]="!form.valid || finalizeStatus" data-toggle="modal" data-target="#confirmModal">Finalize</button>
|
||||
</div>
|
||||
|
||||
<div *ngIf="payLoad" class="form-row">
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -15,6 +15,7 @@ export class FieldBase<T>{
|
|||
attributes: Attribute;
|
||||
regex:string;
|
||||
url: string;
|
||||
datatype: string;
|
||||
|
||||
constructor(options: {
|
||||
value?: T,
|
||||
|
@ -29,7 +30,8 @@ export class FieldBase<T>{
|
|||
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<T>{
|
|||
this.attributes = options.attributes || new Attribute();
|
||||
this.regex = options.regex || '';
|
||||
this.url = options.url || "";
|
||||
this.datatype = options.datatype || "";
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 => {
|
||||
|
|
Loading…
Reference in New Issue