<?php $__env->startSection('content'); ?>

    <div class="right-side">
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    <!-- Starting of Dashboard Campaigns view details data-table area -->
                    <div class="section-padding add-product-1">
                        <div class="row">
                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                <div class="add-product-box">
                                    <div class="add-product-header campaigns">
                                        <h2>Campaign Details</h2>
                                        <a href="<?php echo url('user/campaign'); ?>" class="add-back-btn"><i class="fa fa-arrow-left"></i> Back</a>
                                    </div>
                                    <hr/>

                                    <div class="campaign-tab">
                                        <ul class="nav nav-tabs">
                                            <li class="active"><a data-toggle="tab" href="#campaignDetails">Campaign Details</a></li>
                                            <li><a data-toggle="tab" href="#donations">Donations</a></li>
                                            <li><a data-toggle="tab" href="#withdraws">Withdraws</a></li>
                                        </ul>

                                        <div class="tab-content">
                                            <div id="campaignDetails" class="tab-pane fade in active">
                                                <h3><?php echo e($campaign->title); ?> (<a href="<?php echo e($campaign->id); ?>/edit">Edit</a>)</h3>

                                                <div class="table-responsive">
                                                    <table class="table table-striped table-hover products dt-responsive nowrap" cellspacing="0" width="100%">
                                                        <tbody>
                                                        <tr>
                                                            <td width="30%"><strong>Campaign ID#</strong></td>
                                                            <td><?php echo e($campaign->id); ?></td>
                                                        </tr>
                                                        <tr>
                                                            <td width="30%"><strong>Campaign Status:</strong></td>
                                                            <td><?php echo e(ucfirst($campaign->status)); ?></td>
                                                        </tr>
                                                        <tr>
                                                            <td width="30%"><strong>Created On:</strong></td>
                                                            <td><?php echo e(date('Y-m-d h:i:sa',strtotime($campaign->created_at))); ?></td>
                                                        </tr>
                                                        <tr>
                                                            <td width="30%"><strong>Created By:</strong></td>
                                                            <td><?php echo e($campaign->createdby->name); ?>,<?php echo e($campaign->createdby->country); ?></td>
                                                        </tr>
                                                        <tr>
                                                            <td width="30%"><strong>Campaign Title:</strong></td>
                                                            <td><?php echo e($campaign->title); ?></td>
                                                        </tr>
                                                        <tr>
                                                            <td width="30%"><strong>Campaign Category:</strong></td>
                                                            <td><?php echo e($campaign->category); ?></td>
                                                        </tr>
                                                        <tr>
                                                            <td width="30%"><strong>Feature Image:</strong></td>
                                                            <td><img src="<?php echo e(url('assets/images/campaign')); ?>/<?php echo e($campaign->feature_image); ?>" alt=""></td>
                                                        </tr>
                                                        <tr>
                                                            <td width="30%"><strong>Campaign Video:</strong></td>
                                                            <td><?php echo \App\Campaign::getVideo($campaign->id); ?></td>
                                                        </tr>
                                                        <tr>
                                                            <td width="30%"><strong>Campaign Description:</strong></td>
                                                            <td><?php echo $campaign->description; ?></td>
                                                        </tr>
                                                        <tr>
                                                            <td width="30%"><strong>Campaign Goal:</strong></td>
                                                            <td><?php echo e($settings[0]->currency_sign); ?><?php echo e($campaign->goal); ?></td>
                                                        </tr>
                                                        <tr>
                                                            <td width="30%"><strong>Campaign End Date:</strong></td>
                                                            <td><?php echo e($campaign->end_date); ?></td>
                                                        </tr>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                            <div id="donations" class="tab-pane fade">
                                                <h3>Total Fund Received: <?php echo e($settings[0]->currency_sign); ?><?php echo e(\App\Donation::getFund($campaign->id)); ?></h3>
                                                <h3>Total Donations: <?php echo e(\App\Donation::getDonations($campaign->id)); ?></h3>

                                                <div class="table-responsive">
                                                    <table class="table table-striped table-hover products dt-responsive nowrap" cellspacing="0" width="100%">
                                                        <thead>
                                                        <tr>
                                                            <th>Name</th>
                                                            <th>Email</th>
                                                            <th>Donation Amount</th>
                                                        </tr>
                                                        </thead>

                                                        <tbody>
                                                        <?php $__empty_1 = true; $__currentLoopData = \App\Campaign::campDonations($campaign->id); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $donation): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                                            <tr>
                                                                <?php if($donation->anonymous != "yes"): ?>
                                                                    <td><?php echo e($donation->donator_name); ?></td>
                                                                    <td><?php echo e($donation->donator_email); ?></td>
                                                                <?php else: ?>
                                                                    <td colspan="2" style="color: darkred">Anonymous Donation</td>
                                                                <?php endif; ?>
                                                                <td><?php echo e($settings[0]->currency_sign); ?><?php echo e($donation->amount); ?></td>
                                                            </tr>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                                            <tr>
                                                                <td colspan="3">No Donations Yet.</td>
                                                            </tr>
                                                        <?php endif; ?>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                            <div id="withdraws" class="tab-pane fade">
                                                <h3>Total Withdrawals Made: <?php echo e($settings[0]->currency_sign); ?><?php echo e(\App\Withdraw::campWithdraw($campaign->id)); ?></h3>
                                                <?php if(\App\Withdraw::pendWithdraw($campaign->id) > 0): ?>
                                                    <h4>Withdraw Pending: <?php echo e($settings[0]->currency_sign); ?><?php echo e(\App\Withdraw::pendWithdraw($campaign->id)); ?></h4>
                                                <?php endif; ?>
                                                <h3>Available Fund: $<?php echo e($campaign->available_fund); ?></h3>

                                                <p><a href="<?php echo e(url('user/campaign/'.$campaign->id.'/withdraw')); ?>" class="btn btn-primary">Withdraw Now</a></p>

                                                <div class="table-responsive">
                                                    <table id="product-table_wrapper" class="table table-striped table-hover products dt-responsive nowrap" cellspacing="0" width="100%">
                                                        <thead>
                                                        <tr>
                                                            <th>Date</th>
                                                            <th>Withdraw Method</th>
                                                            <th>Account</th>
                                                            <th>Withdraw Amount</th>
                                                            <th>Charge</th>
                                                            <th>Status</th>
                                                        </tr>
                                                        </thead>

                                                        <tbody>
                                                        <?php $__empty_1 = true; $__currentLoopData = \App\Campaign::campWithdraws($campaign->id); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $withdraw): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                                            <tr>
                                                                <td><?php echo e($withdraw->created_at); ?></td>
                                                                <td><?php echo e($withdraw->method); ?></td>
                                                                <?php if($withdraw->method != "Bank"): ?>
                                                                    <td><?php echo e($withdraw->acc_email); ?></td>
                                                                <?php else: ?>
                                                                    <td><?php echo e($withdraw->iban); ?></td>
                                                                <?php endif; ?>
                                                                <td><?php echo e($settings[0]->currency_sign); ?><?php echo e($withdraw->amount); ?></td>
                                                                <td><?php echo e($settings[0]->currency_sign); ?><?php echo e($withdraw->fee); ?></td>
                                                                <td><label class="label label-default"><?php echo e(ucfirst($withdraw->status)); ?></label></td>
                                                            </tr>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                                            <tr>
                                                                <td colspan="6">No Withdrawals Made.</td>
                                                            </tr>
                                                        <?php endif; ?>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <hr/>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- Ending of Dashboard Campaigns view details data-table area -->


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

<?php $__env->stopSection(); ?>

<?php $__env->startSection('footer'); ?>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('user.includes.masterpage-user', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>