<div class="wrapper">

  <!-- Navbar -->
  <nav class="main-header navbar navbar-expand-md navbar-light navbar-white">
    <div class="container">
      <a href="index.php" class="navbar-brand">

        <span class="brand-text font-weight-light">Siplabs</span>
      </a>

      <button class="navbar-toggler order-1" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>

      <div class="collapse navbar-collapse order-3" id="navbarCollapse">
        <!-- Left navbar links -->
        <ul class="navbar-nav">
          <li class="nav-item">
            <a href="<?php echo base_url('peminjam') ?>" class="nav-link">Beranda</a>
          </li>
          <li class="nav-item">
            <a href="<?php echo base_url('peminjam/jadwal') ?>" class="nav-link">Jadwal</a>
          </li>
          <li class="nav-item">
            <a href="<?php echo base_url('peminjam/inventaris') ?>" class="nav-link">Inventaris</a>
          </li>
        </ul>
      </div>

      <!-- Right navbar links -->
      <ul class="order-1 order-md-3 navbar-nav navbar-no-expand ml-auto">
      <li class="nav-item dropdown no-arrow">
      <?php $userprofile = $this->db->get_where('user', ['id_user' =>$user])->row_array(); ?>
                <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button"
                data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <span class="mr-2 d-none d-lg-inline text-gray-600 large"><?php echo $this->session->nama_lengkap; ?></span>
                      <img class="img-profile rounded"
                    src="<?php echo base_url('files/userprofil/' . $userprofile['image']) ?>" width="20px" border-radius= "50%">
              </a>
            <!-- Dropdown - User Information -->
              <div class="dropdown-menu dropdown-menu-right shadow animated--grow-in"
                aria-labelledby="userDropdown">
                  <a class="dropdown-item " href="<?php echo base_url('peminjam/profil');?>">
                      <i class="fas fa-user fa-sm fa-fw mr-2 text-gray-400"></i>
                      Profile
                  </a>
                <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="#" data-toggle="modal" data-target="#logout">
                        <i class="fas fa-power-off fa-sm fa-fw mr-2 text-gray-400"></i>
                        Logout
                    </a>
               </div>
        </li>
      </ul>
    </div>
  </nav>
  <!-- /.navbar -->

  < <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><?= $title; ?></h1>
                </div>
                <div class="col-sm-6">
                </div>
            </div>
        </div><!-- /.container-fluid -->
    </section>

    <!-- Main content -->
    <!-- Main content -->
    <section class="content">
        <div class="container-fluid">
          <div class="card mb-3" style="max-width: 40rem;">
          <div class="row no-gutters">
            <div class="col-md-4">
            <img class="card-img" src="<?php echo base_url('files/userprofil/'. $userprofile['image'] ); ?>">
            </div>
            <div class="col-md-8">
              <div class="card-body">
                <h1 class="card-title font-weight-bold">Nama: <?= $userprofile['nama_lengkap']?></h1>
                <p class="card-text font-weight-bold"><span>username : <?= $userprofile['username']?></span></p>
                <p class="card-text font-weight-bold"><span>Bio :  <?= $userprofile['bio']?></span></p>
                <p class="card-text font-weight-bold"><span>NIP :  <?= $userprofile['nip']?></span></p>
                <p class="card-text font-weight-bold"><span>Level :  <?= $userprofile['level']?></span></p>
                <p class="card-text font-weight-bold"><span>No WA : <?= $userprofile['no_telp']?></span> </p>
                  <div class="editprofil">
                      <a href="#" data-id_user="" data-toggle="modal" data-target="#editprofiluser" class="btn btn-primary btn-flat"><i class="fas fa-edit"></i> Edit profil</a>
                      <a href="#" data-id_user="" data-toggle="modal" data-target="#gantipassword" class="btn btn-primary btn-flat"><i class="fas fa-key"></i> Ganti password</a>
                   </div>
              </div>
            </div>
          </div>
          </div>
        </div>
    </section>
    <!-- /.content -->
</div>
<div class="modal fade" id="editprofiluser">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
        <form action="<?php echo base_url('inventaris/editprofil') ?>" method="POST" enctype="multipart/form-data">
    <div class="modal-header">
        <h4 class="modal-title">Edit profil</h4>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
        </button>
    </div>
    <div class="modal-body">
            <div class="row">
                <div class="col-md">
                    <input type="hidden" name="id_user" value="<?php echo $userprofile->id_user ?>">
                    <div class="form-group">
                        <label>Username</label>
                        <input type="text" name="username" value="<?php echo $userprofile->username ?>" class="form-control">
                    </div>
                    <div class="form-group">
                        <label>Nama Lengkap</label>
                        <input type="text" name="nama_lengkap" value="<?php echo $userprofile->nama_lengkap ?>" class="form-control">
                    </div>
                    <div class="form-group">
                        <label>Bio</label>
                        <textarea name="bio" class="form-control"><?php echo $userprofile->bio ?></textarea>
                    </div>
                </div>
                <div class="col-md">
                    <div class="form-group">
                        <label>NIP/NIS</label>
                        <input type="text" onkeypress="return isNumberKey(event)" name="nip" value="<?php echo $userprofile->nip ?>" class="form-control">
                    </div>
                    <div class="form-group">
                        <label>Nomor WA Aktif</label>
                        <div class="input-group">
                            <span class="text-bold">+62</span>&nbsp;&nbsp;<input type="text" onkeypress="return isNumberKey(event)" name="no_telp" value="<?php echo $userprofile->no_telp ?>" class="form-control">
                        </div>
                        <small class="text-danger">Nomor dimulai dari angka 8, peminjam akan langsung mengirimkan pesan ke nomor ini</small>
                    </div>
                    <div class="form-group">
                        <label>Pilih Gambar</label>
                        <input type="file" id="imageinput" onchange="return filename()" name="image" class="form-control image">
                        <span class="text-danger" id="imagename"></span>
                        <img src="<?php echo base_url('files/userprofil/'.$userprofile->image) ?>" width="100">
                    </div>
                </div>
            </div>
    </div>
    <div class="modal-footer justify-content-between">
        <button type="button" class="btn btn-default" data-dismiss="modal">Tutup</button>
        <button type="submit" name="edit" class="btn btn-primary pinjam">Edit</button>
    </div>
</form>
        </div>
    </div>
</div>