<%@language = "javascript" %>

<!-- #include file="../scf/scaffolding.inc" -->
<!-- #include file="../mgt/mgt_tools.inc" -->
<!-- #include file="../api2/model_bes_kenmerk.inc" -->
<%
var this_model = new model_bes_kenmerk();

this_model.hook_pre_edit = function (obj, fld)
{
    if (obj.id == -1)
    {
        fld.article_group.foreign.where = "bes_srtgroep_key IS NULL";
        fld.article.foreign.where = "bes_srtdeel_key IS NULL"; // Geen artikelen ophalen: zijn er veel te veel.
    }
%>
<script type="text/javascript">
  var module = "BES";
</script>
<%
}

this_model.hook_pre_post = function (params, jsondata)
{
    var checkdata = { module: "bes",
                      srtkenmerk: true,
                      key: jsondata.property_key,
                      value: jsondata.property_default
                    };
    checkSrtkenmerkValue(checkdata);
    if (checkdata.err != "")
        abort_with_warning(checkdata.err);

    jsondata.property_default = checkdata.value;
}


scaffolding(this_model,
    {
        "search": {
            "autosearch": true,
            "requires": { js: ["../mgt/bes_kenmerk.js"] },
            "filters": [
                "property_key",
                "article_catalogue"
            ]
        },
        "list": {
            "columns": [
                "id",
                "property_key",
                "sequence",
                "level",
                "article_catalogue",
                "article_group",
                "article",
                "property_required"
            ]
        },
        "edit": {
            "requires": {
                js: [
                    "../mgt/bes_kenmerk.js"
                ]
            }
        },
        "print": {}
    });


    function buildBESKenmerkNiveauList()
    {
        return  "D;"+L("bes_ins_discipline_key")
             + ";G;"+L("bes_srtgroep")
             + ";S;"+L("bes_srtdeel");
    }

%>
