
<?php 
    include 'header.php'; 
    $id     = $_GET['id'];
    $noang  = $_GET['no'];
    $level  = $_SESSION['level'] ;
    $kdc  = $_SESSION['kdc'] ;
    $kel  = $_SESSION['kelurahan'] ;
    
    $tgl_ini= date('d-m-Y') ;
    
        $data = mysqli_query($koneksi, "select * from anggota where angg_id='$id'");
        $d = mysqli_fetch_assoc($data);  
            $noang=$d['angg_no'];


                $sql5 = mysqli_query($koneksi, "SELECT count(angg_no) AS tsimp_no,sum(masuk-keluar) AS tsaldo FROM anggota_trans_ao WHERE angg_no='$noang'");
                list($tsimp_no,$tsaldo) = mysqli_fetch_array($sql5);   

                $sql7 = mysqli_query($koneksi, "SELECT sp AS tsp,kecamatan AS kec, kota AS kota,kanca AS kanca FROM kdkanca WHERE kd=$kdc ");
                list($tsp,$kec,$kota,$kanca) = mysqli_fetch_array($sql7);
                $tsaldo_harus=($tsp-$tsaldo_pkk);
                

                
    if ($level=='SUP') {
        $kpd='Direktur' ;
    } 
    if ($level=='TOP') {
        $kpd='Supervisor' ;
    } 
    
        $sql5 = mysqli_query($koneksi, "SELECT id AS tkar_id FROM karyawan WHERE jabatan='$kpd'");
            list($tkar_id) = mysqli_fetch_array($sql5);          
        $sql6 = mysqli_query($koneksi, "SELECT hp AS tno_hp FROM karyawan_iden WHERE id='$tkar_id'");
            list($tno_hp) = mysqli_fetch_array($sql6);                      
?>              

<div class="container">
  <div class="my-4 border-bottom">
        <h3 class="fw-semibold fs-6">PROFIL DONATUR - <?php echo $kanca ?></h3>
  </div>
  <div class="row justify-content-center">
    <div class="col-lg-12">
    <div class="card">
    <div class="card-header d-flex justify-content-between">
      <span class="card-title fw-semibold align-self-start mb">IDENTITAS DIRI</span>
      <buton>
        <a href="index.php" class="btn btn-primary btn-sm"><i class="bi bi-house-fill"></i> &nbsp Home</a> 
        <?php if ($_SESSION['level']<>'ANGGOTA') { ?>
            <a href="javascript:history.go(-1)" class="btn btn-info btn-sm"><i class="bi bi-reply-all"></i> &nbsp Kembali</a>
        <?php } ?>
      </buton>
    </div>

          <div class="box-body">
            <form method="get" action="">
              <div class="row">
                <div class="col-lg-12">
                                  
                  <table class="table table-bordered">
                    <tr>
                    <?php if($_SESSION['level']<>'ANGGOTA') { ;?>
                      <th style="font-weight: normal" width="35%">Foto </th>
                    <?php } else { ;?>  
                        <th style="font-weight: normal" width="35%">Foto Diri </th>
                    <?php } ;?>  
                      <th width="1%">:</th>
                      <td>                    
                        <?php if($d['foto_diri'] == ""){ ?>
                          <img src="../gambar/user.png" style="width: 30px;height: auto">  
                        <?php }else{ ?>
                            <a href="#" class="pop">								    
                               <img width="800" height="800" 
                            src="../gambar/diri/<?php echo $d['foto_diri']; ?>" style="width: 100px;height: auto">
                            </a>             
                        <?php } ?>
                      </td>
                    </tr>                      
                    <tr>
                      <th style="font-weight: normal" width="35%">Nomor </th>
                      <th width="1%">:</th>
                      <td style="font-weight: bold" ><?php echo $d['angg_no'] ?></td>
                    </tr>
                    <tr>
                      <th style="font-weight: normal" >Nama </th>
                      <th>:</th>
                      <td style="font-weight: bold" ><?php echo $d['nama'] ?></td>
                    </tr>

                    <tr>
                      <th style="font-weight: normal" >Alamat</th>
                      <th>:</th>
                      <td style="font-weight: bold" ><?php echo $d['alamat'] ?>, RT <?php echo $d['rt'] ?> RW <?php echo $d['rw'] ?>, <?php echo $kel ?>, <?php echo $kec ?>, <?php echo $kota ?></td>
                    </tr>

                    <tr>
                      <th style="font-weight: normal" >Nomor HP </th>
                      <th>:</th>
                      <td style="font-weight: bold" ><?php echo $d['hp'] ?></td>
                    </tr>                      

                    <tr>
                      <th style="font-weight: normal" >Tanggal Daftar </th>
                      <th>:</th>
                      <td style="font-weight: bold" ><?php echo date('d-m-Y', strtotime($d['tglmasuk'])); ?></td>
                    </tr>  
<!-- 
                    <tr>
                      <th style="font-weight: normal" >Lengkapi Data Lain</th>
                      <th>:</th>
                      <td>
                          <a href="angg_isi_data_lain.php?id=<?php echo $id ?>" class="btn btn-info btn-sm"><i class="bi bi-card-list"></i> &nbsp Isi / Edit Data</a> 
                       <a href="!!!!!!!!!!_kode_unik.php?tid=<?php echo $id ?>" class="btn btn-info btn-sm"><i class="bi bi-card-list"></i> &nbsp Kode Unik</a> 

                        <?php if ($_SESSION['level']<>'ANGGOTA') { ?>
                          <a href="angg_ganti_password.php?tid=<?php echo $id ?>" class="btn btn-primary btn-sm"><i class="bi bi-key-fill"></i> &nbsp Reset Password</a> 
                          <a href="angg_wa_ganti_pasword.php?id=<?php echo $id ?>&hp=<?php echo $d['hp'] ?>" class="btn btn-success btn-sm"><i class="bi bi-person-check-fill"></i> &nbsp Kirim WA Reset Password</a> 
                        <?php } ?> 

                        <a href="angg_foto_diri.php?id=<?php echo $id ?>" class="btn btn-warning btn-sm"><i class="bi bi-camera"></i> &nbsp Ganti Foto-foto</a>
                      </td>
                    </tr>

                    <tr>
                      <th style="font-weight: normal" >Lihat Map Domisili </th>
                      <th>:</th>
                      <td>
                        <?php if($d['a_latitude'] == "" && $d['a_longitude'] == ""){ ?>
                          <div class="alert alert-danger">Lokasi g-map belum diisi.</div>
                          <div class="form-group mb-2">
                                  <a href="angg_isi_map.php?id=<?php echo $id ?>" class="btn btn-info btn-sm"><i class="bi bi-geo-alt"></i> &nbsp Isi Kode MAP</a> 
                          </div>                   
                        <?php }else{ ?>
                            <div class="form-group mb-2">
                                <a href="https://www.google.com/search?q=google+map+<?php echo $d['a_latitude'] ?>%2C+<?php echo $d['a_longitude'] ?>" target="_blank" class="btn btn-warning btn-sm pull-right"><i class="bi bi-shop"></i> &nbsp; ke Detail Google Map</a>
                            </div>                
                            <div class="form-group mb-2">
                                <?php if($_SESSION[level]<>'TOP'){ ?>
                                  <a href="angg_isi_map.php?id=<?php echo $id ?>" class="btn btn-danger btn-sm"><i class="bi bi-geo-alt"></i> &nbsp Isi / Ganti Kode MAP</a> 
                                <?php } ?>
                            </div> 
                        <?php } ?>
                      </td>
-->                      
                    </tr>  
                  </table>
                </div>
              </div>
              </div>
              
            </form>

          
          
<!-- ////////////////////////// SIMPANAN //////////////// -->  
<div>
    <?php if ($tsaldo>0) { 
        include 'tugas_angg_kartu_simpanan.php';
    ?>

<!-- ///////////////////////////SIMPANAN/////////////// -->         
        <?php } else { ?>
                <font color='#ff0000'  style="text-align:left; font-size: 8pt; font-weight:normal;"><i>Tuan <?php echo $d['nama'] ?> belum ada data TRANSAKSI....</i></font><br>
        <?php } ?>
<!-- ////////////////////////// SELESAI SIMPANAN  //////////////// --> 
</div>

        
      </div>
    </div>
  </div>
</div>
<?php include 'foot_ku.php'; ?>