<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     default_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php if (!$this->isReadonly()):?>
<div class="entry-edit">
    <div id="assign_product_warrning" style="display: none;">
        <ul class="messages">
            <li class="error-msg">
                <ul>
                    <li><?php echo $this->__('Links with associated products will retain only after saving current product.') ?></li>
                </ul>
            </li>
        </ul>
    </div>
    <div class="entry-edit-head">
        <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('catalog')->__('Create Simple Associated Product') ?></h4>
    </div>
    <fieldset class="a-right">
        <?php echo $this->getChildHtml('create_empty') ?> <?php echo $this->getChildHtml('create_from_configurable') ?>
    </fieldset>
</div>

<div id="<?php echo $this->getHtmlId() ?>_simple_form" class="ignore-validate configurable-simple-product">
<?php echo $this->getChildHtml('simple'); ?>
</div>
<?php endif;?>
<div class="entry-edit">
    <div class="entry-edit-head">
        <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('catalog')->__('Super product attributes configuration') ?></h4>
    </div>
    <fieldset id="<?php echo $this->getHtmlId() ?>">
        <legend><?php echo Mage::helper('catalog')->__('Super product attributes configuration') ?></legend>
        <input type="hidden" id="<?php echo $this->getHtmlId() ?>_save_links" name="configurable_products_data" value=""/>
        <input type="hidden" id="<?php echo $this->getHtmlId() ?>_save_attributes" name="configurable_attributes_data" />

        <ul class="messages">
            <li class="notice-msg">
                <ul><li><?php echo Mage::helper('catalog')->__('Price values for options should be specified in system base currency.')?></li></ul>
                <ul><li><?php echo Mage::helper('catalog')->__('Attrribute names can be specified per store.')?></li></ul>
            </li>
        </ul>
        <ul id="<?php echo $this->getHtmlId() ?>_attributes" class="super-attributes">
        </ul>
    </fieldset>
</div>
<div class="no-display" id="<?php echo $this->getHtmlId() ?>_attribute_template">
    <div class="<?php if (!$this->isReadonly()):?>attribute-name-container <?php endif;?>left">
        '{{frontend_label}}'
    </div>
    <div class="values-container right">
        <label for="__id___label" class="bold"><?php echo Mage::helper('catalog')->__('Attribute Name:') ?></label>
        <input id="__id___label" type="text" <?php if ($this->isAttributesConfigurationReadonly()): ?> disabled="disabled" <?php endif;?> class="input-text attribute-label required-entry template no-display" value="'{{label}}'" readonly="label" />
        <input id="__id___label_use_default" type="checkbox" value="1" " checked="use_default" class="attribute-use-default-label">
        <label for="__id___label_use_default"><?php echo Mage::helper('catalog')->__('Use default')?> ('{{store_label}}')</label>
        <ul class="attribute-values">
        </ul>
    </div>
</div>
<div class="no-display" id="<?php echo $this->getHtmlId() ?>_value_template">
    <div class="attribute-value-label-container left">
    <?php echo Mage::helper('catalog')->__('Option:') ?> <strong>'{{label}}'</strong>
</div>
<?php if ($this->getCanReadPrice() !== false) : ?>
<div class="attribute-values-container-main">
    <div class="attribute-values-container left">
    <?php echo Mage::helper('catalog')->__('Price:') ?>
    <input id="__id___pricing" type="text" <?php if ($this->isAttributesPricesReadonly() || $this->getCanEditPrice() === false): ?> disabled="disabled" <?php endif;?> class="input-text attribute-price validate-number template no-display" value="'{{pricing_value}}'"/>
</div>
<div class="attribute-values-container left">
    &nbsp;<select class="attribute-price-type" id="__id___price_type" <?php if ($this->isAttributesPricesReadonly() || $this->getCanEditPrice() === false): ?> disabled="disabled" <?php endif;?>>
        <option value="0"><?php echo Mage::helper('catalog')->__('Fixed') ?></option>
        <option value="1"><?php echo Mage::helper('catalog')->__('Percentage') ?></option>
    </select>
</div>
<?php if ($this->getShowUseDefaultPrice()):?>
<div class="attribute-values-container">
    &nbsp;<input id="__id___default" type="checkbox" <?php if ($this->isAttributesPricesReadonly() || $this->getCanEditPrice() === false): ?> disabled="disabled" <?php endif;?> class="attribute-use-default-value"> <label for="__id___default" class="normal"><?php echo Mage::helper('catalog')->__('Use Default Value') ?></label>
</div>
<?php endif;?>
<?php else : ?>
<div class="attribute-values-container-main">
    <div class="attribute-values-container left">
    <input id="__id___pricing" type="hidden"  class="attribute-price template no-display" value="0" />
</div>
<div class="attribute-values-container left">
    <input type="hidden" class="attribute-price-type" id="__id___price_type" value="0" />
</div>
<?php if ($this->getShowUseDefaultPrice()) : ?>
<div class="attribute-values-container no-display">
    <input id="__id___default" type="checkbox" <?php if ($this->isReadonly() || $this->getCanEditPrice() === false):?> disabled="disabled" <?php endif;?> class="attribute-use-default-value">
</div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<div class="template no-display" id="<?php echo $this->getHtmlId() ?>_simple_pricing">
    <?php if ($this->getCanReadPrice() !== false) : ?>
        <div class="attribute-values-container left v-middle">
            &nbsp;<?php echo Mage::helper('catalog')->__('Price:') ?>
            <input type="text" class="input-text attribute-price validate-number"<?php if ($this->getCanEditPrice() === false) : ?> disabled="disabled" <?php endif; ?>/>
        </div>
        <div class="attribute-values-container left v-middle">
            &nbsp;<select class="attribute-price-type"<?php if ($this->getCanEditPrice() === false) : ?> disabled="disabled" <?php endif; ?>>
                <option value="0"><?php echo Mage::helper('catalog')->__('Fixed') ?></option>
                <option value="1"><?php echo Mage::helper('catalog')->__('Percentage') ?></option>
            </select>
        </div>
    <?php else : ?>
        <input type="hidden" class="attribute-price" />
        <input type="hidden" class="attribute-price-type" />
    <?php endif; ?>
</div>
<div class="template no-display" id="<?php echo $this->getHtmlId() ?>_simple_pricing_view">
    &nbsp;<?php echo Mage::helper('catalog')->__('Price') ?> <strong>'{{value}}'</strong>
</div>
<?php echo $this->getGridHtml() ?>
<script type="text/javascript">
var superProduct = new Product.Configurable(<?php echo $this->getAttributesJson() ?>,<?php echo $this->getLinksJson() ?>,'<?php echo $this->getHtmlId() ?>_',<?php echo $this->getGridJsObject() ?>, <?php echo ( $this->isReadonly() ? 'true' : 'false'); ?>);
superProduct.createEmptyUrl = '<?php echo $this->getNewEmptyProductUrl() ?>';
superProduct.createNormalUrl = '<?php echo $this->getNewProductUrl() ?>';
superProduct.createQuickUrl = '<?php echo $this->getQuickCreationUrl() ?>';

Validation.add(
    'validate-configurable',
    '<?php echo $this->escapeJs(Mage::helper('catalog')->__('Product with this combination of attributes already associated to configurable.')) ?>',
    superProduct.checkCreationUniqueAttributes.bind(superProduct)
)
</script>

<div><input type="hidden" name="affect_configurable_product_attributes" value="1" /></div>
