<?php /* Smarty version 2.6.17, created on 2018-04-18 11:58:11
         compiled from admin/activity/delivery_channels_add.html */ ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "./admin/header.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "./admin/left.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "./admin/nav.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "get_kindeditor.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

<style>
.set-nav {
	margin: 0 auto;
}
.set-nav-hr {
	background-color: #ddd;
    height: 1px;
    position: relative;
}
.form-group label {
	font-weight: 600;
}
.checkbox-inline, .radio-inline {
	font-weight: 400!important;
}
.rowlabel {
	font-weight: 300!important;
}
.music_play_hide {
	display:none;
}
</style>


<div id="activity_container">

<form id="activity_form">
<div class="activity_center">
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "./admin/activity/common_nav.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
	<input name="events_id" type="hidden" value="<?php echo $this->_tpl_vars['eventData']['id']; ?>
">
	<div  class="panel panel-default">
		<div class="panel-heading"><h3 class="panel-title" id="panel-title">添加投放渠道</h3></div>
		<div class="panel-body">
			<div class="form-group">
				<label class="control-label rowlabel">渠道名称:</label>  <small class="text-danger"><24个字</small>
				
				<input class="form-control" type="text" value="" name="str_name" id="str_name"/>
				<?php if ($this->_tpl_vars['platFormIds']): ?>
				<br>
				<label class="control-label rowlabel">选择列表:</label> <small class="text-danger">选择投放渠道所在列表</small><br>
				<?php $_from = $this->_tpl_vars['platFormData']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['index'] => $this->_tpl_vars['form']):
?>
				<?php if ($this->_tpl_vars['platFormIds'][$this->_tpl_vars['index']]): ?>
				<label class="checkbox-inline">
				<input type="checkbox" value="<?php echo $this->_tpl_vars['index']; ?>
" name="platform_ids"><?php echo $this->_tpl_vars['form']['name']; ?>

				</label>
				<?php endif; ?>
				<?php endforeach; endif; unset($_from); ?>
				<?php endif; ?>
				
				
			</div>
		</div>
		
	</div>
	<a href="javaScript:;" class="button button-3d button-primary button-rounded " style="width:150px;" id="add_delivery_channels">
		<i class="fa fa-refresh fa-spin add_button" style="display:none;"></i> 添加 </a>
</div>



<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "./admin/activity/common_right.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<div style="clear:both;"></div>
</form>
</div>


<script>
KISSY.use('node, io, event', function (S, Node, IO, Event) {
	var $ = S.all;
	var ing = false;
	$("#add_delivery_channels").on('click', function () {
		$('.add_button').show();
		var post_data = {};
		post_data.events_id = $("input[name=events_id]").val();
		post_data.str_name = $('input[name=str_name]').val();
		
		if(post_data.str_name==null){
			$('.add_button').hide();
			alert('请填写渠道名称');return ;
		}
		
		post_data.platform_ids_str="";
		$("[type='checkbox'][name='platform_ids']:checked").each(function(){  
			post_data.platform_ids_str+=$(this).val()+"|";
        }); 
		
		
		if(post_data.platform_ids_str==''){
			$('.add_button').hide();
			alert('请勾选所属列表');return ;
		}
		
		$(this).hide();
		
		new IO({
			type: "post"
			, url:  VG.conf.root_domain+'/?c=Admin_Activity_DeliveryChannels&a=ReqAddDeliveryChannels'
			, data: post_data
			, success: function (data) {
				if (data.ok) { //ok
					location = VG.conf.root_domain+'?c=Admin_Activity_DeliveryChannels&a=PageList&events_id='+post_data.events_id;
				} else {
					alert('操作失败,原因:'+data.msg);
				}
				return false;
			}
			, error: function (NULL, textStatus) {
				alert("请求服务器失败,原因:"+textStatus);
			}
			, dataType: "json"
		});
		
		
	});
	
	
	
});
</script>

<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "./admin/bottom.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>