<?php
/**
 * @author      Magetop Developer (Hau)
 * @package     Magento Multi Vendor Marketplace
 * @copyright   Copyright (c) Magetop (https://www.magetop.com)
 * @terms       https://www.magetop.com/terms
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 **/
 
 $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
?>
 <script>
	var BASE_URL = '';
	var FORM_KEY = '<?php echo $objectManager->create("Magento\Framework\Data\Form\FormKey")->getFormKey() ?>';
</script>
<div class="entry-edit form-inline" id="super_config" data-panel="product-variations">
    <div data-bind="scope: 'variation-steps-wizard'" class="product-create-configuration">
        <div class="product-create-configuration-info">
            <div class="note" data-role="product-create-configuration-info">
                <?= /* @escapeNotVerified */  __('Configurable products allow customers to choose options (Ex: shirt color).
            You need to create a simple product for each configuration (Ex: a product for each color).');?>
            </div>
        </div>
        <div class="product-create-configuration-actions" data-action="product-create-configuration-buttons">
            <div class="product-create-configuration-action">
                <button type="button" data-action="open-steps-wizard" title="Create Product Configurations"
                        class="action-secondary" data-bind="click: open">
                <span data-role="button-label" data-edit-label="<?= /* @escapeNotVerified */  __('Edit Configurations') ?>">
                    <?= /* @escapeNotVerified */  $block->isHasVariations()
                        ? __('Edit Configurations')
                        : __('Create Configurations')
                    ?>
                </span>
                </button>
            </div>

        </div>
    </div>
    <div class="fieldset">
        <?php echo $block->getChildHtml('magematrix'); ?>

        <!-- Select Associated Product popup -->
        <div data-grid-id="associated-products-container">
            <div class="magetop__data-grid-outer-wrap" data-bind="scope: 'magetopmarket_configurable_associated_product_listing.magetopmarket_configurable_associated_product_listing'">
                <div data-role="spinner" data-component="magetopmarket_configurable_associated_product_listing.magetopmarket_configurable_associated_product_listing.product_columns" class="magetop__data-grid-loading-mask">
                    <div class="spinner">
                        <span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span>
                    </div>
                </div>
                <!-- ko template: getTemplate() --><!-- /ko -->

            </div>
        </div>

        <input type="hidden" name="affect_configurable_product_attributes" value="1" />
    </div>
</div>
<script type="text/x-magento-init">
    {
        "*": {
            "Magento_Ui/js/core/app": {
                "components": {
                    "configurableProductGrid": {
                        "component": "Magetop_Marketplace/js/variations/product-grid",
                        "productsFilter": "magetopmarket_configurable_associated_product_listing.magetopmarket_configurable_associated_product_listing.listing_top.listing_filters",
                        "productsProvider": "magetopmarket_configurable_associated_product_listing.data_source",
                        "productsMassAction": "magetopmarket_configurable_associated_product_listing.magetopmarket_configurable_associated_product_listing.product_columns.ids",
                        "productsColumns": "magetopmarket_configurable_associated_product_listing.magetopmarket_configurable_associated_product_listing.product_columns",
                        "productsGridUrl": "<?= /* @noEscape */ $block->getUrl('marketplace/product_configurable/associatedGrid', ['componentJson' => true])?>",
                        "configurableVariations": "configurableVariations"
                    }
                }
            },
            "Magetop_Marketplace/js/configurable-type-handler": {
                "blockId": "#super_config",
                "tabId": "super_config",
                "hasVariations": <?= /* @noEscape */ $block->isHasVariations() ? 'true' : 'false' ?>
            }
        }
    }
</script>
