{extends file="layout.html"}
{block name=title}LMS :{$layout.pagetitle|striphtml}{/block}
{block name=module_content}
<!--// $Id$ //-->
<H1>{$layout.pagetitle}</H1>

<form name="changes" method="POST" action="?m=userpanel&module=info&f=changes" id="changes-form">
</form>

<table width="100%" cellpadding="3">
	<tr>
		<td>
			<table class="lmsbox lms-ui-background-cycle">
				<colgroup>
					<col style="width: 30%;">
					<col style="width: 15%;">
					<col style="width: 22%;">
					<col style="width: 22%;">
					<col style="width: 6%;">
					<col style="width: 5%;">
				</colgroup>
				<thead>
					<tr>
						<td class="bold nobr">{trans("Customer")}</td>
						<td class="nobr">{trans("Field")}</td>
						<td class="nobr">{trans("Old value")}</td>
						<td class="nobr">{trans("New value")}</td>
						<td class="nobr">{trans("Date")}</td>
						<td>&nbsp;</td>
					</tr>
				</thead>
				<tbody class="lms-ui-multi-check">
					{foreach $userchanges as $change}
						<tr class="lms-ui-multi-check highlight">
							<td class="bold nobr" data-target-url="?m=customerinfo&id={$change.customerid}">
								{$change.customername|trunescape:50} ({$change.customerid|string_format:"%04d"})
							</td>
							<td class="nobr">{t}{$change.fieldname|regex_replace:"/[^a-z]/":""}{/t}</td>
							<td class="nobr">{$change.oldvalue}</td>
							<td class="nobr">{$change.newvalue}</td>
							<td class="nobr">{$change.cdate|date_format:"Y/m/d H:i:s"}</td>
							<td>
								<input class="lms-ui-multi-check" type="checkbox" name="userchanges[]" value="{$change.changeid}"
									form="changes-form">
							</td>
						</tr>
					{foreachelse}
						<tr>
							<td class="empty-table" colspan="6">
								{trans("There are any changes to accept.")}
							</td>
						</tr>
					{/foreach}
				</tbody>
				<tfoot>
					<tr class="dark">
						<td class="buttons" colspan="5">
							{button icon="save" label="Save" class="submit-changes-button" data_action="save"}
							/
							{button icon="delete" label="Delete" class="submit-changes-button" data_action="delete"}
						</td>
						<td class="nobr">
							<label>
								{trans("Select All")}
								<input type="checkbox" class="lms-ui-multi-check-all" form="changes-form">
							</label>
						</td>
					</tr>
				</tfoot>
			</table>
		</td>
	</tr>
</table>

<script>

	$(function() {
		$('.submit-changes-button').click(function() {
			$('#changes-form').attr('action', '?m=userpanel&module=info&f=submit_changes_' + $(this).attr('data-action')).submit();
		});
	});

</script>

{/block}
