View file funding/templates/funding/index.html

File size: 24.67Kb
<script src="https://checkout.stripe.com/checkout.js"></script>
<div class="fund_raise_parent">
	<div class="pg_page padd">
		<h2 class="fund_title"><?php echo($context['fund']->title) ?></h2>
		<div class="show-fund-info-user">
			<div class="postMeta--author-avatar">
				<a href="<?php echo($context['fund']->user_data->url) ?>" data-ajax="ajax_loading.php?app=profile&apph=profile&uname=<?php echo($context['fund']->user_data->username) ?>">
					<img src="<?php echo($context['fund']->user_data->avatar) ?>" alt="User Image">
				</a>
			</div>
			<div class="postMeta--author-text">
				<a href="<?php echo($context['fund']->user_data->url) ?>" data-ajax="ajax_loading.php?app=profile&apph=profile&uname=<?php echo($context['fund']->user_data->username) ?>"><?php echo($context['fund']->user_data->name) ?></a>
				<span class="middot">·</span>
				<time class="time-ago" title="<?php echo(ToDate($context['fund']->time)) ?>"><?php echo(time2str($context['fund']->time)); ?></time>
				<?php if( $me["user_id"] <> $context['fund']->user_id ){?>
					<span class="middot">·</span>
					<?php if ($context['is_reported']) { ?>
						<a id="btn-report" href="javascript:void(0);" onclick="report_fund(<?php echo $context['fund']->id;?>);">{{LANG cancel_report}}</a>
					<?php } else{ ?>
						<a id="btn-report" href="javascript:void(0);" data-modal-menu="report-fund">{{LANG report_fund}}</a>
					<?php } ?>
				<?php } ?>
			</div>
		</div>
		<hr>
		<div class="row">
			<div class="col-md-8">
				<img src="<?php echo($context['fund']->image) ?>" class="fund_main_img">
			</div>
			<div class="col-md-4">
				<div class="pg_fund_info">
					<div class="fund_raise_bar">
						<div class="progress fund_progress">
							<div class="progress-bar" role="progressbar" style="width: <?php echo $context['fund']->bar; ?>%" aria-valuenow="<?php echo $context['fund']->bar; ?>" aria-valuemin="0" aria-valuemax="<?php echo($context['fund']->amount) ?>"></div>
						</div>
						<p class="show_fnd_stats"><span class="main"><?php echo $context['currency_symbol'].$context['fund']->raised; ?></span> {{LANG raised_of}} <?php echo $context['currency_symbol'].$context['fund']->amount; ?></p>
					</div>
					<p class="show_fnd_stats"><span><?php echo $context['fund']->all_donation; ?></span> {{LANG total_donations}}</p>
					<div class="fund_raise_btns">
						<button type="button" class="btn btn-main btn-mat" onclick="$('.pg_fund_info_dont').toggleClass('hidd');$('#donate_amount').focus();">{{LANG donate}}</button>
						<div class="dropdown">
							<button class="btn btn-mat dropdown-toggle" type="button" id="shr_dropdwn" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{LANG share_to}}</button>
							<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="shr_dropdwn">
								<li><a class="dropdown-item" href="javascript:void(0);" onclick="OpenShareWindow('https://www.facebook.com/sharer/sharer.php?u=' + window.location.href)" target="_blank" title="Facebook"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12.001,2.002c-5.522,0-9.999,4.477-9.999,9.999c0,4.99,3.656,9.126,8.437,9.879v-6.988h-2.54v-2.891h2.54V9.798	c0-2.508,1.493-3.891,3.776-3.891c1.094,0,2.24,0.195,2.24,0.195v2.459h-1.264c-1.24,0-1.628,0.772-1.628,1.563v1.875h2.771	l-0.443,2.891h-2.328v6.988C18.344,21.129,22,16.992,22,12.001C22,6.479,17.523,2.002,12.001,2.002z"></path></svg></a></li>
								<li><a class="dropdown-item" href="javascript:void(0);" onclick="OpenShareWindow('https://twitter.com/intent/tweet?text=' + window.location.href)" target="_blank" title="Twitter"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M19.633,7.997c0.013,0.175,0.013,0.349,0.013,0.523c0,5.325-4.053,11.461-11.46,11.461c-2.282,0-4.402-0.661-6.186-1.809	c0.324,0.037,0.636,0.05,0.973,0.05c1.883,0,3.616-0.636,5.001-1.721c-1.771-0.037-3.255-1.197-3.767-2.793	c0.249,0.037,0.499,0.062,0.761,0.062c0.361,0,0.724-0.05,1.061-0.137c-1.847-0.374-3.23-1.995-3.23-3.953v-0.05	c0.537,0.299,1.16,0.486,1.82,0.511C3.534,9.419,2.823,8.184,2.823,6.787c0-0.748,0.199-1.434,0.548-2.032	c1.983,2.443,4.964,4.04,8.306,4.215c-0.062-0.3-0.1-0.611-0.1-0.923c0-2.22,1.796-4.028,4.028-4.028	c1.16,0,2.207,0.486,2.943,1.272c0.91-0.175,1.782-0.512,2.556-0.973c-0.299,0.935-0.936,1.721-1.771,2.22	c0.811-0.088,1.597-0.312,2.319-0.624C21.104,6.712,20.419,7.423,19.633,7.997z"></path></svg></a></li>
								<li><a class="dropdown-item" href="javascript:void(0);" onclick="OpenShareWindow('https://pinterest.com/pin/create/button/?url=' + window.location.href)" target="_blank" title="Pinterest"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M9.04,21.54C10,21.83 10.97,22 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2A10,10 0 0,0 2,12C2,16.25 4.67,19.9 8.44,21.34C8.35,20.56 8.26,19.27 8.44,18.38L9.59,13.44C9.59,13.44 9.3,12.86 9.3,11.94C9.3,10.56 10.16,9.53 11.14,9.53C12,9.53 12.4,10.16 12.4,10.97C12.4,11.83 11.83,13.06 11.54,14.24C11.37,15.22 12.06,16.08 13.06,16.08C14.84,16.08 16.22,14.18 16.22,11.5C16.22,9.1 14.5,7.46 12.03,7.46C9.21,7.46 7.55,9.56 7.55,11.77C7.55,12.63 7.83,13.5 8.29,14.07C8.38,14.13 8.38,14.21 8.35,14.36L8.06,15.45C8.06,15.62 7.95,15.68 7.78,15.56C6.5,15 5.76,13.18 5.76,11.71C5.76,8.55 8,5.68 12.32,5.68C15.76,5.68 18.44,8.15 18.44,11.43C18.44,14.87 16.31,17.63 13.26,17.63C12.29,17.63 11.34,17.11 11,16.5L10.33,18.87C10.1,19.73 9.47,20.88 9.04,21.57V21.54Z"></path></svg></a></li>
								<li><a class="dropdown-item" href="javascript:void(0);" onclick="OpenShareWindow('https://www.linkedin.com/shareArticle?mini=true&amp;url=' + window.location.href)" target="_blank" title="Linkedin"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M20,3H4C3.447,3,3,3.448,3,4v16c0,0.552,0.447,1,1,1h16c0.553,0,1-0.448,1-1V4C21,3.448,20.553,3,20,3z M8.339,18.337H5.667	v-8.59h2.672V18.337z M7.003,8.574c-0.856,0-1.548-0.694-1.548-1.548s0.691-1.548,1.548-1.548c0.854,0,1.548,0.693,1.548,1.548	S7.857,8.574,7.003,8.574z M18.338,18.337h-2.669V14.16c0-0.996-0.018-2.277-1.388-2.277c-1.39,0-1.601,1.086-1.601,2.207v4.248	h-2.667v-8.59h2.56v1.174h0.037c0.355-0.675,1.227-1.387,2.524-1.387c2.704,0,3.203,1.778,3.203,4.092V18.337z"></path></svg></a></li>
								<li><a class="dropdown-item" href="javascript:void(0);" onclick="OpenShareWindow('https://api.whatsapp.com/send?text=' + window.location.href)" data-action="share/whatsapp/share" target="_blank" title="Linkedin"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M2.004 22l1.352-4.968A9.954 9.954 0 0 1 2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10a9.954 9.954 0 0 1-5.03-1.355L2.004 22zM8.391 7.308a.961.961 0 0 0-.371.1 1.293 1.293 0 0 0-.294.228c-.12.113-.188.211-.261.306A2.729 2.729 0 0 0 6.9 9.62c.002.49.13.967.33 1.413.409.902 1.082 1.857 1.971 2.742.214.213.423.427.648.626a9.448 9.448 0 0 0 3.84 2.046l.569.087c.185.01.37-.004.556-.013a1.99 1.99 0 0 0 .833-.231c.166-.088.244-.132.383-.22 0 0 .043-.028.125-.09.135-.1.218-.171.33-.288.083-.086.155-.187.21-.302.078-.163.156-.474.188-.733.024-.198.017-.306.014-.373-.004-.107-.093-.218-.19-.265l-.582-.261s-.87-.379-1.401-.621a.498.498 0 0 0-.177-.041.482.482 0 0 0-.378.127v-.002c-.005 0-.072.057-.795.933a.35.35 0 0 1-.368.13 1.416 1.416 0 0 1-.191-.066c-.124-.052-.167-.072-.252-.109l-.005-.002a6.01 6.01 0 0 1-1.57-1c-.126-.11-.243-.23-.363-.346a6.296 6.296 0 0 1-1.02-1.268l-.059-.095a.923.923 0 0 1-.102-.205c-.038-.147.061-.265.061-.265s.243-.266.356-.41a4.38 4.38 0 0 0 .263-.373c.118-.19.155-.385.093-.536-.28-.684-.57-1.365-.868-2.041-.059-.134-.234-.23-.393-.249-.054-.006-.108-.012-.162-.016a3.385 3.385 0 0 0-.403.004z"></path></svg></a></li>
							</ul>
						</div>
					</div>
					<div class="fund_raise pg_fund_info_dont hidd">
						<h3 class="text-center fund_dnt_hd"><span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M9.06,1.93C7.17,1.92 5.33,3.74 6.17,6H3A2,2 0 0,0 1,8V10A1,1 0 0,0 2,11H11V8H13V11H22A1,1 0 0,0 23,10V8A2,2 0 0,0 21,6H17.83C19,2.73 14.6,0.42 12.57,3.24L12,4L11.43,3.22C10.8,2.33 9.93,1.94 9.06,1.93M9,4C9.89,4 10.34,5.08 9.71,5.71C9.08,6.34 8,5.89 8,5A1,1 0 0,1 9,4M15,4C15.89,4 16.34,5.08 15.71,5.71C15.08,6.34 14,5.89 14,5A1,1 0 0,1 15,4M2,12V20A2,2 0 0,0 4,22H20A2,2 0 0,0 22,20V12H13V20H11V12H2Z" /></svg></span>{{LANG donate}}</h3>
						<div class="fund_input">
							<input type="text" name="amount" class="form-control" placeholder="0.00" id="donate_amount" onkeyup="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');">
						</div>
						<div class="fund_butns">
							<?php if (!empty($config['paypal_id']) && !empty($config['paypal_secret'])) { ?>
								<button class="btn valign" onclick="Pxp_DonateUsingPaypal(this)">
									<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M20.067 8.478c.492.88.556 2.014.3 3.327-.74 3.806-3.276 5.12-6.514 5.12h-.5a.805.805 0 0 0-.794.68l-.04.22-.63 3.993-.032.17a.804.804 0 0 1-.794.679H7.72a.483.483 0 0 1-.477-.558L7.418 21h1.518l.95-6.02h1.385c4.678 0 7.75-2.203 8.796-6.502zm-2.96-5.09c.762.868.983 1.81.752 3.285-.019.123-.04.24-.062.36-.735 3.773-3.089 5.446-6.956 5.446H8.957c-.63 0-1.174.414-1.354 1.002l-.014-.002-.93 5.894H3.121a.051.051 0 0 1-.05-.06l2.598-16.51A.95.95 0 0 1 6.607 2h5.976c2.183 0 3.716.469 4.523 1.388z" fill="currentColor"></path></svg> {{LANG paypal}}
								</button>
							<?php } ?>
							<?php if ($config['credit_card'] == 'on') { ?>
								<button class="btn valign" onclick="Pxp_DonateUsingStripe(this)">
									<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm17 9H4v7h16v-7zm0-4V5H4v3h16z" fill="currentColor"></path></svg> {{LANG credit_card}}
								</button>
							<?php } ?>
							<?php if ($config['bank_payment'] == 'on') { ?>
								<button class="bank_payment btn valign" onclick="Pxp_BankPayment('');">
									<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M2 20h20v2H2v-2zm2-8h2v7H4v-7zm5 0h2v7H9v-7zm4 0h2v7h-2v-7zm5 0h2v7h-2v-7zM2 7l10-5 10 5v4H2V7zm2 1.236V9h16v-.764l-8-4-8 4zM12 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2z" fill="currentColor"></path></svg> {{LANG bank_transfer}}              
								</button>
							<?php } ?>
							<input type="hidden" class="form-control" id="fund_id" value="<?php echo($context['fund']->id) ?>">
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="row">
        <div class="col-md-8">
			<div class="pg_page fund_raise">
				<h4 class="mt-0">Info</h4>
				<p><?php echo($context['fund']->description) ?></p>
			</div>
        </div>
		<div class="col-md-4 fund_col-md">
			<div class="pg_page fund_raise">
				<h4 class="mt-0">{{LANG recent_donations}}</h4>
				<?php if (empty($context['recent'])) { ?>
					<div class="empty_state">
						<span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M16,13C15.71,13 15.38,13 15.03,13.05C16.19,13.89 17,15 17,16.5V19H23V16.5C23,14.17 18.33,13 16,13M8,13C5.67,13 1,14.17 1,16.5V19H15V16.5C15,14.17 10.33,13 8,13M8,11A3,3 0 0,0 11,8A3,3 0 0,0 8,5A3,3 0 0,0 5,8A3,3 0 0,0 8,11M16,11A3,3 0 0,0 19,8A3,3 0 0,0 16,5A3,3 0 0,0 13,8A3,3 0 0,0 16,11Z" /></svg></span>
						<p>{{LANG no_users_yet}}</p>
					</div>
				<?php } ?>
				<?php if (!empty($context['recent'])) { ?>
					<div class="fund">
						<div class="fluid list">
							<?php if ($context['recent']) { foreach ($context['recent'] as $key => $user) { ?>
								<div class="item fund_item" data-recent="<?php echo($user->id) ?>">
									<div class="wrapper">
										<img class="img-circle" src="<?php echo($user->user_data->avatar) ?>" alt="Picture" />
									</div>
									<div class="caption">
										<a href="<?php echo($user->user_data->url) ?>" data-ajax="ajax_loading.php?app=profile&apph=profile&uname=<?php echo($user->user_data->username) ?>"><?php echo $user->user_data->name; ?></a>
										<p><?php echo $context['currency_symbol'].$user->amount; ?><span class="middot">·</span><time class="time-ago" title="<?php echo(ToDate($user->time)) ?>"><?php echo(time2str($user->time)); ?></time></p>
									</div>
								</div>
							<?php } } ?>
						</div>
						<?php if (count($context['recent']) > 8) { ?>
							<!-- <div class="pp_load_loader fund_btn"><button class="btn btn-info pp_flat_btn" onclick="Pxp_LoadMoreFund(this)"><span>{{LANG load_more}}</span></button></div> -->
						<?php } ?>
					</div>
				<?php } ?>
			</div>
        </div>
		<div class="clear"></div>
	</div>
</div>

<div class="confirm--modal bank_payment_donate_modal" style="display: none !important;">
    <div class="confirm--modal--inner">
        <div class="confirm--modal--body dt_bank_trans_modal">
            <h5>{{LANG bank_transfer}}</h5>
            <div class="bank_alert"></div>
            <?php echo $config['bank_description'];?>
            <br>
            <br>
            <?php if (!empty($config['bank_transfer_note'])) { ?>
            <div class="dt_user_profile">
                <ul class="dt_prof_vrfy">
                    <li><?php echo $config['bank_transfer_note'];?></li>
                </ul>
            </div>
            <?php } ?>
            <div class="fak_image">
                <div id="fake_img_holder"></div>
                <div class="upload_fk_image" onclick="document.getElementById('upload-image').click(); return false">
                    <div class="upload_fk_image_content">
                        <svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24"><path fill="currentColor" d="M9,16V10H5L12,3L19,10H15V16H9M5,20V18H19V20H5Z" /></svg> {{LANG upload_file}}
                    </div>
                </div>
            </div>
        </div>
        <div class="confirm--modal--footer">
            <button class="btn btn-default" data-confirm--modal-dismiss>{{LANG cancel}}</button>
            <button class="btn btn-danger btn-red send_bank">{{LANG send}}</button>
            <form class="bank_transfer_form">
                <input class="hidden" id="upload-image" type="file" name="image" multiple accept="image/*">
                <input class="hidden" type="text" name="type" value="donate">
                <input class="hidden" type="text" name="price" id="donate_price">
                <input class="hidden" type="text" name="fund_id" value="<?php echo($context['fund']->id) ?>">
                <input type="reset" id="configreset" value="Reset" class="hidden">
            </form>
        </div>
    </div>
</div>

<?php if( $me["user_id"] <> $context['fund']->user_id ){?>
	<div class="modal--menu confirm--modal" id="report-fund" style="display: none">
		<div class="confirm--modal--inner">
			<div class="confirm--modal--body">
				<h5>{{LANG report_fund}}</h5>
				<form class="fund_report_form">
					<input class="hidden" type="text" name="fund_id" value="<?php echo($context['fund']->id) ?>">
					<div class="pg_mat_input">
						<textarea placeholder="{{LANG report_fund}}" name="report_message" id="report_message" rows="5"></textarea>
						<label>{{LANG report_fund}}</label>
					</div>
				</form>
			</div>
			<div class="confirm--modal--footer">
				<button class="btn btn-default" data-modal--menu-dismiss>{{LANG cancel}}</button>
				<button class="btn btn-danger btn-red" onclick="report_fund(<?php echo $context['fund']->id;?>);">{{LANG report_fund}}</button>
			</div>
		</div>
	</div>
<?php } ?>

<script type="text/javascript">
<?php if( $me["user_id"] <> $context['fund']->user_id ){?>
	function report_fund(post_id){
		if (not(is_logged())) {
			redirect('welcome');
			return false;
		}
		if (!post_id) {
			return false;
		}
		var message = $('#report_message').val();
		$.ajax({
			url: link('main/fund_report'),
			type: 'POST',
			dataType: 'json',
			data: {id: post_id, message: message},
		})
		.done(function(data) {
			if (data.status == 200 && data.code == 1) {
				$('#btn-report').html('{{LANG cancel_report}}');
				$('#btn-report').attr('onclick','report_fund(<?php echo $context['fund']->id;?>);');
				$('#btn-report').removeAttr( "data-modal-menu" );
			}
			else if(data.status == 200 && data.code == 0){
				$('#btn-report').html('{{LANG report_fund}}');
				$('#btn-report').attr('data-modal-menu','report-fund');
				$('#btn-report').removeAttr( "onclick" );
			}
			$('#report-fund').removeClass('open');
			$.toast(data.message,{
				duration: 5000, 
				type: '',
				align: 'top-right',
				singleton: false
			});
		});
	}
<?php } ?>

$(document).ready(function() {
    $("#upload-image").on('change', function() {
    //Get count of selected files
    var product_countFiles = $(this)[0].files.length;
    var product_imgPath = $(this)[0].value;
    var extn = product_imgPath.substring(product_imgPath.lastIndexOf('.') + 1).toLowerCase();
    var product_image_holder = $("#fake_img_holder");
    product_image_holder.empty();
    if (extn == "gif" || extn == "png" || extn == "jpg" || extn == "jpeg") {
        if (typeof(FileReader) != "undefined") {
        //loop for each file selected for uploaded.
        for (var i = 0; i < product_countFiles; i++) 
        {
            var product_reader = new FileReader();
            product_reader.onload = function(e) {
                $("<img />", {
                    "src": e.target.result,
                    "class": "thumb-image"
                  }).appendTo(product_image_holder);
                }
                product_image_holder.show();
                product_reader.readAsDataURL($(this)[0].files[i]);
              }
            } else {
              product_image_holder.html("<p>This browser does not support FileReader.</p>");
            }
         }
    });
});

    $(document).on('click', '.send_bank', function(event) {
        $(".bank_transfer_form").submit();
    });

    $(".bank_transfer_form").ajaxForm({
        type:'POST',
        dataType:'json',
        url: link('go_pro/bank_transfer'),
        success:function(data){
            if (data.status == 200) {
                $('.bank_alert').html($('<div>',{
                    class:'alert alert-success',
                    text:data.message
                }));
                setTimeout(function(){
                    window.location.href = site_url('');
                },3000);
            }
            else{
                $('.bank_alert').html($('<div>',{
                    class:'alert alert-danger',
                    text:data.message
                }));

            }
            setTimeout(function(){
                $('.alert-danger').slideUp('fast',function(){
                    $(this).remove(); 
                })    
                 $('.alert-success').slideUp('fast',function(){
                    $(this).remove(); 
                }) 
            },2000);
        }
    });

    function Pxp_BankPayment(type) {
        var amount = $('#donate_amount').val();
        var fund_id = $('#fund_id').val();

        if (amount > 0 && fund_id > 0) {
            $('#donate_price').attr('value', amount);
            var click_event = "$('#upload-image').trigger('click');";
            $(".images-renderer").html('<div class="select-images" onclick="'+click_event+'"><span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-image"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg><h5>{{LANG choose_an_image}}</h5></span></div>');
            $('#configreset').click();
            $('.bank_payment_donate_modal').fadeIn(250);
        }
        else{
            scroll2top();
            $.toast("{{LANG please_fill_fields}}",{
                duration: 5000, 
                type: 'success',
                align: 'bottom',
                singleton: true
            });
        }
    }

	function OpenShareWindow(url, windowName) {
           newwindow = window.open(url, windowName, 'height=600,width=800');
           if (window.focus) {
              newwindow.focus();
           }
           return false;
        }
		
    function Pxp_LoadMoreFund(self) {
        var last_id = $('.fund_item').last().attr('data-recent');
        var fund_id = <?php echo $context['fund']->id; ?>;
        $(self).find('span').text('{{LANG please_wait}}');
        $.post(link('profile/load_more_recent_raise'), {id: last_id,fund_id:fund_id}, function(data, textStatus, xhr) {
            if (data.status == 200) {
                if (data.html != '') {
                    $('.list').append(data.html);
                    $(self).find('span').text('{{LANG load_more}}');
                }
                else{
                    $('.fund_btn').remove();
                }
            }
            else{
                scroll2top();
                $.toast(data.message,{
                    duration: 5000, 
                    type: 'success',
                    align: 'bottom',
                    singleton: true
                });
            }
        });
    }


    function Pxp_DonateUsingStripe(self) {
        $(self).find('span').html("{{LANG please_wait}}");
        $('.pp_flat_btn').attr('disabled', 'true');
        var amount = $('#donate_amount').val();
        var fund_id = $('#fund_id').val();

        if (amount > 0 && fund_id > 0) {

            var handler = StripeCheckout.configure({
                key: "<?php echo $config['stripe_id'];?>",
                locale: 'english',
                image: '',
                token: function(token) {
                  $.post(link('go_pro/stripe_donate'), {stripeToken:token.id,fund_id:fund_id,amount:amount}, function (data) {
                     if (data.status == 200) {
                        location.reload();
                     } else {
                        $('.pp_flat_btn').removeAttr('disabled');
                        $(self).find('span').html("{{LANG donate}}");
                     }
                  });
                }
            });

            handler.open({
               name: "<?php echo $config['site_name']?>",
               description: "Donate to <?php echo($context['fund']->user_data->name) ?>",
               amount: amount+'00',
               currency: '<?php echo $config['currency']?>',
               opened: function () {
                   $('.btn-cart').removeAttr('disabled');
                   $('.go_pro--modal').fadeOut(250);
               }
            });

            $(window).on('popstate', function() {
               handler.close();
            });
        }
        else{
            scroll2top();
            $.toast("{{LANG please_fill_fields}}",{
                duration: 5000, 
                type: 'success',
                align: 'bottom',
                singleton: true
            });
            $('.pp_flat_btn').removeAttr('disabled');
            $(self).find('span').html("{{LANG donate}}");
        }
        
    }    
    function Pxp_DonateUsingPaypal(self) {
        $(self).find('span').html("{{LANG please_wait}}");
        $('.pp_flat_btn').attr('disabled', 'true');
        var amount = $('#donate_amount').val();
        var fund_id = $('#fund_id').val();

        if (amount > 0 && fund_id > 0) {
            $.post(link('go_pro/paypal_donate'), {amount: amount,fund_id: fund_id}, function(data, textStatus, xhr) {
                if (data.status == 200) {
                    window.location.href = data.url;
                }
                else{
                    scroll2top();
                    $.toast(data.message,{
                        duration: 5000, 
                        type: 'success',
                        align: 'bottom',
                        singleton: true
                    });
                }
                $('.pp_flat_btn').removeAttr('disabled');
                $(self).find('span').html("{{LANG donate}}");
            });

        }
        else{
            scroll2top();
            $.toast("{{LANG please_fill_fields}}",{
                duration: 5000, 
                type: 'success',
                align: 'bottom',
                singleton: true
            });
            $('.pp_flat_btn').removeAttr('disabled');
            $(self).find('span').html("{{LANG donate}}");
        }
    }
</script>