<?php if ($sf_user->isAuthenticated()): ?>
<?php $katao_user = $sf_user->getInstance() ?>

<div class="profile">
	<div class="top">
		<div><h4>mon compte</h4></div>
	</div>
	<div class="center">
		<div class="profile-add01">
			<p><?php echo $katao_user->getFullName() ?></p>
		<?php if ($sf_user->hasCredential('member')): ?>
			<?php $katao_member = $katao_user->getKataoMember() ?>
			<?php $current_amount_euro = $katao_member->getCurrentAmountEuro() ?>
			<?php $current_amount_sol = $katao_member->getCurrentAmountSol() ?>
			<p>
				<br />Votre solde est de :
				<br /><?php echo Utils::formatCurrencyEuro($current_amount_euro) ?> et <?php echo Utils::formatCurrencySol($current_amount_sol) ?>
			</p>
		<?php endif ?>
		<?php if ($sf_user->getInstance()->isMember()): ?>
			<a class="mon-profile" href="<?php echo url_for('@katao_profile') ?>">Accéder à mon profil</a>
		<?php endif ?>
			<a class="mon-profile" href="<?php echo url_for('@sol_violette_transfer') ?>">Faire un virement</a>

			<a class="mon-profile" href="<?php echo url_for('catalyz/logout'); ?>">Se déconnecter</a>
		</div>
	<?php if ($sf_user->hasCredential('member')): ?>
		<div class="profile-add02">
			<h5>mon panier</h5>
		<?php $cart =/*(KataoCart)*/ $sf_user->getInstance()->getCart() ?>
		<?php if (0 < $products_count = $cart->countProducts()): ?>
			<?php $cart_total_euro = $cart->sumProducts() ?>
			<?php $cart_total_sol = $cart->getUsedSols() ?>
			<p>Nb d'articles : <?php echo $products_count ?></p>
			<p>Montant total : <?php echo Utils::formatCurrencyEuro($cart_total_euro) ?> dont <?php echo Utils::formatCurrencySol($cart_total_sol) ?></p>
			<p>
				<br />Solde après la commande :
				<br /><?php echo Utils::formatCurrencyEuro($current_amount_euro - $cart_total_euro) ?> et <?php echo Utils::formatCurrencySol($current_amount_sol - $cart_total_sol) ?>
			</p>
			<a class="mon-profile" href="<?php echo url_for('@katao_cart') ?>">Accéder à mon panier</a>
			<a class="mon-profile" href="<?php echo url_for('@katao_cart_pdf') ?>">Imprimer mon panier</a>
		<?php else: ?>
			<p>Aucun produit</p>
		<?php endif ?>
		</div>
		<?php
		if ($katao_user && $katao_user->getKataoMemberId()) {
			$invoiceId =  $katao_user->getKataoMemberId().date('ymd_his');
		}else{
			$invoiceId = '000'.date('ymd_his');
		}
		?>
		<div class="profile-add03 profile-add02">

			<h5>Charger son compte SOL</h5>

		<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
		<input type="hidden" name="cmd" value="_xclick"/>
		<input type="hidden" name="business" value="<?php echo sfConfig::get('app_paypal_account') ?>"/>
		<input type="hidden" name="lc" value="FR"/>
		<input type="hidden" name="item_name" value="Achat de Sols"/>
		<input type="hidden" name="item_number" value="<?php echo KataoUser::ADD_SOLS ?>"/>
		<label>Montant : </label>
		<input type="text" id="paypal_amount" name="amount" value=""/>
		<input type="hidden" name="currency_code" value="EUR"/>
		<input type="hidden" name="button_subtype" value="services"/>
		<input type="hidden" name="no_note" value="0"/>
		<!-- <input type="hidden" name="cn" value="Ajouter des instructions particulieres pour le vendeur"> -->
		<input type="hidden" name="no_shipping" value="0"/>
		<input type="hidden" name="rm" value="1"/>
		<input type="hidden" name="return" value="<?php echo url_for('@sol_violette_subscribe_cancel', true) //retour sur une page merci ?>"/>
		<input type="hidden" name="cancel_return" value="<?php echo url_for('@homepage', true) //retour sur formulaire  ?>"/>
		<input type="hidden" name="tax_rate" value="0"/>
		<input type="hidden" name="shipping" value="0"/>
		<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted"/>
		<input type="hidden" name="custom" value="<?php echo session_id() ?>"/>
		<input type="hidden" name="invoice" value="<?php echo $invoiceId ?>"/>
		<input type="hidden" name="notify_url" value="<?php echo url_for('@sol_violette_charger', true) //retour sur une page merci +traitement ?>"/>
		<input type="image" src="/images/btn-search02.gif" name="submit" alt="PayPal - la solution de paiement en ligne la plus simple et la plus sÃ©curisÃ©e !"/>
		<img alt="" border="0" src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" width="1" height="1"/>
	</form>
	<div id="error"></div>

	<?php //echo link_to('retour','@sol_violette_charger') ?>
	<?php //echo link_to('home','@katao_homepage') ?>


		</div>
	<?php endif ?>

	</div>
	<div class="bottom"></div>
</div>
<?php endif ?>