<div class="container-fluid" style="max-width:980px;">
<div class="row">
  <div class="col-xs-18 col-xs-offset-3">
    <form method="post" id="form-info-search" style="margin-top:50px;" action="<?php echo site_url('index/search'); ?>">
    <div class="input-group">
      <input type="text" class="form-control search-input" name="q" placeholder="联系人、文档、信息分享、订单、网站">
      <span class="input-group-btn">
        <button class="btn btn-info search-btn" type="submit">搜索</button>
      </span>
    </div>
    </form>
  </div>

  <div class="col-xs-24 nav-list-box">
    <?php foreach ($card_list as $ckey => $card) { ?>
    <div class="col-xs-24 nav-card">
      <h4>
        <a href="javascript:void(0);" onclick="$('#nt_name').val('<?php echo $card->nt_name; ?>');$('#update_nt_sn').val('<?php echo $card->nt_sn; ?>');" data-toggle="modal" data-target=".bs-example-modal-sm">
          <span><?php echo $card->nt_name; ?></span>
          <span class="glyphicon glyphicon-pencil" style="font-size:12px;margin-left:-15px;"></span>
        </a>        
        <a class="nav-add" href="javascript:void(0);" onclick="init_add_nav();" data-ntsn="<?php echo $card->nt_sn; ?>" data-toggle="modal" data-target=".bs-nav-modal-sm">添加</a>
        <a class="nav-edit" href="javascript:void(0);" onclick="$('#card<?php echo $card->nt_sn;?>>.nav-item>.manage-nav-link').css({'display':'block'});$(this).addClass('hidden');$(this).next('.nav-edit-back').removeClass('hidden');">编辑</a>
        <a class="nav-edit-back hidden" href="javascript:void(0);" onclick="$('#card<?php echo $card->nt_sn;?>>.nav-item>.manage-nav-link').css({'display':'none'});$(this).addClass('hidden');$(this).prev('.nav-edit').removeClass('hidden');">返回</a>
      </h4>
      <div class="" id="card<?php echo $card->nt_sn;?>">
          <?php 
          if(isset($nav_list[$card->nt_sn])){
          foreach ($nav_list[$card->nt_sn] as $nav) { ?>
          <div class="col-sm-4 col-xs-8 nav-item nav-item-<?php echo $nav->n_sn; ?>">
            <a class="manage-nav-link" href="javascript:delete_nav('<?php echo $nav->n_sn; ?>');"><span class="glyphicon glyphicon-remove text-muted"></span></a>
            <a class="manage-nav-link" href="javascript:void(0);" onclick="edit_nav('<?php echo $nav->n_name; ?>','<?php echo addslashes($nav->n_link); ?>','<?php echo $nav->n_sn; ?>','<?php echo $nav->n_description; ?>');"><span class="glyphicon glyphicon-pencil text-muted"></span></a>
            <a target="_blank" title="<?php echo $nav->n_description; ?>" href="<?php echo $nav->n_link; ?>" data-nsn="<?php echo $nav->n_sn; ?>" class="col-xs-24 text-left nopadding nav-item-link"><?php echo $nav->n_name; ?></a>
          </div>
          <?php }} ?>
      </div>
    </div>
    <?php } ?>
  </div>


</div>
</div>

<div class="modal bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">卡片管理</h4>
      </div>
      <div class="modal-body col-xs-24">
        <form class="form-add-card" method="post" action="<?php echo site_url('index/add_card'); ?>">
          <div class="input-group">
            <input type="text" class="form-control" id="nt_name" name="nt_name" placeholder="卡片名称">
            <input type="hidden" name="nt_sn" id="update_nt_sn" value="">
            <span class="input-group-btn">
              <button class="btn btn-default" type="button" onclick="$('.form-add-card').attr('action','<?php echo site_url('index/edit_type'); ?>');ajaxSubmit('.form-add-card');">更新</button>
              <button class="btn btn-default" type="button" onclick="ajaxSubmit('.form-add-card');">添加</button>
            </span>
          </div>
        </form>
        <div class="col-xs-24 btn-lg"></div>
        <div class="row">
          <?php foreach ($card_list as $j=>$cn) { ?>
            <?php if ($cn->nt_uid!=$mid) { ?>
            <div class="col-xs-4 text-center">
              <span class="img-circle bg-info" style="display:block;height:70px;line-height:70px;"><?php echo $cn->nt_name; ?></a>
            </div>
            <?php }else{ ?>
            <div class="col-xs-4 text-center">
              <a class="img-circle bg-info delete_type_link" data-title="<?php echo $cn->nt_name; ?>" style="display:block;height:70px;line-height:70px;background:#afd9ee;" href="javascript:void(0);" data-href="<?php echo site_url('index/delete_type/'.$cn->nt_sn); ?>"><?php echo $cn->nt_name; ?></a>
            </div>
            <?php } ?>
          <?php } ?>
        </div>
      </div>
      <div class="clearfix"></div>
    </div>
  </div>
</div>

<div class="modal bs-nav-modal-sm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">导航管理</h4>
      </div>
      <div class="modal-body col-xs-24">
        <form class="form-add-nav" method="post" action="<?php echo site_url('index/add_nav'); ?>">
          <div class="col-xs-24 btn-lg"></div>
          <div class="col-xs-10 nopadding"><input type="text" class="form-control" name="n_name" id="n_name" placeholder="导航名称"></div>
          <div class="col-xs-14 nopadding-R"><input type="text" class="form-control" name="n_link" id="n_link" placeholder="链接地址"></div>
          <div class="col-xs-24 btn-sm"></div>
          <div class="col-xs-24 nopadding">
            <textarea class="form-control" rows="10" name="n_description" id="n_description" placeholder="描述(选填)"></textarea>
          </div>
          <div class="col-xs-24 nopadding">
            <input type="hidden" name="n_nt_sn" id="n_nt_sn" value="">
            <input type="hidden" name="n_sn" id="n_sn">
            <button class="btn btn-default btn-add-nav pull-right" type="button" onclick="ajaxSubmit('.form-add-nav');">确定</button>
          </div>
        </form>
      </div>
      <div class="clearfix"></div>
    </div>
  </div>
</div>
<script type="text/javascript">
$("a.nav-add").click(function(){
  var n_nt_sn=$(this).attr('data-ntsn');
  $("#n_nt_sn").val(n_nt_sn);
});
</script>