<%@language = "javascript" %>
<%
/*  $Revision$
    $Id$

    File:         alg_show_wp.asp
    Status:       99%
    Description:  details van geselecteerde werkplek
    Parameters:   wp_key


    Context:
    Note:

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

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

var wp_key  = getQParamInt("wp_key", "-1");
var loc_key;
var bld_key;
var flr_key;
var room_key;

var authparams = alg.checkAutorisation();

var sql = "SELECT *"
        + "  FROM prs_werkplek "
        + " WHERE prs_werkplek_key = " + wp_key;
var oRs = Oracle.Execute(sql);
var wp_volgnr = oRs("prs_werkplek_volgnr").value;
var wp_oms    = oRs("prs_werkplek_omschrijving").value;
var wp_vstopp = oRs("prs_werkplek_vastopp").value;
var wp_opp    = oRs("prs_werkplek_opp").value;
var wp_vstopp = oRs("prs_werkplek_vastopp").value;
var wp_virt   = oRs("prs_werkplek_virtueel").value;
var room_key  = oRs("prs_alg_ruimte_key").value;
var wp_type   = oRs("PRS_WERKPLEK_TYPE").value;
oRs.Close();

var wp_typ_str = (wp_type == 1 ? L("lcl_wptype_1") : L("lcl_wptype_0"));
%>

<html>
  <head>
<%  FCLTHeader.Generate(); %>
    <script type="text/javascript">
      function wp_change()
      {
          if (FcltMgr.startEdit(window))
              window.location.href = "alg_edit_wp.asp?wp_key=<%=wp_key%>"
      }
      function wp_delete()
      {
         var wp_key = <%=wp_key%>;
         FcltMgr.confirm(L("lcl_alg_del_txt_werkplek"), function() {
             var data = {
                 key: <%=wp_key%>,
                 level: "W"
             };
             <% protectRequest.dataToken("data"); %>
             $.post("alg_delete.asp",
                 data,
                 FcltCallbackClose,
                 "json");
         });
      }
    </script>
  </head>

  <body class="showmode">
  <% SUBFRAME_START(); %>
<%  var buttons = [];
    if (alg.canWriteRuimte(room_key, authparams.rmALGwritelevel)) // ALGUSE schrijfrechten nodig
    {
    var buttons =  [ {title: L("lcl_change"), action:"wp_change()", icon: "fa-fclt-edit" },
                     {title: L("lcl_delete"), action:"wp_delete()", icon: "fa-trash-alt" } ];
    }
    IFRAMER_HEADER(L("lcl_alg_wp_frame"), buttons);
%>
      <form name=u2 onSubmit="return false;">
<%      BLOCK_START("algInfo", L("lcl_alg_wp_frame"), {icon: "fa-map-pin"});
        FCLTplaatsselector(authparams.ALGreadlevel,
                           { locatie: loc_key,
                             gebouwkey: bld_key,
                             verdiepingkey: flr_key,
                             ruimtekey: room_key,
                             startlevel: 2, // Regio
                             eindlevel: 5, // District
                             readonly: true });
        ROFIELDTR("fld", L("lcl_estate_wp_seq"), wp_volgnr, {suppressEmpty: true});
        ROFIELDTR("fld", L("lcl_workplace"), wp_oms, {suppressEmpty: true});
%>      <tr>
          <td class="label"><label for="wp_vstopp_v"><%=L("lcl_estate_wp_fixed")%></label></td>
          <td>
            <label for="wp_vstopp_v">
              <input type="radio" name="wp_vstopp_v" id="wp_vstopp_v" value="" <%= wp_vstopp==null ? " checked " : "" %> disabled><%=L("lcl_estate_wp_fixed_v")%>
            </label>
            <label for="wp_vstopp_f">
              <input type="radio" name="wp_vstopp_v" id="wp_vstopp_f" value="1"<%= wp_vstopp==1 ? " checked " : "" %> disabled><%=L("lcl_estate_wp_fixed_f")%>
            </label>
          </td>
        </tr>
<%      ROFIELDTR("fld", L("lcl_estate_wp_area"), wp_opp, {suppressEmpty:true, datatype: "float"});
        if (wp_virt==1)
            CHECKBOXTR(L("lcl_estate_wp_virt"), "fldalgbez", "wp_virt", wp_virt, { suppressEmpty:true, html: " disabled" });

        ROFIELDTR("wp_type",      L("lcl_wptype"),     wp_typ_str);
%>
        </table>
<%      BLOCK_END();
%>
      </form>
    <% SUBFRAME_END(); %>
  </body>
</html>
<% ASPPAGE_END(); %> 
