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

    <!-- <div class="se-pre-con"></div> -->
    <!-- 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;">
    <div class="nav-wrapper">
        <div class="navbar-text title-navbar box-nav">
            <a href="/" class="navbar-text back">
                <i class="fa fa-arrow-left" style="color:#828282;"></i>
            </a>
            <?php if($this->uri->segment(1) == 'kategori-campaign') { ?>
            <span class="title-nav"><?php echo $title; ?></span>
            <?php }else { ?>
            <span class="title-nav">List Campaign Hari Ini</span>
            <?php } ?>
        </div>
    </div>
</nav>

<div class="main-wrapper">
    <div style="padding: 40px 0px 40px 0px;">
            

            <div class="box-wrap">

                <!-- <h1 class="title-box" style="margin: 0px">Pilihan Benihbaik</h1> -->

                <div class="wrapper-list-camp" id="list_campaign">
                    <div id="loading-image" style="margin-top: 45px; display: none;">
                        <div class="ph-item" style="padding:10px;border-radius: 6px;box-shadow: 0 4px 20px rgb(0 0 0 / 10%) !important;margin-bottom:5px;">
                            <div class="ph-col-5" style="padding-left: 0px;padding-right: 0px;margin-bottom:0px;">
                                <div class="ph-picture tinggi-gambar" style="border-radius: 5px;background-color: #F4F4F4;height: 87px;"></div>
                            </div>
                            <div style="margin-bottom: 0px;">
                                <div class="ph-row">
                                    <div class="ph-col-12 big" style="background-color: #F4F4F4;"></div>
                                    <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                    <div class="ph-col-12" style="height: 5px;border-radius:4px;background-color: #F4F4F4;"></div>
                                    <div class="ph-col-6" style="background-color: #F4F4F4;"></div>
                                    <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                </div>
                            </div>
                        </div>

                        <div class="ph-item" style="padding:10px;border-radius: 6px;box-shadow: 0 4px 20px rgb(0 0 0 / 10%) !important;margin-bottom:5px;">
                            <div class="ph-col-5" style="padding-left: 0px;padding-right: 0px;margin-bottom:0px;">
                                <div class="ph-picture tinggi-gambar" style="border-radius: 5px;background-color: #F4F4F4;height: 87px;"></div>
                            </div>
                            <div style="margin-bottom: 0px;">
                                <div class="ph-row">
                                    <div class="ph-col-12 big" style="background-color: #F4F4F4;"></div>
                                    <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                    <div class="ph-col-12" style="height: 5px;border-radius:4px;background-color: #F4F4F4;"></div>
                                    <div class="ph-col-6" style="background-color: #F4F4F4;"></div>
                                    <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                </div>
                            </div>
                        </div>

                        <div class="ph-item" style="padding:10px;border-radius: 6px;box-shadow: 0 4px 20px rgb(0 0 0 / 10%) !important;margin-bottom:5px;">
                            <div class="ph-col-5" style="padding-left: 0px;padding-right: 0px;margin-bottom:0px;">
                                <div class="ph-picture tinggi-gambar" style="border-radius: 5px;background-color: #F4F4F4;height: 87px;"></div>
                            </div>
                            <div style="margin-bottom: 0px;">
                                <div class="ph-row">
                                    <div class="ph-col-12 big" style="background-color: #F4F4F4;"></div>
                                    <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                    <div class="ph-col-12" style="height: 5px;border-radius:4px;background-color: #F4F4F4;"></div>
                                    <div class="ph-col-6" style="background-color: #F4F4F4;"></div>
                                    <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                </div>
                            </div>
                        </div>

                        <div class="ph-item" style="padding:10px;border-radius: 6px;box-shadow: 0 4px 20px rgb(0 0 0 / 10%) !important;margin-bottom:5px;">
                            <div class="ph-col-5" style="padding-left: 0px;padding-right: 0px;margin-bottom:0px;">
                                <div class="ph-picture tinggi-gambar" style="border-radius: 5px;background-color: #F4F4F4;height: 87px;"></div>
                            </div>
                            <div style="margin-bottom: 0px;">
                                <div class="ph-row">
                                    <div class="ph-col-12 big" style="background-color: #F4F4F4;"></div>
                                    <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                    <div class="ph-col-12" style="height: 5px;border-radius:4px;background-color: #F4F4F4;"></div>
                                    <div class="ph-col-6" style="background-color: #F4F4F4;"></div>
                                    <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                </div>
                            </div>
                        </div>

                        <div class="ph-item" style="padding:10px;border-radius: 6px;box-shadow: 0 4px 20px rgb(0 0 0 / 10%) !important;margin-bottom:5px;">
                                <div class="ph-col-5" style="padding-left: 0px;padding-right: 0px;margin-bottom:0px;">
                                    <div class="ph-picture tinggi-gambar" style="border-radius: 5px;background-color: #F4F4F4;height: 87px;"></div>
                                </div>
                                <div style="margin-bottom: 0px;">
                                    <div class="ph-row">
                                        <div class="ph-col-12 big" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="height: 5px;border-radius:4px;background-color: #F4F4F4;"></div>
                                        <div class="ph-col-6" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                    </div>
                                </div>
                            </div>

                            <div class="ph-item" style="padding:10px;border-radius: 6px;box-shadow: 0 4px 20px rgb(0 0 0 / 10%) !important;margin-bottom:5px;">
                                <div class="ph-col-5" style="padding-left: 0px;padding-right: 0px;margin-bottom:0px;">
                                    <div class="ph-picture tinggi-gambar" style="border-radius: 5px;background-color: #F4F4F4;height: 87px;"></div>
                                </div>
                                <div style="margin-bottom: 0px;">
                                    <div class="ph-row">
                                        <div class="ph-col-12 big" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="height: 5px;border-radius:4px;background-color: #F4F4F4;"></div>
                                        <div class="ph-col-6" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                    </div>
                                </div>
                            </div>

                            <div class="ph-item" style="padding:10px;border-radius: 6px;box-shadow: 0 4px 20px rgb(0 0 0 / 10%) !important;margin-bottom:5px;">
                                <div class="ph-col-5" style="padding-left: 0px;padding-right: 0px;margin-bottom:0px;">
                                    <div class="ph-picture tinggi-gambar" style="border-radius: 5px;background-color: #F4F4F4;height: 87px;"></div>
                                </div>
                                <div style="margin-bottom: 0px;">
                                    <div class="ph-row">
                                        <div class="ph-col-12 big" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="height: 5px;border-radius:4px;background-color: #F4F4F4;"></div>
                                        <div class="ph-col-6" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                    </div>
                                </div>
                            </div>

                            <div class="ph-item" style="padding:10px;border-radius: 6px;box-shadow: 0 4px 20px rgb(0 0 0 / 10%) !important;margin-bottom:5px;">
                                <div class="ph-col-5" style="padding-left: 0px;padding-right: 0px;margin-bottom:0px;">
                                    <div class="ph-picture tinggi-gambar" style="border-radius: 5px;background-color: #F4F4F4;height: 87px;"></div>
                                </div>
                                <div style="margin-bottom: 0px;">
                                    <div class="ph-row">
                                        <div class="ph-col-12 big" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="height: 5px;border-radius:4px;background-color: #F4F4F4;"></div>
                                        <div class="ph-col-6" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                    </div>
                                </div>
                            </div>

                            <div class="ph-item" style="padding:10px;border-radius: 6px;box-shadow: 0 4px 20px rgb(0 0 0 / 10%) !important;margin-bottom:5px;">
                                <div class="ph-col-5" style="padding-left: 0px;padding-right: 0px;margin-bottom:0px;">
                                    <div class="ph-picture tinggi-gambar" style="border-radius: 5px;background-color: #F4F4F4;height: 87px;"></div>
                                </div>
                                <div style="margin-bottom: 0px;">
                                    <div class="ph-row">
                                        <div class="ph-col-12 big" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="height: 5px;border-radius:4px;background-color: #F4F4F4;"></div>
                                        <div class="ph-col-6" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                    </div>
                                </div>
                            </div>

                            <div class="ph-item" style="padding:10px;border-radius: 6px;box-shadow: 0 4px 20px rgb(0 0 0 / 10%) !important;margin-bottom:5px;">
                                <div class="ph-col-5" style="padding-left: 0px;padding-right: 0px;margin-bottom:0px;">
                                    <div class="ph-picture tinggi-gambar" style="border-radius: 5px;background-color: #F4F4F4;height: 87px;"></div>
                                </div>
                                <div style="margin-bottom: 0px;">
                                    <div class="ph-row">
                                        <div class="ph-col-12 big" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="height: 5px;border-radius:4px;background-color: #F4F4F4;"></div>
                                        <div class="ph-col-6" style="background-color: #F4F4F4;"></div>
                                        <div class="ph-col-12" style="background-color: #F4F4F4;"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                
    <?php foreach($galang as $gal): ?>
        <?php 
$batas_galang_dana_date = new DateTime($gal['gd_tgl_selesai']);
$tanggal_sekarang = new DateTime();
$interval = $tanggal_sekarang->diff($batas_galang_dana_date);
$jumlah_hari = $interval->days;
 ?>
 <?php 
$terkumpul = 0;

$this->db->select('donasi_gdid, SUM(donasi_jml) as terkumpul');
$this->db->where('donasi_status', 2);
$this->db->where('donasi_gdid', $gal['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 = $gal['gd_dana'] / $terkumpul; ?>
                <?php $progres1 = 100 / $progres; ?>
                <?php } ?>
    <a class="item-list" href="donasi/<?php echo $gal['gd_url']; ?>">
        <img class="thumb-list" src="assets/home/img/<?php echo $gal['gd_foto']; ?>" alt="thumb-list" onerror="this.onerror=null;this.src='assets/home/img/<?php echo $gal['gd_foto']; ?>';">
        <div class="info-camp">
            <h3 class="title-list-camp"><?php echo $gal['gd_judul']; ?></h3> 
            <p class="user"><?php echo $profil['nama']; ?> <span class="verif"><i class="fa fa-check" aria-hidden="true"></i></span> </p>
            <div class="box-progress progress-list-camp">
                <span style="width:<?php echo round($progres1); ?>%;"><span class="progress"></span></span>
            </div>
            <div class="collected-text">Dana terkumpul</div>
            <div class="collected">
                <span class="nominal-list">Rp <?php echo number_format($terkumpul,0,',','.'); ?></span>             
                <span class="left-day-list">
                    <?php if($batas_galang_dana_date < $tanggal_sekarang) { ?>
                    <?php }else { ?>
                        <?php echo $jumlah_hari; ?> hari lagi
                    <?php } ?>
                </span> 
            </div>
        </div>
    </a>
    <?php endforeach ?>


    </div>
            </div>
        </div>
    </div>
</div>

        <!-- Content -->
    </main>
    <!-- Main -->