<?php $this->partial('aside_configure'); ?>

<div class="post">
	<a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a>

	<form method="post" action="<?php echo _url('user', 'create'); ?>">
		<legend><?php echo _t('admin.user.create'); ?></legend>

		<div class="form-group">
			<label class="group-name" for="new_user_language"><?php echo _t('admin.user.language'); ?></label>
			<div class="group-controls">
				<select name="new_user_language" id="new_user_language">
				<?php $languages = Minz_Translate::availableLanguages(); ?>
				<?php foreach ($languages as $lang) { ?>
				<option value="<?php echo $lang; ?>"<?php echo FreshRSS_Context::$user_conf->language === $lang ? ' selected="selected"' : ''; ?>><?php echo _t('gen.lang.' . $lang); ?></option>
				<?php } ?>
				</select>
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="new_user_name"><?php echo _t('admin.user.username'); ?></label>
			<div class="group-controls">
				<input id="new_user_name" name="new_user_name" type="text" size="16" required="required" maxlength="16" autocomplete="off" pattern="[0-9a-zA-Z]{1,16}" placeholder="demo" />
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="new_user_passwordPlain"><?php echo _t('admin.user.password_form'); ?></label>
			<div class="group-controls">
				<div class="stick">
					<input type="password" id="new_user_passwordPlain" name="new_user_passwordPlain" autocomplete="off" pattern=".{7,}" />
					<a class="btn toggle-password" data-toggle="new_user_passwordPlain"><?php echo _i('key'); ?></a>
				</div>
				<?php echo _i('help'); ?> <?php echo _t('admin.user.password_format'); ?>
				<noscript><b><?php echo _t('gen.js.should_be_activated'); ?></b></noscript>
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="new_user_email"><?php echo _t('admin.user.email_persona'); ?></label>
			<?php $mail = FreshRSS_Context::$user_conf->mail_login; ?>
			<div class="group-controls">
				<input type="email" id="new_user_email" name="new_user_email" class="extend" autocomplete="off" placeholder="alice@example.net" />
			</div>
		</div>

		<div class="form-group form-actions">
			<div class="group-controls">
				<button type="submit" class="btn btn-important"><?php echo _t('gen.action.create'); ?></button>
				<button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button>
			</div>
		</div>
	</form>

	<form method="post" action="<?php echo _url('user', 'delete'); ?>">
		<legend><?php echo _t('admin.user.users'); ?></legend>

		<div class="form-group">
			<label class="group-name" for="user-list"><?php echo _t('admin.user.user_list'); ?></label>
			<div class="group-controls">
				<select id="user-list" class="select-change" name="username">
					<?php foreach (listUsers() as $username) { ?>
					<option data-url="<?php echo _url('user', 'manage', 'u', $username); ?>" <?php echo $this->current_user === $username ? 'selected="selected"' : ''; ?> value="<?php echo $username; ?>"><?php echo $username; ?></option>
					<?php } ?>
				</select>

				<p><?php echo _t('admin.user.articles_and_size',
				                 format_number($this->nb_articles),
				                 format_bytes($this->size_user)); ?></p>
			</div>
		</div>

		<div class="form-group form-actions">
			<div class="group-controls">
				<button type="submit" class="btn btn-attention confirm"><?php echo _t('gen.action.remove'); ?></button>
			</div>
		</div>
	</form>
</div>
