<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="layout-app">
				<div class="container"><div class="row row-app">
					<div class="col-md-12">
						<div class="col-separator col-separator-first col-unscrollable bg-none">
							<div class="col-table">
								<div class="row">
									<div class="col-md-12">
										<div class="widget">
											<?php $this->load->view('admin/flashdata_admin'); ?>
											<div class="widget-head">
												
												<a href="#addPromo" data-toggle="modal" class="btn btn-inverse pull-right mar" onclick="return add_subscriber();"><i class="fa fa-fw fa-plus"></i>Add Subscriber</a>
												
												<h4 class="heading">Subscribers</h4>

											</div>

											<div class="widget-body">
												<form name = "search_sub" action = "" method = "" >
												<div class="col-md-12 selectBox">
													<div class="col-sm-3 bot-mar">
														<label>Search Subscriber</label>
                                                        <input type="text" class="form-control" name = "search_value" value = "<?php echo $strSearchKey; ?>" placeholder="Enter Name / Email / phone/ NRIC" style="background-color: #A9A9A9;color: white"/>
                                                        <input type="hidden" class="form-control" id = "current_page" value = "<?php echo $current_page; ?>"/>
													</div>

													<div class="col-sm-2 bot-mar">
														<label>&nbsp;</label>
														<div>
															<button type="submit" class="btn btn-primary">Search</button>
														</div>
													</div>
												</div>
												</form>
												<table class="table table-white table-vertical-center margin-none table-striped footable">
													<thead>
														<tr>
															<th data-hide="phone,tablet" class="text-center">Profile Image</th>
															<th  class="text-center">Name</th>
															<th data-hide="phone" class="text-center">Email</th>
															<th data-hide="phone" class="text-center">Phone</th>
                                                            <th data-class="highlight" class="text-center">NRIC</th>
                                                            <th data-class="highlight" class="text-center">Member Id</th>
															<!--<th class="text-center">Product ID</th>
															<th class="text-center">Product</th>
															<th data-hide="phone,tablet" class="text-center">Status</th>-->
															<th data-hide="phone,tablet" class="text-center">Update Profile</th>
															<th data-hide="phone,tablet" class="text-center">Profile Overview</th>
															<!-- <th data-hide="phone,tablet" class="text-center">Subscribe Magazine</th>
															<th data-hide="phone,tablet" class="text-center">Subscribe Campaign</th> -->
															<th data-hide="phone,tablet" class="text-center">Subscribe</th>
														</tr>
													</thead>
													<tbody>
														
														<?php if (count($details) > 0) { 
															foreach ($details as $user) {?>
															<tr>
															<!-- <td class="text-center" ><a href="<?php echo base_url();?>index.php/subscriber/preview/?user_id=<?php echo base64_encode($user['id']); ?>" target="_blank"><?php echo $user['id']; ?></a></td> -->
                                                            <td class="text-center">
                                                                <? if ($user['photo'] != NULL) {?>
                                                                    <img src="<?php echo base_url(); ?>uploads/users/<?php echo $user['photo']; ?>" class="img-responsive img-clean prof-table-img" alt="people" />
                                                                <?php } else {?>
                                                                    <img src="<?php echo base_url(); ?>assets/images/default_profile.jpg" class="img-responsive img-clean prof-table-img" alt="people" />
                                                                <?php } ?>
                                                                <!-- <img src="<?php echo base_url();?>uploads/users/<?php echo $user['photo']?>"  class="img-responsive img-clean prof-table-img" alt="" /> -->
                                                            </td>
															<td class="text-left" ><?php echo ucwords($user['last_name']." ".$user['first_name']); ?></td>
                                                            <!-- email will be send only when there email address exists -->
															<td class="text-left"><?php if ($user['email'] != null){?><a href="#send_individual_mail" data-toggle="modal" onclick="return fnSendIndividualMails('<?php echo $user['email']; ?>')"><?php echo $user['email']; ?></a><?php } else{ ?> N/A <?php } ?></td>
															<td class="text-center"><?php if ($user['phone'] != null){?><a href="tel:9999999999"><?php echo $user['phone']; ?></a><?php } else{ ?> N/A <?php } ?></td>
                                                            <td class="text-center" ><?php if ($user['phone'] != null){?><?php echo $user['nric']; ?><?php } else{ ?> N/A <?php } ?></td>
                                                            <td class="text-center" ><?php echo $user['memberId']; ?></td>
															<?php $strEncodedUserId =  base64_encode($user['id']); ?>
															<td class="text-center"><a href="#editPromo" data-toggle="modal" onclick="return edit_subscriber('<?php echo $strEncodedUserId; ?>')" ><i class="fa fa-pencil"></i></a></td>
															<td class="text-center"><a href="<?php echo base_url();?>index.php/subscriber/preview/?user_id=<?php echo base64_encode($user['id']); ?>" data-toggle="modal"><i class="fa fa-search"></i></a></td>
															<!--<td class="text-center"><a href="#subscribe_magazine" onclick="return subscribe_magazine_wise('<?php //echo base64_encode($user['id']); ?>')" data-toggle="modal" class="pull-right mar"><button class="btn btn-warning" type="button">Magazine</button></a></td>
															<td class="text-center"><a href="<?php echo base_url();?>index.php/subscriber/fnSubscribeCampaign/?subscriber_id=<?php //echo base64_encode($user['id']); ?>" onclick="return subscribe_campaign_wise('<?php echo base64_encode($user['id']); ?>')" data-toggle="modal" class=" pull-right mar"><button class="btn btn-info" type="button">Campaign</button></a></td> -->
															<td class="text-center"><a href="<?php echo base_url();?>index.php/subscriber/subscribe_product?user_id=<?php echo base64_encode($user['id']); ?>" class=" pull-right mar"><button class="btn btn-info" type="button">Subscribe</button></a></td>
														</tr>
														<?php }} ?>
														
													</tbody>
												</table>
												<div class="text-center innerAll border-top pagination margin-none" align = "center">
															<?php echo $pagination; ?>
															</div>
											</div>
											<!-- // END TRENDS -->
										</div>


									</div>

								</div>
								<div class="col-separator-h"></div>
							</div>
						</div>
					</div>
					</div>
				</div>
			</div>
<div class="modal fade" id="addPromo" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content" id="tran_preview">

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

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

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

        </div>
    </div>
</div>
<div class="modal fade" id="subscribe_options" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content" id="sub_options">
            <div class="modal-header" align = "left">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h3 class="modal-title" align="center">Subscribe Magazines Process</h3>
            </div>
            <div class="modal-body">
                <div class="innerAll">
                    <div class="innerLR">
                        <form class="form-horizontal" role="form" id = "add_promo" action = "<?php echo base_url(); ?>index.php/subscriber/subscribe_magazine_process" method = "post">
                            <label  class="control-label text-center">Select any one way to proceed further: </label>
                            <div class="form-group mmar">

                                <div class="col-sm-6">
                                    <input type="radio" name="process_way" value="process_magazine" style="vertical-align: middle; margin: 0px;" required="required"/> <label  class="control-label text-center">Magazine </label><br> <br>
                                    <input type="radio" name="process_way" value="process_campaign" style="vertical-align: middle; margin: 0px;" required="required"/> <label  class="control-label text-center"> Campaign</label>
                                </div>
                                <div id="promo_code_block" class="formErrorContent"></div>

                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-4 col-sm-8">
                                    <input type="hidden" id="system_base_url" value="<?php echo base_url();?>">
                                    <input type="hidden" id="previous_id" value="">
                                    <input type="hidden" name="subscriber_id" id="subscriber_id_process" value="">
                                    <button type="submit" class="btn btn-primary" id="add_promo">Submit</button>
                                    <button type="button" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Cancel</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="send_individual_mail" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content" id="individual_mail">
            <div class="modal-dialog">
                <div class="modal-content">
                    <form action="<?php echo base_url();?>index.php/subscriber/fnSendIndividualMailAttachments" method="post" enctype="multipart/form-data" >
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h3 class="modal-title" align="left">Send Mail</h3>
                        </div>
                        <div class="modal-body">
                            <div class="innerAll">
                                <div class="innerLR">
                            <div class="form-group mmar">
                                <label  class="col-sm-3 control-label text-left">To: </label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control " name = "recipient" id = "recipient" value="" readonly/>
                                </div>
                            </div>
                            <div style="clear: both"></div>
                            <div class="form-group mmar">
                                <label  class="col-sm-3 control-label text-left">Subject: </label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control " name = "mail_subject" id = "mail_subject" value=""/>
                                </div>
                            </div>
                            <div style="clear: both"></div>
                            <div class="form-group mmar">
                                <label  class="col-sm-3 control-label text-left">Message: </label>
                                <div class="col-sm-9">
                                    <textarea class="form-control" id="message_desc" name="message_desc" ></textarea>
                                </div>
                            </div>
                            <div style="clear: both"></div>
                            <div class="form-group mmar">
                                <label  class="col-sm-3 control-label text-left">Attachment: </label>
                                <div class="col-sm-9">
                                    <input type="file" name="attachment_for_file"> &nbsp; <small>Attach document</small>
                                </div>
                            </div>
                            <div style="clear: both"></div>
                            <div class="form-group mmar">
                                <div class="col-sm-offset-4 col-sm-8">
                                    <input type="hidden" id="system_base_url" value="<?php echo base_url();?>">
                                    <button type="submit" class="btn btn-primary" id="send_individual_mail" >Submit</button>
                                </div>
                            </div>
                    </form>
                        <div style="clear: both"></div>
                                </div>
                            </div>
                        </div>
                </div>
            </div>
        </div>
    </div>
</div>
<input type="hidden" id="system_base_url" value="<?php echo base_url();?>" />
<script src="<?php echo base_url(); ?>assets/library/jquery/jquery.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/subscriber.js"></script>
<script type="application/javascript">

</script>