Files
tonehaus/templates/account/dashboard.html.twig
boris 1c98a634c3
All checks were successful
CI - Build Tonehaus Docker image / tonehaus-ci-build (push) Successful in 1m57s
eerrrrrr
2025-11-27 23:42:17 +00:00

98 lines
4.3 KiB
Twig

{% extends 'base.html.twig' %}
{% block title %}Dashboard{% endblock %}
{% block body %}
<h1 class="h4 mb-3">Your dashboard</h1>
{% for msg in app.flashes('success') %}<div class="alert alert-success">{{ msg }}</div>{% endfor %}
<div class="row g-3 mb-4">
<div class="col-sm-4">
<div class="card h-100">
<div class="card-body">
<div class="text-secondary">Review Count</div>
<div class="display-6">{{ reviewCount }}</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="card h-100">
<div class="card-body">
<div class="text-secondary">Album Count</div>
<div class="display-6">{{ albumCount }}</div>
</div>
</div>
</div>
<div class="col-sm-4">
<a class="card h-100 text-reset text-decoration-none" href="{{ path('account_profile') }}">
<div class="card-body d-flex align-items-center gap-3">
{% if profileImage %}
<img src="{{ profileImage }}" alt="Profile picture" class="rounded-circle border" width="64" height="64" style="object-fit: cover;">
{% else %}
<div class="rounded-circle bg-secondary d-flex align-items-center justify-content-center text-white flex-shrink-0" style="width:64px;height:64px;">
<span class="fw-semibold">{{ (displayName ?? email)|slice(0,1)|upper }}</span>
</div>
{% endif %}
<div>
<div class="text-secondary">User Type</div>
<div class="fw-semibold">{{ displayName ?? email }}</div>
<div class="text-secondary small">{{ userType }}</div>
</div>
</div>
</a>
</div>
</div>
<div class="row g-3 mt-3">
<div class="col-md-6">
<div class="card h-100">
<div class="card-body">
<h2 class="h6 mb-3">Your reviews</h2>
<div class="vstack gap-2">
{% for r in userReviews %}
<div class="d-flex justify-content-between align-items-start">
<div class="me-2">
<div><a href="{{ path('review_show', {id: r.id}) }}" class="text-decoration-none">{{ r.title }}</a> <span class="text-secondary">(Rating {{ r.rating }}/10)</span></div>
<div class="text-secondary small">{{ r.album.name }}{{ r.createdAt|date('Y-m-d H:i') }}</div>
</div>
<form method="post" action="{{ path('review_delete', {id: r.id}) }}" onsubmit="return confirm('Delete this review?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete_review_' ~ r.id) }}" />
<button class="btn btn-sm btn-outline-danger" type="submit">Delete</button>
</form>
</div>
{% else %}
<div class="text-secondary">You haven't written any reviews yet.</div>
{% endfor %}
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card h-100">
<div class="card-body">
<h2 class="h6 mb-3">Your albums</h2>
<div class="vstack gap-2">
{% for a in userAlbums %}
<div class="d-flex justify-content-between align-items-start">
<div class="me-2">
<div><a href="{{ path('album_show', {id: a.localId}) }}" class="text-decoration-none">{{ a.name }}</a></div>
<div class="text-secondary small">{{ a.artists|join(', ') }}{% if a.releaseDate %}{{ a.releaseDate }}{% endif %}</div>
</div>
<div class="d-flex gap-2">
<a class="btn btn-sm btn-outline-secondary" href="{{ path('album_edit', {id: a.localId}) }}">Edit</a>
<form method="post" action="{{ path('album_delete', {id: a.localId}) }}" onsubmit="return confirm('Delete this album?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete-album-' ~ a.localId) }}" />
<button class="btn btn-sm btn-outline-danger" type="submit">Delete</button>
</form>
</div>
</div>
{% else %}
<div class="text-secondary">You haven't created any albums yet.</div>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}