templates/refonte/pages/parts/search-form.html.twig line 1

Open in your IDE?
  1. {% set type = app.request.get('searchOption', 'journal') %}
  2. {% if app.request.attributes.get('_route') in  ['get_authors','get_authors_publication'] %}
  3.     {% set type = 'author' %}
  4. {% endif %}
  5. {% set search = app.request.get('searchValue', '') %}
  6. {% if app.request.get('auteur') %}
  7.     {% set search = app.request.get('auteur', '') %}
  8. {% elseif app.request.get('authorValue') %}
  9.     {% set search = app.request.get('authorValue', '') %}
  10. {% endif %}
  11. {% set listpublishers = publicationManager.advancedData['publishers'] %}
  12. {% set listcategories = publicationManager.advancedData['categories'] %}
  13. {% set listcountries = publicationManager.advancedData['countries'] %}
  14. {% set categories = publicationManager.advancedData['categories2'] %}
  15. {% set description =
  16.     "Discover the optimal Journal based on multiple criteria or locate authors along with their published articles and the corresponding Journals"
  17. %}
  18. <div class="search-section refonte">
  19.     <div class="container flashes-msg" style="text-align: center;height: auto;">
  20.         {% for message in app.flashes('success') %}
  21.             <div class="alert alert-success alert-dismissible alert-success-journal w-100 mx-auto d-flex p-2 mb-4" role="alert">
  22.                 <span class="">{{ message|raw }}</span>
  23.                 <span type="button" class="close position-static ml-auto" data-dismiss="alert" aria-label="Close" style="padding: 0 !important;"><span aria-hidden="true">&times;</span></span>
  24.             </div>
  25.         {% endfor %}
  26.         {% for message in app.flashes('warning') %}
  27.             <div class="alert alert-warning alert-dismissible alert-warning-journal w-100 mx-auto d-flex p-2 mb-4" role="alert">
  28.                 <span class="">{{ message|raw }}</span>
  29.                 <span type="button" class="close position-static ml-auto" data-dismiss="alert" aria-label="Close" style="padding: 0 !important;"><span aria-hidden="true">&times;</span></span>
  30.             </div>
  31.         {% endfor %}
  32.         {% for message in app.flashes('error') %}
  33.             <div class="alert alert-error alert-dismissible alert-error-journal w-100 mx-auto d-flex p-2 mb-4" role="alert">
  34.                 <span class="">{{ message|raw }}</span>
  35.                 <span type="button" class="close position-static ml-auto" data-dismiss="alert" aria-label="Close" style="padding: 0 !important;"><span aria-hidden="true">&times;</span></span>
  36.             </div>
  37.         {% endfor %}
  38.     </div>
  39.     <img style="    position: absolute;
  40.     right: 169px;
  41.     bottom: 1px;
  42.     height: calc(97% - 114px);
  43. " src="{{ asset('assets/images/illustration-stars.svg') }}" alt="Illustration" class="illustration"/>
  44.     <div class="container text-left position-relative">
  45.         <div class="content">
  46.             <h1 class="title">{{appName | replace({'\"':''})}} <br /> Empowering <br />Scientific Collaboration</h1>
  47.             <p class="description">
  48.                 {{appName | replace({'\"':''})}} is an inclusive ecosystem empowering scientific collaboration and knowledge sharing. <br>
  49.                 It connects researchers, institutions, and corporations to explore literature, access funding, forge partnerships, and publish impactful research outcomes, streamlining the management of research activities.
  50.             </p>
  51.             <form method="get" action="{{ url('data_search_by_several_values') }}" class="search-bar">
  52.                 <!-- Toggle Buttons -->
  53.                 <div class="btn-group toggle-options" role="group">
  54.                     {% if app.request.attributes.get('_route') == 'journalSearch' %}
  55.                     <button type="button" class="btn btn-toggle btn-journal {% if type == 'journal' %}active{% endif %}" onclick="setSearchType('journal')">Journal</button>
  56.                     {% elseif app.request.attributes.get('_route') == 'get_authors' and app.request.get('authorValue') is null  %}
  57.                     <button type="button" class="btn btn-toggle btn-author {% if type == 'author' %}active{% endif %}" onclick="setSearchType('author')">Author</button>
  58.                     {% else %}
  59.                     <button type="button" class="btn btn-toggle btn-journal {% if type == 'journal' %}active{% endif %}" onclick="setSearchType('journal')">Journal</button>
  60.                     <button type="button" class="btn btn-toggle btn-author {% if type == 'author' %}active{% endif %}" onclick="setSearchType('author')">Author</button>
  61.                     {% endif %}
  62.                 </div>
  63.                 <!-- Hidden Input to Track Search Type -->
  64.                 <input type="hidden" name="searchOption" id="searchType" value="{{ type }}" data-route="{{ app.request.attributes.get('_route')  }}" />
  65.                 <!-- Search Input -->
  66.                 <div class="input-group">
  67.                     <input
  68.                             type="text"
  69.                             required
  70.                             class="form-control search-input"
  71.                             name="searchValue"
  72.                             id="search-0"
  73.                             placeholder="{% if type == 'author' %}Author name{% else %}Full title, words, ISSN{% endif %}"
  74.                             value="{{ search }}"
  75.                     />
  76.                     <div class="input-group-append">
  77.                         <button type="submit" class="btn btn-primary search-btn" id="form-search-submit">Search</button>
  78.                     </div>
  79.                     {% if app.user %}
  80.                     <div class="input-group-append input-group-advanced">
  81.                         <a class="btn btn-primary advanced-btn" aria-controls="collapseOne"  data-toggle="collapse" data-target="#search-form-advanced"  aria-expanded="false"> Advanced search?</a>
  82.                     </div>
  83.                     {% endif %}
  84.                 </div>
  85.             </form>
  86.             {% if app.user %}
  87.                     <div id="search-form-advanced" class="collapse advancerefonte" style="margin-top: 1%;">
  88.                         <div  class="search-form-advanced px-2 px-lg-2">
  89.                             <div class="close-btn-container">
  90.                                 <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">
  91.                                     <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>
  92.                                 </svg>
  93.                             </div>
  94.                             <form method="get" action="{{ path('advancedSearchResults') }}">
  95.                                 <div class="row">
  96.                                     <div class="col-md-12 text-center">
  97.                                         <h3 style="color:#3D065F !important; ">Advanced search ?</h3>
  98.                                         <p class="text-advanced">
  99.                                             Discover the perfect journal for your research by considering multiple criteria to determine the most suitable option.
  100.                                         </p>
  101.                                     </div>
  102.                                 </div>
  103.                                 <div class="row filter-1">
  104.                                     <div class="col-md-6 select-1 publisher-select-group">
  105.                                         <p class="title-advanced" style="color:#3D065F !important; ">Publisher</p>
  106.                                         <small>* You can search a publisher or tap the name directly</small>
  107.                                         <select class="form-select select-publisher choices__input" id="publisher" name="name_of_publisher">
  108.                                             <option>All</option>
  109.                                             {% for lp in listpublishers %}
  110.                                                 <option>{{ lp.publisher }}</option>
  111.                                             {% endfor %}
  112.                                         </select>
  113.                                     </div>
  114.                                     <div class="col-md-6 select-1 subjectarea-select-group">
  115.                                         <p class="title-advanced" style="color:#3D065F !important; ">Subject Area</p>
  116.                                         <small>* You can search a subject area  or tap the name directly</small>
  117.                                         <select class="select-sub-area choices__input " id="subjectarea" name="subjectarea">
  118.                                             <option>All</option>
  119.                                             {% for c in categories %}
  120.                                                 <option>{{ c['category'] }}</option>
  121.                                             {% endfor %}
  122.                                         </select>
  123.                                     </div>
  124.                                 </div><hr style="border: 1px solid #ffffff">
  125.                                 <div class="row filter-2 px-2">
  126.                                     <div class="col-md-6">
  127.                                         <div class="row">
  128.                                             <div class="col-md-6">
  129.                                                 <p class="title-advanced mx-0 my-auto text-center" style="color:#3D065F !important; ">Open Acess</p>
  130.                                             </div>
  131.                                             <div class="col-6 col-md-3 d-flex justify-content-center align-items-center justify-md-content-start">
  132.                                                 <label class="my-auto" for="yes">Yes</label>
  133.                                                 <input type="radio" id="yes" value="yes" name="openAccess">
  134.                                             </div>
  135.                                             <div class="col-6 col-md-3 d-flex justify-content-center align-items-center justify-md-content-start">
  136.                                                 <label class="my-auto" for="no">No</label>
  137.                                                 <input type="radio" id="no" value="no" name="openAccess">
  138.                                             </div>
  139.                                         </div>
  140.                                     </div>
  141.                                     <div class="col-md-6">
  142.                                         <div class="row">
  143.                                             <div class="col-md-6 mt-4 mt-md-0">
  144.                                                 <p class="title-advanced title-advanced-quartile mx-0 my-auto text-left mt-4 mt-md-0" style="color:#3D065F !important; ">Quartille</p>
  145.                                             </div>
  146.                                             <div class="col-md-6 d-flex justify-content-center align-items-center justify-md-content-start">
  147.                                                 <div class="px-0 w-100 text-center text-md-left">
  148.                                                     <label for="q1" class="q1">Q1</label>
  149.                                                     <input type="radio" id="q1" value="Q1" name="quartile">
  150.                                                     <br>
  151.                                                     <label for="q3">Q3</label>
  152.                                                     <input type="radio" id="q3" value="Q3" name="quartile">
  153.                                                 </div>
  154.                                                 <div class="px-0 w-100 text-center text-md-left">
  155.                                                     <label for="q2">Q2</label>
  156.                                                     <input  type="radio" id="q2" value="Q2" name="quartile">
  157.                                                     <br>
  158.                                                     <label for="q4">Q4</label>
  159.                                                     <input type="radio" id="q4" value="Q4" name="quartile">
  160.                                                 </div>
  161.                                             </div>
  162.                                         </div>
  163.                                     </div>
  164.                                 </div><hr style="border: 1px solid #ffffff">
  165.                                 <div class="row filter-1 advanced-new">
  166.                                     <div class="col-md-12">
  167.                                         <h5 class="text-advanced mb-3"> You can also search <br>by the journal's Country or the impact indicator H-index.
  168.                                             <span><img src="{{ asset('assets/images/refonte/new.png') }}"></span>
  169.                                         </h5>
  170.                                     </div>
  171.                                     <div class="col-md-5 select-1 country-select-group">
  172.                                         <p class="title-advanced" style="color:#3D065F !important; ">Countries</p>
  173.                                         <small>* You can search a country </small>
  174.                                         <select class="form-select select-country" id="country" name="country">
  175.                                             <option>All</option>
  176.                                             {% for c in listcountries %}
  177.                                                 <option value="{{ c['country'] }}">{{ c['country'] }}</option>
  178.                                             {% endfor %}
  179.                                         </select>
  180.                                     </div>
  181.                                     <div class="col-md-5 offset-md-1 hindex-select-group">
  182.                                         <p class="title-advanced" style="color:#3D065F !important; ">H-Index</p>
  183.                                         <small>* You can also filter by Journal H-index</small><br>
  184.                                         <div class="row">
  185.                                             <div class="col-md-3 choices-signs">
  186.                                                 <select class="select-signhindex form-select" id="signhindex" name="signhindex">
  187.                                                     <option value=">">></option>
  188.                                                     <option value="<"><</option>
  189.                                                     <option value="=">=</option>
  190.                                                 </select>
  191.                                             </div>
  192.                                             <div class="col-md-9 form-group">
  193.                                                 <input type="number" name="hindex" class="form-control">
  194.                                             </div>
  195.                                         </div>
  196.                                     </div>
  197.                                 </div>
  198.                                 <div class="d-flex justify-content-center mt-5 btn-search-block">
  199.                                     <input type="submit" value="Search" class=" btn btn-block search-btn">
  200.                                 </div>
  201.                             </form>
  202.                         </div>
  203.                     </div>
  204.                     {% endif %}
  205.                 <!-- Advanced Search Link -->
  206.         </div>
  207.     </div>
  208. </div>
  209. {% block javascripts %}
  210.     <script>
  211.         // for btn submit form-search-submit check if the search input is not empty
  212.         document.getElementById('form-search-submit').addEventListener('click', function (e) {
  213.             const searchInput = document.getElementById('search-0');
  214.             if (searchInput.value.trim() === '') {
  215.                 e.preventDefault();
  216.                 searchInput.focus();
  217.                 // show the error message in title attribute
  218.                 searchInput.setAttribute('title', 'Please enter a search term');
  219.             }else{
  220.                 // submit the form
  221.                 document.querySelector('.search-bar').submit();
  222.             }
  223.         });
  224.         document.addEventListener('DOMContentLoaded', function () {
  225.             const searchTypeInput = document.getElementById("searchType");
  226.             const searchInput = document.getElementById("search-0");
  227.             const route = "{{ app.request.attributes.get('_route') }}";
  228.             if (route === "get_authors") {
  229.                 searchTypeInput.value = "author";
  230.                 searchInput.placeholder = "Author name";
  231.             } else if (route === "journalSearch") {
  232.                 searchTypeInput.value = "journal";
  233.                 searchInput.placeholder = "Full title, words, ISSN";
  234.             }
  235.         });
  236.         function setSearchType(type) {
  237.             const searchTypeInput = document.getElementById("searchType");
  238.             searchTypeInput.value = type;
  239.             const journalButton = document.querySelector(".btn-toggle:nth-child(1)");
  240.             const authorButton = document.querySelector(".btn-toggle:nth-child(2)");
  241.             if (type === "journal") {
  242.                 journalButton.classList.add("active");
  243.                 authorButton.classList.remove("active");
  244.             } else {
  245.                 authorButton.classList.add("active");
  246.                 journalButton.classList.remove("active");
  247.             }
  248.             // Update placeholder dynamically
  249.             const searchInput = document.getElementById("search-0");
  250.             searchInput.placeholder = type === "author" ? "Author name" : "Full title, words, ISSN";
  251.         }
  252.         function hideAdvancedSearch() {
  253.             // Hide the advanced search section
  254.             const advancedSearchDiv = document.getElementById('search-form-advanced');
  255.             advancedSearchDiv.classList.remove('show'); // Collapse the Bootstrap collapse element
  256.             window.scrollTo(0, 0);
  257.             // Optional: Reset the search bar's margin-top if you added styles dynamically
  258.             const searchBar = document.querySelector('.search-bar');
  259.             if (searchBar) {
  260.                 searchBar.style.marginTop = '0'; // Reset margin
  261.             }
  262.             // Restore the background dimming to normal
  263.             document.querySelector('.advancerefonte::before').style.display = 'none';
  264.         }
  265.     </script>
  266. {% endblock %}