{% set type = app.request.get('searchOption', 'journal') %}
{% if app.request.attributes.get('_route') in ['get_authors','get_authors_publication'] %}
{% set type = 'author' %}
{% endif %}
{% set search = app.request.get('searchValue', '') %}
{% if app.request.get('auteur') %}
{% set search = app.request.get('auteur', '') %}
{% elseif app.request.get('authorValue') %}
{% set search = app.request.get('authorValue', '') %}
{% endif %}
{% set listpublishers = publicationManager.advancedData['publishers'] %}
{% set listcategories = publicationManager.advancedData['categories'] %}
{% set listcountries = publicationManager.advancedData['countries'] %}
{% set categories = publicationManager.advancedData['categories2'] %}
{% set description =
"Discover the optimal Journal based on multiple criteria or locate authors along with their published articles and the corresponding Journals"
%}
<div class="search-section refonte">
<div class="container flashes-msg" style="text-align: center;height: auto;">
{% for message in app.flashes('success') %}
<div class="alert alert-success alert-dismissible alert-success-journal w-100 mx-auto d-flex p-2 mb-4" role="alert">
<span class="">{{ message|raw }}</span>
<span type="button" class="close position-static ml-auto" data-dismiss="alert" aria-label="Close" style="padding: 0 !important;"><span aria-hidden="true">×</span></span>
</div>
{% endfor %}
{% for message in app.flashes('warning') %}
<div class="alert alert-warning alert-dismissible alert-warning-journal w-100 mx-auto d-flex p-2 mb-4" role="alert">
<span class="">{{ message|raw }}</span>
<span type="button" class="close position-static ml-auto" data-dismiss="alert" aria-label="Close" style="padding: 0 !important;"><span aria-hidden="true">×</span></span>
</div>
{% endfor %}
{% for message in app.flashes('error') %}
<div class="alert alert-error alert-dismissible alert-error-journal w-100 mx-auto d-flex p-2 mb-4" role="alert">
<span class="">{{ message|raw }}</span>
<span type="button" class="close position-static ml-auto" data-dismiss="alert" aria-label="Close" style="padding: 0 !important;"><span aria-hidden="true">×</span></span>
</div>
{% endfor %}
</div>
<img style=" position: absolute;
right: 169px;
bottom: 1px;
height: calc(97% - 114px);
" src="{{ asset('assets/images/illustration-stars.svg') }}" alt="Illustration" class="illustration"/>
<div class="container text-left position-relative">
<div class="content">
<h1 class="title">{{appName | replace({'\"':''})}} <br /> Empowering <br />Scientific Collaboration</h1>
<p class="description">
{{appName | replace({'\"':''})}} is an inclusive ecosystem empowering scientific collaboration and knowledge sharing. <br>
It connects researchers, institutions, and corporations to explore literature, access funding, forge partnerships, and publish impactful research outcomes, streamlining the management of research activities.
</p>
<form method="get" action="{{ url('data_search_by_several_values') }}" class="search-bar">
<!-- Toggle Buttons -->
<div class="btn-group toggle-options" role="group">
{% if app.request.attributes.get('_route') == 'journalSearch' %}
<button type="button" class="btn btn-toggle btn-journal {% if type == 'journal' %}active{% endif %}" onclick="setSearchType('journal')">Journal</button>
{% elseif app.request.attributes.get('_route') == 'get_authors' and app.request.get('authorValue') is null %}
<button type="button" class="btn btn-toggle btn-author {% if type == 'author' %}active{% endif %}" onclick="setSearchType('author')">Author</button>
{% else %}
<button type="button" class="btn btn-toggle btn-journal {% if type == 'journal' %}active{% endif %}" onclick="setSearchType('journal')">Journal</button>
<button type="button" class="btn btn-toggle btn-author {% if type == 'author' %}active{% endif %}" onclick="setSearchType('author')">Author</button>
{% endif %}
</div>
<!-- Hidden Input to Track Search Type -->
<input type="hidden" name="searchOption" id="searchType" value="{{ type }}" data-route="{{ app.request.attributes.get('_route') }}" />
<!-- Search Input -->
<div class="input-group">
<input
type="text"
required
class="form-control search-input"
name="searchValue"
id="search-0"
placeholder="{% if type == 'author' %}Author name{% else %}Full title, words, ISSN{% endif %}"
value="{{ search }}"
/>
<div class="input-group-append">
<button type="submit" class="btn btn-primary search-btn" id="form-search-submit">Search</button>
</div>
{% if app.user %}
<div class="input-group-append input-group-advanced">
<a class="btn btn-primary advanced-btn" aria-controls="collapseOne" data-toggle="collapse" data-target="#search-form-advanced" aria-expanded="false"> Advanced search?</a>
</div>
{% endif %}
</div>
</form>
{% if app.user %}
<div id="search-form-advanced" class="collapse advancerefonte" style="margin-top: 1%;">
<div class="search-form-advanced px-2 px-lg-2">
<div class="close-btn-container">
<svg class="close-advanced-search" onclick="hideAdvancedSearch()" width="25" height="25" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M21.4898 25.1794L0.521973 46.1519L4.0579 49.687L25.0249 28.7154L45.9919 49.687L49.5279 46.1519L28.5601 25.1794L49.5279 4.20702L45.9919 0.671875L25.0249 21.6435L4.0579 0.671875L0.521973 4.20702L21.4898 25.1794Z" fill="#dc3545"></path>
</svg>
</div>
<form method="get" action="{{ path('advancedSearchResults') }}">
<div class="row">
<div class="col-md-12 text-center">
<h3 style="color:#3D065F !important; ">Advanced search ?</h3>
<p class="text-advanced">
Discover the perfect journal for your research by considering multiple criteria to determine the most suitable option.
</p>
</div>
</div>
<div class="row filter-1">
<div class="col-md-6 select-1 publisher-select-group">
<p class="title-advanced" style="color:#3D065F !important; ">Publisher</p>
<small>* You can search a publisher or tap the name directly</small>
<select class="form-select select-publisher choices__input" id="publisher" name="name_of_publisher">
<option>All</option>
{% for lp in listpublishers %}
<option>{{ lp.publisher }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-6 select-1 subjectarea-select-group">
<p class="title-advanced" style="color:#3D065F !important; ">Subject Area</p>
<small>* You can search a subject area or tap the name directly</small>
<select class="select-sub-area choices__input " id="subjectarea" name="subjectarea">
<option>All</option>
{% for c in categories %}
<option>{{ c['category'] }}</option>
{% endfor %}
</select>
</div>
</div><hr style="border: 1px solid #ffffff">
<div class="row filter-2 px-2">
<div class="col-md-6">
<div class="row">
<div class="col-md-6">
<p class="title-advanced mx-0 my-auto text-center" style="color:#3D065F !important; ">Open Acess</p>
</div>
<div class="col-6 col-md-3 d-flex justify-content-center align-items-center justify-md-content-start">
<label class="my-auto" for="yes">Yes</label>
<input type="radio" id="yes" value="yes" name="openAccess">
</div>
<div class="col-6 col-md-3 d-flex justify-content-center align-items-center justify-md-content-start">
<label class="my-auto" for="no">No</label>
<input type="radio" id="no" value="no" name="openAccess">
</div>
</div>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-6 mt-4 mt-md-0">
<p class="title-advanced title-advanced-quartile mx-0 my-auto text-left mt-4 mt-md-0" style="color:#3D065F !important; ">Quartille</p>
</div>
<div class="col-md-6 d-flex justify-content-center align-items-center justify-md-content-start">
<div class="px-0 w-100 text-center text-md-left">
<label for="q1" class="q1">Q1</label>
<input type="radio" id="q1" value="Q1" name="quartile">
<br>
<label for="q3">Q3</label>
<input type="radio" id="q3" value="Q3" name="quartile">
</div>
<div class="px-0 w-100 text-center text-md-left">
<label for="q2">Q2</label>
<input type="radio" id="q2" value="Q2" name="quartile">
<br>
<label for="q4">Q4</label>
<input type="radio" id="q4" value="Q4" name="quartile">
</div>
</div>
</div>
</div>
</div><hr style="border: 1px solid #ffffff">
<div class="row filter-1 advanced-new">
<div class="col-md-12">
<h5 class="text-advanced mb-3"> You can also search <br>by the journal's Country or the impact indicator H-index.
<span><img src="{{ asset('assets/images/refonte/new.png') }}"></span>
</h5>
</div>
<div class="col-md-5 select-1 country-select-group">
<p class="title-advanced" style="color:#3D065F !important; ">Countries</p>
<small>* You can search a country </small>
<select class="form-select select-country" id="country" name="country">
<option>All</option>
{% for c in listcountries %}
<option value="{{ c['country'] }}">{{ c['country'] }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-5 offset-md-1 hindex-select-group">
<p class="title-advanced" style="color:#3D065F !important; ">H-Index</p>
<small>* You can also filter by Journal H-index</small><br>
<div class="row">
<div class="col-md-3 choices-signs">
<select class="select-signhindex form-select" id="signhindex" name="signhindex">
<option value=">">></option>
<option value="<"><</option>
<option value="=">=</option>
</select>
</div>
<div class="col-md-9 form-group">
<input type="number" name="hindex" class="form-control">
</div>
</div>
</div>
</div>
<div class="d-flex justify-content-center mt-5 btn-search-block">
<input type="submit" value="Search" class=" btn btn-block search-btn">
</div>
</form>
</div>
</div>
{% endif %}
<!-- Advanced Search Link -->
</div>
</div>
</div>
{% block javascripts %}
<script>
// for btn submit form-search-submit check if the search input is not empty
document.getElementById('form-search-submit').addEventListener('click', function (e) {
const searchInput = document.getElementById('search-0');
if (searchInput.value.trim() === '') {
e.preventDefault();
searchInput.focus();
// show the error message in title attribute
searchInput.setAttribute('title', 'Please enter a search term');
}else{
// submit the form
document.querySelector('.search-bar').submit();
}
});
document.addEventListener('DOMContentLoaded', function () {
const searchTypeInput = document.getElementById("searchType");
const searchInput = document.getElementById("search-0");
const route = "{{ app.request.attributes.get('_route') }}";
if (route === "get_authors") {
searchTypeInput.value = "author";
searchInput.placeholder = "Author name";
} else if (route === "journalSearch") {
searchTypeInput.value = "journal";
searchInput.placeholder = "Full title, words, ISSN";
}
});
function setSearchType(type) {
const searchTypeInput = document.getElementById("searchType");
searchTypeInput.value = type;
const journalButton = document.querySelector(".btn-toggle:nth-child(1)");
const authorButton = document.querySelector(".btn-toggle:nth-child(2)");
if (type === "journal") {
journalButton.classList.add("active");
authorButton.classList.remove("active");
} else {
authorButton.classList.add("active");
journalButton.classList.remove("active");
}
// Update placeholder dynamically
const searchInput = document.getElementById("search-0");
searchInput.placeholder = type === "author" ? "Author name" : "Full title, words, ISSN";
}
function hideAdvancedSearch() {
// Hide the advanced search section
const advancedSearchDiv = document.getElementById('search-form-advanced');
advancedSearchDiv.classList.remove('show'); // Collapse the Bootstrap collapse element
window.scrollTo(0, 0);
// Optional: Reset the search bar's margin-top if you added styles dynamically
const searchBar = document.querySelector('.search-bar');
if (searchBar) {
searchBar.style.marginTop = '0'; // Reset margin
}
// Restore the background dimming to normal
document.querySelector('.advancerefonte::before').style.display = 'none';
}
</script>
{% endblock %}