<extend name="Public:base" />

<block name="content">
	<style>
	.fl{float:left;}
	.fr{float:right;}
	a.ncsc-btn-mini {
	    background-color: #f5f5f5;
	    border-color: #dcdcdc #dcdcdc #b3b3b3;
	    border-style: solid;
	    border-width: 1px;
	    color: #777;
	    cursor: pointer;
	    display: inline-block;
	    font: 12px/20px arial;
	    height: 20px;
	    margin:5px;
	    margin-right: 2px;
	    padding: 0 10px;
	    text-align: center;
	    vertical-align: middle;
	}

	</style>
	<div class="page-header">
	<a href="{:U('Transport/add')}" class="btn btn-primary">新增</a>

	</div>	
	
<div class="row">
	<div class="col-xs-12">	
		
		<div class="table-responsive">
			
			<?php if (is_array($output['list'])){?>
			<?php $unit=get_weight_name(C('WEIGHT_ID')); ?>	
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>											
						<th>运送方式</th>
						<th>运送到</th> 
						<th>首重(<?php echo $unit; ?>)</th>  
						<th>运费(元)</th>	
						<th>续重(<?php echo $unit; ?>)</th>  
						<th>续费(元)</th>				
					</tr>
				</thead>
				 <?php foreach ($output['list'] as $v){?>
				  <tbody>
				    <tr>
				      <td colspan="20"></td>
				    </tr>
				    <tr>
				      <th colspan="20">
				      	
				        <h5 class="fl"><?php echo $v['title'];?></h5>
				        
				        <span class="fr mr5">
				        <time title="最后编辑时间"><i class="icon-time"></i><?php echo date('Y-m-d H:i:s',$v['update_time']);?></time>
				        <a class="J_Clone ncsc-btn-mini" href="javascript:void(0)" data-id="<?php echo $v['id'];?>"><i class="icon-copy"></i>复制模板</a> <a class="J_Modify ncsc-btn-mini" href="javascript:void(0)" data-id="<?php echo $v['id'];?>"><i class="icon-edit"></i>修改</a> <a class="J_Delete ncsc-btn-mini" href="javascript:void(0)" data-id="<?php echo $v['id'];?>"><i class="icon-trash"></i>删除</a></span></th>
				    </tr>
				    <?php if (is_array($output['extend'][$v['id']]['data'])){?>
				    <?php foreach ($output['extend'][$v['id']]['data'] as $value){?>
				    <tr>
				      <td class="bdl"></td>
				      <td class="cell-area tl"><?php echo $value['area_name'];?></td>
				      <td><?php echo $value['snum'];?></td>
				      <td><?php echo $value['sprice'];?></td>
				      <td><?php echo $value['xnum'];?></td>
				      <td class="bdr"><?php echo $value['xprice'];?></td>
				    </tr>
				    <?php }?>
				    <?php }?>
				  </tbody>
				  <?php }?>
				
			</table>
			<?php } else {?>
			<div>~~暂无数据</div>
			<?php } ?>
			<?php if (is_array($output['list'])){?>
			<div class="page"><?php echo $page; ?></div>
			<?php }?>
		</div>
		
		
	</div>
</div>
</block>
<block name="javascript">
	<script>
$(function(){	
	$('a[class="J_Delete ncsc-btn-mini"]').click(function(){
		var id = $(this).attr('data-id');
		if(typeof(id) == 'undefined') return false;
		
		var f=confirm('确认要执行该操作吗？');
		
		if(f){
			$(this).attr('href','{:U("Transport/del")}'+'/id/'+id);
			return true;	
		}else{
			return false;
		}
	});

	$('a[class="J_Modify ncsc-btn-mini"]').click(function(){
		var id = $(this).attr('data-id');
		if(typeof(id) == 'undefined') return false;
		$(this).attr('href','{:U("Transport/edit")}'+'/id/'+id);
		return true;
	});
	
	$('a[class="J_Clone ncsc-btn-mini"]').click(function(){
		var id = $(this).attr('data-id');
		if(typeof(id) == 'undefined') return false;
		$(this).attr('href','{:U("Transport/clone_data")}'+'/id/'+id);
		return true;
	});


});
</script>
</block>