{{function name="selectOptions" aOptions=0 mOption=0}}
	{{foreach from=$aOptions item=sOption}}
		<option value="{{$sOption@key}}" {{if ( is_array( $mOption ) && in_array( $sOption@key, $mOption ) ) || ( $sOption@key == $mOption )}}selected="selected"{{/if}}>{{$sOption}}</option>
	{{/foreach}}
{{/function}}

<h1>{{$lang.Edit_payment_method}}</h1>
<script type="text/javascript">
	$(document).ready(function(){
		$("form#payment-form").validate();
		$("form#payment-form #payment-name").rules("add", {required: true});
		$("form#payment-form #print-form").rules("add", {required: true});
		$("form#payment-form #invoice-payment").rules("add", {required: true});
		$("form#payment-form textarea[name='sDescription']").rules('add', {maxbytes: 65535});
		$("form#payment-form textarea[name='sEmailDescription']").rules('add', {maxbytes: 65535});
	});
</script>
<form action="?p={{$_GET.p}}" method="post" id="payment-form" id="mainForm">
	<fieldset>
		<input type="hidden" name="iPayment" value="{{$aPayment.iPayment}}" />
		<div class="block50">
			<table  class="details">
				<tr>
					<th class="name">{{$lang.Name}}</th><td class="value"><input type="text" id="payment-name" name="sName" value="{{$aPayment.sName}}" class="input" size="50" maxlength="40" alt="simple" /></td><td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_payment_name}}" /></td>
				</tr><tr>
					<th class="name">{{$lang.Active}}</th><td class="value"><input name="iStatus" type="checkbox"{{if $aPayment.iStatus}} checked="checked"{{/if}} value="1" /></td><td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_payment_status}}" /></td>
				</tr><tr>
					<th class="name">{{$lang.Relate_with}}</th><td class="value"><select name="iOuterSystem"><option value="">{{$lang.none}}</option>{{selectOptions aOptions=$aOuterPaymentOption mOption=$aPayment.iOuterSystem}}</select></td><td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_payment_outerSystem}}" /></td>
				</tr><tr>
					<th class="name">{{$lang.Payment_print_form}}</th><td class="value"><select name="iPrintForm" id="print-form">{{selectOptions aOptions=$aYesNo mOption=$aPayment.iPrintForm}}</select></td><td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_payment_printForm}}" /></td>
				</tr><tr>
					<th class="name">{{$lang.Payment_invoice}}</th><td class="value"><select name="iInvoicePayment" id="invoice-payment">{{selectOptions aOptions=$aInvoicesPayments mOption=$aPayment.iInvoicePayment}}</select></td><td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_payment_invoicePayment}}" /></td>
				</tr><tr>
					<th class="name">{{$lang.Max_order}}</th><td class="value"><input type="text" id="payment-max-order" name="fMaxOrder" value="{{$aPayment.fMaxOrder}}" class="input" size="50" maxlength="40" alt="simple" /></td><td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_payment_max_order}}" /></td>
				</tr>
			</table>
		</div>
		<div class="block50">
			<p class="help">{{$lang.help_payment_descriptions}}</p>
			<ul class="help" style="width: 45%; display: inline-block; vertical-align: top;">
				<li>{{$lang.Order_summary}}: <strong>%sSummary%</strong></li>
				<li>{{$lang.Carrier}}: <strong>%sCarrierName%</strong></li>
				<li>{{$lang.Order_id}}: <strong>%iOrder%</strong></li>
				<li>{{$lang.First_and_last_name}}: <strong>%sName%</strong></li>
				<li>{{$lang.Email}}: <strong>%sEmail%</strong></li>
				<li>{{$lang.Invoice}}: <strong>%sInvoice%</strong></li>
				<li>{{$lang.Invoices_Bank}}: <strong>%sBankName%</strong></li>
				<li>{{$lang.Invoices_Account}}: <strong>%sBankAccount%</strong></li>
			</ul>
			<ul class="help" style="width: 45%; display: inline-block; vertical-align: top;">
				<li>{{$lang.Invoices_company_name}}: <strong>{{ldelim}}ConfigShow(invoices_company_name){{rdelim}}</strong></li>
				<li>{{$lang.Invoices_address}}: <strong>{{ldelim}}ConfigShow(invoices_address){{rdelim}}</strong></li>
				<li>{{$lang.Invoices_postal_code}}: <strong>{{ldelim}}ConfigShow(invoices_postal_code){{rdelim}}</strong></li>
				<li>{{$lang.Invoices_city}}: <strong>{{ldelim}}ConfigShow(invoices_city){{rdelim}}</strong></li>
				<li>{{$lang.Invoices_NIP}}: <strong>{{ldelim}}ConfigShow(invoices_NIP){{rdelim}}</strong></li>
				<li>{{$lang.Invoices_REGON}}: <strong>{{ldelim}}ConfigShow(invoices_REGON){{rdelim}}</strong></li>
				<li>{{$lang.Invoices_phone}}: <strong>{{ldelim}}ConfigShow(invoices_phone){{rdelim}}</strong></li>
				<li>{{$lang.Invoices_email}}: <strong>{{ldelim}}ConfigShow(invoices_email){{rdelim}}</strong></li>
				<li>{{$lang.Invoices_www}}: <strong>{{ldelim}}ConfigShow(invoices_www){{rdelim}}</strong></li>
			</ul>
		</div>
		<div class="block50">
			<h2>{{$lang.Payment_description}}</h2> <p class="help">{{$lang.Payment_description_description}}</p>
			{{htmleditor sName='sDescription' iH='480px' iW='100%' sContent=$aPayment.sDescription}}
		</div>
		<div class="block50">
			<h2>{{$lang.Payment_email_description}}</h2> <p class="help">&nbsp;</p>
			{{htmleditor sName='sEmailDescription' iH='480px' iW='100%' sContent=$aPayment.sEmailDescription}}
		</div>
		<div class="save float"><div class="save floatcontainer">
			<input type="submit" class="submit" value="&laquo; {{$lang.return}}"  onclick="location.href = '?p=payments-list'; return false;"/> <input type="submit" class="submit" value="{{$lang.Save}} &raquo;" name="sOption" />
		</div></div>
	</fieldset>
</form>