<?php

if ( !defined( 'ABSPATH' ) ) {
    exit;
}

if ( !class_exists( 'Reon' ) ) {
    return;
}

if ( !class_exists( 'Pricely_Admin_Products_Pricing_Settings' ) ) {

    class Pricely_Admin_Products_Pricing_Settings {

        public function __construct() {

            add_filter( 'pricely_admin_get-settings-section-panels', array( $this, 'get_panel' ), 10 );
        }

        public function get_panel( $in_fields ) {

            $in_fields[] = array(
                'id' => 'any_id',
                'type' => 'panel',
                'last' => true,
                'white_panel' => false,
                'panel_size' => 'smaller',
                'width' => '100%',
                'merge_fields' => false,
                'css_class' => array( 'rn-round-small' ),
                'fields' => $this->get_fields( array() ),
            );


            return $in_fields;
        }

        private function get_fields( $in_fields ) {

            $in_fields[] = array(
                'id' => 'any_id',
                'type' => 'paneltitle',
                'full_width' => true,
                'center_head' => true,
                'title' => esc_html__( 'Products Pricing', 'pricely-dynamic-pricing-cart-discounts' ),
                'desc' => esc_html__( 'Use these settings to configure product pricing (i.e Priccing At Checkout &amp; Price Adjustments)', 'pricely-dynamic-pricing-cart-discounts' ),
            );

            $in_fields[] = array(
                'id' => 'checkout_pricing_settings',
                'type' => 'columns-field',
                'columns' => 4,
                'merge_fields' => true,
                'fields' => array(
                    array(
                        'id' => 'cart_item_prices',
                        'type' => 'select2',
                        'column_size' => 1,
                        'column_title' => esc_html__( 'Cart Item Prices', 'pricely-dynamic-pricing-cart-discounts' ),
                        'tooltip' => esc_html__( 'Choose whether to display the full product prices or the reduced prices on the cart page', 'pricely-dynamic-pricing-cart-discounts' ),
                        'default' => array( 'reduced' ),
                        'options' => array(
                            'reduced' => esc_html__( 'Display reduced prices only', 'pricely-dynamic-pricing-cart-discounts' ),
                            'no' => esc_html__( "Display theme's default prices", 'pricely-dynamic-pricing-cart-discounts' ),
                        ),
                        'width' => '100%',
                    ),
                    array(
                        'id' => 'cart_item_totals',
                        'type' => 'select2',
                        'column_size' => 1,
                        'column_title' => esc_html__( 'Cart Item Totals', 'pricely-dynamic-pricing-cart-discounts' ),
                        'tooltip' => esc_html__( 'Choose whether to display the full product line totals or the reduced line totals on the cart page', 'pricely-dynamic-pricing-cart-discounts' ),
                        'default' => array( 'reduced' ),
                        'options' => array(
                            'reduced' => esc_html__( 'Display reduced totals only', 'pricely-dynamic-pricing-cart-discounts' ),
                            'no' => esc_html__( "Display theme's default totals", 'pricely-dynamic-pricing-cart-discounts' ),
                        ),
                        'width' => '100%',
                    ),
                    array(
                        'id' => 'mini_cart_item_prices',
                        'type' => 'select2',
                        'column_size' => 1,
                        'column_title' => esc_html__( 'Mini Cart Item Totals', 'pricely-dynamic-pricing-cart-discounts' ),
                        'tooltip' => esc_html__( 'Choose whether to display the full product totals or the reduced totals on the mini cart box', 'pricely-dynamic-pricing-cart-discounts' ),
                        'default' => array( 'reduced' ),
                        'options' => array(
                            'reduced' => esc_html__( 'Display reduced totals only', 'pricely-dynamic-pricing-cart-discounts' ),
                            'no' => esc_html__( "Display theme's default prices", 'pricely-dynamic-pricing-cart-discounts' ),
                        ),
                        'width' => '100%',
                    ),
                    array(
                        'id' => 'checkout_item_prices',
                        'type' => 'select2',
                        'column_size' => 1,
                        'column_title' => esc_html__( 'Checkout Item Totals', 'pricely-dynamic-pricing-cart-discounts' ),
                        'tooltip' => esc_html__( 'Choose whether to display the full product totals or the reduced totals on the checkout page', 'pricely-dynamic-pricing-cart-discounts' ),
                        'default' => array( 'reduced' ),
                        'options' => array(
                            'reduced' => esc_html__( 'Display reduced totals only', 'pricely-dynamic-pricing-cart-discounts' ),
                            'no' => esc_html__( "Display theme's default totals", 'pricely-dynamic-pricing-cart-discounts' ),
                        ),
                        'width' => '100%',
                    ),
                ),
            );

            return $in_fields;
        }

    }

    new Pricely_Admin_Products_Pricing_Settings();
}

