<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Prevent direct access to the script.
}
$profile_id    = gigneo_active_profile_id();
$profile_type  = gigneo_profile_type( $profile_id );
$platform_type = gigneo_platform_type();
$credit_system = gigneo_has_credit_system();

//Stats
$template_args = array(
	'profile_id'    => $profile_id,
	'profile_type'  => $profile_type,
	'platform_type' => $platform_type,
	'credit_system' => $credit_system,
);

$credit_plans = gigneo_option( "_gigneo_ts_{$profile_type}_credit_plans" );
?>
<div id="gn-account-credit-wrapper" class="gn-account-main-wrapper">
	<?php
	//Stats
	gigneo_load_template( 'dashboard/account/parts/credit/stat', false, $template_args );
	?>
	<div class="row">
		<div class="col-xl-8 col-lg-7 col-md-12">
			<?php
			//Overview
			gigneo_load_template( 'dashboard/account/parts/credit/overview', false, $template_args );
			?>
		</div>
		<div class="col-xl-4 col-lg-5 col-md-12">
			<?php
			//Buy Credit
			gigneo_load_template( 'dashboard/account/parts/credit/buy', false, $template_args );
			?>
		</div>
	</div>
	<?php
	//Credit plan
	if ( in_array( 'credit_plans', gigneo_active_modules(), true ) ) {
		apply_filters( 'gigneo_credit_plan_template', $template_args );
	}
	//History
	gigneo_load_template( 'dashboard/account/parts/credit/history', false, $template_args );
	?>
</div>
<?php