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

    File:           fac_show_adres.asp)
    Status:         98%
    Description:    show detailed information of an adres

    Parameters:     adr_key

    Context:
    Note:

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

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

var autfunction = "WEB_ALGMSU";
  var authparams = user.checkAutorisation(autfunction);

var adr_key = getQParamInt("adr_key");
var sql,oRs;

 sql = "SELECT mld_adres_contactpers_bureau, "
     + "       mld_adres_telefoon, "
     + "       mld_adres_email, "
     + "       mld_adres_naam, "
     + "       mld_adres_bezoek_adres, "
     + "       mld_adres_bezoek_postcode, "
     + "       mld_adres_bezoek_plaats, "
     + "       mld_adres_bezoek_land, "
     + "       mld_adres_post_adres, "
     + "       mld_adres_gebouw_ruimte, "
     + "       mld_adres_post_postcode, "
     + "       mld_adres_post_plaats, "
     + "       mld_adres_post_land, "
     + "       mld_adres_contactpersoon, "
     + "       mld_adres_contactpers_telefoon, "
     + "       mld_adres_contactpers_email, "
     + "       mld_adres_factuuradres, "
     + "       mld_adres_opdrachtadres, "
     + "       mld_adres_afleveradres, "
     + "       alg_locatie_key "
     + "  FROM mld_adres "
     + " WHERE mld_adres_key = " + adr_key;



oRs=Oracle.Execute(sql);
if (oRs.eof)
{
  // hacker?
  Response.End();
}

mld_adr_cnt_bur   = oRs("mld_adres_contactpers_bureau").Value;
mld_adr_tel       = oRs("mld_adres_telefoon").Value;
mld_adr_email     = oRs("mld_adres_email").Value;
mld_adr_nm        = oRs("mld_adres_naam").Value;
mld_adr_bez_adr   = oRs("mld_adres_bezoek_adres").Value;
mld_adr_bez_pcd   = oRs("mld_adres_bezoek_postcode").value;
mld_adr_bez_pla   = oRs("mld_adres_bezoek_plaats").Value;
mld_adr_bez_lnd   = oRs("mld_adres_bezoek_land").Value;
mld_adr_pst_adr   = oRs("mld_adres_post_adres").Value;
mld_adr_geb_rui   = oRs("mld_adres_gebouw_ruimte").value;
mld_adr_pst_pcd   = oRs("mld_adres_post_postcode").Value;
mld_adr_pst_pla   = oRs("mld_adres_post_plaats").Value;
mld_adr_pst_lnd   = oRs("mld_adres_post_land").Value;
mld_adr_cnt_prs   = oRs("mld_adres_contactpersoon").Value;
mld_adr_cnt_tel   = oRs("mld_adres_contactpers_telefoon").Value;
mld_adr_cnt_email = oRs("mld_adres_contactpers_email").Value;
mld_adr_fac_adr   = oRs("mld_adres_factuuradres").Value;
mld_adr_opd_adr   = oRs("mld_adres_opdrachtadres").Value;
mld_adr_afl_adr   = oRs("mld_adres_afleveradres").Value;
alg_loc_key       = oRs("alg_locatie_key").Value;

oRs.close();

oRs = Oracle.Execute(sql);

%>

<html>
<head>
<%
   FCLTHeader.Generate();
%>
<script type="text/javascript">

    function fac_change()
    {
      if (FcltMgr.startEdit(window))
        window.location.href = "fac_edit_adres.asp?adr_key=<%=adr_key%>";
    }

    function fac_delete()
    {
        FcltMgr.confirm(L("lcl_fac_del_txt_adres"), function() {
            var data = {
                key: <%=adr_key%>,
                level: "AD"
            };
            <% protectRequest.dataToken("data"); %>
            $.post("fac_delete.asp",
                data,
                FcltCallbackClose,
                "json");
        });
    }
</script>

</head>

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

if (authparams.PRSwritelevel<9)
{
  var buttons =  [ {title: L("lcl_change"), action: "fac_change()", icon: "fa-fclt-edit" },
                   {title: L("lcl_delete"), action: "fac_delete()", icon: "fa-trash-alt" }
                 ];
}

IFRAMER_HEADER(L("lcl_adres_frame_algemeen"), buttons);
%>
  <form name="u2">
<%
BLOCK_START("facAlg", L("lcl_fac_adres_nawblock"), {icon: "fa-envelope-square"});
  FCLTplaatsselector( authparams.ALGreadlevel,{ locatiekey: alg_loc_key,
                        startlevel: 2,
                        eindlevel: 2,
                        readonly: true,
                        whenEmpty: L("lcl_search_generic")
                      });
  ROFIELDTR("fld", L("lcl_prs_address_naam"), mld_adr_nm);
  ROFIELDTR("fld", L("lcl_prs_address_gebouw_ruimte"), mld_adr_geb_rui, { suppressEmpty: true });
  ROFIELDTR("fld", L("lcl_prs_address_phone"), mld_adr_tel, { suppressEmpty: true, type: "telefoon" });
  ROFIELDTR("fld", L("lcl_prs_address_email"), mld_adr_email, { suppressEmpty: true, type: "email" });
  %>
  <tr>
    <td class="label"><label for="mld_adr_fac_adr"><%=L("lcl_prs_address_factuuradres")%></label></td>
    <td><input class="fldalgbez" type="checkbox" id="mld_adr_fac_adr" name="mld_adr_fac_adr" value="<%=mld_adr_fac_adr%>" <%= mld_adr_fac_adr==1 ? " checked " : "" %>disabled></td>
  </tr>
  <tr>
    <td class="label"><label for="mld_adr_opd_adr"><%=L("lcl_prs_address_opdrachtadres")%></label></td>
    <td><input class="fldalgbez" type="checkbox" id="mld_adr_opd_adr" name="mld_adr_opd_adr" value="<%=mld_adr_opd_adr%>" <%= mld_adr_opd_adr==1 ? " checked " : "" %>disabled></td>
  </tr>
  <tr>
    <td class="label"><label for="mld_adr_afl_adr"><%=L("lcl_prs_address_afleveradres")%></label></td>
    <td><input class="fldalgbez" type="checkbox" id="mld_adr_afl_adr" name="mld_adr_afl_adr" value="<%=mld_adr_afl_adr%>" <%= mld_adr_afl_adr==1 ? " checked " : "" %>disabled></td>
  </tr>
  <%
BLOCK_END();

BLOCK_START("facBez", L("lcl_fac_adres_visitblock"), {icon: "fa-map-marked-alt"});
  ROFIELDTR("fld", L("lcl_prs_address_bezoek_adres"), mld_adr_bez_adr);
  ROFIELDTR("fld", L("lcl_prs_address_bezoek_postcode"), mld_adr_bez_pcd);
  ROFIELDTR("fld", L("lcl_prs_address_bezoek_plaats"), mld_adr_bez_pla);
  ROFIELDTR("fld", L("lcl_prs_address_bezoek_land"), mld_adr_bez_lnd);
BLOCK_END();

BLOCK_START("facPst", L("lcl_fac_adres_postblock"), {icon: "fa-envelope-open"});
  ROFIELDTR("fld", L("lcl_prs_address_post_adres"), mld_adr_pst_adr, { suppressEmpty: true });
  ROFIELDTR("fld", L("lcl_prs_address_post_postcode"), mld_adr_pst_pcd, { suppressEmpty: true });
  ROFIELDTR("fld", L("lcl_prs_address_post_plaats"), mld_adr_pst_pla, { suppressEmpty: true });
  ROFIELDTR("fld", L("lcl_prs_address_post_land"), mld_adr_pst_lnd, { suppressEmpty: true });
BLOCK_END();

BLOCK_START("facCnt", L("lcl_prs_bedrijf_contactblock"), {icon: "fa-id-card"});
  ROFIELDTR("fld", L("lcl_prs_address_contact_person"), mld_adr_cnt_prs, { suppressEmpty: true });
  ROFIELDTR("fld", L("lcl_prs_address_contact_telefoon"), mld_adr_cnt_tel, { suppressEmpty: true, type: "telefoon" });
  ROFIELDTR("fld", L("lcl_prs_address_contact_email"), mld_adr_cnt_email, { suppressEmpty: true, type: "email" });
  ROFIELDTR("fld", L("lcl_prs_address_contact_bureau"), mld_adr_cnt_bur, { suppressEmpty: true });
BLOCK_END();
%>
</form>
<% SUBFRAME_END(); %>
</body>
</html>
<% ASPPAGE_END(); %> 
