<?php
if($request_type=='add')
{
  ?>
  <h1><font color="orange" size="+15">3.</font>添加您的组别</h1>
  <h4 style="font-weight: 100">这非常重要，参赛者将看到他需要报名的组别并付款</h4>
  <br/><br/>
  <div class="next">
    <center>
      <a href="index.php?c=race&action=input_list&race_id=<?php echo $id?>&request_type=<?php echo $request_type?>"> 下一步>> </a>
    </center>
  </div>
  <?php
}
?>
<a href="#" onclick="add()" class="btn"><i class="fa fa-plus"></i> 新增组别</a>
<br/>
<div class="row" id="add_new" style="display: none">
  <div class="col-lg-12">
    <form action="index.php?c=race&action=race_group_add&race_id=<?php echo $id; ?>&request_type=<?php echo $request_type?>" method="post"
      enctype="application/x-www-form-urlencoded" style="padding: 20px;">
      <center><h3>新增组别</h3>
        <table class="table panel" style="width:100%; margin: 30px;">
          <tr>
            <td style="background: #f0f0f0"><h5>基本设置</h5></td>
            <td style="background: #f0f0f0"></td>
          </tr>
          <tr>
           <td>组别名称</td>
           <td><input type="text" name="title" placeholder="组别名称"></td>
         </tr>
         <tr>
           <td>费用</td>
           <td>  <input type="text" name="price" placeholder="费用">元（单位：人民币）<br/>
             *如果费用填写“0”，则为免费活动<br/>
           *如果未开通在线支付，请设为免费活动方便测试</td>
         </tr>
         <tr>
          <td style="background: #f0f0f0"><h5>高级设置</h5></td>
          <td style="background: #f0f0f0"></td>
        </tr>
        <tr>
         <td>距离</td>
         <td> <input type="text" name="distance" placeholder="距离">公里</td>
       </tr>
       <tr>
         <td>人数上限</td>
         <td>  <input type="text" name="mount" placeholder="人数上限">人</td>
       </tr>
       <tr>
        <td>线路细节</td>
        <td>  <input type="text" name="race_line" placeholder="线路细节"></td>
      </tr>
      <tr>
      	<td>是否审核</td>
      	<td> <select name="audi">
          <option value="1">不需审核</option>
          <option value="2">需审核</option>
        </select></td>
      </tr>
      <tr>
        <td>是否上传图片
        </td>
        <td>
         <select name="p_update">
          <option value="1">需要</option>
          <option value="2">不需要</option>
        </select>
      </td>
    </tr>
    <tr>
      <td style="background: #f0f0f0"><h5>团报设置</h5></td>
      <td style="background: #f0f0f0"></td>
    </tr>
    <tr>
      <td>团报
      </td>
      <td>
       <select name="is_team">
        <option value="0">是</option>
        <option value="1" selected="selected">否</option>
      </select>
    </td>
  </tr>
</tr>
<tr>
  <td>团队审核
  </td>
  <td>
   <select name="team_check">
    <option value="0">是</option>
    <option value="1" selected="selected">否</option>
  </select>
</td>
</tr>
       <tr>
         <td>团队人数</td>
         <td>  <input type="text" name="team_mount" value="0" placeholder="团队人数" size="2">人</td>
       </tr>
<tr>
  <td>操作
  </td>
  <td> <input type="submit" value="新增">
  </td>
</tr>
</table>
</center>
</form>
</div>
</div>
<div id="list">
<center><h3>组别列表</h3></center>
<?php
if ($result) {
  foreach ($result as $row) {
    ?>
    <div class="row_s">
      <div class="col-lg-12">
        <table class="table panel" style="padding: 20px;">
          <form action="index.php?c=race&action=race_group_dll&race_id=<?php echo $id; ?>&id=<?php echo $row['id']?>&request_type=<?php echo $request_type ?>" method="post"
            enctype="application/x-www-form-urlencoded"  >
            <tr>
              <td style="background: #f0f0f0"><h5>基本设置</h5></td>
              <td style="background: #f0f0f0"></td>
            </tr>
            <tr>
             <td>组别名称</td> <td><input type="text" value="<?php echo $row['title'] ?>" name="title" ></td>
           </tr>
           <tr>  
             <td>费用</td> 
             <td><input type="text" value="<?php echo $row['price'] ?>" name="price">元（单位：人民币）<br/>
             *如果费用填写“0”，则为免费活动</td>  
           </tr>
           <tr>
            <td style="background: #f0f0f0"><h5>高级设置</h5></td>
            <td style="background: #f0f0f0"></td>
          </tr>
          <tr> 
           <td>人数</td>  
           <td><input type="text" value="<?php echo $row['mount'] ?>" name="mount">人 </td>  
         </tr>
         <tr>
           <td>距离</td> 
           <td><input type="text" value="<?php echo $row['distance'] ?>" name="distance">公里（km） </td>  
         </tr>
         <tr>
          <td>线路细节</td> 
          <td><input type="text" value="<?php echo $row['race_line'] ?>" name="race_line"> </td>  
        </tr>
        <tr>  
         <td>审核</td>
         <td>
          <select name="audi">
           <option value="1" <?php if ($row['audi']==1 ){echo 'selected';};?>>不需审核</option>
           <option value="2" <?php if ($row['audi']==2 ){echo 'selected';};?>>需审核</option>
         </select>
       </td>  
     </tr>  
     <tr> 
       <td>年龄限制</td> 
       <td>从
         <input type ="text"  name = "s_age" value="<?php echo $row['s_age'] ?>" placeholder="最小年龄" size=10>
         到 
         <input type ="text" name = "b_age" value="<?php echo $row['b_age'] ?>" placeholder="最大年龄" size=10>
         <br/>
       *如果不填写，则判断为不设置年龄限制</td>  
     </tr>
     <tr> 
       <td>报名总人数</td> 
       <td><?php echo $row['reg_mount'] ?></td>  
     </tr>
     <tr>
      <td>是否上传图片
      </td>
      <td>
       <select name="p_update">
        <option value="1" <?php if ($row['p_update']==1 ){echo 'selected';};?>>需要</option>
        <option value="2" <?php if ($row['p_update']==2 ){echo 'selected';};?>>不需要</option>
      </select>
    </td>
  </tr>
  <tr>
    <td style="background: #f0f0f0"><h5>团报设置</h5></td>
    <td style="background: #f0f0f0"></td>
  </tr>
  <tr>
    <td>团报
    </td>
    <td>
     <select name="is_team">
      <option value="0" <?php if ($row['is_team']=='0' ){echo 'selected';};?>>是</option>
      <option value="1" <?php if ($row['is_team']=='1' ){echo 'selected';};?>>否</option>
    </select>
  </td>
</tr>
<tr>
  <td>团队审核
  </td>
  <td>
   <select name="team_check">
    <option value="0" <?php if ($row['team_check']=='0' ){echo 'selected';};?>>是</option>
    <option value="1" <?php if ($row['team_check']=='1' ){echo 'selected';};?>>否</option>
  </select>
</td>

</tr>

       <tr>
         <td>团队人数</td>
         <td>  <input type="text" name="team_mount" value="<?php echo $row['team_mount']?>"  size="2">人</td>
       </tr>
<td>操作</td> 
<td><input type="submit" value="编辑"></a>
  <?php if($row['reg_mount']<=0){?>
   <a href="index.php?c=race&action=group_del&id=<?php echo $row['id']?>&race_id=<?php echo $id?>&request_type=<?php echo $request_type?>" ><i class="fa fa-trash-o"></i></a>
 <?php }?>
</td>
</tr>
</form>
</table>
</div>
</div>
<?php
}
} else {
  ?>
  没有组别，请新增
  <?php
}
?>
</div>
<br/><br/><br/>
<style type="text/css">
.panel{max-width: 500px;margin-left: auto;; margin-right: auto;padding: 30px; background: #f9f9f9; border-radius: 10px; border: 1px solid #d8d8d8}
.moren{background: orange}
.next{position: fixed; width: 100%; bottom: 0px; height: 50px; line-height: 50px; background: #f9f9f9; border-top:1px solid #d8d8d8; z-index: 9999 }
.next a{background: #00a0e0; color: white ; padding: 10px; border-radius: 5px;  width: 200px; }
.row_s{width: 32%; float: left}
</style>
<script type="text/javascript">
  function add()
  {
    $('#add_new').css('display','block');
    $('#list').css('display','none');
  }
</script>
