<?php $this->load->view('header') ?>
      <div class="content">
            <div class="container-fluid">
            <?php if($get_campaign_one) { ?>
                <div class="row">
                    <div class="col-md-6">
                        <div class="card ">
                            <div class="header" style="margin-bottom:15px;">
                                <div class="pull-left">

                                    <h4 class="title"><i class="pe-7s-note2"></i> Logs For Campaign <?php echo $get_campaign_one->c_name; ?></h4>
                                </div>
                            </div>
                            <div class="content">
                                 <div class="table-full-width">
                                    <table class="table">
                                        <tbody>
                                            <tr>
                                                <th>IP</th>
                                                <th>Time Of Visit</th>
                                                <th>Coupon Offered</th>
                                            </tr>
                                            <?php if($get_coupons_used) { 
                                                foreach ($get_coupons_used as  $value) { ?>
                                                <tr>
                                                    <td><?php echo $value->ip_use; ?></td>
                                                    <td><?php echo $value->time_visit; ?></td>
                                                    <td><?php echo $value->c_coupons; ?></td>
                                                </tr>
                                            <?php } }?>


                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="card ">
                            <div class="header" style="margin-bottom:15px;">
                                <div class="pull-left">
                                    <h4 class="title"><i class="pe-7s-note2"></i> Coupons For Campaign <?php echo $get_campaign_one->c_name; ?></h4>
                                </div>
                            </div>
                            <div class="content">
                                <?php 
                                $unused_count = 0; $used_count = 0;
                                if($get_coupons_unused){
                                    foreach ($get_coupons_unused as  $value) {
                                        $unused_count += 1;
                                    }
                                }
                                if($get_coupons_used){
                                    foreach ($get_coupons_used as  $value) {
                                        $used_count += 1;
                                    }    
                                }                              
                                ?>
                                 <p>There are <b style="color:#0F0;"><?php echo $unused_count; ?></b> unused coupons and <b style="color:#F00;"><?php echo $used_count; ?></b> used coupons.</p>
                                 <p>&nbsp;</p>
                                 <hr>
                                 <h4>Unused Coupons:</h4>
                                 <p><textarea cols="60" rows="10" class="form-control"><?php echo $get_campaign_one->c_coupons; ?></textarea></p>
                                 <p>&nbsp;</p>
                                 <hr>
                                 <h4>Used Coupons:</h4>
                                 <p><textarea cols="60" rows="10" class="form-control"><?php if($get_coupons_used) {foreach ($get_coupons_used as  $value) {  echo $value->c_coupons;} }?></textarea></p>
                            </div>
                        </div>
                    </div>
                </div>
                
                <?php } ?>

        </div>




    </div>
</div>


</body>
    <!--   Core JS Files and PerfectScrollbar library inside jquery.ui   -->
    <script src="<?php echo base_url(); ?>assets/js/jquery.min.js" type="text/javascript"></script>
    <script src="<?php echo base_url(); ?>assets/js/jquery-ui.min.js" type="text/javascript"></script>
    <script src="<?php echo base_url(); ?>assets/js/bootstrap.min.js" type="text/javascript"></script>


    <!--  Forms Validations Plugin -->
    <script src="<?php echo base_url(); ?>assets/js/jquery.validate.min.js"></script>

    <!--  Plugin for Date Time Picker and Full Calendar Plugin-->
    <script src="<?php echo base_url(); ?>assets/js/moment.min.js"></script>

    <!--  Date Time Picker Plugin is included in this js file -->
    <script src="<?php echo base_url(); ?>assets/js/bootstrap-datetimepicker.js"></script>

    <!--  Select Picker Plugin -->
    <script src="<?php echo base_url(); ?>assets/js/bootstrap-selectpicker.js"></script>

    <!--  Checkbox, Radio, Switch and Tags Input Plugins -->
    <script src="<?php echo base_url(); ?>assets/js/bootstrap-checkbox-radio-switch-tags.js"></script>

    <!--  Charts Plugin -->
    <script src="<?php echo base_url(); ?>assets/js/chartist.min.js"></script>

    <!--  Notifications Plugin    -->
    <script src="<?php echo base_url(); ?>assets/js/bootstrap-notify.js"></script>

    <!-- Sweet Alert 2 plugin -->
    <script src="<?php echo base_url(); ?>assets/js/sweetalert2.js"></script>

    <!-- Vector Map plugin -->
    <script src="<?php echo base_url(); ?>assets/js/jquery-jvectormap.js"></script>

    <!-- Wizard Plugin    -->
    <script src="<?php echo base_url(); ?>assets/js/jquery.bootstrap.wizard.min.js"></script>

    <!--  Bootstrap Table Plugin    -->
    <script src="<?php echo base_url(); ?>assets/js/bootstrap-table.js"></script>

    <!--  Plugin for DataTables.net  -->
    <script src="<?php echo base_url(); ?>assets/js/jquery.datatables.js"></script>


    <!--  Full Calendar Plugin    -->
    <script src="<?php echo base_url(); ?>assets/js/fullcalendar.min.js"></script>

    <!-- Light Bootstrap Dashboard Core javascript and methods -->
    <script src="<?php echo base_url(); ?>assets/js/light-bootstrap-dashboard.js"></script>



    <script type="text/javascript">
    function showerror(msg)
            {
            $.notify(
                {
                icon: "pe-7s-bell",
                message: msg
                },
                {
                type: 'danger',
                timer: 5000,
                placement: 
                    {
                    from: 'top',
                    align: 'center'
                    }
                });
            }
                    
        function showsuccess(msg)
            {
            $.notify(
                {
                icon: "pe-7s-smile",
                message: msg
                },
                {
                type: 'success',
                timer: 5000,
                placement: 
                    {
                    from: 'top',
                    align: 'center'
                    }
                });
            }
            
        function showdelete(slug)
            {
            if (confirm("Are you sure you want to remove this campaign?") == true) 
                {
                document.location="removecampaign.php?c="+slug;
                }   
            }
            
        function showedit(slug)
            {
            document.location="edit.php?c="+slug;
            }
            
        function showstats(slug)
            {
            document.location="stats.php?c="+slug;
            }
            
        function SelectAll(id)
            {
            document.getElementById(id).focus();
            document.getElementById(id).select();

            }
            
        function showcode(domain,slug)
            {
                swal({
                  title: 'Embed Code:',
                  type: 'info',
                  html:
                    '<textarea class="form-control" rows="5" cols="50" id="cfcode" onclick="SelectAll(\'cfcode\');"><iframe src="https://'+domain+'/'+slug+'/" style="width: 100%;height: 100px;overflow-y: hidden;" frameborder="0" scrolling="no"></iframe></textarea>',
                  showCloseButton: true,
                  confirmButtonText:
                    'All Done!'
                });
            }
        
    
        $(document).ready(function(){           
            
                        

        });
    </script>

</html>