<?php
/**
 * Webkul Software.
 *
 * @category  Webkul
 * @package   Webkul_Agorae
 * @author    Webkul
 * @copyright Copyright (c) Webkul Software Private Limited (https://webkul.com)
 * @license   https://store.webkul.com/license.html
 */

// @codingStandardsIgnoreFile

/**
 * Contact Seller Form at Seller Collection page
 *
 * @var $block \Webkul\Marketplace\Block\Collection
 */

$helper = $this->helper('Webkul\Agorae\Helper\Data');
$partner = $block->getProfileDetail();
$customerName = "";
$customerEmail = "";

if($helper->checkCustomerLoggedIn()) {
    $customer = $helper->getLoggedInCustomer();
    $customerName = $customer->getName();
    $customerEmail = $customer->getEmail();
}
?>
<div class="wkag-contact-cont">
    <form name="seller-contact"
        id="seller-contact-form"
        action="<?php echo  $block->getUrl(
                'agorae/seller/sendmail',
                ['_secure' => $this->getRequest()->isSecure()]
            ) ?>"
        method="post">
        <input type="hidden"
            id="agoraeSellerId"
            name="seller-id" value="<?php echo $partner->getSellerId(); ?>">
        <input type="hidden"
                name="block_name"
                value="<?php echo $block->getNameInLayout(); ?>" />
        <input type="hidden"
            name="shop_url"
            value="<?php echo $partner->getShopUrl();?>">
            <div class="wkagcontactheading">
                <h1><?php echo __('Contact Seller'); ?></h1>
            </div>
            <div class="wkagcontactbody">
                <label class="required">
                    <?php echo __('Your Name'); ?>
                </label>
                <div class="wkaginput">
                    <input type="text"
                            id="yourName"
                            value="<?php echo $customerName; ?>"
                            name="name"
                            class="required-entry">
                </div>
                <label class="required">
                    <?php echo __('Your Email'); ?>
                </label>
                <div class="wkaginput">
                    <input type="text"
                        id="yourEmail"
                        value="<?php echo $customerEmail; ?>"
                        name="email"
                        class="validate-email required-entry">
                </div>
                <label class="required">
                    <?php echo __('Your Subject'); ?>
                </label>
                <div class="wkaginput">
                    <input type="text"
                        id="yourSubject"
                        value=""
                        name="subject"
                        class="required-entry">
                </div>
                <label class="required">
                    <?php echo __('Your Message'); ?>
                </label>
                <div class="wkaginput">
                    <textarea id="yourMessage"
                        name="ask"
                        class="required-entry validate-customer-password"
                        data-password-min-length="150">
                    </textarea>
                </div>
                <div class="wkagbutton buttons-set">
                    <button class="button btn"
                        href="javascript:void(0)"
                        title="<?php echo __('Send Message') ?>" type="submit" id="wkagsend">
                        <span><span><?php echo __('Send Message') ?></span></span>
                    </button>
                </div>
            </div>
        </form>
    </div>
<script>
    require([
        "jquery",
        "mage/mage"
    ], function($){
        var reviewDataForm = $('#seller-contact-form');
        reviewDataForm.mage('validation', {});
    });
</script>
