{extends file="layout.html"}
{block name=title}LMS: {$layout.pagetitle|striphtml}{/block}
{block name=module_content}

{$hide_disabled_users = ConfigHelper::checkConfig('finances.hide_disabled_users')}
{$hide_deleted_users = ConfigHelper::checkConfig('finances.hide_deleted_users')}

<!--// $Id$ //-->
<H1>{$layout.pagetitle}</H1>
<FORM METHOD="POST" NAME="registry" ACTION="?m=cashregedit&id={$registry.id}">
<INPUT type="submit" class="hiddenbtn">
<TABLE class="lmsbox">
	<COLGROUP>
		<COL style="width: 1%;">
		<COL style="width: 1%;">
		<COL style="width: 98%;">
	</COLGROUP>
    <THEAD>
	<TR>
		<TD>
			<IMG src="img/queue.gif" ALT="">
		</TD>
		<TD class="bold">{trans("Name:")}</TD>
		<TD>
			<INPUT TYPE="TEXT" NAME="registry[name]" VALUE="{$registry.name}" SIZE="40" {tip text="Enter name" trigger="name" bold=1}>
		</TD>
	</TR>
    </THEAD>
    <TBODY>
	<TR>
		<TD>
			<IMG src="img/id.gif" ALT="">
		</TD>
		<TD class="bold nobr">{trans("Cash-in receipt numbering plan:")}</TD>
		<TD>
			<SELECT name="registry[in_numberplanid]" {tip text="Select numbering plan"}>
				<OPTION value="0"{if ! $registry.in_numberplanid} SELECTED{/if}>{trans("— select numbering plan —")}</OPTION>
				{foreach item=plan from=$numberplanlist}
				{assign var=period value=$plan.period}
				<OPTION value="{$plan.id}"{if $plan.id==$registry.in_numberplanid} SELECTED{/if}>{$plan.template} ({$_NUM_PERIODS.$period})</OPTION>
				{/foreach}
			</SELECT>
		</TD>
	</TR>
	<TR>
		<TD>
			<IMG src="img/id.gif" ALT="">
		</TD>
		<TD class="bold nobr">{trans("Cash-out receipt numbering plan:")}</TD>
		<TD>
			<SELECT name="registry[out_numberplanid]" {tip text="Select numbering plan"}>
				<OPTION value="0"{if ! $registry.out_numberplanid} SELECTED{/if}>{trans("— select numbering plan —")}</OPTION>
				{foreach item=plan from=$numberplanlist}
				{assign var=period value=$plan.period}
				<OPTION value="{$plan.id}"{if $plan.id==$registry.out_numberplanid} SELECTED{/if}>{$plan.template} ({$_NUM_PERIODS.$period})</OPTION>
				{/foreach}
			</SELECT>
		</TD>
	</TR>
	<TR>
		<TD>
			<IMG src="img/info1.gif" ALT="">
		</TD>
		<TD class="bold">{trans("Description")}:</TD>
		<TD>
			<TEXTAREA NAME="registry[description]" COLS="50" ROWS="3" {tip text="Enter additional information (optional)"}>{$registry.description}</TEXTAREA>
		</TD>
	</TR>
	<TR>
		<TD>
			<IMG src="img/wait.gif" ALT="">
		</TD>
		<TD class="bold nobr">{trans("Disabled summary:")}</TD>
		<TD>
			<INPUT type="checkbox" name="registry[disabled]" value="1"{if $registry.disabled} checked{/if}>
		</TD>
	</TR>
	<TR>
		<TD>
			<IMG src="img/users.gif" ALT="">
		</TD>
		<TD class="bold">{trans("Permissions:")}</TD>
		<TD>
			<table class="lmsbox lms-ui-background-cycle">
				<colgroup>
					<col style="width: 93%;">
					<col style="width: 1%;">
					<col style="width: 1%;">
					<col style="width: 1%;">
					<col style="width: 1%;">
					<col style="width: 1%;">
					<col style="width: 1%;">
					<col style="width: 1%;">
				</colgroup>
				<thead>
					<tr>
						<td>
							<strong>{trans("User")}</strong>
						</td>
						<td class="text-center nobr">
							<strong>{trans("Read")}</strong>
						</td>
						<td colspan="5" class="text-center nobr">
							<strong>{trans("Write (+R)")}</strong>
						</td>
						<td class="text-center nobr">
							<strong>{trans("Advanced (+R)")}</strong>
						</td>
					</tr>
					<tr>
						<td></td>
						<td class="text-center nobr"></td>
						<td class="text-center">{trans("customer")}</td>
						<td class="text-center nobr">{trans("ass. move")}</td>
						<td class="text-center">{trans("advance")}</td>
						<td class="text-center">{trans("other")}</td>
						<td class="text-center">{trans("mod.")}</td>
						<td class="text-center nobr"></td>
					</tr>
				</thead>
				<tbody>
					{foreach $registry.rights as $right}
						<tr class="highlight lms-ui-row-all-check{if empty($right.access)} blend{/if}{if !empty($right.deleted)} crossed{/if}"
							{if empty($right.access) && $hide_disabled_users || !empty($right.deleted) && $hide_deleted_users} style="display: none;"{/if}>
							<td>
								<a href="?m=userinfo&id={$right.id}">{$right.rname|trunescape:40} ({$right.login})</a>
							</td>
							<td class="text-center">
								<input type="checkbox" name="registry[users][{$right.id}][1]" value="1"{if ($right.rights & 1)} checked{/if}>
							</td>
							<td class="text-center nobr">
								<input type="checkbox" name="registry[users][{$right.id}][2]" value="2"{if ($right.rights & 2)} checked{/if}>
							</td>
							<td class="text-center nobr">
								<input type="checkbox" name="registry[users][{$right.id}][4]" value="4"{if ($right.rights & 4)} checked{/if}>
							</td>
							<td class="text-center nobr">
								<input type="checkbox" name="registry[users][{$right.id}][8]" value="8"{if ($right.rights & 8)} checked{/if}>
							</td>
							<td class="text-center nobr">
								<input type="checkbox" name="registry[users][{$right.id}][16]" value="16"{if ($right.rights & 16)} checked{/if}>
							</td>
							<td class="text-center nobr">
								<input type="checkbox" name="registry[users][{$right.id}][32]" value="32"{if ($right.rights & 32)} checked{/if}>
							</td>
							<td class="text-center">
								<input type="checkbox" name="registry[users][{$right.id}][256]" value="256"{if ($right.rights & 256)} checked{/if}>
							</td>
						</tr>
						{if empty($right.access) && $hide_disabled_users || !empty($right.deleted) && $hide_deleted_users}
							<tr style="display: none;">
								<td colspan="8"></td>
							</tr>
						{/if}
					{/foreach}
					<tr>
						<td></td>
						<td colspan="7"></td>
					</tr>
				</tbody>
			</table>
		</TD>
	</TR>
	<TR>
		<TD COLSPAN="3" class="buttons">
			<A HREF="javascript:document.registry.submit();" accesskey="s">{trans("Submit")} <IMG src="img/save.gif" alt=""></A>
			<A HREF="?m=cashreglist">{trans("Cancel")} <IMG src="img/cancel.gif" alt=""></A>
		</TD>
	</TR>
	</TBODY>
</TABLE></FORM>
<script>

	$(function() {
		document.forms['registry'].elements['registry[name]'].focus();
	});

</script>
{/block}
