File: /home/kochikidswysewor/www/wp-content/themes/children-charity-child/page-sponsor-dashboard.php
<?php
get_header(); ?>
<script>jQuery('.sponsor_dtl').hide();</script>
<?php list($cmsmasters_layout) = children_charity_theme_page_layout_scheme();
$user = wp_get_current_user(); //print_r($user);
$user_id = $user->ID;
$children = query_posts( '&post_type=children&orderby=menu_order&order=ASC&showposts=-1');
if($user_id!=0){
$i=1;foreach ($children as $child) {
$categories = get_the_terms( $child_id, 'children_categories' );
$cat_name = $categories[0]->name;
$amount_utilisation = get_field('amount_utilisation',$child_id);
$sponsor_description = get_field('sponsor_description',$child_id);
$child_id = $child->ID;
$image = get_the_post_thumbnail($child_id,'child_image_cr');
$sponsors =array();
$sponser_amount =array();
if( have_rows('sponsor_user_details',$child_id) ):
$i=1; while ( have_rows('sponsor_user_details',$child_id) ) : the_row();
$sponsors = get_sub_field('sponsors_');
$sponser_amount = get_sub_field('sponser_amount',$child_id);
$sponsor_date = get_sub_field('sponsor_date',$child_id);
if($sponsors==$user_id){ ?>
<script>
jQuery('.sponsor_dtl').hide();
</script>
<section class="our-sponser">
<div class="container">
<div class="sponsor_dashboard">
<div class="kidProfile">
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-4">
<?php if($image){?>
<figure class="kidImg"><?php echo $image; ?></figure>
<?php }else{?>
<figure class="kidImg"><img src="<?php bloginfo("stylesheet_directory"); ?>/img/default.jpg"></figure>
<?php } ?>
</div>
<div class="col-lg-5 col-md-9 col-sm-8">
<div class="tble">
<table>
<tbody>
<tr>
<td class="hd">Name :</td>
<td class="des"><?php echo get_the_title($child_id);?></td>
</tr>
<tr>
<td class="hd">Age :</td>
<td class="des"><?php echo get_field('age',$child_id);?> years</td>
</tr>
<tr>
<td class="hd">Birthday :</td>
<td class="des"><?php echo get_field('birthday',$child_id); ?></td>
</tr>
<tr>
<td class="hd">Gender :</td>
<td class="des"><?php echo $cat_name; ?></td>
</tr>
<tr>
<td class="hd">Sponsored Amount : </td>
<td class="des sponsoredamount"><?php echo $sponser_amount;?></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-lg-4 col-md-12 col-sm-12">
<div class="abtCnt">
<h3>About <span><?php echo get_the_title($child_id);?></span></h3>
<?php echo limited_sentences($child->post_content,200);?>
</div>
<a class="print-order-link ok-to-print" href="<?php echo home_url('/print-invoice/?n=' . $child_id); ?>" target="_blank"><button type="button" class="button">Download</button></a>
</div>
</div>
</div>
<?php if(get_field('amount_utilisation',$child_id)){ ?>
<h2 class="spendDtl">Spent Details</h2>
<div class="spend_dtls">
<div class="spndDeatail">
<div class="row d_flex">
<div class="col-lg-12 col-md-12 col-sm-12">
<?php if($sponsor_date){?>
<div class="dte"><?php echo $sponsor_date; ?></div><?php } ?>
<ul>
<?php echo get_field('amount_utilisation',$child_id); ?>
</ul>
</div>
</div>
</div>
<!-- <div class="spndDeatail">
<div class="row d_flex">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="dte">25/01/2020</div>
<ul>
<?php //echo get_field('amount_utilisation',$child_id); ?>
</ul>
</div>
</div>
</div> -->
<!-- <a id="btn-reset-password" class="btn reset_pwd" href="http://kochikids.org">Donate Now</a> -->
</div>
<?php } ?>
</div>
</div>
</section>
<?php }else{?>
<script>
jQuery('.sponsor_dtl').show();
</script>
<?php } $i++; endwhile; endif; } }else{ ?>
<script>
document.location.href = '<?php echo home_url('/donate-confirmation'); ?>';
</script>
<?php }?>
<script>
jQuery( document ).ready(function() {
if(jQuery('.our-sponser').text().length==0){
jQuery(".plzSelect").show();
}
});
</script>
<div class="plzSelect" style="display: none;">
<p>Hi <?php echo $user->display_name; ?>,<br> Currently you have not sponsered any child. For sponsorship,<a class="sponsor_dtl" href="<?php echo home_url('/our-children/'); ?>"> Please Click Here</a><p>
</div>
<!-- <script>
jQuery(".invoice-link").click(function(){ alert("innn");
// var child_id = jQuery(".childid").text();
var amount = jQuery(".sponsoredamount").text();
//var sponsor_content = jQuery("#sponsor_content").val();
jQuery.ajax ({
type: "POST",
url: "<?php //bloginfo('stylesheet_directory');?>/invoice-data.php",
dataType: "text",
data: { amount : amount},
success: function(data) {
alert(data);
},
});
});
</script> -->
<?php get_footer();