<% /*
    $Revision$
    $Id$

    File:           model_mld_stdmsrtgebouw.inc

    Description:    Model voor mld_stdmsrtgebouw

    Context:

    Notes:
*/
%>
<%
function model_mld_stdmsrtgebouw()
{
    this.records_name = "bldfunctionsoverrule";
    this.record_name = "bldfunctionoverrule";
    this.table = "mld_stdmsrtgebouw";
    this.primary = "mld_stdmsrtgebouw_key";
    this.autfunction = "WEB_ALGMSU";
    this.record_title = L("lcl_mld_overrule");
    this.records_title = L("lcl_mld_overrule_properties");

    this.fields = {
        "id": {
            "dbs": "mld_stdmsrtgebouw_key",
            "label": L("lcl_key"),
            "typ": "key",
            "required": true,
            "seq": "mld_s_mld_stdmsrtgebouw_key"
        }
    };
    var buildingfunction = {
        "dbs": "alg_srtgebouw_key",
        "label": L("lcl_estate_gebouw_man_sort"),
        "typ": "varchar",
        "hidden_fld": hasQParam("buildingfunction"),
        "showtransit": true,
        "required": true,
        "foreign": "alg_srtgebouw",
        "multiedit": true
    };
    var stdmelding = {
        "dbs": "mld_stdmelding_key",
        "label": L("mld_stdmelding_key"),
        "typ": "key",
        "required": true,
        "foreign": "mld_stdmelding",
        "hidden_fld": hasQParam("stdmelding"),
        "showtransit": true
    };

    // Voor de volgordelijkheid;
    if (hasQParam("buildingfunction")) {
        this.fields.buildingfunction = buildingfunction;
        this.fields.stdmelding = stdmelding;
    } else {
        this.fields.stdmelding = stdmelding;
        this.fields.buildingfunction = buildingfunction;
    }

    var fields = { // Komt strak in this.fields
        "periodmalus": {
            "dbs": "mld_stdmsrtgebouw_malus",
            "typ": "float",
            "label": L("lcl_mld_malus"),
            "multiedit": true
        },
        "fixedmalus": {
            "dbs": "mld_stdmsrtgebouw_malusbasis",
            "typ": "float",
            "label": L("lcl_mld_malusbasis"),
            "multiedit": true
        },
        "maximummalus": {
            "dbs": "mld_stdmsrtgebouw_malusmax",
            "typ": "float",
            "label": L("lcl_mld_malusmax"),
            "multiedit": true
        },
        "regime": {
            "dbs": "mld_stdmsrtgebouw_regime",
            "typ": "key",
            "label": L("lcl_mld_regime"),
            "LOV": "1;" + L("lcl_mld_office_hours")  + ";"
                 + "2;" + L("lcl_mld_opening_hours") + ";"
                 + "3;" + L("lcl_mld_24_7"),
            "emptyoption": null,
            "multiedit": true
        },
        "accepttime": {
            "dbs": "mld_stdmsrtgebouw_t_accepttijd",
            "obj": "mld_t_uitvoertijd",
            "typ": "processingtime",
            "label": L("lcl_mld_timetoaccept"),
            "multiedit": true
        },
        "processingtime": {
            "dbs": "mld_stdmsrtgebouw_t_uitvtijd",
            "obj": "mld_t_uitvoertijd",
            "typ": "processingtime",
            "label": L("lcl_mld_uitvoertijd"),
            "multiedit": true
        },
        "criticalaccept": {
            "dbs": "mld_stdmsrtgebouw_t_accept_pr1",
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime",
            "label": L("lcl_mld_timetoaccept_kritisch"),
            "multiedit": true
        },
        "criticaltime": {
            "dbs": "mld_stdmsrtgebouw_t_uitv_pr1",
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime",
            "label": L("lcl_mld_uitvoertijd_kritisch"),
            "multiedit": true
        },
        "highpriorityaccept": {
            "dbs": "mld_stdmsrtgebouw_t_accept_pr2",
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime",
            "label": L("lcl_mld_timetoaccept_hoog"),
            "multiedit": true
        },
        "highprioritytime": {
            "dbs": "mld_stdmsrtgebouw_t_uitv_pr2",
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime",
            "label": L("lcl_mld_uitvoertijd_hoog"),
            "multiedit": true
        },
        "lowpriorityaccept": {
            "dbs": "mld_stdmsrtgebouw_t_accept_pr4",
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime",
            "label": L("lcl_mld_timetoaccept_laag"),
            "multiedit": true
        },
        "lowprioritytime": {
            "dbs": "mld_stdmsrtgebouw_t_uitv_pr4",
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime",
            "label": L("lcl_mld_uitvoertijd_laag"),
            "multiedit": true
        }
    };

    // Merge fields -> this.fields
    for (fld in fields) {
        if (fields.hasOwnProperty(fld)) {
            this.fields[fld] = fields[fld];
        }
    }

    this.REST_GET    = generic_REST_GET(this);
    this.REST_POST   = generic_REST_POST(this);
    this.REST_PUT    = generic_REST_PUT(this);
    this.REST_DELETE = generic_REST_DELETE(this);
}
%>