<!-- $Id: buttons_places.txt v7.1 12/01/2023 18:54:37 $ -->
<!-- Copyright (c) 1998-2007 INRIA -->
%( Boutons de configurations et d'options %)

<form class="form-group mx-1" name="evt_url" method="get" action="%action;">
  <input type="hidden" name="m" value="PPS">
  <div class="form-inline">
    <label class="sr-only" for="k">[*place] (k)</label>
    <input type="search" class="form-control col-4 ml-2" name="k"
      id="k" value="%evar.k;"
      placeholder="%if;(evar.k!="")%evar.k;%else;[*place]%end;">
  </div>
  <div class="form-inline mt-1">
    <div class="form-group w-100">
      <span>[*event/events]1[:]</span>
      <div class="custom-control custom-checkbox ml-2">
        <input type="checkbox" class="custom-control-input" name="bi"
          onclick="test_all()" id="bi" value="on"
          %if;(evar.bi!="" and evar.bi="on") checked%end;>
        <label class="custom-control-label" title="[*birth place]"
          for="bi">[*birth]</label>
      </div>
      <div class="custom-control custom-checkbox ml-2">
        <input type="checkbox" class="custom-control-input" name="ba"
          onclick="test_all()" id="ba" value="on"
          %if;(evar.ba!="" and evar.ba="on") checked%end;>
        <label class="custom-control-label" title="[*baptism place]"
          for="ba">[*baptism]</label>
      </div>
      <div class="custom-control custom-checkbox ml-2">
        <input type="checkbox" class="custom-control-input" name="ma"
          onclick="test_all()" id="ma" value="on"
          %if;(evar.ma!="" and evar.ma="on") checked%end;>
        <label class="custom-control-label" title="[*marriage place]"
          for="ma">[*marriage/marriages]0</label>
      </div>
      <div class="custom-control custom-checkbox ml-2">
        <input type="checkbox" class="custom-control-input" name="de"
          onclick="test_all()" id="de" value="on"
          %if;(evar.de!="" and evar.de="on") checked%end;>
        <label class="custom-control-label" title="[*death place]"
          for="de">[*death]</label>
      </div>
      <div class="custom-control custom-checkbox ml-2">
        <input type="checkbox" class="custom-control-input" name="bu"
          onclick="test_all()" id="bu" value="on"
          %if;(evar.bu!="" and evar.bu="on") checked%end;>
        <label class="custom-control-label" title="[*burial place]"
          for="bu">[*burial]</label>
      </div>
      <div class="custom-control custom-checkbox ml-4">
        <input type="checkbox" class="custom-control-input" name="all"
          id="all" value="on"
          %if;((evar.bi!="" and evar.bi="on") and
          (evar.ba!="" and evar.ba="on") and
          (evar.ma!="" and evar.ma="on") and
          (evar.de!="" and evar.de="on") and
          (evar.bu!="" and evar.bu="on")) checked%end;>
        <label class="custom-control-label" title="[*all]"
          for="all">[*all]</label>
      </div>
    </div>
    <div class="form-group">
      <span>[*matching][:]</span>
      <div class="custom-control custom-checkbox ml-4">
        <input type="checkbox" class="custom-control-input" name="word"
          id="word" value="on"
          %if;(evar.word!="" and evar.word="on") checked%end;>
        <label class="custom-control-label" title="[*word match title]"
          for="word">[*word match]</label>
      </div>
      <div class="custom-control custom-checkbox ml-4">
        <input type="checkbox" class="custom-control-input" name="lower"
          id="lower" value="on"
          %if;(evar.lower!="" and evar.lower="on") checked%end;>
        <label class="custom-control-label" title="[*case sensitive title]"
          for="lower">[*case sensitive]</label>
      </div>
      <div class="custom-control custom-checkbox ml-4">
        <input type="checkbox" class="custom-control-input" name="any"
          id="any" value="on"
          %if;(evar.any!="" and evar.any="on") checked%end;>
        <label class="custom-control-label" title="[*any place title]"
          for="any">[*any place]</label>
      </div>
      <input type="text" class=" ml-4" size="2"
        name="max_rlm_nbr" id="max_rlm_nbr" 
        placeholder=%if;(evar.max_rlm_nbr!="")"%evar.max_rlm_nbr;"
          %elseif;(bvar.max_rlm_nbr!="")"%bvar.max_rlm_nbr;"
          %else;"80"%end;>
      <label class="label ml-1" title="[*max nbr title]">[*max nbr]</label>
      %if;(evar.display="long")<input type="hidden" name="display" id="display" value="long">%end;
      <button type="submit" class="btn btn-primary btn-sm ml-4"
        title="[*search/case sensitive]0 [surname/surnames]1 /
          [places] [and] [event/events]1">
        <i class="fa fa-search mr-2"></i>Search
      </button>
    </div>
  </div>
</form>
<div class="d-flex">
  <div>
      <a href="%url_set.k;"
        title="[*all the places]">%nn;
      [*all the places]</a>
  </div>
  <div class="ml-4" >
  <a role="button" class="ml-auto"
    href="%url_set3.a_sort.f_sort.up;%nn;
      &f_sort=on%if;(e.up!="on")&up=on%end;"
      %sp;title="[*sort by/branch/alphabetic order]0 [frequency]">
      <i class="fas fa-sort-%if;(e.up!="on")amount-down%else;amount-up%end;%sp;
        fa-lg"></i>%nn;
  </a>%nn;
  <a role="button" class="ml-auto"
    href="%url_set3.a_sort.f_sort.up;%nn;
      %if;(e.a_sort!="on")&a_sort=on%end;"
      %sp;title="[*sort by/branch/alphabetic order]0
        [sort by/branch/alphabetic order]2">
      <i class="fas fa-sort-%if;(e.a_sort!="on")alpha-up%else;alpha-down%end;%sp;
        fa-lg"></i>%nn;
  </a>%nn;
  %let;ekeep;%if(e.keep="")1%else;%e.keep;%end;%in;
  %if;(e.display!="long")
    <span class="ml-2 mr-2" title="[*place filter]">[*filter][:]</span>
    <a role="button" class="btn-link ml-auto
      %if;( ekeep="" or ekeep<2) disabled text-muted%end;"
      href="%url_set.keep;&keep=%if;(ekeep!="")%expr(ekeep-1)%else;1%end;"
      title="[*place filter]">
      <i class="fas fa-minus fa-lg"></i>
    </a>
    <span title="[*place filter]">%if;(e.keep="")1%else;%e.keep;%end;</span>
    <a role="button" class="ml-auto"
      href="%url_set.keep;&keep=%if;(ekeep!="")%expr(ekeep+1)%else;1%end;"
      title="[*place filter]">
      <i class="fas fa-plus fa-lg"></i>
    </a>
  %end;
  </div>
</div>
<script>

function toggle (btn, state) {
  if (state) 
    { document.getElementById(btn).setAttribute( "value", "on") ;
      document.getElementById(btn).checked = true; }
  else
    { document.getElementById(btn).setAttribute( "value", "") ;
      document.getElementById(btn).checked = false; } ;
};

function test_all () {
  var bi = document.getElementById("bi").checked;
  var bp = document.getElementById("ba").checked;
  var ma = document.getElementById("ma").checked;
  var de = document.getElementById("de").checked;
  var bu = document.getElementById("bu").checked;
  var state = bi && bp && ma && de && bp;
  document.getElementById("all").checked = state;
};

document.getElementById("all").onclick = function() {
  var state = document.getElementById("all").checked ;
  toggle ("bi", state) ;
  toggle ("ba", state) ;
  toggle ("ma", state) ;
  toggle ("de", state) ;
  toggle ("bu", state) ;
};
</script>
