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

// @codingStandardsIgnoreFile

/** @var $this Ess_M2ePro_Block_Adminhtml_Ebay_Feedback_Form */

?>

<script type="text/javascript">

    // General for all tabs
    //-----------------------------
    M2ePro.url.add(<?php echo json_encode(Mage::helper('M2ePro')->getControllerActions('adminhtml_ebay_feedback')) ?>);

    M2ePro.url.add(<?php echo json_encode(array(
        'formSubmit' => $this->getUrl('M2ePro/adminhtml_ebay_feedback/save')
    )); ?>);

    M2ePro.translator.add(<?php echo json_encode(array(
        'Should be between 2 and 80 characters long.' => Mage::helper('M2ePro')->__('Should be between 2 and 80 characters long.'),
        'Feedback has been sent.' => Mage::helper('M2ePro')->__('Feedback has been sent.'),
        'Feedback was not sent.' => Mage::helper('M2ePro')->__('Feedback was not sent.')
    )); ?>);

    Event.observe(window, 'load', function() {
        EbayFeedbackObj = new EbayFeedback();
        editForm = new varienForm('edit_form', '<?php echo $this->getValidationUrl(); ?>');

        $('feedback_template').observe('change', EbayFeedbackObj.feedback_template_change);
    });

</script>

<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" />

    <div class="entry-edit" id="magento_block_ebay_feedbacks_response" collapseable="no" style="display: none;">

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

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

                <input id="feedback_id" name="feedback_id" value="" type="hidden" />

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

                    <tr>
                        <td class="label">
                            <label><?php echo Mage::helper('M2ePro')->__('Transaction ID'); ?>:</label>
                        </td>
                        <td class="label">
                            <span id="transaction_id" class="required-entry" style="width: 275px;"></span>
                        </td>
                    </tr>

                    <tr>
                        <td class="label">
                            <label><?php echo Mage::helper('M2ePro')->__('Item ID'); ?>:</label>
                        </td>
                        <td class="label">
                            <span id="item_id" class="required-entry" style="width: 275px;"></span>
                        </td>
                    </tr>

                    <tr>
                        <td class="label">
                            <label><?php echo Mage::helper('M2ePro')->__('Buyer\'s Feedback'); ?>:</label>
                        </td>
                        <td class="label">
                            <span id="buyer_text" style="width: 275px;"></span>
                        </td>
                    </tr>

                    <tr id="feedback_template_tr" style="display: none;">
                        <td class="label">
                            <label for="feedback_template"><?php echo Mage::helper('M2ePro')->__('Choose Predefined Feedback'); ?>: <span class="required">*</span></label>
                        </td>
                        <td class="label">
                            <select id="feedback_template" name="feedback_template" style="width: 275px;"></select>
                        </td>
                    </tr>

                    <tr id="feedback_text_tr">
                        <td class="label">
                            <label for="feedback_text">
                                <span id="new_feedback_label_text" style="display: none;">
                                    <?php echo Mage::helper('M2ePro')->__('Response Message'); ?>: <span class="required">*</span>
                                </span>
                                <span id="template_feedback_label_text" style="display: none;">
                                    <?php echo Mage::helper('M2ePro')->__('Or Write Your Own'); ?>: <span class="required">*</span>
                                </span>
                            </label>
                        </td>
                        <td class="label">
                            <textarea id="feedback_text" name="feedback_text" style="padding: 0; height: 40px; width: 275px;" class="textarea M2ePro-required-when-visible M2ePro-validate-max-length"></textarea>
                        </td>
                    </tr>

                    <tr>
                        <td class="label"></td>
                        <td class="value">
                            <?php echo $this->getChildHtml('send_feedback');?>
                            &nbsp;
                            <a href="javascript:void(0);" onclick="EbayFeedbackObj.cancelFeedback();"><?php echo Mage::helper('M2ePro')->__('Cancel'); ?></a>
                        </td>
                    </tr>

                 </table>

            </div>
        </div>

    </div>

</form>