<?php defined('IN_YUNYECMS') or exit('No permission.'); ?><!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>YUNYECMS <?php echo YUNYECMS_VERSION;?></title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="<?php echo YUNYECMS_UI;?>bootstrap/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="<?php echo YUNYECMS_UI;?>plugins/font-awesome-4.7.0/css/font-awesome.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="<?php echo YUNYECMS_UI;?>plugins/iCheck/all.css">
  <link rel="stylesheet" href="<?php echo YUNYECMS_UI;?>dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="<?php echo YUNYECMS_UI;?>dist/css/skins/_all-skins.min.css">
  <link rel="stylesheet" href="<?php echo YUNYECMS_UI;?>dist/css/admin.css">
<link rel="stylesheet" href="<?php echo YUNYECMS_UI;?>validator/dist/css/bootstrapValidator.css"/>
<script type="text/javascript" charset="utf-8" src="<?php echo YUNYECMS_PUBLIC;?>ueditor/ueditor.config.js"></script>
 <script type="text/javascript" charset="utf-8" src="<?php echo YUNYECMS_PUBLIC;?>ueditor/ueditor.all.js"> </script> 
<script src="<?php echo YUNYECMS_UI;?>plugins/jQuery/jquery-2.2.3.min.js"></script>
  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>
<body class="hold-transition rightbgcolor"  onload="changefrmHeight()">
  <!-- Content Wrapper. Contains page content -->
  <div class="container-fluid" id="mainwrap">
    <!-- Main content -->
    <section class="content">
      <div class="row">
        <!-- left column -->
        <div class="col-md-12">
        <div class="box  box-solid">
            <div class="box-header">
             <div class="col-xs-12 col-sm-12 col-md-8 pb10">
              <h3 class="box-title">客服设置</h3> &nbsp; 
                <?php include tpl('menu','admin',1); ?>
             </div>
             <div class="col-xs-12 col-sm-12 col-md-4">
              <div class="box-tools">
               <form class="form-search" method="post" action="<?php echo url('index');?>">
                 <?php echo $this->hashurl['svp'];?>
                 <div class="col-xs-12 col-md-12">
                  <div class="input-group input-group-sm" >
                   <input type="text" name="searchkey" class="form-control pull-right" value="<?php if(!empty($searchkey)) { ?><?php echo $searchkey;?><?php } ?>" placeholder="请输入关键词">
                  <div class="input-group-btn">
                   <button type="submit" class="btn btn-info"><i class="fa fa-search"></i></button>
                  </div>
                  </div>
                </div>
               </form>
             </div>
       </div>
   </div>
       <form id="form1" class="form-horizontal" method="post" action="<?php echo YUNYECMS_URLADDONS;?>"   >
              <div class="box-body">
        <div class="form-group">
            <label class="col-md-2 control-label" for="title">客服类型</label>
            <div class="col-md-6">
       <table class="table table-bordered table-striped " id="add_online_type">
        <thead>
        <tr>
            <th width="60" align="right">名称</th>
            <th width="60" align="right">类型</th>
            <th width="70" >排序</th>
            <th width="70" ></th>
        </tr>
        </thead>
        <tbody>
           <?php if(empty($rs['online_type'])&&!is_array($rs['online_type'])) { ?>
            <?php if(is_array($online_type)): $i = -1; $__DATA__ = $online_type;if(count($__DATA__)==0 )  echo "" ;foreach($__DATA__ as $kt=>$vt): $mod = ($i % 2 );++$i;?>
             <tr>
                 <td> 
				  <input type="text"  class="form-control "  id="online_type[<?php echo $vt["id"] ;?>][name]" name="online_type[<?php echo $vt["id"] ;?>][name]"   value="<?php echo $vt["name"] ;?>"  />
				 </td>
                <td>
                 <input type="text"  class="form-control " id="online_type[<?php echo $vt["id"] ;?>][index]" name="online_type[<?php echo $vt["id"] ;?>][index]"  value="<?php echo $vt["index"] ;?>"   />
                </td> 
                <td>
                 <input type="text"  class="form-control " id="online_type[<?php echo $vt["id"] ;?>][ordernum]" name="online_type[<?php echo $vt["id"] ;?>][ordernum]" value="<?php echo $vt["id"] ;?>"    />
                </td>
				 <td>  </td>
             </tr>
             <input type="hidden"  id="online_type[<?php echo $vt["id"] ;?>][id]" name="online_type[<?php echo $vt["id"] ;?>][id]"  value="<?php echo $vt["id"] ;?>"  />
			<?php  endforeach;  endif; ?>
             <?php } else { ?>
              <?php if(is_array($rs['online_type'])): $i = -1; $__DATA__ = $rs['online_type'];if(count($__DATA__)==0 )  echo "" ;foreach($__DATA__ as $kt=>$vt): $mod = ($i % 2 );++$i;?>
             <tr id="tr<?php echo $vt["id"] ;?>">
                 <td> 
				  <input type="text"  class="form-control "  id="online_type[<?php echo $vt["id"] ;?>][name]" name="online_type[<?php echo $vt["id"] ;?>][name]"   value="<?php echo $vt["name"] ;?>"  />
				 </td>
                <td>
                 <input type="text"  class="form-control " id="online_type[<?php echo $vt["id"] ;?>][index]" name="online_type[<?php echo $vt["id"] ;?>][index]" value="<?php echo $vt["index"] ;?>"   />
                </td>
                <td>
                 <input type="text" class="form-control " id="online_type[<?php echo $vt["id"] ;?>][ordernum]" name="online_type[<?php echo $vt["id"] ;?>][ordernum]" value="<?php echo $vt["ordernum"] ;?>"   /><input type="hidden"  id="online_type[<?php echo $vt["id"] ;?>][id]" name="online_type[<?php echo $vt["id"] ;?>][id]"  value="<?php echo $vt["id"] ;?>"  />
                </td>
				<td><a  href="javascript:;" onclick="deltr('tr<?php echo $vt["id"] ;?>');">删除</a> </td>
             </tr>
			<?php  endforeach;  endif; ?>
          <?php } ?>
        </tbody>
    </table> <div class="col-sm-2"> <a href="javascript:void(0);"  class="btn btn-sm btn-info btn-flat" id="addButton"><i class="fa fa-plus"></i>增加类型</a></div>
 <script type="text/javascript" charset="utf-8">
 $(function() {
 var fieldCount = <?php echo $count_type;?>;
 $("#addButton").click(function() {
  fieldCount++;
  if(fieldCount <= 16)
  {
	var trid='tr'+ fieldCount; 
	var htmlstr='<tr id="'+trid+'">';
	              htmlstr=htmlstr+' <td> <input type="text"  class="form-control"  placeholder="客服名称"    id="online_type['+fieldCount+'][name]" name="online_type['+fieldCount+'][name]"   value=""  /></td>';
	  	          htmlstr=htmlstr+' <td><input type="text"  placeholder="客服类型"    class="form-control " id="online_type['+fieldCount+'][index]" name="online_type['+fieldCount+'][index]"  value=""  /></td>';
	              htmlstr=htmlstr+' <td><input type="text"  class="form-control " id="online_type['+fieldCount+'][ordernum]" name="online_type['+fieldCount+'][ordernum]"  value="'+fieldCount+'"  /><input type="hidden" placeholder="排序" id="online_type['+fieldCount+'][id]" name="online_type['+fieldCount+'][id]"    value="'+fieldCount+'" /></td>';
	  	          htmlstr=htmlstr+'  <td><a href="javascript:;" onclick="deltr(\''+trid+'\');">删除</a></td>';
                  htmlstr=htmlstr+' </tr> ';
	$("#add_online_type").append(htmlstr);
   }
  else
  {
  alert("Maximum onlinetype fields reached.");
  }
 });
 });
	 
 function deltr(obj){
	 var trobj=$('#'+obj);
	 trobj.remove();
 }	 
</script>
          </div>
        </div>
          <div class="form-group">
            <label class="col-md-2 control-label" for="title">在线客服主题</label>
            <div class="col-md-9">
				 <div class="row">
                <?php if(is_array($online_theme)): $i = -1; $__DATA__ = $online_theme;if(count($__DATA__)==0 )  echo "" ;foreach($__DATA__ as $km=>$vm): $mod = ($i % 2 );++$i;?>
							 <div class="col-md-3 text-center">
							    <img src="<?php echo ADDONS;?>online/<?php echo $vm["pic"] ;?>" width="100%"><br/><br/>
								<input type="radio" name="theme" value="<?php echo $vm["index"] ;?>" class="minimal-blue"   <?php  if(empty($rs['theme'])){ if($vm["index"]=='blue') echo "checked";}else{  if($rs['theme']==$vm["index"]) echo "checked";} ?> >  <?php echo $vm["name"] ;?> &nbsp;
							 </div>
				<?php  endforeach;  endif; ?>
				 </div>
            </div>
        </div> 
         <div class="form-group">
				<label class="col-md-2 control-label" for="title">是否开启</label>
				<div class="col-md-6">
		         <input type="radio" name="isopen" value="1" class="minimal-blue" <?php if(empty($id)) { ?> checked <?php } else { ?> <?php if($rs['isopen']==1) { ?> checked <?php } ?> <?php } ?>    >   是 &nbsp; 
			     <input type="radio" name="isopen" value="0" class="minimal-blue" <?php if($rs['isopen']==0) { ?> checked <?php } ?>  >   否
				</div>
		 </div> 
              </div>
              <!-- /.box-body -->
              <div class="box-footer">
              <div class="form-group">
                 <div class="col-md-offset-2 col-md-9">
					 <input name="yyact" type="hidden" value="<?php echo $yyact;?>">
                     <input name="c" type="hidden" value="<?php echo ROUTE_C;?>">
                     <input name="a" type="hidden" value="<?php echo ROUTE_A;?>">
                     <?php echo $this->hashurl['svp'];?>
                     <?php if(!empty($id)) { ?>
                     <input name="id" type="hidden" value="<?php echo $id;?>">
                     <?php } ?>
                     <button type="submit" class="btn bg-blue  btn-flat"><?php if($yyact=="add") { ?> <i class="icon fa fa-plus"></i> 添 加 <?php } elseif ($yyact=="edit") { ?> <i class="icon fa fa-edit"></i> 修 改 <?php } ?></button> &nbsp; &nbsp;
                         &nbsp; &nbsp;
                     <button type="reset" class="btn btn-default btn-flat"> <i class="fa fa-undo"></i> 重 置 </button>                                         
            </div>	
              </div>
              </div>
              <!-- /.box-footer -->
            </form>
         
         
          </div>
	                 
            
        </div>
        <!--/.col (left) -->
      </div>
      <!-- /.row -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
<?php include tpl_adm('foot'); ?>
<!-- jQuery 2.2.3 -->
<script src="<?php echo YUNYECMS_UI;?>plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="<?php echo YUNYECMS_UI;?>bootstrap/js/bootstrap.min.js"></script>
<!-- FastClick -->
<!-- AdminLTE for demo purposes -->
<script src="<?php echo YUNYECMS_UI;?>dist/js/admin.js"></script>
<script src="<?php echo YUNYECMS_UI;?>plugins/iCheck/icheck.min.js"></script>

<script type="text/javascript" src="<?php echo YUNYECMS_UI;?>validator/dist/js/bootstrapValidator.js"></script>
<script>
  $(function () {
    //iCheck for checkbox and radio inputs
    $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
      checkboxClass: 'icheckbox_minimal-blue',
      radioClass: 'iradio_minimal-blue'
    });
    //Red color scheme for iCheck
    $('input[type="checkbox"].minimal-red, input[type="radio"].minimal-red').iCheck({
      checkboxClass: 'icheckbox_minimal-red',
      radioClass: 'iradio_minimal-red'
    });
    //Flat red color scheme for iCheck
    $('input[type="checkbox"].flat-blue, input[type="radio"].flat-blue').iCheck({
      checkboxClass: 'icheckbox_flat-blue',
      radioClass: 'iradio_flat-blue'
    });
  });
</script>
<script type="text/javascript">
$(document).ready(function() {
    $('#defaultForm').bootstrapValidator({
        message: 'This value is not valid',
//        live: 'disabled',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            title: {
                message: '栏目名称是无效的',
                validators: {
                    notEmpty: {
                        message: '栏目名称必需填写'
                    },
                   /* remote: {
                        url: 'user_add.php',
                        message: '部门名是不可用的'
                    },*/
                }
            },
        }
    });
});
</script>
<script language="javascript" type="text/javascript">
        $(function() {
			var navudinfo="<?php echo $parnav;?>";
			$('.breadcrumb',window.parent.document).children('#homeitem').nextAll().remove();
			$('.breadcrumb',window.parent.document).children('#homeitem').after(navudinfo);
        });
</script>

    <script>
			  $(function () {
				//iCheck for checkbox and radio inputs
				$('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
				  checkboxClass: 'icheckbox_minimal-blue',
				  radioClass: 'iradio_minimal-blue'
				});
				//Red color scheme for iCheck
				$('input[type="checkbox"].minimal-red, input[type="radio"].minimal-red').iCheck({
				  checkboxClass: 'icheckbox_minimal-red',
				  radioClass: 'iradio_minimal-red'
				});
				$('input[type="checkbox"].minimal-blue, input[type="radio"].minimal-blue').iCheck({
				  checkboxClass: 'icheckbox_minimal-blue',
				  radioClass: 'iradio_minimal-blue'
				});
				//Flat red color scheme for iCheck
				  $('input[type="checkbox"].flat-blue, input[type="radio"].flat-blue').iCheck({
				  checkboxClass: 'icheckbox_flat-blue',
				  radioClass: 'iradio_flat-blue'
				});
			  });
     </script>
</body>
</html>