{{ header }}{{ column_left }}
<div id="content">
	<div class="page-header">
		<div class="container-fluid">


			<div class="pull-right">

				<button type="submit" id="button-resume" data-toggle="tooltip" title="{{ button_resume }}" class="btn btn-primary" name="enable">
					<i class="fa fa-undo"></i>
					Resume</button>
				<button type="submit" id="button-pause" data-toggle="tooltip" title="{{ button_pause }}" class="btn btn-warning" name="disable">
					<i class="fa fa-pause"></i>
					Pause</button>
				<button type="submit" id="button-cancel" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-danger" name="disable">
					<i class="fa fa-ban"></i>
					Cancel</button>


			</div>
			<h1>{{ heading_title }}</h1>
			<ul class="breadcrumb">
				{% for breadcrumb in breadcrumbs %}
					<li>
						<a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a>
					</li>
				{% endfor %}
			</ul>
		</div>
	</div>
	<div class="container-fluid">
		{% if error_warning %}
			<div class="alert alert-danger alert-dismissible">
				<i class="fa fa-exclamation-circle"></i>
				sasd {{ error_warning }}
				<button type="button" class="close" data-dismiss="alert">&times;</button>
			</div>
		{% endif %}
		{% if success %}
			<div class="alert alert-success alert-dismissible">
				<i class="fa fa-check-circle"></i>
				{{ success }}
				<button type="button" class="close" data-dismiss="alert">&times;</button>
			</div>
		{% endif %}
	{% if success1 %}
			<div class="alert alert-danger alert-dismissible">
				<i class="fa fa-check-circle"></i>
				{{ success1 }}
				<button type="button" class="close" data-dismiss="alert">&times;</button>
			</div>
		{% endif %}
		<div class="row">
			<div id="filter-order" class="col-md-3 col-md-push-9 col-sm-12 hidden-sm hidden-xs">
				<div class="panel panel-default">
					<div class="panel-heading">
						<h3 class="panel-title">
							<i class="fa fa-filter"></i>
							{{ text_filter }}</h3>
					</div>
					<div class="panel-body">
						<div class="form-group">
							<label class="control-label" for="input-order-id">{{ entry_subscription_id }}</label>
							<input type="text" name="filter_subscription_id" value="{{ filter_subscription_id }}" placeholder="{{ entry_subscription_id }}" id="input-order-id" class="form-control"/>
						</div>

						<div class="form-group">
							<label class="control-label" for="input-customer">{{ entry_plan_id }}</label>
							<input type="text" name="filter_plan_name" value="{{ filter_plan_name }}" placeholder="{{ entry_plan_id }}" id="input-customer" class="form-control"/>
						</div>
						<div class="form-group">
							<label class="control-label" for="input-order-status">{{ entry_plan_status }}</label>
							<select name="filter_subscription_status" id="input-order-status" class="form-control">
								<option value="">{{text_select}}</option>
								{% if filter_subscription_status == 'active' %}
									<option value="active" selected="selected">{{ text_active }}</option>
								{% else %}
									<option value="active">{{ text_active }}</option>
								{% endif %}
								{% if filter_subscription_status == 'pause' %}
									<option value="pause" selected="selected">{{ text_pause }}</option>
								{% else %}
									<option value="pause">{{ text_pause }}</option>
								{% endif %}
								{% if filter_subscription_status == 'cancelled' %}
									<option value="cancelled" selected="selected">{{ text_cancelled }}</option>
								{% else %}
									<option value="cancelled">{{ text_cancelled }}</option>
								{% endif %}
							</select>
						</div>
						<div class="form-group">
							<label class="control-label" for="input-date-added">{{ entry_date_created }}</label>
							<div class="input-group date">
								<input type="text" name="filter_date_created" value="{{ filter_date_created }}" placeholder="{{ entry_date_added }}" data-date-format="YYYY-MM-DD" id="input-date-added" class="form-control"/>
								<span class="input-group-btn">
									<button type="button" class="btn btn-default">
										<i class="fa fa-calendar"></i>
									</button>
								</span>
							</div>
						</div>
						<div class="form-group text-right">
							<button type="button" id="button-filter" class="btn btn-default">
								<i class="fa fa-filter"></i>
								{{ button_filter }}</button>
						</div>
					</div>
				</div>
			</div>
			<div class="col-md-9 col-md-pull-3 col-sm-12">
				<div class="panel panel-default">
					<div class="panel-heading">
						<h3 class="panel-title">
							<i class="fa fa-list"></i>
							{{ text_subscription_list }}</h3>
					</div>
					<div class="panel-body">
						<form action={{status}} method="post" enctype="multipart/form-data" id="form-plan" name="form-plan">
							<div class="table-responsive">
								<table class="table table-bordered table-hover">
									<thead>
										<tr>
											<td style="width: 1px;" class="text-center"><input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);"/></td>
											 <td class="text-left">{% if sort == 's.entity_id' %}
													<a href="{{ sort_order }}" class="{{ order|lower }}">{{ column_id }}</a>
												{% else %}
													<a href="{{ sort_order }}">{{ column_id }}</a>
												{% endif %}</td>
											<td class="text-left">
												{% if sort == 's.subscription_id' %}
													<a href="{{ sort_order }}" class="{{ order|lower }}">{{ column_subscription_id }}</a>
												{% else %}
													<a href="{{ sort_order }}">{{ column_subscription_id }}</a>
												{% endif %}
											</td>
											<td class="text-left">
												{% if sort == 'p.plan_id' %}
													<a href="{{ sort_order }}" class="{{ order|lower }}">{{ column_plan_id }}</a>
												{% else %}
													<a href="{{ sort_order }}">{{ column_plan_id }}</a>
												{% endif %}
											</td>
											<td class="text-left">
												{% if sort == 'customer' %}
													<a href="{{ sort_customer }}" class="{{ order|lower }}">{{ column_customer }}</a>
												{% else %}
													<a href="{{ sort_customer }}">{{ column_customer }}</a>
												{% endif %}
											</td>
											<td class="text-left">
												{% if sort == 'customer' %}
													<a href="{{ sort_customer }}" class="{{ order|lower }}">{{ column_product_name }}</a>
												{% else %}
													<a href="{{ sort_customer }}">{{ column_product_name }}</a>
												{% endif %}
											</td>
											<td class="text-left">
												{% if sort == 'order_status' %}
													<a href="{{ sort_status }}" class="{{ order|lower }}">{{ column_subscription_status }}</a>
												{% else %}
													<a href="{{ sort_status }}">{{ column_subscription_status }}</a>
												{% endif %}
											</td>
											<td class="text-left">
												{% if sort == 'o.total' %}
													<a href="{{ sort_total }}" class="{{ order|lower }}">{{ column_total_count }}</a>
												{% else %}
													<a href="{{ sort_total }}">{{ column_total_count }}</a>
												{% endif %}
											</td>
											<td class="text-left">
												{% if sort == 'o.date_added' %}
													<a href="{{ sort_date_added }}" class="{{ order|lower }}">{{ column_paid_count }}</a>
												{% else %}
													<a href="{{ sort_date_added }}">{{ column_paid_count }}</a>
												{% endif %}
											</td>
											<td class="text-left">
												{% if sort == 'o.date_modified' %}
													<a href="{{ sort_date_modified }}" class="{{ order|lower }}">{{ column_remaining_count }}</a>
												{% else %}
													<a href="{{ sort_date_modified }}">{{ column_remaining_count }}</a>
												{% endif %}
											</td>
											<td class="text-left">
												{% if sort == 'o.date_modified' %}
													<a href="{{ sort_date_modified }}" class="{{ order|lower }}">{{ column_next_charge_at }}</a>
												{% else %}
													<a href="{{ sort_date_modified }}">{{ column_next_charge_at }}</a>
												{% endif %}
											</td>
											<td class="text-left">
												{% if sort == 'o.date_modified' %}
													<a href="{{ sort_date_modified }}" class="{{ order|lower }}">{{ column_start_at }}</a>
												{% else %}
													<a href="{{ sort_date_modified }}">{{ column_start_at }}</a>
												{% endif %}
											</td>
											<td class="text-left">
												{% if sort == 'o.date_modified' %}
													<a href="{{ sort_date_modified }}" class="{{ order|lower }}">{{ column_end_at }}</a>
												{% else %}
													<a href="{{ sort_date_modified }}">{{ column_end_at }}</a>
												{% endif %}
											</td>
											<td class="text-left">
												{% if sort == 's.subscription_created_at' %}
													<a href="{{ sort_plan_status }}" class="{{ order|lower }}">{{ column_subscription_created_at }}</a>
												{% else %}
													<a href="{{ sort_plan_status }}">{{ column_subscription_created_at }}</a>
												{% endif %}
											</td>
											<td class="text-left">
												{% if sort == 'o.date_modified' %}
													<a href="{{ sort_date_modified }}" class="{{ order|lower }}">{{ column_action }}</a>
												{% else %}
													<a href="{{ sort_date_modified }}">{{ column_action }}</a>
												{% endif %}
											</td>
										</tr>
									</thead>
									<tbody>

										{% if subscriptions %}
											{% for sub in subscriptions %}
												<tr>
													<td class="text-center">
														{% if sub.entity_id in selected %}
															<input type="checkbox" name="selected[]" value="{{ sub.entity_id }}" checked="checked"/>
														{% else %}
															<input type="checkbox" name="selected[]" value="{{ sub.entity_id }}"/>
														{% endif %}
													</td>
													<td class="text-left">{{ sub.entity_id }}</td>
													<td class="text-left">{{ sub.subscription_id }}</td>
													<td class="text-left">{{ sub.plan_id }}</td>
													<td class="text-left">{{ sub.customer_fname }}
														{{ sub.customer_lname }}
													</td>
													<td class="text-left">{{ sub.product_name }}
													</td>
													<td class="text-left">{{ sub.status }}</td>
													<td class="text-left">{{ sub.total_count }}</td>
													<td class="text-left">{{ sub.paid_count}}</td>
													<td class="text-left">{{ sub.remaining_count}}</td>
													<td class="text-left">{{ sub.next_charge_at }}</td>
													<td class="text-left">{{ sub.start_at }}</td>
													<td class="text-left">{{ sub.end_at }}</td>
													<td class="text-left">{{ sub.created_at }}</td>
													<td class="text-left">
														<div style="min-width: 120px;">
															<div class="btn-group">
																<a href="{{ sub.view }}" data-toggle="tooltip" title="{{ button_view }}" class="btn btn-primary">
																	<i class="fa fa-eye"></i>
																</a>
																<button type="button" data-toggle="dropdown" class="btn btn-primary dropdown-toggle">
																	<span class="caret"></span>
																</button>
																<ul class="dropdown-menu dropdown-menu-right">
																	<li>
																		<a href="{{ sub.singleResume }}">
																			<i class="fa fa-undo"></i>
																			{{ button_resume }}</a>
																	</li>
																	<li>
																		<a href="{{ sub.singlePause }}">
																			<i class="fa fa-pause"></i>
																			{{ button_pause }}</a>
																	</li>
																	<li>
																		<a href="{{ sub.singleCancel }}">
																			<i class="fa fa-ban"></i>
																			{{ button_cancel }}</a>
																	</li>
																</ul>
															</div>
														</div>
													</td>
												</tr>
											{% endfor %}
										{% else %}
											<tr>
												<td class="text-center" colspan="13">{{ text_no_results }}</td>
											</tr>
										{% endif %}
										<input type="hidden" name="status" id="status" value="">
									</tbody>
								</table>
							</div>
						</form>
						<div class="row">
							<div class="col-sm-6 text-left">{{ pagination }}</div>
							<div class="col-sm-6 text-right">{{ results }}</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<script
			type="text/javascript">
			<!--

			$('#button-resume').click(function () {
$('#status').val('1');

});
$('#button-pause').click(function () {
$('#status').val('2');
});

$('#button-cancel').click(function () {
$('#status').val('3');
});
// --> </script> <script type="text/javascript"><!--
$('#button-filter').on('click', function () {
url = '';

var filter_subscription_id = $('input[name=\'filter_subscription_id\']').val();

if (filter_subscription_id) {
url += '&filter_subscription_id=' + encodeURIComponent(filter_subscription_id);
}

var filter_plan_name = $('input[name=\'filter_plan_name\']').val();

if (filter_plan_name) {
url += '&filter_plan_name=' + encodeURIComponent(filter_plan_name);
}

var filter_subscription_status = $('select[name=\'filter_subscription_status\']').val();

if (filter_subscription_status !== '') {
url += '&filter_subscription_status=' + encodeURIComponent(filter_subscription_status);
}


var filter_date_created = $('input[name=\'filter_date_created\']').val();

if (filter_date_created) {
url += '&filter_date_created=' + encodeURIComponent(filter_date_created);
}

location = 'index.php?route=extension/payment/razorpay/getSubscription&user_token={{ user_token }}' + url;
});
// -->
			-->
		</script>

		<script type="text/javascript"><!--

		//-->
	</script>
	<script src="view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
	<link href="view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css" type="text/css" rel="stylesheet" media="screen"/>
	<script
		type="text/javascript">
		<!--
		$('.date').datetimepicker({language: '{{ datepicker }}', pickTime: false});
//
		-->
	</script>
	{{footer}}
