name & version field diasabled in new version dmp

This commit is contained in:
annampak 2018-02-28 16:59:41 +02:00
parent 7c6815fef0
commit 1715e8629f
5 changed files with 20 additions and 7 deletions

View File

@ -80,7 +80,7 @@
</button>
</div>
<mat-form-field class="example-full-width">
<mat-form-field class="full-width">
<input matInput placeholder="Version" disabled [value]="formGroup.get('version').value== undefined ?0 :formGroup.get('version').value">
</mat-form-field>

View File

@ -34,8 +34,10 @@ export class DataManagementPlanWizardComponent implements OnInit {
this.dataManagementPlanService.getSingle(this.itemId).map(data => data as DataManagementPlanModel)
.subscribe(data => {
this.dataManagementPlan = JsonSerializer.fromJSONObject(data, DataManagementPlanModel);
this.formGroup = this.dataManagementPlan.buildForm();
this.isClone = this.route.snapshot.data.clone;
if(this.isClone == false) this.dataManagementPlan.version = this.dataManagementPlan.version + 1;
this.formGroup = this.dataManagementPlan.buildForm();
});
})
}

View File

@ -3,7 +3,7 @@
<mat-card>
<mat-card-content>
<mat-form-field class="full-width">
<input matInput placeholder="{{'DMP-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label" required>
<input matInput placeholder="{{'DMP-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label" required [attr.disabled]="labelDisabled">
<mat-error *ngIf="formGroup.get('label').errors?.backendError">{{baseErrorModel.label}}</mat-error>
<mat-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
@ -66,6 +66,10 @@
<mat-progress-bar [style.height.px]="2" *ngIf="filteringResearchersAsync" mode="indeterminate"></mat-progress-bar>
</td-chips>
<mat-form-field class="full-width">
<input matInput placeholder="Version" formControlName="version"> <!--disabled doesn't work -->
</mat-form-field>
<mat-list *ngIf="associatedUsers?.length" role="list">
<h3 mat-subheader>Associated Users</h3>
<mat-list-item role="listitem" *ngFor="let user of associatedUsers">

View File

@ -47,6 +47,7 @@ export class DataManagementPlanWizardEditorComponent implements AfterViewInit {
organisationsAutoCompleteConfiguration: AutoCompleteChipConfiguration;
createNewVersion;
associatedUsers: Array<DmpUsersModel>
labelDisabled: boolean =false;
constructor(
private dataManagementPlanService: DataManagementPlanService,
@ -71,6 +72,12 @@ export class DataManagementPlanWizardEditorComponent implements AfterViewInit {
organisationRequestItem.criteria = new BaseCriteria();
this.organisationsAutoCompleteConfiguration = new AutoCompleteChipConfiguration(this.externalSourcesService.searchDMPOrganizations.bind(this.externalSourcesService), organisationRequestItem);
this.route.data.subscribe(value=>{
if (value.clone==false && this.formGroup.get("label").value){
this.labelDisabled = true;
}
this.formGroup.controls["version"].disable();
})
}
formSubmit(): void {

View File

@ -56,7 +56,7 @@ export class DatasetWizardListingComponent implements OnInit {
ngOnInit() {
this.route.params.subscribe((params: Params) => {debugger;
this.route.params.subscribe((params: Params) => {
if (this.dmpId != null)
if(params['dmpLabel']!=undefined)
this.titlePrefix ="for " + params['dmpLabel'];