<?php $this->displayTemplate('header') ?>

<script type="text/javascript">
<!--
var default_iso = '<?php echo $this->session->shop_country ?>';
-->
</script>

<!-- Configuration form -->
<div id="infosShopBlock">
	<h2><?php echo $this->l('Information about your Website') ?></h2>

	<!-- Shop name -->
	<div class="field clearfix">
		<label for="infosShop" class="aligned"><?php echo $this->l('Website name') ?> </label>
		<div class="contentinput">
			<input class="text required" type="text" id="infosShop" name="shop_name" value="<?php echo htmlspecialchars($this->session->shop_name ?? '') ?>" /> <sup class="required">*</sup>
		</div>
		<?php echo $this->displayError('shop_name') ?>
	</div>

	<!-- Activity -->
	<?php /*
	<div class="field clearfix">
		<label for="infosActivity" class="aligned"><?php echo $this->l('Main activity') ?></label>
		<div class="contentinput">
			<select id="infosActivity" name="shop_activity" class="chosen">
				<option value="0" style="font-weight: bold" <?php if (!$this->session->shop_activity): ?>selected="selected"<?php endif; ?>><?php echo $this->l('Please choose your main activity') ?></option>
				<?php foreach ($this->list_activities as $i => $activity): ?>
					<option value="<?php echo $i ?>" <?php if (isset($this->session->shop_activity) && $this->session->shop_activity == $i): ?>selected="selected"<?php endif; ?>><?php echo $activity ?></option>
				<?php endforeach; ?>
				<option value="0"><?php echo $this->l('Other activity...') ?></option>
			</select>
		</div>
		<p class="userInfos aligned"><?php echo $this->l('Help us learn more about your store so we can offer you optimal guidance and the best features for your business!') ?></p>
	</div>
	*/ ?>

	<!-- Install type (with fixtures or not) -->
	<div class="field clearfix">
		<label class="aligned"><?php echo $this->l('Install demo data') ?></label>
		<div class="contentinput">
			<label>
				<input value="full" type="radio" name="db_mode" style="vertical-align: middle;" <?php if ($this->install_type == 'full'): ?>checked="checked"<?php endif; ?> autocomplete="off" />
				<?php echo $this->l('Yes') ?>
			</label>
			<label>
				<input value="lite" type="radio" name="db_mode" style="vertical-align: middle;" <?php if ($this->install_type == 'lite'): ?>checked="checked"<?php endif; ?> autocomplete="off" />
				<?php echo $this->l('No'); ?>
			</label>
		</div>
		<p class="userInfos aligned"><?php echo $this->l('Installing demo data is a good way to learn how to use QloApps if you have not used it before. This demo data can later be erased using module QloApps Data Cleaner which comes pre-installed with this installation.') ?></p>
	</div>

	<!-- Country list -->
	<div class="field clearfix">
		<label for="infosCountry" class="aligned"><?php echo $this->l('Country') ?></label>
		<div class="contentinput">
			<select name="shop_country" id="infosCountry" class="chosen">
				<option value="0" style="font-weight: bold"><?php echo $this->l('Select your country') ?></option>
				<?php foreach ($this->list_countries as $country): ?>
					<option value="<?php echo (isset($country['iso'])) ? $country['iso'] : '' ?>" <?php if ($this->session->shop_country && isset($country['iso']) && $this->session->shop_country === $country['iso']): ?>selected="selected"<?php endif; ?><?php if (!isset($country['iso']) || !$country['iso']): ?>disabled<?php endif; ?>><?php echo $country['name'] ?></option>
				<?php endforeach; ?>
			</select>
			<sup class="required">*</sup>
		</div>
		<?php echo $this->displayError('shop_country') ?>
	</div>

	<!-- Timezone list -->
	<div id="timezone_div" class="field clearfix" <?php if (!in_array($this->session->shop_timezone, array('us','ca','au','ru','me','id'))) echo 'style="display:none"'; ?>>
		<label for="infosTimezone" class="aligned"><?php echo $this->l('Website timezone') ?></label>
		<div class="contentinput">
			<select name="shop_timezone" id="infosTimezone" class="chosen no-chosen">
				<option value="0" style="font-weight: bold"><?php echo $this->l('Select your timezone') ?></option>
				<?php foreach ($this->getTimezones() as $timezone): ?>
					<option value="<?php echo $timezone ?>" <?php if ($this->session->shop_timezone == $timezone): ?>selected="selected"<?php endif; ?>><?php echo $timezone ?></option>
				<?php endforeach; ?>
			</select>
			<sup class="required">*</sup>
		</div>
		<?php echo $this->displayError('shop_timezone') ?>
	</div>

	<!-- Enable SSL -->
	<?php if ($this->session->allow_ssl) { ?>
		<div class="field clearfix">
			<label class="aligned"><?php echo $this->l('Enable SSL') ?></label>
			<div class="contentinput">
				<label>
					<input value="1" type="radio" name="enable_ssl" style="vertical-align: middle;" <?php if ($this->session->enable_ssl == '1'): ?>checked="checked"<?php endif; ?> autocomplete="off" />
					<?php echo $this->l('Yes') ?>
				</label>
				<label>
					<input value="0" type="radio" name="enable_ssl" style="vertical-align: middle;" <?php if ($this->session->enable_ssl == '0'): ?>checked="checked"<?php endif; ?> autocomplete="off" />
					<?php echo $this->l('No'); ?>
				</label>
			</div>
		</div>
	<?php } ?>

	<!-- Shop logo
	<div class="field clearfix">
		<label for="uploadedImage" class="aligned logo"><?php echo $this->l('Shop logo') ?></label>
		<div class="contentinput">
			<p id="alignedLogo"><img id="uploadedImage" src="../img/logo.jpg?t=<?php echo time() ?>" alt="Logo" /></p>
		</div>
		<p class="userInfos aligned"><?php echo $this->l('Optional - You can add you logo at a later time.') ?></p>

		<div id="inputFileLogo" class="contentinput" style="top:-20px;position:relative">
			<input type="file" name="fileToUpload" id="fileToUpload"/>
		</div>
		<span id="resultInfosLogo" class="result"></span>
	</div>
	 -->

	<h2 style="margin-top:20px"><?php echo $this->l('Your Account') ?></h2>

	<!-- Admin firstname -->
	<div class="field clearfix">
		<label for="infosFirstname" class="aligned"><?php echo $this->l('First name') ?> </label>
		<div class="contentinput">
			<input class="text required" type="text" id="infosFirstname" name="admin_firstname" value="<?php echo htmlspecialchars($this->session->admin_firstname ?? '') ?>" />
			<sup class="required">*</sup>
		</div>
		<?php echo $this->displayError('admin_firstname') ?>
	</div>

	<!-- Admin lastname -->
	<div class="field clearfix">
		<label for="infosName" class="aligned"><?php echo $this->l('Last name') ?> </label>
		<div class="contentinput">
			<input class="text required" type="text" id="infosName" name="admin_lastname" value="<?php echo htmlspecialchars($this->session->admin_lastname ?? '') ?>" />
			<sup class="required">*</sup>
		</div>
		<?php echo $this->displayError('admin_lastname') ?>
	</div>

	<!-- Admin email -->
	<div class="field clearfix">
		<label for="infosEmail" class="aligned"><?php echo $this->l('E-mail address') ?> </label>
		<div class="contentinput">
			<input type="text" class="text required" id="infosEmail" name="admin_email" value="<?php echo htmlspecialchars($this->session->admin_email ?? '') ?>" />
			<sup class="required">*</sup>
		</div>
		<p class="userInfos aligned"><?php echo $this->l('This email address will be your username to access your website\'s back office.') ?></p>
		<?php echo $this->displayError('admin_email') ?>
	</div>

	<!-- Admin password -->
	<div class="field clearfix">
		<label for="infosPassword" class="aligned"><?php echo $this->l('Password') ?> </label>
		<div class="contentinput">
			<input autocomplete="off" type="password" class="text required" id="infosPassword" name="admin_password" value="<?php echo htmlspecialchars($this->session->admin_password ?? '') ?>" />
			<sup class="required">*</sup>
		</div>
		<?php if ($this->displayError('admin_password')): ?>
			<?php echo $this->displayError('admin_password') ?>
		<?php else: ?>
			<p class="userInfos aligned"><?php echo $this->l('Must be at least 8 characters') ?></p>
		<?php endif; ?>
	</div>

	<!-- Admin password confirm -->
	<div class="field clearfix">
		<label class="aligned" for="infosPasswordRepeat"><?php echo $this->l('Re-type to confirm') ?> </label>
		<div class="contentinput">
			<input type="password" autocomplete="off" class="text required" id="infosPasswordRepeat" name="admin_password_confirm" value="<?php echo htmlspecialchars($this->session->admin_password_confirm ?? '') ?>" />
			<sup class="required">*</sup>
		</div>
		<?php echo $this->displayError('admin_password_confirm') ?>
	</div>
	<div style="margin-top:20px">
		<span><small><?php echo sprintf($this->l('The information you give us is collected by us and is subject to data processing and statistics. Under the current "Act on Data Processing, Data Files and Individual Liberties" you have the right to access, rectify and oppose to the processing of your personal data through this <a href="%s" onclick="return !window.open(this.href)">link</a>.'), 'mailto:support@qloapps.com'); ?></small></span>
	</div>
	<div style="margin-top:10px;">
		<input type="checkbox" id="set_license" class="required" name="marketing_consent" value="1" style="vertical-align: middle;float:left" <?php if ($this->session->marketing_consent): ?>checked="checked"<?php endif; ?> />
		<div style="margin-left:20px">
			<label for="set_license"><strong><?php echo $this->l('I agree to receive the Newsletter and promotional offers from QloApps.') ?></strong></label>
			<br /><i><?php echo '** '.$this->l('You will always receive transactional emails like new updates, security fixes and patches even if you do not opt in for this option.') ?></i><br />
		</div>
	</div>
</div>

<!-- Partners form -->
<div id="benefitsBlock" style="display:none"></div>

<?php $this->displayTemplate('footer') ?>
