{{ header }}{{ column_left }}
<div id="content">
	<div class="page-header">
		<div class="container-fluid">
			<div class="pull-right">
				<button type="submit" form="form-module" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
				<a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a>
			</div>
			<h1>{{ heading_title }}</h1>
			<ul class="breadcrumb">
				{% for breadcrumb in breadcrumbs %}
				<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
				{% endfor %}
			</ul>
		</div>
	</div>
	<div class="container-fluid">
		{% if error_warning %}
		<script>
			usNotify('warning', '{{ error_warning }}');
		</script>
		{% endif %}
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3>
			</div>
			<div class="panel-body">
				<form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-module" class="form-horizontal">
					<div class="form-group required">
						<label class="col-sm-2 control-label" for="input-status">{{ entry_status }}</label>
						<div class="col-sm-10">
							<div class="toggle-group">
								<input type="checkbox" name="status" {% if status %}checked="checked"{% endif %} id="input-status" tabindex="1">
								<label for="input-status"></label>
								<div class="onoffswitch pull-left" aria-hidden="true">
									<div class="onoffswitch-label">
										<div class="onoffswitch-inner"></div>
										<div class="onoffswitch-switch"></div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="form-group required">
						<label class="col-sm-2 control-label" for="input-name">{{ entry_name }}</label>
						<div class="col-sm-10">
							<input type="text" name="name" value="{{ name }}" placeholder="{{ entry_name }}" id="input-name" class="form-control" />
							{% if (error_name) %}
							<div class="text-danger">
								<script>
									usNotify('warning', '{{ error_name }}');
								</script>
							</div>
							{% endif %}
						</div>
					</div>
					<div class="form-group required">
						<label class="col-sm-2 control-label">{{ entry_heading }}</label>
						<div class="col-sm-10">
							<ul class="nav nav-tabs" id="heading">
								{% for language in languages %}
								<li>
									<a href="#tab-heading-language-{{ language.language_id }}" data-toggle="tab"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> {{ language.name }}</a>
								</li>
								{% endfor %}
							</ul>
							<div class="tab-content">
								{% for language in languages %}
								<div class="tab-pane" id="tab-heading-language-{{ language.language_id }}">
									<input
										type="text"
										name="heading[{{ language.code }}]"
										value="{{ heading[language.code] is not empty ? heading[language.code] : '' }}"
										class="form-control"
										/>
									{% if (error_heading[language.code] is defined) %}
									<div class="text-danger">
										<script>
											usNotify('warning', '{{ error_heading[language.code] }}');
										</script>
									</div>
									{% endif %}
								</div>
								{% endfor %}
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label" for="input-category">{{ entry_category }}</label>
						<div class="col-sm-10">
							<div class="well well-sm" style="min-height: 150px;max-height: 500px;overflow: auto;">
								<table class="table table-striped">
									{% for category in categories %}
									<tr>
										<td class="checkbox">
											<label>
											{% if category.category_id in module_categories %}
											<input type="checkbox" name="module_categories[]" value="{{ category.category_id }}" checked="checked" />
											{{ category.name }}
											{% else %}
											<input type="checkbox" name="module_categories[]" value="{{ category.category_id }}" />
											{{ category.name }}
											{% endif %}
											</label>
										</td>
									</tr>
									{% endfor %}
								</table>
							</div>
							<a onclick="$(this).parent().find(':checkbox').prop('checked', true);">{{ text_select_all }}</a> / <a onclick="$(this).parent().find(':checkbox').prop('checked', false);">{{ text_unselect_all }}</a>
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-2 control-label" for="input-sort">{{ entry_sort }}</label>
						<div class="col-sm-10">
							<select name="sort" class="form-control">
								<option value="c.sort_order"{% if sort == 'c.sort_order' %} selected="selected"{% endif %}>{{ entry_by_sort_order }}</option>
								<option value="cd.name"{% if sort == 'cd.name' %} selected="selected"{% endif %}>{{ entry_by_name }}</option>
							</select>
						</div>
					</div>

					<div class="form-group required">
						<label class="col-sm-2 control-label" for="input-limit">{{ entry_limit }}</label>
						<div class="col-sm-10">
							<input type="text" name="limit" value="{{ limit }}" placeholder="{{ entry_limit }}" id="input-limit" class="form-control" />
							{% if (error_limit) %}
							<div class="text-danger">
								<script>
									usNotify('warning', '{{ error_limit }}');
								</script>
							</div>
							{% endif %}
						</div>
					</div>
					<div class="form-group required">
						<div class="col-sm-6">
							<label class="col-sm-4 control-label" for="input-width">{{ entry_width }}</label>
							<div class="col-sm-8">
								<div class="input-group">
									<input type="text" name="width" value="{{ width }}" placeholder="{{ entry_width }}" id="input-width" class="form-control" />
									<span class="input-group-addon">px</span>
								</div>
								{% if (error_width) %}
								<div class="text-danger">
									<script>
										usNotify('warning', '{{ error_width }}');
									</script>
								</div>
								{% endif %}
							</div>
						</div>
						<div class="col-sm-6">
							<label class="col-sm-4 control-label" for="input-height">{{ entry_height }}</label>
							<div class="col-sm-8">
								<div class="input-group">
									<input type="text" name="height" value="{{ height }}" placeholder="{{ entry_height }}" id="input-height" class="form-control" />
									<span class="input-group-addon">px</span>
								</div>
								{% if (error_height) %}
								<div class="text-danger">
									<script>
										usNotify('warning', '{{ error_height }}');
									</script>
								</div>
								{% endif %}
							</div>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-6">
							<label class="col-sm-4 control-label" for="input-show_image">{{ entry_image }}</label>
							<div class="col-sm-8">
								<div class="toggle-group">
									<input type="checkbox" name="show_image" {% if show_image %}checked="checked"{% endif %} id="input-show_image" tabindex="1">
									<label for="input-show_image"></label>
									<div class="onoffswitch pull-left" aria-hidden="true">
										<div class="onoffswitch-label">
											<div class="onoffswitch-inner"></div>
											<div class="onoffswitch-switch"></div>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="col-sm-6">
							<label class="col-sm-4 control-label" for="input-show_sub_categories">{{ entry_sub_categories }}</label>
							<div class="col-sm-8">
								<div class="toggle-group">
									<input type="checkbox" name="show_sub_categories" {% if show_sub_categories %}checked="checked"{% endif %} id="input-show_sub_categories" tabindex="1">
									<label for="input-show_sub_categories"></label>
									<div class="onoffswitch pull-left" aria-hidden="true">
										<div class="onoffswitch-label">
											<div class="onoffswitch-inner"></div>
											<div class="onoffswitch-switch"></div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<script>
	$('#heading a:first').tab('show');
</script>
{{ footer }}