<?php defined('KOBLOG') or die('Koblog CMS.'); ?>

<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'tab-content')); ?>

<div class="d-flex justify-content-between mb-2">
	<?php echo Bootstrap::pageTitle(array('title'=>$L->g('New user'), 'icon'=>'user')); ?>
	<div>
		<button type="submit" class="btn btn-primary" name="save"><?php $L->p('Save') ?></button>
		<a class="btn btn-secondary" href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>" role="button"><?php $L->p('Cancel') ?></a>
	</div>
</div>

<div class="card">
	<div class="card-body">
		<?php
			echo Bootstrap::formInputHidden(array(
				'name'=>'tokenCSRF',
				'value'=>$security->getTokenCSRF()
			));

			echo Bootstrap::formInputText(array(
				'name'=>'new_username',
				'label'=>$L->g('Username'),
				'value'=>(isset($_POST['new_username'])?$_POST['new_username']:''),
				'class'=>'',
				'placeholder'=>'',
				'tip'=>''
			));

			echo Bootstrap::formInputText(array(
				'name'=>'new_password',
				'type'=>'password',
				'label'=>$L->g('Password'),
				'value'=>'',
				'class'=>'',
				'placeholder'=>'',
				'tip'=>''
			));

			echo Bootstrap::formInputText(array(
				'name'=>'confirm_password',
				'type'=>'password',
				'label'=>$L->g('Confirm Password'),
				'value'=>'',
				'class'=>'',
				'placeholder'=>'',
				'tip'=>''
			));

			echo Bootstrap::formSelect(array(
				'name'=>'role',
				'label'=>$L->g('Role'),
				'options'=>array('author'=>$L->g('Author'), 'editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
				'selected'=>'Author',
				'class'=>'',
				'tip'=>$L->g('author-can-write-and-edit-their-own-content')
			));

			echo Bootstrap::formInputText(array(
				'name'=>'email',
				'label'=>$L->g('Email'),
				'value'=>(isset($_POST['email'])?$_POST['email']:''),
				'class'=>'',
				'placeholder'=>'',
				'tip'=>''
			));
		?>

		<?php echo Bootstrap::formClose(); ?>
	</div>
</div>
