<?php
/**@var \Magetop\Advancepreview\Block\Adminhtml\Product\Edit\Form $block */
//echo get_class($block);
$productId = $block->getRequest()->getParam('id',0);
$urls = $block->getAjaxUrl();
$uploadUrl = $urls['upload_url'];
$itemsUrl = $urls['item_url'];
$editUrl = $urls['edit_url'];
$dellUrl = $urls['dell_url'];
$ownDesignUrl = $urls['own_design_url'];
//$block->getSamplePdfFile();
?>
<?php if($productId > 0) : ?>
    <input type="hidden" id="txt-preview-upload-url" value="<?php echo $uploadUrl; ?>">
    <input type="hidden" id="txt-preview-items-url" value="<?php echo $itemsUrl; ?>">
    <input type="hidden" id="txt-preview-edit-url" value="<?php echo $editUrl; ?>">
    <input type="hidden" id="txt-preview-dell-url" value="<?php echo $dellUrl; ?>">
    <input type="hidden" id="txt-preview-upload-own-design-url" value="<?php echo $ownDesignUrl; ?>">
    <input type="hidden" id="txt-product-id" value="<?php echo $productId; ?>">
    <div id="product-review-message"></div>
<button type="button" id="btn-add-product-preview"><?php echo __('Add new 3D model') ?></button>
<div style="text-align: center; margin-top: 10px; font-size: 1.8em;"><?php echo __('3D lists') ?></div>
<div id="preview-product-lists-content">

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

</div>
    <div class="preview-model-selection-header">
        <?php echo __('Sample Pdf and Ai') ?>
    </div>
<div class="preview-sample-pdf-design">
    <h3><?php echo __('Upload Sample Pdf Design') ?></h3>
    <form action="/" method="post" id="form-upload-own-design-pdf" enctype="multipart/form-data">
        <input type="hidden" name="form_key" value="<?php echo $block->getFormKey(); ?>">
        <input type="hidden" name="product_id" value="<?php echo $productId; ?>">
        <input type="hidden" name="design_type" value="<?php echo 'pdf'; ?>">
        <label for="txt-design-preview-pdf"><?php echo __('Select Pdf File') ?></label>
        <input type="file" name="txt_design_preview_pdf" id="txt-design-preview-pdf" value="">
        <?php if($block->getSamplePdfFile($productId)  != '') : ?>
            <span custom-url="<?php echo $block->getSamplePdfFile($productId)  ?>" class="preview-download-sample-file"><?php echo __('Download File') ?></span>
        <?php endif; ?>
    </form>
</div>

<div class="preview-sample-ai-design">
    <h3><?php echo __('Upload Sample AI Design') ?></h3>
    <form action="/" method="post" id="form-upload-own-design-ai" enctype="multipart/form-data">
        <input type="hidden" name="form_key" value="<?php echo $block->getFormKey(); ?>">
        <input type="hidden" name="product_id" value="<?php echo $productId; ?>">
        <input type="hidden" name="design_type" value="<?php echo 'ai'; ?>">
        <label for="txt-design-preview-ai"><?php echo __('Select Ai File') ?></label>
        <input type="file" name="txt_design_preview_ai" id="txt-design-preview-ai" value="">
        <?php if($block->getSampleAiFile($productId)  != '') : ?>
            <span custom-url="<?php echo $block->getSampleAiFile($productId)  ?>" class="preview-download-sample-file"><?php echo __('Download File') ?></span>
        <?php endif; ?>
    </form>
</div>



<script>
    require([
        'jquery',
        'preview_form'
    ],function ($, previewForm) {
        previewForm.init();
    })
</script>
<?php else: ?>
<p><?php echo __('Please create product before configuring 3d model') ?></p>
<?php endif; ?>
