<?php
/**@var \Magetop\Advancepreview\Block\Adminhtml\Product\Edit\PreviewDiscount $block */
//echo get_class($block);
$productId = $block->getRequest()->getParam('id',0);
$urls = $block->getAjaxUrl();
$uploadUrl = $urls['save_url'];
$itemsUrl = $urls['item_url'];
$editUrl = $urls['edit_url'];
$dellUrl = $urls['dell_url'];
?>
<?php if($productId > 0) : ?>
    <input type="hidden" id="txt-preview-discount-upload-url" value="<?php echo $uploadUrl; ?>">
    <input type="hidden" id="txt-preview-discount-items-url" value="<?php echo $itemsUrl; ?>">
    <input type="hidden" id="txt-preview-discount-edit-url" value="<?php echo $editUrl; ?>">
    <input type="hidden" id="txt-preview-discount-dell-url" value="<?php echo $dellUrl; ?>">
    <input type="hidden" id="txt-product-discount-id" value="<?php echo $productId; ?>">

<button type="button" id="btn-add-product-discount-preview"><?php echo __('Add Discount') ?></button>
    <div id="product-discount-review-message"></div>
<div style="text-align: center; margin-top: 10px; font-size: 1.8em;"><?php echo __('Discount List') ?></div>
<div id="preview-product-discount-lists-content">

</div>
<div id="preview-product-discount-form-content" style="display: none">

</div>

<script>
    require([
        'jquery',
        'preview_discount_form'
    ],function ($, previewDiscoutForm) {
        previewDiscoutForm.init();
    })
</script>
<?php else: ?>
<p><?php echo __('Please create product before configuring Preview Discount') ?></p>
<?php endif; ?>
