# You must use a tab-size of 4 spaces to edit this file.
---
zenario__user_forms:
    panels:
        user_forms:
            title: Forms
            no_items_message: No forms have been created.
            select_mode_title: Select a form...
            panel_type: multi_line_list
            css_class: three_line_list_panel
            use_tall_rows: true
            db_items:
                table: '[[DB_PREFIX]][[ZENARIO_USER_FORMS_PREFIX]]user_forms AS f'
                where_statement: WHERE f.status = 'active'
                id_column: f.id
            refiners:
                archived:
                    sql: f.status = 'archived'
                email_address_setting: 
                    sql: |
                        f.admin_email_addresses != '' 
                        AND f.admin_email_addresses IS NOT NULL
                        AND f.status != 'archived'
                type:
                    sql: f.type = [[REFINER__TYPE]]
            
            label_format_for_picked_items: '(ID: [[id]]) [[name]]'

            columns:
                id:
                    title: ID
                    format: id
                    db_column: f.id
                    searchable: true
                    align_right: true
                    always_show: true
                    width: xxsmall
                name:
                    title: Form name
                    db_column: f.name
                    searchable: true
                    always_show: true
                    width: xxlarge
                type:
                    title: Type
                    db_column: f.type
                    parent: name
                    always_show: true
                form_extra_info:
                    title: Form extra info
                    parent: name
                    always_show: true
                form_email_addresses:
                    title: Email
                    db_column: f.admin_email_addresses
                    width: xlarge
                    always_show: true
                
                field_count:
                    title: Fields
                    db_column: |
                        (
                        SELECT COUNT(*) FROM [[DB_PREFIX]][[ZENARIO_USER_FORMS_PREFIX]]user_form_fields
                        WHERE user_form_id=f.id
                        )
                    show_by_default: true
                    searchable: false
                    disallow_sorting: true
                    align_right: true
                    width: small
                response_count:
                    title: Responses
                    db_column: |
                        CONCAT_WS(
                            ' ',
                            (
                                SELECT COUNT(*) FROM [[DB_PREFIX]][[ZENARIO_USER_FORMS_PREFIX]]user_response
                                WHERE form_id = f.id
                            ),
                        'submitted'
                        )
                    align_right: true
                    width: small
                    show_by_default: true
                response_count_internal:
                    db_column: |
                        (
                            SELECT COUNT(*) FROM [[DB_PREFIX]][[ZENARIO_USER_FORMS_PREFIX]]user_response
                            WHERE form_id = f.id
                        )
                    hidden: true
                partial_response_count:
                    title: Partial responses
                    db_column: |
                        CONCAT_WS(
                            ' ',
                            (
                                SELECT COUNT(*) FROM [[DB_PREFIX]][[ZENARIO_USER_FORMS_PREFIX]]user_partial_response
                                WHERE form_id = f.id
                            ),
                            'saved pending'
                        )
                    parent: response_count
                    align_right: true
                    width: small
                    show_by_default: true
                partial_response_count_internal:
                    db_column: |
                        (
                                SELECT COUNT(*) FROM [[DB_PREFIX]][[ZENARIO_USER_FORMS_PREFIX]]user_partial_response
                                WHERE form_id = f.id
                        )
                    hidden: true
                latest_response:
                    title: Latest
                    tooltip: Latest response date/time
                    db_column: |
                        (
                        SELECT MAX(response_datetime) FROM [[DB_PREFIX]][[ZENARIO_USER_FORMS_PREFIX]]user_response
                        WHERE form_id = f.id
                        )
                    #format: datetime
                    show_by_default: true
                crm:
                    title: CRM
                    show_by_default: true
                where_used:
                    title: Usage
                    show_by_default: true
                    width: xlarge
                    html: true
                plugin_is_used:
                    hidden: true
                allows_save_and_complete_later:
                    title: Save and complete later status
                    db_column: f.allow_partial_completion
                    hidden: true
            default_sort_column: name
            
            item:
                name: Form
                names: Forms
                css_class: zenario_user_forms
            
            collection_buttons:
                create:
                    ord: 1
                    priv: _PRIV_MANAGE_FORMS
                    hide_in_select_mode: true
                    css_class: zenario_create_a_new
                    hide_on_filter: true
                    label: Create a form
                    admin_box:
                        path: zenario_user_form
                    hide_on_refiner: archived
                advanced_dropdown:
                    ord: 2
                    label: Advanced
                    hide_in_select_mode: true
                    hide_on_filter: true
                    hide_on_refiner: archived
                    hide_when_children_are_not_visible: true
#Not implemented yet: a separate type of forms for profiles
#                create_profile_form:
#                    ord: 3
#                    priv: _PRIV_MANAGE_FORMS
#                    parent: advanced_dropdown
#                    label: Create profile form
#                    admin_box:
#                        path: zenario_user_form
#                        key:
#                            type: profile
                import_form:
                    ord: 4
                    priv: _PRIV_MANAGE_FORMS
                    parent: advanced_dropdown
                    label: Import form design
                    admin_box:
                        path: zenario_import_user_forms
                    hide_on_refiner: archived
                create_registration_form:
                    ord: 5
                    priv: _PRIV_MANAGE_FORMS
                    parent: advanced_dropdown
                    label: Create registration form
                    admin_box:
                        path: zenario_user_form
                        key:
                            type: registration
                    #As of Zenario 9.6, this button is hidden and the feature may be removed.
                    hidden: true
            
            item_buttons:
                edit_form_fields_gui:
                    ord: 1
                    priv: _PRIV_MANAGE_FORMS
                    label: Edit form fields
                    link:
                        path: zenario__user_forms/panels/form_fields_gui
                        branch: true
                        refiner: user_form_id
                form_settings:
                    ord: 2
                    priv: _PRIV_MANAGE_FORMS
                    hide_in_select_mode: true
                    label: Edit form settings
                    admin_box:
                        path: zenario_user_form
                duplicate:
                    ord: 3
                    priv: _PRIV_MANAGE_FORMS
                    hide_in_select_mode: true
                    label: Duplicate
                    ajax:
                        confirm:
                            message: |
                                Are you sure you want to duplicate the form "[[name]]"?
                            button_message: 'Duplicate'
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            duplicate_form: "1"
                    hide_on_refiner: archived
                view_dropdown:
                    ord: 4
                    label: View
                    hide_in_select_mode: true
                    hide_when_children_are_not_visible: true
                view_responses:
                    ord: 1
                    label: Responses for this form
                    parent: view_dropdown
                    priv: _PRIV_VIEW_FORM_RESPONSES
                    record_count: response_count_internal
                    link:
                        path: zenario__user_forms/panels/user_form_responses
                        refiner: form_id
                view_content_items:
                    ord: 6
                    label: Content items with this form
                    parent: view_dropdown
                    record_count: content_item_count
                    link:
                        path: zenario__content/panels/content
                        refiner: form_id
                    visible_if_for_all_selected_items: item.plugin_is_used
                advanced_dropdown:
                    ord: 6.1
                    label: Advanced
                    hide_in_select_mode: true
                    hide_on_filter: true
                    hide_when_children_are_not_visible: true
                edit_predefined_text:
                    ord: 6.2
                    priv: _PRIV_MANAGE_FORMS
                    parent: advanced_dropdown
                    label: Edit pre-defined text
                    link:
                        path: zenario__user_forms/panels/predefined_text_targets
                        refiner: user_form_id
                export_forms:
                    ord: 6.3
                    priv: _PRIV_MANAGE_FORMS
                    parent: advanced_dropdown
                    hide_in_select_mode: true
                    label: Export form design
                    multiple_select: true
                    ajax:
                        confirm:
                            message: |
                                Are you sure you want to export the selected form design? You can then import it into a different Zenario site of the same version.
                            button_message: 'Export'
                            cancel_button_message: Cancel
                            message_type: warning
                            download: true
                        request:
                            export_forms: "1"
                
                
                delete:
                    ord: 98
                    priv: _PRIV_MANAGE_FORMS
                    hide_in_select_mode: true
                    label: Delete
                    multiple_select_tooltip: Delete these forms?
                    multiple_select: true
                    disabled_if_for_all_selected_items: |
                        item.plugin_is_used
                    disabled_tooltip: |
                        This form is currently in use. Please remove the form from all plugins before attempting to delete the form.
                    ajax:
                        confirm:
                            message: |
                                Are you sure you want to delete the form "[[name]]"?
                                This action cannot be undone.
                                
                                Recorded form responses will be deleted.
                            multiple_select_message: |
                                Are you sure you wish to delete these forms?
                                This action cannot be undone.
                                
                                Recorded form responses will be deleted.
                            button_message: Delete
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            delete_form: "1"
                    hide_on_refiner: archived
                archive:
                    ord: 99
                    priv: _PRIV_MANAGE_FORMS
                    hide_in_select_mode: true
                    label: Archive
                    multiple_select_tooltip: Archive these forms?
                    multiple_select: true
                    visible_if_for_all_selected_items: item.response_count_internal > 0
                    disabled_if_for_all_selected_items: |
                        item.plugin_is_used
                    disabled_tooltip: |
                        This form is currently in use. Please remove the form from all plugins before attempting to archive the form.
                    ajax:
                        confirm:
                            message: |
                                Are you sure you want to archive the form "[[name]]"?
                                This action cannot be undone.
                            multiple_select_message: |
                                Are you sure you wish to archive these forms?
                                This action cannot be undone.
                            button_message: Archive
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            archive_form: "1"
                    hide_on_refiner: archived
            hidden_nav:
                plugins_using_form:
                    link:
                        path: zenario__modules/panels/plugins
                        refiner: plugins_using_form
                nests_using_form:
                    link:
                        path: zenario__modules/panels/plugins
                        refiner: nests_using_form
                slideshows_using_form:
                    link:
                        path: zenario__modules/panels/plugins
                        refiner: slideshows_using_form
                content_items_using_form:
                    link:
                        path: zenario__content/panels/content
                        refiner: content_items_using_form
                layouts_using_form:
                    link:
                        path: zenario__layouts/panels/layouts
                        refiner: layouts_using_form
