<%@language = "javascript" %>

<!-- #include file="../scf/scaffolding.inc" -->
<!-- #include file="../api2/model_fac_import_app.inc" -->

<%
var generic = getQParamInt("gen", 0);
var  this_model = new model_fac_import_app();

this_model.hook_pre_edit = function (obj, fld)
{
%>
    <script>
        var gen = "<%=generic%>";
        var bestelcatalogus = (<%=generic%>==0);
    </script>
<%
}

var id = getQParamInt("id", -1);
if (id > 0)
{
    var url = "../../appl/shared/BijlagenForm.asp?module=IMPORTS&imp_exp_key=" + id;
    var proturl = protectQS.create(url);
    var fileaction = "FcltMgr.openModalDetail('" + safe.jsstring(proturl) + "')";
}

if (generic == 1)
{
// Gewoon op FACTAB blijven    this_model.autfunction = "WEB_PRSSYS";
    delete this_model.fields.name.hidden_fld;
    delete this_model.fields.code.hidden_fld;
    delete this_model.gparams.GET.wheres;
}

scaffolding(this_model,
    {
        "search": {
            "autosearch": true,
            "filters": [
                "orderdiscipline",
                "authorization",
                "company"
            ],
            "transit": [
                "orderdiscipline",
                "authorization",
                "company"
            ]
        },
        "list": {
            "columns": [
                "id",
                "code",
                "name",
                "authorization",
                "orderdiscipline",
                "company"
            ]
        },
        "edit": {
            "requires": {
                js: ["./fac_import_app.js"]
            }
        },
        "show":{
            "requires": {
              js: ["./fac_import_app.js"]
            },
            "buttons" : [{ title: L("fac_import_app_files"), action: fileaction, icon: "fa-file" }]
        },
        "transit": {
            "gen": generic
        },
        "layout": {
            "miscellaneous": {
                "icon": "fa-file-import"
            }
        },
        "print": {}
    });
%><% ASPPAGE_END(); %>
