<div class="modal-header">
  <button type="button" class="pull-right btn btn-danger btn-sm" data-dismiss="modal" aria-hidden="true"><i class="fa fa-close"></i></button>
  <h4 class="modal-title">{{ information_title }} - {{ text_store }}</h4>
</div>
<div class="modal-body">
  <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-store-information" class="form-horizontal">
	<div class="well well-sm" style="height: 150px; overflow: auto;">
      {% for store in stores %}
		<div class="input-checkbox">
		  <label class="label-store">
			{% if store.store_id in information_store %}
			  <input type="checkbox" class="checkbox" name="information_store[]" value="{{ store.store_id }}" checked="checked" id="input-store{{ store.store_id }}" />
			  <label for="input-store{{ store.store_id }}"></label>
			  {% else %}
			  <input type="checkbox" class="checkbox" name="information_store[]" value="{{ store.store_id }}" id="input-store{{ store.store_id }}" />
			  <label for="input-store{{ store.store_id }}"></label>
			{% endif %}
			<span>{{ store.name }}</span>
		  </label>
		</div>
	  {% endfor %}
	</div>
  </form>
</div>
<div class="modal-footer">
  <div class="text-center"><a data-form="form-store-information" class="button-save btn btn-primary"><i class="fa fa-save"></i> {{ button_save }}</a></div>
</div>
<script type="text/javascript"><!--
$(".button-save").on('click', function(){
	$.ajax({
		url: $('#' + $(this).data('form')).attr('action'),
		type: 'post',
		dataType: 'json',
		data: $('#' + $(this).data('form') + ' input[type=\'text\'], #' + $(this).data('form') + ' input[type=\'checkbox\']:checked'),
		success: function(json) {
			if (json['error']) {
				$('#form-store-information').before('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '</div>');
				
				$('.alert-danger').delay(1500).fadeOut(500);
			}
									
			if (json['success']) {
				$('#form-store-information').before('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + '</div>');				
									
				setTimeout(function(){
					$('#modal-information-edit').modal('hide');
				}, 1000)
			}
		}
	});
});   
//--></script>