templates\_partial\topnav.html.twig line 1

Open in your IDE?
  1. <nav class="sb-topnav navbar navbar-expand navbar-dark bg-dark d-flex justify-content-start">
  2.     <!-- Sidebar Toggle-->
  3.     <button class="btn btn-link btn-sm order-0 me-0" id="sidebarToggle" href="#!">
  4.         <i class="fas fa-bars"></i>
  5.     </button>
  6.     <!-- Navbar Brand-->
  7.     <a class="navbar-brand ps-0 align-self-stretch" href="{{ path('home-index') }}">{{ FIRMA_ADI }}</a>
  8.     {% if not is_granted('IS_AUTHENTICATED_FULLY') %}
  9.         <a class="btn btn-light align-self-end text-nowrap" href="{{ path('auth-login') }}" title="Oturum Aç">
  10.             <i class="fas fa-sign-in-alt"></i> Oturum Aç
  11.         </a>
  12.     {% endif %}
  13.     <div class="row w-100 px-3 fw-bold">
  14.         <div class="col text-light text-nowrap">{% if app.user %}
  15.                 <select class="form-select w-auto" style="cursor: pointer" onchange="firmaChange(event)">
  16.                     {% for firma in app.session.get('AltFirmalar', []) %}
  17.                         <option value="{{ firma.FIRMAKODU }}"{{ firma.FIRMAKODU==app.session.get('AktifFirma') ? ' selected': '' }}>
  18.                             {{ firma.UNVAN2 }}
  19.                         </option>
  20.                     {% endfor %}
  21.                 </select>
  22.             {% endif %}
  23.         </div>
  24.         <div class="btn d-none d-sm-inline col text-end py-0 my-0">
  25.         <a class="btn py-0 my-0"
  26.            href="http://foodsoft.com.tr" target="_blank"><img src="{{ asset('img/foodsoft-dijital.png') }}" alt="Foodsoft Dijital Logo"></a>
  27.         </div>
  28.     </div>
  29.     <script>
  30.         function firmaChange(e) {
  31.             e.preventDefault();
  32.             e.target.disabled = true;
  33.             let cariKodu = e.target.value;
  34.             console.log(cariKodu);
  35.             axios.get('/api/config/firma-degistir/' + cariKodu)
  36.                 .then(response => {
  37.                     try {
  38.                         if (!response.data.result) {
  39.                             console.log("Hatalı firma değişimi", response.data)
  40.                             throw "Hatalı firma değişimi!";
  41.                         }
  42.                         window.location.reload();
  43.                     } catch (error) {
  44.                         console.log(error)
  45.                         alert("Hatalı firma değişimi:\n" + error);
  46.                     }
  47.                 })
  48.                 .catch(error => {
  49.                     console.log(error)
  50.                     alert("Firma değişimi sırasında hata oluştu:\n" + error);
  51.                 })
  52.             return false;
  53.         }
  54.     </script>
  55. </nav>