<?php if (auth()->user()->role == 'customer'): ?>
    <?= $this->extend('layouts/topbar') ?>
<?php else: ?>
    <?= $this->extend('layouts/sidebar') ?>
<?php endif; ?>

<?= $this->section('content') ?>
<section class="content">
    <div class="container-fluid">
        <!-- Small boxes (Stat box) -->
        <div class="card">
            <div class="card-body">
                <form method="POST" action=" <?= base_url('edit_profile_proses/' . (auth()->user()->role == "customer" ? $data->id_customer : $data->id_pegawai)) ?>" enctype="multipart/form-data">
                    <?= csrf_field() ?>
                    <div class="form-group">
                        <label class="form-label" for="exampleInputNama">Nama Lengkap</label>
                        <input type="text" class="form-control" id="exampleInputNama" name="nama" placeholder="Input Nama" required value="<?= $data->nama ?>">
                    </div>
                    <div class="form-group">
                        <label class="form-label" for="exampleInputUsername">Username</label>
                        <input type="text" class="form-control" id="exampleInputUsername" name="username" placeholder="Input Username" required value="<?= $data->username ?>">
                    </div>
                    <?php if (auth()->user()->role == 'customer'): ?>
                        <div class="form-group">
                            <label class="form-label" for="exampleInputTelepon">Telepon</label>
                            <input type="text" class="form-control" id="exampleInputTelepon" name="telepon" placeholder="Input Telepon" required value="<?= $data->telepon ?>">
                        </div>
                        <!-- Address removed from customer master; not editable here -->
                    <?php endif ?>
                    <div class="form-group">
                        <label class="form-label" for="inputPassword">Password</label>
                        <div class="input-group mb-3">
                            <input type="password" id="inputPassword" name="password" minlength="8" class="form-control" placeholder="Password">
                            <div class="input-group-append">
                                <div class="input-group-text" onclick="toggle('inputPassword')">
                                    <span class="fas fa-lock" id="lock"></span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="form-label" for="RetypePassword">Confirm Password</label>
                        <div class="input-group mb-3">
                            <input type="password" id="RetypePassword" class="form-control" minlength="8" name="password_confirm" placeholder="Konfirmasi Password">
                            <div class="input-group-append">
                                <div class="input-group-text" onclick="toggle1('RetypePassword')">
                                    <span class="fas fa-lock" id="lock1"></span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <button type="submit" class="btn btn-primary">Simpan</button>
                </form>
            </div>
        </div>
    </div><!-- /.container-fluid -->
</section>
<?= $this->endSection() ?>