{% extends "WebBundle::layout.html.twig" %}
{% set subtitle =   "Subscriptions"  %}
{% set og_description =  "Subscriptions" %}
{% set og_type =  "null" %}
{% set og_image =  "null" %}
{% set keywords =  "null" %}
{% block title %}Subscriptions{% endblock %}
{% block body %}
	<div class="row content-section">
		<div class="col-md-12" >
			<div class="actor-header-bg" style=" background-image: url('{{(app.user.media.type == "link" )? app.user.media.url : asset(app.user.media.link)}}');">
				<div class="movie-header actor-header">
					<div class="movie-title">{{app.user.name}}</div>
				</div>
			</div>
			<img class="actor-logo" src="{{(app.user.media.type == "link" )? app.user.media.url : asset(app.user.media.link)|imagine_filter("user_image")}}">
		</div>
		<div class="col-md-3" >
			<a href="{{path("fos_user_profile_show")}}" class="btn btn-block btn-sm play-btn"><i class="fas fa-user"></i> My Profile</a>
			<a href="{{path("fos_user_myprofile_edit")}}" class="btn btn-block btn-sm play-btn"><i class="fas fa-user-edit"></i> Edit Profile</a>
			<a href="{{path("user_user_subscriptions")}}" class="btn btn-block btn-sm play-btn"><i class="fas fa-star"></i> My Subscription</a>
			{% if app.user.type == "email" %}
				<a href="{{path("fos_user_change_password")}}" class="btn btn-block btn-sm play-btn"><i class="fas fa-user-lock"></i> Change password</a>
			{% endif %}
			<a href="{{path("fos_user_security_logout")}}" class="btn btn-block btn-sm play-btn"><i class="fas fa-sign-out-alt"></i> Logout</a>
		</div>
		<div class="col-md-9">
			<h3>Subscriptions</h3>
			<div class="table-responsive ">
				<table class="table">
					<thead>
						<tr>
							<th scope="col">Date</th>
							<th scope="col">Plan</th>
							<th scope="col">Price</th>
							<th scope="col">Expirate</th>
							<th scope="col">State</th>
						</tr>
					</thead>
					<tbody>
						{% for subscription  in app.user.subscriptions %}
							<tr>
								<td>{{subscription.created|date("Y/d/m H:i")}}</td>
								<td>{{subscription.pack}}</td>
								<td>{{subscription.price}} {{subscription.currency}}</td>
								<td>{{subscription.expired|date("Y/d/m H:i")}} </td>
								<td>
									<label class="badge badge-light btn-sm">{{subscription.status|capitalize}}</label>
									{% if subscription.status == "unpaid" %}
										{% if subscription.method == "paypal"  %}
											<a href="{{path("wep_subscription_paypal",{"id":subscription.id})}}" class="btn btn-primary btn-sm float-right">Pay now</a>
										{% elseif subscription.method == "card"  %}
											<a href="{{path("wep_subscription_card",{"id":subscription.id})}}" class="btn btn-primary btn-sm float-right">Pay now</a>
										{% elseif subscription.method == "manual"  %}
											<a href="{{path("wep_subscription_manual",{"id":subscription.id})}}" class="btn btn-primary btn-sm float-right">Pay now</a>
										{% endif %}
									{% endif %}
								</td>
							</tr>
						{% endfor %}
					</tbody>
				</table>
			</div>
		</div>
	</div>
{% endblock %}