{include file="header.tpl"}
{if $admin} 
<div id="sidebar">
{include file="sidebar.tpl"}
</div>

<div class="mainContent">

<h1>Admin Center</h1>
<h2>Logged in as {$username}</h2>
{$action}

{if $success}
	<p class="green"><strong>{$success}</strong></p>
{elseif $error_message}
	<p class="red"><strong>{$error_message}</strong></p>
{/if}

{if $details}
    {foreach item="user" from=$details}
	<h3>View details for {$user.user}.</h3>
        <strong>{$user.id} + {$user.user} + {$user.reg_date} + {$user.ipaddress} + {$user.last_active} + {$user.user_level}</strong><br />
		<fieldset>
		<legend>{$smarty.const.EDIT_USER_LEGEND}</legend>

		<form action="listuser.php" method="post">

		<p><label for="first_name">{$smarty.const.FIRST_NAME}</label>
		<input id="first_name" name="first_name" type="text" size="30" maxlength="30" value="{$user.first_name}" />
		</p>
		<p><label for="last_name">{$smarty.const.LAST_NAME}</label>
		<input id="last_name" name="last_name" type="text" size="30" maxlength="30" value="{$user.last_name}" />
		</p>
		<p><label for="phone">{$smarty.const.PHONE}</label>
		<input id="phone" name="phone" type="text" size="30" maxlength="30" value="{$user.phone}" />
		</p>
		<p><label for="alt_phone">{$smarty.const.ALT_PHONE}</label>
		<input id="alt_phone" name="alt_phone" type="text" size="30" maxlength="30" value="{$user.alt_phone}" />
		</p>
		<p><label for="fax">{$smarty.const.FAX}</label>
		<input id="fax" name="fax" type="text" size="30" maxlength="30" value="{$user.fax}" />
		</p>
		<p><label for="email">{$smarty.const.EMAIL}</label>
		<input id="email" name="email" type="text" size="35" maxlength="50" value="{$user.email}" />
		</p>
		<p><label for="user_level">{$smarty.const.USER_LEVEL}</label>
		<select id="user_level" name="user_level" size="1">
		  <option value="9" {if $user.user_level eq '9'}selected="selected"{/if}>Admin</option>
		  <option value="2" {if $user.user_level eq '2'}selected="selected"{/if}>Seller</option>
 		  <option value="0" {if $user.user_level eq '0'}selected="selected"{/if}>User</option>
		</select>
		</p>
		<p>
		<input id="user" name="user" type="hidden" value="{$user.user}" />
		<input id="userid" name="userid" type="hidden" value="{$user.id}" />
		<input name="submit" type="submit" value="update" />
		</p>

		</form>
		</fieldset>

	{/foreach}

{else}

<hr />
<p>
    {* display pagination header *}
    Items {$paginate.first} - {$paginate.last} of {$paginate.total} displayed.
</p>	

    {foreach item="user" from=$results}
        <p><strong>{$user.user}<br />
		Registration Date: {$user.reg_date} Last Active: {$user.last_active}</strong><br />
   		</p>
		<p><img src="../images/id_card_view.gif" alt="View Full details" /> <a href="listuser.php?userid={$user.id}&amp;action=fullview">View Full details</a> <img src="../images/exit.gif" alt="Delete User" /><a href="listuser.php?userid={$user.id}&amp;action=delete">Delete User</a>
    	</p>
	{/foreach}
<p>
     Items {$paginate.first} - {$paginate.last} of {$paginate.total} displayed.
</p>

<hr />
	<div id="paginate">
		<p>{* display pagination info *}
 			{paginate_prev} {paginate_middle format="page"} {paginate_next} 
		</p>
	</div>
{/if}

</div>
{/if}
{include file="footer.tpl"}