<div class="main-content listing-main-container h-100">
	<div class="container-fluid">
		<div class="d-flex flex-direction-row">
			<div *ngIf="hasListingItems && listingItems && listingItems.length === 0 && !hasLikeCriteria()" class="card mt-0">
			<!-- <div *ngIf="listingItems && listingItems.length === 0" class="card mt-0" [style.display]="isVisible ? 'block' : 'none'"> -->
				<!-- <a class="col-auto d-flex" (click)="closeCard()"><span class="ml-auto pt-3 material-icons clear-icon">clear</span></a> -->
				<div class="card-content info-text mb-0">
					<p>{{'DMP-LISTING.TEXT-INFO' | translate}}</p>
					<p class="mt-4 pt-2">{{'DMP-LISTING.TEXT-INFO-QUESTION' | translate}} <a class="zenodo-link" href="https://zenodo.org/communities/liber-dmp-cat/?page=1&size=20" target="_blank">{{'DMP-LISTING.LINK-ZENODO' | translate}}</a> {{'DMP-LISTING.GET-IDEA' | translate}}</p>
					<div class="d-flex">
						<div *ngIf="!isPublic" class="col left-content" (click)="restartTour()">{{ 'GENERAL.ACTIONS.TAKE-A-TOUR'| translate }}</div>
						<img class="col-auto ml-auto laptop-img" src="../../../assets/splash/assets/img/1_Main/Png/Who   Benefits copy.png" width="116" height="139">
					</div>
				</div>
			</div>
			<p *ngIf="listingItems && listingItems.length > 0 || this.criteria.like" class="col-auto header-title">{{(isPublic ? 'GENERAL.TITLES.EXPLORE-PLANS' : 'GENERAL.TITLES.PLANS') | translate}}</p>
			<div class="filter-btn" [style.right]="this.dialog.getDialogById('filters') ? '446px' : '0px'" [style.width]="scrollbar || this.dialog.getDialogById('filters') ? '57px' : '37px'" (click)="openFiltersDialog()">
				<button mat-raised-button class="p-0">
					<mat-icon class="mr-4">filter_alt</mat-icon>
				</button>
			</div>
		</div>
		<div>
			<div class="listing row pb-2">
				<div *ngIf="listingItems && listingItems.length > 0 || this.criteria.like" class="col-md-12">
					<div class="d-flex flex-direction-row pt-4">
						<!-- Sort by -->
						<span class="d-flex align-items-center">{{'DMP-LISTING.SORT-BY' | translate}}:</span>
						<mat-form-field class="sort-form col-auto">
							<mat-select placeholder="{{'CRITERIA.LIKE'| translate}}" [formControl]="formGroup.get('order')">
								<mat-option *ngIf="!isPublic" [value]="order.MODIFIED">{{enumUtils.toRecentActivityOrderString(order.MODIFIED)}}</mat-option>
								<mat-option *ngIf="isPublic" [value]="order.PUBLISHED">{{enumUtils.toRecentActivityOrderString(order.PUBLISHED)}}</mat-option>
								<mat-option [value]="order.LABEL">{{enumUtils.toRecentActivityOrderString(order.LABEL)}}</mat-option>
								<mat-option *ngIf="!isPublic" [value]="order.STATUS">{{enumUtils.toRecentActivityOrderString(order.STATUS)}}</mat-option>
								<!-- <mat-option [value]="order.CREATED">{{enumUtils.toRecentActivityOrderString(order.CREATED)}}</mat-option> -->
							</mat-select>
						</mat-form-field>
						<!-- End of Sort by -->
						<div class="d-flex flex-row ml-auto">
							<!-- Guided Tour -->
							<!-- <div class="center-content" [style.display]="!isVisible && isAuthenticated()? 'block' : 'none'" (click)="restartTour()"> -->
							<div *ngIf="!isPublic" class="center-content" (click)="restartTour()">{{ 'GENERAL.ACTIONS.TAKE-A-TOUR'| translate }}</div>
							<!-- End of Guided Tour -->
							<!-- Search Filter-->
							<mat-form-field class="search-form ml-auto col-auto pr-0"
								floatLabel="never">
								<mat-icon matSuffix>search</mat-icon>
								<input matInput placeholder="{{'CRITERIA.DMP.LIKE'| translate}}" name="likeCriteria"
									[formControl]="formGroup.get('like')">
								<mat-error *ngIf="formGroup.get('like').hasError('backendError')">
									{{formGroup.get('like').getError('backendError').message}}</mat-error>
							</mat-form-field>
							<!-- End of Search Filter -->
						</div>
					</div>
				</div>
				<div class="col-md-12 col-sm-12 col-md-9">
					<div *ngFor="let item of listingItems; let i = index">
						<app-dmp-listing-item-component [showDivider]="i != (listingItems.length - 1)" [dmp]="item" [isPublic]="isPublic"></app-dmp-listing-item-component>
					</div>
					<div *ngIf="listingItems && listingItems.length > 0 && this.startIndex < this.totalCount - 1 && this.pageSize < this.totalCount - 1" class="d-flex justify-content-center">
						<button type="button" class="btn-load-more" (click)="loadMore()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
					</div>
				</div>
				<div *ngIf="hasListingItems && listingItems && listingItems.length === 0 && this.criteria.like !== ''" class="col-md-12 d-flex justify-content-center pt-4 mt-4 mb-4 pb-4">
					<span class="empty-list">{{'DMP-LISTING.EMPTY-LIST' | translate}}</span>
				</div>
			</div>
		</div>
	</div>
</div>


<!-- Version 1 -->
<!-- <div class="header-image" *ngIf="isPublic">
	<div class="header-text-container">
		<h3>{{ 'ABOUT.WELCOME' | translate }}</h3>
		<h4>{{ 'ABOUT.WELCOME-MESSAGE' | translate }}</h4>
	</div>
</div>
<div [ngClass]="isPublic ? 'explore-dmp-content' : 'main-content'">
	<div class="container-fluid">
		<div class="card">
			<div class="row card-header card-header-plain d-flex">
				<div class="card-desc d-flex flex-column justify-content-center">
					<h4 class="card-title">{{'DMP-LISTING.TITLE' | translate}} {{titlePrefix}}</h4>
					<div *ngIf="allVersions">
						<span class="all-versions">
							{{'DMP-LISTING.VIEW-ALL-VERSIONS' | translate}}
						</span>
						<span class="dmp-label">
							{{this.groupLabel}}
						</span>
					</div>
				</div>
				<div class="row ml-auto p-2" *ngIf="!isPublic">
					<button mat-icon-button [matMenuTriggerFor]="actionsMenu" class="ml-auto more-icon" (click)="$event.stopImmediatePropagation();">
						<mat-icon class="more-horiz">more_horiz</mat-icon>
					</button>
					<mat-menu #actionsMenu="matMenu" xPosition="before">
						<button mat-menu-item (click)="fileSave($event)">
							<mat-icon>cloud_upload</mat-icon> {{'DMP-UPLOAD.ACTIONS.IMPORT' | translate}}
						</button>
					</mat-menu>
					<button mat-raised-button color="primary" class="text-uppercase lightblue-btn m-1" [routerLink]="['./new']">
						<mat-icon>add</mat-icon> {{'DMP-LISTING.ACTIONS.NEW' | translate}}
					</button>
					<button mat-raised-button color="primary" class="text-uppercase lightblue-btn m-1" [routerLink]="['/quick-wizard']">
						<mat-icon>play_circle_outline</mat-icon> {{'DMP-LISTING.ACTIONS.NEW-WITH-WIZARD' | translate}}
					</button>
				</div>
			</div>
			<div class="card-body table-responsive">
				<div class="listing row pb-2">
					<div class="col-12 col-sm-12 col-md-3">
						<app-dmp-criteria-component [showGrant]="showGrant" [isPublic]="isPublic" class="col-auto"></app-dmp-criteria-component>
					</div>
					<div class="col-12 col-sm-12 col-md-9 pt-4">
						<div *ngFor="let item of listingItems; let i = index">
							<app-dmp-listing-item-component [showDivider]="i != (listingItems.length - 1)" [dmp]="item" [isPublic]="isPublic"></app-dmp-listing-item-component>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-12 col-sm-12 col-md-9 ml-auto paginator">
						<mat-paginator #paginator [length]="totalCount" [pageSizeOptions]="[10, 25, 100]" (page)="pageThisEvent($event)" class="mt-2"></mat-paginator>
					</div>
				</div>
			</div>
		</div>
	</div>
</div> -->



<!-- Version 0 -->
<!-- <mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">

	<ng-container cdkColumnDef="name">
		<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DMP-LISTING.COLUMNS.NAME' | translate}}
		</mat-header-cell>
		<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
	</ng-container>

	<ng-container cdkColumnDef="grant">
		<mat-header-cell *matHeaderCellDef mat-sort-header="|join|grant:label">{{'DMP-LISTING.COLUMNS.GRANT' |
							translate}}</mat-header-cell>
		<mat-cell *matCellDef="let row"> {{row.grant}} </mat-cell>
	</ng-container>

	<ng-container cdkColumnDef="status">
		<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.STATUS' | translate}}</mat-header-cell>
		<mat-cell *matCellDef="let row"> {{enumUtils.toDmpStatusString(row.status)}} </mat-cell>
	</ng-container>

	<ng-container cdkColumnDef="creationTime">
		<mat-header-cell *matHeaderCellDef mat-sort-header="created">
			{{'DMP-LISTING.COLUMNS.CREATION-TIME' | translate}}</mat-header-cell>
		<mat-cell *matCellDef="let row"> {{row.creationTime | date:'shortDate'}} </mat-cell>
	</ng-container>

	<ng-container cdkColumnDef="organisations">
		<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.ORGANISATIONS' | translate}}</mat-header-cell>
		<mat-cell *matCellDef="let row"> {{row.organisations}} </mat-cell>
	</ng-container>

	<ng-container cdkColumnDef="version">
		<mat-header-cell *matHeaderCellDef mat-sort-header="version">
			{{'DMP-LISTING.COLUMNS.LATEST_VERSION' | translate}}</mat-header-cell>
		<mat-cell *matCellDef="let row">
			{{row.version}}
		</mat-cell>
	</ng-container>

	<ng-container cdkColumnDef="datasets">
		<mat-header-cell *matHeaderCellDef mat-sort-header="|count|dataset">
			{{'DMP-LISTING.COLUMNS.DATASETS' | translate}}</mat-header-cell>
		<mat-cell *matCellDef="let row" (click)="$event.stopPropagation()">
			<app-url-listing [items]="row.datasets" [urlLimit]="5" [parameters]="{ datasetLabel: row.label }">
			</app-url-listing>
		</mat-cell>
	</ng-container>

	<ng-container cdkColumnDef="actions">
		<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.ACTIONS' | translate}}</mat-header-cell>
		<mat-cell *matCellDef="let row" (click)="$event.stopPropagation()">
			<mat-menu #actionsMenu="matMenu">
				<button mat-menu-item (click)="openShareDialog(row.id,row.label)">
					<mat-icon>share</mat-icon>{{'DMP-LISTING.ACTIONS.INVITE' | translate}}
				</button>
				<button mat-menu-item (click)="addDataset(row.id)">
					<mat-icon>add</mat-icon>{{'DMP-LISTING.ACTIONS.ADD-DATASET' | translate}}
				</button>
				<button mat-menu-item (click)="showDatasets(row.id, row.label)">
					<mat-icon>list</mat-icon>{{'DMP-LISTING.ACTIONS.DATASETS' | translate}}
				</button>
				<button mat-menu-item (click)="viewVersions(row.groupId, row.label)">
					<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
				</button>
			</mat-menu>
			<button mat-icon-button [matMenuTriggerFor]="actionsMenu">
				<mat-icon>more_vert</mat-icon>
			</button>
		</mat-cell>
	</ng-container>

	<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
	<mat-row *matRowDef="let row; columns: displayedColumns" (click)="rowClick(row.id);"></mat-row>

</mat-table>
<mat-paginator #paginator [length]="dataSource?.totalCount" [pageSizeOptions]="[10, 25, 100]">
</mat-paginator> -->
