<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
  <!-- Content Header (Page header) -->
  <section class="content-header">
    <h1>
      Gérer l'
      <small>Entreprise</small>
    </h1>
    <ol class="breadcrumb">
      <li><a href="#"><i class="fa fa-dashboard"></i> Accueil</a></li>
      <li class="active">Entreprise</li>
    </ol>
  </section>

  <!-- Main content -->
  <section class="content">
    <!-- Small boxes (Stat box) -->
    <div class="row">
      <div class="col-md-12 col-xs-12">

        <?php if (session()->getFlashdata('success')): ?>
          <div class="alert alert-success alert-dismissible" role="alert">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <?php echo session()->getFlashdata('success'); ?>
          </div>
        <?php elseif (session()->getFlashdata('error')): ?>
          <div class="alert alert-error alert-dismissible" role="alert">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <?php echo session()->getFlashdata('error'); ?>
          </div>
        <?php endif; ?>

        <div class="box">
          <div class="box-header">
            <h3 class="box-title">Gérer les informations sur l'entreprise</h3>
          </div>
          <form role="form" action="<?php base_url('company/update') ?>" method="post">
            <div class="box-body">

              <!-- Validation errors -->
              <?php if (!empty($validation_errors)): ?>
                <div class="alert alert-danger">
                  <ul>
                    <?php foreach ($validation_errors as $error): ?>
                      <li><?= esc($error) ?></li>
                    <?php endforeach; ?>
                  </ul>
                </div>
              <?php endif; ?>

              <div class="form-group">
                <label for="company_name">Nom de l'entreprise</label>
                <input type="text" class="form-control" id="company_name" name="company_name" placeholder="Nom de l'entreprise" value="<?php echo $company_data['company_name'] ?>" autocomplete="off">
              </div>
              <div class="form-group">
                <label for="nif">NIF</label>
                <input type="text" class="form-control" id="nif" name="nif" placeholder="NIF" value="<?php echo $company_data['NIF'] ?>" autocomplete="off">
              </div>
              <div class="form-group">
                <label for="stat">STAT</label>
                <input type="text" class="form-control" id="stat" name="stat" placeholder="STAT" value="<?php echo $company_data['STAT'] ?>" autocomplete="off">
              </div>
              <div class="form-group">
                <label for="service_charge_value">Montant des frais (%)</label>
                <input type="text" class="form-control" id="service_charge_value" name="service_charge_value" placeholder="Montant des frais %" value="<?php echo $company_data['service_charge_value'] ?>" autocomplete="off">
              </div>
              <div class="form-group">
                <label for="vat_charge_value">Charge TVA (%)</label>
                <input type="text" class="form-control" id="vat_charge_value" name="vat_charge_value" placeholder="Charge TVA %" value="<?php echo $company_data['vat_charge_value'] ?>" autocomplete="off">
              </div>
              <div class="form-group">
                <label for="address">Addresse</label>
                <input type="text" class="form-control" id="address" name="address" placeholder="Enter addresse" value="<?php echo $company_data['address'] ?>" autocomplete="off">
              </div>
              <div class="form-group">
                <label for="phone">Téléphone 1</label>
                <input type="text" class="form-control" id="phone" name="phone" placeholder="Téléphone" value="<?php echo $company_data['phone'] ?>" autocomplete="off">
              </div>
              <div class="form-group">
                <label for="phone2">Téléphone 2</label>
                <input type="text" class="form-control" id="phone2" name="phone2" placeholder="Téléphone" value="<?php echo $company_data['phone2'] ?>" autocomplete="off">
              </div>
              <div class="form-group">
                <label for="country">Pays</label>
                <input type="text" class="form-control" id="country" name="country" placeholder="Pays" value="<?php echo $company_data['country'] ?>" autocomplete="off">
              </div>
              <div class="form-group">
                <label for="permission">Message</label>
                <textarea class="form-control" id="message" name="message">
                     <?php echo $company_data['message'] ?>
                  </textarea>
              </div>
              <div class="form-group">
                <label for="currency">Devise</label>
                <?php ?>
                <select class="form-control" id="currency" name="currency">
                  <option value="">~~SÉLECTIONNER~~</option>

                  <?php foreach ($currency_symbols as $k => $v): ?>
                    <option value="<?php echo trim($k); ?>" <?php if ($company_data['currency'] == $k) {
                                                              echo "selected";
                                                            } ?>><?php echo $k ?></option>
                  <?php endforeach ?>
                </select>
              </div>

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

            <div class="box-footer">
              <button type="submit" class="btn btn-primary">Enregistrer</button>
            </div>
          </form>
        </div>
        <!-- /.box -->
      </div>
      <!-- col-md-12 -->
    </div>
    <!-- /.row -->


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

<script type="text/javascript">
  $(document).ready(function() {
    $("#companyNav").addClass('active');
    $("#message").wysihtml5();
  });
</script>