{
    "type":{
        "n":"Terminals",
        "d":"trt('Terminal')",
        "ObjectID":"id",
        "edit_object":{
            "columns":[
                {"d":"id", "n":"id", "vt":"i4", "visible":"0"},
                {"d":"trt('Company')", "n":"company_id", "vt":"object", "maybenull":"0", "ot":"Companies", "FieldCaption":"name", "selector":"combo"},
			    {"d":"trt('Phone')", "n":"phone", "vt":"string", "size":"20"},
			    {"d":"trt('Serial_number')", "n":"serial", "vt":"string", "size":"50"},
			    {"d":"IMEI", "n":"imei", "vt":"string", "size":"50", "maybenull":"0"},
			    {"d":"trt('Terminal model')", "n":"terminal_model_id", "vt":"object", "maybenull":"0", "ot":"TerminalsModels", "FieldCaption":"name", "selector":"combo"},
			    {"d":"trt('Description')", "n":"description", "vt":"text", "size":"500"}
            ],
            "insert-query":"select * from main.p_Terminals_i(${_user_id},${company_id},${phone},${serial},${imei},${terminal_model_id},${description});",
            "update-query":"select * from main.p_Terminals_u(${_user_id},${id},${company_id},${phone},${serial},${imei},${terminal_model_id},${description});",
            "delete-query":"select * from main.p_Terminals_d(${_user_id},${id});",
            "select-query":"select * from main.p_Terminals_s(${_user_id},${id},0,NULL);"
        },
        "show-object":{
            "d":"trt('Terminals')",
            "width":"1000",
            "sql-query":"select * from main.p_terminals_ss(${_user_id},${id},${company_id},${terminal_id},${install},${imei},${serial});",
            "filter":{
                "columns":[
                    {"d":"id","n":"id","vt":"string","visible":"0"},
                    {"d":"trt('Company')","n":"company_id","vt":"object","object":"Companies","FieldCaption":"name","selector":"combo"},
                    {"d":"terminal_id","n":"terminal_id","vt":"i4","visible":"0"},
                    {"d":"trt('Installed')","n":"install","vt":"b"},
                    {"d":"trt('IMEI')","n":"imei","vt":"string"},
                    {"d":"trt('Serial_number')","n":"serial","vt":"string"}
                ]
            },
            "columns":[
                {"d":"trt('Terminal_model')", "n":"terminal_model_name", "width":"150"},
                {"d":"trt('Company')", "n":"campany_name", "width":"150"},
                {"d":"trt('Installed_on')", "n":"object_name", "width":"150"},
                {"d":"trt('Phone')", "n":"phone", "width":"150"},
                {"d":"trt('Serial_number')", "n":"serial", "width":"120"},
                {"d":"IMEI", "n":"imei", "width":"300"},
                {"d":"trt('Description')", "n":"description", "width":"300"},
                {"d":"trt('Count_sensors')", "n":"tscnt", "width":"120",
                    "type":{
                        "n":"TerminalsSensors",
                        "show-object":{
                            "d":"trt('Sensors_types')",
                            "filter":{
                                "height":"1",
                                "columns":[
                                    {
                                        "n":"terminal_id",
                                        "data":"${id}"
                                    }
                                ]
                            }
                        }
                    }
                },
                {"d":"Настройки", "n":"tstcnt", "width":"120",
                    "type":{
                        "n":"TerminalsSettings",
                        "show-object":{
                            "filter":{
                                "columns":[
                                    {
                                        "n":"terminal_id",
                                        "data":"${id}"
                                    }
                                ]
                            }
                        }
                    }
                }
            ]
        }
    }
}