<?php 
$date = array(
	'mon'=>'周一',
	'tus'=>'周二',
	'wed'=>'周三',
	'thurs'=>'周四',
	'fri'=>'周五',
	'satur'=>'周六',
	'sun'=>'周日'
	);
$stime=array(
	'0:00','0:30','1:00','1:30','2:00','2:30','3:00','3:30','4:00','4:30','5:00','5:30','6:00','6:30','7:00','7:30','8:00','8:30','9:00','9:30','10:00','10:30','11:00','11:30','12:00','12:30','13:00','13:30','14:00','14:30','15:00','15:30','16:00','16:30','17:00','17:30','18:00','18:30','19:00','19:30','20:00','20:30','21:00','21:30','22:00','22:30','23:00','23:30'
	);
?>
<link rel="stylesheet" href="<?php echo mvc::$cfg['HOST']['b2c'];?>static/css/customService.css?ver=<?php echo mvc::$cfg['VER']['css'];?>" type="text/css"/>
<script src="<?php echo mvc::$cfg['HOST']['b2c'];?>static/js/customService.js?ver=<?php echo mvc::$cfg['VER']['js'];?>"></script>
<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">
	<form method="post" id="editModule">
	<input type="hidden" name="module" value="<?php echo $config['module'];?>">
		<div class="fit-custom-service">
			<div class="choosed-custom-service">
				<span>内容设置</span>
			</div>
			<div class="setting-cus-ser-info">
				<div class="fit-cus-ser-workTime">
					<p>工作时间:</p>
					<table>
						<thead>
							<tr style='color:#3266cd;'>
								<th class="date-th">日期:</th>
								<th class="date-th">时间:</th>
								<th>显示:</th>
							</tr>
						</thead>
						<tbody>
						<?php if(!empty($config['config']['dates'])){?>
						 <?php foreach($config['config']['dates'] as $dK=>$dV){?>
							<tr class="data-tr">
								<td>
									<select name="config[dates][<?php echo $dK;?>][bweek]" class="form-control">
									 <?php foreach($date as $dateV){?>
									 	<option value="<?php echo $dateV;?>" <?php if($dateV==$dV['bweek']){ echo 'selected';}?>><?php echo $dateV;?></option>
									 <?php } ?>
									</select>至<select name="config[dates][<?php echo $dK;?>][eweek]" class="form-control">
										<?php foreach($date as $dateV){?>
									 	<option value="<?php echo $dateV;?>" <?php if($dateV==$dV['eweek']){ echo 'selected';}?>><?php echo $dateV;?></option>
									 <?php } ?>
									</select>
								</td>
								<td>
									<select name="config[dates][<?php echo $dK;?>][btime]" class="form-control">
									 <?php foreach($stime as $stimeV){?>
										<option value="<?php echo $stimeV;?>" <?php if($stimeV==$dV['btime']){ echo 'selected';}?>><?php echo $stimeV;?></option>
									 <?php } ?>
									</select>至<select name="config[dates][<?php echo $dK;?>][etime]" class="form-control">
									 <?php foreach($stime as $stimeV){?>
										<option value="<?php echo $stimeV;?>" <?php if($stimeV==$dV['etime']){ echo 'selected';}?>><?php echo $stimeV;?></option>
									 <?php } ?>
									</select>
								</td>
								<td>
									<input type="checkbox" name="config[dates][<?php echo $dK;?>][show]" <?php if($dV['show']){ echo 'checked';}?> value='1'>
								</td>
								<td><button type="button" class="btn btn-danger btn-xs" onclick="$(this).parents('tr').remove();">删除</button></td>
							</tr>
						 <?php }?>
						<?php }else{?>
							<tr class="data-tr">
								<td>
									<select name="config[dates][0][bweek]" class="form-control">
									 <?php foreach($date as $dateV){?>
									 	<option value="<?php echo $dateK;?>"><?php echo $dateV;?></option>
									 <?php } ?>
									</select>至<select name="config[dates][0][eweek]" class="form-control">
									 <?php foreach($date as $dateV){?>
									 	<option value="<?php echo $dateK;?>"><?php echo $dateV;?></option>
									 <?php } ?>
									</select>
								</td>
								<td>
									<select name="config[dates][0][btime]" class="form-control">
									 <?php foreach($stime as $stimeV){?>
										<option value="<?php echo $stimeV;?>"><?php echo $stimeV;?></option>
									 <?php } ?>
									</select>至<select name="config[dates][0][etime]" class="form-control">
									 <?php foreach($stime as $stimeV){?>
										<option value="<?php echo $stimeV;?>"><?php echo $stimeV;?></option>
									 <?php } ?>
									</select>
								</td>
								<td>
									<input type="checkbox" name="config[dates][0][show]" value='1'>
								</td>
							</tr>
						<?php }?>
						</tbody>
					</table>
				</div>
				<div style="margin-left: 705px;"><button type='button' class="btn btn-primary" onclick="addNewSerTime()">新增时间</button></div>
				<div class="cus-phone">
					<div class="phone-box">
						<input type="hidden" value="联系手机" name="config[tels][0][name]">
						<span>联系手机:</span><input type="text" class="form-control" value="<?php echo $config['config']['tels'][0]['tel'];?>" name="config[tels][0][tel]" maxlength='11'>&nbsp;&nbsp;&nbsp;<span>显示:</span><input type="checkbox" class="phoneInput" name="config[tels][0][show]" <?php if($config['config']['tels'][0]['show']){ echo 'checked';}?> value='1'>
					</div>
					<div class="phone-box">
						<input type="hidden" value="联系电话" name="config[tels][1][name]">
						<span>联系电话:</span><input type="text" class="form-control" value="<?php echo $config['config']['tels'][1]['tel'];?>" name="config[tels][1][tel]">&nbsp;&nbsp;&nbsp;<span>显示:</span><input type="checkbox" class="phoneInput" name="config[tels][1][show]" <?php if($config['config']['tels'][1]['show']){ echo 'checked';}?> value='1'>
					</div>
					<div class="phone-box">
						<span>模块标题:</span><input type="text" class="form-control" name="config[title]" value="<?php echo $config['config']['title'];?>" maxlength='30'>&nbsp;&nbsp;&nbsp;<span>显示标题:</span><input type="checkbox" class="phoneInput" name="config[titleShow]" value='1' class="cus-ser-checkbox" <?php if($config['config']['titleShow']){echo 'checked';}?>>
					</div>
				</div>
			</div>
			<div class="clear"></div>
			<div class="modal-footer center">
				<button type="button" class="btn btn-primary" onclick="DESIGN.editFinish();">提交</button>
				<button type="button" class="btn btn-default" data-dismiss="modal" aria-label="Close">关闭</button>
			</div>
		</div>
	</form>
</div>