{{ header }}{{ column_left }}
<div id="content">
	<div class="page-header">
		<div class="container-fluid">
			<div class="pull-right">
				<button type="submit" form="form-payment" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary">
					<i class="fa fa-save"></i>
				</button>
				<a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default">
					<i class="fa fa-reply"></i>
				</a>
			</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>
				{{ error_warning }}
				<button type="button" class="close" data-dismiss="alert">&times;</button>
			</div>
		{% endif %}

		{% if php_version_old %}
			<div class="alert alert-warning alert-dismissible">
				<i class="fa fa-exclamation-circle"></i>
				You are using a older version of php, You can still use the payment method via external payment. To unlock additional features update your php to >= 7.2.5.
				<button type="button" class="close" data-dismiss="alert">&times;</button>
			</div>
		{% endif %}

		<form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-payment" class="form-horizontal">

			<div class="panel panel-default">
				<div class="panel-heading">
					<h3 class="panel-title">
						<i class="fa fa-pencil"></i>
						{{ text_edit }}</h3>
					<span class='pull-right'>v2.10.0 for oc3.0.x</span>
				</div>
				<div class="panel-body">
				
					
					<ul class="nav nav-tabs">
						<li class="active">
							<a data-toggle="tab" href="#store_tab_0">Default Store</a>
						</li>
						{% for store in stores %}						
							<li class="{% if tab_page == store['store_id'] %} active {% endif %}" >
								<a data-toggle="tab" href="#store_tab_{{store['store_id']}}">{{store['name']}}</a>
							</li>							
						{% endfor %}
					</ul>

					
					<div class="tab-content">
						<div id="store_tab_0" class="tab-pane fade in active">

							<!-- FORM FOR API DATA -->
							{% if php_version_old == false %}

								<div class="form-group {% if payment_cardinity_external == 0 %} required {% endif %} internal_credentials">
									<label class="col-sm-2 control-label" for="payment_cardinity_external">
										<span data-toggle="tooltip" title="{{ help_consumer_cred }}">{{ entry_key }}</span>
									</label>
									<div class="col-sm-10">
										<input type="text" name="api_data[0][payment_cardinity_key]" value="{{ api_data[0]['payment_cardinity_key'] }}" placeholder="{{ entry_key }}" id="input-key" class="form-control"/>
										{% if error_key[0] %}
											<div class="text-danger">{{ error_key[0] }}</div>
										{% endif %}
									</div>
								</div>

								<div class="form-group {% if payment_cardinity_external == 0 %} required {% endif %} internal_credentials">
									<label class="col-sm-2 control-label" for="input-secret">
										<span data-toggle="tooltip" title="{{ help_consumer_cred }}">{{ entry_secret }}</span>
									</label>
									<div class="col-sm-10">
										<input type="text" name="api_data[0][payment_cardinity_secret]" value="{{ api_data[0]['payment_cardinity_secret'] }}" placeholder="{{ entry_secret }}" id="input-secret" class="form-control"/>
										{% if error_secret[0] %}
											<div class="text-danger">{{ error_secret[0] }}</div>
										{% endif %}
									</div>
								</div>

							{% endif %}


							<div class="form-group {% if payment_cardinity_external %} required {% endif %} external_credentials">
								<label class="col-sm-2 control-label" for="input-key">{{ project_key }}</label>
								<div class="col-sm-10">
									<input type="text" name="api_data[0][payment_cardinity_project_key]" value="{{ api_data[0]['payment_cardinity_project_key'] }}" placeholder="{{ project_key }}" id="input-key" class="form-control"/>
									{% if error_project_key[0] %}
										<div class="text-danger">{{ error_project_key[0] }}</div>
									{% endif %}
								</div>
							</div>
							<div class="form-group {% if payment_cardinity_external %} required {% endif %} external_credentials">
								<label class="col-sm-2 control-label" for="input-secret">{{ project_secret }}</label>
								<div class="col-sm-10">
									<input type="text" name="api_data[0][payment_cardinity_project_secret]" value="{{ api_data[0]['payment_cardinity_project_secret'] }}" placeholder="{{ project_secret }}" id="input-secret" class="form-control"/>
									{% if error_project_secret[0] %}
										<div class="text-danger">{{ error_project_secret[0] }}</div>
									{% endif %}
								</div>
							</div>

							<!-- FORM FOR API DATA END DEFAULT-->
							
							
						</div>
						{% for store in stores %}
							<div id="store_tab_{{store['store_id']}}" class="tab-pane fade in {% if tab_page == store['store_id'] %} active {% endif %}">
								<p>Settings specific {{ store['url'] }}.</p>
								<!-- FORM FOR API DATA MULTI STORE -->

								{% if php_version_old == false %}

									<div class="form-group {% if payment_cardinity_external == 0 %} required {% endif %} internal_credentials">
										<label class="col-sm-2 control-label" for="payment_cardinity_external">
											<span data-toggle="tooltip" title="{{ help_consumer_cred }}">{{ entry_key }}</span>
										</label>
										<div class="col-sm-10">
											<input type="text" name="api_data[{{store['store_id']}}][payment_cardinity_key]" value="{{ api_data[store['store_id']]['payment_cardinity_key']}}" placeholder="{{ entry_key }}" id="input-key" class="form-control"/>
											{% if error_key[store['store_id']] %}
												<div class="text-danger">{{ error_key[store['store_id']] }}</div>
											{% endif %}
										</div>
									</div>

									<div class="form-group {% if payment_cardinity_external == 0 %} required {% endif %} internal_credentials">
										<label class="col-sm-2 control-label" for="input-secret">
											<span data-toggle="tooltip" title="{{ help_consumer_cred }}">{{ entry_secret }}</span>
										</label>
										<div class="col-sm-10">
											<input type="text" name="api_data[{{store['store_id']}}][payment_cardinity_secret]" value="{{ api_data[store['store_id']]['payment_cardinity_secret'] }}" placeholder="{{ entry_secret }}" id="input-secret" class="form-control"/>
											{% if error_secret[store['store_id']] %}
												<div class="text-danger">{{ error_key[store['store_id']] }}</div>
											{% endif %}
										</div>
									</div>

								{% endif %}



								<div class="form-group {% if payment_cardinity_external %} required {% endif %} external_credentials">
									<label class="col-sm-2 control-label" for="input-key">{{ project_key }}</label>
									<div class="col-sm-10">
										<input type="text" name="api_data[{{store['store_id']}}][payment_cardinity_project_key]" value="{{ api_data[store['store_id']]['payment_cardinity_project_key'] }}" placeholder="{{ project_key }}" id="input-key" class="form-control"/>
										{% if error_project_key[store['store_id']] %}
											<div class="text-danger">{{ error_project_key[store['store_id']] }}</div>
										{% endif %}
									</div>
								</div>
								<div class="form-group {% if payment_cardinity_external %} required {% endif %} external_credentials">
									<label class="col-sm-2 control-label" for="input-secret">{{ project_secret }}</label>
									<div class="col-sm-10">
										<input type="text" name="api_data[{{store['store_id']}}][payment_cardinity_project_secret]" value="{{ api_data[store['store_id']]['payment_cardinity_project_secret'] }}" placeholder="{{ project_secret }}" id="input-secret" class="form-control"/>
										{% if error_project_secret[store['store_id']] %}
											<div class="text-danger">{{ error_project_secret[store['store_id']] }}</div>
										{% endif %}
									</div>
								</div>

								<!-- FORM FOR API DATA END -->
							</div>
						{% endfor %}
					</div>

			</div>
		</div>

		<div class="panel panel-default">			
			<div class="panel-body">
				

							<div class="form-group">
								<label class="col-sm-2 control-label" for="payment_cardinity_external">
									<span data-toggle="tooltip" title="{{ help_external }}">{{ entry_external }}</span>
								</label>
								<div class="col-sm-10">
									<select name="payment_cardinity_external" id="input-external" class="form-control">
										{% if payment_cardinity_external %}
											<option value="1" selected="selected">{{ text_enabled }}</option>
											{% if php_version_old == false %}
												<option value="0">{{ text_disabled }}</option>
											{% endif %}
										{% else %}
											<option value="1">{{ text_enabled }}</option>
											<option value="0" selected="selected">{{ text_disabled }}</option>
										{% endif %}
									</select>
								</div>
							</div>

					<div class="form-group">
						<label class="col-sm-2 control-label" for="input-debug">
							<span data-toggle="tooltip" title="{{ help_debug }}">{{ entry_debug }}</span>
						</label>
						<div class="col-sm-10">
							<select name="payment_cardinity_debug" id="input-debug" class="form-control">
								{% if payment_cardinity_debug %}
									<option value="1" selected="selected">{{ text_enabled }}</option>
									<option value="0">{{ text_disabled }}</option>
								{% else %}
									<option value="1">{{ text_enabled }}</option>
									<option value="0" selected="selected">{{ text_disabled }}</option>
								{% endif %}
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label" for="input-total">
							<span data-toggle="tooltip" title="{{ help_total }}">{{ entry_total }}</span>
						</label>
						<div class="col-sm-10">
							<input type="text" name="payment_cardinity_total" value="{{ payment_cardinity_total }}" placeholder="{{ entry_total }}" id="input-total" class="form-control"/>
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-2 control-label" for="input-order-status">{{ entry_order_status }}</label>
						<div class="col-sm-10">
							<select name="payment_cardinity_order_status_id" id="input-order-status" class="form-control">
								{% for order_status in order_statuses %}
									{% if order_status.order_status_id == payment_cardinity_order_status_id %}
										<option value="{{ order_status.order_status_id }}" selected="selected">{{ order_status.name }}</option>
									{% else %}
										<option value="{{ order_status.order_status_id }}">{{ order_status.name }}</option>
									{% endif %}
								{% endfor %}
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label" for="input-geo-zone">{{ entry_geo_zone }}</label>
						<div class="col-sm-10">
							<select name="payment_cardinity_geo_zone_id" id="input-geo-zone" class="form-control">
								<option value="0">{{ text_all_zones }}</option>
								{% for geo_zone in geo_zones %}
									{% if geo_zone.geo_zone_id == payment_cardinity_geo_zone_id %}
										<option value="{{ geo_zone.geo_zone_id }}" selected="selected">{{ geo_zone.name }}</option>
									{% else %}
										<option value="{{ geo_zone.geo_zone_id }}">{{ geo_zone.name }}</option>
									{% endif %}
								{% endfor %}
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label" for="input-status">{{ entry_status }}</label>
						<div class="col-sm-10">
							<select name="payment_cardinity_status" id="input-status" class="form-control">
								{% if payment_cardinity_status %}
									<option value="1" selected="selected">{{ text_enabled }}</option>
									<option value="0">{{ text_disabled }}</option>
								{% else %}
									<option value="1">{{ text_enabled }}</option>
									<option value="0" selected="selected">{{ text_disabled }}</option>
								{% endif %}
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label" for="input-sort-order">{{ entry_sort_order }}</label>
						<div class="col-sm-10">
							<input type="text" name="payment_cardinity_sort_order" value="{{ payment_cardinity_sort_order }}" placeholder="{{ entry_sort_order }}" id="input-sort-order" class="form-control"/>
						</div>
					</div>
				
			</div>
		</div>

		</form>

		<br/><br/><br/>
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">
					<i class="fa fa-file"></i>
					{{ entry_log }}</h3>
			</div>
			<div class="panel-body">
				<form method='post' enctype="multipart/form-data" action='{{entry_log_action}}'>
					<table class='table'>
						<tr>
							<td>
								<select name="cardinity_trns_month" class="form-control">
									{% for i in 1..12 %}
										<option value="{{ i }}">{{ i }}</option>
									{% endfor %}
								</select>
							</td>
							<td>
								<select name="cardinity_trns_year" class="form-control">
									{% for y in yearNow..yearNow+30 %}
										<option value="{{ y }}">{{ y }}</option>
									{% endfor %}
								</select>
							</td>
							<td>
								<button type='submit' class="btn btn-primary" target='_blank'>
									<i class="fa fa-download"></i>
									Download Transaction Log</button>
							</td>
						</tr>
					</table>
				</form>

			</div>
		</div>

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

		$("#input-external").change(function () {

if ($("#input-external").val() == 1) {
$(".external_credentials").toggleClass('required', true);
$(".internal_credentials").toggleClass('required', false);
} else {
$(".external_credentials").toggleClass('required', false);
$(".internal_credentials").toggleClass('required', true);
}
});
$('.date').datetimepicker({language: '{{ datepicker }}', pickTime: false});
//--></script>
	{{ footer }}
