# You must use a tab-size of 4 spaces to edit this file.
---
zenario_smart_group:
    priv: _PRIV_MANAGE_GROUP
    key:
        id: ""
        intended_usage: smart_newsletter_group
        num_rules: 1
        duplicate: false
        
        # Flags for whether certain types of user-field exist
        checkboxesExist: false
        consentsExist: false
        groupsExist: false
        listsExist: false
        
        # Flags for whether things from other modules exist
        assetsExist: false
        companiesExist: false
        locationsExist: false
        rolesExist: false
        userTimersModuleIsRunning: false
        userTimersExist: false
        activityBandsExist: false
        isNotMemberExist: false
        isMemberExist: false
        
    identifier:
        css_class: zenario_smart_group
        label: Smart Group ID
    hide_tab_bar: true
    title: ''
    tabs:
        smart_group:
            edit_mode:
                enabled: true
            fields:
                name: 
                    label: "Smart group name:"
                    type: text
                    maxlength: 50
                    style: |
                        width: 25em;
                    validation: 
                        required: "Please enter a smart group name."
                intended_usage:
                    hidden: true
                    label: "Intended usage:"
                    type: select
                    values:
                        smart_permissions_group:
                            ord: 1
                            label: "Smart group"
                        smart_newsletter_group:
                            ord: 2
                            label: "Smart newsletter group"
                must_match:
                    full_width: true
                    pre_field_html: |
                        Define which users are included by adding rules.
                        Users will appear in this smart group when&nbsp;
                    type: select
                    format_onchange: true
                    values:
                        all:
                            label: 'they match ALL of the rules below:'
                        any:
                            label: 'they match ANY of the rules below:'
                
                table_start:
                    full_width: true
                    snippet: 
                        html: |
                            <table class="zenario_smart_group_rules">
                
                table_end:
                    ord: 999996
                    same_row: true
                    snippet: 
                        html: |
                            </table>
                
                
                members: 
                    ord: 999997
                    label: "Users/contacts that match these rules:"
                    type: text
                    readonly: true
                    style: |
                        width: 5em;
                    value: 0
                
                no_rules_set_news: 
                    ord: 999998
                    visible_if: tuix.key.intended_usage == 'smart_newsletter_group'
                    full_width: true
                    label: "Users/contacts that match these rules:"
                    snippet: 
                        label: No rules are set. All users will be included.
                
                no_rules_set_perms: 
                    ord: 999999
                    visible_if: tuix.key.intended_usage == 'smart_permissions_group'
                    full_width: true
                    label: "Users/contacts that match these rules:"
                    snippet: 
                        label: No rules are set. No one will be included.
                        
            custom_template_fields:
                type__znz:
                    same_row: true
                    type: select
                    empty_value: ' -- Select -- '
                    values: types
                    format_onchange: true
                    pre_field_html: |
                        <tr><td>
                    post_field_html: |
                        </td><td>
                
                is_isnt_in__znz:
                    same_row: true
                    type: select
                    values:
                        is:
                            label: member of
                        is_one_of:
                            label: member of ANY of
                        isnt:
                            label: not a member of
                    visible_if: |
                        zenarioAB.value('type__znz') == 'group' 
                    format_onchange: true
                    
                is_isnt_in_activity_band__znz:
                    same_row: true
                    type: select
                    values:
                        is:
                            label: in activity band
                        isnt:
                            label: not in activity band
                    visible_if: |
                        zenarioAB.value('type__znz') == 'activity_band'
                    format_onchange: true
                
                field__znz:
                    same_row: true
                    type: select
                    values: fields
                    empty_value: ' -- Select -- '
                    visible_if: |
                        zenarioAB.value('type__znz') == 'checkbox' ||
                        zenarioAB.value('type__znz') == 'consent' ||
                        zenarioAB.value('type__znz') == 'group' ||
                        zenarioAB.value('type__znz') == 'list'
                    format_onchange: true
                    validation:
                        required_if_not_hidden: "Please select a field."
                
                field2__znz:
                    same_row: true
                    pre_field_html: ' or&nbsp;'
                    type: select
                    empty_value: ' -- Select -- '
                    values: fields
                    visible_if: |
                        zenarioAB.value('type__znz') == 'group' &&
                        zenarioAB.value('is_isnt_in__znz') == 'is_one_of'
                    format_onchange: true
                
                field3__znz:
                    same_row: true
                    pre_field_html: ' or&nbsp;'
                    type: select
                    empty_value: ' -- Select -- '
                    values: fields
                    visible_if: |
                        zenarioAB.value('type__znz') == 'group' &&
                        zenarioAB.value('is_isnt_in__znz') == 'is_one_of' &&
                        (zenario.engToBoolean(zenarioAB.value('field2__znz')) || zenario.engToBoolean(zenarioAB.value('field3__znz')))
                    format_onchange: true
                
                field4__znz:
                    same_row: true
                    pre_field_html: ' or&nbsp;'
                    type: select
                    empty_value: ' -- Select -- '
                    values: fields
                    visible_if: |
                        zenarioAB.value('type__znz') == 'group' &&
                        zenarioAB.value('is_isnt_in__znz') == 'is_one_of' &&
                        (zenario.engToBoolean(zenarioAB.value('field3__znz')) || zenario.engToBoolean(zenarioAB.value('field4__znz')))
                    format_onchange: true
                
                field5__znz:
                    same_row: true
                    pre_field_html: ' or&nbsp;'
                    type: select
                    empty_value: ' -- Select -- '
                    values: fields
                    visible_if: |
                        zenarioAB.value('type__znz') == 'group' &&
                        zenarioAB.value('is_isnt_in__znz') == 'is_one_of' &&
                        (zenario.engToBoolean(zenarioAB.value('field4__znz')) || zenario.engToBoolean(zenarioAB.value('field5__znz')))
                    format_onchange: true
                    
                activity_bands__znz:
                    same_row: true
                    type: select
                    type: select
                    empty_value: ' -- Select --'
                    visible_if: |
                        zenarioAB.value('type__znz') == 'activity_band'
                    format_onchange: true
                
                is_isnt_set__znz:
                    same_row: true
                    type: select
                    values:
                        is:
                            label: is set
                        isnt:
                            label: is not set
                    visible_if: |
                        zenarioAB.value('type__znz') == 'checkbox' ||
                        zenarioAB.value('type__znz') == 'consent'
                    format_onchange: true
                
                
                is_isnt__znz:
                    same_row: true
                    type: select
                    values:
                        is:
                            label: is
                        isnt:
                            label: is not
                    visible_if: |
                        (zenarioAB.value('type__znz') && 1 * zenarioAB.value('type__znz')) ||
                        (zenarioAB.value('type__znz') == 'list' && zenarioAB.value('field__znz'))
                    format_onchange: true
                
                value__znz:
                    same_row: true
                    type: select
                    empty_value: ' -- Select -- '
                    validation:
                        required_if_not_hidden: "Please select a value."
                    format_onchange: true
                
                has_the_role__znz:
                    same_row: true
                    snippet:
                        label: 'Has the role'
                    visible_if: |
                        zenarioAB.value('type__znz') == 'role'
                
                role__znz:
                    same_row: true
                    type: select
                    values: roles
                    empty_value: ' -- Select -- '
                    visible_if: |
                        zenarioAB.value('type__znz') == 'role'
                    format_onchange: true
                    validation:
                        required_if_not_hidden: "Please select a role."
                
                role_at_specified_location__znz:
                    same_row: true
                    snippet:
                        label: 'at the location specified in the URL'
                    visible_if: |
                        zenarioAB.value('type__znz') == 'role'
                        && tuix.key.intended_usage == 'smart_permissions_group'
                
                role_at_any_location__znz:
                    same_row: true
                    snippet:
                        label: 'at any location'
                    visible_if: |
                        zenarioAB.value('type__znz') == 'role'
                        && tuix.key.intended_usage == 'smart_newsletter_group'
                
                timer_template__znz:
                    same_row: true
                    type: select
                    values: timerTemplates
                    empty_value: ' -- Select -- '
                    visible_if: |
                        (zenarioAB.value('type__znz') == 'has_a_current_timer' || zenarioAB.value('type__znz') == 'has_no_current_timer')
                    format_onchange: true
                    validation:
                        required_if_not_hidden: "Please select a timer template."
                
                td__znz:
                    same_row: true
                    snippet: 
                        html: |
                            </td><td>
                
                remove__znz:
                    same_row: true
                    type: submit
                    css_class: zenario_gp_button
                    value: '-'
                    visible_if: |
                        zenarioAB.value('type__znz') || znz > 1
                add__znz:
                    same_row: true
                    type: submit
                    css_class: zenario_gp_button
                    value: '+'
                    visible_if: |
                        zenarioAB.value('type__znz') && znz == zenarioAB.tuix.key.num_rules
                
                tr__znz:
                    same_row: true
                    snippet: 
                        html: |
                            </td></tr>
                perms_comment:
                    ord: 100006
                    visible_if: tuix.key.intended_usage == 'smart_permissions_group'
                    full_width: true
                    snippet: 
                        html: Only people with status of Active can log in to see private content items.
    lovs:
        fields: {}
        types:
            user_fields:
                ord: 1
                label: User fields
            group:
                parent: user_fields
                ord: 100001
                label: Group (Create a group to enable this option)
                disabled_if: tuix.key.groupsExist == false

            checkbox:
                parent: user_fields
                ord: 100002
                label: Checkbox
                visible_if: tuix.key.checkboxesExist
            consent:
                parent: user_fields
                ord: 100003
                label: Consent checkbox
                visible_if: tuix.key.consentsExist
            list:
                parent: user_fields
                ord: 100004
                label: Radio or list
                visible_if: tuix.key.listsExist
            
            has_access_to:
                ord: 2
                label: Other checks
                hide_when_children_are_not_visible: true
              
            activity_band:
                ord: 6
                parent: has_access_to
                label: Activity band
                visible_if: tuix.key.activityBandsExist 
                
            role:
                ord: 7
                parent: has_access_to
                label: Role
                visible_if: tuix.key.rolesExist
                
            in_a_group:
                ord: 8
                parent: has_access_to
                label: Is a member of any group
                disabled_if: tuix.key.isMemberExist == false
                
            not_in_a_group:
                ord: 9
                parent: has_access_to
                label:  Is not a member of any group
                disabled_if: tuix.key.isNotMemberExist == false

            has_a_current_timer:
                ord: 10
                parent: has_access_to
                label: Has a current timer
                visible_if: tuix.key.userTimersModuleIsRunning
                disabled_if: tuix.key.userTimersExist == false
                
            has_no_current_timer:
                ord: 11
                parent: has_access_to
                label:  Has an expired timer and no current timer
                visible_if: tuix.key.userTimersModuleIsRunning
                disabled_if: tuix.key.userTimersExist == false