<?php

    $this->load->view('master/header');
    $this->load->view('master/sidebar');


    foreach ($results as $front_countdown) {
      $total_experience = $front_countdown['total_experience'];
      $happy_clients = $front_countdown['happy_clients'];
      $projects_done = $front_countdown['projects_done'];
      $id = $front_countdown['front_countdownid'];
    } 

?>  
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        Front Countdown
        <!-- <small>it all starts here</small> -->
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li><a href="#">Front Countdown</a></li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">

      <?php if($this->session->flashdata('success')){ ?>

      <div class="alert alert-success alert-dismissible">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
        <h4><i class="icon fa fa-check"></i> Alert!</h4>
        <?php echo $this->session->flashdata('success'); ?>.
      </div>

      <?php } ?>

      <?php if($this->session->flashdata('error')){ ?>

      <div class="alert alert-danger alert-dismissible">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
        <h4><i class="icon fa fa-ban"></i> Alert!</h4>
        <?php echo $this->session->flashdata('error'); ?>.
      </div>

      <?php } ?>

      <!-- Default box -->
      <div class="box">
        <div class="box-header with-border">
          <h3 class="box-title">Set Countdown</h3>

          <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip"
                    title="Collapse">
              <i class="fa fa-minus"></i></button>
            <button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
              <i class="fa fa-times"></i></button>
          </div>
        </div>
        <div class="box-body">
          <div class="row">
            <div class="col-md-6">
              <?php if(isset($total_experience) == "" && isset($happy_clients) == "" && isset($projects_done) == ""){ ?>
                <form class="form-vertical" method="post" action="<?= site_url('user/Dashboard/submit_front_countdown') ?>">
                  <div class="form-group">
                    <input class="form-control" name="total_experience" type="text" placeholder="Total Experience">
                  </div>
                  <div class="form-group">
                    <input class="form-control" name="happy_clients" type="text" placeholder="Happy Clients">
                  </div>
                  <div class="form-group">
                    <input class="form-control" name="projects_done" type="text" placeholder="Project Done">
                  </div>
                  <div class="form-group">
                    <button class="btn btn-success">Save</button>
                  </div>
                </form>
              <?php }
                    else{
              ?>
                <form class="form-vertical" method="post" action="<?= site_url('user/Dashboard/update_front_countdown') ?>">
                  <div class="form-group">
                    <input class="form-control" name="total_experience" type="text" value="<?php echo $total_experience; ?>">
                  </div>
                  <div class="form-group">
                    <input class="form-control" name="happy_clients" type="text" value="<?php echo $happy_clients; ?>">
                  </div>
                  <div class="form-group">
                    <input class="form-control" name="projects_done" type="text" value="<?php echo $projects_done; ?>">
                  </div>
                  <input type="hidden" name="front_countdownid" value="<?php echo $id; ?>">
                  <div class="form-group">
                    <button class="btn btn-success">Save</button>
                  </div>
                </form>
              <?php
                    }
              ?>
            </div>

          </div>

        </div>
        <!-- /.box-body -->
      </div>
      <!-- /.box -->

    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->


<?php

    $this->load->view('master/footer');

?>  