<?php $_product = $block->getProduct(); ?>
<?php $buttonTitle = __('Add to Cart'); ?>
<?php if ($_product->isSaleable()): ?>
<?php 
	$helper = $this->helper("Magetop\Agency\Helper\Data"); 
	$custumerId = $helper->getCustomerId();
	$allProducts = $helper->getAssignProductCollection($_product->getId(),$custumerId);
	$advancePreviewHelper = $this->helper("Magetop\Advancepreview\Helper\Data"); 
	$customerGroup = $advancePreviewHelper->getCustomerGroup();
	$isUpdateDesignOrder = (int)$block->getRequest()->getParam('re_up',0);
	// just preview
	$previewOrderDesignId = (int)$block->getRequest()->getParam('preview_design',0);
?>
	<?php if (count($allProducts) > 0 && $custumerId > 0): ?>
		<?php echo $this->getChildHtml('assignproduct_list') ?>
		<style>
			.product-info-main > .product-info-price > .price-box {display: none;}
		</style>
	<?php elseif($isUpdateDesignOrder > 0) : ?>	
		<div class="box-tocart">
			<div class="fieldset">
				<button type="button" 
						title="<?php echo __('Submit') ?>"
						id="btn-preview-re-up-design-print" disabled>
					<span><?php echo __('Submit') ?></span>
				</button>
			</div>
		</div>		
	<?php elseif($previewOrderDesignId > 0): ?>
	
	<?php else: ?>
		<!--advance preview extension -->
		<?php echo $block->getLayout()->createBlock('Magetop\Advancepreview\Block\CustomProduct')->setTemplate('Magetop_Advancepreview::product/custom-options.phtml')->toHtml(); ?>
		<!--end -->
		<div class="box-tocart">
			<div class="fieldset">
				<?php if ($block->shouldRenderQuantity()): ?>
				<div class="field qty">
					<label class="label" for="qty"><span><?= /* @escapeNotVerified */ __('Qty') ?></span></label>
					<div class="control">
						<input type="number"
							   name="qty"
							   id="qty"
							   value="<?= /* @escapeNotVerified */ $block->getProductDefaultQty() * 1 ?>"
							   title="<?= /* @escapeNotVerified */ __('Qty') ?>"
							   class="input-text qty"
							   data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"
							   />
					</div>
				</div>
				<?php endif; ?>
				<div class="actions" style="display: none;">
					<button type="submit"
							title="<?= /* @escapeNotVerified */ $buttonTitle ?>"
							class="action primary tocart"
							id="product-addtocart-button">
						<span><?= /* @escapeNotVerified */ $buttonTitle ?></span>
					</button>
				</div>
				<button style="display: none;" type="button" disabled
							title="<?= /* @escapeNotVerified */ $buttonTitle ?>"
							id="preivew-product-addtocart-button">
						<span><?= /* @escapeNotVerified */ $buttonTitle ?></span>
					</button>
				<?php /* if($customerGroup > 1) : ?>
					<div class="actions actions-preview-request-offer">
						<span
								title="<?php echo __('Request for offer') ?>"
								class=""
								id="product-preview-request-offer">
							<span><?php echo __('Request for offer') ?></span>
						</span>
					</div>
				<?php  endif;*/ ?>
				<button style="display: none;" type="button" 
						title="<?php echo __('Request for offer') ?>"
						id="product-preview-request-offer" disabled>
					<span><?php echo __('Request for offer') ?></span>
				</button>
			</div>
		</div>
	<?php endif; ?>
<?php endif; ?>
<?php if ($block->isRedirectToCartEnabled()) : ?>
<script type="text/x-magento-init">
    {
        "#product_addtocart_form": {
            "Magento_Catalog/product/view/validation": {
                "radioCheckboxClosest": ".nested"
            }
        }
    }
</script>
<?php else : ?>
<script type="text/x-magento-init">
    {
        "#product_addtocart_form": {
            "Magento_Catalog/js/validate-product": {}
        }
    }
</script>
<?php endif; ?>

<?php $seller = \Magento\Framework\App\ObjectManager::getInstance()->create('Magetop\Marketplace\Block\Sellers')->getSellerProfile() ?>
<?php if($seller){ ?>
    <style>
        <?php if($customerGroup != 4) : ?>
            #product-preview-request-offer {
                display: block !important;
            }
        <?php endif ?>
    </style>
<?php }else{ ?>
    <style>
        #preivew-product-addtocart-button {
            display: block !important;
        }
        <?php if($customerGroup != 1) : ?>
            #product-preview-request-offer {
                display: block !important;
            }
        <?php endif ?>
    </style>
<?php } ?>