<div class="row">
	<div class="col-md-5">
		<div class="box box-primary">
			<div class="box-header with-border">
				<h3 class="box-title"><?= !empty(lang('categories'))?lang('categories'):"categories";?></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>
			<form action="<?php echo base_url('admin/categories/add') ?>" method="post">
				<div class="box-body" >
					<input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>">


				      <div class="form-group">
				      	<label><?= !empty(lang('categories'))?lang('categories'):"categories";?> <?= !empty(lang('name'))?lang('name'):"name";?></label>
				        <input type="text" name="cat_name" class="form-control" placeholder="<?= !empty(lang('categories'))?lang('categories'):"categories";?>" value="<?= isset($s_cat['cat_name'])?$s_cat['cat_name']:""; ?>">
				        <span class="error"><?php echo form_error('cat_name'); ?></span>
				      </div>

				      <div class="form-group">
				      	<label><?= !empty(lang('slug'))?lang('slug'):"slug";?></label>
				        <input type="text" name="slug" class="form-control" placeholder="<?= !empty(lang('slug'))?lang('slug'):"slug";?>" value="<?= isset($s_cat['slug'])?$s_cat['slug']:""; ?>">
				        <span class="error"><?php echo form_error('slug'); ?></span>
				      </div>
				     

				      <div class="form-group">
				      	<label><?= !empty(lang('status'))?lang('status'):"Visibility";?></label>
				      	<div class="">
				      		<label class="text_direction"><input type="radio" class="icheck" name="status" value="1" <?= isset($s_cat['status']) && html_escape($s_cat['status'])=="1"?"checked":''; ?> checked> &nbsp;<?= !empty(lang('live'))?lang('live'):"live";?></label> &nbsp;&nbsp;
				      		<label class="text_direction"><input type="radio" class="icheck" name="status" value="0" <?= isset($s_cat['status']) && html_escape($s_cat['status'])=="0"?"checked":''; ?>> &nbsp;<?= !empty(lang('hide'))?lang('hide'):"hide";?></label>
				      	</div>
				        <span class="error"><?php echo form_error('status'); ?></span>
				      </div>
					
					<input type="hidden" name="id" value="<?= isset($s_cat['id'])? $s_cat['id']:"0";?>">
				</div><!-- /.box-body -->
				<div class="box-footer" > 
					<?php if(isset($s_cat['id']) && $s_cat['id'] !=0): ?>
						<div class="pull-left">
			          		<a href="<?= base_url('admin/categories') ?>"  class="btn btn-default btn-block btn-flat"><?= !empty(lang('cancel'))?lang('cancel'):"cancel";?></a>
			            </div>
		        	<?php endif ?>
		            <div class="pull-right">
		          		<button type="submit" name="register" class="btn btn-primary btn-block btn-flat"><?= !empty(lang('submit'))?lang('submit'):"submit";?></button>
		            </div>
				</div>
			</form>
		</div>
	</div>
	<div class="col-md-7">
		<div class="box box-primary">
			<div class="box-header with-border">
				<h3 class="box-title"><?= !empty(lang('categories'))?lang('categories'):"categories";?></h3>
				<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>
			<!-- /.box-header -->
			<div class="box-body" >
				<div class="user_table">
					<table class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th><?= !empty(lang('sl'))?lang('sl'):"sl";?></th>
                  <th><?= !empty(lang('name'))?lang('name'):"name";?></th>
                  <th><?= !empty(lang('slug'))?lang('slug'):"slug";?></th>
                  <th><?= !empty(lang('status'))?lang('status'):"status";?></th>
                  <th><?= !empty(lang('action'))?lang('action'):"action";?></th>
                </tr>
                </thead>
                <tbody>
                <?php $i=1; foreach ($categories as $key => $row): ?>
	                <tr>
	                  <td><?php echo $i; ?></td>
	                  <td><?php echo html_escape($row['cat_name']); ?></td>
	                  <td><?php echo html_escape($row['slug']); ?></td>
	                  <td>
	                  	<a href="<?= base_url('change-status/'.$row['id']."/")?><?= html_escape($row['status'])==1?"0":"1"; ?>/categories" class="label <?= $row['status']==1?"label-success":"label-danger"; ?>"><?= html_escape($row['status'])==1?(!empty(lang('live'))?lang('live'):"Live"): (!empty(lang('hide'))?lang('hide'):"Hide"); ?></a>
	                  </td>
	                  
	                  <td>
	                  	<a href="<?php echo base_url('admin/blog/edit_category/'.html_escape($row['id'])); ?>" class="btn btn-flat btn-info btn-sm" data-toggle="tooltip" data-placement="top" title="Edit Categories"><i class="fa fa-pencil"></i></a>

	                  	<a href="<?php echo base_url('admin/blog/delete_category/'.html_escape($row['id'])); ?>"data-msg="<?= !empty(lang('want_to_delete'))?lang('want_to_delete'):'Want to delete?' ;?>" class="btn btn-flat btn-danger btn-sm action_btn" data-toggle="tooltip" data-placement="top" title="Delete Category" ><i class="fa fa-trash-o"></i></a>
	               
	                  </td>
	                </tr>
            	<?php $i++; endforeach ?>
                </tbody>
              </table>
				</div>
			</div><!-- /.box-body -->
			<div class="box-footer" >
			
			</div>
		</div>
	</div>
</div>

