<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">{{ entry_store }}</h4>
</div>
<div class="modal-body" id="body-mass-product-store">
  <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-mass-product-store" class="form-horizontal">	
	<div class="form-group">	
	  <label class="col-sm-3 control-label">{{ entry_store }}</label>
	  <div class="col-sm-9">
		<div class="well well-sm" style="height: 150px; overflow: auto;">
		  {% for store in stores %}
			<div class="input-checkbox">
			  <label class="label-store">
				<input type="checkbox" class="checkbox" name="product_store[]" value="{{ store.store_id }}" id="input-store{{ store.store_id }}" />
				<label for="input-store{{ store.store_id }}"></label>						    
				<span>{{ store.name }}</span>
			  </label>
			</div>	
		  {% endfor %}
		</div>
	  </div>
	</div>
	<div class="form-group">	
	  <label class="col-sm-3 control-label" for="input-store-method">{{ entry_method_edit }}</label>
	  <div class="col-sm-9">
		<select name="store_method_edit" id="input-store-method" class="form-control">
		  <option value="all_new">{{ text_all_new }}</option>
		  <option value="add_selected">{{ text_add_selected }}</option>
		  <option value="delete_selected">{{ text_delete_selected }}</option>
		</select>
	  </div>
	</div>
  </form>
</div>
<div class="modal-footer">
  <div class="text-center"><a data-form="form-mass-product-store" 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: $('#product-list input[type=\'checkbox\']:checked, #' + $(this).data('form') + ' input[type=\'checkbox\']:checked, #' + $(this).data('form') + ' select'),
		success: function(json) {				
			if (json['error']) {
				$('#form-mass-product-store').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-mass-product-store').before('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + '</div>');	
				
				setTimeout(function(){
					$('#modal-product-edit').modal('hide');
				}, 1000)
			}
		}
	});
});  
//--></script>