<%@ LANGUAGE = JavaScript %>
<% /*
     $Revision$
     $Id$
*/ %>

<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/iface.inc" -->
<!-- #include file="../Shared/plaatsselector.inc" -->
<!-- #include file="../Shared/persoonselector.inc" -->
<!-- #include file="../Shared/selector.inc" -->
<!-- #include file="alg.inc" -->

<%
FCLTHeader.Requires({ plugins:["jQuery", "kenmerk"] });

var ins_score_enabled = S("ins_score_enabled") == 1;
var locatie_key = getQParamInt("locatie_key", -1); // Locatie
var gebouw_key = getQParamInt("gebouw_key", -1); // Gebouw
var srtgebouw_key = getQParamInt("gebouw_func", -1); // Gebouwfunctie
var verantw_key = getQParamInt("verantw", -1); // Gebouw verantwoordelijke
var verantw_key2 = getQParamInt("verantw2", -1); // Gebouw verantwoordelijke 2
var autosearch = getQParamInt("autosearch", 0) == 1;
var alg_startlevel = getQParamInt("alg_startlevel", 2); // Startlevel van plaatsselector, default Locatie
var cnt_full = getQParamInt("cnt_full", 1);
var authparams = alg.checkAutorisation();
var this_alg = alg.func_enabled(gebouw_key);
%>

<html>
  <head>
    <%  FCLTHeader.Generate(); %>
      <script type="text/javascript">
          function doSubmit()
            {
                // Submitten met kenmerken
                doSubmitWithKenmerken();
            }

        async function myModal(init)
        {
          var lvl = "G";
          var key = 0;
          var bld_key = "";
          var url = "load_kenmerk.asp?disc="
                                  + "&urole=bo"
                                  + "&advanced=1"
                                  + "&hasFilter=1"
                                  + "&onrgoed_key=" + bld_key
                                  + "&onrgoed_niveau=" + lvl;
          var titel = L("lcl_properties");
          await showKenmerkModal(url, titel, init)
        }

          $(function() {<% if (autosearch) { %> document.forms.u2.submit(); <%}%> });
      </script>
  </head>
  <body id="searchbody">
    <form name="u2" target="workFrame" action="alg_gebouw_search_list.asp" method="get">
      <% SEARCH_PAGE_START({ header: L("lcl_filterblok") });
      SEARCH_BLOCK_START();
%>
          <input type="hidden" id="cnt_full" name="cnt_full" value="<%=cnt_full%>">
<%
                  FCLTplaatsselector(authparams.ALGreadlevel, {
                                                                locatiekey: locatie_key,
                                                                gebouwkey: gebouw_key,
                                                                startlevel: alg_startlevel, // locatie
                                                                eindlevel: 2, // locatie
                                                                whenEmpty: L("lcl_search_generic")
                                                              });
%>
              <tr class="primsearch">
                <td class="label"><label for="bld_code"><%=L("lcl_estate_gebouw_man_code")%></label></td>
                <td><input type="text" class="fld" id="bld_code" name="bld_code" value=""></td>
              </tr>
              <tr class="primsearch">
                <td class="label"><label for="bld_name"><%=L("lcl_estate_gebouw_man_name")%></label></td>
                <td><input type="text" class="fld" id="bld_name" name="bld_name" value=""></td>
              </tr>
              <!-- Vervallen objecten -->
              <tr class="primsearch">
                <td></td>
                <td align=left>
                  <input type="checkbox" class="fld" name="expAlgIncl" id="expAlgIncl" value="1" >
                  <label for="expAlgIncl"><%=L("lcl_alg_gebouw_vervallen_incl")%></label>
                </td>
              </tr>
          <% SEARCH_BLOCK_END();
          SEARCH_BLOCK_START();
          sql = "SELECT alg_srtgebouw_key"
                + ", "+lcl.xsqla('alg_srtgebouw_omschrijving', 'alg_srtgebouw_key')
                + "  FROM alg_srtgebouw"
                + " WHERE alg_srtgebouw_verwijder IS NULL"
                + " ORDER BY UPPER("+lcl.xsql('alg_srtgebouw_omschrijving', 'alg_srtgebouw_key')+")";
              FCLTselector("srt",
                           sql,
                           { initKey: srtgebouw_key,
                             label: L("lcl_estate_gebouw_srtgebouw"),
                             trclass: "primsearch",
                             emptyOption: ""
                           });
%>            <!-- gebouw groeperingskenmerk -->
                <tr class="primsearch">
                  <td class="label"><label for="bld_groep"><%=L("lcl_estate_gebouw_groepkenmerk")%></label></td>
                  <td><input type="text" class="fld" id="bld_groep" name="bld_groep" value=""></td>
                </tr>

              <!-- Gebouw verantwoordelijke -->
<%            // Dit veld is alleen zichtbaar indien er minimaal één gebouwverantwoordelijke geconfigureerd is (suppressNoValues).
              FCLTpersoonselector("verantw",
                                  "sgVerantw",
                                  { perslidKey: verantw_key,
                                    label: L("lcl_alg_bld_verantw"),
                                    filtercode: "GV", // Gebouw Verantwoordelijke
                                    trclass: "primsearch",
                                    suppressNoValues: true,
                                    whenEmpty: L("lcl_search_generic")  // want filter
                                  });
%>
                <tr class="primsearch">
                  <td class="label"><label for="bld_email"><%=L("lcl_alg_gebouw_email")%></label></td>
                  <td><input type="text" class="fld" id="bld_email" name="bld_email" value=""></td>
                </tr>
<%
              if (ins_score_enabled)
              { // Conditiescore
%>              <tr class="primsearch fldfitness_score" id="fitness_score">
                  <td>
                    <table width="100%">
                      <tr>
                        <td class="label">
                        <label for="show_fitness_score_from"><%=L("lcl_mjb_fitness_score")%></label>
                        </td>
                        <td style="text-align: right">
                          <%=L("lcl_mjb_from")%>
                        </td>
                      </tr>
                    </table>
                  </td>
                  <td class="score">
                    <input type="text"
                           onChange="fvalid=checkKenmerk(this, false, 'N', 1, 1, 1, 6)"
                           onBlur="checkKenmerk(this, true, 'N', 1, 1, 1, 6)"
                           id="fitness_score1_from"
                           name="fitness_score1_from"
                           class="fldshort number "
                           value=""
                           maxlength="3">
                    &nbsp;<%=L("lcl_mjb_through")%>&nbsp;
                    <input type="text"
                           onChange="fvalid=checkKenmerk(this, false, 'N', 1, 1, 1, 6)"
                           onBlur="checkKenmerk(this, true, 'N', 1, 1, 1, 6)"
                           id="fitness_score1_through"
                           name="fitness_score1_through"
                           class="fldshort number "
                           value=""
                           maxlength="3">
                  </td>
                </tr>
<%            } %>
<%      SEARCH_BLOCK_END();
        SIMPLE_BLOCK_START();
          var buttons = [ {title: L("lcl_overview_list"), action: "doSubmit()", id: "bSearch", importance: 1, icon: "fa-clipboard-list" }
                        , {title: L("lcl_shared_advanced"), action: "myModal()", id: "bAdvanced", importance: 3, icon: "fa-filter" }
                        ];
          CreateButtons(buttons, { entersubmit: true, showIcons: true });
        SIMPLE_BLOCK_END();
        SEARCH_PAGE_END(); %>
      </form>

    <div id="result">
      <iframe width="100%" height="100%"
              src="../Shared/empty.asp"
              name="workFrame" id="workFrame"
              onload="FcltMgr.iframeLoaded(this)"
              frameborder="0" scrolling="no">
      </iframe>
    </div>
  </body>
</html>
<% ASPPAGE_END(); %>
