<div class="row d-flex flex-row">
	<div mat-dialog-title class="col-auto">{{ data.message }}</div>
	<div class="col-auto close-btn ml-auto" (click)="close()">
		<mat-icon>close</mat-icon>
	</div>
</div>
<div mat-dialog-content class="pt-2 pb-2">
	<div class="container">
		<mat-accordion [multi]="true">
			<mat-expansion-panel>
				<mat-expansion-panel-header>
					<mat-panel-title>
						{{ 'DMP-FINALISE-DIALOG.DMP' | translate }}
					</mat-panel-title>
					<mat-panel-description class="dmp-title">
						{{ inputModel.dmpLabel }}
					</mat-panel-description>
				</mat-expansion-panel-header>
				{{ inputModel.dmpDescription }}
			</mat-expansion-panel>
			<mat-expansion-panel [expanded]="true">
				<mat-expansion-panel-header>
					<mat-panel-title>
						{{ 'DMP-FINALISE-DIALOG.DATASETS' | translate }}
					</mat-panel-title>
					<mat-panel-description></mat-panel-description>
				</mat-expansion-panel-header>
				<div *ngIf="inputModel.datasets.length > 0">
					<div *ngFor="let dataset of inputModel.datasets" class="row pl-3 datasets">
						<mat-icon *ngIf="dataset.status == 0" class="col-1 draft-bookmark">bookmark</mat-icon>
						<mat-icon *ngIf="dataset.status != 0" class="col-1 finalized-bookmark">bookmark</mat-icon>
						<h4 *ngIf="dataset.status == 0" class="col-11 ml-auto mt-1 mb-4">
							<span>{{ 'TYPES.DATASET-STATUS.DRAFT' | translate }}
							<ng-container *ngIf="datasetLookupStatus[dataset.id] && (datasetLookupStatus[dataset.id] === datasetLookupStatusEnum.INVALID)">
								({{'DMP-FINALISE-DIALOG.INVALID' | translate}})
							</ng-container>
							:</span>
							{{ dataset.label }}
							<i *ngIf="(datasetLookupStatus[dataset.id] != datasetLookupStatusEnum.INVALID) && (datasetLookupStatus[dataset.id] != datasetLookupStatusEnum.VALID) " class="fa fa-spinner fa-spin" ></i>
						</h4>
						<h4 *ngIf="dataset.status != 0" class="col-11 ml-auto mt-1 mb-4">{{ dataset.label }}</h4>
					</div>
				</div>
				<div *ngIf="inputModel.datasets.length === 0" class="emptyList">{{ 'DMP-FINALISE-DIALOG.EMPTY' | translate }} </div>
			</mat-expansion-panel>
		</mat-accordion>

		<div *ngIf="validDrafts.length > 0" class="pt-4 pb-2">
			<h4 class="pl-2">{{'DMP-FINALISE-DIALOG.FINALISE-TITLE' | translate}}</h4>
			<mat-selection-list #datasetsDraftSelectionList [(ngModel)]="outputModel.datasetsToBeFinalized">
				<div class="styleBorder" *ngFor="let dataset of validDrafts">
					<mat-list-option [value]='dataset.id' [disabled]="!datasetLookupStatus[dataset.id] || (datasetLookupStatus[dataset.id] != datasetLookupStatusEnum.VALID)">
						<span class="text-truncate" [matTooltip]="dataset.label">{{ dataset.label }}</span>
					</mat-list-option>
				</div>
			</mat-selection-list>
		</div>
		<mat-error *ngIf="getFinalizedDatasets().length === 0 && outputModel.datasetsToBeFinalized.length === 0">
			{{'DMP-FINALISE-DIALOG.VALIDATION.AT-LEAST-ONE-DATASET-FINALISED' | translate}}
		</mat-error>
	</div>
</div>
<div *ngIf="getFinalizedDatasets().length != 0">
	<div class="row pt-2 pb-2 pl-4 pr-4">
		{{ 'DMP-FINALISE-DIALOG.IMPACT' | translate }}
	</div>
	<div class="row pl-4 pr-4">
		{{ 'DMP-FINALISE-DIALOG.AFTER-FINALIZATION' | translate }}
	</div>
</div>

<div mat-dialog-actions class="d-flex justify-content-end mb-1">
	<div class="col-auto">
		<button mat-raised-button cdkFocusInitial (click)="close()" class="cancel-btn">{{ data.cancelButton }}</button>
	</div>
	<div class="col-auto">
		<button mat-raised-button [disabled]="getFinalizedDatasets().length === 0 && outputModel.datasetsToBeFinalized.length === 0" class="submit-btn" (click)="onSubmit()">{{ data.confirmButton }}</button>
	</div>
</div>

<!-- <form *ngIf="formGroup" (ngSubmit)="onSubmit()">
<div class="row d-flex flex-row">
	<div mat-dialog-title class="col-auto">{{ data.message }}</div>
	<div class="col-auto close-btn ml-auto" (click)="close()">
		<mat-icon>close</mat-icon>
	</div>
</div>
<div mat-dialog-content *ngIf="datasetsFinalized && datasetsDraft" class="pt-2 pb-2">
	<mat-accordion [multi]="true">
		<mat-expansion-panel>
			<mat-expansion-panel-header>
				<mat-panel-title>
					{{ 'DMP-FINALISE-DIALOG.DMP' | translate }}
				</mat-panel-title>
				<mat-panel-description class="dmp-title">
					{{ formGroup.get('label').value }}
				</mat-panel-description>
			</mat-expansion-panel-header>
			{{ formGroup.get('description').value }}
		</mat-expansion-panel>
		<mat-expansion-panel [expanded]="true">
			<mat-expansion-panel-header>
				<mat-panel-title>
					{{ 'DMP-FINALISE-DIALOG.DATASETS' | translate }}
				</mat-panel-title>
				<mat-panel-description></mat-panel-description>
			</mat-expansion-panel-header>
			<div *ngIf="allDatasets.length > 0">
				<div *ngFor="let dataset of allDatasets" class="row pl-3 datasets">
					<mat-icon *ngIf="isDraft(dataset)" class="col-1 draft-bookmark">bookmark</mat-icon>
					<mat-icon *ngIf="!isDraft(dataset)" class="col-1 finalized-bookmark">bookmark</mat-icon>
					<h4 *ngIf="isDraft(dataset)" class="col-11 ml-auto mt-1 mb-4">
						<span>{{ 'TYPES.DATASET-STATUS.DRAFT' | translate }}:</span>
						{{ dataset.label }}</h4>
					<h4 *ngIf="!isDraft(dataset)" class="col-11 ml-auto mt-1 mb-4">{{ dataset.label }}</h4>
				</div>
			</div>
			<div *ngIf="allDatasets.length === 0" class="emptyList">{{ 'DMP-FINALISE-DIALOG.EMPTY' | translate }} </div>
		</mat-expansion-panel>
	</mat-accordion>

	<div *ngIf="datasetsDraft.length > 0" class="pt-4 pb-2">
		<h4 class="pl-2">{{'DMP-FINALISE-DIALOG.FINALISE-TITLE' | translate}}</h4>
		<mat-selection-list #datasetsDraftSelectionList [ngModel]="outputModel.datasetToBeFinalized">
			<div class="styleBorder" *ngFor="let dataset of datasetsDraft">
				<mat-list-option [value]='dataset.id'>
					{{ dataset.label }}
				</mat-list-option>
			</div>
		</mat-selection-list>
	</div>
	<mat-error *ngIf="datasetsFinalized.length == 0">{{'DMP-FINALISE-DIALOG.VALIDATION.AT-LEAST-ONE-DATASET-FINALISED'
				| translate}}</mat-error>
</div>

<div mat-dialog-content *ngIf="isWizard" class="pt-2 pb-2">
	<mat-accordion [multi]="true">
		<mat-expansion-panel>
			<mat-expansion-panel-header>
				<mat-panel-title>
					{{ 'DMP-FINALISE-DIALOG.DMP' | translate }}
				</mat-panel-title>
				<mat-panel-description class="dmp-title">
					{{ formGroup.get('dmp')?.get('label')?.value }}
				</mat-panel-description>
			</mat-expansion-panel-header>
			{{ formGroup.get('dmp')?.get('description')?.value }}
		</mat-expansion-panel>
		<mat-expansion-panel [expanded]="true">
			<mat-expansion-panel-header>
				<mat-panel-title>
					{{ 'DMP-FINALISE-DIALOG.DATASETS' | translate }}
				</mat-panel-title>
				<mat-panel-description></mat-panel-description>
			</mat-expansion-panel-header>
			<div *ngIf="allDatasetLabels.length > 0">
				<div *ngFor="let label of allDatasetLabels" class="row pl-3 datasets">
					<mat-icon class="col-1 finalized-bookmark">bookmark</mat-icon>
					<h4 class="col-11 ml-auto mt-1 mb-4">{{ label }}</h4>
				</div>
			</div>
			<div *ngIf="allDatasetLabels.length === 0" class="emptyList"> {{ 'DMP-FINALISE-DIALOG.EMPTY' | translate }}
			</div>
		</mat-expansion-panel>
	</mat-accordion>
</div>

<div *ngIf="datasetsFinalized && datasetsFinalized.length != 0">
	<div class="row pt-2 pb-2 pl-4 pr-4">
		{{ 'DMP-FINALISE-DIALOG.IMPACT' | translate }}
	</div>
	<div class="row pl-4 pr-4">
		{{ 'DMP-FINALISE-DIALOG.AFTER-FINALIZATION' | translate }}
	</div>
</div>

<div mat-dialog-actions class="d-flex justify-content-end">
	<div class="col-auto">
		<button mat-raised-button class="confirm" (click)="onSubmit()">{{ data.confirmButton }}</button>
	</div>
	<div class="col-auto">
		<button mat-raised-button cdkFocusInitial (click)="close()" class="cancel">{{ data.cancelButton }}</button>
	</div>
</div>
</form> -->
