# You must use a tab-size of 4 spaces to edit this file.
---
zenario__administration:
    panels:
        administrators:
            priv: _PRIV_VIEW_ADMIN
            panel_type: multi_line_list_or_grid
            css_class: three_line_list_panel
            use_tall_rows: true
            title: Administrators
            no_items_message: This site has no administrators. Click "Create" to create one.
            db_items:
                table: '[[DB_PREFIX]]admins AS a'
                id_column: a.id
                custom_where_statement_if_no_refiner: "WHERE status != 'deleted'"
            refiners:
                active:
                    sql: "status != 'deleted'"
                trashed:
                    sql: "status = 'deleted'"
                active_local:
                    sql: "status != 'deleted' AND authtype = 'local'"
            default_sort_column: full_name
            notice:
                show: false
                type: information
                message: ''
                    
            columns:
                id:
                    db_column: a.id
                    hidden: true
                full_name:
                    title: Name and details
                    db_column: CONCAT(a.first_name, ' ', a.last_name)
                    show_by_default: true
                    always_show: true
                    searchable: true
                    width: large
                username:
                    parent: full_name
                    title: Username
                    db_column: a.username
                    show_by_default: true
                    always_show: true
                    searchable: true
                email_address:
                    parent: full_name
                    title: Email
                    db_column: a.email
                    always_show: true
                    searchable: true
                authtype:
                    title: Account type
                    db_column: a.authtype
                    format: enum
                    values:
                        local: Local
                        super: Multi-site
                    show_by_default: true
                    disallow_sorting: true
                    width: small
                is_client_account:
                    parent: authtype
                    title: Is client account
                    show_by_default: true
                    db_column: a.is_client_account
                    disallow_sorting: true
                permissions:
                    css_class: organizer_cell_uses_multiple_rows
                    title: Permissions
                    show_by_default: true
                    always_show: true
                    disallow_sorting: true
                    width: large
                is_inactive:
                    format: yes_or_no
                csuper:
                    db_column: "IF (a.authtype = 'multi-site', ', multi-site', \'\')"
                status:
                    db_column: a.status
                    server_side_only: true
                created_date:
                    title: Created
                    db_column: a.created_date
                    format: date
                session_id:
                    db_column: session_id
                last_login:
                    title: Last login
                    db_column: |
                        a.last_login
                    show_by_default: true
                    width: medium
                last_activity_time:
                    parent: last_login
                    title: Last activity
                    show_by_default: true
                    width: medium
                pending_2fa:
                    parent: last_login
                    title: Pending 2FA
                    show_by_default: true
                    width: medium
                last_platform:
                    title: Last login browser & IP address
                    db_column: |
                        IF(a.last_login_ip<>'',CONCAT(a.last_platform, ' ', a.last_browser, ' v. ', a.last_browser_version, ' from ', a.last_login_ip), '')
                    width: xlarge
                    disallow_sorting: true
                failed_login_count_since_last_successful_login:
                    db_column: a.failed_login_count_since_last_successful_login
                    hidden: true
                
                filename:
                    db_column: f.filename
                    table_join: >
                        LEFT JOIN [[DB_PREFIX]]files AS f
                        ON a.image_id = f.id
                        AND f.`usage` = 'admin'
                checksum:
                    db_column: f.checksum
                    table_join: >
                        LEFT JOIN [[DB_PREFIX]]files AS f
                        ON a.image_id = f.id
                        AND f.`usage` = 'admin'
                has_image:
                    format: yes_or_no
                    db_column: f.id IS NOT NULL
                    table_join: >
                        LEFT JOIN [[DB_PREFIX]]files AS f
                        ON a.image_id = f.id
                        AND f.`usage` = 'admin'
                    width: xxsmall
                
            label_format_for_picked_items: |
                [[full_name_for_pickers]]
            
            quick_filter_buttons:
                all:
                    label: 'All'
                    column: authtype
                    remove_filter: true
                local:
                    label: 'Local'
                    column: authtype
                    value: local
                super:
                    label: 'Multi-site'
                    column: authtype
                    value: super

            item:
                css_class: admin_item
            collection_buttons:
                create:
                    priv: _PRIV_CREATE_ADMIN
                    css_class: zenario_create_a_new
                    hide_on_filter: true
                    label: Create an administrator
                    hide_on_refiner: trashed
                    hide_in_select_mode: true
                    admin_box:
                        path: zenario_admin
            item_buttons:
                edit:
                    ord: 1
                    priv: _PRIV_VIEW_ADMIN
                    label: Edit acccount
                    hide_in_select_mode: true
                    admin_box:
                        path: zenario_admin
                action_dropdown:
                    label: Actions
                    multiple_select: true
                    hide_when_children_are_not_visible: true
                copy_perms:
                    parent: action_dropdown
                    priv: _PRIV_EDIT_ADMIN
                    label: Copy permissions from...
                    admin_box:
                        path: admin_copy_perms
                    #If there are 2 or more local admins, this tooltip will be changed
                    #in the module code to "You cannot copy another admin's permissions to yourself."
                    disabled_tooltip: |
                        You can only copy permissions when you have at least two local administrators
                    hide_on_refiner: trashed
                    hide_in_select_mode: true
                    visible_if: item.authtype == 'local'
                    disabled_if: item.currently_logged_in_admin
                restore_admin:
                    parent: action_dropdown
                    priv: _PRIV_DELETE_ADMIN
                    label: Restore
                    multiple_select: true
                    hide_in_select_mode: true
                    only_show_on_refiner: trashed
                    ajax:
                        confirm:
                            message: |
                                Are you sure you wish to restore the administrator account "[[username]]"?
                                
                                (After being restored, you will also need to give them a password reset before they can log in.)
                            multiple_select_message: |
                                Are you sure you wish to restore the selected administrator accounts?
                                
                                (After being restored, you will also need to give them a password reset before they can log in.)
                            button_message: Restore
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            restore: 1
                    with_columns_set:
                        isLocal: true
                        isTrashed: true
                trash_admin:
                    parent: action_dropdown
                    priv: _PRIV_DELETE_ADMIN
                    label: Trash
                    hide_in_select_mode: true
                    with_columns_set:
                        isLocal: true
                        isActive: true
                        last_login: true
                    without_columns_set:
                        isCurrentAdmin: true
                    admin_box:
                        path: zenario_trash_admin
                delete_admin:
                    parent: action_dropdown
                    priv: _PRIV_DELETE_ADMIN
                    label: Delete
                    hide_in_select_mode: true
                    multiple_select: true
                    with_columns_set:
                        isLocal: true
                        isActive: true
                    without_columns_set:
                        last_login: true
                        isCurrentAdmin: true
                    ajax:
                        confirm:
                            message: |
                                Are you sure you wish to delete the administrator account "[[username]]"?
                            multiple_select_message: |
                                Are you sure you wish to restore the selected administrator accounts?
                            button_message: Delete
                            cancel_button_message: Cancel
                            message_type: warning
                        request:
                            delete: 1
            inline_buttons:
                inactive:
                    visible_if: |
                        zenario.engToBoolean(item.is_inactive)
                    css_class: zenario_ib_warning
                    admin_box:
                        path: zenario_admin
                    tooltip: |
                        [[inactive_tooltip]]
                3_or_more_failed_login_attempts_since_last_successful_login:
                    visible_if: |
                        zenario.engToBoolean(item.admin_had_3_or_more_failed_login_attempts_since_last_successful_login)
                    css_class: zenario_ib_warning
                    admin_box:
                        path: zenario_admin
                    tooltip: |
                        [[3_or_more_failed_login_attempts_since_last_successful_login_tooltip]]

            
            trash:
                link:
                    path: zenario__administration/panels/administrators
                    refiner: trashed
                    branch: true
