~~~
{layout name="layout"}
<script src="__PLUGINS__/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
<script src="__PLUGINS__/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<link href="__PLUGINS__/bootstrap-datepicker/bootstrap-datepicker.min.css" rel="stylesheet">
<script src="__PLUGINS__/summernote/summernote.min.js"></script>
<script src="__PLUGINS__/summernote/lang/summernote-zh-CN.js"></script>
<link href="__PLUGINS__/summernote/summernote.css" rel="stylesheet">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="panel-control">
<ul class="nav nav-tabs">
<li class="active">
<a data-toggle="tab" href="#itinerary-box" aria-expanded="false">日程规划</a>
</li>
</ul>
</div>
<h3 class="panel-title">日报发布</h3>
</div>
<div class="panel-body">
<div class="tab-content">
<div id="itinerary-box" class="tab-pane fade active in">
<form id="dailyform" class="form-horizontal pad-top mar-top" <!-- action="{:url('mydaily/add_api')}" method="post" -->>
<div class="form-group">
<label class="col-sm-2 control-label">日报时间</label>
<div class="col-sm-6">
<div class="input-group">
<input type="text" value="{$today}" class="form-control start_time" name="day" id="day">
<span class="input-group-addon">
<i class="ion-calendar"></i>
</span>
</div>
</div>
</div>
<div class="items">
<div class="form-group">
<label class="col-sm-2 control-label">工作内容</label>
<div class="col-sm-6">
<input name="title[]" id="title" placeholder="今天做的事情" value="{$v.title|default=''}" type="text" class="form-control" >
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">简单纪要</label>
<div class="col-sm-6">
<textarea name="info[]" id="info" class="summernote"></textarea>
</div>
</div>
</div>
<div class="itinerary">
<div class="form-group">
<label class="col-sm-2 control-label">工作内容</label>
<div class="col-sm-6">
<input name="title[]" id="title" placeholder="" type="text" class="form-control" >
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">简单纪要</label>
<div class="col-sm-6">
<textarea name="info[]" id="info" class="summernote"></textarea>
</div>
</div>
</div>
<div id="moreitinerary"></div>
<div class="text-center pad-all">
<span class="btn btn-warning btn-lg" onclick="addItineraryTemp()">增加工作项目</span>
<input value="保存" type="submit" class="btn btn-success btn-lg" />
<input type="hidden" name="id" id="id" value="{$info.id|default=0}" />
</div>
</form>
</div>
</div>
</div>
</div>
<div id="itinerary-temp" style="display:none">
<div class="itinerary">
<p class="bord-top"></p>
<div class="form-group">
<label class="col-sm-2 control-label">工作内容</label>
<div class="col-sm-6">
<input name="title[]" id="title" placeholder="" type="text" class="form-control" >
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">简单纪要</label>
<div class="col-sm-6">
<textarea name="info[]" id="info" class="summernote"></textarea>
</div>
</div>
</div>
</div>
<script>
$('#dailyform').submit(function(event){
event.preventDefault();
var submit_url="{:url('mydaily/add_api')}"
var form_data=$('#dailyform').serialize();
console.log(form_data)
$.post(submit_url,form_data,function(data){
if(data.status==1){
layer.alert(data.msg)
}else{
layer.alert(data.msg)
}
})
})
function addDaily(){
var submit_url="{:url('mydaily/add_api')}"
var form_data=$('#dailyform').serialize();
$.post(submit_url,form_data,function(data){
if(data.status==1){
layer.alert('保存成功',function(){
location.href="{:url('mydaily/index')}"
return false;
})
}else{
layer.alert(data.msg,function(){
layer.closeAll()
return false;
})
}
})
//return false;
}
$(function(){
$('.start_time').datepicker({
format: "yyyy-mm-dd",
todayBtn: "linked",
autoclose: true,
todayHighlight: true,
language: "zh-CN",
});
$('.summernote').summernote({
height: "100px",
toolbar: [],
})
})
function addItineraryTemp(){
var html=$('#itinerary-temp').html();
$('.summernote').summernote({
height: "100px",
toolbar: [],
})
$('#moreitinerary').append(html);
}
</script>
~~~