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> <button type="button" class="btn btn-default btncustom" [disabled]="!form.valid || finalizeStatus" data-toggle="modal" data-target="#confirmModal">Finalize</button>
</div> </div>
<!--
<div *ngIf="payLoad" class="form-row"> <div *ngIf="payLoad" class="form-row">
<strong>Saved the following values</strong><br>{{payLoad}} <strong>Saved the following values</strong><br>{{payLoad}}
</div> </div>
-->
<!-- <!--
<p>Form value: {{ form.value | json }}</p> <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 { ModalComponent } from '../modal/modal.component';
import { AutocompleteRemoteComponent } from './fields/autocomplete-remote/autocomplete-remote.component'; import { AutocompleteRemoteComponent } from './fields/autocomplete-remote/autocomplete-remote.component';
import {Location} from '@angular/common';
import { AngularDraggableModule } from 'angular2-draggable'; import { AngularDraggableModule } from 'angular2-draggable';
import {MenuItem} from 'primeng/primeng'; 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, 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.form = this.qcs.toFormGroup(new Array(), new Array());
this.xml2jsonOBJ = new X2JS(); this.xml2jsonOBJ = new X2JS();
} }
@ -224,13 +226,13 @@ export class DynamicFormComponent implements OnInit {
} }
ngAfterViewChecked(): void { //navigate to certain section of the page ngAfterViewChecked(): void { //navigate to certain section of the page
try { try {
document.querySelector('#' + this.fragment).scrollIntoView(); document.querySelector('#' + this.fragment).scrollIntoView();
} catch (e) { } } catch (e) { }
} }
submitForm(final){ submitForm(final){
debugger;
this.serverService.getDatasetByID(this.datasetId).subscribe( this.serverService.getDatasetByID(this.datasetId).subscribe(
(data) => { (data) => {
if (final) data.status = 2; if (final) data.status = 2;
@ -242,9 +244,12 @@ export class DynamicFormComponent implements OnInit {
this.serverService.setDataset(data).subscribe( this.serverService.setDataset(data).subscribe(
(data) => { (data) => {
console.log("Updated dataset"); console.log("Updated dataset");
//simple_notifier("success",null,"Saved form progress"); simple_notifier("success",null,"Saved form progress");
this.router.navigate(['/welcome'], { queryParams: { /*returnUrl: this.state.url*/ }}); if (final)
this._location.back();
//this.router.navigate(['/welcome'], { queryParams: { /*returnUrl: this.state.url*/ }});
}, },
(err) => { (err) => {
simple_notifier("danger",null,"Could not save form progress"); simple_notifier("danger",null,"Could not save form progress");