<?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 Update New Campaign 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">
                                        <h2>Update Campaign</h2>
                                        <a href="<?php echo url('admin/campaign'); ?>" class="add-back-btn"><i class="fa fa-arrow-left"></i> Back</a>
                                    </div>
                                    <hr/>
                                    <form method="POST" action="<?php echo action('CampaignController@update',['id'=> $campaign->id]); ?>" id="add_form" class="form-horizontal"  enctype="multipart/form-data">
                                        <?php echo e(csrf_field()); ?>

                                        <input type="hidden" name="_method" value="PATCH">
                                        <div class="form-group">
                                            <label class="control-label col-sm-3" for="update_campaign_name">Campaign Name*</label>
                                            <div class="col-sm-8">
                                                <input type="text" class="form-control" name="title" value="<?php echo e($campaign->title); ?>" id="update_campaign_name" placeholder="Enter Campaign Name" required>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-sm-3" for="update_select_campaign_category">Select Category *</label>
                                            <div class="col-sm-8">
                                                <select class="form-control" name="update_select_campaign_category" id="update_select_campaign_category">
                                                    <option value="">Select Category</option>
                                                    <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <?php if($category->name == $campaign->category): ?>
                                                            <option value="<?php echo e($category->name); ?>" selected><?php echo e($category->name); ?></option>
                                                        <?php else: ?>
                                                            <option value="<?php echo e($category->name); ?>"><?php echo e($category->name); ?></option>
                                                        <?php endif; ?>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-sm-3" for="update_current_feature_photo">Current Feature Photo*</label>
                                            <div class="col-sm-8">
                                                <img src="<?php echo e(url('/')); ?>/assets/images/campaign/<?php echo e($campaign->feature_image); ?>" style="max-width: 200px;" alt="No Photo Added" id="docphoto">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-sm-3" for="update_current_feature_photo">Feature Photo *</label>
                                            <div class="col-sm-8">
                                                <input type="file" accept="image/*" name="photo" class="hidden" onchange="readURL(this)" id="uploadFile"/>
                                                <div id="uploadTrigger" class="btn btn-default form-control">
                                                    <i class="fa fa-upload"></i> <span>Add Feature Photo</span>
                                                </div>
                                                <p>Prefered Image Ratio: (16:9)</p>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-sm-3" for="update_campaign_description">Campaign Description*</label>
                                            <div class="col-sm-8">
                                                <textarea class="form-control" name="update_campaign_description" id="update_campaign_description" rows="5" placeholder="Campaign Description" style="resize: vertical;"  required><?php echo e($campaign->description); ?></textarea>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-sm-3" for="update_campaign_video_link">Campaign Video Link* <span>(Youtube urls only)</span></label>
                                            <div class="col-sm-8">
                                                <input type="text" class="form-control" name="video_link" value="<?php echo e($campaign->video_link); ?>" id="update_campaign_video_link" placeholder="Campaign Video Link">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-sm-3" for="update_campaign_end_date">End Date*</label>
                                            <div class="col-sm-8">
                                                <input type="text" class="form-control datepick" name="end_date" value="<?php echo e($campaign->end_date); ?>" id="update_campaign_end_date" placeholder="Enter End Date" required>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-sm-3" for="update_campaign_goal">Goal* <span>in USD($)</span></label>
                                            <div class="col-sm-8">
                                                <input type="number" class="form-control" name="goal" value="<?php echo e($campaign->goal); ?>" id="update_campaign_goal" placeholder="Campaign Goal" required>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-sm-3" for="update_campaign_preloaded_amount">Preloaded Amount(Optional)* <span>Seperated By Comma(,)</span></label>
                                            <div class="col-sm-8">
                                                <input type="text" class="form-control" name="preloaded_amount" value="<?php echo e($campaign->preloaded_amount); ?>" id="update_campaign_preloaded_amount" placeholder="Preloaded Amount">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-sm-3" for="update_close_campaign_after">Close Campaign After*</label>
                                            <div class="col-sm-6">
                                                <label class="radio-inline">
                                                    <?php if($campaign->end_after == "goal"): ?>
                                                        <input type="radio" name="end_after" value="goal" required checked>
                                                    <?php else: ?>
                                                        <input type="radio" name="end_after" value="goal" required>
                                                    <?php endif; ?>
                                                    Achieving Goal
                                                </label>
                                                <label class="radio-inline">
                                                    <?php if($campaign->end_after == "date"): ?>
                                                        <input type="radio" name="end_after" value="date" required checked>
                                                    <?php else: ?>
                                                        <input type="radio" name="end_after" value="date" required>
                                                    <?php endif; ?>
                                                    End Date
                                                </label>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-sm-3"></label>
                                            <div class="col-sm-8" data-toggle="buttons">
                                                <?php if($campaign->featured == 1): ?>
                                                    <label class="btn btn-default active">
                                                        <input type="checkbox" name="featured" value="1" autocomplete="off" checked>
                                                        <span class="go_checkbox"><i class="glyphicon glyphicon-ok"></i></span>
                                                        Add to Featured Campaign
                                                    </label>
                                                <?php else: ?>
                                                    <label class="btn btn-default">
                                                        <input type="checkbox" name="featured" value="1" autocomplete="off">
                                                        <span class="go_checkbox"><i class="glyphicon glyphicon-ok"></i></span>
                                                        Add to Featured Campaign
                                                    </label>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                        <hr/>
                                        <div class="add-product-footer">
                                            <button name="addProduct_btn" type="submit" class="btn btn-success add-product_btn">Update Campaign</button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- Ending of Dashboard Update New Campaign area -->


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

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

        $(".datepick").datepicker({
            minDate: new Date(),
            dateFormat: 'yy-mm-dd'
        });

        $("#uploadTrigger").click(function(){
            $("#uploadFile").click();
            $("#uploadFile").change(function(event) {
                $("#uploadTrigger").html($("#uploadFile").val());
            });
        });
        function readURL(input) {

            if (input.files && input.files[0]) {
                var reader = new FileReader();

                reader.onload = function (e) {
                    $('#docphoto').attr('src', e.target.result);
                };

                reader.readAsDataURL(input.files[0]);
            }
        }
        bkLib.onDomLoaded(function() {
            new nicEditor().panelInstance('update_campaign_description');
        });
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.includes.masterpage-admin', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>