<?php echo $header; ?><?php echo $column_left; ?>
<div id="content">
	<div class="page-header">
		<div class="container-fluid">
			<div class="pull-right">
				<button type="submit" form="form-exibir-descontos" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button>
				<a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
			<h1><?php echo $heading_title; ?></h1>
			<ul class="breadcrumb">
				<?php foreach ($breadcrumbs as $breadcrumb) { ?>
				<li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
				<?php } ?>
			</ul>
		</div>
	</div>
	<div class="container-fluid">
		<?php if ($error_warning) { ?>
		<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?>
			<button type="button" class="close" data-dismiss="alert">&times;</button>
		</div>
		<?php } ?>
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title"><i class="fa fa-pencil"></i> <?php echo $text_edit; ?></h3>
			</div>
			<div class="panel-body">

				<div style="margin:0 0 30px 0; padding:10px; background:#d00; color:#fff;">
					<strong style="color:#ff0;">ATENÇÃO!</strong> Este módulo apenas exibe o preço com desconto na página de produtos, para configurar o cálculo do desconto na finalização do pedido acesse o menu
					<a href="<?php echo $this->registry->get('url')->link('total/desconto', 'token=' . $this->registry->get('session')->data['token'], 'SSL'); ?>" style="color:#fff;">Extensões &gt; Totalização do Pedido &gt; Desconto por forma de pagamento</a>.
				</div>

				<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-exibir-descontos" class="form-horizontal">

					<div class="row">
						<div class="col-sm-2">
							<ul class="nav nav-pills nav-stacked" id="modules">
								<?php $module_row = 0; ?>
								<?php foreach ($modules as $module) { ?>
								<li><a href="#tab-module<?php echo $module_row; ?>" data-toggle="tab"><i class="fa fa-minus-circle" onclick="$('a[href=\'#tab-module<?php echo $module_row; ?>\']').parent().remove(); $('#tab-module<?php echo $module_row; ?>').remove(); $('#modules a:first').tab('show');"></i> <?php echo $tab_module_num; ?> <?php echo $module_row + 1; ?></a></li>
								<?php $module_row++; ?>
								<?php } ?>
								<li><a href="#" data-toggle="tab" onclick="addModule(); return false;"><i class="fa fa-plus-circle"></i> <?php echo $tab_module_add; ?></a></li>
							</ul>
						</div>

						<div class="col-sm-10">
							<div class="tab-content">

								<?php $module_row = 0; ?>
								<?php foreach ($modules as $module) { ?>
								<div class="tab-pane" id="tab-module<?php echo $module_row; ?>">
									<div class="form-group">
										<label class="col-sm-2 control-label" for="input-desconto-<?php echo $module_row; ?>"><span data-toggle="tooltip" title="<?php echo $help_desconto; ?>"><?php echo $entry_desconto; ?></span></label>
										<div class="col-sm-10">
											<input type="text" name="exibir_descontos_config[<?php echo $module_row; ?>][desconto]" value="<?php echo isset($module['desconto']) ? $module['desconto'] : ''; ?>" placeholder="<?php echo $entry_desconto; ?>" id="input-desconto-<?php echo $module_row; ?>" class="form-control" />
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label" for="input-minimo-<?php echo $module_row; ?>"><span data-toggle="tooltip" title="<?php echo $help_minimo; ?>"><?php echo $entry_minimo; ?></span></label>
										<div class="col-sm-10">
											<input type="text" name="exibir_descontos_config[<?php echo $module_row; ?>][minimo]" value="<?php echo isset($module['minimo']) ? $module['minimo'] : ''; ?>" placeholder="<?php echo $entry_minimo; ?>" id="input-minimo-<?php echo $module_row; ?>" class="form-control" />
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label"><span data-toggle="tooltip" title="<?php echo $help_descricao; ?>"><?php echo $entry_descricao; ?></span></label>
										<div class="col-sm-10">
											<?php foreach ($languages as $language) { ?>
												<div class="input-group">
													<span class="input-group-addon"><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /></span>
													<input type="text" name="exibir_descontos_config[<?php echo $module_row; ?>][descricao][<?php echo $language['language_id']; ?>]" value="<?php echo isset($module['descricao'][$language['language_id']]) ? $module['descricao'][$language['language_id']] : ''; ?>" placeholder="<?php echo $text_descricao_padrao; ?>" class="form-control" />
												</div>
											<?php } ?>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label" for="input-listagem-<?php echo $module_row; ?>"><span data-toggle="tooltip" title="<?php echo $help_listagem; ?>"><?php echo $entry_listagem; ?></span></label>
										<div class="col-sm-10">
											<select name="exibir_descontos_config[<?php echo $module_row; ?>][listagem]" id="input-listagem-<?php echo $module_row; ?>" class="form-control">
												<option value="1" <?php if (isset($module['listagem']) && $module['listagem'] == '1') { echo('selected'); } ?> ><?php echo $text_yes; ?></option>
												<option value="0" <?php if (isset($module['listagem']) && $module['listagem'] == '0') { echo('selected'); } ?> ><?php echo $text_no; ?></option>
											</select>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label"><span data-toggle="tooltip" title="<?php echo $help_descricao_lista; ?>"><?php echo $entry_descricao_lista; ?></span></label>
										<div class="col-sm-10">
											<?php foreach ($languages as $language) { ?>
												<div class="input-group">
													<span class="input-group-addon"><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /></span>
													<input type="text" name="exibir_descontos_config[<?php echo $module_row; ?>][descricao_lista][<?php echo $language['language_id']; ?>]" value="<?php echo isset($module['descricao_lista'][$language['language_id']]) ? $module['descricao_lista'][$language['language_id']] : ''; ?>" placeholder="<?php echo $text_descricao_lista_padrao; ?>" class="form-control" />
												</div>
											<?php } ?>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label" for="input-status-<?php echo $module_row; ?>"><?php echo $entry_status; ?></label>
										<div class="col-sm-10">
											<select name="exibir_descontos_config[<?php echo $module_row; ?>][status]" id="input-status-<?php echo $module_row; ?>" class="form-control">
												<option value="0" <?php if (isset($module['status']) && $module['status'] == '0') { echo('selected'); } ?> ><?php echo $text_disabled; ?></option>
												<option value="1" <?php if (isset($module['status']) && $module['status'] == '1') { echo('selected'); } ?> ><?php echo $text_enabled; ?></option>
											</select>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label" for="input-sort-order-<?php echo $module_row; ?>"><?php echo $entry_sort_order; ?></label>
										<div class="col-sm-10">
											<input type="text" name="exibir_descontos_config[<?php echo $module_row; ?>][sort_order]" value="<?php echo isset($module['sort_order']) ? $module['sort_order'] : ''; ?>" placeholder="<?php echo $entry_sort_order; ?>" id="input-sort-order-<?php echo $module_row; ?>" class="form-control" />
										</div>
									</div>
								</div>
								<?php $module_row++; ?>
								<?php } ?>

							</div>
						</div>
					</div>

				</form>

			</div>
		</div>
	</div>
</div>

<script type="text/javascript"><!--
var module_row = <?php echo $module_row; ?>;

function addModule() {
	html  = '<div class="tab-pane" id="tab-module' + module_row + '">';
	html += '	<div class="form-group">';
	html += '		<label class="col-sm-2 control-label" for="input-desconto-' + module_row + '"><span data-toggle="tooltip" title="<?php echo $help_desconto; ?>"><?php echo $entry_desconto; ?></span></label>';
	html += '		<div class="col-sm-10">';
	html += '			<input type="text" name="exibir_descontos_config[' + module_row + '][desconto]" value="10" placeholder="<?php echo $entry_desconto; ?>" id="input-desconto-' + module_row + '" class="form-control" />';
	html += '		</div>';
	html += '	</div>';
	html += '	<div class="form-group">';
	html += '		<label class="col-sm-2 control-label" for="input-minimo-' + module_row + '"><span data-toggle="tooltip" title="<?php echo $help_minimo; ?>"><?php echo $entry_minimo; ?></span></label>';
	html += '		<div class="col-sm-10">';
	html += '			<input type="text" name="exibir_descontos_config[' + module_row + '][minimo]" value="1.00" placeholder="<?php echo $entry_minimo; ?>" id="input-minimo-' + module_row + '" class="form-control" />';
	html += '		</div>';
	html += '	</div>';
	html += '	<div class="form-group">';
	html += '		<label class="col-sm-2 control-label"><span data-toggle="tooltip" title="<?php echo $help_descricao; ?>"><?php echo $entry_descricao; ?></span></label>';
	html += '		<div class="col-sm-10">';
	<?php foreach ($languages as $language) { ?>
	html += '				<div class="input-group">';
	html += '					<span class="input-group-addon"><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /></span>';
	html += '					<input type="text" name="exibir_descontos_config[' + module_row + '][descricao][<?php echo $language['language_id']; ?>]" value="<?php echo $text_descricao_padrao; ?>" placeholder="<?php echo $text_descricao_padrao; ?>" class="form-control" />';
	html += '				</div>';
	<?php } ?>
	html += '		</div>';
	html += '	</div>';
	html += '	<div class="form-group">';
	html += '		<label class="col-sm-2 control-label" for="input-listagem-' + module_row + '"><span data-toggle="tooltip" title="<?php echo $help_listagem; ?>"><?php echo $entry_listagem; ?></span></label>';
	html += '		<div class="col-sm-10">';
	html += '			<select name="exibir_descontos_config[' + module_row + '][listagem]" id="input-listagem-' + module_row + '" class="form-control">';
	html += '				<option value="1"><?php echo $text_yes; ?></option>';
	html += '				<option value="0"><?php echo $text_no; ?></option>';
	html += '			</select>';
	html += '		</div>';
	html += '	</div>';
	html += '	<div class="form-group">';
	html += '		<label class="col-sm-2 control-label"><span data-toggle="tooltip" title="<?php echo $help_descricao_lista; ?>"><?php echo $entry_descricao_lista; ?></span></label>';
	html += '		<div class="col-sm-10">';
	<?php foreach ($languages as $language) { ?>
	html += '				<div class="input-group">';
	html += '					<span class="input-group-addon"><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /></span>';
	html += '					<input type="text" name="exibir_descontos_config[' + module_row + '][descricao_lista][<?php echo $language['language_id']; ?>]" value="<?php echo $text_descricao_lista_padrao; ?>" placeholder="<?php echo $text_descricao_lista_padrao; ?>" class="form-control" />';
	html += '				</div>';
	<?php } ?>
	html += '		</div>';
	html += '	</div>';
	html += '	<div class="form-group">';
	html += '		<label class="col-sm-2 control-label" for="input-status-' + module_row + '"><?php echo $entry_status; ?></label>';
	html += '		<div class="col-sm-10">';
	html += '			<select name="exibir_descontos_config[' + module_row + '][status]" id="input-status-' + module_row + '" class="form-control">';
	html += '				<option value="0"><?php echo $text_disabled; ?></option>';
	html += '				<option value="1"><?php echo $text_enabled; ?></option>';
	html += '			</select>';
	html += '		</div>';
	html += '	</div>';
	html += '	<div class="form-group">';
	html += '		<label class="col-sm-2 control-label" for="input-sort-order-' + module_row + '"><?php echo $entry_sort_order; ?></label>';
	html += '		<div class="col-sm-10">';
	html += '			<input type="text" name="exibir_descontos_config[' + module_row + '][sort_order]" value="" placeholder="<?php echo $entry_sort_order; ?>" id="input-sort-order-' + module_row + '" class="form-control" />';
	html += '		</div>';
	html += '	</div>';
	html += '</div>';

	$('#form-exibir-descontos').find('.tab-content').append(html);

	$('#modules > li:last-child').before('<li><a href="#tab-module' + module_row + '" data-toggle="tab"><i class="fa fa-minus-circle" onclick="$(\'a[href=\\\'#tab-module' + module_row + '\\\']\').parent().remove(); $(\'#tab-module' + module_row + '\').remove(); $(\'#modules a:first\').tab(\'show\')"></i> <?php echo $tab_module_num; ?> ' + (module_row + 1) + '</li>');

	$('#modules a[href=\'#tab-module' + module_row + '\']').tab('show');

	module_row++;
}

$('#modules a:first').tab('show');

<?php if ($module_row == 0) { ?>
	addModule();
<?php } ?>
//--></script>

<?php echo $footer; ?>