{
    "module": "pipicar",
    "name": "pipicar.auto",
    "type": "crud",
    "title": "Автомобили",
    "data": {
        "table": "pipi_auto",
        "pk": "id",
        "limit": 25,
        "segment": true,
        "timestamp": true,
        "fields": {
            "id": {
                "type": "pk"
            },
            "code": {
                "type": "string",
                "validation": "required",
                "comment": "Код"
            },
            "name": {
                "type": "string",
                "nullable": true,
                "comment": "Наименование"
            },
            "type_id": {
                "type": "foreign",
                "table": "pipi_auto_types",
                "foreign": "id",
                "display": ["name"],
                "nullable": true,
                "comment": "Тип"
            },
            "class_id": {
                "type": "foreign",
                "table": "pipi_auto_classes",
                "foreign": "id",
                "display": ["name"],
                "nullable": true,
                "comment": "Класс"
            },
            "brand_id": {
                "type": "foreign",
                "table": "pipi_auto_brands",
                "foreign": "id",
                "display": ["name"],
                "nullable": true,
                "comment": "Марка"
            },
            "model_id": {
                "type": "foreign",
                "table": "pipi_brand_models",
                "foreign": "id",
                "display": ["name"],
                "nullable": true,
                "comment": "Модель"
            },
            "color_id": {
                "type": "foreign",
                "table": "pipi_auto_colors",
                "foreign": "id",
                "display": ["name"],
                "nullable": true,
                "comment": "Цвет"
            },
            "serial_number": {
                "type": "string",
                "nullable": true,
                "comment": "Серийный номер"
            },
            "state_number": {
                "type": "string",
                "nullable": true,
                "comment": "Госномер"
            },
            "manufacture_year": {
                "type": "date",
                "nullable": true,
                "comment": "Год производства"
            },
            "passport_number": {
                "type": "string",
                "nullable": true,
                "comment": "Номер техпаспорта"
            },
            "passport_date": {
                "type": "date",
                "nullable": true,
                "comment": "Дата техпаспорта"
            },
            "estimated_cost": {
                "type": "float",
                "nullable": true,
                "comment": "Оценочная стоимость"
            },
            "owner_id": {
                "type": "foreign",
                "table": "pipi_owners",
                "foreign": "id",
                "display": ["name"],
                "nullable": true,
                "comment": "Владелец имущества"
            },
            "is_trust_management": {
                "type": "boolean",
                "default": false,
                "comment": "В доверенном управлении"
            },
            "owner_percentage": {
                "type": "integer",
                "nullable": true,
                "comment": "Процент владельца"
            },
            "owner_contract": {
                "type": "string",
                "nullable": true,
                "comment": "Договор владельца имущества"
            },
            "is_inactive": {
                "type": "boolean",
                "default": false,
                "comment": "Не использовать"
            },
            "inspection_kit": {
                "type": "json",
                "nullable": true,
                "comment": "Комплектация для осмотра"
            },
            "is_predefined": {
                "type": "boolean",
                "default": false,
                "comment": "Предопределенный"
            },
            "predefined_data_name": {
                "type": "string",
                "nullable": true,
                "comment": "Имя предопределенных данных"
            },
            "created_at": {
                "type": "timestamp",
                "comment": "Дата создания"
            },
            "updated_at": {
                "type": "timestamp",
                "comment": "Дата обновления"
            },
            "deleted_at": {
                "type": "timestamp",
                "nullable": true,
                "comment": "Дата удаления"
            }
        }
    },
    "ui": {
        "grid": {
            "title": "Автомобили",
            "template": "app.base.crud.grid",
            "cols": [
                {
                    "name": "code",
                    "caption": "Код"
                },
                {
                    "name": "name",
                    "caption": "Наименование"
                },
                {
                    "name": "brand_id",
                    "caption": "Марка"
                },
                {
                    "name": "model_id",
                    "caption": "Модель"
                },
                {
                    "name": "state_number",
                    "caption": "Госномер"
                },
                {
                    "name": "manufacture_year",
                    "caption": "Год производства"
                }
            ],
            "action": {
                "head": [
                    "add"
                ],
                "row": [
                    "edit",
                    "delete"
                ]
            },
            "filter": {
                "template": "app.base.crud.filter",
                "rows": [
                    {
                        "cols": [
                            {
                                "size": 4,
                                "input": {
                                    "name": "code",
                                    "label": "Код"
                                }
                            },
                            {
                                "size": 4,
                                "input": {
                                    "name": "name",
                                    "label": "Наименование"
                                }
                            },
                            {
                                "size": 4,
                                "input": {
                                    "name": "state_number",
                                    "label": "Госномер"
                                }
                            }
                        ]
                    }
                ]
            }
        },
        "forms": {
            "add": {
                "title": "Добавление автомобиля",
                "template": "app.base.crud.form",
                "form": {
                    "submits": "struct:crud.form.edit.submits",
                    "rows": [
                        {
                            "cols": [
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "code",
                                        "label": "Код"
                                    }
                                },
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "name",
                                        "label": "Наименование"
                                    }
                                },
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "state_number",
                                        "label": "Госномер"
                                    }
                                }
                            ]
                        },
                        {
                            "cols": [
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "brand_id",
                                        "label": "Марка"
                                    }
                                },
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "model_id",
                                        "label": "Модель"
                                    }
                                },
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "color_id",
                                        "label": "Цвет"
                                    }
                                }
                            ]
                        },
                        {
                            "cols": [
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "manufacture_year",
                                        "label": "Год производства"
                                    }
                                },
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "estimated_cost",
                                        "label": "Оценочная стоимость"
                                    }
                                },
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "owner_id",
                                        "label": "Владелец"
                                    }
                                }
                            ]
                        }
                    ]
                }
            },
            "edit": {
                "title": "Редактирование автомобиля",
                "template": "app.base.crud.form",
                "form": {
                    "rows": [
                        {
                            "cols": [
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "code",
                                        "label": "Код"
                                    }
                                },
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "name",
                                        "label": "Наименование"
                                    }
                                },
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "state_number",
                                        "label": "Госномер"
                                    }
                                }
                            ]
                        },
                        {
                            "cols": [
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "brand_id",
                                        "label": "Марка"
                                    }
                                },
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "model_id",
                                        "label": "Модель"
                                    }
                                },
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "color_id",
                                        "label": "Цвет"
                                    }
                                }
                            ]
                        },
                        {
                            "cols": [
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "manufacture_year",
                                        "label": "Год производства"
                                    }
                                },
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "estimated_cost",
                                        "label": "Оценочная стоимость"
                                    }
                                },
                                {
                                    "size": 4,
                                    "input": {
                                        "name": "owner_id",
                                        "label": "Владелец"
                                    }
                                }
                            ]
                        }
                    ],
                    "submits": "struct:crud.form.edit.submits"
                }
            }
        }
    },
    "actions": "struct:crud.actions"
}
