{% extends '@OxHoardBundle/layout.html.twig' %}
{% block title %}References{% endblock %}
{% block body %}
<div class="marginTop clearfix"></div>
<div id="content" class="container">
<div class="row marginTop">
<div class="hoardlistview-6col col-md-12">
{% if is_authenticated %}
<div class="edit-btn"><a href="{{ path('reference_new') }}"><h2>Add a new Reference <span class="fa fa-plus"></span></h2></a></div>
{% endif %}
<h1>List of References</h1>
<div style="padding: 10px"></div>
<form id="reference-search-form" method="get" action="">
<div id="tabs" class="tabs">
<ul>
<li><a href="#tabs-1">Search</a></li>
<li><a href="#tabs-2">Advanced Search</a></li>
</ul>
<div id="tabs-1">
<input name="search" type="text"
{% if search_term %}
value="{{ search_term }}"
{% else %}
placeholder="Search"
{% endif %}
/>
</div>
<div id="tabs-2">
<div>
<div class="datalabel">
<label>Author</label>
</div>
<div class="data">
<input name="author" type="text"
{% if author %}
value="{{ author }}"
{% else %}
placeholder="Author"
{% endif %}
/>
</div>
</div>
{% if is_authenticated %}
<div class="datalabel">
<label>Abbreviation</label>
</div>
<div class="data">
<input name="abbreviation" type="text"
{% if abbreviation %}
value="{{ abbreviation }}"
{% else %}
placeholder="Abbreviation"
{% endif %}
/>
</div>
{% endif %}
<div>
<div class="datalabel">
<label>Title</label>
</div>
<div class="data">
<input name="title" type="text"
{% if title %}
value="{{ title }}"
{% else %}
placeholder="Title"
{% endif %}
/>
</div>
</div>
<div>
<div class="datalabel">
<label>Title (journal, series)</label>
</div>
<div class="data">
<input name="title-edition" type="text"
{% if title_edition %}
value="{{ title_edition }}"
{% else %}
placeholder="Title (journal, series)"
{% endif %}
/>
</div>
</div>
<div>
<div class="datalabel">
<label>Volume</label>
</div>
<div class="data">
<input name="volume" type="text"
{% if volume %}
value="{{ volume }}"
{% else %}
placeholder="Volume"
{% endif %}
/>
</div>
</div>
<div>
<div class="datalabel">
<label>Year</label>
</div>
<div class="data">
<input name="year-from" type="text"
{% if year_from %}
value="{{ year_from }}"
{% else %}
placeholder="From year"
{% endif %}
/>
<input name="year-to" type="text"
{% if year_to %}
value="{{ year_to }}"
{% else %}
placeholder="To year"
{% endif %}
/>
</div>
</div>
<div>
<div class="datalabel">
<label>Type</label>
</div>
<div class="data">
<select name="reference-type" class="select2-choice form-control">
<option value=""></option>
{% for ref_type in reference_types %}
<option value="{{ref_type.id}}"
{% if ref_type.id == reference_type %} selected {% endif %}
>{{ref_type}}</option>
{% endfor %}
</select>
</div>
</div>
{% if is_authenticated %}
<div>
<div class="datalabel">
<label>Internal note</label>
</div>
<div class="data">
<input name="internal-note" type="text"
{% if internalNote %}
value="{{ internalNote }}"
{% else %}
placeholder="Internal note"
{% endif %}
/>
</div>
</div>
{% endif %}
</div>
</div>
<input class='hidden' id="active-tab" name='active-tab' type="text" value="{{active_tab}}"/>
<input type="submit" value="Submit" /></form>
{% embed '@OxHoardBundle/flash.html.twig' %}{% endembed %}
<h4>
{% set direction = pagination.getDirection() %}
{% for field in sort_fields %}
{% if pagination.isSorted(field.key) %}Sorted by {{field.label}} {{direction}} {% endif %}
{% endfor %}
</h4>
<div class="btn-group sort-results">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Sort By:
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for field in sort_fields %}
<li>{{ knp_pagination_sortable(pagination, field.label, field.key, {'defaultDirection' : field.defaultDirection}) }}</li>
{% endfor %}
</ul>
</div>
<div class="navigation">
{{ knp_pagination_render(pagination) }}
</div>
{% if pagination is empty %}
<h2>Your query did not return any results.</h2>
{% endif %}
{% for reference in pagination %}
<h2>
<a href="{{ path('reference_show', { 'id':reference.id }) }}">{{ reference }}</a> -
</h2>
{% if is_authenticated %}
<a class="btn btn-default pull-right list-edit-button" href="{{ path('reference_edit', { 'id':reference.id }) }}">Edit</a>
{% endif %}
<div class="datalabel">Title (journal, series): </div><div class="data">{{ reference.titleEdition }}</div>
<div class="datalabel">Abbreviation: </div><div class="data">{{ reference.abbreviation }}</div>
<div class="datalabel">Year: </div><div class="data">{{ reference.year }}</div>
<div class="datalabel">Type: </div><div class="data">{{ reference.referenceType }}</div>
{% if is_authenticated %}
{% if reference.sortValue != 0 %}
<div class="datalabel">Sort Value: </div><div class="data">{{ reference.sortValue }}</div>
{% endif %}
{% endif %}
{% if is_admin and reference.hasOwnColumn %}
<div class="datalabel">Has own column</div><div class="data"><i class="fa fa-check"></i></div>
{% endif %}
{% endfor %}
</div>
</div>
<div class="navigation">
{{ knp_pagination_render(pagination) }}
</div>
</div>
{% endblock %}
{% block javascripts %}
{{parent()}}
{% embed 'import-libs/select2.js.html.twig' %}{% endembed %}
<script>
$( function() {
$('.select2-choice').select2()
$( ".tabs" ).tabs({
active: $('#tabs>div').index($('{{active_tab}}')),
activate: function( ev, ui ) {
$("#active-tab").val(ui.newTab.children()[0].hash)
}
})
} );
</script>
{% endblock %}
{% block stylesheets %}
{{ parent() }}
{% embed 'import-libs/select2.css.html.twig' %}{% endembed %}
{% endblock %}