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

    Note:   Dit is de SCF-versie van prs/prs_bedrijf*, in het leven geroepen voor de systemen waarvan we de technische adressen willen beheren
            Die hebben een prs_bedrijf-records nodig, maar zijn geen bedrijf. Daarom presenteren we dergelijke "bedrijven" waarbij intern=2
            anders dan de normale bedrijven. De meeste gegevens zijn nl irrelevant

            Mogelijk gaan ooit de normale (externe en interne) bedrijven naar SCF, en dan moeten die varianten (en autorisaties) goed worden bekeken

            Voor deze systeembedrijven is vooralsnog PRSSYS vereist.

*/
%>
<!-- #include file="../scf/scaffolding.inc" -->
<!-- #include file="../api2/model_companies.inc" -->

<%
var intern = getQParamInt("intern", 2);   // 2 = systeembedrijf, zie Note boven

var bedrijf_key = getQParamInt("bedrijf_key", -1);

var authparamsPRSSYS = user.checkAutorisation("WEB_PRSSYS", true);
var canMultiAut = authparamsPRSSYS;


var this_model_params = { isinternal : intern
                        }

var this_model = new model_companies(this_model_params); // We willen hier niet via de interface bewerken


if (intern==2) // delete allerlei velden
{
    this_model.fields["name"].label = L('lcl_prs_companies_name_sys');
    this_model.fields["contactname"].label = L('lcl_prs_companies_contact_person_sys');
    this_model.fields["remark"].label = L('lcl_prs_companies_contact_opm_sys');

    delete this_model.fields["postaddress"];
    delete this_model.fields["postzipcode"];
    delete this_model.fields["postcity"];
    delete this_model.fields["postcountry"];
    delete this_model.fields["visitaddress"];
    delete this_model.fields["visitzipcode"];
    delete this_model.fields["visitcity"];
    delete this_model.fields["visitcountry"];
    delete this_model.fields["phone"];
    delete this_model.fields["phone2"];
    delete this_model.fields["email"];
    //delete this_model.fields["contactname"];
    delete this_model.fields["contactphone"];
    //delete this_model.fields["remark"];
    delete this_model.fields["remark2"];
    delete this_model.fields["hourrate"];
    delete this_model.fields["code"];
    delete this_model.fields["agreement"];
    delete this_model.fields["agreementdate"];
    delete this_model.fields["isinternal"];
    delete this_model.fields["issupplier"];
    delete this_model.fields["isexecutor"];
    delete this_model.fields["iscontractor"];
    delete this_model.fields["isrenter"];
    delete this_model.fields["location"];
    delete this_model.fields["service"];

    delete this_model.includes["custom_fields"];

}


var scf_params = {
            "search": {
                "filters": [
                    "name"
                ]
            },
            "multicolumn": true,
            "list": {
                "columns": [
                    "id",
                    "name",
                    "contactname",
                    "remark"
                  ]
            },
            "show": {},
            "layout": {
                "active_tab": 1,  /* de technische adressen */
                "block": [
                    {
                        "icon": "fa-computer",
                        "label": L("lcl_prs_companies_title_sys"),
                        "fields": [
                            //"id",
                            "name",
                            "contactname",
                            "remark"]
                    }
                ]
            }
        };

if (canMultiAut)
{
    //scf_params.list.actions = [{ "action": "authgroupAdd", "caption": L("fac_groep"), multi: true, onlyMulti: true, multiOnce: true } ];
}

scaffolding(this_model, scf_params);

%>
<% ASPPAGE_END(); %>
