<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_keyword }}</h4>
</div>
<div class="modal-body" id="body-mass-product-seourl">
  <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-mass-product-seourl" class="form-horizontal">	
	<div class="alert alert-info">{{ text_seo_url_info }}</div>
	<div class="form-group">
	  <label class="col-sm-2 control-label" for="input-seo-url">{{ entry_generator }}</label>
	  <div class="col-sm-10">
		<select name="seo_url_generator" id="input-seo-url" class="form-control">
		  <option value="generator">{{ text_seo_name }}</option>
		  <option value="custom">{{ text_seo_custom }}</option>
		</select>
	  </div>
	</div>
	<div class="form-group hidden" id="seo-url-custom">	
	  <label class="col-sm-2 control-label" for="input-seo-url-custom">{{ entry_keyword }}</label>
	  <div class="col-sm-10">
		<input type="text" name="seo_url" value="" placeholder="{{ entry_keyword }}" id="input-seo-url-custom" class="form-control" />
	  </div>
	</div>
	<div class="form-group">
	  <label class="col-sm-2 control-label" for="input-type-seo-url"><span data-toggle="tooltip" title="{{ help_type_seo_url }}">{{ entry_type_seo_url }}</span></label>
	  <div class="col-sm-10">
		<select name="type_seo_url" id="input-type-seo-url" class="form-control">
		  <option value="none">{{ text_no_overwrite }}</option>
		  <option value="yes">{{ text_overwrite }}</option>
		</select>
	  </div>
	</div>
  </form>
</div>
<div class="modal-footer">
  <div class="text-center"><a data-form="form-mass-product-seourl" 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=\'text\'], #' + $(this).data('form') + ' select'),
		success: function(json) {				
			if (json['error']) {
				$('#form-mass-product-seourl').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-seourl').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>
<script type="text/javascript"><!--
$('#form-mass-product-seourl select[name=\'seo_url_generator\']').on('change', function() {
	if ($('#form-mass-product-seourl select[name=\'seo_url_generator\']').val() == 'custom') {
		$('#seo-url-custom').removeClass('hidden');
	} else {
		$('#seo-url-custom').addClass('hidden');
	}
});
//--></script>