<form enctype="multipart/form-data" action="index.php?ToDo=importOrdertrackingnumbers&Step=2" onsubmit="return ValidateForm(CheckImportOrdertrackingnumberForm)" id="frmImport" method="post">
<div class="BodyContainer">
	<div class="row">
		<div class="col-sm-12">
			<h4 class="page-title">{% lang 'ImportOrdertrackingnumbersStep1' %}</h4>
			<p>{% lang 'ImportOrdertrackingnumbersStep1Desc' %}</p>
			{{ Message|safe}}
		</div>
	</div>

	<div class="row">
		<div class="col-sm-12">
			<input type="reset" value="{% lang 'Cancel' %}" class="FormButton btn btn-default" onclick="ConfirmCancel()" />
			<input type="submit" value="{% lang 'Next' %}" class="FormButton btn btn-success" />
		</div>
	</div>
	<br />

	<div class="row">
		<div class="col-sm-12">
			<div class="panel panel-default">
				<div class="panel-heading"> 
					<h3 class="panel-title">{% lang 'OrderStatusDetails' %}</h3> 
				</div> 

				<div class="panel-body">
					<div class="form-group row">
						<label class="col-md-2 control-label">
							{% lang 'UpdateOrderStatusTo' %}: 
						</label>
						<div class="col-md-10">
							<select id="updateOrderStatus" name="updateOrderStatus" class="form-control">
							<option value="0">{% lang 'DoNotUpdate' %}</option>
							<option value="1">{% lang 'Pending' %}</option>
							<option value="7">{% lang 'AwaitingPayment' %}</option>
							<option value="11">{% lang 'AwaitingFulfillment' %}</option>
							<option value="9">{% lang 'AwaitingShipment' %}</option>
							<option value="8">{% lang 'AwaitingPickup' %}</option>
							<option value="3">{% lang 'PartiallyShipped' %}</option>
							<option value="10">{% lang 'Completed' %}</option>
							<option value="2" selected="selected">{% lang 'Shipped' %}</option>
							<option value="5">{% lang 'Cancelled' %}</option>
							<option value="6">{% lang 'Declined' %}</option>
							<option value="4">{% lang 'Refunded' %}</option>
							</select>
						</div>
					</div>
				</div>
			</div>

			<div class="panel panel-default">
				<div class="panel-heading"> 
					<h3 class="panel-title">{% lang 'ImportDetails' %}</h3> 
				</div> 

				<div class="panel-body">
					<div class="form-group row">
						<label class="col-md-2 control-label">
							{% lang 'ImportOverride' %}: 
						</label>
						<div class="col-md-10">
							<label><input type="checkbox" name="OverrideDuplicates" value="1" /> {% lang 'YesImportOverride' %}</label>
						</div>
					</div>
				</div>
			</div>

			<div class="panel panel-default">
				<div class="panel-heading"> 
					<h3 class="panel-title">{% lang 'ImportFileDetails' %}</h3> 
				</div> 

				<div class="panel-body">
					<div class="form-group row">
						<label class="col-md-2 control-label">
							{% lang 'ImportFile' %}:
						</label>
						<div class="col-md-10">
							<label>
								<input id="OrdertrackingnumberImportUseUpload" type="radio" name="useserver" value="0" checked="checked" onclick="ToggleSource();" />
								{% lang 'ImportFileUpload' %}
								{% lang 'ImportMaxSize' with [
									'maxSize': ImportMaxSize
								]%}
							</label>
							<div id="OrdertrackingnumberImportUploadField">
								<input type="file" name="importfile" id="ImportFile" class="Field250" />
							</div>
							<div>
								<label><input id="OrdertrackingnumberImportUseServer" type="radio" name="useserver" value="1" onclick="ToggleSource();" /> {% lang 'ImportFileServer' %}</label>
								<img onMouseOut="HideHelp('d2');" onMouseOver="ShowHelp('d2', '{% lang 'ImportFileServer' %}', '{% lang 'ImportFileServerDesc' %}')" src="images/help.gif" width="24" height="16" border="0">
								<div style="display: none;" id="d2"></div>
							</div>
							<div id="OrdertrackingnumberImportServerField" style="display: none;">
								<select name="serverfile" id="ServerFile" class="Field250">
									<option value="">{% lang 'ImportChooseFile' %}</option>
									{{ ServerFiles|safe }}
								</select>
							</div>
							<div id="OrdertrackingnumberImportServerNoList" style="display: none; font-style: italic;" class="Field250">
								{% lang 'FieldNoServerFiles' %}
							</div>
						</div>
					</div>

					<div class="form-group row">
						<label class="col-md-2 control-label">
							{% lang 'ImportContainsHeaders' %}:
						</label>
						<div class="col-md-10">
							<label><input type="checkbox" name="Headers" value="1" /> {% lang 'YesImportContainsHeaders' %}</label>
						</div>
					</div>

					<div class="form-group row">
						<label class="col-md-2 control-label">
							{% lang 'ImportFieldSeparator' %}:
						</label>
						<div class="col-md-10">
							<input type="text" name="FieldSeparator" id="FieldSeparator" class="Field250" value="{{ FieldSeparator|safe }}" />
						</div>
					</div>

					<div class="form-group row">
						<label class="col-md-2 control-label">
							{% lang 'ImportFieldEnclosure' %}:
						</label>
						<div class="col-md-10">
							<input type="text" name="FieldEnclosure" id="FieldEnclosure" class="Field250" value='{{ FieldEnclosure|safe }}' />
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<div class="row">
		<div class="col-sm-12">
			<input type="reset" value="{% lang 'Cancel' %}" class="FormButton btn btn-default" onclick="ConfirmCancel()" />
			<input type="submit" value="{% lang 'Next' %}" class="FormButton btn btn-success" />
		</div>
	</div>
</div>
</form>

<script type="text/javascript">
	function ConfirmCancel() {
		if(confirm('{% lang 'ConfirmCancelImport' %}'))
			window.location = 'index.php?ToDo=manageordertrackingnumbers';
	}

	function CheckImportOrdertrackingnumberForm() {
		var f = document.getElementById('OrdertrackingnumberImportUseUpload');
		if(f.checked == true) {
			var f = document.getElementById('ImportFile');
			if(f.value == '') {
				alert('{% lang 'NoImportFile' %}');
				f.focus();
				return false;
			}
		} else {
			var f = document.getElementById('ServerFile');
			if(f.value < 1) {
				alert('{% lang 'NoImportFile' %}');
				f.focus();
				return false;
			}
		}

		var f = document.getElementById('FieldSeparator');
		if(f.value == '') {
			alert('{% lang 'NoImportFieldSeparator' %}');
			f.focus();
			return false;
		}

		var f = document.getElementById('FieldEnclosure');
		if(f.value == '') {
			alert('{% lang 'NoImportFieldEnclosure' %}');
			f.focus();
			return false;
		}
		return true;
	}

	function ToggleSource() {
		var file = document.getElementById('OrdertrackingnumberImportUseUpload');
		if(file.checked == true) {
			document.getElementById('OrdertrackingnumberImportUploadField').style.display = '';
			document.getElementById('OrdertrackingnumberImportServerField').style.display = 'none';
			document.getElementById('OrdertrackingnumberImportServerNoList').style.display = 'none';
		} else {
			document.getElementById('OrdertrackingnumberImportUploadField').style.display = 'none';
			if(document.getElementById('OrdertrackingnumberImportServerField').getElementsByTagName('SELECT')[0].options.length == 1) {
				document.getElementById('OrdertrackingnumberImportServerNoList').style.display = '';
			} else {
				document.getElementById('OrdertrackingnumberImportServerField').style.display = '';
			}
		}
	}
</script>