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

$getcountry = $dbc->query("SELECT * FROM `countries` 
                            WHERE `countries`.`country_id`='".$row['country_id']."'
                            LIMIT 1");
      $rwcon = $getcountry->fetch_assoc();
      
$getdetcountry = $dbc->query("SELECT * FROM `country_page` 
                            WHERE `country_page`.`country_id`='".$row['country_id']."'
                            LIMIT 1");
      $rwDcon = $getdetcountry->fetch_assoc();
      

echo '<div class="w3-row w3-margin-bottom">';
echo '<div class="w3-row w3-border-bottom">';
echo '<h2 class="w3-container w3-text-bluepm w3-hide-small w3-hide-medium"><i class="fa fa-address-book-o w3-xxlarge"></i> ';
echo $lng['cpt_address_book'].' - ';
echo '<i class="fa fa-map-marker"></i> '.$rwcnt['county_name'].',<a href="'.PATH.$rwDcon['seo'].'.html" style="text-decoration:none;"> '.$rwcon['country_name'].'</a></h2>';

echo '<h2 class="w3-container w3-text-bluepm w3-hide-large w3-large"><i class="fa fa-address-book-o w3-large"></i> ';
echo $lng['cpt_address_book'].' - ';
echo '<i class="fa fa-map-marker"></i> '.$rwcnt['county_name'].',<a href="'.PATH.$rwDcon['seo'].'.html" style="text-decoration:none;"> '.$rwcon['country_name'].'</a></h2>';

echo '</div>';


echo '<div class="w3-col l6 m12 s12 w3-card_" style="max-width:100%;height:auto;">';
 
if(file_exists(THM.$set['theme'].'/maps/countymap.php')){
   include THM.$set['theme'].'/maps/countymap.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 w3-border-bottom">';

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

echo '</div>'; ?>


<?php if(!isset($_SESSION['uid'])){

include(BASE);
$getlocation = $dbc->query("SELECT * FROM `counties` 
                            WHERE `counties`.`country_id`='23'");

while($rowloc = $getlocation->fetch_assoc()){
    
    echo '<div class="w3-third w3-hide-small" 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();
?>

<?php // Notices
if(isset($completed)){
    echo '<div class="w3-panel w3-seagreen w3-margin-top"><p>'.$completed.'</p></div>';
    }
if(isset($fn_err)){
    echo '<div class="w3-panel w3-red w3-margin-top"><p>'.$fn_err.'</p></div>';
    }
if(isset($ln_err)){
    echo '<div class="w3-panel w3-red w3-margin-top"><p>'.$ln_err.'</p></div>';
    }
if(isset($e_err)){
    echo '<div class="w3-panel w3-red w3-margin-top"><p>'.$e_err.'</p></div>';
    }
if(isset($err_exist)){
    echo '<div class="w3-panel w3-red w3-margin-top"><p>'.$err_exist.'</p></div>';
    }
?>

<?php } ?>


<?php echo '</div>';
echo '</div>';

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

if(!isset($_SESSION['uid'])){

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

echo '<a onclick="document.getElementById(\'dsf45gff3r4tygdf65\').style.display=\'block\'" class="w3-button w3-block w3-white w3-hover-bluepm w3-padding-small">';

echo '<div class="w3-card w3-hover-bluepm" style="height:145px;">';
echo '<i class="fa fa-user-plus w3-xxxlarge" style="height:118;margin-top:35px;"></i>';
echo '<h5 class="w3-center" style="margin-top:0px;">'.$lng['county_btn_create_account'].'</h5>';
echo '</div>';

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


// Details by Modal
echo '<div id="dsf45gff3r4tygdf65" class="w3-modal" style="z-index:1007;margin-top:0px;">';
echo '<div class="w3-modal-content w3-animate-top" style="width:740px;max-width:100%;margin:auto;">';

echo '<div class="w3-container_">';
echo '<span onclick="document.getElementById(\'dsf45gff3r4tygdf65\').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-seagreen w3-text-white w3-card">';
echo '<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-user-plus"></i> '.$lng['county_btn_create_account'].'</h3>';
echo '</div>';

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

<h3 class="w3-center">
<i class="fa fa-address-card-o"></i> 
'.$lng['county_register_in_txt'].' '.$rwcnt['county_name'].'
</h3>

<form action="" method="POST">
<div class="w3-row-padding">

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="text" name="first_name" placeholder="'.$lng['form_first_name'].'" required=""/>
</div>

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="text" name="last_name" placeholder="'.$lng['form_last_name'].'" required=""/>
</div>

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="email" name="email" placeholder="'.$lng['form_email'].'" required=""/>
</div>

<div class="w3-col l6 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="tel" name="mobile" placeholder="'.$lng['form_mobile'].'"/>
</div>


<div class="w3-col l12 m12 s12">
<input class="w3-input w3-border w3-margin-bottom" type="url" name="url" placeholder="'.$lng['form_url'].'"/>
</div>


<div class="w3-col l12 m12 s12">
<textarea class="w3-input w3-border w3-margin-bottom" rows="3" name="comment" placeholder="'.$lng['form_comm_to_admin'].'">
</textarea>
</div>';


echo '<div class="w3-col l12 m12 s12">';    
echo '<input class="w3-check w3-margin-bottom" type="checkbox" name="terms" value="0" id="checkTenable"/>';    
echo '<label> ';
echo $lng['form_agree_with'].' <a href="';
if($set['terms'] == '1'){
echo $set['trm_url'].'" target="'.$set['tc_o'].'">';
  }else{
    echo '#terms">';
  }
echo $lng['form_terms'].'</a></label>';
echo '</div>';

 
echo '<div class="w3-col l12 m12 s12">
<input class="w3-check w3-margin-bottom" type="checkbox" name="privacy" value="0" id="checkPenable" disabled="disabled"/>
<label> '.$lng['form_agree_with'].' <a href="';
if($set['privacy'] == '1'){
echo $set['prv_url'].'" target="'.$set['pp_o'].'">';
  }else{
    echo '#privacy">';
  }
echo $lng['form_privacy'].'</a></label>
</div>

<div class="w3-col l12 m12 s12">
<input class="w3-check w3-margin-bottom" type="checkbox" name="news"/>
<label>'.$lng['form_agree_with_news'].'</label>
</div>

<div class="w3-col l12 m12 s12 w3-center">
<button class="w3-button w3-bluepm w3-border w3-border-cadetblue w3-hover-seagreen w3-margin-bottom" id="ischeckenable" disabled="disabled" id="ischeckenable" disabled="disabled">'.$lng['county_btn_create_account'].'</button>
</div>

<input type="hidden" name="county_location" value="'.$rwcnt['county_name'].'"/>
<input type="hidden" name="submitforapproval" value="true"/>

</div>
</form>

</div>';

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

//End Modal
 }

include(BASE);

$getuser = $dbc->query("SELECT * FROM `users` 
                                WHERE `city_id`='{$row['cnty_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:120px;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['county_no_county_members'].'</h4>';
    echo '</div></div>';
   }
   
echo '</div>';
echo '</div>';
 }

?>