<?php
// Include config file
require_once "config.php";
// include 'menu.php';
include 'header.php';

// ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);

// Define variables and initialize with empty values
$plans_data=array();
$planssql = "SELECT * FROM plans WHERE status = 1";
$plans_row = mysqli_query($mysqli,$planssql);
while($row = mysqli_fetch_assoc($plans_row)){
	$data=array();
	$data['plane_name']="<h1>".$row['name']."</h1>";
	
	$plan_sub_field_sql="SELECT * FROM plan_sub_field WHERE status = 1";
	$plan_sub_field_row = mysqli_query($mysqli,$plan_sub_field_sql);	
	$count=0;
	while($row1 = mysqli_fetch_assoc($plan_sub_field_row))
	{
		$count++;
    if($row1['is_limite']==1)
    {
      if($row1['plan_'.$row['id']]>0)
      {
        //$data['plane_sub_name_'.$count]=$row1['name'];
        $data['plane_sub_key_'.$count]="<h4>".($row1['plan_'.$row['id']])." ".$row1['limite_text']."</h4>";
      }
      else
      {
        //$data['plane_sub_name_'.$count]=$row1['name'];
        $data['plane_sub_key_'.$count]="<h4>".$row1['unlimited_text']."</h4>";
      }
    }
    else
    {
      if($row1['plan_'.$row['id']]==1)
      {
        //$data['plane_sub_name_'.$count]=$row1['name'];
        $data['plane_sub_key_'.$count]='<i class="fas fa-check"></i>';
      }
      else
      {
        //$data['plane_sub_name_'.$count]=$row1['name'];
        $data['plane_sub_key_'.$count]='';
      }
    }
		
	}	

	array_push($plans_data, $data);
}
/*echo "<pre>";
print_r($plans_data);*/


?>
<section>
  <div class="container">
    <div class="row">
        <div class="col-md-12">
            <div class="create-account text-center">
                <img src="public/images/verified (1).png" alt="">
                <h2>ACCOUNT CREATED!</h2>
            </div>
        </div>
    </div>
</div>
</section>
<section class="st-full-hd">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="st-full-title">
                    <h3>PICK THE PLAN THAT’S RIGHT FOR YOU</h3>
                </div>
            </div>
        </div>
    </div>
</section>
<section class="st-plan">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="plan-box">
                  <div class="plan-cols-big">
                    <div class="plan-cols-top-cap">
                    </div>
                    <div class="plan-cols-hd-blank">
                    </div>
                    <div class="plan-body">
                        <ul>
                          <?php 
                            $plan_sub_field_sql="SELECT * FROM plan_sub_field WHERE status = 1";
                            $plan_sub_field_row = mysqli_query($mysqli,$plan_sub_field_sql);
                            $d_count=0;  
                            while($row1 = mysqli_fetch_assoc($plan_sub_field_row))
                            {
                              $d_count++;
                              if($d_count<=6)
                              {
                                ?>
                                  <li><h4><?php echo $row1['name']; ?></h4></li>
                                <?php
                              }
                              else
                              {
                                ?>
                                <li> <div class="plan-dec"><p><?php echo $row1['name']; ?></p> </div></li>
                                <?php
                              }
                            }
                          ?>
                            <!-- <li><h4>GLOBAL STRESS MAP</h4></li>
                            <li><h4>STATE RANKINGS</h4></li>
                            <li><h4>CITY RANKINGS</h4></li>
                            <li><h4>PERSONAL STRESS CHART</h4></li>
                            <li><h4>PERSONAL STRESS ANALYTICS </h4></li>
                            <li><h4>GROUPS</h4></li>
                            <li> <div class="plan-dec"><p>JOIN UNLIMITED GROUPS</p> </div></li>
                            <li> <div class="plan-dec"><p>CREATE UP TO</p> </div></li>
                            <li> <div class="plan-dec"><p>CREATE GROUPS WITH</p> </div></li>
                            <li> <div class="plan-dec"><p>SHARE & VIEW MEMBER SCORES</p> </div></li>
                            <li> <div class="plan-dec"><p>CONTROL ADMIN PRIVILEGES</p> </div></li>
                            <li> <div class="plan-dec"><p>SETUP STRESS RISK ALERTS</p> </div></li>
                            <li> <div class="plan-dec"><p>VIEW GROUP ANALYTICS</p> </div></li>
                            <li> <div class="plan-dec"><p>VIEW GROUP CHARTS</p> </div></li>
                            <li> <div class="plan-dec"><p>ACCESS MEMBER ANALYTICS</p> </div></li>
                            <li> <div class="plan-dec"><p>ACCESS MEMBER CHARTS</p> </div></li>
                            <li> <div class="plan-dec"><p> </p> </div></li> -->
                        </ul>
                    </div>
                    <div class="plan-btn-blank">
                        
                    </div>
                </div>
                  <?php
                    $c=0;
                    foreach ($plans_data as $key => $value) 
                    {
                      $c++;
                      ?>
                        <div class="plan-cols <?php if($c==1){ echo "plan-free-cols"; }?> ">
                          <div class="plan-cols-top-cap">
                            <?php if($c==1){ echo "<p>AUTO-SELECTED!</p>"; }?>
                             
                          </div>
                          <div class="plan-cols-hd">
                            <?php echo $value['plane_name']; ?>
                          </div>
                          <div class="plan-body">
                              <ul>
                                <?php

                                  foreach ($value as $key1 => $value1) {
                                    if($key1!='plane_name'){

                                      echo "<li>".$value1."</li>";
                                    }
                                   
                                  }
                                ?>
                              </ul>
                          </div>
                          <div class="plan-btn">
                              <a href="#"><?php if($c==1){ echo "CONFIRM"; } else { echo "UPGRADE"; } ?></a>
                          </div>
                      </div>
                      <?php
                    }

                  ?>
                    <!-- <div class="plan-cols plan-free-cols">
                        <div class="plan-cols-top-cap">
                           <p>AUTO-SELECTED!</p>
                        </div>
                        <div class="plan-body">
                            <ul>
                              <li><h1>FREE</h1></li>
                                <li><i class="fas fa-check"></i></li>
                                <li><i class="fas fa-check"></i></li>
                                <li> </li>
                                <li><i class="fas fa-check"></i></li>
                                <li> </li>
                                <li><i class="fas fa-check"></i></li>
                                <li><i class="fas fa-check"></i></li>
                                <li><h4>5 GROUPS</h4></li>
                                <li><h4>10 MEMBERS</h4></li>
                                <li><i class="fas fa-check"></i></li>
                                <li><i class="fas fa-check"></i></li>
                                <li> </li>
                                <li> </li>
                                <li> </li>
                                <li> </li>
                                <li> </li>
                            </ul>
                        </div>
                        <div class="plan-btn">
                            <a href="#">CONFIRM</a>
                        </div>
                    </div>
                    <div class="plan-cols">
                        <div class="plan-cols-top-cap">
                        </div>
                        
                        <div class="plan-body">
                            <ul>
                              <li><h1>FREEER</h1></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><h4>UNLIMITED</h4></li>
                              <li><h4>50 MEMBERS</h4></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li> </li>
                              <li> </li>
                              <li> </li>
                            </ul>
                        </div>
                        <div class="plan-btn">
                            <a href="#">UPGRADE</a>
                        </div>
                    </div>
                    <div class="plan-cols plan-two-same">
                    	<div class="plan-cols-top-cap">
                        </div>
                        <div class="plan-body">
                            <ul>
                              <li><h1>FREEIST</h1></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><h4>UNLIMITED</h4></li>
                              <li><h4>UNLIMITED MEMBER</h4></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                              <li><i class="fas fa-check"></i></li>
                            </ul>
                        </div>
                        <div class="plan-btn">
                            <a href="#">UPGRADE</a>
                        </div>
                    </div> -->
                </div>
            </div>
        </div>
    </div>
</section>
<?php
include 'footer.php';
?>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.2/jquery.validate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.2/additional-methods.min.js" ></script>
