import(common.tpl)


/* method tabs */
.settings|before = <?php $index = 0;?>
@method = [data-v-methods] [data-v-method]
@method|deleteAllButFirstChild

@method|before = <?php
if (isset($this->methods) && is_array($this->methods))
foreach ($this->methods as $index => $method) { ?>

	[data-v-methods] .tab-pane[data-v-method]|id = <?php echo "tab-$index";?>
	[data-v-methods] .tab-pane[data-v-method]|addClass = <?php if ($index == 0) echo "active";?>

	@method [data-v-method-payment_method_id]|href = <?php echo "#tab-$index";?>
	@method [data-v-method-payment_method_id]|addClass = <?php if ($index == 0) echo "active";?>
	@method [data-v-method-name] = <?php $lang = isset($method['lang']) && is_array($method['lang']) ? current($method['lang']) : [];if (! is_array($lang)) $lang = [];echo htmlspecialchars($lang['title'] ?? "Method $index");?>
	@method input.method|value = <?php
		$_setting = '@@__name:\]\[([^\]]+)\]__@@';
		echo htmlspecialchars($_POST['settings'][$_setting] ?? $method[$_setting] ?? '@@__value__@@');
	?>

	@method input.method|name = <?php
		$name = '@@__name__@@';
		echo str_replace('methods[0]',"methods[$index]", $name);
	?>	
	
	@method select|name = <?php
		$name = '@@__name__@@';
		echo str_replace('methods[0]',"methods[$index]", $name);
	?>

@method|after = <?php 
	}

$index = 0;	
$method = [];
?>

[data-v-testmode]|addNewAttribute = <?php if (isset($method['testMode']) && $method['testMode'] == 'true') echo 'checked';?>

@gateway = [data-v-gateway_id] [data-v-option]
@gateway|deleteAllButFirstChild

@gateway|before = <?php
$count = 0;
if(isset($this->gateway) && is_array($this->gateway)) {
	foreach ($this->gateway as $gateway_index => $gateway) {?>
	
	@gateway|innerText = <?php echo htmlspecialchars(Vvveb\humanReadable($gateway));?>
	@gateway|value	   = $gateway_index
	@gateway|addNewAttribute = <?php if (isset($method['gateway']) && $gateway_index == $method['gateway']) echo 'selected';?>
	
	@gateway|after = <?php 
		$count++;
	} 
}?>

@payment_status = [data-v-payment_status_id] [data-v-option]
@payment_status|deleteAllButFirstChild

@payment_status|before = <?php
$count = 0;
if(isset($this->payment_status) && is_array($this->payment_status)) {
	foreach ($this->payment_status as $payment_status_index => $payment_status) {?>
	
	@payment_status|innerText = <?php echo htmlspecialchars(Vvveb\humanReadable($payment_status));?>
	@payment_status|value	  = $payment_status_index
	@payment_status|addNewAttribute = <?php if (isset($method['payment_status_id']) && $payment_status_index == $method['payment_status_id']) echo 'selected';?>
	
	@payment_status|after = <?php 
		$count++;
	} 
}?>

@success_payment_status = [data-v-success_payment_status_id] [data-v-option]
@success_payment_status|deleteAllButFirstChild

@success_payment_status|before = <?php
$count = 0;
if(isset($this->success_payment_status) && is_array($this->success_payment_status)) {
	foreach ($this->success_payment_status as $success_payment_status_index => $success_payment_status) {?>
	
	@success_payment_status|innerText = <?php echo htmlspecialchars(Vvveb\humanReadable($success_payment_status));?>
	@success_payment_status|value	  = $success_payment_status_index
	@success_payment_status|addNewAttribute = <?php if (isset($method['success_payment_status_id']) && $success_payment_status_index == $method['success_payment_status_id']) echo 'selected';?>
	
	@success_payment_status|after = <?php 
		$count++;
	} 
}?>

@pending_payment_status = [data-v-pending_payment_status_id] [data-v-option]
@pending_payment_status|deleteAllButFirstChild

@pending_payment_status|before = <?php
$count = 0;
if(isset($this->pending_payment_status) && is_array($this->pending_payment_status)) {
	foreach ($this->pending_payment_status as $pending_payment_status_index => $pending_payment_status) {?>
	
	@pending_payment_status|innerText = <?php echo htmlspecialchars(Vvveb\humanReadable($pending_payment_status));?>
	@pending_payment_status|value	  = $pending_payment_status_index
	@pending_payment_status|addNewAttribute = <?php if (isset($method['pending_payment_status_id']) && $pending_payment_status_index == $method['pending_payment_status_id']) echo 'selected';?>
	
	@pending_payment_status|after = <?php 
		$count++;
	} 
}?>

@error_payment_status = [data-v-error_payment_status_id] [data-v-option]
@error_payment_status|deleteAllButFirstChild

@error_payment_status|before = <?php
$count = 0;
if(isset($this->error_payment_status) && is_array($this->error_payment_status)) {
	foreach ($this->error_payment_status as $error_payment_status_index => $error_payment_status) {?>
	
	@error_payment_status|innerText = <?php echo htmlspecialchars(Vvveb\humanReadable($error_payment_status));?>
	@error_payment_status|value	  = $error_payment_status_index
	@error_payment_status|addNewAttribute = <?php if (isset($method['error_payment_status_id']) && $error_payment_status_index == $method['error_payment_status_id']) echo 'selected';?>
	
	@error_payment_status|after = <?php 
		$count++;
	} 
}?>

/* language tabs */

[data-v-languages]|before = <?php $_lang_instance = '@@__data-v-languages__@@';$_i = 0;?>
@language = [data-v-languages] [data-v-language]
@language|deleteAllButFirstChild
//@language|addClass = <?php if ($_i == 0) echo 'active';?>

@language|before = <?php

foreach ($this->languagesList as $language) { ?>
	[data-v-languages] [data-v-language-id]|id = <?php echo "lang-$index-" . $language['code'] . '-' . $_lang_instance;?>
	[data-v-languages]  [data-v-language-id]|addClass = <?php if ($_i == 0) echo 'show active';?>

	@language [data-v-language-name] = $language['name']
	@language [data-v-language-img]|title = $language['name']
	@language [data-v-language-img]|src = <?php echo 'language/' . $language['code'] . '/' . $language['code'] . '.png';?>
	@language [data-v-language-link]|href = <?php echo "#lang-$index-" . $language['code'] . '-' . $_lang_instance?>
	@language [data-v-language-link]|addClass = <?php if ($_i == 0) echo 'active';?>

	@language [data-v-lang-*] = <?php 
		$name = '@@__data-v-lang-(*)__@@';
		echo htmlspecialchars($method['lang'][$language['language_id']][$name] ?? ($_POST['methods'][$index]['lang'][$language['language_id']][$name] ?? ''))
	?>

	@language [data-v-lang-*]|name = <?php 
		$name = '@@__data-v-lang-(*)__@@';
		echo htmlspecialchars("methods[$index][lang][{$language['language_id']}][$name]");
	?>	

@language|after = <?php 
$_i++;
}
?>


@region_group = [data-v-region_group_id] [data-v-option]
@region_group|deleteAllButFirstChild

@region_group|before = <?php
$count = 0;
if(isset($this->region_group) && is_array($this->region_group)) {
	foreach ($this->region_group as $region_group_index => $region_group) {?>
	
	
	@region_group|innerText = $region_group
	@region_group|value	    = $region_group_index
	@region_group|addNewAttribute = <?php if (isset($method['region_group_id']) && $region_group_index == $method['region_group_id']) echo 'selected';?>
	
	
	@region_group|after = <?php 
		$count++;
	} 
}?>

@tax_type = [data-v-tax_type_id] [data-v-option]
@tax_type|deleteAllButFirstChild

@tax_type|before = <?php
$count = 0;
if(isset($this->tax_type) && is_array($this->tax_type)) {
	foreach ($this->tax_type as $tax_type_index => $tax_type) {?>
	
	
	@tax_type|innerText = $tax_type
	@tax_type|value	    = $tax_type_index
	@tax_type|addNewAttribute = <?php if (isset($method['tax_type_id']) && $tax_type_index == $method['tax_type_id']) echo 'selected';?>
	
	
	@tax_type|after = <?php 
		$count++;
	} 
}?>


@order_status = [data-v-order_status_id] [data-v-option]
@order_status|deleteAllButFirstChild

@order_status|before = <?php
$count = 0;
if(isset($this->order_status) && is_array($this->order_status)) {
	foreach ($this->order_status as $order_status_index => $order_status) {?>
	
	
	@order_status|innerText = <?php echo htmlspecialchars(Vvveb\humanReadable($order_status));?>
	@order_status|value     = $order_status_index
	@order_status|addNewAttribute = <?php if (isset($method['order_status_id']) && $order_status_index == $method['order_status_id']) echo 'selected';?>
	
	
	@order_status|after = <?php 
		$count++;
	} 
}?>
