<link rel="stylesheet" href="<?php echo admin_css() ?>plugins/bs-stepper/css/bs-stepper.min.css">
<?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 Branch</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 Branch</li>
               </ol>
            </div>
         </div>
      </div>
      <!-- /.container-fluid -->
   </section>
   <!-- Main content -->
   <section class="content">
      <div class="container-fluid">
         <!--  EXAMPLE -->
         <div class="card card-default">
            <div class="card-header">
               <div class="card-tools">
                  <a href="<?php echo admin_url() ?>branch/view_all_branch"><button type="button" class="btn btn-success btn-sm">View All Branch</button></a>
               </div>
            </div>
            <!-- /.card-header -->
            <div class="card-body">
               <div class="card-body p-0">
                  <?php echo form_open_multipart(base_url() . 'admin/branch/add_branch'); ?>
                  <div class="bs-stepper linear">
                     <div class="" role="tablist">
                        <!-- your steps here -->
                        <div class="row">
                           <div class="col-6 col-md-3">
                              <div class="step active" data-target="#basic-part">
                                 <button type="button" class="step-trigger" role="tab" aria-controls="logins-part" id="logins-part-trigger" aria-selected="true">
                                    <span class="bs-stepper-circle">1</span>
                                    <span class="bs-stepper-label">Basic</span>
                                 </button>
                              </div>
                           </div>
                           <div class="col-6 col-md-3">
                              <div class="line"></div>
                              <div class="step" data-target="#additional-part">
                                 <button type="button" class="step-trigger" role="tab" aria-controls="information-part" aria-selected="false" disabled="disabled">
                                    <span class="bs-stepper-circle">2</span>
                                    <span class="bs-stepper-label">About Branch</span>
                                 </button>
                              </div>
                           </div>
                           <div class="col-6 col-md-3">
                              <div class="line"></div>
                              <div class="step" data-target="#shiping-part">
                                 <button type="button" class="step-trigger" role="tab" aria-controls="information-part" aria-selected="false" disabled="disabled">
                                    <span class="bs-stepper-circle">3</span>
                                    <span class="bs-stepper-label">Course</span>
                                 </button>
                              </div>
                           </div>
                           <div class="col-6 col-md-3">
                              <div class="line"></div>
                              <div class="step" data-target="#pricing">
                                 <button type="button" class="step-trigger" role="tab" aria-controls="information-part" aria-selected="false" disabled="disabled">
                                    <span class="bs-stepper-circle">4</span>
                                    <span class="bs-stepper-label">Address</span>
                                 </button>
                              </div>
                           </div>
                           <div class="col-6 col-md-3">
                              <div class="line"></div>
                              <div class="step" data-target="#media">
                                 <button type="button" class="step-trigger" role="tab" aria-controls="information-part" aria-selected="false" disabled="disabled">
                                    <span class="bs-stepper-circle">5</span>
                                    <span class="bs-stepper-label">Contact</span>
                                 </button>
                              </div>
                           </div>
                           <div class="col-6 col-md-3">
                              <div class="line"></div>
                              <div class="step" data-target="#seo">
                                 <button type="button" class="step-trigger" role="tab" aria-controls="information-part" aria-selected="false" disabled="disabled">
                                    <span class="bs-stepper-circle">6</span>
                                    <span class="bs-stepper-label">SEO</span>
                                 </button>
                              </div>
                           </div>
                           <div class="col-6 col-md-3">
                              <div class="line"></div>
                              <div class="step" data-target="#finish">
                                 <button type="button" class="step-trigger" role="tab" aria-controls="information-part" aria-selected="false" disabled="disabled">
                                    <span class="bs-stepper-circle">7</span>
                                    <span class="bs-stepper-label">Finish</span>
                                 </button>
                              </div>
                           </div>
                        </div>
                     </div>
                     <div class="bs-stepper-content">
                        <!-- your steps content here -->
                        <div id="basic-part" class="content active dstepper-block" role="tabpanel" aria-labelledby="logins-part-trigger">
                           <div class="row justify-content-center">
                              <div class="col-xl-12">
                                 <div class="form-group row mb-3">
                                    <label class="col-md-2 col-form-label" for="course_title"><?php echo get_phrase('branch_name'); ?> <span class="required">*</span> </label>
                                    <div class="col-md-10">
                                       <input type="text" class="form-control" name="name" required>
                                    </div>
                                 </div>
                                 <div class="form-group row mb-3">
                                    <label class="col-md-2 col-form-label" for="course_title"><?php echo get_phrase('page_title'); ?> <span class="required">*</span> </label>
                                    <div class="col-md-10">
                                       <input type="text" class="form-control" name="slider_title" required="" placeholder="Enter Slider Title">
                                    </div>
                                 </div>
                                 <div class="form-group row mb-3">
                                    <label class="col-md-2 col-form-label" for="course_title"><?php echo get_phrase('page_slug'); ?> </label>
                                    <div class="col-md-10">
                                       <input type="text" class="form-control" name="slug">
                                    </div>
                                 </div>

                                 <div class="form-group row mb-3">
                                    <label class="col-md-2 col-form-label" for="description"><?php echo get_phrase('slider_short_description'); ?></label>
                                    <div class="col-md-10">
                                       <textarea rows="8" name="short_description" class="form-control "></textarea>
                                    </div>
                                 </div>
                                 <div class="form-group row mb-3">
                                    <label class="col-md-2 col-form-label" for="description"><?php echo get_phrase('mobile_no'); ?> <span class="required">*</span> </label>
                                    <div class="col-md-10">
                                       <input name="mobile" type="number" class="form-control " placeholder="Enter Mobile No" required="">
                                    </div>
                                 </div>
                                 <div class="form-group row mb-3">
                                    <label class="col-md-2 col-form-label" for="description"><?php echo get_phrase('email_id'); ?> <span class="required">*</span> </label>
                                    <div class="col-md-10">
                                       <input name="email" type="email" class="form-control " placeholder="Enter Email ID" required="">
                                    </div>
                                 </div>
                                 <div class="form-group row mb-3">
                                    <label class="col-md-2 col-form-label" for="description"><?php echo get_phrase('branch_mode'); ?> <span class="required">*</span> </label>
                                    <div class="col-md-10">
                                       <select name="mode" class="form-control " placeholder="Enter Email ID" required="">
                                          <option value="">Select From List</option>
                                          <option value="Physical">Physical</option>
                                          <option value="Digital">Digital</option>
                                       </select>
                                    </div>
                                 </div>
                              </div>
                           </div>
                           <button type="button" class="btn btn-primary" onclick="stepper.next()">Next</button>
                        </div>
                        <!-- end col -->
                     </div>
                     <div id="additional-part" class="content" role="tabpanel" aria-labelledby="information-part-trigger">
                        <div class="row justify-content-center">
                           <div class="col-xl-12">
                              <div class="form-group row mb-3">
                                 <label class="col-md-2 col-form-label" for="description"><?php echo get_phrase('about_us'); ?></label>
                                 <div class="col-md-10">
                                    <textarea rows="8" name="about_us" class="form-control text-editor"></textarea>
                                 </div>
                              </div>
                           </div>
                           <div class="col-xl-12">
                              <div class="form-group row mb-3">
                                 <label class="col-md-2 col-form-label" for="description"><?php echo get_phrase('video_ink'); ?></label>
                                 <div class="col-md-10">
                                    <input name="video_link" class="form-control" placeholder="Enter Video Link">
                                 </div>
                              </div>
                           </div>
                        </div>
                        <button type="button" class="btn btn-primary" onclick="stepper.previous()">Previous</button>
                        <button type="button" class="btn btn-primary" onclick="stepper.next()">Next</button>
                     </div>
                     <div id="shiping-part" class="content" role="tabpanel" aria-labelledby="information-part-trigger">
                        <div class="row justify-content-center">
                           <div class="col-xl-12">
                              <div class="form-group row mb-3">
                                 <label class="col-md-2 col-form-label" for="description"><?php echo get_phrase('features'); ?></label>
                                 <div class="col-md-10">
                                    <textarea rows="8" name="features" class="form-control text-editor"></textarea>
                                 </div>
                              </div>
                           </div>
                           <div class="col-xl-12">
                              <div class="form-group row mb-3">
                                 <label class="col-md-2 col-form-label" for="description"><?php echo get_phrase('select_courses'); ?><span class="required">*</span></label>
                                 <div class="select2-purple col-md-10">
                                    <select class="select2" multiple="multiple" data-placeholder="Select Courses" data-dropdown-css-class="select2-purple" name="course[]" style="width: 100%!important;" required="">
                                       <?php $all_course = $this->course_model->get_all_course();
                                       foreach ($all_course as $key => $course): ?>
                                          <option value="<?php echo $course->id ?>"><?php echo $course->title ?></option>
                                       <?php endforeach; ?>
                                    </select>
                                 </div>
                              </div>
                           </div>
                        </div>
                        <button type="button" class="btn btn-primary" onclick="stepper.previous()">Previous</button>
                        <button type="button" class="btn btn-primary" onclick="stepper.next()">Next</button>
                     </div>
                     <div id="pricing" class="content" role="tabpanel" aria-labelledby="information-part-trigger">
                        <div class="row justify-content-center">
                           <div class="col-xl-12">
                              <div class="paid-course-stuffs">
                                 <div class="form-group row mb-3">
                                    <label class="col-md-2 col-form-label" for="price"><?php echo get_phrase('Pin Code') ?><span class="required">*</span></label>
                                    <div class="col-md-10">
                                       <input type="text" class="form-control" name="pin_code" placeholder="Enter Pin Code" required="" onchange="check_address(this.value)">
                                    </div>
                                 </div>
                                 <div class="form-group row mb-3">
                                    <label class="col-md-2 col-form-label" for="price"><?php echo get_phrase('address') ?><span class="required">*</span></label>
                                    <div class="col-md-10">
                                       <textarea type="text" class="form-control" name="address" placeholder="" required=""></textarea>
                                    </div>
                                 </div>
                                 <div class="form-group row mb-3">
                                    <label class="col-md-2 col-form-label" for="price"><?php echo get_phrase('Area') ?><span class="required">*</span></label>
                                    <div class="col-md-10">
                                       <select name="area" required class="form-control" id="area">
                                          <option value="">Select A Area</option>
                                       </select>
                                    </div>
                                 </div>
                                 <div class="form-group row mb-3">
                                    <label class="col-md-2 col-form-label" for="price"><?php echo get_phrase('City') ?><span class="required">*</span></label>
                                    <div class="col-md-10">
                                       <input name="city" placeholder="Enter City *" required readonly="" class="form-control" id="city">
                                    </div>
                                 </div>
                                 <div class="form-group row mb-3">
                                    <label class="col-md-2 col-form-label" for="price"><?php echo get_phrase('State') ?><span class="required">*</span></label>
                                    <div class="col-md-10">
                                       <input name="state" placeholder="Enter State *" required readonly="" class="form-control" id="state">
                                    </div>
                                 </div>
                                 <div class="form-group row mb-3">
                                    <label class="col-md-2 col-form-label" for="price"><?php echo get_phrase('google_map_code') ?><span class="required">*</span></label>
                                    <div class="col-md-10">
                                       <textarea type="text" class="form-control" name="google_map" placeholder="" required=""></textarea>
                                    </div>
                                 </div>

                                 <div class="form-group row mb-3">
                                    <label class="col-md-2 col-form-label" for="price"><?php echo get_phrase('landmark') ?></label>
                                    <div class="col-md-10">
                                       <textarea type="text" class="form-control text-editor" name="landmark" placeholder=""></textarea>
                                    </div>
                                 </div>
                              </div>
                           </div>
                           <!-- end col -->
                        </div>
                        <!-- end row -->
                        <button type="button" class="btn btn-primary" onclick="stepper.previous()">Previous</button>
                        <button type="button" class="btn btn-primary" onclick="stepper.next()">Next</button>
                     </div>
                     <div id="media" class="content" role="tabpanel" aria-labelledby="information-part-trigger">
                        <div class="row justify-content-center">

                           <div class="col-xl-12">
                              <div class="form-group row mb-3">
                                 <label class="col-md-2 col-form-label" for="course_overview_url"><?php echo get_phrase('branch_manager_name'); ?></label>
                                 <div class="col-md-10">
                                    <input type="text" class="form-control" name="brn_manager">
                                 </div>
                              </div>
                           </div>
                           <div class="col-xl-12">
                              <div class="form-group row mb-3">
                                 <label class="col-md-2 col-form-label" for="course_overview_url"><?php echo get_phrase('enquiry_contact'); ?><span class="required">*</span></label>
                                 <div class="col-md-10">
                                    <input type="text" class="form-control" name="enq_contact" required="">
                                 </div>
                              </div>
                           </div>
                           <div class="col-xl-12">
                              <div class="form-group row mb-3">
                                 <label class="col-md-2 col-form-label" for="course_overview_url"><?php echo get_phrase('enquiry_email'); ?><span class="required">*</span></label>
                                 <div class="col-md-10">
                                    <input type="email" class="form-control" name="enq_email" required="">
                                 </div>
                              </div>
                           </div>
                           <div class="col-xl-12">
                              <div class="form-group row mb-3">
                                 <label class="col-md-2 col-form-label" for="course_overview_url"><?php echo get_phrase('timing'); ?><span class="required">*</span></label>
                                 <div class="col-md-10">
                                    <input type="text" class="form-control" name="time" required="">
                                 </div>
                              </div>
                           </div>
                        </div>
                        <!-- end row -->
                        <button type="button" class="btn btn-primary" onclick="stepper.previous()">Previous</button>
                        <button type="button" class="btn btn-primary" onclick="stepper.next()">Next</button>
                     </div>
                     <div id="seo" class="content" role="tabpanel" aria-labelledby="information-part-trigger">
                        <div class="row justify-content-center">
                           <div class="col-xl-12">
                              <div class="form-group row mb-3">
                                 <label class="col-md-2 col-form-label" for="website_keywords"><?php echo get_phrase('meta_title'); ?></label>
                                 <div class="col-md-10">
                                    <input type="text" class="form-control" name="branch_meta_title" placeholder="Enter Branch meta Title" />
                                 </div>
                              </div>
                           </div>
                           <div class="col-xl-12">
                              <div class="form-group row mb-3">
                                 <label class="col-md-2 col-form-label" for="website_keywords"><?php echo get_phrase('meta_keywords'); ?></label>
                                 <div class="col-md-10">
                                    <input type="text" class="form-control" name="meta_keywords" placeholder="Enter Meta Keywords- (Separate with comma(,))" . />
                                 </div>
                              </div>
                           </div>
                           <!-- end col -->
                           <div class="col-xl-12">
                              <div class="form-group row mb-3">
                                 <label class="col-md-2 col-form-label" for="meta_description"><?php echo get_phrase('meta_description'); ?></label>
                                 <div class="col-md-10">
                                    <textarea name="meta_description" class="form-control"></textarea>
                                 </div>
                              </div>
                           </div>
                           <div class="col-xl-12">
                              <div class="form-group row mb-3">
                                 <label class="col-md-2 col-form-label" for="meta_description"><?php echo get_phrase('schema'); ?></label>
                                 <div class="col-md-10">
                                    <textarea name="schema" class="form-control"></textarea>
                                 </div>
                              </div>
                           </div>
                           <!-- end col -->
                        </div>
                        <!-- end row -->
                        <button type="button" class="btn btn-primary" onclick="stepper.previous()">Previous</button>
                        <button type="button" class="btn btn-primary" onclick="stepper.next()">Next</button>
                     </div>
                     <div id="finish" class="content" role="tabpanel" aria-labelledby="information-part-trigger">
                        <div class="row">
                           <div class="col-12">
                              <div class="text-center">
                                 <h2 class="mt-0"><i class="mdi mdi-check-all"></i></h2>
                                 <h3 class="mt-0"><?php echo get_phrase("thank_you"); ?> !</h3>
                                 <p class="w-75 mb-2 mx-auto"><?php echo get_phrase('you_are_just_one_click_away'); ?></p>
                                 <div class="mb-3 mt-3">
                                    <button type="submit" class="btn btn-primary text-center"><?php echo get_phrase('submit'); ?></button>
                                 </div>
                              </div>
                           </div>
                           <!-- end col -->
                        </div>
                        <!-- end row -->
                        <input type="hidden" name="added_by" value="<?php echo user()->id ?>">
                        <button type="button" class="btn btn-primary" onclick="stepper.previous()">Previous</button>
                     </div>
                  </div>
               </div>
            </div>
            <?php echo form_close(); ?>
         </div>
      </div>
   </section>
   <!-- /.content -->
</div>
</section>
<style type="text/css">
</style>
<script src="<?php echo admin_css() ?>plugins/bs-stepper/js/bs-stepper.min.js"></script>
<script type="text/javascript">
   // BS-Stepper Init
   document.addEventListener('DOMContentLoaded', function() {
      window.stepper = new Stepper(document.querySelector('.bs-stepper'))
   });
</script>

<style media="screen">
   body {
      overflow-x: hidden;
   }
</style>
<script type="text/javascript">
   function check_address(e) {
      let pin_code = e;
      $.ajax({
         beforeSend: function() {
            $(".preloader-ajax").show();
            $(".preloader-ajax-bg").show();
         },
         type: "GET",
         dataType: "JSON",
         async: true,
         url: '<?php echo base_url(); ?>home/get_pin_code_details/' + pin_code,
         success: function(data) {
            $('#area').html(data.area);
            $('#city').val(data.city);
            $('#state').val(data.state);
            $(".preloader-ajax").hide();
            $(".preloader-ajax-bg").hide();
         },
         error: function() {
            $(".preloader-ajax").hide();
            $(".preloader-ajax-bg").hide();
         }
      });
   }
</script>