templates/jobOffer/content.html.twig line 11

Open in your IDE?
  1. {% if is_granted('ROLE_ADMIN') == true %} {% set base = 'base.html.twig' %}
  2. {% elseif is_granted('ROLE_ENTREPRISE') == true %} {% set base = 'base_company.html.twig' %}
  3. {% elseif is_granted('ROLE_DIPLOME') == true %} {% set base = 'base_degree.html.twig' %}
  4. {% elseif is_granted('ROLE_ETABLISSEMENT') == true %} {% set base = 'base_school.html.twig' %}
  5. {% elseif is_granted('ROLE_PRINCIPAL') == true %} {% set base = 'base_principal.html.twig' %}
  6. {% elseif is_granted('ROLE_LEGISLATEUR') == true %} {% set base = 'base_legislator.html.twig' %}
  7. {% elseif is_granted('ROLE_DIRECTEUR') == true %} {% set base = 'base_legislator.html.twig' %}
  8. {% else %} {% set base = 'base.html.twig' %}
  9. {% endif %}
  10. {% extends base %}
  11. {% block title %}
  12.   {{ parent() }}  {{ 'menu.country' | trans }}
  13. {% endblock %}
  14. {#{% block navigation %}#}
  15.     {#<li class="breadcrumb-item"><span>Pays</span></li>#}
  16. {#{% endblock %}#}
  17. {% block js %}
  18.    <script>
  19.       // $(document).ready(function () {
  20.       //    let translations = [];
  21.       //    getTranslation().then (function (translation) {
  22.       //       translations = translation;
  23.       //       // $("#appbundle_joboffer_country").prepend("<option value='' selected='selected'>" + translations['js.select'] + "</option>");
  24.       //    });
  25.       // });
  26.    </script>
  27.   <script>
  28.      // Event
  29.      // $(document).on('change', '#appbundle_joboffer_country, #appbundle_joboffer_region', function () {
  30.      //    // alert("test")
  31.      //    let $field = $(this)
  32.      //    let $regionField = $('#appbundle_joboffer_country')
  33.      //    let $form = $field.closest('form')
  34.      //    let target = '#' + $field.attr('id').replace('region', 'city').replace('country', 'region')
  35.      //    // Les données à envoyer en Ajax
  36.      //    let data = {}
  37.      //    data[$regionField.attr('name')] = $regionField.val()
  38.      //    data[$field.attr('name')] = $field.val()
  39.      //    // On soumet les données
  40.      //    $.post($form.attr('action'), data).then(function (data) {
  41.      //       // On récupère le nouvmeeau <select>
  42.      //       let $input = $(data).find(target)
  43.      //       // On remplace notre <select> actuel
  44.      //       $(target).replaceWith($input)
  45.      //    })
  46.      // });
  47.      // Event
  48.      // Country -> Region -> City
  49.      // if($('#appbundle_joboffer_prefecture').length) {
  50.      //    listenChangeCountryRegion('#appbundle_joboffer_country', '#appbundle_joboffer_region', 'country', 'region', 'addressCity');
  51.      // }
  52.      // // Event
  53.      // // Region -> Prefecture -> City
  54.      // else {
  55.         listenChangeRegionPrefecture('#appbundle_joboffer_country', '#appbundle_joboffer_region', '#appbundle_joboffer_prefecture', '#appbundle_joboffer_city');
  56.      // }
  57.      if($('#countryId').val) {
  58.         let countryId = $('#countryId').val();
  59.         if(!$('#appbundle_joboffer_country').val()) {
  60.            $('#appbundle_joboffer_country option[value=' + countryId + ']').prop('selected', true);
  61.            $('#appbundle_joboffer_country').trigger('change');
  62.         }
  63.      }
  64.      $(document).on('change', '#appbundle_joboffer_sectorArea', function () {
  65.         let $field = $(this)
  66.         let $sectorAreaField = $('#appbundle_joboffer_sectorArea')
  67.         let $form = $field.closest('form')
  68.         let target = '#' + $field.attr('id').replace('sectorArea', 'activity')
  69.         // Les données à envoyer en Ajax
  70.         let data = {}
  71.         data[$sectorAreaField.attr('name')] = $sectorAreaField.val()
  72.         // On soumet les données
  73.         $.post($form.attr('action'), data).then(function (data) {
  74.            // On récupère le nouvmeeau <select>
  75.            let $input = $(data).find(target)
  76.            // On remplace notre <select> actuel
  77.            $(target).replaceWith($input)
  78.         })
  79.      })
  80.   </script>
  81. {% endblock %}