1{{ header }}{{ column_left }}
2<div id="content">
3  <div class="page-header">
4    <div class="container-fluid">
5      <div class="pull-right">
6        <button type="submit" form="form-payment" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
7        <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
8      <h1>{{ heading_title }}</h1>
9      <ul class="breadcrumb">
10        {% for breadcrumb in breadcrumbs %}
11        <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
12        {% endfor %}
13      </ul>
14    </div>
15  </div>
16  <div class="container-fluid">
17	{% if error_warning %}
18	  <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
19	    <button type="button" class="close" data-dismiss="alert">&times;</button>
20	  </div>
21	{% endif %}
22    {% if success %}
23      <div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> {{ success }}
24        <button type="button" class="close" data-dismiss="alert">&times;</button>
25      </div>
26    {% endif %}
27    <div class="panel panel-default">
28      <div class="panel-heading">
29        <h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3>
30      </div>
31      <div class="panel-body">
32        <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-payment" class="form-horizontal">
33		  <ul class="nav nav-tabs">
34		    {% if show_register %}
35		      <li class="active" id="li-tab-register"><a href="#tab-register" data-toggle="tab">{{ tab_register }}</a></li>
36		      <li id="li-tab-settings"><a href="#tab-settings" data-toggle="tab">{{ tab_settings }}</a></li>
37			{% else %}
38		      <li class="active" id="li-tab-settings"><a href="#tab-settings" data-toggle="tab">{{ tab_settings }}</a></li>
39			{% endif %}
40		  </ul>
41		  <div class="tab-content">
42		    <div class="tab-pane {% if show_register %} active {% endif %}" id="tab-register">
43		      <div class="form-group required">
44                <label class="col-sm-2 control-label" for="input-pilibaba-email-address"><span data-toggle="tooltip" title="{{ help_email_address }}">{{ entry_email_address }}</span></label>
45                <div class="col-sm-10">
46			    <input type="email" name="payment_pilibaba_email_address" value="" placeholder="{{ entry_email_address }}" id="input-pilibaba-email-address" class="form-control" />
47		        </div>
48		      </div>
49		      <div class="form-group required">
50                <label class="col-sm-2 control-label" for="input-pilibaba-password"><span data-toggle="tooltip" title="{{ help_password }}">{{ entry_password }}</span></label>
51                <div class="col-sm-10">
52			    <input type="password" name="pilibaba_password" value="" placeholder="{{ entry_password }}" id="input-pilibaba-password" class="form-control" />
53		        </div>
54		      </div>
55		      <div class="form-group required">
56		        <label class="col-sm-2 control-label" for="input-pilibaba-currency"><span data-toggle="tooltip" title="{{ help_currency }}">{{ entry_currency }}</span></label>
57			    <div class="col-sm-10">
58			      <select name="pilibaba_currency" id="input-pilibaba-currency" class="form-control">
59			      	<option value="">Select Currency</option>
60			        {% for currency in currencies %}
61			        <option value="{{ currency }}">{{ currency }}</option>
62			        {% endfor %}
63			      </select>
64			    </div>
65		      </div>
66		      <div class="form-group required">
67		        <label class="col-sm-2 control-label" for="input-pilibaba-warehouse"><span data-toggle="tooltip" title="{{ help_warehouse }}">{{ entry_warehouse }}</span></label>
68			    <div class="col-sm-10">
69			      <select name="pilibaba_warehouse" id="input-pilibaba-warehouse" class="form-control">
70			      	<option value="">Select Warehouse</option>
71			        {% for warehouse in warehouses %}
72			        <option value="{{ warehouse.id }}">{{ warehouse.country }} {{ warehouse.city }} {{ warehouse.firstName }} {{ warehouse.lastName }}</option>
73			        {% endfor %}
74			        <option value="other">{{ text_other }}</option>
75			      </select>
76			    </div>
77		      </div>
78		      <div class="form-group" style="display:none">
79		        <label class="col-sm-2 control-label" for="input-pilibaba-country"><span data-toggle="tooltip" title="{{ help_country }}">{{ entry_country }}</span></label>
80			    <div class="col-sm-10">
81			      <select name="pilibaba_country" id="input-pilibaba-country" class="form-control">
82			      	<option value="">Select Country</option>
83			        {% for country in countries %}
84			        <option value="{{ country.iso_code_3 }}">{{ country.name }}</option>
85			        {% endfor %}
86			      </select>
87			    </div>
88		      </div>
89			  <a class="button btn btn-primary col-sm-offset-2" id="button-register">{{ button_register }}</a> <span class="btn btn-primary col-sm-offset-2" id="img_loading_register" style="display:none"><i class="fa fa-circle-o-notch fa-spin fa-lg"></i></span>
90			</div>
91		    <div class="tab-pane {% if not show_register %} active {% endif %}" id="tab-settings">
92		      {% if error_weight %}
93                <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_weight }}</div>
94			  {% endif %}
95
96		      {% if notice_email %}
97				<div class="alert alert-info"><i class="fa fa-info-circle"></i> {{ notice_email }}</div>
98			  {% endif %}
99
100		      <div class="form-group required">
101                <label class="col-sm-2 control-label" for="input-pilibaba-merchant-number"><span data-toggle="tooltip" title="{{ help_merchant_number }}">{{ entry_merchant_number }}</span></label>
102                <div class="col-sm-10">
103			    <input type="text" name="payment_pilibaba_merchant_number" value="{{ payment_pilibaba_merchant_number }}" placeholder="{{ entry_merchant_number }}" id="input-pilibaba-merchant-number" class="form-control" />
104			    {% if error_pilibaba_merchant_number %}
105                  <div class="text-danger">{{ error_pilibaba_merchant_number }}</div>
106                {% endif %}
107		        </div>
108		      </div>
109		      <div class="form-group required">
110		        <label class="col-sm-2 control-label" for="input-pilibaba-secret-key"><span data-toggle="tooltip" title="{{ help_secret_key }}">{{ entry_secret_key }}</span></label>
111			    <div class="col-sm-10">
112			    <input type="text" name="payment_pilibaba_secret_key" value="{{ payment_pilibaba_secret_key }}" placeholder="{{ entry_secret_key }}" id="input-pilibaba-secret-key" class="form-control" />
113			    {% if error_pilibaba_secret_key %}
114                  <div class="text-danger">{{ error_pilibaba_secret_key }}</div>
115                {% endif %}
116			    </div>
117		      </div>
118              <div class="form-group">
119                <label class="col-sm-2 control-label" for="input-pilibaba-environment">{{ entry_environment }}</label>
120                <div class="col-sm-10">
121                  <select name="payment_pilibaba_environment" id="input-pilibaba-environment" class="form-control">
122                    {% if payment_pilibaba_environment == 'live' %}
123                      <option value="live" selected="selected">{{ text_live }}</option>
124                    {% else %}
125                      <option value="live">{{ text_live }}</option>
126                    {% endif %}
127                    {% if payment_pilibaba_environment == 'test' %}
128                      <option value="test" selected="selected">{{ text_test }}</option>
129                    {% else %}
130                      <option value="test">{{ text_test }}</option>
131                    {% endif %}
132                  </select>
133                </div>
134              </div>
135		      <div class="form-group">
136		        <label class="col-sm-2 control-label" for="input-pilibaba-shipping-fee"><span data-toggle="tooltip" title="{{ help_shipping_fee }}">{{ entry_shipping_fee }}</span></label>
137			    <div class="col-sm-10">
138			      <input type="text" name="payment_pilibaba_shipping_fee" value="{{ payment_pilibaba_shipping_fee }}" placeholder="{{ entry_shipping_fee }} (e.g. 4.99)" id="input-pilibaba-shipping-fee" class="form-control" />
139			      {% if error_pilibaba_shipping_fee %}
140                    <div class="text-danger">{{ error_pilibaba_shipping_fee }}</div>
141                  {% endif %}
142			    </div>
143		      </div>
144		      <div class="form-group">
145                <label class="col-sm-2 control-label" for="input-pilibaba-order-status"><span data-toggle="tooltip" title="{{ help_order_status }}">{{ entry_order_status }}</span></label>
146                <div class="col-sm-10">
147                  <select name="payment_pilibaba_order_status_id" id="input-pilibaba-order-status" class="form-control">
148                    {% for order_status in order_statuses %}
149                      {% if order_status.order_status_id == payment_pilibaba_order_status_id %}
150                        <option value="{{ order_status.order_status_id }}" selected="selected">{{ order_status.name }}</option>
151                      {% else %}
152                        <option value="{{ order_status.order_status_id }}">{{ order_status.name }}</option>
153                      {% endif %}
154                    {% endfor %}
155                  </select>
156                </div>
157              </div>
158		      <div class="form-group">
159		        <label class="col-sm-2 control-label" for="input-pilibaba-status">{{ entry_status }}</label>
160		        <div class="col-sm-10">
161		          <select name="payment_pilibaba_status" id="input-pilibaba-status" class="form-control">
162                    {% if payment_pilibaba_status %}
163                      <option value="1" selected="selected">{{ text_enabled }}</option>
164                      <option value="0">{{ text_disabled }}</option>
165                    {% else %}
166                      <option value="1">{{ text_enabled }}</option>
167                      <option value="0" selected="selected">{{ text_disabled }}</option>
168                    {% endif %}
169			      </select>
170			    </div>
171		      </div>
172		      <div class="form-group">
173		        <label class="col-sm-2 control-label" for="input-pilibaba-logging"><span data-toggle="tooltip" title="{{ help_logging }}">{{ entry_logging }}</span></label>
174			    <div class="col-sm-10">
175		          <select name="payment_pilibaba_logging" id="input-pilibaba-logging" class="form-control">
176                    {% if payment_pilibaba_logging %}
177                      <option value="1" selected="selected">{{ text_enabled }}</option>
178                      <option value="0">{{ text_disabled }}</option>
179                    {% else %}
180                      <option value="1">{{ text_enabled }}</option>
181                      <option value="0" selected="selected">{{ text_disabled }}</option>
182                    {% endif %}
183			      </select>
184			    </div>
185		      </div>
186		      <div class="form-group">
187		        <label class="col-sm-2 control-label" for="input-pilibaba-sort-order">{{ entry_sort_order }}</label>
188		        <div class="col-sm-10">
189			      <input type="text" name="payment_pilibaba_sort_order" value="{{ payment_pilibaba_sort_order }}" placeholder="{{ entry_sort_order }}" id="input-pilibaba-sort-order" class="form-control" />
190			    </div>
191		      </div>
192		      <div class="form-group" style="display:none">
193		        <label class="col-sm-2 control-label" for="input-pilibaba-email-address"></label>
194		        <div class="col-sm-10">
195			      <input type="text" name="payment_pilibaba_email_address" value="{{ payment_pilibaba_email_address }}" placeholder="" id="input-pilibaba-email-address" class="form-control" />
196			    </div>
197		      </div>
198		    </div>
199		  </div>
200        </form>
201      </div>
202    </div>
203  </div>
204</div>
205
206<script type="text/javascript"><!--
207	$('#input-pilibaba-warehouse').change(function() {
208		var value = $(this).val();
209
210		if (value == 'other') {
211			$('#input-pilibaba-country').parent().parent().show();
212		} else {
213			$('#input-pilibaba-country').parent().parent().hide();
214		}
215	});
216
217	$('#button-register').click(function() {
218		$.ajax({
219			type: 'POST',
220			dataType: 'json',
221			data: {'email_address': $('#input-pilibaba-email-address').val(), 'password': $('#input-pilibaba-password').val(), 'currency': $('#input-pilibaba-currency').val(), 'warehouse': $('#input-pilibaba-warehouse').val(), 'country': $('#input-pilibaba-country').val(), 'environment': $('#input-pilibaba-environment').val()},
222			url: 'index.php?route=extension/payment/pilibaba/register&user_token={{ user_token }}',
223			beforeSend: function() {
224				$('#button-register').hide();
225				$('#img_loading_register').show();
226				$('.pilibaba_message').remove();
227			},
228			success: function(json) {
229				if (json['redirect']) {
230					location = json['redirect'].replace('&amp;', '&');
231				}
232
233				if (json['error']) {
234					$('#tab-register').prepend('<div class="alert alert-danger pilibaba_message" style="display:none"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '</div>').fadeIn();
235				}
236
237				$('#button-register').show();
238				$('#img_loading_register').hide();
239				$('.pilibaba_message').fadeIn();
240			}
241		});
242	});
243//--></script>
244
245<style>
246@media (min-width: 768px) {
247	#button-register, #img_loading_register {
248		position: relative;
249		left: 5px;
250	}
251}
252</style>
253
254{{ footer }}