<?php include_once(mvc::$cfg['PATH_TPL'].'public/topSeller.php');?>
<div class="maintb">
	<?php include_once(mvc::$cfg['PATH_TPL'].'seller/leftMenu.php');?>
	<div class="main_middle product-group">
		<div class="navrow">
			<ul class="navrow_ul">
				<li class="active"><a href="/seller/group">添加配件组合</a></li>
				<button  class="btn btn-danger add-pack-notice">未选中任何商品！</button>
			</ul>
        </div>
		<div class="form-wrapper">
		<form method="post" action="" id="newGroupForm">
		<input type="hidden" name='order' value="<?php echo $order;?>">
		<input type="hidden" name='gId' value="<?php echo $gId;?>">
		<div class="marauto">
				<div class="txt_row">
					<div class="txt_main">
						<label class="txt_title">组合标题</label>
						<input type="text" class="form-control" name="groupName" value="<?php echo $name;?>" maxlength='15' placeholder='最多能输入15字' maxlength='15'>
						<span class="error"></span>
					</div>
				</div>
				<div class="txt_row">
					<div class="txt_main">
						<label class="txt_title">是否开启</label>
							<div style="display: inline-block;position:relative;top: 3px;">
								<span title="点击禁用！" class="apple-checkbox">
					                <input type="checkbox" class="chk_3 checkbox_c2" name='groupStatus' value='1' <?php if(!isset($status) || $status){echo 'checked';}?>>
					                <label for="checkbox_c2" onclick="togGroupStatus(this)"></label>
					            </span>
					            <div class="clear"></div>
							</div>
					</div>
				</div>
				<div class="txt_row">
					<div class="txt_main add-god-tit" >
						<label class="txt_title"><i class="required">*</i>搭配宝贝</label>
					</div>
					<div id="goodsMainTab" class="goods_main group_main">
						<table class="table table-condensed">
					      <thead>
					        <tr>
					          <th width="250">宝贝名称</th>
					          <th width="150">配件短名</th>
					          <th width="80">排序</th>
					          <th>价格</th>
					          <th>库存</th>
					          <th width="50">操作</th>
					        </tr>
					      </thead>
					      <tbody>
					       <?php if(!empty($dataArr)){?>
					        <?php foreach ($dataArr as $key => $value){?>
					        	<tr class="group_pro">
					        		<input type="hidden" class="prpl_pro_id" value="<?php echo $value['prgl_pro_id'];?>" name="group[<?php echo $value['prgl_pro_id'];?>][proId]">
					        		<td>
					        			<a href="/item/index?proId=<?php echo $value['prgl_pro_id'];?>" target="_blank" class='group_img'>
					        				<?php if(!empty($value['spi_name']) && !empty($value['spi_path'])){?>
								            <img class="shop-log" src="<?php echo mvc::$cfg['FILE_CENTER']['b2c']['url_get'].'&c=product&f='.$value['spi_path'].'/100/'.$value['spi_name'].mvc::$cfg['FILE_CENTER']['b2c']['get_uri'];?>"> 
								            <?php }else{?>
								            <img src="/static/images/noimg.png">
								            <?php }?>
								        </a>
								      	<a class="name" href="/item/index?proId=<?php echo $value['prgl_pro_id'];?>" target="_blank">
								            <?php echo $value['pro_name'];?> 
								        </a>
						        	</td>
						        	<td><input class="form-control" name="group[<?php echo $value['prgl_pro_id'];?>][name]" value="<?php echo $value['prgl_pro_name'];?>" style="width:122px;" placeholder='最多能输入15字' maxlength='15'></td>
						        	<td><input class="form-control" name="group[<?php echo $value['prgl_pro_id'];?>][sort]" value="<?php echo $value['prgl_pro_seq'];?>" style="width:50px;" maxlength='4'></td>
						        	<td><?php if($value['pro_promotion_btime']<=time() && $value['pro_promotion_etime']>=time()){ echo $value['pro_promotion_price'];}else{ echo $value['pro_sale_price'];}?></td>
						        	<td><?php echo $value['pro_count'];?></td>
						        	<td><a onclick="removechecked(this)" href="javascript:;">删除</a></td>
						        </tr>
					        <?php }?>
					       <?php }else{?>
					       	<tr>
					       		<td class="center" colspan="6"><span class="orange">点击下面按钮去选择配件吧</span></td>
					       	</tr>
					       <?php } ?>
					      </tbody>
					    </table>
					</div>
				</div>
				<button onclick="clickToGroupGods()" type="button" class="btn btn-success add-dapei-paobei">添加搭配宝贝</button>
				<div class="txt_row">
					<div class="txt_main add-god-tit" >
						<label class="txt_title"></label>
					</div>
					<div class="goods_main goods-ajax-main">
					</div>
				</div>
			</div>
		</form>
		</div>
		<div class="clear"></div>
		<button type="button" onclick="submitNewGroup()" class="btn btn-info save-pack-change">保存</button>
		<button type="button" onclick="window.history.go(-1);" class="btn btn-default return-pack">返回</button>
		<span class="error group_error"></span>
	</div>
</div>
<?php include_once(mvc::$cfg['PATH_TPL'].'public/footAll.php');?>





