# You must use a tab-size of 4 spaces to edit this file.
---
zenario_import:
    key:
        id: ''
        dataset: ''
        
        reset_key_line: 0
        create_header_fields: 0
        guess_key_line: 0
        update_preview: 0
        update_actions: 0
        
        header_count: ''
        lines_to_skip: ''
        new_records: ''
    old_values:
        file: ''
        key_line: ''
        update_key_field: ''
        header_list: ''
        insert_or_update: ''
        insert_options: ''
    title: Dataset Import Wizard - Step 1 of 4
    hide_tab_bar: true
    disable_selecting_tab_from_url: true
    save_button_message: Import now
    tab: file
    tabs:
        file:
            _step: 1
            label: File
            edit_mode:
                enabled: true
            fields:
                desc:
                    snippet:
                        html: |
                            <p>
                                Use this interface to import data on users or contacts from a file in CSV files or Excel format.
                            </p>
                            <br/>
                            <p>
                                Within the first 5 rows the file must have a row that names the fields contained in the data.
                            </p>
                file:
                    label: 'Select a CSV or XLSX file to import:'
                    upload:
                        drag_and_drop: true
                        accept: 'text/csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
                        extensions:
                            - .csv
                            - .xls
                    validation:
                        required: Please select a CSV or XLSX file to import.
                    format_onchange: true
                type:
                    label: 'Import action:'
                    type: radios
                    values:
                        insert_data:
                            ord: 1
                            label: 'Insert or update'
                            note_below: 'Recommended. Imported records with email addresses that match existing records will cause an update. Records with non-matching email addresses will be inserted.'
                        update_data:
                            ord: 2
                            label: 'Update only'
                            note_below: 'Update existing records using email address as the unique key, but ignore any new records in the import file'
                    value: insert_data
                    validation:
                        required: Please select an import type.
                next:
                    value: Next
                    css_class: zenario_gp_button
                    type: submit
                    ord: 999999
        headers:
            _step: 2
            label: Fields
            edit_mode:
                enabled: true
            template_fields:
                file_column_name:
                    same_row: true
                    readonly: true
                    type: text
                    style: width:20em;
                file_column_match:
                    same_row: true
                    type: select
                    empty_value: -- Omit field --
                    format_onchange: true
                    values: dataset_fields
                file_column_description:
                    same_row: true
                    post_field_html: <br/>
                    snippet:
                        html: 'test'
            fields:
                desc:
                    ord: 0.5
                    snippet:
                        html: |
                            <p>Field names: select the row in the file that contains the field names.</p>
                key_lines_preview:
                    label: 'Preview (first 5 lines):'
                    type: code_editor
                    dont_trim: true
                    readonly: true
                    style: "height: 10em"
                key_line:
                    ord: 1
                    label: 'Which row contains the field names?'
                    type: select
                    value: 1
                    values:
                        1: Row 1
                        2: Row 2
                        3: Row 3
                        4: Row 4
                        5: Row 5
                    format_onchange: true
                
                insert_desc:
                    ord: 1.01
                    snippet:
                        html: |
                            <p>Duplicates: you can choose to update existing user records instead of creating a new one if a matching email address is found.</p>
                
                insert_options:
                    ord: 1.02
                    type: radios
                    label: 'When encountering a record with an email address already in the database:'
                    values:
                        no_update:
                            ord: 1
                            label: Skip; leave existing one as-is
                        merge:
                            ord: 2
                            label: Merge new record into existing
                        overwrite:
                            ord: 3
                            label: Overwrite existing record with new one
                    value: no_update
                        
                
                update_desc:
                    ord: 1.1
                    snippet:
                        html: |
                            Select the field name to uniquely identify each line, preferably email address. This will be used to match the line to an entry in the database. If two or more lines have matching identifiers they will be not be imported. If two or more entries in the database match a lines identifier they will all be updated (although a warning will show at stage 3).
                    
                update_key_field:
                    ord: 1.2
                    label: 'Which field contains email address?'
                    type: select
                    empty_value: '-- Select --'
                    values: {}
                
                desc2:
                    ord: 2
                    snippet:
                        html: |
                            <p>Field names: specify which field names correspond to which database columns, or omit the field from import.</p>
                file_column_headers:
                    ord: 3
                    snippet:
                        html: |
                            <div style="width:21em;float:left"><b>Field name in file</b></div>
                            <div style="width:21em;float:left"><b>Database column</b></div>
                            <div><b>Field must be:</b></div>
                    post_field_html: <br>
                
                previous:
                    value: Previous
                    css_class: zenario_gp_button
                    type: submit
                    ord: 999998
                next:
                    value: Next
                    css_class: zenario_gp_button
                    type: submit
                    ord: 999999
        preview:
            _step: 3
            label: Preview
            edit_mode:
                enabled: true
            fields:
                desc:
                    snippet:
                        html: Review the data about to be imported and the problems encountered. Any line with an error will be skipped.
                total_readable_lines:
                    snippet:
                        html:
                csv_preview:
                    label: 'Preview (up to 200 lines are shown):'
                    type: code_editor
                    dont_trim: true
                    readonly: true
                problems:
                    label: 'Problems:'
                    type: code_editor
                    dont_trim: true
                    readonly: true
                previous:
                    value: Previous
                    css_class: zenario_gp_button
                    type: submit
                    ord: 999998
                next:
                    value: Next
                    css_class: zenario_gp_button
                    type: submit
                    ord: 999999
        actions:
            _step: 4
            label: Actions
            edit_mode:
                enabled: true
            notices:
                screen_name_for_contacts:
                    show: false
                    message: |
                        You have opted to import screen names from your uploaded data, but these are not supported for Contacts. The imported screen name data will be ignored.
                    type: warning
            template_fields:
                dataset_field_value:
                    same_row: true
                    post_field_html: <br>
                    type: text
                    style: 'width:20em;'
                dataset_field_name:
                    same_row: true
                    readonly: true
                    type: text
                    style: 'width:15em;'
            fields:
                records_statement:
                    snippet:
                        html: 
                email_report:
                    label: Email me a report
                    type: checkbox
                
                send_welcome_email:
                    label: 'Send activation email'
                    type: checkbox
                    redraw_onchange: true
                    side_note: |
                        Send a activation email to any newly created active users.
                    hidden: true
                email_to_send:
                    hide_with_previous_field: true
                    visible_if: |
                        zenarioAB.value('send_welcome_email')
                    label: 'Email template:'
                    pick_items:
                        path: zenario__email_template_manager/panels/email_templates
                        min_path: zenario__email_template_manager/panels/email_templates
                        max_path: zenario__email_template_manager/panels/email_templates
                        target_path: zenario__email_template_manager/panels/email_templates
                        select_phrase: Select email template...
                        hide_remove_button: true
                    validation:
                        required_if_not_hidden: Please select an email template
                    side_note: >
                        An email based on the selected email template will be sent
                        to the selected users.
                    indent: 1
                
                line_break:
                    label: 'Auto-set fields:'
                    snippet:
                        html: |
                            You can mass-set values for the following fields (these are not present on your import)
                            <br/><br/>
                previous:
                    value: Previous
                    css_class: zenario_gp_button
                    type: submit
                    ord: 999999
