# You must use a tab-size of 4 spaces to edit this file.
---
zenario__administration:
    panels:
        custom_fields:
            title: Custom dataset fields
            db_items:
                table: '[[DB_PREFIX]]custom_dataset_fields AS cdf'
                id_column: cdf.id
                where_statement: 'WHERE cdf.type != "other_system_field" AND cdf.db_column != ""'
            default_sort_column: label
            label_format_for_picked_items: '[[label]]'
            refiners:
                dataset_id:
                    sql: 'cdf.dataset_id = [[REFINER_ID]]'
                custom_fields_only:
                    sql: |
                        cdf.dataset_id = [[REFINER_ID]]
                        AND cdf.is_system_field = 0 
                        AND cdf.type in ('text', 'date', 'radios', 'checkbox', 'textarea', 'consent', 'group', 'centralised_radios', 'url', 'select', 'consent', 'dataset_select', 'centralised_select')
                user_fields:
                    sql: |
                        cdf.dataset_id = (
                            SELECT cd.id
                            FROM [[DB_PREFIX]]custom_datasets AS cd
                            WHERE cd.table = 'users_custom_data'
                        )
                user_custom_fields_only:
                    sql: |
                        cdf.dataset_id = (
                            SELECT cd.id
                            FROM [[DB_PREFIX]]custom_datasets AS cd
                            WHERE cd.table = 'users_custom_data'
                        )
                        AND cdf.is_system_field = 0 
                        AND cdf.type in ('text', 'date', 'radios', 'checkbox', 'textarea', 'consent', 'group', 'centralised_radios', 'url', 'select', 'consent', 'dataset_select', 'centralised_select')
                exclude_image_pickers:
                    sql: |
                        cdf.dataset_id = [[REFINER_ID]]
                        AND cdf.type NOT IN ('file_picker','repeat_start')
                   
            columns:
                label:
                    title: Label
                    searchable: true
                    db_column: IF(cdf.label != '', cdf.label, cdf.default_label)
                    always_show: true
                field_name:
                    title: Field name
                    searchable: false
                    db_column: cdf.field_name
                    always_show: true
                type:
                    title: Type
                    searchable: false
                    db_column: cdf.type
                    always_show: true