<div class="data-management-plan-wizard-editor">
	<form *ngIf="formGroup" (ngSubmit)="formSubmit()" [formGroup]="formGroup">
		<mat-card>
			<mat-card-content>
				<div class="d-flex row">
					<mat-form-field class="col-8">
						<input matInput placeholder="{{'DMP-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label"
							formControlName="label" required>
						<mat-error *ngIf="formGroup.get('label').hasError('backendError')">
							{{formGroup.get('label').getError('backendError').message}}</mat-error>
						<mat-error *ngIf="formGroup.get('label').hasError('required')">
							{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
					</mat-form-field>
					<mat-form-field class="col-8">
						<app-single-auto-complete [formControl]="formGroup.get('grant')"
							placeholder="{{'DMP-EDITOR.FIELDS.GRANT' | translate}}"
							[configuration]="grantAutoCompleteConfiguration">
						</app-single-auto-complete>
						<mat-error *ngIf="formGroup.get('grant').hasError('backendError')">
							{{formGroup.get('grant').getError('backendError').message}}</mat-error>
						<mat-error *ngIf="formGroup.get('grant').hasError('required')">
							{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
					</mat-form-field>

					<mat-form-field class="col-8">
						<textarea matInput class="description-area"
							placeholder="{{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}}" formControlName="description">
						</textarea>
						<mat-error *ngIf="formGroup.get('description').hasError('backendError')">
							{{formGroup.get('description').getError('backendError').message}}</mat-error>
						<mat-error *ngIf="formGroup.get('description').hasError('required')">
							{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
					</mat-form-field>
					<mat-form-field class="col-8">
						<app-multiple-auto-complete [formControl]="formGroup.get('profiles')"
							placeholder="{{'DMP-EDITOR.FIELDS.DATASET-TEMPLATES' | translate}}"
							[configuration]="profilesAutoCompleteConfiguration">
						</app-multiple-auto-complete>
						<mat-error *ngIf="formGroup.get('profiles').hasError('backendError')">
							{{formGroup.get('profiles').getError('backendError').message}}</mat-error>
						<mat-error *ngIf="formGroup.get('profiles').hasError('required')">
							{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
						<button matSuffix type="button" class="input-btn" (click)="availableProfiles()">
							<mat-icon class="icon-btn">view_list</mat-icon>
						</button>
					</mat-form-field>
					<mat-form-field class="col-8">
						<app-multiple-auto-complete [formControl]="formGroup.get('organisations')"
							placeholder="{{'DMP-EDITOR.FIELDS.ORGANISATIONS' | translate}}"
							[configuration]="organisationsAutoCompleteConfiguration">
						</app-multiple-auto-complete>
						<mat-error *ngIf="formGroup.get('organisations').hasError('backendError')">
							{{formGroup.get('organisations').getError('backendError').message}}</mat-error>
						<mat-error *ngIf="formGroup.get('organisations').hasError('required')">
							{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
					</mat-form-field>
					<mat-form-field class="col-8">
						<app-multiple-auto-complete [formControl]="formGroup.get('researchers')"
							placeholder="{{'DMP-EDITOR.FIELDS.RESEARCHERS' | translate}}"
							[configuration]="researchersAutoCompleteConfiguration">
						</app-multiple-auto-complete>
						<mat-error *ngIf="formGroup.get('researchers').hasError('backendError')">
							{{formGroup.get('researchers').getError('backendError').message}}</mat-error>
						<mat-error *ngIf="formGroup.get('researchers').hasError('required')">
							{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
						<button matSuffix type="button" class="input-btn" (click)="addResearcher()">
							<mat-icon class="icon-btn">add_circle</mat-icon>
						</button>
					</mat-form-field>
					<mat-form-field class="col-md-6">
						<input matInput placeholder="Version" formControlName="version">
						<!--disabled doesn't work -->
					</mat-form-field>

					<mat-list class="col-md-12" *ngIf="associatedUsers?.length" role="list">
						<h3 mat-subheader>Associated Users</h3>
						<mat-list-item role="listitem" *ngFor="let user of associatedUsers">
							<mat-icon mat-list-icon>person</mat-icon>
							<div>{{user.name}}</div>
						</mat-list-item>
					</mat-list>
				</div>
			</mat-card-content>
		</mat-card>
	</form>
</div>
