<link rel="stylesheet" href="<?php echo base_url();?>assets/css/cust_paginition.css" type="text/css" />
<script src="<?php echo base_url(); ?>assets/library/jquery/jquery.min.js"></script>
<div class="modal-dialog" style="width: 1150px" align="center">
    <div class="modal-content">
        <!-- Modal heading -->
        <?php $this->load->view('admin/flashdata_admin'); ?>
        <div class="modal-header" align = "left">
            <a href="<?php echo base_url();?>index.php/subscriber/subscribe_product?user_id=<?php echo base64_encode($strUserId); ?>&tr_id=<?php echo $this->input->get('tr_id');?>" class=" pull-right mar" onclick="return fnCheckSelectedContent();"><button class="btn btn-info" type="button">Subscribe Magazines</button></a>
            <h4 class="modal-title" align="center"> Subscribe Campaign For  <span class="username_display">&nbsp;<?php echo ucwords($strUserName); ?></span></h4>
        </div>
        <div class="modal-body">
            <div class="innerAll">
                <div class="innerLR">
                    <div class="widget-body">
                        <form name="search_sub" id="subscribe_products" action ="<?php echo base_url();?>index.php/subscriber/subscribe_multiple_magazines" method ="post">
                            <input type="hidden" value="<?php echo $this->input->get('tr_id');?>" name="tr_id"/>
                            <?php if (count($arrData) > 0) {?>
                                <table class="table table-white table-vertical-center margin-none table-striped footable">
                                    <tr>
                                        <td>
                                            <label  class="col-sm-4 control-label text-left">Select Campaign: </label>
                                            <div class="col-sm-7">
                                                <select name="promo_code" id="promo_id" required="required" class="cust_select marl-n">
                                                    <option value="">--Select--</option>
                                                    <?php foreach ($arrData as $details) {?>
                                                        <option value="<?php echo $details['id'];?>"><?php echo $details['campeign_code'];?></option>
                                                    <?php } ?>
                                                </select>

                                            </div>
                                        </td>
                                    </tr>
                                    <tr id="append_magazine">

                                    </tr>
                                </table>

                                <div style="clear: both"></div>
                                <div class="form-group mmar">
                                    <div class="col-sm-15">
                                        <table class="table table-white table-vertical-center margin-none table-striped footable" id="list_new_magazines">
                                            <thead>
                                            <tr>
                                                <th></th>
                                                <th  class="text-center">Magzine Code</th>
                                                <th  class="text-center">Number of Years</th>
                                                <th  class="text-center">Amount</th>
                                                <th  class="text-center">Start Date </th>
                                                <th  class="text-center">End Date</th>
                                                <th  class="text-center">Start Issue</th>
                                                <th  class="text-center">End Issue</th>
                                                <th  class="text-center">Total Issue</th>
                                                <th  class="text-center">Edit</th>
                                                <th  class="text-center">Delete</th>

                                            </tr>
                                            </thead>
                                            <tbody id="table_body_camp">
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                <div style="clear: both"></div>
                                <div class="form-group" align="left" style="margin-top: 10px">
                                    <a href="#nnn" id="add_new_Magazine" data-toggle="modal" onclick="return add_magazine_to_campaign();"><i class="fa fa-fw fa-plus"></i>Choose Magazines to Subscribe</a>
                                    <input type="hidden" id="num_mag" value="0" />
                                </div>
                                <div class="form-group" align="center" style="margin-top: 10px">
                                    <div class="">
                                        <input type="hidden" id="system_base_url" value="<?php echo base_url();?>">
                                        <input type="hidden" name="subscriber_id" value="<?php echo base64_encode($strUserId);?>" >
                                        <button type="submit" class="btn btn-primary" id="sub_product">Submit</button>
                                        <a class="btn" href="<?php echo base_url(); ?>index.php/subscriber/subscriber_list"> <button type="button" class="btn btn-primary">Cancel</button></a>
                                    </div>
                                </div>
                            <?php } else {?>
                                Sorry!! No campaigns found.
                            <?php  } ?>
                        </form>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
<input type="hidden" id="system_base_url" value="<?php echo base_url();?>" />
<div class="modal fade" id="nnn" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content" id="tran_preview2">

        </div>
    </div>
</div>
<div class="modal fade" id="edit_campaign_details" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content" id="tran_preview3">

        </div>
    </div>
</div>
<script src="<?php echo base_url();?>assets/js/main.js" type="text/javascript"></script>
<script src="<?php echo base_url();?>assets/js/custom.js" type="text/javascript"></script>
<script src="<?php echo base_url(); ?>assets/js/subscriber.js"></script>
<script src="<?php echo base_url();?>assets/plugins/forms_elements_bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<script src="<?php echo base_url();?>assets/js/jquery.validationEngine-en.js" type="text/javascript"></script>
<script src="<?php echo base_url();?>assets/js/jquery.validationEngine.js" type="text/javascript"></script>

<script>
    $(document).ready(function() {
        $('.date').datepicker();
        $("#subscribe_products").validationEngine();
        $("#subscribe_magazine_campaign").validationEngine();
    });
    function fnCheckSelectedContent()
    {
        var intCountOfMagazines = $(":input[name='magezine_code[]']").length;
        if (intCountOfMagazines > 0) {
            alert("All the selected magazine details will be lost if you proceed !!!");
            return false;
        }
        var flag = confirm("Are you sure to proceed other way ?");
        return flag;
    }
</script>