<?php
/*
 * @author     M2E Pro Developers Team
 * @copyright  M2E LTD
 * @license    Commercial use is forbidden
 */

// @codingStandardsIgnoreFile

/** @var $this Ess_M2ePro_Block_Adminhtml_Ebay_Configuration_General_Form */
?>

<script type="text/javascript">

    M2ePro.php.setConstants(
        <?php echo Mage::helper('M2ePro')->getClassConstantAsJson('Ess_M2ePro_Helper_View_Ebay'); ?>,
        'Ess_M2ePro_Helper_View_Ebay'
    );

    M2ePro.php.setConstants(
        <?php echo Mage::helper('M2ePro')->getClassConstantAsJson('Ess_M2ePro_Helper_Component_Ebay_Motors'); ?>,
        'Ess_M2ePro_Helper_Component_Ebay_Motors'
    );

    M2ePro.url.add(<?php echo json_encode(Mage::helper('M2ePro')->getControllerActions('adminhtml_ebay_configuration')) ?>);

    Event.observe(window, 'load', function() {

        EbayConfigurationObj = new EbayConfiguration();

        editForm = new varienForm('edit_form', '<?php echo $this->getValidationUrl(); ?>');
    });

</script>

<style>

    #ebay_configuration_general_motors_manage_form .form-list td.label {
        width: 125px;
    }
    #ebay_configuration_general_motors_manage_form .form-list td.label label {
        width: 100px;
    }

</style>

<form id="<?php echo $this->getForm()->getId(); ?>" action="<?php echo $this->getForm()->getData('action'); ?>" method="post" enctype="multipart/form-data">

    <input name="form_key" value="<?php echo $this->getFormKey(); ?>" type="hidden" />

    <?php if ($this->getEnabledFeedback()) : ?>
        <div class="entry-edit" id="magento_block_ebay_configuration_general_notification">

            <div class="entry-edit-head">
                <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('M2ePro')->__('Notifications'); ?></h4>
            </div>

            <div class="fieldset">
                <div class="hor-scroll">

                    <table class="form-list" cellspacing="0" cellpadding="0">

                        <tbody>

                        <tr id="negative_feedbacks_row">
                            <td class="label">
                                <label for="feedback_notification_mode"><?php echo Mage::helper('M2ePro')->__('Negative Feedback'); ?>: </label>
                            </td>
                            <td class="value">
                                <select id="feedback_notification_mode" name="feedback_notification_mode">
                                    <option value="0" <?php if (!$this->getConfigurationHelper()->isEnableFeedbackNotificationMode()): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('No'); ?></option>
                                    <option value="1" <?php if ($this->getConfigurationHelper()->isEnableFeedbackNotificationMode()): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('Yes'); ?></option>
                                </select>
                                <p class="note">
                                    <span><?php echo Mage::helper('M2ePro')->__('Show a notification in Magento when you receive negative Feedback on eBay.'); ?></span>
                                </p>
                            </td>
                        </tr>

                        </tbody>

                    </table>

                </div>
            </div>

        </div>
    <?php endif; ?>

    <div class="entry-edit" id="magento_block_ebay_configuration_general_selling">

        <div class="entry-edit-head">
            <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('M2ePro')->__('Selling'); ?></h4>
        </div>

        <div class="fieldset">
            <div class="hor-scroll">

                <table class="form-list" cellspacing="0" cellpadding="0">

                    <tbody>

                    <tr>
                        <td class="label">
                            <label for="prevent_item_duplicates_mode"><?php echo Mage::helper('M2ePro')->__('Prevent eBay Item Duplicates')?>: </label>
                        </td>

                        <td class="value">
                            <select id="prevent_item_duplicates_mode" name="prevent_item_duplicates_mode">
                                <option value="0" <?php if (!$this->getConfigurationHelper()->isEnablePreventItemDuplicatesMode()): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('No'); ?></option>
                                <option value="1" <?php if ($this->getConfigurationHelper()->isEnablePreventItemDuplicatesMode()): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('Yes'); ?></option>
                            </select>
                            <p class="note">
                                <span><?php echo Mage::helper('M2ePro')->__(
                                    'M2E Pro will not list Magento Product on the Channel if it is already listed within the same eBay Account and Marketplace.'
                                ); ?></span>
                            </p>
                        </td>
                    </tr>

                    </tbody>

                </table>

            </div>
        </div>

    </div>

    <div class="entry-edit" id="magento_block_ebay_configuration_general_images">

        <div class="entry-edit-head">
            <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('M2ePro')->__('Image Uploading'); ?></h4>
        </div>

        <div class="fieldset">
            <div class="hor-scroll">

                <table class="form-list" cellspacing="0" cellpadding="0">

                    <tr>
                        <td class="label">
                            <label for="upload_images_mode"><?php echo Mage::helper('M2ePro')->__('Main Image/Gallery Hosting Mode')?>: </label>
                        </td>

                        <td class="value">
                            <select id="upload_images_mode" name="upload_images_mode">
                                <option value="<?php echo Ess_M2ePro_Helper_Component_Ebay_Configuration::UPLOAD_IMAGES_MODE_AUTO; ?>" <?php if ($this->getConfigurationHelper()->isAutoUploadImagesMode()): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('Automatic'); ?></option>
                                <option value="<?php echo Ess_M2ePro_Helper_Component_Ebay_Configuration::UPLOAD_IMAGES_MODE_SELF; ?>" <?php if ($this->getConfigurationHelper()->isSelfUploadImagesMode()): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('Self-Hosted'); ?></option>
                                <option value="<?php echo Ess_M2ePro_Helper_Component_Ebay_Configuration::UPLOAD_IMAGES_MODE_EPS; ?>" <?php if ($this->getConfigurationHelper()->isEpsUploadImagesMode()): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('EPS-Hosted'); ?></option>
                            </select>
                            <p class="note">
                                <span><?php echo Mage::helper('M2ePro')->__('
                                    Select the Mode which you would like to use for uploading Images on eBay:<br/>
                                    <strong>Automatic</strong> — if you try to upload more then 1 Image for an Item or
                                    separate Variational Attribute the EPS-hosted mode will be used automatically.
                                    Otherwise, the Self-hosted mode will be used automatically;<br/>
                                    <strong>Self-Hosted</strong> — all the Images are provided as a direct Links to the
                                    Images saved in your Magento;<br/>
                                    <strong>EPS-Hosted</strong> — the Images are uploaded to eBay EPS service.
                                '); ?></span>
                            </p>
                        </td>
                    </tr>

                </table>

            </div>
        </div>

    </div>

    <?php if ($this->getMotorsMarketplace()->isStatusEnabled() && $this->getMotorsMarketplace()->getChildObject()->isEpidEnabled()): ?>
        <div class="entry-edit" id="magento_block_ebay_configuration_general_motors_epids">

            <div class="entry-edit-head">
                <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('M2ePro')->__('Parts Compatibility [ePIDs Motors]'); ?></h4>
            </div>

            <div class="fieldset">
                <div class="hor-scroll">

                    <div id="block_notice_ebay_category_motors_epids" class="block_notices_module" title="<?php echo Mage::helper('M2ePro')->__('Parts Compatibility [ePIDs Motors]'); ?>">
                        <?php echo Mage::helper('M2ePro')->__('
                            In this Section, you can provide a Magento Attribute where ePID values for your Products will be saved.
                            <br/>
                            Also you can Add/Update ePID Database manually by clicking <strong>Manage Option</strong> in Database line.
                        '); ?>
                    </div>

                    <table class="form-list" cellspacing="0" cellpadding="0">
                        <tbody>

                        <tr>
                            <td class="label">
                                <label for="motors_epids_attribute"><?php echo Mage::helper('M2ePro')->__('Attribute'); ?>:</label>
                            </td>

                            <?php if (count($this->getAvailabilityAttributes()) != 0): ?>

                                <td class="value">
                                    <select id="motors_epids_attribute" class="select M2ePro-custom-attribute-can-be-created" allowed_attribute_types="textarea" apply_to_all_attribute_sets="0" name="motors_epids_attribute">
                                        <option value="">-- <?php echo Mage::helper('M2ePro')->__('Select Attribute'); ?> --</option>
                                        <?php foreach ($this->getAvailabilityAttributes() as $attribute): ?>
                                            <option value="<?php echo $attribute['code']; ?>"<?php if ($attribute['code'] == $this->getConfigurationHelper()->getMotorsEpidsAttribute()): ?> selected="selected"<?php endif; ?>><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?></option>
                                        <?php endforeach; ?>
                                    </select>
                                </td>
                                <td id="motors_epids_attribute_td_note">
                                    <p class="note">
                                            <span><?php echo Mage::helper('M2ePro')->__(
                                                'Choose the Attribute that contains the Product Reference IDs (ePIDs) of compatible vehicles for the parts.
                                                 In the M2E Pro Listing, use the <strong>Add Compatible Vehicles</strong> tool to find necessary compatible Items.
                                                 <br/>
                                                 Only Textarea Attributes are shown.'
                                            ); ?></span>
                                        </p>
                                    </td>

                                <?php else: ?>

                                    <td class="value">
                                        <div id="block_notice_ebay_configuration_motors_epids_attribute" class="block_notices_module" title="" subtitle="" collapseable="no" hideblock="no" always_show="yes">
                                            <?php echo Mage::helper('M2ePro')->__('You do not have Textarea Attributes.'); ?>
                                        </div>
                                    </td>

                                <?php endif; ?>
                            </tr>

                            <tr>
                                <td class="label">
                                    <label><?php echo Mage::helper('M2ePro')->__('Database'); ?>:</label>
                                </td>

                                <td class="value">
                                    <span style="padding-right: 2px;"><?php echo Mage::helper('M2ePro')->__('From eBay'); ?>: </span>
                                    <span style="font-weight: bold; display: inline-block; width: 40px;"><?php echo $this->getMotorsEpidCount(); ?></span>

                                    <span style="padding-right: 2px; padding-left: 10px;"><?php echo Mage::helper('M2ePro')->__('Custom Added'); ?>: </span>
                                    <span style="font-weight: bold; padding-right: 2px;"><?php echo $this->getMotorsEpidCustomCount(); ?></span>

                                    <span style="">
                                        (<a href="javascript:void(0);" onclick="EbayConfigurationObj.manageMotorsRecords('<?php echo Ess_M2ePro_Helper_Component_Ebay_Motors::TYPE_EPID_MOTOR; ?>', '<?php echo Mage::helper('M2ePro')->__('Manage Custom Compatibility [ePIDs Motors]'); ?>');"><?php echo Mage::helper('M2ePro')->__('manage'); ?></a>)
                                    </span>
                                </td>
                            </tr>

                        </tbody>
                    </table>

                </div>
            </div>

        </div>
    <?php endif; ?>

    <?php if ($this->getUkMarketplace()->isStatusEnabled() && $this->getUkMarketplace()->getChildObject()->isEpidEnabled()): ?>
        <div class="entry-edit" id="magento_block_ebay_configuration_general_motors_epids_uk">

            <div class="entry-edit-head">
                <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('M2ePro')->__('Parts Compatibility [ePIDs UK]'); ?></h4>
            </div>

            <div class="fieldset">
                <div class="hor-scroll">

                    <div id="block_notice_ebay_category_motors_epids_uk" class="block_notices_module" title="<?php echo Mage::helper('M2ePro')->__('Parts Compatibility [ePIDs UK]'); ?>">
                        <?php echo Mage::helper('M2ePro')->__('
                            In this Section, you can provide a Magento Attribute where ePID values for UK marketplace will be saved.
                            <br/>
                            Also you can Add/Update ePID Database manually by clicking <strong>Manage Option</strong> in Database line.
                            <br/>
                            You have an ability to choose either ePID or kType values should be used on eBay UK.
                            Specify the appropriate <strong>Parts Compatibility Mode</strong> for your Listing in M2E Pro Listings grid.
                        '); ?>
                    </div>

                    <table class="form-list" cellspacing="0" cellpadding="0">
                        <tbody>

                        <tr>
                            <td class="label">
                                <label for="uk_epids_attribute"><?php echo Mage::helper('M2ePro')->__('Attribute'); ?>:</label>
                            </td>

                            <?php if (count($this->getAvailabilityAttributes()) != 0): ?>

                                <td class="value">
                                    <select id="uk_epids_attribute" class="select M2ePro-custom-attribute-can-be-created" allowed_attribute_types="textarea" apply_to_all_attribute_sets="0" name="uk_epids_attribute">
                                        <option value="">-- <?php echo Mage::helper('M2ePro')->__('Select Attribute'); ?> --</option>
                                        <?php foreach ($this->getAvailabilityAttributes() as $attribute): ?>
                                            <option value="<?php echo $attribute['code']; ?>"<?php if ($attribute['code'] == $this->getConfigurationHelper()->getUkEpidsAttribute()): ?> selected="selected"<?php endif; ?>><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?></option>
                                        <?php endforeach; ?>
                                    </select>
                                </td>
                                <td id="uk_epids_attribute_td_note">
                                    <p class="note">
                                        <span>
                                            <?php echo Mage::helper('M2ePro')->__(
                                                'Choose the Attribute that contains the Product Reference IDs (ePIDs) of compatible vehicles for the parts.
                                                 In the M2E Pro Listing, use the <strong>Add Compatible Vehicles</strong> tool to find necessary compatible Items.
                                                 <br/>
                                                 Only Textarea Attributes are shown.'
                                            ); ?>
                                        </span>
                                    </p>
                                </td>

                            <?php else: ?>

                                <td class="value">
                                    <div id="block_notice_ebay_configuration_uk_epids_attribute" class="block_notices_module" title="" subtitle="" collapseable="no" hideblock="no" always_show="yes">
                                        <?php echo Mage::helper('M2ePro')->__('You do not have Textarea Attributes.'); ?>
                                    </div>
                                </td>

                            <?php endif; ?>
                        </tr>

                        <tr>
                            <td class="label">
                                <label><?php echo Mage::helper('M2ePro')->__('Database'); ?>:</label>
                            </td>

                            <td class="value">
                                <span style="padding-right: 2px;"><?php echo Mage::helper('M2ePro')->__('From eBay'); ?>: </span>
                                <span style="font-weight: bold; display: inline-block; width: 40px;"><?php echo $this->getUkEpidCount(); ?></span>

                                <span style="padding-right: 2px; padding-left: 10px;"><?php echo Mage::helper('M2ePro')->__('Custom Added'); ?>: </span>
                                <span style="font-weight: bold; padding-right: 2px;"><?php echo $this->getUkEpidCustomCount(); ?></span>

                                <span style="">
                                    (<a href="javascript:void(0);" onclick="EbayConfigurationObj.manageMotorsRecords('<?php echo Ess_M2ePro_Helper_Component_Ebay_Motors::TYPE_EPID_UK; ?>', '<?php echo Mage::helper('M2ePro')->__('Manage Custom Compatibility [ePIDs UK]'); ?>');"><?php echo Mage::helper('M2ePro')->__('manage'); ?></a>)
                                </span>
                            </td>
                        </tr>

                        </tbody>
                    </table>

                </div>
            </div>

        </div>
    <?php endif; ?>

    <?php if ($this->getDeMarketplace()->isStatusEnabled() && $this->getDeMarketplace()->getChildObject()->isEpidEnabled()): ?>
        <div class="entry-edit" id="magento_block_ebay_configuration_general_motors_epids_de">

            <div class="entry-edit-head">
                <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('M2ePro')->__('Parts Compatibility [ePIDs DE]'); ?></h4>
            </div>

            <div class="fieldset">
                <div class="hor-scroll">

                    <div id="block_notice_ebay_category_motors_epids_de" class="block_notices_module" title="<?php echo Mage::helper('M2ePro')->__('Parts Compatibility [ePIDs DE]'); ?>">
                        <?php echo Mage::helper('M2ePro')->__('
                            In this Section, you can provide a Magento Attribute where ePID values for DE marketplace will be saved.
                            <br/>
                            Also you can Add/Update ePID Database manually by clicking <strong>Manage Option</strong> in Database line.
                            <br/>
                            You have an ability to choose either ePID or kType values should be used on eBay DE.
                            Specify the appropriate <strong>Parts Compatibility Mode</strong> for your Listing in M2E Pro Listings grid.
                        '); ?>
                    </div>

                    <table class="form-list" cellspacing="0" cellpadding="0">
                        <tbody>

                        <tr>
                            <td class="label">
                                <label for="de_epids_attribute"><?php echo Mage::helper('M2ePro')->__('Attribute'); ?>:</label>
                            </td>

                            <?php if (count($this->getAvailabilityAttributes()) != 0): ?>

                                <td class="value">
                                    <select id="de_epids_attribute" class="select M2ePro-custom-attribute-can-be-created" allowed_attribute_types="textarea" apply_to_all_attribute_sets="0" name="de_epids_attribute">
                                        <option value="">-- <?php echo Mage::helper('M2ePro')->__('Select Attribute'); ?> --</option>
                                        <?php foreach ($this->getAvailabilityAttributes() as $attribute): ?>
                                            <option value="<?php echo $attribute['code']; ?>"<?php if ($attribute['code'] == $this->getConfigurationHelper()->getDeEpidsAttribute()): ?> selected="selected"<?php endif; ?>><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?></option>
                                        <?php endforeach; ?>
                                    </select>
                                </td>
                                <td id="de_epids_attribute_td_note">
                                    <p class="note">
                                        <span>
                                            <?php echo Mage::helper('M2ePro')->__(
                                                'Choose the Attribute that contains the Product Reference IDs (ePIDs) of compatible vehicles for the parts.
                                                 In the M2E Pro Listing, use the <strong>Add Compatible Vehicles</strong> tool to find necessary compatible Items.
                                                 <br/>
                                                 Only Textarea Attributes are shown.'
                                            ); ?>
                                        </span>
                                    </p>
                                </td>

                            <?php else: ?>

                                <td class="value">
                                    <div id="block_notice_ebay_configuration_de_epids_attribute" class="block_notices_module" title="" subtitle="" collapseable="no" hideblock="no" always_show="yes">
                                        <?php echo Mage::helper('M2ePro')->__('You do not have Textarea Attributes.'); ?>
                                    </div>
                                </td>

                            <?php endif; ?>
                        </tr>

                        <tr>
                            <td class="label">
                                <label><?php echo Mage::helper('M2ePro')->__('Database'); ?>:</label>
                            </td>

                            <td class="value">
                                <span style="padding-right: 2px;"><?php echo Mage::helper('M2ePro')->__('From eBay'); ?>: </span>
                                <span style="font-weight: bold; display: inline-block; width: 40px;"><?php echo $this->getDeEpidCount(); ?></span>

                                <span style="padding-right: 2px; padding-left: 10px;"><?php echo Mage::helper('M2ePro')->__('Custom Added'); ?>: </span>
                                <span style="font-weight: bold; padding-right: 2px;"><?php echo $this->getDeEpidCustomCount(); ?></span>

                                <span style="">
                                    (<a href="javascript:void(0);" onclick="EbayConfigurationObj.manageMotorsRecords('<?php echo Ess_M2ePro_Helper_Component_Ebay_Motors::TYPE_EPID_DE; ?>', '<?php echo Mage::helper('M2ePro')->__('Manage Custom Compatibility [ePIDs DE]'); ?>');"><?php echo Mage::helper('M2ePro')->__('manage'); ?></a>)
                                </span>
                            </td>
                        </tr>

                        </tbody>
                    </table>

                </div>
            </div>

        </div>
    <?php endif; ?>

    <?php if ($this->getItMarketplace()->isStatusEnabled() && $this->getItMarketplace()->getChildObject()->isEpidEnabled()): ?>
        <div class="entry-edit" id="magento_block_ebay_configuration_general_motors_epids_it">

            <div class="entry-edit-head">
                <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('M2ePro')->__('Parts Compatibility [ePIDs IT]'); ?></h4>
            </div>

            <div class="fieldset">
                <div class="hor-scroll">

                    <div id="block_notice_ebay_category_motors_epids_it" class="block_notices_module" title="<?php echo Mage::helper('M2ePro')->__('Parts Compatibility [ePIDs IT]'); ?>">
                        <?php echo Mage::helper('M2ePro')->__('
                            In this Section, you can provide a Magento Attribute where ePID values for IT marketplace will be saved.
                            <br/>
                            Also you can Add/Update ePID Database manually by clicking <strong>Manage Option</strong> in Database line.
                            <br/>
                            You have an ability to choose either ePID or kType values should be used on eBay IT.
                            Specify the appropriate <strong>Parts Compatibility Mode</strong> for your Listing in M2E Pro Listings grid.
                        '); ?>
                    </div>

                    <table class="form-list" cellspacing="0" cellpadding="0">
                        <tbody>

                        <tr>
                            <td class="label">
                                <label for="it_epids_attribute"><?php echo Mage::helper('M2ePro')->__('Attribute'); ?>:</label>
                            </td>

                            <?php if (count($this->getAvailabilityAttributes()) != 0): ?>

                                <td class="value">
                                    <select id="it_epids_attribute" class="select M2ePro-custom-attribute-can-be-created" allowed_attribute_types="textarea" apply_to_all_attribute_sets="0" name="it_epids_attribute">
                                        <option value="">-- <?php echo Mage::helper('M2ePro')->__('Select Attribute'); ?> --</option>
                                        <?php foreach ($this->getAvailabilityAttributes() as $attribute): ?>
                                            <option value="<?php echo $attribute['code']; ?>"<?php if ($attribute['code'] == $this->getConfigurationHelper()->getItEpidsAttribute()): ?> selected="selected"<?php endif; ?>><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?></option>
                                        <?php endforeach; ?>
                                    </select>
                                </td>
                                <td id="it_epids_attribute_td_note">
                                    <p class="note">
                                        <span>
                                            <?php echo Mage::helper('M2ePro')->__(
                                                'Choose the Attribute that contains the Product Reference IDs (ePIDs) of compatible vehicles for the parts.
                                                 In the M2E Pro Listing, use the <strong>Add Compatible Vehicles</strong> tool to find necessary compatible Items.
                                                 <br/>
                                                 Only Textarea Attributes are shown.'
                                            ); ?>
                                        </span>
                                    </p>
                                </td>

                            <?php else: ?>

                                <td class="value">
                                    <div id="block_notice_ebay_configuration_it_epids_attribute" class="block_notices_module" title="" subtitle="" collapseable="no" hideblock="no" always_show="yes">
                                        <?php echo Mage::helper('M2ePro')->__('You do not have Textarea Attributes.'); ?>
                                    </div>
                                </td>

                            <?php endif; ?>
                        </tr>

                        <tr>
                            <td class="label">
                                <label><?php echo Mage::helper('M2ePro')->__('Database'); ?>:</label>
                            </td>

                            <td class="value">
                                <span style="padding-right: 2px;"><?php echo Mage::helper('M2ePro')->__('From eBay'); ?>: </span>
                                <span style="font-weight: bold; display: inline-block; width: 40px;"><?php echo $this->getItEpidCount(); ?></span>

                                <span style="padding-right: 2px; padding-left: 10px;"><?php echo Mage::helper('M2ePro')->__('Custom Added'); ?>: </span>
                                <span style="font-weight: bold; padding-right: 2px;"><?php echo $this->getItEpidCustomCount(); ?></span>

                                <span style="">
                                    (<a href="javascript:void(0);" onclick="EbayConfigurationObj.manageMotorsRecords('<?php echo Ess_M2ePro_Helper_Component_Ebay_Motors::TYPE_EPID_IT; ?>', '<?php echo Mage::helper('M2ePro')->__('Manage Custom Compatibility [ePIDs IT]'); ?>');"><?php echo Mage::helper('M2ePro')->__('manage'); ?></a>)
                                </span>
                            </td>
                        </tr>

                        </tbody>
                    </table>

                </div>
            </div>

        </div>
    <?php endif; ?>

    <?php if ($this->getEnabledKtype()) : ?>

        <div class="entry-edit" id="magento_block_ebay_configuration_general_motors_ktypes">

            <div class="entry-edit-head">
                <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('M2ePro')->__('Parts Compatibility [kTypes]'); ?></h4>
            </div>

            <div class="fieldset">
                <div class="hor-scroll">

                    <div id="block_notice_ebay_category_motors_ktypes" class="block_notices_module" title="<?php echo Mage::helper('M2ePro')->__('Parts Compatibility [kTypes]'); ?>">
                        <?php echo Mage::helper('M2ePro')->__('
                            In this Section, you can provide a Magento Attribute where kType values for your Products will be saved.
                            <br/>
                            Also you can Add/Update kType Database manually by clicking <strong>Manage Option</strong> in Database line.
                        '); ?>
                    </div>

                    <table class="form-list" cellspacing="0" cellpadding="0">
                        <tbody>

                        <tr>
                            <td class="label">
                                <label for="ktypes_attribute"><?php echo Mage::helper('M2ePro')->__('Attribute'); ?>:</label>
                            </td>

                            <?php if (count($this->getAvailabilityAttributes()) != 0): ?>

                                <td class="value">
                                    <select id="ktypes_attribute" class="select M2ePro-custom-attribute-can-be-created" allowed_attribute_types="textarea" apply_to_all_attribute_sets="0" name="ktypes_attribute">
                                        <option value="">-- <?php echo Mage::helper('M2ePro')->__('Select Attribute'); ?> --</option>
                                        <?php foreach ($this->getAvailabilityAttributes() as $attribute): ?>
                                            <option value="<?php echo $attribute['code']; ?>"<?php if ($attribute['code'] == $this->getConfigurationHelper()->getKTypesAttribute()): ?> selected="selected"<?php endif; ?>><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?></option>
                                        <?php endforeach; ?>
                                    </select>
                                </td>
                                <td id="ktypes_attribute_td_note">
                                    <p class="note">
                                        <span><?php echo Mage::helper('M2ePro')->__(
                                            'Choose the Attribute that contains the kTypes of compatible vehicles 
                                            for the parts. In the M2E Pro Listing, use the <strong>Add Compatible 
                                            Vehicles</strong> tool to find necessary compatible Items. Only Text 
                                            Area Attributes are shown.<br/> If you configure kTypes via Magento 
                                            attributes, make sure its input type (under attribute properties) is 
                                            set to Text Area.'
                                        ); ?></span>
                                    </p>
                                </td>

                            <?php else: ?>

                                <td class="value">
                                    <div id="block_notice_ebay_configuration_ktypes_attribute" class="block_notices_module" title="" subtitle="" collapseable="no" hideblock="no" always_show="yes">
                                        <?php echo Mage::helper('M2ePro')->__('You do not have Textarea Attributes.'); ?>
                                    </div>
                                </td>

                            <?php endif; ?>
                        </tr>

                        <tr>
                            <td class="label">
                                <label><?php echo Mage::helper('M2ePro')->__('Database'); ?>:</label>
                            </td>

                            <td class="value">
                                <span style="padding-right: 2px;"><?php echo Mage::helper('M2ePro')->__('From eBay'); ?>: </span>
                                <span style="font-weight: bold; display: inline-block; width: 40px;"><?php echo $this->getKtypeCount(); ?></span>

                                <span style="padding-right: 2px; padding-left: 10px;"><?php echo Mage::helper('M2ePro')->__('Custom Added'); ?>: </span>
                                <span style="font-weight: bold; padding-right: 2px;"><?php echo $this->getKtypeCustomCount(); ?></span>

                                <span style="">
                                        (<a href="javascript:void(0);" onclick="EbayConfigurationObj.manageMotorsRecords('<?php echo Ess_M2ePro_Helper_Component_Ebay_Motors::TYPE_KTYPE; ?>', '<?php echo Mage::helper('M2ePro')->__('Manage Custom Compatibility [kTypes]'); ?>');"><?php echo Mage::helper('M2ePro')->__('manage'); ?></a>)
                                    </span>
                            </td>
                        </tr>

                        </tbody>
                    </table>

                </div>
            </div>

        </div>
    <?php endif; ?>

</form>

<!-- POPUP CONTENT -->
<div id="manage_motors_popup_contents" style="display: none;">

    <div style="padding-bottom: 35px;">
        <div id="block_notice_ebay_configuration_general_motors_manage" class="block_notices_module" title="<?php echo Mage::helper('M2ePro')->__('Manage Custom Compatibility'); ?>" style="margin-top: 15px;">

            <?php echo Mage::helper('M2ePro')->__('
                In this Section you can <strong>Add/Update</strong> Custom Compatible Vehicles information using prepared file.
                This file should be in CSV format, where each line describes one Compatible Vehicle.<br/><br/>
                First line of the file should contain names of Columns:
                <ul class="list">
                <li>for ePIDs: epid, product_type, make, model, submodel, street_name, year, trim, engine</li>
                <li>for kTypes: ktype, make, model, variant, body_style, type, from_year, to_year, engine</li>
                </ul>
                There are several required fields:
                <ul class="list">
                <li>for ePIDs: epid, product_type, make, model, submodel, year</li>
                <li>for kTypes: ktype</li>
                </ul>
                For ePIDs product_type column you should provide one of these possible Values:
                <ul class="list">
                <li>0 - for Car / Truck type</li>
                <li>1 - for Motorcycle type</li>
                <li>2 - for ATV / Snowmobiles type</li>
                </ul>
                You can always clear Added Compatible Vehicles by pressing <strong>Clear</strong> Button.
            '); ?>

        </div>

        <form id="ebay_configuration_general_motors_manage_form" action="<?php echo $this->getUrl('*/*/importMotorsData'); ?>" method="post" enctype="multipart/form-data">

            <input name="form_key" value="<?php echo $this->getFormKey(); ?>" type="hidden" />
            <input name="motors_type" id="motors_type" value="" type="hidden" />

            <div class="fieldset" style="padding-top: 5px;">
                <div class="hor-scroll">

                    <table class="form-list" cellspacing="0" cellpadding="0">

                        <tr>
                            <td class="label">
                                <label><?php echo Mage::helper('M2ePro')->__('Database'); ?>:</label>
                            </td>
                            <td class="value">
                                <span id="database-statistic-popup-epids-uk" class="database-statistic-popup" style="font-weight: bold;"><?php echo $this->getUkEpidCustomCount(); ?></span>
                                <span id="database-statistic-popup-epids-de" class="database-statistic-popup" style="font-weight: bold;"><?php echo $this->getDeEpidCustomCount(); ?></span>
                                <span id="database-statistic-popup-epids-it" class="database-statistic-popup" style="font-weight: bold;"><?php echo $this->getItEpidCustomCount(); ?></span>
                                <span id="database-statistic-popup-epids-motor" class="database-statistic-popup" style="font-weight: bold;"><?php echo $this->getMotorsEpidCustomCount(); ?></span>
                                <span id="database-statistic-popup-ktypes" class="database-statistic-popup" style="font-weight: bold;"><?php echo $this->getKtypeCustomCount(); ?></span>
                            </td>
                            <td class="value" style="width: 90px; text-align: right;">
                                <button type="button" style="min-width: 55px;" onclick="EbayConfigurationObj.clearAddedMotorsRecords.bind(this)();"><?php echo Mage::helper('M2ePro')->__('Clear') ?></button>
                            </td>
                        </tr>

                        <tr>
                            <td class="label">
                                <?php echo Mage::helper('M2ePro')->__('File for import'); ?>: <span class="required">*</span>
                            </td>
                            <td class="value">
                                <input name="source" id="source" type="file" accept=".csv" class="required-entry" />
                            </td>
                            <td class="value" style="text-align: right;">
                                <button type="button" style="min-width: 55px;" onclick="EbayConfigurationObj.importMotorsRecords();"><?php echo Mage::helper('M2ePro')->__('Import') ?></button>
                            </td>
                        </tr>

                    </table>

                </div>
            </div>

        </form>

        <div style="float: right;">
            <button type="button" style="min-width: 55px" onclick="Windows.getFocusedWindow().close()"><?php echo Mage::helper('M2ePro')->__('Close'); ?></button>
        </div>

    </div>
</div>
