<?php
      $errors = $this->session->userdata('errors');
      if (isset($errors)) {
          ?>
   <script>
      swal ( "Oops" ,  "<?php echo $errors ?>" ,  "error" )
   </script>
   <?php echo $errors ?>
   <?php
      $this->session->unset_userdata('errors');
      }
      $error = $this->session->userdata('error');
      if (isset($error)) {
      ?>
   <script>
      swal ( "Oops" ,  "<?php echo $error ?>" ,  "error" )
   </script>
   <?php
      $this->session->unset_userdata('error');
      }
      $success = $this->session->userdata('success');
      if (isset($success)) {
      ?>
   <script>
      swal({
      title: "Done!",
      text: "<?php echo $success ?>",
      icon: "success",
      });
   </script>
   <?php
      $this->session->unset_userdata('success');
      }
      ?>
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1>Add New Blog</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="<?php echo admin_url() ?>admin">Home</a></li>
              <li class="breadcrumb-item active">Add New Blog</li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <!-- SELECT2 EXAMPLE -->
        <div class="card card-default">
          <div class="card-header">
            <div class="card-tools">
              <a href="<?php echo admin_url() ?>blog/view_all_blog"><button type="button" class="btn btn-success btn-sm">View All Blog</button></a>
             
            </div>
          </div>
          <!-- /.card-header -->
          <?php echo form_open_multipart(base_url().'admin/blog/new_blog_add'); ?>
          <div class="card-body">
            <div class="row">
              <div class="col-md-12">
                <div class="form-group">
                  <label>Blog Title <span class="required">*</span></label>
                  <input type="text" name="title" class="form-control" placeholder="Enter Blog Title" required="">
                </div>
              </div>
              <div class="col-md-12">
                <div class="form-group">
                  <label>Blog Slug <small>(If you leave it blank, it will be generated automatically.)</small></label>
                  <input type="text" name="title_slug" class="form-control" placeholder="Enter Blog Slug">
                </div>
              </div>
              <div class="col-md-12">
                <div class="form-group">
                  <label>Blog Short Description <span class="required">*</span></label>
                  <textarea type="text" name="short_description" class="form-control" placeholder="Enter Blog Short Description" required=""></textarea>
                </div>
              </div>

              <div class="col-md-12">
                <div class="form-group">
                  <label>Blog SEO Title</label>
                  <input type="text" name="seo_title" class="form-control" placeholder="Enter Blog Keywords">
                </div>
              </div>
              <div class="col-md-12">
                <div class="form-group">
                  <label>Blog SEO Keywords</label>
                  <textarea type="text" name="keywords" class="form-control" placeholder="Enter Blog Keywords"></textarea>
                </div>
              </div>
              <div class="col-md-12">
                <div class="form-group">
                  <label>Blog SEO Description</label>
                  <textarea type="text" name="seo_description" class="form-control" placeholder="Enter Blog Description"></textarea>
                </div>
              </div>
              <div class="col-md-12">
                <div class="form-group">
                  <label>Blog SEO Schema</label>
                  <textarea type="text" name="schema" class="form-control" placeholder="Enter Blog Schema"></textarea>
                </div>
              </div>

              <div class="col-md-12">
                <div class="row">
                  <div class="col-sm-4">
                    <div class="">
                      <label for="radioDanger3">
                        Add to Featured
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-4">
                    <div class="form-group clearfix">
                      <div class="icheck-danger d-inline">
                        <input type="radio" name="breaking" checked="" id="breaking-off" value="0">
                        <label for="breaking-off">
                        </label>
                      </div>
                      <div class="icheck-success d-inline">
                        <input type="radio" name="breaking" id="breaking-on" value="1">
                        <label for="breaking-on">
                        </label>
                      </div>
                    </div>
                  </div>
                </div>
              </div>

              <div class="col-md-12">
                <div class="row">
                  <div class="col-sm-4">
                    <div class="">
                      <label for="radioDanger3">
                        Send Post to All Subscribers <small>(Newsletter)</small>
                      </label>
                    </div>
                  </div>
                  <div class="col-sm-4">
                    <div class="form-group clearfix">
                      <div class="icheck-danger d-inline">
                        <input type="radio" name="send_post_to_subscribes" checked="" id="send_post_to_subscribes-off" value="0">
                        <label for="send_post_to_subscribes-off">
                        </label>
                      </div>
                      <div class="icheck-success d-inline">
                        <input type="radio" name="send_post_to_subscribes" id="send_post_to_subscribes-on" value="1">
                        <label for="send_post_to_subscribes-on">
                        </label>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-12">
                <div class="form-group">
                  <label>Tags</label>
                  <textarea type="text" name="tag" class="form-control" placeholder="Enter Blog Tag" ></textarea>
                </div>
              </div>
              <div class="col-md-12">
                <div class="form-group">
                  <label>Blog Content</label>
                  <textarea type="text" name="content" class="text-editor" placeholder="Enter Blog content"></textarea>
                </div>
              </div>

              <div class="col-md-12 ">
               <div class="row">
                  <div class="col-md-12">
                     <div class="form-group">
                        <label for="inputEmail" class="col-sm-12 col-form-label">Blog Image</label>
                        <input type="file" name="image" class="form-control name_list image" />
                     </div>
                  </div>
               </div>
            </div>  
            <div class="col-md-12">
                <div class="form-group">
                  <label>Blog Category</label>
                  <select  name="category" class="form-control">
                    <option value="">Select Category</option>
                    <?php foreach ($blog_category as $key => $category):?>
                      <option value="<?php echo $category->id ?>"><?php echo $category->category_name ?></option>
                    <?php endforeach; ?>
                  </select>
                </div>
              </div>

              
              <div class="col-md-12">
                <div class="form-group">
                  <button class="btn btn-info" type="submit" style="float: right">Add</button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
    <!-- /.content -->
  </div>
  