<?php $this->load->view('element/head');?>
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper" xmlns="http://www.w3.org/1999/html">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        Item Form
        <small>List Item</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Item Form</a></li>
        <li class="active">Here</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
	
      <div class="row">
        <div class="col-xs-12">
          <ul class="nav nav-tabs">
            <li role="presentation" class="active"><a href="<?php echo site_url('item/create');?>">Input Item</a></li>
            <li role="presentation"><a href="<?php echo site_url('item');?>">List Item</a></li>
          </ul>
		  <div class="box box-info">
            <div class="box-header with-border">
              <h3 class="box-title">Item</h3>
              <?php if($this->session->flashdata('form_false')){?>
                <div class="alert alert-danger text-center">
                  <strong><?php echo $this->session->flashdata('form_false');?></strong>
                </div>
              <?php } ?>
              <?php if($this->session->flashdata('upload_failed')){?>
                <div class="alert alert-danger text-center">
                  <strong><?php echo $this->session->flashdata('upload_failed');?></strong>
                </div>
              <?php } ?>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <?php if(!empty($item)){?>
            <form class="form-horizontal" method="POST" action="<?php echo site_url('item/save').'/'.$item['id'];?>" enctype="multipart/form-data">
            <?php }else{?>
            <form class="form-horizontal" method="POST" action="<?php echo site_url('item/save');?>" enctype="multipart/form-data">
            <?php } ?>
              <div class="box-body">
                <div class="col-md-6">
                  <div class="form-group">
                    <label class="col-sm-4 control-label" for="value">Value Item</label>
                    <div class="col-sm-8">
                      <input type="text" value="<?php echo !empty($item) ? $item['value'] : '';?>" id="value" name="value" class="form-control" autocomplete="off" placeholder="Value Item"/>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-4 control-label" for="image">Image</label>
                    <div class="col-sm-8">
                      <input type="file" value="<?php echo !empty($item) ? $item['image'] : '';?>" name="image" accept="image/*" id="image" class="form-control"/>
                      <p style="color: red;">
                        <strong><small>* Image size under 500KB.<br>* Image type gif | jpg | jpeg | png.</small></strong>
                      </p>
                    </div>
                  </div>
                </div>
                <div class="col-md-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label" for="id_order">Order Image</label>
                    <div class="col-sm-8">
                      <input type="text" value="<?php echo !empty($item) ? $item['id_order'] : '';?>" id="id_order" name="id_order" class="form-control" autocomplete="off" placeholder="Order Image"/>
                    </div>
                  </div>
                </div>
              </div>
              <!-- /.box-body -->
              <div class="box-footer">
                <div class="col-md-3 col-md-offset-4">
                  <a class="btn btn-default" href="<?php echo site_url('item');?>">Cancel</a>
                  <button class="btn btn-info pull-right" type="submit">Save</button>
                </div>
              </div>
              <!-- /.box-footer -->
            </form>
          </div>
		</div>
        <!-- /.col -->
      </div>
	  <!-- row -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
<?php $this->load->view('element/footer');?>