<div class="row">
	<form action="<?php echo base_url('admin/blog/add') ?>" class="skill_form" method="post" enctype="multipart/form-data">
		<input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>">
		<div class="col-md-7">
			<div class="box box-primary">
				<div class="box-header with-border">
					<h3 class="box-title"><?= !empty(lang('posts'))?lang('posts'):"posts";?></h3>
					<?php $this->load->view('admin/inc/error_msg'); ?>
					<div class="box-tools pull-right">
						<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
						<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-remove"></i></button>
					</div>
				</div>
				<div class="box-body" >
				      <div class="form-group">
				      	<label><?= !empty(lang('title'))?lang('title'):"title";?></label>
				        <input type="text" name="title" class="form-control" placeholder="<?= !empty(lang('title'))?lang('title'):"Title";?>" value="<?= set_value('title',isset($s_post['title'])?html_escape($s_post['title']):"") ; ?>" required>
				        <span class="error"><?php echo form_error('title'); ?></span>
				      </div>

				      <div class="form-group">
				      	<label><?= !empty(lang('slug'))?lang('slug'):"slug";?> <span class="cross">*<?= !empty(lang('in_english'))?lang('in_english'):"Must be in English" ;?></span></label>
				        <input type="text" name="slug" class="form-control" placeholder="<?= !empty(lang('slug'))?lang('slug'):"slug";?>" value="<?= set_value('slug',isset($s_post['slug'])?html_escape($s_post['slug']):""); ?>" required>
				        <span class="error"><?php echo form_error('slug'); ?></span>
				      </div>

				    <div class="row mt-15">
						<div class="form-group col-md-12">
							<div class="serviceImg" style="display:<?= isset($s_post['images']) && !empty($s_post['images'])?'block':'none'; ?>;">
								<img src="<?= !empty($s_post['images'])?base_url($s_post['images']):''; ?>" class="service_icon_preview" alt="">
							</div>
							<div class="upload_list">
								<label><input type="radio" name="is_video" class="is_video" value="0"  <?= isset($s_post['is_video']) && $s_post['is_video']==0?'checked':''; ?>> <?= !empty(lang('image_upload'))?lang('image_upload'):"Image upload";?></label> &nbsp;&nbsp;
								<label><input type="radio" name="is_video" class="is_video" value="1" <?= isset($s_post['is_video']) && $s_post['is_video']==1?'checked':''; ?>> <?= !empty(lang('video_link'))?lang('video_link'):"Video Link";?></label>
							</div>

							<div class="image_link" style="display:<?= isset($s_post['is_video']) &&  $s_post['is_video']==0?'block':'none'; ?>;">
								<input type="file" name="file[]" size="20" class="form-control" id="load_image">
                                <input type="hidden" name="post_image" value="<?= !empty($s_post['image'])?html_escape($s_post['image']):""; ?>">
							</div>
							<div class="video_link" style="display:<?= isset($s_post['is_video']) && $s_post['is_video']==1?'block':'none'; ?>;">
								<input type="text" name="video_link" class="form-control" placeholder="Youtube Video Link" value="<?= !empty($s_post['thumb'])?html_escape($s_post['thumb']):""; ?>">
							</div>
						</div>
					</div>
				    <br>

				      <div class="form-group">
				      	<label><?= !empty(lang('details'))?lang('details'):"details";?></label>
				      	<textarea name="details" class="tinymce" id="" cols="30" rows="10"><?= set_value('details',isset($s_post['details'])?$s_post['details']:""); ?></textarea>
				      	<input name="image" type="file" id="upload" class="hidden" onchange="">
				        <span class="error"><?php echo form_error('details'); ?></span>
				      </div>
				    
				</div><!-- /.box-body -->
			</div>
		</div>




		<div class="col-md-5">
			<div class="box box-primary">
				<div class="box-header with-border">
					<h3 class="box-title"><?= !empty(lang('posts'))?lang('posts'):"posts";?></h3>
				</div>
				<div class="box-body" >

					<div class="form-group">
				      	<label><?= !empty(lang('overview'))?lang('overview'):"overview";?></label>
				      	<textarea name="overview" class="form-control" id="" cols="5" rows="5" required><?= set_value('overview',isset($s_post['overview'])?html_escape($s_post['overview']):""); ?></textarea>
				        <span class="error"><?php echo form_error('overview'); ?></span>
				     </div>

				    <div class="form-group">
				      	<label><?= !empty(lang('categories'))?lang('categories'):"categories";?></label>
				      	<div class="">
				      		<select name="cat_id" class="select2" id="" required>
				      			<option value=""><?= !empty(lang('select'))?lang('select'):"select";?></option>
				      			<?php foreach ($categories as $cat): ?>
				      				<option <?= isset($s_post['cat_id']) &&  $s_post['cat_id']==$cat['id']?"selected":""; ?> value="<?= html_escape($cat['id']); ?>"><?= html_escape($cat['cat_name']);?></option>
				      			<?php endforeach ?>
				      		</select>
				      	</div>
				        <span class="error"><?php echo form_error('cat_id'); ?></span>
				     </div>

				    <div class="form-group">
				      	<label><?= !empty(lang('tags'))?lang('tags'):"tags";?></label>
				      	<div class="">
				      		<div class="p_atg">
					      		<?php if(isset($post_tags) && count($post_tags) > 0): ?>
						      		<?php foreach ($post_tags as $p_tag): ?>
						      			<label class="label label-info"><?= html_escape($p_tag['tag_name']);?></label>
						      		<?php endforeach ?>
					      		<?php endif ?>
				      		</div>
				      		<select multiple name="tag_name[]" id="" autofocus="off" class="chosen-select form-control">
                              <?php foreach ($tags as $tag): ?>
                                <option value="<?= html_escape($tag['id']); ?>"> <?= html_escape($tag['tag_name']);?></option>
                              <?php endforeach ?>
                            </select>
				      	</div>
				     </div>

					

			      	<div class="form-group">
				      	<label><?= !empty(lang('status'))?lang('status'):"status";?></label>
			      		<div class="">
				      		<label class="text_direction custom-radio"><input type="radio" class="" name="status" value="1" <?= isset($s_post['status']) &&  html_escape($s_post['status'])=="1"?"checked":''; ?> checked> &nbsp;<?= !empty(lang('live'))?lang('live'):"live";?></label> &nbsp;&nbsp;
				      		<label class="text_direction custom-radio"><input type="radio" class="" name="status" value="0" <?= isset($s_post['status']) &&  html_escape($s_post['status'])=="0"?"checked":''; ?>> &nbsp;<?= !empty(lang('hide'))?lang('hide'):"hide";?></label>
				      		
			      		</div>
				        <span class="error"><?php echo form_error('status'); ?></span>
			     	 </div>

			     	 <div class="form-group">
				      	<label><?= !empty(lang('type'))?lang('type'):"Post type";?></label>
			      		<div class="">
				      		<label class="text_direction custom-radio"><input type="radio" class="" name="post_type" value="1" <?= isset($s_post['post_type']) &&  html_escape($s_post['post_type'])=="1"?"checked":''; ?> checked> &nbsp;<?= !empty(lang('public'))?lang('public'):"public";?></label> &nbsp;&nbsp;

				      		<label class="text_direction custom-radio"><input type="radio" class="" name="post_type" value="0" <?= isset($s_post['post_type']) &&  html_escape($s_post['post_type'])=="0"?"checked":''; ?> > &nbsp;<?= !empty(lang('only_me'))?lang('only_me'):"only_me";?></label> &nbsp;&nbsp;

				      		
				      		
			     	 </div>


					<input type="hidden" name="id" value="<?= isset($s_post['id'])? html_escape($s_post['id']):"0";?>">
				</div><!-- /.box-body -->


				<div class="box-footer" > 
					<div class="pull-left">
						<?php if ($this->session->flashdata('warning')): ?>
							<a href="<?= base_url('admin/post-add') ?>"  class="btn btn-default btn-block btn-flat"><i class="fa fa-refresh"></i></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<?php endif ?>
					</div> 
					
					<div class="pull-left">
		          		<a href="<?= base_url('admin/post') ?>"  class="btn btn-default btn-block btn-flat"><?= !empty(lang('cancel'))?lang('cancel'):"cancel";?></a>
		            </div>
		        	
		            <div class="pull-right">
		            	<input type="hidden" name="id" value="<?= isset($s_post['id'])?html_escape($s_post['id']):"0"; ?>">
		          		<button type="submit" name="register" class="btn btn-primary btn-block btn-flat"><?= !empty(lang('submit'))?lang('submit'):"submit";?></button>
		            </div>
				</div>
				<div class="view_image preview_load_image" style="display: <?= !empty($s_post['image'])?'block':'none' ?>; height: 100%; margin-top: 30px; padding-bottom: 15px;">
	    			<img src="<?= !empty($s_post['image'])?html_escape(base_url($s_post['image'])):'' ?>" alt="" id="preview_load_image">
	    		</div>
			</div>
		</div>
	</form>
</div>

