<?php global $vis_language;?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
	<div class="col-sm-6">
		<h3 class="m-b-xs text-black"><span><? echo $vis_language['TXTGATEWAY'];?></h3>
		<ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
			<li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><?echo $vis_language['TXTHOME'];?></a></li>
			<li><a class="link" href="#/setting/setting_menu/<? echo $vis_language['TXTSETTINGS'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<?echo $vis_language['TXTSETTINGS'];?>',{'vis_module':'setting','vis_operation':'setting_menu'});"><? echo $vis_language['TXTSETTINGS'];?></a></li>
			<li class="active"><? echo $vis_language['TXTGATEWAY'];?></li>
		</ul>
	</div>
</section>
<section class="padder">
	<section class='panel panel-default'>
		<header class="panel-heading sub_header"><? echo $vis_language['TXTGATEWAY']; ?></header>
		<div class="panel-body">
			<form method="post" name="vis_billing_setting" id="vis_billing_setting_sub" class="form-horizontal">
				<div class="form-group">
					<label class="col-sm-2 control-label"><?= $vis_language['TXTDOMAIN']; ?></label>
					<div class='col-sm-10'>
						<select class='form-control input-sm selectpicker' name="vis_domain" id="vis_domain" onchange="$('#vis_workpanel_div').visExecution('load_area',{'vis_module':'setting', 'vis_operation':'billing_setting', 'vis_domain_id':$(this).val(), 'vis_gateway':$('input[name=vis_gateway]:checked').val()})" <? if(count($domain) > 10) echo 'data-live-search="true"' ?> >
							<? for ($i = 0; $i < count($domain); $i++)
							echo '<option value="' . $domain[$i]['domain_id'] . '"' . ($domain[$i]['domain_id'] == $domain_sel ? ' selected="selected"' : '') . '>' . $domain[$i]['domain_name'] . '</option>';  ?>
						</select>
					</div>
				</div>
				<div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTGATEWAY']; ?></label>
               <div class="col-sm-10">
                  <div class="radio i-checks m-r-lg pull-left">
				  <label>
                  <input type="radio" name="vis_gateway" value="paypal_email" <?php if($payment_gateway == 'paypal_email') echo 'checked="checked"'?> onclick="$('#vis_workpanel_div').visExecution('load_area',{'vis_module':'setting', 'vis_operation':'billing_setting', 'vis_gateway':$(this).val(),'vis_domain_id':$('#vis_domain').val()})"/><i></i>
                  <? echo $vis_language['TXTPAYPALEMAIL']; ?></label></div>
                  <div class="radio i-checks m-r-lg pull-left">
				  <label>
                  <input type="radio" name="vis_gateway" value="authorize.net" <?php if($payment_gateway == 'authorize.net') echo 'checked="checked"';?> onclick="$('#vis_workpanel_div').visExecution('load_area',{'vis_module':'setting', 'vis_operation':'billing_setting', 'vis_gateway':$(this).val(),'vis_domain_id':$('#vis_domain').val()})"/><i></i>
                  <? echo $vis_language['TXTAUTHORIZE']; ?>
                  </label></div>
                   <div class="radio i-checks pull-left">
				  <label>
                  <input type="radio" name="vis_gateway" value="stripe" <?php if($payment_gateway == 'stripe') echo 'checked="checked"';?> onclick="$('#vis_workpanel_div').visExecution('load_area',{'vis_module':'setting', 'vis_operation':'billing_setting', 'vis_gateway':$(this).val(),'vis_domain_id':$('#vis_domain').val()})"/><i></i>
                  <? echo $vis_language['TXTSTRIPE']; ?>
                  </label></div>
               </div>
          	  </div>
				<?
					if($payment_gateway == 'paypal_email'){ ?>
					<div class="form-group">
						<label class="col-sm-2 control-label"><?= $vis_language['TXTEMAIL']; ?></label>
						<div class="col-sm-10">
							<input class="form-control input-sm" type="text" name="vis_bill_email" id="vis_email" value="<? echo $billing_setting['email']; ?>">
						</div>
					</div>
					<?
					} else if($payment_gateway == 'authorize.net'){ ?>
					<div class="form-group">
						<label class="col-sm-2 control-label"><?= $vis_language['TXTAPILOGINID']; ?></label>
						<div class="col-sm-10">
							<input class="form-control input-sm" type="text" name="vis_bill_api_loginid" id="vis_bill_api_loginid" value="<? echo $billing_setting['field_name']; ?>">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label"><?= $vis_language['TXTTRANSACTIONKEY']; ?></label>
						<div class="col-sm-10">
							<input class="form-control input-sm" type="text" name="vis_bill_transaction_key" id="vis_bill_transaction_key" value="<? echo $billing_setting['field_value']; ?>">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label"><?= $vis_language['TXTGATEWAYMODE']; ?></label>
						<div class='col-sm-10'>
							<select class='form-control input-sm selectpicker' name="vis_gateway_mode" id="vis_gateway_mode">
								<option value="1" <? if($billing_setting['gateway_mode'] == 1) echo "selected=selected";?>>Test</option>
								<option value="2" <? if($billing_setting['gateway_mode'] == 2) echo "selected=selected";?>>Live</option>
							</select>
						</div>
					</div>
					<? }
                    else { ?>
                        <div class="form-group">
						<label class="col-sm-2 control-label"><?= $vis_language['TXTSECRETKEY']; ?></label>
                            <div class="col-sm-10">
                                <input class="form-control input-sm" type="text" name="vis_bill_secret_key" id="vis_bill_secret_key" value="<? echo $billing_setting['field_name']; ?>">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?= $vis_language['TXTPUBLISHABLEKEY']; ?></label>
                            <div class="col-sm-10">
                                <input class="form-control input-sm" type="text" name="vis_bill_publishable_key" id="vis_bill_publishable_key" value="<? echo $billing_setting['field_value']; ?>">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?= $vis_language['TXTGATEWAYMODE']; ?></label>
                            <div class='col-sm-10'>
                                <select class='form-control input-sm selectpicker' name="vis_gateway_mode" id="vis_gateway_mode">
                                    <option value="1" <? if($billing_setting['gateway_mode'] == 1) echo "selected=selected";?>>Test</option>
                                    <option value="2" <? if($billing_setting['gateway_mode'] == 2) echo "selected=selected";?>>Live</option>
                                </select>
                            </div>
                        </div>
                    <? } ?>
				<div class="line b-b line-lg pull-in"></div>
				<br/>
				<div class="form-group">
					<div class="col-sm-4 col-sm-offset-2">
					<button type="button" class="btn btn-primary" onclick="$('#vis_workpanel_div').visExecution('submit_form', {'vis_module':'setting', 'vis_operation':'update_gateway', 'vis_form':'vis_billing_setting_sub'})"><? echo $vis_language['TXTSAVE']; ?></button>
                    <button type="button" class="btn btn-primary m-l" onclick="$('#vis_workpanel_div').visExecution('submit_form', {'vis_module':'setting', 'vis_operation':'delete_gateway', 'vis_form':'vis_billing_setting_sub'})"><? echo $vis_language['TXTDELETE']; ?></button>
					</div>
				</div>
			</form>
		</div>
	</section>
</section>
<script>
	$('.selectpicker').selectpicker();
</script>