<body class="wrap-all-content">

    <!-- Main -->

    <main role="main" class="container with-navbar" style="padding:0px 0px 0px 0px; max-width: 480px !important;">

        <!-- Content -->

    <nav class="container navbar fixed-top navbar-default p-0 title benihbaik_solid" style="max-width: 480px;background-color: #ffffff !important;">

        <div style="max-width: 480px !important; margin: 0px 30px;height: 100%;width: 100%; display: flex; align-items: center;">

            <span class="navbar-text title-navbar">

                <a href="" class="navbar-text mr-2">

                    <i class="fa fa-arrow-left title " style="color:#828282;"></i>

                </a>

            </span>

                

        </div>

    </nav>

<?php 

$terkumpul = 0;



$this->db->select('donasi_gdid, SUM(donasi_jml) as terkumpul');

$this->db->where('donasi_status', 2);

$this->db->where('donasi_gdid', $galang['gd_id']);

$query = $this->db->get('tb_donasi');



if ($query->row()->terkumpul > 0) {

    $terkumpul = $query->row()->terkumpul;

}

 ?>

    <?php if($terkumpul == 0) { ?>

    <?php }else { ?>

    <?php $progres = $galang['gd_dana'] / $terkumpul; ?>

    <?php $progres1 = 100 / $progres; ?>

    <?php } ?>

    <?php 

$batas_galang_dana_date = new DateTime($galang['gd_tgl_selesai']);

$tanggal_sekarang = new DateTime();

$interval = $tanggal_sekarang->diff($batas_galang_dana_date);

$jumlah_hari = $interval->days;

 ?>

 <?php 

        function waktu_lalu($timestamp) {

    $selisih = time() - strtotime($timestamp) ;

    $detik = $selisih ;

    $menit = round($selisih / 60 );

    $jam = round($selisih / 3600 );

    $hari = round($selisih / 86400 );

    $minggu = round($selisih / 604800 );

    $bulan = round($selisih / 2419200 );

    $tahun = round($selisih / 29030400 );

    if ($detik <= 60) {

        $waktu = $detik.' detik yang lalu';

    } else if ($menit <= 60) {

        $waktu = $menit.' menit yang lalu';

    } else if ($jam <= 24) {

        $waktu = $jam.' jam yang lalu';

    } else if ($hari <= 7) {

        $waktu = $hari.' hari yang lalu';

    } else if ($minggu <= 4) {

        $waktu = $minggu.' minggu yang lalu';

    } else if ($bulan <= 12) {

        $waktu = $bulan.' bulan yang lalu';

    } else {

        $waktu = $tahun.' tahun yang lalu';

    }

    return $waktu;

}

         ?>

    <div style="margin: 50px 30px 16px 30px;">

        <div class="range" style="position: relative;padding-top:15px;">

            <img class="img-fluid img-dompet-siaga" width="470" src="assets/home/img/<?php echo $galang['gd_foto']; ?>" alt="<?php echo $galang['gd_judul']; ?>">

        </div>

        

        <div class="range">

            <h1 class="subtitle2"><?php echo $galang['gd_judul']; ?></h1>

        </div>



        <div class="range">

            <div class="progress progres_bb" style="margin-bottom:8px;">

                <?php if($terkumpul == 0) { ?>
                <div class="progress-bar" style="width:0%;"></div>
                <?php }else { ?>
                <div class="progress-bar" style="width:<?php echo round($progres1); ?>%;"></div>
                <?php } ?>

            </div>



            <div class="row">

                <div class="col-9" style="padding-right:5px;">

                    <p class="jumlah-nominal">Rp <?php echo number_format($terkumpul,0,',','.'); ?>

                        <span class="nominal-desk">dari Rp <?php echo number_format($galang['gd_dana'],0,',','.'); ?></span>

                    </p>

                </div>



                <div class="col-3 text-right" style="padding-left:5px;" >

                    <span><span class="nominal">

                        <?php if($batas_galang_dana_date < $tanggal_sekarang) { ?>

                        

                    <?php }else { ?>

                        <?php echo $jumlah_hari; ?> hari lagi

                    <?php } ?>

                    </span></span>

                </div>

            </div>

        </div>   

                

        <div class="range" style="display:flex;">

<div style="width: 30%;padding-right:10px;">
                            <a class="foter-share unv-gtm" onclick="sharePopUp('bantu-ibnu-sembuh');" data-name="Klik Share Button" data-action="<?php echo $galang['gd_judul']; ?>" data-label="donasi/<?php echo $galang['gd_url']; ?>"><i class="fas fa-share-alt unv-gtm" style="padding-left:5px;padding-right:5px;" data-name="Klik Share Button" data-action="<?php echo $galang['gd_judul']; ?>" data-label="donasi/<?php echo $galang['gd_url']; ?>"></i> Bagikan</a>
                        </div>

            <div style="width: 70%;">

                <a href="konfirmasi-donasi/<?php echo $galang['gd_url']; ?>" style="text-decoration:none;color:white;"><button class="block unv-gtm" data-name="Klik Donasi Sekarang" data-action="<?php echo $galang['gd_judul']; ?>" data-label="<?php echo uri_string(); ?>">Donasi Sekarang</button></a>

            </div>

        </div> 



        <div class="range">

         <hr>

        </div>



        <div class="range">

            <p class="subtitle">Penggalang Dana</p>

            <div class="card-dana-terkumpul2">

                <div class="boxnya">

                    <img src="https://fastcdn.benihbaik.com/users/avatars/2021-10-27_1635327162_61791cba66181.jpg" alt="user" class="imgbox">

                    <div class="detailbox">

                        <span class="donatur"><?php echo $profil['nama']; ?> 

                            <img class="img-fluid img-responsive" src="https://m.benihbaik.com/img/home/ceklis.svg" alt="ceklis">

                        </span>

                        <span><span class="nominal">Identitas terverifikasi</span></span>

                    </div>

                </div>

            </div>

        </div>

                

        

    </div>



    <!-- cerita & donasi & aktifitas -->

    <div style="border-top:10px solid #f7f7f7;">

    </div>

    <div style="padding: 20px 30px 16px 30px;">   

        <div class="range">

                <ul class="nav nav-pills nav-fill">

                    <li class="nav-item" style="padding-right:16px;">

                        <a class="nav-link active font_benihbaik_judul" style="text-decoration: none; padding: 0px; border: 0px solid transparent; text-align: left;" id="cerita-tab" data-toggle="tab" href="#cerita" role="tab" aria-controls="home" aria-selected="true">

                            <div class="text-center tulisan-tombol-tab unv-gtm" data-name="Klik Cerita" data-action="Berawal Tak Sengaja Kena Lemparan Botol, Seketika Aleeza Didiagnosa Tumor Ganas!" data-label="https://m.benihbaik.com/campaign/bantu-aleeza-sembuh">Cerita</div>

                        </a>

                    </li>



                    <li class="nav-item" style="padding-right:16px;">

                        <a class="nav-link font_benihbaik_judul" style="text-decoration: none; padding: 0px; border: 0px solid transparent;" id="donasi-tab" data-toggle="tab" href="#donasi" role="tab" aria-controls="donasi" aria-selected="false">

                            <div class="text-center tulisan-tombol-tab unv-gtm" data-name="Klik Donasi" data-action="Berawal Tak Sengaja Kena Lemparan Botol, Seketika Aleeza Didiagnosa Tumor Ganas!" data-label="https://m.benihbaik.com/campaign/bantu-aleeza-sembuh" >Donasi</div>

                        </a>

                    </li>

                </ul>          

            </div>

            <div class="range">

                <hr>

            </div>

            <div class="range">

                

                <div class="tab-content" id="myTabContent">

                    <div class="tab-pane fade show active" id="cerita" role="tabpanel" aria-labelledby="cerita-tab">

                        <div id="bb_collapse" class="container bb_collapse_hide mb-3 ceritaImgFix" style="padding: 5px; font-size: 14px !important;">

                            <!-- <p class="font_benihbaik_judul" style="color: #9F9F9F; text-align:justify"> -->

                                <p dir="ltr" style="text-align: justify;"><?php echo $galang['gd_isi']; ?>&nbsp;</p>

                        </div>

                    </div>

                    <div class="tab-pane fade" id="donasi" role="tabpanel" aria-labelledby="donasi-tab">

                        <div id="scrollScreenDonatur" style="height:300px;overflow:scroll; padding:0px 1px 0px 1px;">

                            <div id="donatur_data">

                                        <div id="load" style="display: none;">

                                            <center><img data-src="https://m.benihbaik.com/benihbaik/img/91.gif" width="25px;" class="lazyload"></center>

                                        </div>

                                    <ul class="list-group list-group-flush">

                                        <?php foreach($listdonasi as $ld): ?>

                    <div class="container boxdonatur"><img src="assets/home/img/image_sementara/<?php echo $ld['user_foto']; ?>" onerror="this.onerror=null;this.src=https://m.benihbaik.com/img/image_sementara/image-not-found.png;" alt="user" class="imgbox">

                        <div class="detailbox">

                            <span class="donatur"><?php echo $ld['user_nama']; ?></span>  

                            <span><span class="nominal">Rp <?php echo number_format($ld['donasi_jml'],0,',','.'); ?></span></span>

                            <span class="desk"><?php echo $ld['donasi_doa']; ?></span>

                            <span class="desk2"><?php echo waktu_lalu($ld['donasi_time']); ?></span>

                        </div>

                    </div>

                <?php endforeach; ?>



                        </ul></div>

                        </div>

                        <br>

                        <center>

                            <a id="scrollBack" class="foter-share2 form-control text_bb">Donasi Terkini</a>

                        </center>



                    </div>

                </div>

            </div>

    </div>

    <!-- end cerita & donasi & aktifitas -->

    

    <div style="border-top:10px solid #f7f7f7;"></div>



    <div style="padding: 20px 30px 70px 30px;">

        <p class="subtitle2"> Bantu Campaign Lainnya </p>

        <!-- BenihBaik Bawah Campaign Lainnya -->

        <div>

            <div id="result">

                <div class="owl-carousel" id="BenihbaikSearch">

                                            

                        <?php foreach($sidegalang as $sgal): ?>

                            <?php 

$terkumpul = 0;



$this->db->select('donasi_gdid, SUM(donasi_jml) as terkumpul');

$this->db->where('donasi_status', 2);

$this->db->where('donasi_gdid', $sgal['gd_id']);

$query = $this->db->get('tb_donasi');



if ($query->row()->terkumpul > 0) {

    $terkumpul = $query->row()->terkumpul;

}

 ?>

                <?php if($terkumpul == 0) { ?>

                <?php }else { ?>

                <?php $progres = $sgal['gd_dana'] / $terkumpul; ?>

                <?php $progres1 = 100 / $progres; ?>

                <?php } ?>

                <?php 

$batas_galang_dana_date = new DateTime($sgal['gd_tgl_selesai']);

$tanggal_sekarang = new DateTime();

$interval = $tanggal_sekarang->diff($batas_galang_dana_date);

$jumlah_hari = $interval->days;

 ?>

                            <?php if($this->uri->segment(2) == $sgal['gd_url']) { ?>

                            <?php }else { ?>

                        <a href="donasi/<?php echo $sgal['gd_url']; ?>" style="text-decoration: none !important;" class="campaign-list" bb-title="<?php echo $sgal['gd_judul']; ?>"  bb-list="Detail" bb-author="YBI" bb-type="Bantu Campaign Lainnya" >

                            <div class="card mb-1" style="border-radius: 8px;" >

                                <div class="card-header-camp-pilihan p-0">

                                    <img class="card-img-top owl-lazy" style="object-fit: cover;height: 100%;" data-src="assets/home/img/<?php echo $sgal['gd_foto']; ?>" onError="this.onerror=null;this.src='https://m.benihbaik.com/img/image_sementara/image-not-found.png';" alt="<?php echo $sgal['gd_judul']; ?>">

                                </div>



                                <div class="card-body" style="padding: 10px 10px 0px 10px;">

                                    <h6 class="card-title font_benihbaik_judul title-rowcut" style="font-family:montserrat-bold;margin-bottom:15px;height: 2.8em; font-size:14px;line-height: 150%;"><b><?php echo $sgal['gd_judul']; ?></b></h6>

                                    <p class="user" style="font-size:13px;color:#828282;"><?php echo $profil['nama']; ?> <img class="img-fluid img-responsive" style="width:5%;margin-left: 8px; margin-top: 2px;" src="https://m.benihbaik.com/img/home/ceklis.svg" alt="ceklis"> </p>



                                    <div class="progress" style="margin-bottom:5px; height:5px;">

                                        <?php if($terkumpul == 0) { ?>
                                        <div class="progress-bar" style="width:0%;"></div>
                                        <?php }else { ?>
                                        <div class="progress-bar" style="width:<?php echo round($progres1); ?>%;"></div>
                                        <?php } ?>

                                    </div>



                                     <div class="row" style="margin-bottom:15px;padding-right: 1em;padding-left: 1em;">

                                        <div class="col-md-12 nomargin">

                                            <div class="float-left">

                                                <p class="card-text mt-1" style="color:#23B570;font-size: 12px;font-family:montserrat-bold;">

                                                    <b>Rp <?php echo number_format($sgal['gd_dana'],0,',','.'); ?></b>

                                                </p>

                                            </div>

                                            <div class="float-right">

                                                <p class="card-text mt-1" style="color:#626262;font-size: 12px;font-family:montserrat-regular;">

                                                    <b>

                                                        <?php if($batas_galang_dana_date < $tanggal_sekarang) { ?>

                                                

                                            <?php }else { ?>

                                                <?php echo $jumlah_hari; ?> hari lagi

                                            <?php } ?>

                                                    </b>

                                                </p>

                                            </div>

                                        </div>

                                    </div>

                                </div>

                            </div>

                        </a>

                        <?php } ?>

                    <?php endforeach; ?>

                    </div>

            </div>

        </div>

    </div>



    <div class="range foter-bottom" id="footer" style="display:none;">

        <div class="foter1">



            <div style="width: 100%;display: flex;"><a href="konfirmasi-donasi/<?php echo $galang['gd_url']; ?>" style="text-decoration:none;color:white;" class="block text-center unv-gtm" data-name="Klik Donasi Sekarang" data-action="<?php echo $galang['gd_judul']; ?>" data-label="<?php echo uri_string(); ?>">Donasi Sekarang</a>

            </div>

        </div>

    </div>