<!--{include file="<!--{$oapath}-->public/ins_page.tpl"}-->
     <link rel='stylesheet' type='text/css' href="<!--{$oapath}-->Ins/js/layui/css/layui.css">
 <script type='text/javascript' src='<!--{$urlpath}-->data/oaeditor/kindeditor.js'></script>
<block name="content">
	<div class="page-header">
	<h1>新建待办事项</h1>
</div>
		<form method='post' id="form_data" name="form_data" enctype="multipart/form-data"   class="well form-horizontal">
		<input type="hidden" id="ajax" name="ajax" value="1">
		<input type="hidden" id="status" name="status" value="1">
		<input type="hidden" id="opmode" name="opmode" value="add">
		<div class="form-group">
			<label class="col-sm-2 control-label" for="name">标题*：</label>
			<div class="col-sm-10">
				<input value="" class="form-control" type="text" id="name" name="name" check="require" msg="请输入标题">
			</div>
		</div>

		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="end_date">结束：</label>
			<div class="col-sm-8">
				<input  type="text" id="end_date" name="end_date" readonly="readonly" class="form-control input-date" value="" readonly="readonly">
			</div>
		</div>

		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" >优先级：</label>
			<div class="col-sm-8">
				<div class="col-sm-8">
					<div class="form-control-static" >
						<input type="hidden" id="priority" name="priority"/>
						<div  class="slider_box" >
							<div class="left" >
								低
							</div>
							<div id="basic_slider"></div>
							<div class="right" >
								高
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="clearfix"></div>
		<div class="form-group">
			<label class="col-sm-2 control-label" for="name">附件：</label>
			<div class="col-sm-10">
				<div class="uploader" id="uploader_add_file" add_file_id="add_file">
                                    <a class="btn btn-sm btn-primary" id="testList">添加附件</a>
                                    
                                    <ul class="file_list" new_upload="" id="file_list"></ul>
                            </div>
			</div>
		</div>
		<div class="form-group">
			<div class="col-xs-12">
				<textarea  class="editor" id="content"  name="content" style="width:100%;height:300px;"></textarea>
                                                            <script>var editor;KindEditor.ready(function(K) {editor = K.create('#content',{afterCreate : function() {
    this.sync();
},
afterBlur:function(){
    this.sync();
} }); });</script>
			</div>
		</div>
		<div class="form-group">
			<div class="action">
				<input class="btn btn-sm btn-primary" type="button" value="保存" onclick="save();">
				<input  class="btn btn-sm btn-default" type="button" value="取消" onclick="go_return_url();">
			</div>
		</div>
	</form>
</block>

                                		</div>
		<!-- Mainly scripts -->
		<script src="<!--{$oapath}-->Ins/js/jquery-2.1.1.js"></script>
		<script src="<!--{$oapath}-->Ins/js/bootstrap.min.js"></script>
		<script src="<!--{$oapath}-->Ins/js/plugins/metisMenu/jquery.metisMenu.js"></script>
		<script src="<!--{$oapath}-->Ins/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
		<!-- Custom and plugin javascript -->
		<script src="<!--{$oapath}-->Ins/js/inspinia.js"></script>
		<script src="<!--{$oapath}-->Ins/js/common.js"></script>
		<script src="<!--{$oapath}-->Ins/js/plugins/pace/pace.min.js"></script>
                
		<script src="<!--{$oapath}-->Ins/js/plugins/toastr/toastr.min.js"></script>
                <script src="<!--{$oapath}-->Ins/js/plugins/gritter/jquery.gritter.min.js"></script>
                <script src="<!--{$oapath}-->Ins/js/plugins/bootbox/bootbox.min.js"></script>
		
        <script src="<!--{$oapath}-->Ins/js/plugins/jquery-ui/jquery-ui.min.js"></script>
	<script src="<!--{$oapath}-->Ins/js/plugins/nouslider/jquery.nouislider.min.js"></script>
        <script src="<!--{$oapath}-->Ins/js/plugins/date-time/moment-with-locales.js"></script>
	<script src="<!--{$oapath}-->Ins/js/plugins/date-time/bootstrap-datetimepicker.js"></script>

       <script type="text/javascript" src="<!--{$oapath}-->Ins/js/layui/layui.js"></script>

<block name="js">
    <script type="text/javascript">
	
				</script>
    <script type="text/javascript">
	$(document).ready(function() {
		$('.input-date').datetimepicker({
			format : 'YYYY-MM-DD',
			locale : 'zh-cn',
			ignoreReadonly : true,
			widgetPositioning : {
				horizontal : 'auto',
				vertical : 'bottom'
			},
		});
		
		$(".input-daterange input").datetimepicker({
			format : "YYYY-MM-DD",
			locale : 'zh-cn',
			showTodayButton : true,
			showClose : true,
			ignoreReadonly : true,
			widgetPositioning : {
				horizontal : 'auto',
				vertical : 'bottom'
			},
		});

		$("#start_date").on("dp.change", function(e) {
			if ($("#end_date").length > 0) {
				$('#end_date').data("DateTimePicker").minDate(e.date);
			}
		});
		
		$("#end_date").on("dp.change", function(e) {
			if ($("#start_date").length > 0) {
				$('#start_date').data("DateTimePicker").maxDate(e.date);
			}
		});

		$(".input-date-time").datetimepicker({
			format : 'YYYY-MM-DD HH:mm',
			locale : 'zh-cn',
			sideBySide : true,
			showTodayButton : true,
			showClose : true,
			ignoreReadonly : true,
			widgetPositioning : {
				horizontal : 'auto',
				vertical : 'bottom'
			},
		});		 
	}); 
</script>
<block name="js">
	<script type="text/javascript">
		function save() {
			sendForm("form_data", "oa.php?c=Todo&a=save", "oa.php?c=Todo");
		}
                $(document).on("click", "#del_li", function() {
                                                $(this).parent().parent().parent().remove();		
                                });
		$(document).ready(function() {
			$("#basic_slider").noUiSlider({
				start : 0,
				step : 1,
				range : {
					'min' : 1,
					'max' : 5,
				},
			});
			$("#basic_slider").on('change',function(){
				$("div.slider_box .noUi-base").css("background-color", schedule_bg($(this).val()));
				$("#priority").val($(this).val());
			});
			$("div.slider_box .noUi-base").css("background-color", schedule_bg(0));
		});
	</script>
</block>
          <script>
layui.use('upload', function(){
  var $ = layui.jquery
  ,upload = layui.upload;
  
  //普通图片上传
  var uploadInst = upload.render({
    elem: '#testList'
    ,url: 'oa.php?c=Popup&a=upload'
    ,accept: 'file'
    ,before: function(obj){
      //预读本地文件示例，不支持ie8
      obj.preview(function(index, file, result){
        $('#demo1').attr('src', result); //图片链接（base64）
      });
    }
    ,done: function(res){
      //如果上传失败
      if(res.code > 0){
        return layer.msg('上传失败');
      }else{
          var html="<li class='tbody'><input type='hidden' name='upload_file[]' value='"+res.name1+"'/><div class='loading' style='width: 100%;'></div><div class='data'><span class='del text-center'><a class='link del' id='del_li' style='display: inline;'>删除</a></span>";
          html+="<span class='size text-right'>"+res.size+"</span>";
          html+="<span class='auto autocut'>"+res.name2+"</span></div></li>";
          var demoText = $('#file_list');
          demoText.append(html);
      }
      //上传成功
    }
    ,error: function(){
      //演示失败状态，并实现重传
      var demoText = $('#demoText');
      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
      demoText.find('.demo-reload').on('click', function(){
        uploadInst.upload();
      });
    }
  });
  

  
  //绑定原始文件域
  upload.render({
    elem: '#test20'
    ,url: '/upload/'
    ,done: function(res){
      console.log(res)
    }
  });
  
});
</script>
</block>
	</body>
</html>