# You must use a tab-size of 4 spaces to edit this file.
---
zenario__users:
    panels:
        users:
            priv: _PRIV_VIEW_USER
            title: 'Users and contacts'
            panel_type: multi_line_list_or_grid
            css_class: three_line_list_panel
            use_tall_rows: true
            grid_view_microtemplate: 'zenario_grid_view_user'
            label_format_for_grid_view: '[[identifier]]'
            no_items_message: >
                No users or contacts found
            select_mode_title: Select a user
            multiple_select_mode_title: Select user(s)
            db_items:
                table: '[[DB_PREFIX]]users AS u'
                id_column: u.id
                custom_where_statement_if_no_refiner: "WHERE u.status <> 'suspended'"
            refiners:
                group_members: {}
                suspended_users:
                    sql: "u.status='suspended'"
                active_users:
                    sql: "u.status='active'"
                smart_group:
                    sql: 'TRUE'
                    table_join: ''
                    no_items_message: This smart group has no members
    
        
            
            columns:
                id:
                    title: ID
                    format: id
                    db_column: u.id
                    searchable: true
                    always_show: true
                    align_right: true
                    width: xsmall
                parent_id:
                    server_side_only: true
                    title: Parent ID
                    db_column: u.parent_id
                    align_right: true
                    width: xsmall
                
                identifier:
                    title: Identifier
                    db_column: u.identifier
                    searchable: true
                    width: medium
                    always_show: true
                status:
                    title: Status
                    db_column: u.status
                    format: enum
                    values:
                        active: Active extranet user
                        pending: Pending extranet user
                        suspended: Suspended extranet user
                        contact: Contact
                    always_show: true
                    parent: identifier
                    
                screen_name:
                    title: Screen name
                    db_column: u.screen_name
                    searchable: true
                    width: small
                salutation:
                    hidden: true
                    db_column: u.salutation
                first_name:
                    hidden: true
                    shown_in_view_options: true
                    title_in_view_options: First name
                    db_column: u.first_name
                    searchable: true
                name:
                    title: Name
                    title_in_view_options: Last name
                    db_column: u.last_name
                    sort_column: u.last_name, u.first_name
                    sort_column_desc: u.last_name DESC, u.first_name DESC
                    searchable: true
                    always_show: true
                    width: medium
                    microtemplate: |
                        {{(m.item.salutation || '')|e}} {{m.item.first_name|e}} {{m.item.name|e}}
                    
                email:
                    title: Email
                    db_column: u.email
                    always_show: true
                    searchable: true
                    width: large
                email_verified:
                    title: Email verified
                    db_column: u.email_verified
                    always_show: true
                    searchable: 1
                    format: enum
                    values:
                        verified: Email address verified
                        not_verified: Email not verified
                        email_not_set: ''
                    width: xsmall
                    parent: email
                email_domain:
                    title: Email domain
                    db_column: u.email_domain
                    searchable: true
                    show_by_default: false
                    width: large
                terms_and_conditions_accepted:
                    title: Terms and conditions accepted
                    format: yes_or_no
                    yes_phrase: Consents
                    no_phrase: No consent
                    db_column: u.terms_and_conditions_accepted
                    show_by_default: false
                groups:
                    title: Groups
                    width: medium
                    always_show: true
                creation_method:
                    title: Creation method
                    db_column: u.creation_method
                    width: xsmall
                    always_show: false
                created_date:
                    title: Created
                    db_column: u.created_date
                    always_show: true
                    format: datetime
                    width: small
                last_login:
                    title: Last login
                    db_column: u.last_login
                    width: xsmall
                    format: date
                    empty_value: Never logged in
                has_logged_in:
                    title: Has logged in
                    db_column: u.last_login IS NOT NULL
                    format: yes_or_no
                    yes_phrase: "Has logged in"
                    no_phrase: "Never logged in"
                    filters_by_value:
                        1: |
                            u.last_login IS NOT NULL
                    width: xsmall
                    always_show: false
                checksum:
                    db_column: f.checksum
                    table_join: "LEFT JOIN [[DB_PREFIX]]files AS f ON f.id = u.image_id AND f.`usage` = 'user'"
                filename:
                    db_column: f.filename
                    table_join: "LEFT JOIN [[DB_PREFIX]]files AS f ON f.id = u.image_id AND f.`usage` = 'user'"
                has_image:
                    #title: Has Image
                    format: yes_or_no
                    db_column: f.id IS NOT NULL
                    table_join: "LEFT JOIN [[DB_PREFIX]]files AS f ON f.id = u.image_id AND f.`usage` = 'user'"
                    width: xxsmall
                user_type: {}
                
            default_sort_column: identifier
            label_format_for_picked_items: '[[identifier]]'
            
            quick_filter_buttons:
                all:
                    label: 'All'
                    column: status
                    remove_filter: true
                contact:
                    label: 'Contacts'
                    column: status
                    value: contact
                active:
                    label: 'Users'
                    column: status
                    value: active
                pending:
                    label: 'Pending Users'
                    column: status
                    value: pending
                    
                has_logged_in:
                    label: 'Login activity'
                any_activity:
                    parent: has_logged_in
                    label: 'Any activity'
                    column: has_logged_in
                    remove_filter: true
                logged_in:
                    parent: has_logged_in
                    label: 'Has logged in'
                    column: has_logged_in
                never_logged_in:
                    parent: has_logged_in
                    label: 'Never logged in'
                    column: has_logged_in
                    invert: true

            item:
                css_class: user
                name: User
                names: Users
            collection_buttons:
                add:
                    label: Create a user or contact
                    hide_in_select_mode: true
                    priv: _PRIV_EDIT_USER
                    css_class: zenario_create_a_new
                    hide_on_filter: true
                    admin_box:
                        path: zenario_user__details
                        create_another: true
                
                add_user_to_this_group:
                    priv: _PRIV_EDIT_USER
                    only_show_on_refiner: group_members
                    hide_in_select_mode: true
                    label: Add users to this group
                    pick_items:
                        path: zenario__users/panels/users
                        request:
                            add_user_to_this_group: "1"
                        one_to_one_choose_phrase: Add user to group
                        multiple_select: true
                        one_to_many_choose_phrase: Add users to group
                
                # User dataset import buttons
                import_dropdown:
                    label: Import
                    hide_when_children_are_not_visible: true
                    ord: 999990
                import:
                    label: Start import wizard
                    parent: import_dropdown
                    hide_on_filter: true
                    hide_in_select_mode: true
                    admin_box:
                        path: zenario_import
                        key:
                            dataset:
                donwload_sample_file:
                    label: Download sample file
                    parent: import_dropdown
                    hide_on_filter: true
                    hide_in_select_mode: true
                    admin_box:
                        path: zenario_download_sample_file
                        key:
                            dataset:
                export:
                    label: Export
                    hide_in_select_mode: true
                    admin_box:
                        path: zenario_export_dataset
                        pass_matched_ids: true
                        key:
                            dataset:
                    ord: 999991
                
                settings_dropdown:
                    css_class: organizer_settings_dropdown
                    ord: 999992
                    hide_when_children_are_not_visible: true
                    label: ⚙
                
                users_dataset:
                    priv: _PRIV_MANAGE_DATASET
                    label: Edit Users dataset
                    parent: settings_dropdown
                    hide_in_select_mode: true
                    hide_on_refiner: true
                    link:
                        path: ''
                
                settings:
                    priv: _PRIV_VIEW_SITE_SETTING
                    label: Settings for Users/Contacts
                    parent: settings_dropdown
                    hide_in_select_mode: true
                    hide_on_refiner: true
                    admin_box:
                        path: site_settings
                        key:
                            id: users
                
                data_protection:
                    priv: _PRIV_VIEW_SITE_SETTING
                    label: Data Protection
                    parent: settings_dropdown
                    hide_in_select_mode: true
                    hide_on_refiner: true
                    admin_box:
                        path: site_settings
                        key:
                            id: data_protection
                    
                help:
                    label: Help
                    hide_in_select_mode: true
                    help:
                        message: |
                            Users are people who can log in to a private area of a Zenario site. To enable this feature, the Extranet Base Module and Login module must be running.
                            
                            Contacts are people whose details are stored on the site. Beside storing their details, Zenario may be able to send email newsletters to them. For this, the Newsletter module must be running.
                
            item_buttons:
                edit:
                    label: Edit [[user_type]]
                    hide_in_select_mode: true
                    priv: _PRIV_VIEW_USER
                    admin_box:
                        path: zenario_user__details
                impersonate:
                    label: Impersonate user
                    hide_in_select_mode: true
                    priv: _PRIV_IMPERSONATE_USER
                    admin_box:
                        path: zenario__impersonate
                    visible_if_for_all_selected_items: >
                        (item.status == 'active') 
                view_dropdown:
                    label: View
                    hide_in_select_mode: true
                    hide_when_children_are_not_visible: true
                action_dropdown:
                    label: Actions
                    hide_in_select_mode: true
                    hide_when_children_are_not_visible: true
                    multiple_select: true
                
                send_welcome_email:
                    hide_in_select_mode: true
                    parent: action_dropdown
                    priv: _PRIV_EDIT_USER
                    label: Send activation email
                    multiple_select_label: Send activation emails
                    multiple_select: true
                    with_columns_set:
                        traits.active: true
                    admin_box:
                        path: zenario_user__welcome_email
                    visible_if_for_all_selected_items: item.email != ''
                send_verification_email:
                    hide_in_select_mode: true
                    parent: action_dropdown
                    priv: _PRIV_EDIT_USER
                    label: Send verification email
                    multiple_select_label: Send verification emails
                    multiple_select: true
                    with_columns_set:
                        traits.active: true
                    admin_box:
                        path: zenario_user__verification_email
                    visible_if_for_all_selected_items: item.email != '' && item.email_verified == 'not_verified'
                change_password:
                    hide_in_select_mode: true
                    parent: action_dropdown
                    priv: _PRIV_EDIT_USER
                    label: Change password
                    with_columns_set:
                        traits.active: true
                    admin_box:
                        path: zenario_user__change_password
                
                add_users_to_groups:
                    priv: _PRIV_EDIT_USER
                    parent: action_dropdown
                    label: Add to groups...
                    hide_in_select_mode: true
                    multiple_select: true
                    admin_box:
                        path: zenario_mass_group_membership
                        key:
                            remove: false
                            
                remove_users_from_groups:
                    priv: _PRIV_EDIT_USER
                    parent: action_dropdown
                    label: Remove from groups...
                    hide_in_select_mode: true
                    multiple_select: true
                    admin_box:
                        path: zenario_mass_group_membership
                        key:
                            remove: true
                            
                flag_user:
                    priv: _PRIV_EDIT_USER
                    parent: action_dropdown
                    label: Add flags...
                    hide_in_select_mode: true
                    multiple_select: true
                    admin_box:
                        path: zenario_flag
                        key:
                            remove: false
                            
                remove_flags:
                    priv: _PRIV_EDIT_USER
                    parent: action_dropdown
                    label: Remove flags...
                    hide_in_select_mode: true
                    multiple_select: true
                    admin_box:
                        path: zenario_flag
                        key:
                            remove: true
                
                remove_users_from_this_group:
                    parent: action_dropdown
                    priv: _PRIV_EDIT_USER
                    only_show_on_refiner: group_members
                    hide_in_select_mode: true
                    label: Remove user from this Group
                    multiple_select_label: Remove users from this Group
                    multiple_select: true
                    ajax:
                        confirm:
                            button_message: Remove
                            cancel_button_message: Cancel
                            message_type: warning
                            multiple_select_message: 'Are you sure you wish to remove the [[item_count]] selected users/contacts from the group "[[label]]"?'
                            #The merge field "label" is overridden fillOrganizerPanel.
                        request:
                            remove_users_from_this_group: "1"
                image_dropdown:
                    label: Image
                    hide_in_select_mode: true
                    multiple_select: true
                    hide_when_children_are_not_visible: true
                view_image:
                    label: View image
                    parent: image_dropdown
                    ord: 70
                    popout:
                        href: zenario/file.php?popout=1&usage=user
                    with_columns_set:
                        traits.has_image: true
                upload_image:
                    label: Upload an image
                    hide_in_select_mode: true
                    parent: image_dropdown
                    ord: 71
                    priv: _PRIV_EDIT_USER
                    tooltip: |
                        Upload an image|
                        You may upload a .gif, a .jpeg, a .jpg or a .png image to use as an avatar for this User.<br/>
                    multiple_select: true
                    multiple_select_tooltip: |
                        Upload an image|
                        You may upload a .gif, a .jpeg, a .jpg or a .png image to use as an avatar for these Users.<br/>
                    upload:
                        accept: 'image/png, image/jpeg, image/gif, image/webp'
                        extensions:
                            - .gif
                            - .jpg
                            - .jpeg
                            - .png
                            - .webp
                        request:
                            upload_image: true
                    without_columns_set:
                        traits.has_image: true
                replace_image:
                    label: Upload a new image
                    hide_in_select_mode: true
                    parent: image_dropdown
                    ord: 72
                    priv: _PRIV_EDIT_USER
                    tooltip: |
                        Upload a new image|
                        You may upload a .gif, a .jpeg, a .jpg or a .png image to use as an image for this user.<br/>
                        Your new image will replace the existing one.
                    multiple_select: true
                    multiple_select_tooltip: |
                        Upload a new image|
                        You may upload a .gif, a .jpeg, a .jpg or a .png image to use as an avatar for these Users.<br/>
                        Your new image will replace the existing one.
                    upload:
                        accept: 'image/png, image/jpeg, image/gif, image/webp'
                        extensions:
                            - .gif
                            - .jpg
                            - .jpeg
                            - .png
                            - .webp
                        request:
                            upload_image: true
                    with_columns_set:
                        traits.has_image: true
                delete_image:
                    label: Remove image
                    hide_in_select_mode: true
                    parent: image_dropdown
                    ord: 73
                    priv: _PRIV_EDIT_USER
                    multiple_select: true
                    multiple_select_tooltip: Remove image
                    ajax:
                        confirm:
                            message: 'Are you sure you want to remove the image from user "[[identifier]]"?'
                            multiple_select_message: >
                                Are you sure you want to remove the images from the selected users?
                            button_message: Remove
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            delete_image: "1"
                    with_columns_set:
                        traits.has_image: true
                convert_to_user:
                    label: Convert to extranet user...
                    hide_in_select_mode: true
                    parent: action_dropdown
                    priv: _PRIV_EDIT_USER
                    admin_box:
                        path: zenario_user__convert_to_user
                    with_columns_set:
                        traits.is_contact: true
                convert_to_contact:
                    label: Convert to contact...
                    hide_in_select_mode: true
                    parent: action_dropdown
                    priv: _PRIV_EDIT_USER
                    without_columns_set:
                        traits.is_contact: true
                    ajax:
                        confirm:
                            message: ""
                            button_message: Convert to contact
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            convert_to_contact: "1"
                activate:
                    label: Re-activate account
                    hide_in_select_mode: true
                    parent: action_dropdown
                    priv: _PRIV_EDIT_USER
                    with_columns_set:
                        traits.suspended: true
                    admin_box:
                        path: zenario_user__activate
                
                suspend:
                    hide_in_select_mode: true
                    parent: action_dropdown
                    priv: _PRIV_EDIT_USER
                    label: Suspend account
                    multiple_select: true
                    with_columns_set:
                        traits.active: true
                    ajax:
                        confirm:
                            message: |
                                Suspend account for user "[[identifier]]"?

                                The account will then appear in Organizer's "Suspended users" panel.
                            multiple_select_message: |
                                Suspend accounts for the selected users?

                                The accounts will then appear in Organizer's "Suspended users" panel.
                            button_message: Suspend
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            suspend_user: "1"
                
                delete:
                    label: Delete [[user_type]]
                    multiple_select_label: Delete user/contact
                    hide_in_select_mode: true
                    priv: _PRIV_EDIT_USER
                    multiple_select: true
                    admin_box:
                        path: zenario_user__delete
            inline_buttons:
                active:
                    css_class: zenario_users_active_status
                    tooltip: "Extranet user"
                    visible_if: >
                        (item.status == "active")
                contact:
                    css_class: zenario_users_contact_status
                    tooltip: "Contact"
                    visible_if: >
                        (item.status == "contact")
                pending:
                    css_class: zenario_users_pending_status
                    tooltip: "Extranet user (pending)"
                    visible_if: >
                        (item.status == "pending")
                suspended:
                    css_class: zenario_users_suspended_status
                    tooltip: "Extranet user (suspended)"
                    visible_if: >
                        (item.status == "suspended")

