<?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/section')); ?>">Section 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>
			
			<?php echo parseErrorMessageLaravel($errors);?>
			  
          <div class="widget-content nopadding">
			<form name="my_add_form" id="my_add_form" action="<?php echo e(URL('admin/section/store')); ?>" method="POST" onsubmit="return form_check();" class="form-horizontal">
			
              <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">Parent <span style="color:#FF0000;">*</span></label>
                <div class="controls">
				<?php 
					$parent_list = Helper::listData($parent_list, 'id', 'title');
					$parent_val = isset($object['parent_id']) ? $object['parent_id'] : NULL;
				?>
				<?php echo getHTMLSelect('parent_id', 'parent_id', $parent_list, $parent_val, array('class'=>'span5', 'firstItem'=>'Please select a section'));?>
                </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">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 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(); ?>