{% extends('base.html.twig') %}
{% block title %}Hymn Information for {{ hymn.title }}!{% endblock %}
{% block pageId %}hymn_info{% endblock %}
{% block javascripts %}
{{ parent() }}
{{ encore_entry_script_tags('hymninfo') }}
{% endblock %}
{% block body %}
{% if not useImg %}
<script src="//cdnjs.cloudflare.com/ajax/libs/pdfobject/2.0.201604172/pdfobject.min.js"
integrity="sha256-dUe7c2jPkbycNGu4OSy/3FbLKU5FK1aM62Vc5Ni7sgs="
crossorigin="anonymous"></script>
{% endif %}
<div class="card">
<h2 class="card-header">Hymn Information</h2>
<article class="card-body">
<div class="hymn-info">
<h3 class="ml-3 font-weight-bold">{{ hymn.title }}</h3>
<hr/>
{% if is_granted('ROLE_ADMIN') %}
<h4 class="ml-3">
<a href="{{ path('app_admin_hymns_edit', {'id': hymn.id}) }}" target="_blank">Edit this hymn</a>
</h4>
<hr/>
{% endif %}
{% if categories|length > 0 %}
<h3 class="col-12 text-center font-weight-bold" title="List of categories associated with this hymn!">Category List</h3>
<div class="text-center">
Here is a list of categories associated with this hymn!
</div>
<div class="row ml-3">
{% for category in categories %}
<div class="col-md-6">
<div class="small">
<a title="{{ category.description }}" class="pr-3" href="{{ path('hymn_category_show', {'slug': category.slug}) }}">{{ category.title }}</a>
</div>
</div>
{% endfor %}
</div>
<hr/>
{% endif %}
<div class="row">
<div class="col-md-6 hymn-audio">
<audio class="mx-2" style="width: 100%;" id="player" controls title="{{ hymn.title }}">
<source src="/{{ hymnType.slug }}/midi/{{ hymn.slug }}.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
<div class="col-md-6 hymn-score btn-group-vertical align-items-center mt-2 mt-sm-0" data-toggle="modal"
title="View the hymn, '{{ hymn.title }}'."
data-target="#largeModal"><i class="fa fa-music"> view music</i>
</div>
<div class="modal fade" id="largeModal" tabindex="-1" role="dialog" aria-labelledby="largeModal"
aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" id="audio_container"></div>
{% if useImg %}
<div class="modal-body" id="image_container">
{% if hymn.ScorePageCount > 1 %}
{% for i in 0..(hymn.ScorePageCount-1) %}
<img alt="{{ hymn.title }} page {{ i+1 }}"
src="/{{ hymnType.slug }}/img/{{ hymn.slug }}-{{ i }}.jpg"/>
{% endfor %}
{% else %}
<img alt="{{ hymn.title }}" src="/{{ hymnType.slug }}/img/{{ hymn.slug }}.jpg"/>
{% endif %}
</div>
{% else %}
<div class="modal-body" id="pdf_container"></div>
<script>
PDFObject.embed("/{{ hymnType.slug }}/pdfs/{{ hymn.title }}.pdf", "#pdf_container");
</script>
{% endif %}
</div>
</div>
</div>
</div>
<hr/>
{% if is_recorded %}
<h3 class="text-center">Audio Recording Samples</h3>
<div class="row">
{% for hymn in artist_hymns %}
<div class="col-md-6 my-3 ml-2">
<div class="{{ hymn.artistSlug }}">
{{ hymn.artistName }}
{% if hymn.yearRecorded is not null %}
(in {{ hymn.yearRecorded }})
{% endif %}
</div>
<audio class="h-50 w-50 m-1 p-0" id="player" controls title="{{ hymn.title }}">
<source src="{{ hymn.HymnUrl }}{{ hymn.title }}.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
{% endfor %}
</div>
<hr/>
{% endif %}
<div class="row">
<div class="prev-hymn col-md-1">
<a title="Go to the previous hymn"
href="{{ path('hymnInfo', {'slug': hymn.prevSlug}) }}"><i class="fa fa-arrow-left ml-3"></i></a>
</div>
<div class="page-back text-center col-md-10">
<a href="{{ path('hymns', {'hymnType': hymnType.slug}) }}">Back to the list</a>
</div>
<div class="next-hymn col-md-1">
<a title="Go to the next hymn"
href="{{ path('hymnInfo', {'slug': hymn.nextSlug}) }}"><i class="fa fa-arrow-right"></i></a>
</div>
</div>
<hr/>
<div class="row">
<div class="col-md-3 text-right">Author</div>
<div class="col-md-8">
<a class="hymn-info-link d-inline" href="{{ path('authcomp', {'type': 'Author', 'id': auth.Id} ) }}">
{{ auth.FirstName }} {{ auth.MiddleName }} {{ auth.LastName }}
</a>{% if hymn.lyricyyyy|length > 0 %} in {{ hymn.lyricyyyy }} {% endif %}
</div>
<div class="col-md-1">
<a href="#" class="authcomp-info" id="auth_{{ auth.ID }}"
data-content="{{ auth.Notes|nl2br }}"
data-toggle="modal" data-target="#authModal" data-id="{{ auth.ID }}"
data-title="Author {{ auth.FirstName }} {{ auth.MiddleName }} {{ auth.LastName }}'s bio information">
<i class="fa fa-book"></i>
</a>
</div>
<div class="modal fade" id="authModal" tabindex="-1" role="dialog"
aria-labelledby="authModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header row">
<h4 class="modal-title col-12" id="authModalLabel">
{{ auth.FirstName }} {{ auth.MiddleName }} {{ auth.LastName }}'s bio information
</h4>
{% set bdate = auth.Birthdate|length > 0 ? auth.Birthdate : 'Date Unknown' %}
{% set ddate = auth.Deathdate|length > 0 ? auth.Deathdate : 'Date Unknown' %}
<h5 class="col-12">{{ bdate }} - {{ ddate }}</h5>
</div>
<div class="authcomp modal-body"
id="authModalBody">{{ (auth.Notes ?? 'Sorry, we have no information for this author')|raw|nl2br }}</div>
</div>
</div>
</div>
</div>
<hr/>
<div class="row">
<div class="col-md-3 text-right">Composer</div>
<div class="col-md-8">
<a class="hymn-info-link d-inline" href="{{ path('authcomp', {'type': 'Composer', 'id': comp.Id} ) }}">
{{ comp.FirstName }} {{ comp.MiddleName }} {{ comp.LastName }}
</a>{% if hymn.musicyyyy|length > 0 %} in {{ hymn.musicyyyy }} {% endif %}
</div>
<div class="col-md-1">
<a href="#" class="authcomp-info" id="comp_{{ comp.ID }}"
data-content="{{ comp.Notes|nl2br }}"
data-toggle="modal" data-target="#compModal" data-id="{{ comp.ID }}"
data-title="Composer {{ comp.FirstName }} {{ comp.MiddleName }} {{ comp.LastName }}'s bio information">
<i class="fa fa-book"></i>
</a>
</div>
<div class="modal fade" id="compModal" tabindex="-1" role="dialog"
aria-labelledby="compModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header row">
<h4 class="modal-title col-12" id="compModalLabel">
{{ comp.FirstName }} {{ comp.MiddleName }} {{ comp.LastName }}'s bio information
</h4>
{% set bdate = comp.Birthdate|length > 0 ? comp.Birthdate : 'Date Unknown' %}
{% set ddate = comp.Deathdate|length > 0 ? comp.Deathdate : 'Date Unknown' %}
<h5 class="col-12">{{ bdate }} - {{ ddate }}</h5>
</div>
<div class="authcomp modal-body"
id="compModalBody">{{ (comp.Notes ?? 'Sorry, we have no information for this composer')|raw|nl2br }}</div>
</div>
</div>
</div>
</div>
<hr/>
<div class="row">
<div class="col-md-3 text-right">Arranger</div>
<div class="col-md-8">
<a class="hymn-info-link d-inline" href="{{ path('authcomp', {'type': 'Arranger', 'id': arrn.Id} ) }}">
{{ arrn.FirstName }} {{ arrn.MiddleName }} {{ arrn.LastName }}
</a>{% if hymn.arrangedyyyy|length > 0 %} in {{ hymn.arrangedyyyy }} {% endif %}
</div>
<div class="col-md-1">
<a href="#" class="authcomp-info" id="arrn_{{ arrn.ID }}"
data-content="{{ arrn.Notes|nl2br }}"
data-toggle="modal" data-target="#arrnModal" data-id="{{ arrn.ID }}"
data-title="Arranger {{ arrn.FirstName }} {{ arrn.MiddleName }} {{ arrn.LastName }}'s bio information">
<i class="fa fa-book"></i>
</a>
</div>
<div class="modal fade" id="arrnModal" tabindex="-1" role="dialog"
aria-labelledby="arrnModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header row">
<h4 class="modal-title col-12" id="arrnModalLabel" >
{{ arrn.FirstName }} {{ arrn.MiddleName }} {{ arrn.LastName }}'s bio information
</h4>
{% set bdate = arrn.Birthdate|length > 0 ? arrn.Birthdate : 'Date Unknown' %}
{% set ddate = arrn.Deathdate|length > 0 ? arrn.Deathdate : 'Date Unknown' %}
<h5 class="col-12">{{ bdate }} - {{ ddate }}</h5>
</div>
<div class="authcomp modal-body"
id="arrnModalBody">{{ (arrn.Notes ?? 'Sorry, we have no information for this arranger')|raw|nl2br }}</div>
</div>
</div>
</div>
</div>
<hr/>
{% if( hymn.OtherNotes is not null) %}
<div class="row">
<div class="col-md-3 text-right">Notes</div>
<div class="col-md-9">{{ hymn.OtherNotes|raw|nl2br }}</div>
</div>
<hr/>
{% endif %}
<div class="row">
<div class="col-md-3 text-right">Lyrics</div>
<div class="col-md-9">{{ hymn.text|raw|nl2br }}</div>
</div>
<hr/>
<div class="small text-center">
<div>Uploaded on {{ hymn.createdAt|date("F jS, Y \\a\\t g:ia") }} and has {{ hymn.hymnHitCount }} views!</div>
</div>
</div>
</article>
<h3 class="card-header">Comments</h3>
<div id="comments" class="card-body">
{% for c in comments %}
<blockquote class="mb-2">
<p>{{ c.comment|raw }}</p>
<footer>
by {{ c.userName }} on {{ c.commentDate|date('m/d/Y h:m:s a') }}
{% if is_granted('ROLE_ADMIN') %}
<div class="float-right">
<a href="mailto:{{ c.email }}?subject=Re:%20your%20comment%20on%20eHymns&body=Thank you for your comment on '{{ hymn.title }}'!">Reply</a>
</div>
{% endif %}
</footer>
</blockquote>
{% else %}
<div class="no-comments text-center">
This hymn doesn't have any comments yet.<br/>You can be the first!
</div>
{% endfor %}
{% if app.user %}
{{ form_start(form) }}
<input type="hidden" value="{{ app.user.id }}" name="user_id" id="user_id">
{{ form_widget(form) }}
<input type="submit"/>
{{ form_end(form) }}
{% else %}
<div class="text-center">
You must be
<a href="{{ path('app_login') }}?go_to={{ app.request.server.get('REQUEST_SCHEME') }}://{{ app.request.host }}{{ path('hymnInfo', {'slug' : hymn.slug}) }}#comments">
logged in</a> to comment. Otherwise, please <a href="{{ path('register') }}">register</a>.
</div>
{% endif %}
</div>
</div>
{% endblock %}