{{ header }}{{ column_left }}
<div id="content">
	<div class="page-header">
		<div class="container-fluid">
			<div class="pull-right">
			 <div class="dropdown" style="display: inline-block;">
						<button class="btn btn-primary dropdown-toggle" type="button" id="edit-module" title="{{ text_setting_form }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
							<i class="fa fa-cogs"></i>
							<span class="caret"></span>
						</button>
						<ul class="dropdown-menu" aria-labelledby="edit-module">
							{% if feedback_module_options %}
								{% for module_edit in feedback_module_options %}
									<li><a href="{{ module_edit.module_url }}">{{ module_edit.module_name }}</a></li>
								{% endfor %}
							 {% else %}
								<li class="text-danger">{{ error_nomodule }}</li>
							{% endif %}
						</ul>
					 
				</div>
				<a href="{{ add_module }}" form="form-account" data-toggle="tooltip" title="{{ button_create_form }}" class="btn btn-primary"><i class="fa fa-plus"></i></a>
				<a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a>
				<button type="button" data-toggle="tooltip" title="{{ button_delete }}" class="btn btn-danger" onclick="confirm('{{ button_text_confirm }}') ? $('#form-list').submit() : false;"><i class="fa fa-trash-o"></i></button>
			</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 %}
			<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
				<button type="button" class="close" data-dismiss="alert">&times;</button>
			</div>
		{% endif %}
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title"><i class="fa fa-list-ol"></i> {{ text_feedback_list }}</h3>
			</div>
			<div class="panel-body">
			<div class="well">
				<div class="row">
					<div class="col-sm-4">
						<div class="form-group">
								<label class="control-label" for="input-name">{{ text_filter_name_form }}</label>
								<select class="form-control" name="filter_name">
										<option value="">{{ text_filter_all_form }}</option>
										{% for feedback_name in module_names %}
											{% if filter_name == feedback_name.module_name%}
												 <option value="{{ feedback_name.module_name}}" selected="selected">{{ feedback_name.module_name}}</option>
											{% else %}
												 <option value="{{ feedback_name.module_name}}">{{ feedback_name.module_name}}</option>
											{% endif %} 	
										{% endfor %}
								</select> 
						</div>
					</div>
					<div class="col-sm-4">
						<div class="form-group">
								<label class="control-label" for="input-name">{{ text_filter_text_form }}</label>
								<input type="text" name="filter_text" value="{{ filter_text }}" placeholder="{{ text_entry_text }}" id="input-name" class="form-control" autocomplete="off"><ul class="dropdown-menu"></ul>
						</div>
					</div>
					<div class="col-sm-2">
						<div class="form-group">
								<label class="control-label" for="filter_noread">{{ text_filter_status }}</label>
								<select name="filter_noread" class="form-control">
									{% if filter_noread == 'noread' %}
										<option value="">{{ text_filter_allstatus }}</option>
										<option value="noread" selected="selected">{{ text_status_noread }}</option>
										<option value="read">{{ text_status_read }}</option>
									{% elseif  filter_noread == 'read' %}
										<option value="">{{ text_filter_allstatus }}</option>
										 <option value="noread">{{ text_status_noread }}</option>
										<option value="read" selected="selected">{{ text_status_read }}</option>
									{% else %}
										<option value="" selected="selected">{{ text_filter_allstatus }}</option>
										 <option value="noread">{{ text_status_noread }}</option>
										<option value="read">{{ text_status_read }}</option>
									{% endif %} 
								</select>
						</div>
					</div>
					<div class="col-sm-2">
							<div class="form-group">
								<button type="button" id="button-filter" class="btn btn-primary pull-right"><i class="fa fa-search"></i>{{ button_filter }}</button>
							</div>
						</div>
				</div>
			</div>
				<form role="form" action="{{ deleteFeedback }}" method="post" enctype="multipart/form-data" id="form-list" class="form-horizontal">
				<div>
				 {% if feedbacks %}
				 <div class="table-responsive">
					<table class="table table-striped table-bordered table-hover">
						<thead>
							<td style="width: 1px;" class="text-center"><input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);"></td>
							<td style="width: 1px;" class="text-center">
								{% if sort == 'fedback_id' %}
										<a href="{{ sort_id }}" class="{{ order|lower }}">ID</a>
								{% else %}
										<a href="{{ sort_id }}">ID</a>
								{% endif %}
							</td>
							<td>
								{% if sort == 'date' %}
										<a href="{{ sort_date }}" class="{{ order|lower }}">{{ text_date }}</a>
								{% else %}
										<a href="{{ sort_date }}">{{ text_date }}</a>
								{% endif %} 
							</td>
							<td>
								{% if sort == 'module_name' %}
										<a href="{{ sort_name }}" class="{{ order|lower }}">{{ text_name_form }}</a>
								{% else %}
										<a href="{{ sort_name }}">{{ text_name_form }}</a>
								{% endif %} 
							</td>
							<td>{{ text_page_send }}</td>
							<td>{{ entry_status }}</td>
							<td></td>
						</thead>
						<tbody>
								{% for feedback in feedbacks %}
								 <tr> 
									 <td><input type="checkbox" name="selected[]" value="{{ feedback.fedback_id}}"></td>
									 <td>{{ feedback.fedback_id}}</td>
									 <td>{{ feedback.date}}</td>
									 <td>{{ feedback.module_name}}</td>
									 <td><a href="{{ feedback.page_link}}" target="_blank">{{ text_page_link }}</a></td>
									 <td>{{ feedback.status}}</td>
									 <td>
									 	{% if feedback.status == text_status_noread %}
									 		<button type="button" class="btn btn-warning" data-toggle="modal" title="{{ text_more }}" data-target="#feedbackMore_{{ feedback.fedback_id}}">
												<i class="fa fa-eye"></i>
												</button>
										{% else %}
											<button type="button" class="btn btn-success" data-toggle="modal" title="{{ text_more }}" data-target="#feedbackMore_{{ feedback.fedback_id}}">
												<i class="fa fa-eye"></i>
											</button>
										{% endif %} 
									</td>
								 </tr>
								{% endfor %}
						</tbody>
					 </table>
				 </div>
				{% else %}
					<h2>{{ text_nomassage }}</h2>
				{% endif %} 
				</div>
			</form>
			{% if feedbacks %}
					{% for feedback in feedbacks %}
								<div class="modal fade" id="feedbackMore_{{ feedback.fedback_id}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
									<div class="modal-dialog" role="document">
										<div class="modal-content">
											<div class="modal-header">
												<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
												<h4 class="modal-title" id="feedbackMoreLabel">{{ feedback.module_name}}</h4>
												<h5 class="modal-title">{{ text_massage_number }}{{ feedback.fedback_id}}</h5>
											</div>
											<div class="modal-body">

											 <form role="form" action="{{ saveFeedback }}" method="post" enctype="multipart/form-data" id="form-feedback{{ feedback.fedback_id}}" class="form-horizontal"> 
												<div class="table-responsive">
													<table class="table table-striped table-bordered">
														<thead>
															<td>{{ text_popup_value }}</td>
															<td>{{ text_popup_data }}</td>
														</thead>
														<tbody>
															{% if feedback.feedback_array %}
																{% for field_values in feedback.feedback_array %}
																	<tr>
																		{% for field_name, field_value in field_values %}
																			{% if field_name != 'required' %}
																			 	<td> {{ field_name }}</td>
																			 	{% if field_value is iterable %}
																			 		<td> {{ field_value|join(', ') }} </td>
																				{% else %}
																				 	<td> {{ field_value }} </td>
																				{% endif %}
																		 	{% endif %}
																		{% endfor %}
																	</tr>
																{% endfor %}
															{% endif %}
																<tr>
																	<td>{{ text_popup_date}}</td>
																	<td>{{ feedback.date}}</td>
																</tr>
																<tr>
																	<td>{{ text_page_send }}</td>
																	<td><a href="{{ feedback.page_link}}" target="_blank">{{ text_page_link }}</a></td>
																</tr>
																<tr>
																	<td>{{ entry_status }}</td>
																	<td>
																		<select name="feedback_status" class="form-control">
																			{% if feedback.status == text_status_noread %}
																				<option value="noread" selected="selected">{{ text_status_noread }}</option>
																				<option value="read">{{ text_status_read }}</option>
																			{% else %}
																				<option value="noread">{{ text_status_noread }}</option>
																				<option value="read" selected="selected">{{ text_status_read }}</option>
																			{% endif %} 
																		</select>
																		<input type="hidden" name="feedback_id" value="{{ feedback.fedback_id}}"/>
																	</td>
																</tr>
														</tbody>
													</table>
												</div>
												</form>
											</div>
											<div class="modal-footer">
												<button type="button" class="btn btn-default" data-dismiss="modal">{{ text_popup_close }}</button>
												<button type="button" onclick="$('#form-feedback{{ feedback.fedback_id}}').submit();" class="btn btn-primary">{{ button_save }}</button>
											</div>
										</div>
									</div>
								</div>
					{% endfor %}
				{% endif %}
				 <div class="row">
					<div class="col-sm-6 text-left">{{ pagination }}</div>
					<div class="col-sm-6 text-right">{{ results }}</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript"><!--
$('#button-filter').on('click', function() {
	var url = 'index.php?route=extension/module/formcreator/getlist&user_token={{ user_token }}';

	var filter_name = $('select[name=\'filter_name\']').val();

	if (filter_name) {
		url += '&filter_name=' + encodeURIComponent(filter_name);
	}
	 var filter_text = $('input[name=\'filter_text\']').val();

	if (filter_text) {
		url += '&filter_text=' + encodeURIComponent(filter_text);
	}
	var filter_noread = $('select[name=\'filter_noread\']').val();

	if (filter_noread) {
		url += '&filter_noread=' + encodeURIComponent(filter_noread);
	}

	location = url;
});
	</script>
{{ footer }}