<?php

    if ( ! class_exists( 'weLaunch' ) && ! class_exists( 'Redux' ) ) {
        return;
    }

    if( class_exists( 'weLaunch' ) ) {
        $framework = new weLaunch();
    } else {
        $framework = new Redux();
    }

    // This is your option name where all the Redux data is stored.
    $opt_name = "woocommerce_packing_slips_options";

    $args = array(
        'opt_name' => 'woocommerce_packing_slips_options',
        'use_cdn' => TRUE,
        'dev_mode' => FALSE,
        'display_name' => __('WooCommerce Packing Slips', 'woocommerce-packing-slips'),
        'display_version' => '1.2.15',
        'page_title' => __('WooCommerce Packing Slips', 'woocommerce-packing-slips'),
        'update_notice' => TRUE,
        'intro_text' => '',
        'footer_text' => '&copy; ' . date('Y') . ' weLaunch',
        'admin_bar' => TRUE,
        'menu_type' => 'submenu',
        'menu_title' => __('Packing Slips', 'woocommerce-packing-slips'),
        'allow_sub_menu' => TRUE,
        'page_parent' => 'woocommerce',
        'page_parent_post_type' => 'your_post_type',
        'customizer' => FALSE,
        'default_mark' => '*',
        'hints' => array(
            'icon_position' => 'right',
            'icon_color' => 'lightgray',
            'icon_size' => 'normal',
            'tip_style' => array(
                'color' => 'light',
            ),
            'tip_position' => array(
                'my' => 'top left',
                'at' => 'bottom right',
            ),
            'tip_effect' => array(
                'show' => array(
                    'duration' => '500',
                    'event' => 'mouseover',
                ),
                'hide' => array(
                    'duration' => '500',
                    'event' => 'mouseleave unfocus',
                ),
            ),
        ),
        'output' => TRUE,
        'output_tag' => TRUE,
        'settings_api' => TRUE,
        'cdn_check_time' => '1440',
        'compiler' => TRUE,
        'page_permissions' => 'manage_options',
        'save_defaults' => TRUE,
        'show_import_export' => TRUE,
        'database' => 'options',
        'transient_time' => '3600',
        'network_sites' => TRUE,
    );

    global $weLaunchLicenses;
    if( (isset($weLaunchLicenses['woocommerce-ultimate-pdf-invoices']) && !empty($weLaunchLicenses['woocommerce-ultimate-pdf-invoices'])) || (isset($weLaunchLicenses['woocommerce-plugin-bundle']) && !empty($weLaunchLicenses['woocommerce-plugin-bundle'])) ) {
        $args['display_name'] = '<span class="dashicons dashicons-yes-alt" style="color: #9CCC65 !important;"></span> ' . $args['display_name'];
    } else {
        $args['display_name'] = '<span class="dashicons dashicons-dismiss" style="color: #EF5350 !important;"></span> ' . $args['display_name'];
    }

    $framework::setArgs( $opt_name, $args );

    if(isset($_GET['tab']) && $_GET['tab'] == "email") {
        return;
    }

    global $woocommerce;
    $mailer = $woocommerce->mailer();
    $wc_emails = $mailer->get_emails();

    $non_order_emails = array(
        'customer_note',
        'customer_reset_password',
        'customer_new_account'
    );

    $emails = array();
    foreach ($wc_emails as $class => $email) {
        if ( !in_array( $email->id, $non_order_emails ) ) {
            switch ($email->id) {
                case 'new_order':
                    $emails[$email->id] = sprintf('%s (%s)', $email->title, __( 'Admin email', 'woocommerce-packing-slips' ) );
                    break;
                case 'customer_invoice':
                    $emails[$email->id] = sprintf('%s (%s)', $email->title, __( 'Manual email', 'woocommerce-packing-slips' ) );
                    break;
                default:
                    $emails[$email->id] = $email->title;
                    break;
            }
        }
    }

    /*
     *
     * ---> START SECTIONS
     *
     */

    $framework::setSection( $opt_name, array(
        'title'  => __( 'Packing Slips', 'woocommerce-packing-slips' ),
        'id'     => 'general',
        'desc'   => __( 'Need support? Please use the comment function on codecanyon.', 'woocommerce-packing-slips' ),
        'icon'   => 'el el-home',
    ) );

    $framework::setSection( $opt_name, array(
        'title'      => __( 'General', 'woocommerce-packing-slips' ),
        'desc'       => __( 'To get auto updates please <a href="' . admin_url('tools.php?page=welaunch-framework') . '">register your License here</a>.', 'woocommerce-packing-slips' ),
        'id'         => 'general-settings',
        'subsection' => true,
        'fields'     => array(
            array(
                'id'       => 'enable',
                'type'     => 'checkbox',
                'title'    => __( 'Enable', 'woocommerce-packing-slips' ),
                'subtitle' => __( 'Enable Packing Slips to use the options below', 'woocommerce-packing-slips' ),
                'default' => 1,
            ),
            array(
                'id'       => 'generalAutomatic',
                'type'     => 'checkbox',
                'title'    => __( 'Create Packing Slips Automatically', 'woocommerce-packing-slips' ),
                'subtitle' => __( 'Packing Slips will be created for each order automatically.', 'woocommerce-packing-slips' ),
                'default' => 1,
            ),
            array(
                'id'       => 'generalAttachToMail',
                'type'     => 'checkbox',
                'title'    => __( 'Attach Packing Slip to Email', 'woocommerce-packing-slips' ),
                'subtitle' => __( 'Attach Packing Slips automatically to admin mails.', 'woocommerce-packing-slips' ),
                'default' => 1,
            ),
            array(
                'id'     =>'generalAttachToMailStatus',
                'type'  => 'select',
                'title' => __('Attach to Email order Statuses', 'woocommerce-packing-slips'), 
                'multi' => true,
                'options' => $emails,
                'default' => array(
                    'new_order',
                ),
                'required' => array('generalAttachToMail','equals','1'),
            ),

            array(
                'id'       => 'generalAttachToMailCustomEmail',
                'type'     => 'checkbox',
                'title'    => __( 'Custom Email', 'woocommerce-packing-slips' ),
                'subtitle' => __( 'In addition to the admin mail, send packing slip also to a custom Email. .', 'woocommerce-packing-slips' ),
                'default' => 0,
                'required' => array('generalAttachToMail','equals','1'),
            ),
                array(
                    'id'       => 'generalAttachToMailCustomEmailTo',
                    'type'     => 'text',
                    'title'    => __( 'Custom Email To', 'woocommerce-packing-slips' ),
                    'subtitle'    => __( 'Enter mail address here (split with comma , for multiple)', 'woocommerce-packing-slips' ),
                    'default'  => __('', 'woocommerce-packing-slips'),
                    'required' => array('generalAttachToMailCustomEmail','equals','1'),
                ),
                array(
                    'id'       => 'generalAttachToMailCustomEmailSubject',
                    'type'     => 'text',
                    'title'    => __( 'Custom Email Subject', 'woocommerce-packing-slips' ),
                    'subtitle'    => __( 'Email Subject. Your Blog name will be added as suffix.', 'woocommerce-packing-slips' ),
                    'default'  => __('Packing Slip – ', 'woocommerce-packing-slips'),
                    'required' => array('generalAttachToMailCustomEmail','equals','1'),
                ),
                array(
                    'id'       => 'generalAttachToMailCustomEmailText',
                    'type'     => 'text',
                    'title'    => __( 'Custom Email Text', 'woocommerce-packing-slips' ),
                    'subtitle'    => __( 'Email Text', 'woocommerce-packing-slips' ),
                    'default'  => __('See attached packing Slip.', 'woocommerce-packing-slips'),
                    'required' => array('generalAttachToMailCustomEmail','equals','1'),
                ),
        )
    ) );

    $framework::setSection( $opt_name, array(
        'title'      => __( 'Layout', 'woocommerce-packing-slips' ),
        // 'desc'       => __( '', 'woocommerce-packing-slips' ),
        'id'         => 'layout',
        'subsection' => true,
        'fields'     => array(
            array(
                'id'       => 'format',
                'type'     => 'select',
                'title'    => __( 'Format', 'woocommerce-packing-slips' ),
                'subtitle' => __( 'Choose a pre-defined page size. A4 is recommended!', 'woocommerce-packing-slips' ),
                'options'  => array(
                    'A4' => __('A4', 'woocommerce-packing-slips'),
                    'A4-L' => __('A4 Landscape', 'woocommerce-packing-slips'),
                    'A0' => __('A0', 'woocommerce-packing-slips'),
                    'A0-L' => __('A0 Landscape', 'woocommerce-packing-slips'),
                    'A1' => __('A1', 'woocommerce-packing-slips'),
                    'A1-L' => __('A1 Landscape', 'woocommerce-packing-slips'),
                    'A3' => __('A3', 'woocommerce-packing-slips'),
                    'A3-L' => __('A3 Landscape', 'woocommerce-packing-slips'),
                    'A5' => __('A5', 'woocommerce-packing-slips'),
                    'A5-L' => __('A5 Landscape', 'woocommerce-packing-slips'),
                    'A6' => __('A6', 'woocommerce-packing-slips'),
                    'A6-L' => __('A6 Landscape', 'woocommerce-packing-slips'),
                    'A7' => __('A7', 'woocommerce-packing-slips'),
                    'A7-L' => __('A7 Landscape', 'woocommerce-packing-slips'),
                    'A8' => __('A8', 'woocommerce-packing-slips'),
                    'A8-L' => __('A8 Landscape', 'woocommerce-packing-slips'),
                    'A9' => __('A9', 'woocommerce-packing-slips'),
                    'A9-L' => __('A9 Landscape', 'woocommerce-packing-slips'),
                    'A10' => __('A10', 'woocommerce-packing-slips'),
                    'A10-L' => __('A10 Landscape', 'woocommerce-packing-slips'),
                    'Letter' => __('Letter', 'woocommerce-packing-slips'),
                    'Legal' => __('Legal', 'woocommerce-packing-slips'),
                    'Executive' => __('Executive', 'woocommerce-packing-slips'),
                    'Folio' => __('Folio', 'woocommerce-packing-slips'),
                ),
                'default' => 'A4',
            ),
            array(
                'id'             => 'layoutPadding',
                'type'           => 'spacing',
                // 'output'         => array('.site-header'),
                'mode'           => 'padding',
                'units'          => array('px'),
                'units_extended' => 'false',
                'title'          => __('Padding', 'woocommerce-pdf-invoices'),
                'default'            => array(
                    'padding-top'     => '50px', 
                    'padding-right'   => '60px', 
                    'padding-bottom'  => '10px', 
                    'padding-left'    => '60px',
                    'units'          => 'px', 
                ),
            ),
            array(
                'id'     =>'layoutTextColor',
                'type'  => 'color',
                'title' => __('Text Color', 'woocommerce-packing-slips'), 
                'validate' => 'color',
                'default'   => '#333333',
            ),
            array(
                'id'     =>'layoutFontFamily',
                'type'  => 'select',
                'title' => __('Default Font', 'woocommerce-packing-slips'), 
                'options'  => array(
                    'dejavusans' => __('Sans', 'woocommerce-packing-slips' ),
                    'dejavuserif' => __('Serif', 'woocommerce-packing-slips' ),
                    'dejavusansmono' => __('Mono', 'woocommerce-packing-slips' ),
                    'droidsans' => __('Droid Sans', 'woocommerce-packing-slips'),
                    'droidserif' => __('Droid Serif', 'woocommerce-packing-slips'),
                    'lato' => __('Lato', 'woocommerce-packing-slips'),
                    'lora' => __('Lora', 'woocommerce-packing-slips'),
                    'merriweather' => __('Merriweather', 'woocommerce-packing-slips'),
                    'montserrat' => __('Montserrat', 'woocommerce-packing-slips'),
                    'opensans' => __('Open sans', 'woocommerce-packing-slips'),
                    'opensanscondensed' => __('Open Sans Condensed', 'woocommerce-packing-slips'),
                    'oswald' => __('Oswald', 'woocommerce-packing-slips'),
                    'ptsans' => __('PT Sans', 'woocommerce-packing-slips'),
                    'sourcesanspro' => __('Source Sans Pro', 'woocommerce-packing-slips'),
                    'slabo' => __('Slabo', 'woocommerce-packing-slips'),
                    'raleway' => __('Raleway', 'woocommerce-packing-slips'),
                ),
                'default'   => 'dejavusans',
            ),
            array(
                'id'     =>'layoutFontSize',
                'type'     => 'spinner', 
                'title'    => __('Default font size', 'woocommerce-packing-slips'),
                'default'  => '9',
                'min'      => '1',
                'step'     => '1',
                'max'      => '40',
            ),
            array(
                'id'     =>'layoutFontLineHeight',
                'type'     => 'spinner', 
                'title'    => __('Default line height', 'woocommerce-packing-slips'),
                'default'  => '12',
                'min'      => '1',
                'step'     => '1',
                'max'      => '40',
            ),
        )
    ) );

    $framework::setSection( $opt_name, array(
        'title'      => __( 'Header', 'woocommerce-packing-slips' ),
        // 'desc'       => __( '', 'woocommerce-packing-slips' ),
        'id'         => 'header',
        'subsection' => true,
        'fields'     => array(
            array(
                'id'       => 'enableHeader',
                'type'     => 'checkbox',
                'title'    => __( 'Enable', 'woocommerce-packing-slips' ),
                'subtitle' => __( 'Enable header', 'woocommerce-packing-slips' ),
                'default' => '1',
            ),

            array(
                'id'     =>'headerBackgroundColor',
                'type' => 'color',
                'title' => __('Header background color', 'woocommerce-packing-slips'), 
                'validate' => 'color',
                'default' => '#333333',
                'required' => array('enableHeader','equals','1'),
            ),
            array(
                'id'     =>'headerTextColor',
                'type'  => 'color',
                'title' => __('Header text color', 'woocommerce-packing-slips'), 
                'validate' => 'color',
                'default' => '#FFFFFF',
                'required' => array('enableHeader','equals','1'),
            ),
            array(
                'id'     =>'headerFontSize',
                'type'     => 'spinner', 
                'title'    => __('Header font size', 'woocommerce-packing-slips'),
                'default'  => '8',
                'min'      => '1',
                'step'     => '1',
                'max'      => '40',
            ),
            array(
                'id'     =>'headerLayout',
                'type'  => 'select',
                'title' => __('Header Layout', 'woocommerce-packing-slips'), 
                'required' => array('enableHeader','equals','1'),
                'options'  => array(
                    'oneCol' => __('1/1', 'woocommerce-packing-slips' ),
                    'twoCols' => __('1/2 + 1/2', 'woocommerce-packing-slips' ),
                    'threeCols' => __('1/3 + 1/3 + 1/3', 'woocommerce-packing-slips' ),
                ),
                'default' => 'twoCols',
            ),
            array(
                'id'     =>'headerMargin',
                'type'     => 'spinner', 
                'title'    => __('Header Margin', 'woocommerce-packing-slips'),
                'default'  => '10',
                'min'      => '1',
                'step'     => '1',
                'max'      => '200',
                'required' => array('enableHeader','equals','1'),
            ),
            array(
                'id'     =>'headerHeight',
                'type'     => 'spinner', 
                'title'    => __('Header Height', 'woocommerce-packing-slips'),
                'default'  => '30',
                'min'      => '1',
                'step'     => '1',
                'max'      => '200',
                'required' => array('enableHeader','equals','1'),
            ),
            array(
                'id'     =>'headerVAlign',
                'type'  => 'select',
                'title' => __('Vertical Align', 'woocommerce-packing-slips'), 
                'required' => array('enableHeader','equals','1'),
                'options'  => array(
                    'top' => __('Top', 'woocommerce-packing-slips' ),
                    'middle' => __('Middle', 'woocommerce-packing-slips' ),
                    'bottom' => __('Bottom', 'woocommerce-packing-slips' ),
                ),
                'default' => 'middle',
            ),
            array(
                'id'     =>'headerTopLeft',
                'type'  => 'select',
                'title' => __('Top Left Header', 'woocommerce-packing-slips'), 
                'required' => array('enableHeader','equals','1'),
                'options'  => array(
                    'none' => __('None', 'woocommerce-packing-slips' ),
                    'bloginfo' => __('Blog information', 'woocommerce-packing-slips' ),
                    'text' => __('Custom text', 'woocommerce-packing-slips' ),
                    'pagenumber' => __('Pagenumber', 'woocommerce-packing-slips' ),
                    'image' => __('Image', 'woocommerce-packing-slips' ),
                    'exportinfo' => __('Export Information', 'woocommerce-packing-slips' ),
                ),
                'default' => 'bloginfo',
            ),
            array(
                'id'     =>'headerTopLeftText',
                'type'  => 'editor',
                'title' => __('Top Left Header Text', 'woocommerce-packing-slips'), 
                'required' => array('headerTopLeft','equals','text'),
                'args'   => array(
                    'teeny'            => false,
                )
            ),
            array(
                'id'     =>'headerTopLeftImage',
                'type' => 'media',
                'url'      => true,
                'title' => __('Top Left Header Image', 'woocommerce-packing-slips'), 
                'required' => array('headerTopLeft','equals','image'),
                'args'   => array(
                    'teeny'            => false,
                )
            ),
            array(
                'id'     =>'headerTopMiddle',
                'type'  => 'select',
                'title' => __('Top Middle Header', 'woocommerce-packing-slips'), 
                'required' => array('headerLayout','equals','threeCols'),
                'options'  => array(
                    'none' => __('None', 'woocommerce-packing-slips' ),
                    'bloginfo' => __('Blog information', 'woocommerce-packing-slips' ),
                    'text' => __('Custom text', 'woocommerce-packing-slips' ),
                    'pagenumber' => __('Pagenumber', 'woocommerce-packing-slips' ),
                    'image' => __('Image', 'woocommerce-packing-slips' ),
                    'exportinfo' => __('Export Information', 'woocommerce-packing-slips' ),
                ),
            ),
            array(
                'id'     =>'headerTopMiddleText',
                'type'  => 'editor',
                'title' => __('Top Middle Header Text', 'woocommerce-packing-slips'), 
                'required' => array('headerTopMiddle','equals','text'),
                'args'   => array(
                    'teeny'            => false,
                )
            ),
            array(
                'id'     =>'headerTopMiddleImage',
                'type' => 'media',
                'url'      => true,
                'title' => __('Top Middle Header Image', 'woocommerce-packing-slips'), 
                'required' => array('headerTopMiddle','equals','image'),
                'args'   => array(
                    'teeny'            => false,
                )
            ),
            array(
                'id'     =>'headerTopRight',
                'type'  => 'select',
                'title' => __('Top Right Header', 'woocommerce-packing-slips'), 
                'required' => array('headerLayout','equals',array('threeCols','twoCols')),
                'options'  => array(
                    'none' => __('None', 'woocommerce-packing-slips' ),
                    'bloginfo' => __('Blog information', 'woocommerce-packing-slips' ),
                    'text' => __('Custom text', 'woocommerce-packing-slips' ),
                    'pagenumber' => __('Pagenumber', 'woocommerce-packing-slips' ),
                    'image' => __('Image', 'woocommerce-packing-slips' ),
                    'exportinfo' => __('Export Information', 'woocommerce-packing-slips' ),
                ),
                'default' => 'pagenumber',
            ),
            array(
                'id'     =>'headerTopRightText',
                'type'  => 'editor',
                'title' => __('Top Right Header Text', 'woocommerce-packing-slips'), 
                'required' => array('headerTopRight','equals','text'),
                'args'   => array(
                    'teeny'            => false,
                )
            ),
            array(
                'id'     =>'headerTopRightImage',
                'type' => 'media',
                'url'      => true,
                'title' => __('Top Right Header Image', 'woocommerce-packing-slips'), 
                'required' => array('headerTopRight','equals','image'),
                'args'   => array(
                    'teeny'            => false,
                )
            ),
        )
    ) );

    $framework::setSection( $opt_name, array(
        'title'      => __( 'Address', 'woocommerce-packing-slips' ),
        // 'desc'       => __( '', 'woocommerce-packing-slips' ),
        'id'         => 'address',
        'subsection' => true,
        'fields'     => array(
            // array(
            //     'id'       => 'addressLayout',
            //     'type'     => 'image_select',
            //     'title'    => __( 'Select Layout', 'woocommerce-packing-slips' ),
            //     'options'  => array(
            //         '1'      => array('img'   => plugin_dir_url( __FILE__ ) . 'img/1.png'),
            //         '2'      => array('img'   => plugin_dir_url( __FILE__ ). 'img/2.png'),
            //         '3'      => array('img'   => plugin_dir_url( __FILE__ ). 'img/3.png'),
            //     ),
            //     'default' => '1'
            // ),
            array(
                'id'     =>'addressTextLeft',
                'type'  => 'editor',
                'title' => __('Address Text Left', 'woocommerce-packing-slips'),
                'args'   => array(
                    'teeny'            => false,
                ),
                'default' => '<strong>Ship from:</strong>
                Company XYZ
                Street 123
                1234 City
                E: info@domain.com'
            ),
            array(
                'id'     =>'addressTextCenter',
                'type'  => 'editor',
                'title' => __('Address Text Center', 'woocommerce-packing-slips'),
                'args'   => array(
                    'teeny'            => false,
                ),
                'default' => '<strong>Ship to:</strong>
                {{shipping_company}}
                {{shipping_first_name}} {{shipping_last_name}}
                {{shipping_address_1}} {{shipping_address_2}}
                {{shipping_postcode}} {{shipping_city}}
                {{shipping_state}} {{shipping_country}}'
            ),
            array(
                'id'     =>'addressTextRight',
                'type'  => 'editor',
                'title' => __('Address Text Right', 'woocommerce-packing-slips'),
                'args'   => array(
                    'teeny'            => false,
                ),
                'default' => 
                    '<strong>Bill To</strong>
                    {{billing_company}}
                    {{billing_first_name}} {{billing_last_name}}
                    {{billing_address_1}} {{billing_address_2}}
                    {{billing_postcode}} {{billing_city}}
                    {{billing_state}} {{billing_country}}'
            ),
        )
    ) );
    $framework::setSection( $opt_name, array(
        'title'      => __( 'Content', 'woocommerce-packing-slips' ),
        // 'desc'       => __( '', 'woocommerce-packing-slips' ),
        'id'         => 'content',
        'subsection' => true,
        'fields'     => array(
            array(
                'id'     =>'contentTextIntro',
                'type'  => 'editor',
                'title' => __('Content Intro Text', 'woocommerce-packing-slips'),
                'args'   => array(
                    'teeny'            => false,
                ),
                'default' => 
                    '<h4>Packing Slip No {{id}}</h4>
                    Dear {{shipping_first_name}} {{shipping_last_name}},

                    thank you very much for your order and the trust you have placed in!'
            ),
                        array(
                'id'       => 'contentItemsRTL',
                'type'     => 'checkbox',
                'title'    => __( 'Content Items RTL support', 'woocommerce-packing-slips' ),
                'default' => 0,
            ),
                        array(
                'id'       => 'contentItemsShowPos',
                'type'     => 'checkbox',
                'title'    => __( 'Show Position', 'woocommerce-packing-slips' ),
                'default' => 1,
            ),
            array(
                'id'     =>'contentItemsShowPosWidth',
                'type'     => 'spinner', 
                'title'    => __('Pos Column Size (%)', 'woocommerce-packing-slips'),
                'default'  => '10',
                'min'      => '1',
                'step'     => '10',
                'max'      => '100',
                'required' => array('contentItemsShowPos','equals','1'),
            ),
                array(
                    'id'       => 'contentItemsShowPosName',
                    'type'     => 'text',
                    'title'    => __( 'Column Pos Name', 'woocommerce-packing-slips' ),
                    'default'  => __('Pos.', 'woocommerce-packing-slips'),
                    'required' => array('contentItemsShowPos','equals','1'),
                ),
            array(
                'id'       => 'contentItemsShowImage',
                'type'     => 'checkbox',
                'title'    => __( 'Show Image', 'woocommerce-packing-slips' ),
                'default' => 1,
            ),
                array(
                    'id'     =>'contentItemsShowImageWidth',
                    'type'     => 'spinner', 
                    'title'    => __('Image Column Size (%)', 'woocommerce-packing-slips'),
                    'default'  => '10',
                    'min'      => '1',
                    'step'     => '10',
                    'max'      => '100',
                    'required' => array('contentItemsShowImage','equals','1'),
                ),
                array(
                    'id'     =>'contentItemsShowImageSize',
                    'type'     => 'spinner', 
                    'title'    => __('Image size (px)', 'woocommerce-packing-slips'),
                    'default'  => '80',
                    'min'      => '1',
                    'step'     => '10',
                    'max'      => '150',
                    'required' => array('contentItemsShowImage','equals','1'),
                ),
                array(
                    'id'       => 'contentItemsShowImageName',
                    'type'     => 'text',
                    'title'    => __( 'Column Image Name', 'woocommerce-packing-slips' ),
                    'default'  => __('Image', 'woocommerce-packing-slips'),
                    'required' => array('contentItemsShowImage','equals','1'),
                ),
            array(
                'id'       => 'contentItemsShowProduct',
                'type'     => 'checkbox',
                'title'    => __( 'Show Product', 'woocommerce-packing-slips' ),
                'default' => 1,
            ),
                array(
                    'id'     =>'contentItemsShowProductWidth',
                    'type'     => 'spinner', 
                    'title'    => __('Column Size (%)', 'woocommerce-packing-slips'),
                    'default'  => '30',
                    'min'      => '1',
                    'step'     => '10',
                    'max'      => '100',
                    'required' => array('contentItemsShowProduct','equals','1'),
                ),
                array(
                    'id'       => 'contentItemsShowProductName',
                    'type'     => 'text',
                    'title'    => __( 'Column Product Name', 'woocommerce-packing-slips' ),
                    'default'  => __('Product', 'woocommerce-packing-slips'),
                    'required' => array('contentItemsShowProduct','equals','1'),
                ),
            array(
                'id'       => 'contentItemsShowLinks',
                'type'     => 'checkbox',
                'title'    => __( 'Show Product Link', 'woocommerce-packing-slips' ),
                'default' => 1,
                'required' => array('contentItemsShowProduct','equals','1'),
            ),
            array(
                'id'       => 'contentItemsShowSKU',
                'type'     => 'checkbox',
                'title'    => __( 'Show SKU', 'woocommerce-packing-slips' ),
                'default' => 1,
            ),
                array(
                    'id'     =>'contentItemsShowSKUWidth',
                    'type'     => 'spinner', 
                    'title'    => __('Column Size (%)', 'woocommerce-packing-slips'),
                    'default'  => '10',
                    'min'      => '1',
                    'step'     => '10',
                    'max'      => '100',
                    'required' => array('contentItemsShowSKU','equals','1'),
                ),
                array(
                    'id'       => 'contentItemsShowSKUName',
                    'type'     => 'text',
                    'title'    => __( 'Column SKU Name', 'woocommerce-packing-slips' ),
                    'default'  => __('SKU', 'woocommerce-packing-slips'),
                    'required' => array('contentItemsShowSKU','equals','1'),
                ),
            array(
                'id'       => 'contentItemsShowWeight',
                'type'     => 'checkbox',
                'title'    => __( 'Show Weight', 'woocommerce-packing-slips' ),
                'default' => 1,
            ),
                array(
                    'id'     =>'contentItemsShowWeightWidth',
                    'type'     => 'spinner', 
                    'title'    => __('Column Size (%)', 'woocommerce-packing-slips'),
                    'default'  => '10',
                    'min'      => '1',
                    'step'     => '10',
                    'max'      => '100',
                    'required' => array('contentItemsShowWeight','equals','1'),
                ),
                array(
                    'id'       => 'contentItemsShowWeightName',
                    'type'     => 'text',
                    'title'    => __( 'Column Weight Name', 'woocommerce-packing-slips' ),
                    'default'  => __('Weight', 'woocommerce-packing-slips'),
                    'required' => array('contentItemsShowWeight','equals','1'),
                ),
            array(
                'id'       => 'contentItemsShowDimensions',
                'type'     => 'checkbox',
                'title'    => __( 'Show Dimensions', 'woocommerce-packing-slips' ),
                'default' => 0,
            ),
                array(
                    'id'     =>'contentItemsShowDimensionsWidth',
                    'type'     => 'spinner', 
                    'title'    => __('Column Size (%)', 'woocommerce-packing-slips'),
                    'default'  => '10',
                    'min'      => '1',
                    'step'     => '10',
                    'max'      => '100',
                    'required' => array('contentItemsShowDimensions','equals','1'),
                ),
                array(
                    'id'       => 'contentItemsShowDimensionsName',
                    'type'     => 'text',
                    'title'    => __( 'Column Dimensions Name', 'woocommerce-packing-slips' ),
                    'default'  => __('Dimensions', 'woocommerce-packing-slips'),
                    'required' => array('contentItemsShowDimensions','equals','1'),
                ),
            array(
                'id'       => 'contentItemsShowQty',
                'type'     => 'checkbox',
                'title'    => __( 'Show Quantity', 'woocommerce-packing-slips' ),
                'default' => 1,
            ),
                array(
                    'id'     =>'contentItemsShowQtyWidth',
                    'type'     => 'spinner', 
                    'title'    => __('Column Size (%)', 'woocommerce-packing-slips'),
                    'default'  => '10',
                    'min'      => '1',
                    'step'     => '10',
                    'max'      => '100',
                    'required' => array('contentItemsShowQty','equals','1'),
                ),
                array(
                    'id'       => 'contentItemsShowQtyName',
                    'type'     => 'text',
                    'title'    => __( 'Column Qty Name', 'woocommerce-packing-slips' ),
                    'default'  => __('Qty', 'woocommerce-packing-slips'),
                    'required' => array('contentItemsShowQty','equals','1'),
                ),
            array(
                'id'       => 'contentItemsShowPrice',
                'type'     => 'checkbox',
                'title'    => __( 'Show Price', 'woocommerce-packing-slips' ),
                'default' => 0,
            ),
                array(
                    'id'     =>'contentItemsShowPriceWidth',
                    'type'     => 'spinner', 
                    'title'    => __('Column Size (%)', 'woocommerce-packing-slips'),
                    'default'  => '9',
                    'min'      => '1',
                    'step'     => '10',
                    'max'      => '100',
                    'required' => array('contentItemsShowPrice','equals','1'),
                ),
                array(
                    'id'       => 'contentItemsShowPriceName',
                    'type'     => 'text',
                    'title'    => __( 'Column Price Name', 'woocommerce-packing-slips' ),
                    'default'  => __('Single Price', 'woocommerce-packing-slips'),
                    'required' => array('contentItemsShowPrice','equals','1'),
                ),

            array(
                'id'       => 'contentItemsShowCustomField1',
                'type'     => 'checkbox',
                'title'    => __( 'Show Custom Field 1', 'woocommerce-packing-slips' ),
                'default' => 0,
            ),
                array(
                    'id'     =>'contentItemsShowCustomField1Width',
                    'type'     => 'spinner', 
                    'title'    => __('Column Size (%)', 'woocommerce-packing-slips'),
                    'default'  => '10',
                    'min'      => '1',
                    'step'     => '10',
                    'max'      => '100',
                    'required' => array('contentItemsShowCustomField1','equals','1'),
                ),
                array(
                    'id'       => 'contentItemsShowCustomField1Name',
                    'type'     => 'text',
                    'title'    => __( 'Column Custom Field 1 Name', 'woocommerce-packing-slips' ),
                    'default'  => __('', 'woocommerce-packing-slips'),
                    'required' => array('contentItemsShowCustomField1','equals','1'),
                ),
                array(
                    'id'       => 'contentItemsShowCustomField1MetaKey',
                    'type'     => 'text',
                    'title'    => __( 'Column Custom Field 1 Meta Key', 'woocommerce-packing-slips' ),
                    'default'  => __('', 'woocommerce-packing-slips'),
                    'required' => array('contentItemsShowCustomField1','equals','1'),
                ),

            array(
                'id'       => 'contentItemsShowCustomField2',
                'type'     => 'checkbox',
                'title'    => __( 'Show Custom Field 2', 'woocommerce-packing-slips' ),
                'default' => 0,
            ),
                array(
                    'id'     =>'contentItemsShowCustomField2Width',
                    'type'     => 'spinner', 
                    'title'    => __('Column Size (%)', 'woocommerce-packing-slips'),
                    'default'  => '10',
                    'min'      => '1',
                    'step'     => '10',
                    'max'      => '100',
                    'required' => array('contentItemsShowCustomField2','equals','1'),
                ),
                array(
                    'id'       => 'contentItemsShowCustomField2Name',
                    'type'     => 'text',
                    'title'    => __( 'Column Custom Field 2 Name', 'woocommerce-packing-slips' ),
                    'default'  => __('', 'woocommerce-packing-slips'),
                    'required' => array('contentItemsShowCustomField2','equals','1'),
                ),
                array(
                    'id'       => 'contentItemsShowCustomField2MetaKey',
                    'type'     => 'text',
                    'title'    => __( 'Column Custom Field 2 Meta Key', 'woocommerce-packing-slips' ),
                    'default'  => __('', 'woocommerce-packing-slips'),
                    'required' => array('contentItemsShowCustomField2','equals','1'),
                ),
            array(
                'id'     =>'contentItemsEvenBackgroundColor',
                'type' => 'color',
                'url'      => true,
                'title' => __('Even Items Background Color', 'woocommerce-packing-slips'), 
                'validate' => 'color',
                'default' => '#FFFFFF',
            ),
            array(
                'id'     =>'contentItemsEvenTextColor',
                'type' => 'color',
                'url'      => true,
                'title' => __('Even Items Text Color', 'woocommerce-packing-slips'), 
                'validate' => 'color',
                'default' => '#333333',
            ),
            array(
                'id'     =>'contentItemsOddBackgroundColor',
                'type' => 'color',
                'url'      => true,
                'title' => __('Odd Items Background Color', 'woocommerce-packing-slips'), 
                'validate' => 'color',
                'default' => '#ebebeb',
            ),
            array(
                'id'     =>'contentItemsOddTextColor',
                'type' => 'color',
                'url'      => true,
                'title' => __('Odd Items Text Color', 'woocommerce-packing-slips'), 
                'validate' => 'color',
                'default' => '#333333',
            ),
            array(
                'id'     =>'contentTextOutro',
                'type'  => 'editor',
                'title' => __('Content Outro Text', 'woocommerce-packing-slips'),
                'args'   => array(
                    'teeny'            => false,
                ),
                'default' => 
                    'Thank you for shopping with us.<br>
                    <br>
                    Yours sincerely<br>
                    WeLaunch'
            ),
        )
    ) );

    $framework::setSection( $opt_name, array(
        'title'      => __( 'Footer', 'woocommerce-packing-slips' ),
        // 'desc'       => __( '', 'woocommerce-packing-slips' ),
        'id'         => 'footer',
        'subsection' => true,
        'fields'     => array(
            array(
                'id'       => 'enableFooter',
                'type'     => 'checkbox',
                'title'    => __( 'Enable', 'woocommerce-packing-slips' ),
                'subtitle' => __( 'Enable footer', 'woocommerce-packing-slips' ),
                'default' => '1',
            ),
            array(
                'id'     =>'footerBackgroundColor',
                'type' => 'color',
                'url'      => true,
                'title' => __('Footer background color', 'woocommerce-packing-slips'), 
                'validate' => 'color',
                'default' => '#F7F7F7',
                'required' => array('enableFooter','equals','1'),
            ),
            array(
                'id'     =>'footerTextColor',
                'type'  => 'color',
                'url'      => true,
                'title' => __('Footer text color', 'woocommerce-packing-slips'), 
                'validate' => 'color',
                'default' => '#333333',
                'required' => array('enableFooter','equals','1'),
            ),
            array(
                'id'     =>'footerFontSize',
                'type'     => 'spinner', 
                'title'    => __('Footer font size', 'woocommerce-packing-slips'),
                'default'  => '8',
                'min'      => '1',
                'step'     => '1',
                'max'      => '40',
            ),
            array(
                'id'     =>'footerLayout',
                'type'  => 'select',
                'title' => __('Footer Layout', 'woocommerce-packing-slips'), 
                'required' => array('enableFooter','equals','1'),
                'options'  => array(
                    'oneCol' => __('1/1', 'woocommerce-packing-slips' ),
                    'twoCols' => __('1/2 + 1/2', 'woocommerce-packing-slips' ),
                    'threeCols' => __('1/3 + 1/3 + 1/3', 'woocommerce-packing-slips' ),
                    'fourCols' => __('1/4 + 1/4 + 1/4 + 1/4', 'woocommerce-packing-slips' ),
                ),
                'default' => 'fourCols',
                'required' => array('enableFooter','equals','1'),
            ),
            array(
                'id'     =>'footerMargin',
                'type'     => 'spinner', 
                'title'    => __('Footer Margin', 'woocommerce-packing-slips'),
                'default'  => '10',
                'min'      => '1',
                'step'     => '1',
                'max'      => '200',
                'required' => array('enableFooter','equals','1'),
            ),
            array(
                'id'     =>'footerHeight',
                'type'     => 'spinner', 
                'title'    => __('Footer Height', 'woocommerce-packing-slips'),
                'default'  => '30',
                'min'      => '1',
                'step'     => '1',
                'max'      => '200',
                'required' => array('enableFooter','equals','1'),
            ),
            array(
                'id'     =>'footerVAlign',
                'type'  => 'select',
                'title' => __('Vertical Align', 'woocommerce-packing-slips'), 
                'required' => array('enableFooter','equals','1'),
                'options'  => array(
                    'top' => __('Top', 'woocommerce-packing-slips' ),
                    'middle' => __('Middle', 'woocommerce-packing-slips' ),
                    'bottom' => __('Bottom', 'woocommerce-packing-slips' ),
                ),
                'default' => 'top',
            ),
            array(
                'id'     =>'footerTopLeft',
                'type'  => 'select',
                'title' => __('Top Left Footer', 'woocommerce-packing-slips'), 
                'required' => array('enableFooter','equals','1'),
                'options'  => array(
                    'none' => __('None', 'woocommerce-packing-slips' ),
                    'bloginfo' => __('Blog information', 'woocommerce-packing-slips' ),
                    'text' => __('Custom text', 'woocommerce-packing-slips' ),
                    'pagenumber' => __('Pagenumber', 'woocommerce-packing-slips' ),
                    'image' => __('Image', 'woocommerce-packing-slips' ),
                    'exportinfo' => __('Export Information', 'woocommerce-packing-slips' ),
                ),
                'default' => 'text',
            ),
            array(
                'id'     =>'footerTopLeftText',
                'type'  => 'editor',
                'title' => __('Top Left Footer Text', 'woocommerce-packing-slips'), 
                'required' => array('footerTopLeft','equals','text'),
                'args'   => array(
                    'teeny'            => false,
                ),
                'default' => 
                    'Company<br>
                    Address 123<br>
                    1234 City<br>
                    Country'
            ),
            array(
                'id'     =>'footerTopLeftImage',
                'type' => 'media',
                'url'      => true,
                'title' => __('Top Left Footer Image', 'woocommerce-packing-slips'), 
                'required' => array('footerTopLeft','equals','image'),
                'args'   => array(
                    'teeny'            => false,
                )
            ),
            array(
                'id'     =>'footerTopMiddleLeft',
                'type'  => 'select',
                'title' => __('Top Middle Left Footer', 'woocommerce-packing-slips'), 
                'required' => array('footerLayout','equals', array('fourCols')),
                'options'  => array(
                    'none' => __('None', 'woocommerce-packing-slips' ),
                    'bloginfo' => __('Blog information', 'woocommerce-packing-slips' ),
                    'text' => __('Custom text', 'woocommerce-packing-slips' ),
                    'pagenumber' => __('Pagenumber', 'woocommerce-packing-slips' ),
                    'image' => __('Image', 'woocommerce-packing-slips' ),
                    'exportinfo' => __('Export Information', 'woocommerce-packing-slips' ),
                ),
                'default' => 'text',
            ),
            array(
                'id'     =>'footerTopMiddleLeftText',
                'type'  => 'editor',
                'title' => __('Top Middle Left Footer Text', 'woocommerce-packing-slips'), 
                'required' => array('footerTopMiddleLeft','equals','text'),
                'args'   => array(
                    'teeny'            => false,
                ),
                'default' => 
                    'Tel.: 0160 123 1534<br>
                    E-Mail: info@yourdomain.com<br>
                    Web: https://yourdomain.com'
            ),
            array(
                'id'     =>'footerTopMiddleLeftImage',
                'type' => 'media',
                'url'      => true,
                'title' => __('Top Middle Left Footer Image', 'woocommerce-packing-slips'), 
                'required' => array('footerTopMiddleLeft','equals','image'),
                'args'   => array(
                    'teeny'            => false,
                )
            ),
            array(
                'id'     =>'footerTopMiddleRight',
                'type'  => 'select',
                'title' => __('Top Middle Right Footer', 'woocommerce-packing-slips'), 
                'required' => array('footerLayout','equals', array('fourCols','threeCols')),
                'options'  => array(
                    'none' => __('None', 'woocommerce-packing-slips' ),
                    'bloginfo' => __('Blog information', 'woocommerce-packing-slips' ),
                    'text' => __('Custom text', 'woocommerce-packing-slips' ),
                    'pagenumber' => __('Pagenumber', 'woocommerce-packing-slips' ),
                    'image' => __('Image', 'woocommerce-packing-slips' ),
                    'exportinfo' => __('Export Information', 'woocommerce-packing-slips' ),
                ),
                'default' => 'text',
            ),
            array(
                'id'     =>'footerTopMiddleRightText',
                'type'  => 'editor',
                'title' => __('Top Middle Right Footer Text', 'woocommerce-packing-slips'), 
                'required' => array('footerTopMiddleRight','equals','text'),
                'args'   => array(
                    'teeny'            => false,
                ),
                'default' => 
                    'VAT-ID: 123 435 456<br>
                    Managing Director: Your Name'
            ),
            array(
                'id'     =>'footerTopMiddleRightImage',
                'type' => 'media',
                'url'      => true,
                'title' => __('Top Middle Right Footer Image', 'woocommerce-packing-slips'), 
                'required' => array('footerTopMiddleRight','equals','image'),
                'args'   => array(
                    'teeny'            => false,
                )
            ),
            array(
                'id'     =>'footerTopRight',
                'type'  => 'select',
                'title' => __('Top Right Footer', 'woocommerce-packing-slips'), 
                'required' => array('footerLayout','equals', array('fourCols','threeCols','twoCols')),
                'options'  => array(
                    'none' => __('None', 'woocommerce-packing-slips' ),
                    'bloginfo' => __('Blog information', 'woocommerce-packing-slips' ),
                    'text' => __('Custom text', 'woocommerce-packing-slips' ),
                    'pagenumber' => __('Pagenumber', 'woocommerce-packing-slips' ),
                    'image' => __('Image', 'woocommerce-packing-slips' ),
                    'exportinfo' => __('Export Information', 'woocommerce-packing-slips' ),
                ),
                'default' => 'text',
            ),
            array(
                'id'     =>'footerTopRightText',
                'type'  => 'editor',
                'title' => __('Top Right Footer Text', 'woocommerce-packing-slips'), 
                'required' => array('footerTopRight','equals','text'),
                'args'   => array(
                    'teeny'            => false,
                ),
                'default' => 
                    'Bank: Deutsche Bank<br>
                    IBAN: DE 123345 3 456<br>
                    BIC: GEN0123'
            ),
            array(
                'id'     =>'footerTopRightImage',
                'type' => 'media',
                'url'      => true,
                'title' => __('Top Right Footer Image', 'woocommerce-packing-slips'), 
                'required' => array('footerTopRight','equals','image'),
                'args'   => array(
                    'teeny'            => false,
                )
            ),
        )
    ) );

    $framework::setSection( $opt_name, array(
        'title'      => __( 'Advanced settings', 'woocommerce-packing-slips' ),
        'desc'       => __( 'Custom stylesheet / javascript.', 'woocommerce-packing-slips' ),
        'id'         => 'advanced',
        'subsection' => true,
        'fields'     => array(
            array(
                'id'       => 'debugMode',
                'type'     => 'checkbox',
                'title'    => __( 'Enable Debug Mode', 'woocommerce-packing-slips' ),
                'subtitle' => __( 'This stops creating the PDF and shows the plain HTML.', 'woocommerce-packing-slips' ),
                'default'   => 0,
            ),
            array(
                'id'       => 'debugMPDF',
                'type'     => 'checkbox',
                'title'    => __( 'Enable MPDF Debug Mode', 'woocommerce-packing-slips' ),
                'subtitle' => __( 'Show image , font or other errors in the PDF Rendering engine.', 'woocommerce-packing-slips' ),
                'default'   => 0,
            ),
            array(
                'id'       => 'dateFormat',
                'type'     => 'text',
                'title'    => __('Date Format', 'woocommerce-packing-slips'),
                'subtitle' => __( 'Specify the date format. Default is ' . get_option('date_format'), 'woocommerce-packing-slips' ),
                'default'  => get_option('date_format'),
            ),
            array(
                'id'       => 'qrCodeSize',
                'type'     => 'text',
                'title'    => __('QR Code Size', 'woocommerce-packing-slips'),
                'subtitle' => __( 'Default: 0.8', 'woocommerce-packing-slips' ),
                'default'  => '0.8',
            ),
            array(
                'id'       => 'barCodeSize',
                'type'     => 'text',
                'title'    => __('Barcode Size', 'woocommerce-packing-slips'),
                'subtitle' => __( 'Default: 0.8', 'woocommerce-packing-slips' ),
                'default'  => '0.8',
            ),
            array(
                'id'       => 'barCodeType',
                'type'     => 'text',
                'title'    => __('Barcode Type', 'woocommerce-packing-slips'),
                'subtitle' => __( 'Default: C128A, other possibilities: https://mpdf.github.io/reference/html-control-tags/barcode.html', 'woocommerce-packing-slips' ),
                'default'  => 'C128A',
            ),
            array(
                'id'       => 'barCodeValue',
                'type'     => 'select',
                'title'    => __( 'Barcode Value', 'woocommerce-packing-slips' ),
                'subtitle' => __( 'Choose the value of that the barcode gets generated.', 'woocommerce-packing-slips' ),
                'options'  => array(
                    'invoice_number' => __('Invoice Number', 'woocommerce-pdf-invoices'),
                    'id' => __('Order ID', 'woocommerce-pdf-invoices'),
                ),
                'default' => 'id',
            ),
            array(
                'id'       => 'customCSS',
                'type'     => 'ace_editor',
                'mode'     => 'css',
                'title'    => __( 'Custom CSS', 'woocommerce-packing-slips' ),
                'subtitle' => __( 'Add some stylesheet if you want.', 'woocommerce-packing-slips' ),
            ),
        )
    ));


    $framework::setSection( $opt_name, array(
        'title'  => __( 'Preview', 'woocommerce-packing-slips' ),
        'id'     => 'preview',
        'desc'   => __( 'Need support? Please use the comment function on codecanyon.', 'woocommerce-packing-slips' ),
        'icon'   => 'el el-eye-open',
    ) );

    /*
     * <--- END SECTIONS
     */
