<?php $__env->startSection('content'); ?>

<script type="text/javascript" language="javascript">
function my_add_form_submit(){
	var form_check_state = form_check();
	if( form_check_state ){
		document.getElementById('my_add_form').submit();
	}else{
		return false;
	}
}

function form_check(){ 
	var error_msg = '';
	error_msg += form_field_text_check('title','Title');	
	error_msg += form_field_radio_check('status','Status');
	
	//KindEditor value
	editor.sync();
	
	if( error_msg != '' ){
		$("#error_message").html(error_msg);
		$("html, body").animate({ scrollTop: 0 }, 500);
		return false;
	}else{
		return true;
	}
}
</script>

<script language="javascript" type="text/javascript">
var editor;
KindEditor.ready(function(K) {
	editor = K.create('#content_wysiwyg', {		
		langType : 'en',
		newlineTag : 'br',		//p, br
		resizeType : 2,
		allowFileManager : true,
		afterBlur: function(){this.sync();}
	});
});
</script>

  <div id="content-header">
    <div id="breadcrumb"> <a href="<?php echo e(url('/admin')); ?>" title="Go to Home" class="tip-bottom"><i class="icon-home"></i> Home</a> <a href="<?php echo e(url('/admin/article')); ?>">Article Management</a> <a href="javascript:void(0);" class="current">Add/Edit</a> </div>
  </div>
  
  
  <div class="container-fluid">
    <div class="row-fluid">
      <div class="span12">
        <div class="widget-box">
	  	
			<div class="title_btn">
				<h2><?php echo $pk_id>0? 'Edit': 'Add New';?></h2>
			</div>
			<div class="clear"></div>
			
			<div class="tab_name">
				<a href="<?php echo e(URL('/admin/section')); ?>" class="">Section</a>
				<a href="<?php echo e(URL('/admin/article')); ?>" class="active">Article</a>
			</div><!--tab_name-->
			<div class="clear"></div>
			
			<?php echo parseErrorMessageLaravel($errors);?>
			  
          <div class="widget-content nopadding">
			<form name="my_add_form" id="my_add_form" action="<?php echo e(URL('admin/article/store')); ?>" method="POST" onsubmit="return form_check();" class="form-horizontal" enctype="multipart/form-data">
			
              <div class="control-group">
                <label class="control-label">Title <span style="color:#FF0000;">*</span></label>
                <div class="controls">
				  <input type="text" name="title" id="title" maxlength="255" class="span8 m-wrap" value="<?php echo isset($object->title) ? $object->title : NULL?>" required="required" placeholder="Title" />
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">Title Image</label>
                <div class="controls">
                  <input type="file" name="titlephotos[]" id="titlephotos_1" value=""> (Will use this image as Title)
				<br />
				<input type="text" name="titleimageid_1" id="titleimageid_1" size="10" value="" onkeyup="value=value.replace(/[^\d-]/g,'');"/>Link to a image, Media ID (Please retrieve ID from Media Center, Set -1 will delete previous) 
				<br />
				<?php if( isset($object['title_media_path']) && $object['title_media_path']!="" ):?><img src="<?php echo get_ext_path($object['title_media_path']);?>" style="max-width:375px;" /><?php endif;?>
                </div>
              </div>
			  
			  
			  <div class="control-group">
                <label class="control-label">Published Date <span style="color:#FF0000;">*</span></label>
                <div class="controls">
				  <input type="text" name="published" id="published" data-date-format="yyyy-mm-dd" value="<?php echo isset($object->published) ? $object->published : NULL?>" class="datepicker span8">
				  <span class="help-block">Date with Formate of  (yyyy-mm-dd)</span>
                </div>
              </div>
<script language="javascript">
$(function() {
	$("#published").datepicker({
		changeMonth: true,		//Allows you to change the month by selecting from a drop-down list.
		changeYear: true,		//Allows you to change the year by selecting from a drop-down list. 
		dateFormat: "yy-mm-dd",		//The format for parsed and displayed dates. 
		dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
		dayNamesMin: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
		dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
		firstDay: 1,		//Set the first day of the week: Sunday is 0, Monday is 1
		monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
		monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
		yearRange: "c-20:c+20",		//Control the range of years displayed in the year drop-down
		showButtonPanel: true,			//Whether to show the button panel.
	});
});
</script>
			  
              <div class="control-group">
                <label class="control-label">Section <span style="color:#FF0000;">*</span></label>
                <div class="controls">
                  <select name="section_id" id="section_id" class="span5">
					<option value="">Please select a section</option>
					<?php foreach( $section_list as $section ):?>
						<option value="<?php echo e($section->id); ?>" <?php echo isset($object->section_id) && $object->section_id==$section->id? ' selected="selected"': '';?>><?php echo e($section->getBreakString()); ?><?php echo e($section->title); ?></option>
					<?php endforeach;?>
				</select>
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">Status <span style="color:#FF0000;">*</span></label>
                <div class="controls">
                  <label><input type="radio" name="status" id="status" value="Active" <?php echo isset($object->status) && $object->status=='Active' ? ' checked="checked"' : NULL?> />Active</label>
				<label><input type="radio" name="status" id="status" value="Archive" <?php echo isset($object->status) ? ( $object->status=='Archive' ? ' checked="checked"': NULL) : ' checked="checked"'?> />Archive</label>
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">Sort <span style="color:#FF0000;">*</span></label>
                <div class="controls">
                  <input type="text" name="sort" id="sort" maxlength="255" value="<?php echo isset($object->sort) ? $object->sort : NULL?>" onkeyup="value=value.replace(/[^\d]/g,'');" required="required" placeholder="Number Only" />
                </div>
			  </div>
			  
              <div class="control-group">
                <label class="control-label">Banner <span style="color:#FF0000;">*</span></label>
                <div class="controls">
                  <input type="file" name="photos[]" id="photos_1" value=""> (image : 1920px X 310px)
				<br />
				<input type="text" name="imageid_1" id="imageid_1" size="10" value="" onkeyup="value=value.replace(/[^\d-]/g,'');"/>Link to a image, Media ID (Please retrieve ID from Media Center, Set -1 will delete previous) 
				<br />
				<?php if( isset($object['media_path']) && $object['media_path']!="" ):?><img src="<?php echo get_ext_path_advanced($object['media_path'], $object['media_id'], 's');?>" style="max-width:400px;" /><?php endif;?>
                </div>
              </div>
			  
              <div class="control-group">
                <label class="control-label">Summary <span style="color:#FF0000;">*</span></label>
                <div class="controls">
                  <textarea style="height:100px; width:700px;" name="summary" ><?php echo isset($object->summary) ? $object->summary : NULL?></textarea>
                </div>
              </div>
			  
              <div class="control-group">
                <label class="control-label">Content <span style="color:#FF0000;">*</span></label>
                <div class="controls">
                  <textarea style="height:300px; width:700px;" name="content" id="content_wysiwyg" ><?php echo isset($object->content) ? $object->content : NULL?></textarea>
                </div>
              </div>
			  
              <div class="control-group">
                <label class="control-label">Tags </label>
                <div class="controls">
				  <input type="text" name="tags" id="tags" maxlength="255" class="span8 m-wrap" value="<?php echo isset($object->tags) ? $object->tags : NULL?>" placeholder="Tags" /> Please use comma to divide the multiple tags.
                </div>
              </div>
              <div class="control-group" style="display:none;">
                <label class="control-label">Comment Status <span style="color:#FF0000;">*</span></label>
                <div class="controls">
                  <label><input type="radio" name="comment_status" id="comment_status" value="1" <?php echo isset($object->comment_status) && $object->comment_status=='1' ? ' checked="checked"' : NULL?> />Open</label>
				<label><input type="radio" name="comment_status" id="comment_status" value="0" <?php echo isset($object->comment_status) ? ( $object->comment_status=='0' ? ' checked="checked"': NULL) : ' checked="checked"'?> />Closed</label>
                </div>
              </div>
			  
              <div class="control-group">
                <label class="control-label">Display Type <span style="color:#FF0000;">*</span></label>
                <div class="controls">
                  <label><input type="radio" name="display_type" id="display_type" value="2" <?php echo isset($object->display_type) && $object->display_type=='2' ? ' checked="checked"' : NULL?> />Show All</label>
				<label><input type="radio" name="display_type" id="display_type" value="1" <?php echo isset($object->display_type) ? ( $object->display_type=='1' ? ' checked="checked"': NULL) : ' checked="checked"'?> />VIEW MORE</label>
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">View Number</label>
                <div class="controls">
                  <input type="text" name="viewnum" id="viewnum" maxlength="255" value="<?php echo isset($object->viewnum) ? $object->viewnum : NULL?>" onkeyup="value=value.replace(/[^\d]/g,'');" placeholder="Number Only" />
                </div>
			  </div>
			  
			  
			  <div class="control-group info">
                <label class="control-label">SEO URL</label>
                <div class="controls">
				  <?php echo isset($object->seo_url) ? $object->seo_url : NULL?>
                </div>
              </div>
			  <div class="control-group info">
                <label class="control-label">Update SEO URL?</label>
                <div class="controls">
                  <label><input type="radio" name="sync_seo_url" id="sync_seo_url" value="0" checked="checked" />No</label>
				  <label><input type="radio" name="sync_seo_url" id="sync_seo_url" value="1" />Yes (Will update URL using Title)</label>
                </div>
              </div>
			  <div class="control-group info">
                <label class="control-label">SEO Title</label>
                <div class="controls">
				  <input type="text" name="seo_title" id="seo_title" maxlength="255" class="span5" value="<?php echo isset($object->seo_title) ? $object->seo_title : NULL?>" placeholder="SEO Title" /> &lt;title&gt;SEO Title&lt;/title&gt;, will use title as default.
                </div>
              </div>
			  <div class="control-group info">
                <label class="control-label">SEO Keywords</label>
                <div class="controls">
				  <input type="text" name="seo_keywords" id="seo_keywords" maxlength="255" class="span5" value="<?php echo isset($object->seo_keywords) ? $object->seo_keywords : NULL?>" placeholder="SEO Keywords" /> &lt;meta name="keywords" content="Keyword 1, Keyword 2, Keyword 3"&gt;
                </div>
              </div>
			  <div class="control-group info">
                <label class="control-label">SEO Description</label>
                <div class="controls">
				  <input type="text" name="seo_description" id="seo_description" maxlength="255" class="span5" value="<?php echo isset($object->seo_description) ? $object->seo_description : NULL?>" placeholder="SEO Description" /> &lt;meta name="description" content="Description of this record"&gt;
                </div>
              </div>
			  
			  
              <div class="form-actions">
			  	<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
				<input type="hidden" name="pk_id" value="<?php echo isset($object->id) ? $object->id : 0?>" />
				
                <input type="submit" value="Save" class="btn btn-success">
				<input type="button" value="Cancel" class="btn btn-danger" onclick="javascript:history.go(-1);return false;" />
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
    
  </div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>