<?php

/**
 * The Enqueue and Dequeue CSS and JS files setting configurations.
 *
 * @package domain-for-sale
 * @subpackage domain-for-sale/admin
 */

namespace ThemeAtelier\DomainForSale\Admin\Views\Settings;

use ThemeAtelier\DomainForSale\Admin\Framework\Classes\DOMAIN_FOR_SALE;

if (! defined('ABSPATH')) {
    die;
} // Cannot access pages directly.

/**
 * The Layout building class.
 */
class DomainForSalePayments
{

    /**
     * Payments setting section.
     *
     * @param string $prefix The settings.
     * @return void
     */
    public static function section($prefix)
    {
        DOMAIN_FOR_SALE::createSection(
            $prefix,
            array(
                'id'        => 'payments',
                'title'       => esc_html__('Payments', 'domain-for-sale'),
                'icon'        => 'icofont-pay',
            )
        );
        DOMAIN_FOR_SALE::createSection(
            $prefix,
            array(
                'parent'        => 'payments',
                'title'       => esc_html__('Escrow Settings', 'domain-for-sale'),
                'icon'        => 'icofont-shield',
                'fields' => array(
                    array(
                        'id'    => 'enable_escrow_payment',
                        'type'  => 'switcher',
                        'class'  => 'switcher_pro_only',
                        'title' => esc_html__('Enable Escrow.com Payment', 'domain-for-sale'),
                        'text_on' => esc_html__('Enabled', 'domain-for-sale'),
                        'text_off' => esc_html__('Disabled', 'domain-for-sale'),
                        'text_width' => 100,
                        'title_help' => '<div class="domain-for-sale-info-label">' . esc_html__('Turn this on to allow users to pay via Escrow.com for domain purchases.', 'domain-for-sale') . '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#escrow-settings') . '">' . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                    ),
                    array(
                        'id'    => 'escrow_email',
                        'type'  => 'text',
                        'class'  => 'pro_only',
                        'title' => esc_html__('Escrow Email', 'domain-for-sale'),
                        'title_help' => '<div class="domain-for-sale-info-label">' . esc_html__('Enter the email address you use to login into Escrow.com.', 'domain-for-sale') . '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#escrow-settings') . '">' . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                    ),

                    array(
                        'id'    => 'escrow_api_key',
                        'type'  => 'text',
                        'class'  => 'pro_only',
                        'title' => esc_html__('Escrow API Key', 'domain-for-sale'),
                        'title_help' => '<div>' . esc_html__('Enter your Escrow.com API Key for the configured environment. If you have configured the plugin to call production, use a production API Key. If you have configured the plugin to call sandbox, use a sandbox API Key.', 'domain-for-sale') . '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#escrow-settings') . '">' . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                        'attributes'  => array(
                            'type'      => 'password',
                        ),
                    ),

                    array(
                        'id'    => 'escrow_api_url',
                        'type'  => 'select',
                        'class'  => 'pro_only',
                        'title' => esc_html__('Escrow API URL', 'domain-for-sale'),
                        'title_help' => '<div>' . esc_html__('Select the version of the Escrow.com API that you wish to use. URLs with api.escrow.com are for production use. URLs with api.escrow-sandbox.com are for testing. Make sure you update the Escrow Email and Escrow API Key to match the selected environment.', 'domain-for-sale') . '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#escrow-settings') . '">' . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                        'options' => array(
                            'https://api.escrow.com/' => esc_html__('https://api.escrow.com/', 'domain-for-sale'),
                            'https://api.escrow-sandbox.com/' => esc_html__('https://api.escrow-sandbox.com/', 'domain-for-sale'),
                        ),
                        'default' => 'https://api.escrow.com',
                    ),
                    array(
                        'id'    => 'escrow_fee_paid_by',
                        'type'  => 'select',
                        'class'  => 'pro_only',
                        'title' => esc_html__('Escrow Fee Paid By', 'domain-for-sale'),
                        'title_help' => '<div>' . esc_html__('Select the version of the Escrow.com API that you wish to use. URLs with api.escrow.com are for production use. URLs with api.escrow-sandbox.com are for testing. Make sure you update the Escrow Email and Escrow API Key to match the selected environment.', 'domain-for-sale') . '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#escrow-settings') . '">' . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                        'options' => array(
                            'buyer' => esc_html__('Buyer', 'domain-for-sale'),
                            'seller' => esc_html__('Seller', 'domain-for-sale'),
                            'splitbs' => esc_html__('Split 50/50', 'domain-for-sale'),
                        ),
                        'default' => 'seller',
                        'attributes'  => array(
                            'style' => 'width:150px;',
                        ),
                    ),
                    array(
                        'id'    => 'inspection_period',
                        'type'  => 'select',
                        'class'  => 'pro_only',
                        'title' => esc_html__('Inspection Period', 'domain-for-sale'),
                        'title_help' => '<div class="domain-for-sale-info-label">' . esc_html__('Select the inspection period for all transactions created via this plugin.', 'domain-for-sale') . '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#escrow-settings') . '">' . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                        'options' => array(
                            '1' => esc_html__('1 day', 'domain-for-sale'),
                            '2' => esc_html__('2 days', 'domain-for-sale'),
                            '3' => esc_html__('3 days', 'domain-for-sale'),
                            '4' => esc_html__('4 days', 'domain-for-sale'),
                            '5' => esc_html__('5 days', 'domain-for-sale'),
                            '6' => esc_html__('6 days', 'domain-for-sale'),
                            '7' => esc_html__('7 days', 'domain-for-sale'),
                            '8' => esc_html__('8 days', 'domain-for-sale'),
                            '9' => esc_html__('9 days', 'domain-for-sale'),
                            '10' => esc_html__('10 days', 'domain-for-sale'),
                            '11' => esc_html__('11 days', 'domain-for-sale'),
                            '12' => esc_html__('12 days', 'domain-for-sale'),
                            '13' => esc_html__('13 days', 'domain-for-sale'),
                            '14' => esc_html__('14 days', 'domain-for-sale'),
                            '15' => esc_html__('15 days', 'domain-for-sale'),
                            '16' => esc_html__('16 days', 'domain-for-sale'),
                            '17' => esc_html__('17 days', 'domain-for-sale'),
                            '18' => esc_html__('18 days', 'domain-for-sale'),
                            '19' => esc_html__('19 days', 'domain-for-sale'),
                            '20' => esc_html__('20 days', 'domain-for-sale'),
                        ),
                        'default' => '3',
                        'attributes'  => array(
                            'style' => 'width:150px;',
                        ),
                    ),
                )
            )
        );
        DOMAIN_FOR_SALE::createSection(
            $prefix,
            array(
                'parent'      => 'payments',
                'title'       => esc_html__('Payments Form', 'domain-for-sale'),
                'icon'        => 'icofont-ui-note',
                'fields' => array(
                    array(
                        'id'    => 'direct_sale_title',
                        'type'  => 'text',
                        'class' => 'pro_only',
                        'title' => esc_html__('Purchase Form Title', 'domain-for-sale'),
                        'default' => esc_html__('Purchase Now', 'domain-for-sale'),
                        'title_help' =>
                        '<div class="domain-for-sale-info-label">'
                            . esc_html__('Displayed at the top of the form. When you use form types as both, the title will become a tab title.', 'domain-for-sale') .
                            '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#payments-form') . '">'
                            . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                    ),

                    array(
                        'id'    => 'divider_text',
                        'type'  => 'text',
                        'class' => 'pro_only',
                        'title' => esc_html__('Divider Text', 'domain-for-sale'),
                        'default' => esc_html__('Or', 'domain-for-sale'),
                        'title_help' =>
                        '<div class="domain-for-sale-info-label">'
                            . esc_html__('Used as a divider for tab.', 'domain-for-sale') .
                            '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#payments-form') . '">'
                            . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                    ),

                    array(
                        'id'    => 'purchase_form_default',
                        'type'  => 'checkbox',
                        'class' => 'pro_only checkbox_pro_only',
                        'title' => esc_html__('Make Purchase Form as Default Form', 'domain-for-sale'),
                    ),

                    array(
                        'id'    => 'purchase_name_label',
                        'type'  => 'text',
                        'class' => 'pro_only',
                        'title' => esc_html__('Purchase Form Name Field Label', 'domain-for-sale'),
                        'default' => esc_html__('Name*', 'domain-for-sale'),
                        'title_help' =>
                        '<div class="domain-for-sale-info-label">'
                            . esc_html__('The label text shown above the name input field.', 'domain-for-sale') .
                            '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#payments-form') . '">'
                            . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                    ),

                    array(
                        'id'    => 'purchase_name_placeholder',
                        'type'  => 'text',
                        'class' => 'pro_only',
                        'title' => esc_html__('Purchase Form Name Field Placeholder', 'domain-for-sale'),
                        'default' => esc_html__('Your name', 'domain-for-sale'),
                        'title_help' =>
                        '<div class="domain-for-sale-info-label">'
                            . esc_html__('The placeholder text inside the name field.', 'domain-for-sale') .
                            '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#payments-form') . '">'
                            . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                    ),

                    array(
                        'id'    => 'purchase_email_label',
                        'type'  => 'text',
                        'class' => 'pro_only',
                        'title' => esc_html__('Purchase Form Email Field Label', 'domain-for-sale'),
                        'default' => esc_html__('Email*', 'domain-for-sale'),
                        'title_help' =>
                        '<div class="domain-for-sale-info-label">'
                            . esc_html__('The label text shown above the email input field.', 'domain-for-sale') .
                            '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#payments-form') . '">'
                            . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                    ),

                    array(
                        'id'    => 'purchase_email_placeholder',
                        'type'  => 'text',
                        'class' => 'pro_only',
                        'title' => esc_html__('Purchase Email Field Placeholder', 'domain-for-sale'),
                        'default' => esc_html__('Your email address*', 'domain-for-sale'),
                        'title_help' =>
                        '<div class="domain-for-sale-info-label">'
                            . esc_html__('The placeholder text inside the email field.', 'domain-for-sale') .
                            '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#payments-form') . '">'
                            . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                    ),

                    array(
                        'id'    => 'direct_sale_button_label',
                        'type'  => 'text',
                        'class' => 'pro_only',
                        'title' => esc_html__('Purchase Button Label', 'domain-for-sale'),
                        'default' => esc_html__('Buy Now', 'domain-for-sale'),
                        'title_help' =>
                        '<div class="domain-for-sale-info-label">'
                            . esc_html__('The text shown on the form purchase button.', 'domain-for-sale') .
                            '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#payments-form') . '">'
                            . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                        'desc' => __('<b>Use placeholders:</b> {{price}}.', 'domain-for-sale'),
                    ),
                )
            )
        );
        DOMAIN_FOR_SALE::createSection(
            $prefix,
            array(
                'parent'      => 'payments',
                'title'       => esc_html__('Invitation Notification', 'domain-for-sale'),
                'icon'        => 'icofont-notification',
                'fields' => array(
                    array(
                        'id'    => 'purchase_email_form_name',
                        'type'  => 'text',
                        'class'  => 'pro_only',
                        'title' => esc_html__('Email Form Name', 'domain-for-sale'),
                        'default' => esc_html__("{siteTitle}", 'domain-for-sale'),
                        'desc' => __('<span><b>Available tags:</b> {domain}, {siteTitle}, {currentTitle}</span>', 'domain-for-sale'),
                        'title_help' => '<div class="domain-for-sale-info-label">' . esc_html__('Set the “From Name” shown in bidder confirmation emails.', 'domain-for-sale') . '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#invitation-notification-1') . '">' . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                    ),

                    array(
                        'id'    => 'purchase_email_form_email',
                        'type'  => 'text',
                        'class'  => 'pro_only',
                        'title' => esc_html__('Email Form Email', 'domain-for-sale'),
                        'default' => esc_html__("{adminEmail}", 'domain-for-sale'),
                        'desc' => __('<span><b>Available tags:</b> {adminEmail}</span>', 'domain-for-sale'),
                        'title_help' => '<div class="domain-for-sale-info-label">' . esc_html__('Set the “From Email” address used for sending bidder confirmation emails.', 'domain-for-sale') . '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#invitation-notification-1') . '">' . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                    ),

                    array(
                        'id'    => 'purchase_subject',
                        'type'  => 'text',
                        'class'  => 'pro_only',
                        'title' => esc_html__('Purchase Confirmation Subject', 'domain-for-sale'),
                        'default' => esc_html__("Congratulations! Your offer for {domain} has been accepted", 'domain-for-sale'),
                        'desc' => __('<span><b>Available tags:</b> {domain}, {name}, {offer}, {{offer}}, {date}, {siteTitle}, {currentTitle}</span>', 'domain-for-sale'),
                        'title_help' => '<div class="domain-for-sale-info-label">' . esc_html__('Customize the subject line of the bidder confirmation email.', 'domain-for-sale') . '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#invitation-notification-1') . '">' . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                    ),
                    array(
                        'id'    => 'purchase_confirmation_message',
                        'type'  => 'textarea',
                        'class'  => 'pro_only',
                        'title' => esc_html__('Purchase Confirmation Template', 'domain-for-sale'),
                        'default' => esc_html__("Hi {name},\n\nCongratulations! Your offer for {domain} has been accepted.\n\nYou can now securely complete your purchase via Escrow.com: {purchaseLink}\n\nOnce your payment is confirmed, the domain transfer will begin.\n\nBest regards,\nThe {siteTitle} Team", 'domain-for-sale'),
                        'desc' => __('<span><b>Available tags:</b> {name}, {email}, {phone}, {offer}, {{offer}}, {proposal}, {domain}, {purchaseLink}</span>', 'domain-for-sale'),
                        'title_help' => '<div class="domain-for-sale-info-label">' . esc_html__('Customize the body of the bidder confirmation email.', 'domain-for-sale') . '</div> <a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/payments/#invitation-notification-1') . '">' . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                    ),
                )
            )
        );
    }
}
