{{HEAD}}
<div class="container">
	{{HEADER}}
	[!if?&is=`[*error*]:!=:` &then=`
	<div class="alert alert-danger alert-dismissable col-md-12">
		<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
		<strong>[*error*]</strong>
	</div>
	`!]
	[!if?&is=`[*success*]:!=:` &then=`
	<div class="alert alert-success alert-dismissable col-md-12">
		<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
		<strong>[*success*]</strong>
	</div>
	`!]
	<ul class="nav nav-tabs">
		<li class="active"><a href="#data" data-toggle="tab"><span class="glyphicon glyphicon-list-alt"></span> My userdata</a></li>
		<li><a href="#orders" data-toggle="tab"><span class="glyphicon glyphicon-credit-card"></span> My orders</a></li>
	</ul>
	<div class="tab-content">
		<div class="tab-pane active" id="data">
			<h3>Customer data</h3>
			<form action="" method="post">
				<table class="table table-bordered table-condensed">
					<tr>
						<th width="150px">Name</th>
						<td><input type="text" name="profile[name]" value="[*u_fullname*]" class="form-control"></td>
					</tr>
					<tr>
						<th>Email</th>
						<td><input type="text" name="profile[email]" value="[*u_email*]" class="form-control"></td>
					</tr>
					<tr>
						<th>Phone</th>
						<td><input type="text" name="profile[phone]" value="[*u_phone*]" class="form-control"></td>
					</tr>
					<tr>
						<th>Delivery type</th>
						<td>
							<select name="profile[delivery]" class="form-control" data-active="[*u_delivery*]">
								[[Shop?&get=`delivery_list`&tpl=`tpl_delivery`]]
							</select>
						</td>
					</tr>
					<tr>
						<th>Delivery address</th>
						<td>
							
							<table class="table" id="js_addr">
								[[Shop?&get=`user_addr`&tpl=`tpl_user_addr`]]
							</table>
							<a href="#" class="btn btn-success js_addr_add"><span class="glyphicon glyphicon-plus-sign"></span> Add delivery address</a>
						</td>
					</tr>
				</table>
				<h3>Change password</h3>
				<table class="table table-bordered table-condensed">
					<tr>
						<th width="150px">Current password</th>
						<td><input type="password" name="profile[old]" id="" class="form-control"></td>
					</tr>
					<tr>
						<th>New password</th>
						<td><input type="password" name="profile[new]" id="" class="form-control"></td>
					</tr>
					<tr>
						<th>New password confirm</th>
						<td><input type="password" name="profile[cfm]" id="" class="form-control"></td>
					</tr>
				</table>
				<button class="btn btn-primary">Update my data</button>
			</form>
		</div>
		<div class="tab-pane" id="orders">
			<table class="table table-bordered table-condensed">
				<tbody>
					<tr>
						<th>#</th>
						<th>Date</th>
						<th>Price</th>
						<th>Order status</th>
						<th>Pay status</th>
						<th></th>
					</tr>
				</tbody>
				<tbody>
					[[Shop?&get=`orders`&tpl=`tpl_order`]]
				</tbody>
			</table>
		</div>
	</div>
	<script>
		var _row = $("#js_addr tr:last").clone();
		$(".js_addr_add").on("click", function(){
			_row.find("input").val('');
			$("#js_addr").append(_row.clone());
			return false;
		});
		$("#js_addr").on("click", ".js_addr_remove", function(){
			if (!confirm('Delete address?')) return false;
			$(this).closest("tr").remove();
			return false;
		});
	</script>
</div> <!-- /container -->
{{FOOTER}}