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

    File:           sle_show_srtdeel.asp
    Description:    show detailed information of an srtobject

    Parameters:     ins_srtdeel_key

    Context:        Vanuit ../sle_srtdeel.asp
    Note:

*/ %>
<!-- #include file="../Shared/common.inc"-->
<!-- #include file="../Shared/iface.inc"-->
<!-- #include file="../INS/ins_flexkenmerk.inc" -->
<%
FCLTHeader.Requires({plugins:["jQuery"], js: ["../Shared/kenmerk_js.asp"]})

var urole = "bo"; // eventjes voor de flex

var autfunction = ["WEB_SLEFOF", "WEB_SLEBOF"];

// De functie checkAutorisation(autfunction) geeft een Response.End indien er geen autorisatie voor autfunction wordt gevonden
var authparams = user.checkAutorisation(autfunction);
var authparamsSLEBOF = user.checkAutorisation("WEB_SLEBOF", true);

var ins_srtdeel_key = getQParamInt("ins_srtdeel_key");
var couple = getQParamInt("couple", 0) == 1;

var sql = "SELECT s.ins_srtdeel_code"
        + "     , s.ins_srtdeel_omschrijving"
        + "     , g.ins_srtgroep_key"
        + " FROM ins_srtdeel s"
        + "    , ins_srtgroep g"
        + " WHERE s.ins_srtgroep_key = g.ins_srtgroep_key"
        + "   AND ins_srtdeel_key = " + ins_srtdeel_key;
var oRs = Oracle.Execute(sql);
var srtcode = oRs("ins_srtdeel_code").value;
var sortomschr = oRs("ins_srtdeel_omschrijving").value;

var sletype = (oRs("ins_srtgroep_key").value == S("sle_ins_srt_groep_key")? "S" : "C");

oRs.close();
%>

<html>
  <head>
<%
    FCLTHeader.Generate();
%>
    <script type="text/javascript">
      function sle_print()
      {
        FcltMgr.windowopen('./ins_srtdeel_xml.asp?ins_srtdeel_key=' + <%=ins_srtdeel_key%>);
      }

      function sle_change()
      {
        if (FcltMgr.startEdit(window))
          window.location.href = "sle_edit_srtdeel.asp?ins_srtdeel_key=<%=ins_srtdeel_key%>&embedded=1";
      }

      function sle_delete()
      {
        FcltMgr.confirm(L("lcl_ins_del_srtdeel"), function() {
            var data = {
                key: <%=ins_srtdeel_key%>
            };
            <% protectRequest.dataToken("data"); %>
            $.post("sle_delete_srtdeel.asp",
                data,
                FcltCallbackClose,
                "json");
        });
      }
    </script>
  </head>

  <body class="showmode">
<%  SUBFRAME_START();
    var buttons = [];

    if (authparamsSLEBOF && authparamsSLEBOF.ALGwritelevel < 9 && authparamsSLEBOF.PRSwritelevel < 9)
    {
      var buttons =  [{title: L("lcl_change"), action: "sle_change()", icon: "fa-fclt-edit" }];
      if (!couple) // Net aangemaakt. Dan wil je ze niet verwijderen. Anders moet sle_delete_srtdeel.asp aangepast worden.
        buttons.push({title: L("lcl_delete"), action: "sle_delete()", icon: "fa-trash-alt" });
    }

    IFRAMER_HEADER(sletype == "S" ? L("lcl_sle_sleutel_set") : L("lcl_cil_cilinder_set"), buttons);
%>
      <form name="u2">
<%
        BLOCK_START("sleIns", (sletype == "S" ? L("lcl_sle_sleutel_set") : L("lcl_cil_cilinder_set")), {icon: (sletype == "S" ? "fa-key" : "fa-minus-circle fa-rotate-90") });
        ROFIELDTR("fld", (sletype == "S" ? L("lcl_sle_sleutel_code") : L("lcl_cil_cilinder_code")), srtcode);
        ROFIELDTR("fld", L("lcl_descr"), sortomschr);
        BLOCK_END();

        generateFlexKenmerkBlock({ urole: urole,
                                   bewerkniveau: "S",
                                   niveau: "S", // sleutels
                                   srtdeel_key: ins_srtdeel_key,
                                   srtdeelkey_array: ins_srtdeel_key > 0? [ins_srtdeel_key] : [],
                                   reado: true
                                 });
%>
      </form>
      <% SUBFRAME_END(); %>
  </body>
</html>
<% ASPPAGE_END(); %>
