# You must use a tab-size of 4 spaces to edit this file.
---
zenario__user_forms:
    panels:
        user_form_responses:
            priv: _PRIV_VIEW_FORM_RESPONSES
            panel_type: multi_line_list_or_grid
            css_class: two_line_list_panel
            use_tall_rows: true
            title: User Responses
            select_mode_title: Select a response
            multiple_select_mode_title: Select response(s)
            no_items_message: No user responses have been recorded.
            hidden: true
            default_sort_column: response_datetime
            default_sort_desc: true
            notice:
                show: false
                type: ''
                message: ''
            db_items:
                table: |
                    [[DB_PREFIX]]user_response AS ur
                    INNER JOIN [[DB_PREFIX]][[ZENARIO_USER_FORMS_PREFIX]]user_forms AS uf
                        ON uf.id = ur.form_id
                    LEFT JOIN [[DB_PREFIX]]users AS u
                        ON ur.user_id = u.id
                id_column: ur.id
                max_limit: 99999999
            refiners:
                form_id:
                    sql: 'ur.form_id = [[REFINER_ID]]'
                user_id:
                    sql: 'ur.user_id = [[REFINER_ID]]'
            columns:
                id:
                    title: ID
                    format: id
                    db_column: ur.id
                    align_right: true
                    width: xxsmall
                    disallow_sorting: true
                    searchable: true
                    always_show: true
                response_datetime:
                    title: Date/Time Responded
                    db_column: ur.response_datetime
                    width: large
                    format: datetime
                    searchable: true
                    always_show: true
                user_id:
                    db_column: ur.user_id
                    hidden: true
                user_deleted:
                    db_column: ur.user_deleted
                    hidden: true
                user_identifier:
                    db_column: u.identifier
                    hiddent: true
                user:
                    title: 'Identifier if User/Contact:'
                    disallow_sorting: true
                    searchable: true
                    #If displaying responses for a specific form, this column will always be shown.
                    #If displaying all form responses for a specific user, it will be hidden in the PHP class.
                    always_show: true
                    width: xlarge
                    html: true
                sent_to_admins_or_users:
                    hidden: true
                    db_column: |
                            (
                                SELECT GROUP_CONCAT(DISTINCT(sending_log.email_address_to) SEPARATOR ", ")
                                FROM [[DB_PREFIX]]email_template_sending_log AS sending_log
                                WHERE form_response_id = ur.id
                                ORDER BY sending_log.id
                            ) AS sent_to_admins_or_users
                processing_actions:
                    title: Processing actions
                    width: xxlarge
                    always_show: true
                allocated_to_admin:
                    parent: processing_actions
                    title: Processing control
                    disallow_sotring: true
                    searchable: false
                    width: xxlarge
                    always_show: true
                allocated_to_admin_id:
                    db_column: ur.allocated_to_admin_id
                    hidden: true
                allocated_to_admin_datetime:
                    db_column: ur.allocated_to_admin_datetime
                    hidden: true
                form_id:
                    db_column: ur.form_id
                    hidden: true
                form:
                    title: Form
                    db_column: uf.name
                    disallow_sorting: true
                    searchable: true
                    #If displaying responses for a specific form, this column will be hidden in the PHP class.
                    #If displaying all form responses for a specific user, it will always be shown.
                    always_show: true
                    width: xlarge
                    html: true
                blocked_by_profanity_filter:
                    title: Blocked by profanity filter
                    format: text
                    searchable: true
                    show_by_default: true
                profanity_filter_score:
                    title: Profanity rating
                    format: text
                    searchable: true
                    show_by_default: true
                    align_right: "1"
                    width: small
                profanity_tolerance_limit:
                    title: Profanity tolerence limit
                    format: text
                    searchable: true
                    show_by_default: true
                    align_right: "1"
                    width: small
                crm_response:
                    title: CRM response
                    db_column: |
                        IF (
                            LENGTH(ur.crm_response) > 200, 
                            CONCAT(SUBSTRING(ur.crm_response, 1, 200), '...'), 
                            ur.crm_response
                        )
                    ord: 99999
                
                user_deleted:
                    db_column: ur.user_deleted
                data_deleted:
                    db_column: ur.data_deleted
            item_buttons:
                view_response:
                    priv: _PRIV_VIEW_FORM_RESPONSES
                    label: 'View response'
                    admin_box:
                        path: zenario_user_form_response
                send_form_response_to_admin_by_email:
                    priv: _PRIV_VIEW_FORM_RESPONSES
                    label: 'Re-send response...'
                    admin_box:
                        path: zenario_send_form_response_to_admin_by_email
                delete:
                    priv: _PRIV_VIEW_FORM_RESPONSES
                    label: 'Delete'
                    multiple_select: true
                    multiple_select_label: 'Delete selected responses'
                    ajax:
                        confirm:
                            message: Delete this response?
                            multiple_select_message: Delete the selected responses?
                            button_message: Delete
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            delete_form_response: 1
            collection_buttons:
                export:
                    priv: _PRIV_VIEW_FORM_RESPONSES
                    label: 'Export in Excel'
                    admin_box: 
                        path: zenario_export_user_responses
                        key:
                            form_id: ''
                            user_id: ''
                delete_form_responses:
                    priv: _PRIV_MANAGE_FORMS
                    label: 'Delete all responses'
                    ajax:
                        confirm:
                            #The message is set in the PHP class
                            #(two cases: delete all responses to a specific form, or delete all responses from a specific user)
                            button_message: Delete
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            delete_form_responses: 1
