Your IP : 216.73.217.77


Current Path : /home/users/unlimited/www/facebook.codeskitter.site/themes/sunshine/layout/modals/
Upload File :
Current File : /home/users/unlimited/www/facebook.codeskitter.site/themes/sunshine/layout/modals/ai_credits.phtml

<div class="modal fade" id="AI-credit-modal" role="dialog">
	<div class="modal-dialog modal-md wow_mat_mdl">
		<form method="post">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><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-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></span></button>
					<h4 class="modal-title"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" width="512" height="512" x="0" y="0" viewBox="0 0 512 512" xml:space="preserve" class=""><g><path fill="#4fcde1" d="M391 81h30V15c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15zM331 81h30V15c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15zM271 81h30V15c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z" data-original="#39326c" class=""></path><path fill="#4fcde1" d="M211 81h30V15c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15zM151 81h30V15c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15zM91 81h30V15c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z" data-original="#5f55af" class=""></path><path fill="#4fcde1" d="M406 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15zM346 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15zM286 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z" data-original="#39326c" class=""></path><g fill="#5f55af"><path d="M226 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15zM166 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15zM106 512c8.284 0 15-6.716 15-15v-66H91v66c0 8.284 6.716 15 15 15zM15 121h66V91H15c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15zM15 181h66v-30H15c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15zM15 241h66v-30H15c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15zM15 301h66v-30H15c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15zM15 361h66v-30H15c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15zM15 421h66v-30H15c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z" fill="#4fcde1" data-original="#5f55af" class=""></path></g><path fill="#4fcde1" d="M431 91v30h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15zM431 181h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66zM431 241h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66zM431 301h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66zM431 361h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66zM431 421h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z" data-original="#39326c" class=""></path><path fill="#e8fcff" d="M446 51H66c-8.284 0-15 6.716-15 15v380c0 8.284 6.716 15 15 15h380c8.284 0 15-6.716 15-15V66c0-8.284-6.716-15-15-15z" data-original="#aed0ff" class=""></path><path fill="#e8fcff" d="M461 446V66c0-8.284-6.716-15-15-15H256v410h190c8.284 0 15-6.716 15-15z" data-original="#7c84e8" class=""></path><path fill="#4fcde1" d="M386 111H126c-8.284 0-15 6.716-15 15v260c0 8.284 6.716 15 15 15h260c8.284 0 15-6.716 15-15V126c0-8.284-6.716-15-15-15z" data-original="#5f55af" class=""></path><path fill="#4fcde1" d="M401 386V126c0-8.284-6.716-15-15-15H256v290h130c8.284 0 15-6.716 15-15z" data-original="#39326c" class=""></path><path fill="#ffffff" d="M247.626 192.389A17.657 17.657 0 0 0 231.077 181h-.018a17.658 17.658 0 0 0-16.517 11.351l-45.06 118.31c-2.949 7.742.937 16.408 8.679 19.356 7.742 2.95 16.408-.937 19.356-8.679l7.543-19.804h51.691l7.458 19.762c2.267 6.007 7.974 9.708 14.036 9.708 1.76 0 3.55-.312 5.294-.97 7.75-2.925 11.663-11.579 8.737-19.33zm-31.14 79.146 14.538-38.171 14.406 38.171z" data-original="#f9f9f9" class=""></path><g fill="#e2dff4"><path d="M264.209 321.296c2.267 6.007 7.974 9.708 14.036 9.708 1.76 0 3.55-.312 5.294-.97 7.75-2.925 11.663-11.579 8.737-19.33L256 214.578v86.956h.751zM328.5 181c-8.284 0-15 6.716-15 15v120c0 8.284 6.716 15 15 15s15-6.716 15-15V196c0-8.284-6.716-15-15-15z" fill="#ffffff" data-original="#e2dff4" class=""></path></g></g></svg> <?php echo $wo['lang']['buy_credit']; ?></h4>
				</div>
				<div class="modal-body">
					<div class="ai_alert_balance buy_cred">
						<b class="ai_credit_prices"><?php echo $wo['lang']['available_balance']?></b>
					</div>
					
					<div class="ai_credit_alert"></div>
					
					<div class="wow_form_fields">
						<input type="number" placeholder="<?php echo $wo['lang']['amount']?>" onkeyup="updatedConvertedWalletAmount(this);checkCanBuy(this)" id="ai-credit-input">
						<p class="ai_wallet_amount"></p>
					</div>
					<input type="hidden" name="user" value="<?php echo $wo['user']['user_id'];?>">
					<input type="hidden" value="<?php echo $wo['user']['credits'];?>" id="current_user_credits">
					<input type="hidden" value="" id="current_model_credits">
				</div>
				<div class="modal-footer" style="border: none">
					<div class="ball-pulse"><div></div><div></div><div></div></div>
					<button type="button" class="btn main btn-mat" id="ai-credit-button" onclick="buyCredits()"><?php echo $wo['lang']['buy']; ?></button>
				</div>
			</div>
		</form>
	</div>
</div>

<script type="text/javascript">
	function updatedConvertedWalletAmount(self) {
		let num = Number($(self).val());
		if (typeof num === "number" && !isNaN(num) && num > 0) {
			$('.ai_wallet_amount').html("<?php echo($wo['lang']['equals_to']) ?> <?php echo Wo_GetCurrency($wo['config']['ads_currency']); ?>" + (parseInt($(self).val()) / <?php echo($wo['config']['credit_price']) ?>));
		}
		else{
			$('.ai_wallet_amount').html("");
		}
	}
	function getAvailableByType(type = 'image'){
		if (type == 'text') {
			return parseInt(parseInt($('#current_user_credits').val()) / parseInt("<?php echo($wo['config']['generated_word_price']) ?>"));
		}
		return parseInt(parseInt($('#current_user_credits').val()) / parseInt("<?php echo($wo['config']['generated_image_price']) ?>"));
	}
	function buyCredits() {
		$("#ai-credit-button").text("<?php echo($wo['lang']['please_wait']) ?>");
		$("#ai-credit-button").attr("disabled",true);
		$.post(Wo_Ajax_Requests_File()+'?f=wallet&s=buy_credit', {amount: $('#ai-credit-input').val()}, function(data, textStatus, xhr) {
			if (data.status == 200) {
				$('#current_user_credits').val(parseInt($('#current_user_credits').val()) + parseInt($('#ai-credit-input').val()));
				$('#ai-credit-input').val('');
				$('#AI-credit-modal').modal('hide');
				if ($('#current_model_credits').val() == 'AI-post-modal') {
					openPostModel();
				}
				else if($('#current_model_credits').val() == 'AI-user-modal'){
					openAiUserModel($('#ai-user-model-type').val());
				}
				else if($('#current_model_credits').val() == 'AI-modal'){
					openAIModel();
				}
				else if($('#current_model_credits').val() == 'AI-blog-modal'){
					refreshBlogInfo();
				}
			}
			else{
				$('.ai_credit_alert').html("<div class='alert alert-danger'>"+data.message+"</div>");
			}
			$("#ai-credit-button").text("<?php echo($wo['lang']['buy']) ?>");
			$("#ai-credit-button").attr("disabled",true);
		});
	}
	function checkCanBuy(self) {
		$.post(Wo_Ajax_Requests_File()+'?f=wallet&s=check_credit', {amount: $(self).val()}, function(data, textStatus, xhr) {
			if (data.status == 200) {
				$("#ai-credit-button").removeAttr("disabled");
				$('.ai_credit_alert').html("");
			}
			else{
				$("#ai-credit-button").attr("disabled",true);
				$('.ai_credit_alert').html("<div class='alert alert-danger'>"+data.message+"</div>");
			}
		});
	}
	function openAICredit(id) {
		$('.ai_wallet_amount').html("");
		$('#ai-credit-input').val('');
		$('#ai_credit_alert').html('');
		<?php if ($wo['user']['wallet'] < 1) { ?>
			$('.ai_credit_alert').html("<div class='alert alert-danger'><a href='<?php echo $wo['config']['site_url'];?>/wallet'><?php echo $wo["lang"]["please_top_up_wallet"]?></a></div>");
		<?php } ?>
		var div = '{TX}';
		if (id == 'AI-post-modal' || id == 'AI-blog-modal') {
			$('.ai_credit_prices').html(div.replace('{TX}',"<?php echo(str_replace('{price}', $wo['config']['generated_word_price'], $wo['lang']['text_price'])) ?>"));
		}
		else{
			$('.ai_credit_prices').html(div.replace('{TX}',"<?php echo(str_replace('{price}', $wo['config']['generated_image_price'], $wo['lang']['image_price'])) ?>"));
		}
					
		$('#current_model_credits').val(id);
		$('#AI-post-modal').modal('hide');
		$('#AI-user-modal').modal('hide');
		$('#AI-modal').modal('hide');
		$('#AI-blog-modal').modal('hide');
		$('#AI-credit-modal').modal('show');
	}
</script>