<?php
if($page = $row['seo']){
include(BASE);
$getinfocountry = $dbc->query("SELECT * FROM `countries` 
                               WHERE `countries`.`country_id`='".$row['country_id']."'
                               LIMIT 1");
      $rwco = $getinfocountry->fetch_assoc();

$getlocation = $dbc->query("SELECT * FROM `counties` 
                            WHERE `counties`.`country_id`='".$row['country_id']."'");


echo '<div class="w3-row w3-margin-bottom w3-border-bottom">';
echo '<div class="w3-col l6 m12 s12 w3-card_" style="max-width:100%;height:auto;">';

if(file_exists(THM.$set['theme'].'/maps/countrymap.php')){
   include THM.$set['theme'].'/maps/countrymap.php';
         }else{
           echo '<div class="w3-center w3-padding-64"><h3>'.$lng['alert_nomap'].'</h3></div>';
         }
echo '</div>';
echo '<div class="w3-col l6 m12 s12">';

echo '<div class="w3-container">';

echo '<h2 class="w3-center w3-text-bluepm"><i class="fa fa-address-book-o w3-xxlarge"></i> ';
//echo $lng['cpt_address_book'].'('.$rwco['country_name'].')</h2>';
echo $lng['cpt_address_book'].'</h2>';

while($rowloc = $getlocation->fetch_assoc()){
    echo '<div class="w3-third w3-mobile" style="padding:2px;">';
    echo '<a href="'.PATH.$rowloc['seo'].'.html" style="text-decoration:none;" title="'.$rowloc['county_name'].'">';
    echo '<div class="w3-bluepm w3-hover-seagreen w3-mobile">&nbsp;<i class="fa fa-map-marker"></i> '.$rowloc['county_name'].'</div>';
    echo '</a></div>';
}
$dbc->close();

echo '</div></div></div>';

echo '<div class="w3-row">';
echo '<div class="w3-rest w3-card">';

include(BASE);

$getuser = $dbc->query("SELECT * FROM `users` 
                                WHERE `country_id`='{$row['country_id']}' 
                                  AND `approved`='1'
                                  AND `book`='1'");
 
if($getuser->num_rows > 0){
  
while($rwusr = $getuser->fetch_assoc()){
        
$getusrdtls = $dbc->query("SELECT * FROM `user_details` 
                            WHERE `user_details`.`uid`='{$rwusr['uid']}' 
                            LIMIT 1");
if($getusrdtls->num_rows == 1){$rwudt = $getusrdtls->fetch_assoc(); }

$getcountry = $dbc->query("SELECT * FROM `countries`                               
                                   WHERE `country_id`='{$rwusr['country_id']}' 
                                   LIMIT 1");
if($getcountry->num_rows == 1){$rwctry = $getcountry->fetch_assoc();}

$getcounty = $dbc->query("SELECT * FROM `counties` 
                                  WHERE `cnty_id`='{$rwusr['city_id']}' 
                                  LIMIT 1");
if($getcounty->num_rows == 1){$rwcty = $getcounty->fetch_assoc();}

echo '<div class="w3-col l2 m3 s6 w3-cell" style="padding:2px;">';

//echo '<a onclick="document.getElementById(\'dsf45gff3r'.$rwusr['uid'].'4tygdf65\').style.display=\'block\'" class="w3-button w3-block w3-white w3-hover-bluepm w3-padding-small">';
echo '<a href="'.PATH.$rwudt['seo'].'.html" class="w3-button w3-block w3-white w3-hover-bluepm w3-padding-small">';
echo '<div class="w3-card w3-hover-pale-blue">';

if(!empty($rwudt['pictures'])){
echo '<img src="'.PATH.'images/'.$rwudt['pictures'].'" alt="" style="object-fit:cover;width:100%;max-width:100%;height:150px;max-height:auto;"/>';
 
  }else{
    
echo '<img src="'.PATH.'images/no-user-image.png'.'" alt="" style="object-fit:cover;width:100%;max-width:100%;height:150px;max-height:auto;"/>';
 
     }

echo '<h5 class="w3-center" style="margin-top:0px;">';

echo $rwusr['first_name'].' '.$rwusr['last_name'].'</h5>';     

echo '</div>';

echo '</a>';

echo '</div>';

// Details by Modal
echo '<div id="dsf45gff3r'.$rwusr['uid'].'4tygdf65" class="w3-modal" style="z-index:1007;margin-top:-50px;">';

echo '<div class="w3-modal-content w3-animate-zoom" style="width:640px;max-width:100%;margin:auto;">';

echo '<div class="w3-container_">';

echo '<span onclick="document.getElementById(\'dsf45gff3r'.$rwusr['uid'].'4tygdf65\').style.display=\'none\'" class="w3-button w3-display-topright w3-seagreen w3-hover-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>';

echo '<div class="w3-row w3-hide-large_">';

echo '<div class="w3-container w3-bluepm w3-text-white w3-card">';
echo '<h3 style="margin-top:8px;font-size:22px;">Informations</h3>';
echo '</div>';

echo '<div class="w3-bar-block w3-white">';

echo '<div class="w3-col l4" style="padding:4px;">';

if(!empty($rwudt['pictures'])){
echo '<img src="'.PATH.'images/'.$rwudt['pictures'].'" alt="imagine" style="object-fit:cover;width:100%;max-width:100%;height:250px;max-height:auto;"/>';
   
   }else{
    
echo '<img src="'.PATH.'images/no-user-image.png" alt="imagine" style="object-fit:cover;width:100%;max-width:100%;height:250px;max-height:auto;"/>';
     
     }
  
echo '</div>';

echo '<div class="w3-col l8" style="padding:4px;">'; 

echo '<h3 class="w3-container w3-center">'.$rwusr['first_name'].' '.$rwusr['last_name'].'</h3>';

//echo '<h4 class="w3-container w3-center"><a href="'.PATH.$rwudt['seo'].'.html" title="">Visit my Business Page</a></h4>';

echo '<h5 class="w3-container">Mobile: '.$rwusr['mobile'].'</h5>';

echo '<h5 class="w3-container">E-mail: '.str_replace('@', '[Here Is At]', $rwusr['email']).'</h5>';

//echo '<h5 class="w3-container">Web: <a href="'.$rwudt['url'].'" target="_blank">'.str_replace('https://', '', $rwudt['url']).'</a> <i class="fa fa-external-link w3-small" title="Visit the site to an external source"></i></h5>';

if(!empty($rwudt['url'])){
echo '<div class="w3-center"><a class="w3-button w3-bluepm w3-hover-seagreen" href="'.$rwudt['url'].'" target="_blank">View Details <i class="fa fa-external-link w3-small" title="Visit the site to an external source"></i></a></div>';
echo '<div class="w3-center"><a class="w3-button w3-bluepm w3-hover-seagreen" href="'.PATH.$rwudt['seo'].'.html" >My Page</a></div>';
}else{
echo '<div class="w3-center"><a class="w3-button w3-bluepm w3-hover-seagreen" href="'.PATH.$rwudt['seo'].'.html" >View My Business Page</a></div>';
}
     
echo '<div class="w3-row w3-margin-top">';

echo '<div class="w3-container w3-left"><i class="fa fa-map-marker"></i> '.$rwcty['county_name'].'</div>';

echo '<div class="w3-container w3-right"><i class="fa fa-globe"></i> '.$rwctry['country_name'];

echo '</div>';

echo '</div></div></div></div></div></div></div>';

//End Modal
        
    }
 }else{
    echo '<div class="w3-col l12 m3 s12" style="padding:10px;">';
    echo '<div class="w3-container w3-center">';
    echo '<h4 class="w3-padding-64">'.$lng['country_no_country_members'].'</h4>';
    echo '</div></div>';
  }

echo '</div></div>';

  }
?>