<?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>Spin Setting</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">Spin Setting</li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-sm-12">
            <div class="card card-default">
              <div class="card-header">
                <h4>Update Spin Details</h4>
              </div>
              <!-- /.card-header -->
              <?php echo form_open(base_url().'admin/course/update_spin_data'); ?>
              <div class="card-body">
                <div class="row">
                  <?php $i=1; foreach ($spin_details as $spin):?>
                    <div class="col-md-12">
                      <div class="form-group">
                        <label>Section <?php echo $i;?></label>
                      </div>
                    </div>
                    <div class="col-md-4">
                      <div class="form-group">
                        <label>Text<span class="required">*</span></label>
                        <input type="text" name="spin_text[]" class="form-control" placeholder="Enter Spin Text" required="" value="<?php echo $spin->spin_text ?>">
                      </div>
                    </div>
                    <div class="col-md-4">
                      <div class="form-group">
                        <label>Result<span class="required">*</span></label>
                        <input type="text" name="spin_result[]" class="form-control" placeholder="Enter Spin Result" required="" value="<?php echo $spin->spin_result ?>">
                      </div>
                    </div>
                    <div class="col-md-4">
                      <div class="form-group">
                        <label>Win Result<span class="required">*</span></label>
                        <select type="text" name="spin_win[]" class="form-control" required="">
                          <option <?php if($spin->spin_win == 'True'){echo 'selected';} ?> value="True">Win</option>
                          <option <?php if($spin->spin_win == 'false'){echo 'selected';} ?> value="false">Failed</option>
                        </select>
                      </div>
                    </div>
                    <input type="hidden" name="spin_id[]" class="form-control" placeholder="Enter Spin Result" required="" value="<?php echo $spin->spin_id ?>">
                  <?php $i++; endforeach;?>
                  <div class="col-md-12">
                    <div class="form-group">
                      <button class="btn btn-info" type="submit" style="float: right">Update</button>
                    </div>
                  </div>
                  <?php echo form_close(); ?>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
</div>