<% /*
    $Revision$
    $Id$

    File:           model_aut_client_perslid.inc
    Description:    Persoonlijke instellingen per Client/app
    Notes:
*/

function model_aut_client_perslid(params)
{
    params = params || {};
    this.records_name = "clientpersons";
    this.record_name = "clientperson";
    this.table = "aut_client_perslid";
    this.primary = "aut_client_perslid_key";
    this.autSELF = "person";
    this.autfunction = params.self?false:"WEB_FACFAC";
    this.record_title = L("aut_client_perslid");
    this.records_title = L("aut_client_perslid_m");
    this.defaultIcon = "fa-user-shield";

    this.fields = {
        "id": {
            "dbs": "aut_client_perslid_key",
            "label": L("lcl_key"),
            "typ": "key",
            "seq": "aut_s_aut_client_perslid_key"
        },
        "autclient": {
            "dbs": "aut_client_key",
            "label": L("aut_client"),
            "typ": "key",
            "hidden_fld": true,
            "required": true,
            "foreign": {
                "tbl": "aut_client",
                "key": "aut_client_key",
                "desc": "aut_client_omschrijving"
            }
        },
        "registrationdate": {
            "dbs": "aut_client_perslid_aanmaak",
            "label": L("aut_client_perslid_aanmaak"),
            "typ": "datetime",
            "readonly": "true"
        },
        "app_build": {
            "dbs": "aut_client_perslid_appbuild",
            "label": L("aut_client_perslid_appbuild"),
            "typ": "number",
            "hidden_fld": "true"
        },
        "app_version": {
            "dbs": "aut_client_perslid_appversion",
            "label": L("aut_client_perslid_appversion"),
            "typ": "varchar",
            "hidden_fld": "true"
        },
        "device_id": {
            "dbs": "aut_client_perslid_device_id",
            "label": L("aut_client_perslid_device_id"),
            "typ": "varchar"
        },
        "device_name": {
            "dbs": "aut_client_perslid_device_name",
            "label": L("aut_client_perslid_device_name"),
            "typ": "varchar"
        },
        "scope": {
            "dbs": "aut_client_perslid_scope",
            "label": L("aut_client_perslid_scope"),
            "typ": "varchar"
        },
        "pushtoken": {
            "dbs": "aut_client_perslid_pushtoken",
            "label": L("aut_client_perslid_pushtoken"),
            "typ": "varchar",
            "filter": "exact"
        },
        "refreshtoken": {
            "dbs": "aut_client_perslid_refreshtkn",
            "label": L("aut_client_perslid_refreshtoken"),
            "typ": "varchar",
            "filter": "exact"
        },
        "refreshdate": {
            "dbs": "aut_client_perslid_refreshdate",
            "label": L("aut_client_perslid_refreshdate"),
            "typ": "datetime"
        },
        "accesstoken": {
            "dbs": "aut_client_perslid_accesstoken",
            "label": L("aut_client_perslid_accesstoken"),
            "typ": "varchar",
            "filter": "exact"
        },
        "accessdate": {
            "dbs": "aut_client_perslid_accessdate",
            "label": L("aut_client_perslid_accessdate"),
            "typ": "datetime"
        },
        "login": {
            "dbs": "aut_client_perslid_login",
            "label": L("aut_client_perslid_login"),
            "typ": "datetime"
        },
        "person": {
            "dbs": "prs_perslid_key",
            "label": L("lcl_user"),
            "typ": "key",
            "foreign" : "prs_perslid"
        }
    }

    this.edit = {
        "modal": true
    };

    this.list = {
        "columns": ["person", "scope", "device_id", "accessdate", "login"]
    };

    this.REST_GET    = generic_REST_GET(this);
    if (params.internal) // Dan geloof ik het wel
    {
        this.autfunction = false;
        this.REST_POST   = generic_REST_POST(this);
        this.REST_PUT    = generic_REST_PUT(this);
        this.REST_DELETE = generic_REST_DELETE(this);
    }
/*
TODO: je eigen device_name mogen bewerken en registratie mogen verwijderen
    if (params.self) // Alleen device_name bewerken
    {
        for (var fld in this.fields)
        {
            if (fld != 'device_name')
            {
                this.fields[fld].readonly = true;
                if (!inArray(fld,["autclient", "autclient","registrationdate", "refreshdate"]))
                    this.fields[fld].hidden_fld = true;
            }
        }
    }
*/
}
%>