This commit is contained in:
Nikolaos Laskaris 2017-11-20 12:29:42 +02:00
parent 4d809859c8
commit 8b5704b320
3 changed files with 12 additions and 5 deletions

Binary file not shown.

View File

@ -55,9 +55,11 @@
<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">
<strong>Saved the following values</strong><br>{{payLoad}}
</div>
-->
<!--
<p>Form value: {{ form.value | json }}</p>

View File

@ -15,6 +15,8 @@ import { TokenService, TokenProvider } from '../services/login/token.service';
import { ModalComponent } from '../modal/modal.component';
import { AutocompleteRemoteComponent } from './fields/autocomplete-remote/autocomplete-remote.component';
import {Location} from '@angular/common';
import { AngularDraggableModule } from 'angular2-draggable';
import {MenuItem} from 'primeng/primeng';
@ -67,7 +69,7 @@ export class DynamicFormComponent implements OnInit {
constructor(private qcs: FieldControlService, private serverService: ServerService, private dataModelService: dataModelBuilder, private router: Router,
private route: ActivatedRoute, private pagerService: PaginationService, private tokenService: TokenService) {
private _location: Location, private route: ActivatedRoute, private pagerService: PaginationService, private tokenService: TokenService) {
this.form = this.qcs.toFormGroup(new Array(), new Array());
this.xml2jsonOBJ = new X2JS();
}
@ -224,13 +226,13 @@ export class DynamicFormComponent implements OnInit {
}
ngAfterViewChecked(): void { //navigate to certain section of the page
try {
document.querySelector('#' + this.fragment).scrollIntoView();
} catch (e) { }
}
submitForm(final){
debugger;
this.serverService.getDatasetByID(this.datasetId).subscribe(
(data) => {
if (final) data.status = 2;
@ -242,9 +244,12 @@ export class DynamicFormComponent implements OnInit {
this.serverService.setDataset(data).subscribe(
(data) => {
console.log("Updated dataset");
//simple_notifier("success",null,"Saved form progress");
this.router.navigate(['/welcome'], { queryParams: { /*returnUrl: this.state.url*/ }});
simple_notifier("success",null,"Saved form progress");
if (final)
this._location.back();
//this.router.navigate(['/welcome'], { queryParams: { /*returnUrl: this.state.url*/ }});
},
(err) => {
simple_notifier("danger",null,"Could not save form progress");