<?php

add_action( 'acf/init', 'apartment_fee_manager_add_rentpress_tab' );

function apartment_fee_manager_add_rentpress_tab() {

    if ( function_exists( 'acf_add_options_sub_page' ) ) {

        $options_page = acf_add_options_sub_page( array(
            'page_title'  => 'Fees Calculator Settings',
            'menu_title'  => 'Fees Calculator',
            'parent_slug' => 'rentpress',
            'menu_slug'   => 'fee-calculator-settings',
            'capability'  => 'manage_options',
        ) );

        if ( function_exists( 'acf_add_local_field_group' ) ) {

        acf_add_local_field_group( array(
            'key' => 'group_695c007f6e008',
            'title' => 'Apartment Fees Global Options',
            'fields' => array(
                array(
                    'key' => 'field_695c007ff8812',
                    'label' => 'Amenity Sort',
                    'name' => 'fees_amenity_sort',
                    'aria-label' => '',
                    'type' => 'select',
                    'instructions' => 'Amenities will be shown in the order they are entered but can be adjusted here to display alphabetically or by price ( A - Z, 1 - 10 )',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '50',
                        'class' => '',
                        'id' => '',
                    ),
                    'choices' => array(
                        'default' => 'Default',
                        'alpha' => 'Alphabetical',
                        'price' => 'Price',
                    ),
                    'default_value' => 'default',
                    'return_format' => 'value',
                    'multiple' => 0,
                    'allow_null' => 0,
                    'allow_in_bindings' => 0,
                    'ui' => 0,
                    'ajax' => 0,
                    'placeholder' => '',
                    'create_options' => 0,
                    'save_options' => 0,
                ),
                array(
                    'key' => 'field_695c0218f8813',
                    'label' => 'Accent Color Override',
                    'name' => 'fees_accent_color_override',
                    'aria-label' => '',
                    'type' => 'color_picker',
                    'instructions' => 'Your RentPress accent color will be used by default, but can be overridden here.',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '50',
                        'class' => '',
                        'id' => '',
                    ),
                    'default_value' => '',
                    'enable_opacity' => 0,
                    'return_format' => 'string',
                    'allow_in_bindings' => 0,
                    'show_custom_palette' => 0,
                    'show_color_wheel' => 1,
                    'custom_palette_source' => '',
                    'palette_colors' => '',
                ),
                array(
                    'key' => 'field_695d381b954cc',
                    'label' => 'Placement',
                    'name' => '',
                    'aria-label' => '',
                    'type' => 'accordion',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '',
                        'class' => 'fees-accordion',
                        'id' => '',
                    ),
                    'open' => 0,
                    'multi_expand' => 0,
                    'endpoint' => 0,
                ),
                array(
                    'key' => 'field_695d37410f25b',
                    'label' => 'Single Floor Plan Calculator Placement',
                    'name' => 'fees_calculator_placement',
                    'aria-label' => '',
                    'type' => 'select',
                    'instructions' => 'By default, the Fees Calculator is added to themes by the available shortcodes. However, placement can be automatically inserted into the template inline or by a button triggering a modal.',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '50',
                        'class' => '',
                        'id' => '',
                    ),
                    'choices' => array(
                        'shortcode' => 'Shortcode',
                        'inline' => 'Inline',
                        'modal' => 'Modal',
                    ),
                    'default_value' => 'shortcode',
                    'return_format' => 'value',
                    'multiple' => 0,
                    'allow_null' => 0,
                    'allow_in_bindings' => 0,
                    'ui' => 0,
                    'ajax' => 0,
                    'placeholder' => '',
                    'create_options' => 0,
                    'save_options' => 0,
                ),
                array(
                    'key' => 'field_697ce3a6f0795',
                    'label' => 'Single Property Calculator Placement',
                    'name' => 'fees_property_calculator_placement',
                    'aria-label' => '',
                    'type' => 'select',
                    'instructions' => 'By default, the Fees Calculator is added to themes by the available shortcodes. However, placement can be automatically inserted into the template inline or by a button triggering a modal.',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '50',
                        'class' => '',
                        'id' => '',
                    ),
                    'choices' => array(
                        'shortcode' => 'Shortcode',
                        'inline' => 'Inline',
                        'modal' => 'Modal',
                    ),
                    'default_value' => 'shortcode',
                    'return_format' => 'value',
                    'multiple' => 0,
                    'allow_null' => 0,
                    'allow_in_bindings' => 0,
                    'ui' => 0,
                    'ajax' => 0,
                    'placeholder' => '',
                    'create_options' => 0,
                    'save_options' => 0,
                ),
                array(
                    'key' => 'field_695d403b8286c',
                    'label' => 'Single Floor Plan Location',
                    'name' => 'fees_single_floor_plan_location',
                    'aria-label' => '',
                    'type' => 'radio',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => array(
                        array(
                            array(
                                'field' => 'field_695d37410f25b',
                                'operator' => '==',
                                'value' => 'inline',
                            ),
                        ),
                    ),
                    'wrapper' => array(
                        'width' => '50%',
                        'class' => '',
                        'id' => '',
                    ),
                    'choices' => array(
                        '.rentpress-single-floorplan-page-info-row' => 'Above Explore More Options',
                        '.rentpress-similar-floorplans' => 'Below Explore More Options',
                    ),
                    'default_value' => 'rentpress-single-floorplan-page-info-row',
                    'return_format' => 'value',
                    'allow_null' => 0,
                    'other_choice' => 0,
                    'allow_in_bindings' => 0,
                    'layout' => 'vertical',
                    'save_other_choice' => 0,
                ),
                array(
                    'key' => 'field_695d41d1c48c2',
                    'label' => 'Single Floor Plan Modal Button Location',
                    'name' => 'fees_single_floor_plan_modal_button_location',
                    'aria-label' => '',
                    'type' => 'radio',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => array(
                        array(
                            array(
                                'field' => 'field_695d37410f25b',
                                'operator' => '==',
                                'value' => 'modal',
                            ),
                        ),
                    ),
                    'wrapper' => array(
                        'width' => '50',
                        'class' => '',
                        'id' => '',
                    ),
                    'choices' => array(
                        '.rentpress-floorplan-about-section' => 'After Floor Plan About Text',
                        '#property-pet-policy' => 'After Pet Policy Text',
                        '.rentpress-single-floorplan-main-info-block-cta-wrapper' => 'CTA Buttons Group',
                    ),
                    'default_value' => '.rentpress-floorplan-about-section',
                    'return_format' => 'value',
                    'allow_null' => 0,
                    'other_choice' => 0,
                    'allow_in_bindings' => 0,
                    'layout' => 'vertical',
                    'save_other_choice' => 0,
                ),
                array(
                    'key' => 'field_697ce447f0796',
                    'label' => 'Single Property Location',
                    'name' => 'fees_single_property_location',
                    'aria-label' => '',
                    'type' => 'radio',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => array(
                        array(
                            array(
                                'field' => 'field_697ce3a6f0795',
                                'operator' => '==',
                                'value' => 'inline',
                            ),
                        ),
                    ),
                    'wrapper' => array(
                        'width' => '50%',
                        'class' => '',
                        'id' => '',
                    ),
                    'choices' => array(
                        '.rentpress-single-property-info-row' => 'Below the Property Info',
                        '#floorplans' => 'Below the Floor Plans',
                    ),
                    'default_value' => 'rentpress-single-property-info-row',
                    'return_format' => 'value',
                    'allow_null' => 0,
                    'other_choice' => 0,
                    'allow_in_bindings' => 0,
                    'layout' => 'vertical',
                    'save_other_choice' => 0,
                ),
                array(
                    'key' => 'field_697ce44ff0797',
                    'label' => 'Single Property Modal Button Location',
                    'name' => 'fees_single_property_modal_button_location',
                    'aria-label' => '',
                    'type' => 'radio',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => array(
                        array(
                            array(
                                'field' => 'field_697ce3a6f0795',
                                'operator' => '==',
                                'value' => 'modal',
                            ),
                        ),
                    ),
                    'wrapper' => array(
                        'width' => '50',
                        'class' => '',
                        'id' => '',
                    ),
                    'choices' => array(
                        '.rentpress-property-about-section' => 'After About Community Text',
                        '#property-pet-policy' => 'After Pet Policy Text',
                    ),
                    'default_value' => '.rentpress-property-about-section',
                    'return_format' => 'value',
                    'allow_null' => 0,
                    'other_choice' => 0,
                    'allow_in_bindings' => 0,
                    'layout' => 'vertical',
                    'save_other_choice' => 0,
                ),
                                array(
                    'key' => 'field_accordion_labels',
                    'label' => 'Labels',
                    'name' => '',
                    'type' => 'accordion',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '',
                        'class' => 'fees-accordion',
                        'id' => '',
                    ),
                    'open' => 0,
                    'multi_expand' => 1,
                    'endpoint' => 0,
                ),
                array(
                    'key' => 'field_69665c46064f7',
                    'label' => 'Community Fees Title',
                    'name' => 'fees_container_title',
                    'aria-label' => '',
                    'type' => 'text',
                    'instructions' => 'The title default displays the community name.',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '33',
                        'class' => '',
                        'id' => '',
                    ),
                    'default_value' => '',
                    'maxlength' => '',
                    'allow_in_bindings' => 0,
                    'placeholder' => '',
                    'prepend' => '',
                    'append' => '',
                ),
                array(
                    'key' => 'field_69430d572r9n3',
                    'label' => 'Community Name &#8594;',
                    'name' => 'prepend_community_name',
                    'type' => 'true_false',
                    'message' => 'Toggle true to prepend community name.',
                    'ui' => 1,
                    'wrapper' => array(
                        'width' => '33',
                        'class' => 'flip-ui',
                    ),
                ),
                array(
                    'key' => 'field_69665c46065g8',
                    'label' => 'Floor Plan Fees Title',
                    'name' => 'fp_fees_container_title',
                    'aria-label' => '',
                    'type' => 'text',
                    'instructions' => 'The title default displays the floor plan name.',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '33',
                        'class' => '',
                        'id' => '',
                    ),
                    'default_value' => '',
                    'maxlength' => '',
                    'allow_in_bindings' => 0,
                    'placeholder' => '',
                    'prepend' => '',
                    'append' => '',
                ),
                array(
                    'key' => 'field_fees_label_onetime',
                    'label' => 'One-Time Fees Label',
                    'name' => 'fees_label_onetime',
                    'type' => 'text',
                    'instructions' => 'Override the default "One-Time Fees" section title.',
                    'wrapper' => array(
                        'width' => '33',
                    ),
                    'default_value' => 'One-Time Fees',
                ),
                array(
                    'key' => 'field_fees_label_monthly',
                    'label' => 'Monthly Fees Label',
                    'name' => 'fees_label_monthly',
                    'type' => 'text',
                    'instructions' => 'Override the default "Monthly Fees" section title.',
                    'wrapper' => array(
                        'width' => '33',
                    ),
                    'default_value' => 'Monthly Fees',
                ),
                array(
                    'key' => 'field_fees_label_annual',
                    'label' => 'Annual Fees Label',
                    'name' => 'fees_label_annual',
                    'type' => 'text',
                    'instructions' => 'Override the default "Annual Fees" section title.',
                    'wrapper' => array(
                        'width' => '33',
                    ),
                    'default_value' => 'Annual Fees',
                ),
                array(
                    'key' => 'field_695d381b955dd',
                    'label' => 'Modal & CTAs',
                    'name' => '',
                    'aria-label' => '',
                    'type' => 'accordion',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '',
                        'class' => 'fees-accordion',
                        'id' => '',
                    ),
                    'open' => 0,
                    'multi_expand' => 0,
                    'endpoint' => 0,
                ),
                array(
                    'key' => 'field_695d4347c48c3',
                    'label' => 'Modal Button Title',
                    'name' => 'fees_modal_button_title',
                    'aria-label' => '',
                    'type' => 'text',
                    'instructions' => 'Override the default "View Fees" modal button text.',
                    'required' => 0,
                    'conditional_logic' => array(
                        array(
                            array(
                                'field' => 'field_695d37410f25b',
                                'operator' => '==',
                                'value' => 'modal',
                            ),
                        ),
                        array(
                            array(
                                'field' => 'field_697ce3a6f0795',
                                'operator' => '==',
                                'value' => 'modal',
                            ),
                        ),
                    ),
                    'wrapper' => array(
                        'width' => '33',
                        'class' => '',
                        'id' => '',
                    ),
                    'default_value' => '',
                    'maxlength' => '',
                    'allow_in_bindings' => 0,
                    'placeholder' => '',
                    'prepend' => '',
                    'append' => '',
                ),
                array(
                    'key' => 'field_parent_floor_plan_url_ext',
                    'label' => 'Parent Floor Plan URL Extension',
                    'name' => 'parent_floorplan_url_extension',
                    'aria-label' => '',
                    'type' => 'text',
                    'instructions' => 'Floor plans URL slug to append when no units are available.',
                    'required' => 0,
                    'conditional_logic' => array(
                        array(
                            array(
                                'field' => 'field_695d37410f25b',
                                'operator' => '==',
                                'value' => 'modal',
                            ),
                        ),
                        array(
                            array(
                                'field' => 'field_697ce3a6f0795',
                                'operator' => '==',
                                'value' => 'modal',
                            ),
                        ),
                    ),
                    'wrapper' => array(
                        'width' => '33',
                        'class' => '',
                        'id' => '',
                    ),
                    'default_value' => '',
                    'maxlength' => '',
                    'allow_in_bindings' => 0,
                    'placeholder' => 'eg: floorplans/#neighborhood-floorplans',
                    'prepend' => '/',
                    'append' => '',
                ),
                array(
                    'key' => 'field_modal_cta_placement',
                    'label' => 'Modal CTA Placement',
                    'name' => 'modal_cta_placement',
                    'aria-label' => '',
                    'type' => 'select',
                    'instructions' => 'Default CTA\'s inside the modal are above the fees table.',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '33',
                        'class' => '',
                        'id' => '',
                    ),
                    'choices' => array(
                        'above_table' => 'Above Table',
                        'under_totals' => 'Under Fee Totals',
                    ),
                    'default_value' => 'above_table',
                    'return_format' => 'value',
                ),

            ),

            'location' => array(
                array(
                    array(
                        'param'    => 'options_page',
                        'operator' => '==',
                        'value'    => 'fee-calculator-settings', 
                    ),
                ),
            ),
            'menu_order' => 0,
            'position' => 'normal',
            'style' => 'default',
            'label_placement' => 'top',
            'instruction_placement' => 'label',
            'hide_on_screen' => '',
            'active' => true,
            'description' => '',
            'show_in_rest' => 1,
            'display_title' => '',
        ));
        }
    }
}