<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html>
  
  <head>
    <title>
      Admin &gt; Pengaturan | <?php echo html_escape($this->system->set[ 'site_name']) . PHP_EOL; ?>
    </title>
    <?php include_once(VIEWPATH. 'includes/head.php'); ?>
  </head>
  
  <body>
    <?php include_once(VIEWPATH. 'admin/_navbar.php'); ?>
    <div class="container">
      <ul class="breadcrumb">
        <li><a href="<?php echo site_url();?>"><i class="fa fa-home"></i></a></li>
        <li><a href="<?php echo site_url('admin');?>">Admin Panel</a></li>
        <li><a href="<?php echo site_url('admin/pengaturan');?>">Pengaturan</a></li>
        <li class="active"><span>Umum</span></li>
      </ul>
      <div class="row">
        <div class="col-sm-4 col-md-3">
          <?php include(dirname(__FILE__).'/_sidebar.php');?>
        </div>
        <div class="col-sm-8 col-md-9">
          <div class="panel panel-default">
            <div class="panel-heading">
              <h3>
                <i class="fa fa-cog"></i> Umum
              </h3>
            </div>
            <div class="panel-body">
              <?php echo form_open_multipart() . PHP_EOL;?>
                <div class="form-group">
                  <label for="site_name" class="control-label">
                    Nama Situs
                  </label>
                  <input type="text" class="form-control" name="site_name" id="site_name" value="<?php echo  set_value('site_name', $this->system->set['site_name']);?>" maxlength="80" required="required"/>
                </div>
                <div class="form-group">
                  <label class="control-label">
                    Logo
                  </label>
                  <div class="input-group">
                    <label class="input-group-btn">
                      <span class="btn btn-primary"><img src="<?php echo base_url('assets/logo.png');?>" style="height: 18px;"/><input type="file" style="display: none;" name="logo"></span>
                    </label>
                    <input type="text" class="form-control" value="Tidak ada file" readonly="readonly"/>
                  </div>
                </div>
                <div class="form-group">
                  <label for="site_desc" class="control-label">
                    Deskripsi Situs
                  </label>
                  <textarea class="form-control" name="site_desc" id="site_desc" maxlength="200" required="required"><?php echo  set_value('site_desc', @$this->system->set['site_desc']);?></textarea>
                </div>
                <div class="form-group">
                  <label for="site_keywords" class="control-label">
                    Keywords
                  </label>
                  <input type="text" class="form-control" name="site_keywords" id="site_keywords" value="<?php echo  set_value('site_keywords', @$this->system->set['site_keywords']);?>" maxlength="200" required="required"/>
                </div>
                <div class="form-group">
                  <label for="site_email" class="control-label">
                    Email Situs
                  </label>
                  <input type="email" class="form-control" name="site_email" id="site_email" value="<?php echo  set_value('site_email', $this->system->get_set('site_email'));?>"/>
                </div>
                <div class="form-group">
                  <label for="zona_waktu" class="control-label">
                    Zona Waktu
                  </label>
                  <input type="text" class="form-control" name="zona_waktu" id="zona_waktu" value="<?php echo  set_value('zona_waktu', $this->system->set['zona_waktu']);?>" maxlength="8" required/>
                </div>
                <div class="form-group">
                  <label for="per_page" class="control-label">
                    List Per Page
                  </label>
                  <input type="number" class="form-control" name="list_per_page" id="per_page" value="<?php echo set_value('list_per_page', $this->system->set['list_per_page']);?>" maxlength="2" required/>
                </div>
                <div class="alert alert-warning">
                  <h4>Maintenance</h4>
                  <div class="form-group">
                    <label>Judul</label>
                    <input class="form-control" type="text" name="mnt_title" value="<?php echo set_value('mtc_title', $mtc_title);?>" maxlength="80"/>
                  </div>
                  <div class="form-group">
                    <label>Pesan</label>
                    <textarea class="form-control" name="mnt_message" maxlength="10000" rows="6"><?php echo set_value('mtc_message', $mtc_message);?></textarea>
                    <p class="help-block">Kode HTML diperbolehkan</p>
                  </div>
                  <div class="form-group">
                    <label class="control-label">
                      Status
                    </label>
                    <select class="form-control" name="mnt_status">
                      <option value="on"<?php echo ($this->system->set['maintenance'] == 'on' ? ' selected' : '');?>>
                        Aktif
                      </option>
                      <option value="off"<?php echo ($this->system->set['maintenance'] == 'off' ? ' selected' : '');?>>
                        Tidak aktif
                      </option>
                    </select>
                    <p class="help-block">Administrator masih bisa mengakses website walaupun status maintenance aktif.</p>
                  </div>
                </div>
                <div>
                  <button type="submit" class="btn btn-primary" name="submit" value="save">
                    Simpan
                  </button>
                </div>
              <?php echo form_close() . PHP_EOL;?>
            </div>
          </div>
        </div>
      </div>
    </div>
    <?php include_once(VIEWPATH.'includes/foot.php'); ?>
    <script>
    $(document).on('change', ':file', function() {
        var input = $(this),
        numFiles = input.get(0).files ? input.get(0).files.length : 1,
        label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
        input.trigger('fileselect', [numFiles, label]);
    });
    $(document).ready( function() {
        $(':file').on('fileselect', function(event, numFiles, label) {
            var input = $(this).parents('.input-group').find(':text'),
            log = numFiles > 1 ? numFiles + ' files selected' : label;
            if( input.length ) {
                input.val(log);
            }
        });
    });
    </script>
  </body>

</html>