<?php 
    echo "<div class='col-md-12'>
              <div class='box box-info'>
                <div class='box-header with-border'>
                  <h3 class='box-title'>Detail data Donasi $_GET[oleh]</h3>
                </div>
              <div class='box-body'>";
              $attributes = array('class'=>'form-horizontal','role'=>'form');
              echo form_open_multipart($this->uri->segment(1).'/edit_donasi_kategori',$attributes); 
              $donasi_terkumpul = $this->db->query("SELECT sum(nominal_donasi) as total FROM ds_donasi_masuk where id_donasi='$rows[id_donasi]' AND status_donasi='Dibayar'")->row_array();
          echo "<div class='col-md-6'>
                  <table class='table table-condensed'>
                  <tbody>
                    <input type='hidden' name='id' value='$rows[id_donasi]'>
                    <tr><th width='120px' scope='row'>Judul</th>    <td><input type='text' class='form-control' value='$rows[judul]' name='judul' required></td></tr>
                    <tr><th scope='row'>Kategori</th>    <td><select class='form-control' name='id_donasi_kategori' required>
                                                              <option value='' selected>- Pilih -</option>";
                                                              $ds_donasi = $this->db->query("SELECT * FROM ds_donasi_kategori ORDER BY id_donasi_kategori ASC");
                                                              foreach ($ds_donasi->result_array() as $row) {
                                                                if ($rows['id_donasi_kategori']==$row['id_donasi_kategori']){
                                                                  echo "<option value='$row[id_donasi_kategori]' selected>$row[nama_donasi]</option>";
                                                                }else{
                                                                  echo "<option value='$row[id_donasi_kategori]'>$row[nama_donasi]</option>";
                                                                }
                                                              }
                                                                echo "</select></td></tr>
                    <tr><th scope='row'>Deskripsi</th>    <td><textarea class='form-control' name='deskripsi' style='height:200px' required>$rows[deskripsi]</textarea></td></tr>
                    <tr><th scope='row'>Target Dana</th>    <td><input type='text' style='color:red' class='form-control formatNumber' name='target_dana' value='".rupiah($rows['target_dana'])."' required></td></tr>
                    <tr><th scope='row'>Berakhir</th>    <td><input type='date' class='form-control' name='akhir_periode' value='$rows[akhir_periode]' required></td></tr>
                    <tr><th scope='row'>Alamat</th>    <td><textarea class='form-control' name='alamat' style='height:100px' required>$rows[alamat]</textarea></td></tr>
                    <tr><th scope='row'>Foto</th>    <td><input type='file' class='form-control' name='lampiran'>";
                    if ($rows['lampiran']!=''){ echo "Lampiran : <a href='".base_url()."members/download/$rows[lampiran]'>$rows[lampiran]</a>"; }
                    echo "</td></tr>
                  </tbody>
                  </table>
                  </div>

                  <div class='col-md-6'>
                    <div style='background:#f4f4f4; border-bottom:3px solid orange; border-radius:10px; margin-bottom:25px; padding:10px 20px'>
                     <p style='text-transform:uppercase; color:#8a8a8a; margin:0px'>Total Donasi Terkumpul</p>                                         
                     <h2 style='margin:0px'>Rp. ".rupiah($donasi_terkumpul['total'])."</h2> 
                    </div>
                    
                    <div class='table-responsive'>
                      <table id='example1' class='table table-bordered table-striped table-condensed'>
                        <thead>
                          <tr>
                            <th style='width:20px'>No</th>
                            <th>Nama</th>
                            <th>Jumlah</th>
                            <th>Tanggal</th>
                            <th>Status</th>
                          </tr>
                        </thead>
                        <tbody>";
                        $no = 1;
                        $donasi_masuk = $this->db->query("SELECT * FROM ds_donasi_masuk a JOIN rb_konsumen b ON a.id_konsumen=b.id_konsumen where a.id_donasi='$rows[id_donasi]' ORDER BY id_donasi_masuk DESC");
                        foreach ($donasi_masuk->result_array() as $row){
                        echo "<tr><td>$no</td>
                                  <td>$row[nama_lengkap]</td>
                                  <td>".rupiah($row['nominal_donasi'])."</td>
                                  <td>".jam_tgl_indo($row['waktu_donasi'])."</td>
                                  <td>".status_donasi($row['status_donasi'])."</td>
                              </tr>";
                          $no++;
                        }
                        echo "</tbody>
                    </table>
                  </div>
                  </div>
                </div>
              
              <div class='box-footer'>
                <button type='submit' name='submit' class='btn btn-info'>Simpan</button>
                <a href='#' onclick=\"window.history.go(-1); return false;\"><button type='button' class='btn btn-default pull-right'>Cancel</button></a>
              </div>

            </div></div></div>";
            echo form_close();