<b class="minprice panel-url" data-spanel="#minprice-panel">{{ heading_title }}</b>
<div id="minprice-panel" class="spanel spanel">
<div class="close-panel"><div class="container"><i class="fa fa-arrow-up"></i>{{ text_close }}</div></div>
  <div class="container">
  <div class="table"> 	 
	<div class="table-cell">
	  <div class="w65"> 
		<form method="POST" id="form-minprice">
		  <div class="form-group required"><input type="text" name="minprice_mail" value="{{ minprice_mail }}" placeholder="{{ text_mail }}" id="minprice-mail" class="form-control no-border" /></div>
		  <div class="form-group required"><input type="text" name="minprice_name" value="{{ minprice_name }}" placeholder="{{ text_name }}" id="minprice-name" class="form-control no-border" /></div>
		  <div class="form-group required"><input type="text" name="minprice_url" value="" placeholder="{{ text_url }}" id="minprice-url" class="form-control no-border" />
		  <input type="hidden" name="shop_url" value="{{ product_id }}" />
		  </div>
          <div class="form-group">{{ captcha }}
            <p class="checkbox"><input type="checkbox" checked="checked" id="agree"/> <label for="agree">{{ text_agree }}</label></p>
          </div>
		  <div class="form-group">
			<button type="submit" class="btn made-btn">{{ minprice_button }}</button>
          </div>
      </form>
	  </div>	
    </div>
  </div>
</div>
</div>  
<script>
			
    $('#form-minprice').submit(function(e){
        e.preventDefault();var form = this;
        $.ajax({
			url: 'index.php?route=madeshop/minprice/minprice',
			type: 'post',
			data: $(this).serialize(),
			dataType: 'json',
			beforeSend: function() {
				$('#form-minprice .made-btn').text('{{ text_loading }}');
			},
			complete: function() {
				$('#form-minprice .made-btn').text('{{ minprice_button }}');
			},
			success: function(json) {
				$('#form-minprice .form-group').removeClass('has-error');
            if (json['error']){ 
   				if (json['error']['phone']){
				$('#minprice-phone').parent().addClass('has-error');
				}
				if (json['error']['name']){ 
				$('#minprice-name').parent().addClass('has-error');
				}
			}
			if (json['success']) {
				$('#form-minprice').slideUp();
				$('#minprice-panel .w65').append('<div class="text-center">{{ text_success }}</div>');
				setTimeout(function () {
					$('body').click();	
				}, 3000);
				}
			},

			error: function(xhr, ajaxOptions, thrownError) {
				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
			}
		});
	});
		
	
	$('#agree').on('click', function(e) {
    e.preventDefault();
    alert('{{ text_alert }}');
    });
	
	
	$(document).delegate('.madeshop-agree', 'click', function(e) {
    e.preventDefault();
    $("#form-minprice").slideUp( 300, "linear", function(){
    $.ajax({
        url: $(element).attr('href'),
        type: 'get',
        dataType: 'html',
        success: function(data) {
            html = '        <div id="agree-block">';
            html += '        <b class="back"><i class="fa fa-long-arrow-left"></i>{{ text_back }}</b>';
            html += '        <h1 class="modal-title">' + $(element).text() + '</h1>';
            html += '      <div class="form-body">' + data + '</div>';
            html += '</div>';

            $('#minprice-panel .table-cell').after(html);
        }
    });
    });
    var element = this;
});
$(document).delegate('.back', 'click', function(e) {
    $("#form-minprice").slideDown();
    $('#agree-block').remove();
});
</script>					 				 


