<?php
$this->load->view('wpstemplate/top_header');
$mediaRes = $media_res;
$messurement = $this->config->item('unit_measurement');
$businessNature = $this->config->item('businessNatureAll');
$employeeCount = $this->config->item('employeeCount');
$firmStatus = $this->config->item('firmStatus');
$turnover = $this->config->item('turnover');

//Address
$city = $location = "";
$state = "";
if (is_array($company) && !empty($company)) {
  $city = get_db_field_value("wps_cities_list", "city", "WHERE id = '" . $company['city'] . "'");
  $state = get_db_field_value("wps_states_list", "name", "WHERE id = '" . $company['state'] . "'");
}

if ($state)
  $location .= $state;
if ($city) {
  if ($state)
    $location .= ', ';
  $location .= $city;
}
?>
<link href="<?php echo theme_url(); ?>designer/css/magiczoomplus.css" rel="stylesheet" type="text/css" />   
<!-- Heading Banner--->
<section class="heading_banner" style="background-image: url(<?php echo theme_url(); ?>designer/images/products/products.jpg)">
  <div class="container">
    <div class="row">
      <div class="col-lg-12 text-center">
        <div class="cat_title"><?php echo $res['product_name']; ?></div>
        <div class="clearfix"></div>
        <!--<div class="cat_title2">We Are Available For You</div>-->
      </div>
    </div>
  </div>
</section>

<!-- Breadcrumb--->
<section class="inner_breadcrumb hidden-xs">
  <div class="container">
    <div class="row">
      <div class="col-lg-12">
        <ul class="breadcrumb">
          <li><a href="<?php echo comp_url(); ?>" title="Home">Home</a></li>
          <li><a href="<?php echo comp_url(); ?>product-listing" title="Our Products">Our Products</a></li>
          <!--<li><a href="product-sub-listing.php" title="Home Textile & Furnishings">Home Textile & Furnishings</a></li>-->
          <li class="active"><?php echo $res['product_name']; ?></li>
        </ul>
      </div>
    </div>
  </div>
</section>


<!-- Home About--->
<section class="product_details_page">
  <div class="container">
    <div class="row">
      <div class="col-lg-10 col-md-9">
        <div class="product_details1">
          <div class="col-lg-5 col-md-5">

            <div class="zoom-gallery">
              <div data-slide-id="zoom" class="zoom-gallery-slide active">
                <a href="<?php echo get_image('product_images', $res['media'], '', '', 'R'); ?>" class="MagicZoom" id="zoom-v"><img src="<?php echo get_image('product_images', $res['media'], '355', '355', 'R'); ?>"/>
                </a>
              </div>
              <?php
              if ($res['youtube_id'] != '') {
                ?>
                <div data-slide-id="video-1" class="zoom-gallery-slide video-slide">
                  <iframe width="180" height="180" src="https://www.youtube.com/embed/<?php echo $res['youtube_id']; ?>" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>                </div>
                <?php
              }
              ?>
              <div class="selectors">
                <?php
                $cnt = 1;
                foreach ($mediaRes as $mkey => $mval) {
                  ?>
                  <a data-slide-id="zoom" <?php echo ($cnt == 1) ? 'class="active"' : ''; ?> href="<?php echo get_image('product_images', $mval['media'], '', '', 'R'); ?>" data-image="<?php echo get_image('product_images', $mval['media'], '355', '355', 'R'); ?>" data-zoom-id="zoom-v"><img src="<?php echo get_image('product_images', $mval['media'], '75', '75', 'R'); ?>" /></a>
                  <?php
                  $cnt++;
                }
                if ($res['youtube_id'] != '') {
                  ?>
                  <a data-slide-id="video-1" href="#">
                    <span class="fa fa-youtube-play"></span>
                    <img src="<?php echo theme_url(); ?>images/video1.jpg"/>
                  </a>
                  <?php
                }
                ?>
              </div>
            </div>



          </div>
          <div class="col-lg-7 col-md-7">
            <div class="details_page_content">
              <h1><?php echo $res['product_name']; ?></h1>
              <div class="price01">
                <strong><?php echo display_price($res['product_price']); ?></strong>/ <?php echo $messurement[$res['unit_measurement']]; ?><strong> <?php echo $res['moq']; ?> <?php echo $messurement[$res['unit_measurement']]; ?></strong> (Min Order)
              </div>

              <p><?php echo char_limiter($res['products_description'], 350) ?></p>
              <p><strong>Payment:</strong> This supplier also supports L/C, T/T, Western Union, MoneyGram, PayPal payments for offline orders.</p>
              <!--<a class="supplier_btn" href="javascript:void()"><i class="fa fa-envelope-o"></i> Contact Supplier</a>-->
              <a class="supplier_btn getQuote" data-productid="<?php echo $res['products_id']; ?>" data-companyid="<?php echo $res['customers_id']; ?>" data-productname="<?php echo $res['product_name'] . ' <br> ' . $company['company_name'] . ' ' . $location; ?>" data-companyname="<?php echo $company['company_name']; ?>" data-productimage="<?php echo get_image('product_images', $res['media'], '400', '600', 'R'); ?>" data-unit="<?php echo $messurement[$res['unit_measurement']]; ?>" href="javascript:void()" data-toggle="modal" data-target="#productID" title="Send Enquiry"><i class="fa fa-envelope-o"></i> Send Enquiry</a>

              <!-- AddToAny BEGIN -->
              <a class="a2a_dd" href="https://www.addtoany.com/share"><i class="fa fa-share-square-o"></i> Share </a>
              <script async src="https://static.addtoany.com/menu/page.js"></script>
              <!-- AddToAny END -->
              <div class="clearfix"></div>
            </div>
          </div>
        </div>

        <div class="product_overview">
          <div class="panel with-nav-tabs panel-default">
            <div class="panel-heading">
              <ul class="nav nav-tabs">
                <li class="active"><a href="#tab1default" data-toggle="tab">Product Details</a></li>
                <li><a href="#tab2default" data-toggle="tab">Company Profile</a></li>
              </ul>
            </div>
            <div class="panel-body">
              <div class="tab-content">
                <div class="tab-pane fade in active" id="tab1default">

                  <h3>Product Specification</h3>
                  <div class="quick_details">
                    <dl class="dl-horizontal">
                      <?php
                      if ($res['attribute_name']) {
                        $atrribute = explode(',', $res['attribute_name']);
                        $atrributeVal = explode(',', $res['attribute_value']);
                        foreach ($atrribute as $ak => $av) {
                          ?>
                          <dt><?php echo $av; ?></dt>: <dd><?php echo $atrributeVal[$ak]; ?></dd>
                          <?php
                        }
                      }
                      ?>
                    </dl>
                  </div>
                  <h3>Product Description</h3>
                  <div class="quick_details"><?php echo $res['products_description']; ?></div>

                </div>
                <div class="tab-pane fade" id="tab2default">

                  <h4>About Company</h4>
                  <p><?php echo $factsheet['about_company']; ?></p>
                  <h4 class="mb10">Company Factsheet</h4>
                  <div class="row">
                    <div class = "col-xs-12 col-sm-6 col-lg-4">
                      <div class = "wps-factsheet">
                        <div class = "icon">
                          <img alt = "Nature of Business" src = "<?php echo theme_url(); ?>images/factsheet/nature-of-business.png">
                        </div>
                        <div class = "info01">
                          <h4>Nature of Business</h4>
                          <p><?php echo $businessNature[$factsheet['business_nature']]; ?></p>
                        </div>
                      </div>
                    </div>
                    <div class = "col-xs-12 col-sm-6 col-lg-4">
                      <div class = "wps-factsheet">
                        <div class = "icon">
                          <img alt = "Year of Establishment" src = "<?php echo theme_url(); ?>images/factsheet/year-of-establishment.png">
                        </div>
                        <div class = "info01">
                          <h4>Year of Establishment</h4>
                          <p><?php echo $factsheet['establishment_year']; ?></p>
                        </div>
                      </div>
                    </div>
                    <div class = "col-xs-12 col-sm-6 col-lg-4">
                      <div class = "wps-factsheet">
                        <div class = "icon">
                          <img alt = "Total Number of Employees" src = "<?php echo theme_url(); ?>images/factsheet/employees.png">
                        </div>
                        <div class = "info01">
                          <h4>Total Number of Employees</h4>
                          <p><?php echo $employeeCount[$factsheet['employee_count']]; ?></p>
                        </div>
                      </div>
                    </div>
                    <div class = "col-xs-12 col-sm-6 col-lg-4">
                      <div class = "wps-factsheet">
                        <div class = "icon">
                          <img alt = "Legal Status of Firm" src = "<?php echo theme_url(); ?>images/factsheet/Legal-Status-of-Firm.png">
                        </div>
                        <div class = "info01">
                          <h4>Legal Status of Firm</h4>
                          <p><?php echo $firmStatus[$factsheet['legal_firm_status']]; ?></p>
                        </div>
                      </div>
                    </div>
                    <div class = "col-xs-12 col-sm-6 col-lg-4">
                      <div class = "wps-factsheet">
                        <div class = "icon">
                          <img alt = "Annual Turnover" src = "<?php echo theme_url(); ?>images/factsheet/annual-turnover.png">
                        </div>
                        <div class = "info01">
                          <h4>Annual Turnover</h4>
                          <p><?php echo $turnover[$factsheet['legal_firm_status']]; ?></p>
                        </div>
                      </div>
                    </div>
                    <div class = "col-xs-12 col-sm-6 col-lg-4">
                      <div class = "wps-factsheet">
                        <div class = "icon">
                          <img alt = "GST Number" src = "<?php echo theme_url(); ?>images/factsheet/gst.png">
                        </div>
                        <div class = "info01">
                          <h4>GST Number</h4>
                          <p><?php echo $factsheet['gst_no']; ?></p>
                        </div>
                      </div>
                    </div>
                  </div>

                </div>
                <div class="col-md-12">
                  <?php
                  $cnt = 1;
                  foreach ($mediaRes as $mkey => $mval) {
                    ?>
                    <div class=" text-center mb10 full_image01">
                      <img class = "img-responsive" src="<?php echo get_image('product_images', $mval['media'], '800', '500', 'R'); ?>" />
                    </div>
                    <?php
                    $cnt++;
                  }
                  ?>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="col-lg-2 col-md-3">
        <div class="product_details_right">
          <div class="media">
            <div class="media-left">
              <a href="javascript:void()">
                <div class="image">
                  <img src="<?php echo get_image('user', $company['profile_picture'], '48', '48', 'R'); ?>" alt="logo">
                </div>
              </a>
            </div>
            <div class="media-body">
              <h5><a href="<?php echo comp_url(); ?>"><?php echo $company['company_name']; ?></a></h5>
              <div class="year">8 Years</div>
            </div>
          </div>
        </div>

        <?php
        if (is_array($related) && !empty($related)) {
          ?>
          <div class="product_details_right">
            <h5>You may like</h5>
            <?php
            foreach ($related as $rval) {
              ?>
              <div class="alsoLike">
                <div class="image">
                  <a href="<?php echo comp_url() . $rval['friendly_url']; ?>" title="<?php echo $rval['product_name']; ?>">
                    <img src="<?php echo get_image('product_images', $rval['media'], '140', '140', 'R'); ?>"></a>
                </div>
                <h5><a href="javascript:void()" title="<?php echo $rval['product_name']; ?>"><?php echo $rval['product_name']; ?></a></h5>
              </div>
              <?php
            }
            ?>
          </div>
          <?php
        }
        ?>
      </div>

      <div class="clearfix"></div>
      <?php
      if (is_array($related) && !empty($related)) {
        ?>
        <div class="col-lg-12">
          <h5>You may like</h5>
          <div class="clearfix"></div>
          <div class="wps_featured">
            <?php
            $wowdelay = 0.1;
            foreach ($related as $relVal) {
              $wowdelay = $wowdelay + 0.1;
              ?>
              <div class="feature_item wow fadeInDown animated" data-wow-delay="<?php echo $wowdelay; ?>s">
                <div class="item">
                  <a href="<?php echo comp_url() . $relVal['friendly_url']; ?>" title="<?php echo $relVal['product_name']; ?>">
                    <div class="feature_image">
                      <div class="image">
                        <img src="<?php echo get_image('product_images', $relVal['media'], '210', '210', 'R'); ?>" alt="<?php echo $relVal['product_name']; ?>">
                      </div>
                    </div>
                  </a>
                  <div class="feature_sec">
                    <h3><a href="<?php echo comp_url() . $relVal['friendly_url']; ?>" title="<?php echo $relVal['product_name']; ?>"><?php echo $relVal['product_name']; ?></a></h3>
                    <p><a href="<?php echo comp_url() . $relVal['friendly_url']; ?>" title="Read More About Lawn Dining Set">Read More</a></p>
                  </div>
                </div>
              </div>
              <?php
            }
            ?>
          </div>
        </div>
        <?php
      }
      ?>
    </div>
  </div>
</section>
<!-- Home Clients -->
<?php echo comp_clients(); ?>
<!-- Footer -->
<?php $this->load->view('wpstemplate/bottom_footer'); ?>
<script src="<?php echo theme_url(); ?>designer/js/magiczoomplus.js" type="text/javascript"></script>
<script>
  jQuery('.zoom-gallery .selectors a').on('click touch', function (e) {
    var iframe = jQuery('.active iframe[src*="youtube"],.active iframe[src*="vimeo"]');
    if (iframe.length) {
      iframe.attr('src', iframe.attr('src'));
    }
    jQuery('.zoom-gallery .zoom-gallery-slide').removeClass('active');
    jQuery('.zoom-gallery .selectors a').removeClass('active');
    jQuery('.zoom-gallery .zoom-gallery-slide[data-slide-id="' + jQuery(this).attr('data-slide-id') + '"]').addClass('active');
    jQuery(this).addClass('active');
    e.preventDefault();
  });
</script>
</body> 
</html>