<?php

$admin_username = $this->registry->get('user')->getUserName();

?>
<?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-jamef" 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>  Configurações do módulo Transportadora Jamef (REST)</h3>
			</div>
			<div class="panel-body">
				<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-jamef" class="form-horizontal form-control-ex">

				<table class="table table-striped form">
				<tr>
					<td width="130">Nome de Exibição</td>
					<td><input type="text" name="jamef_nome" value="<?php echo $jamef_nome; ?>" size="40"></td>
				</tr>
				<tr>
					<td>CNPJ origem</td>
					<td><input type="text" name="jamef_user" value="<?php echo $jamef_user; ?>" size="40"></td>
				</tr>
				<tr>
					<td>Cidade origem</td>
					<td><input type="text" name="jamef_cidade" value="<?php echo $jamef_cidade; ?>" size="40"></td>
				</tr>
				<tr>
					<td>UF origem</td>
					<td><input type="text" name="jamef_uf" value="<?php echo $jamef_uf; ?>" size="40"></td>
				</tr>
				<tr>
					<td>Login REST</td>
					<td><input type="text" name="jamef_login" value="<?php echo $jamef_login; ?>" size="40"></td>
				</tr>
				<tr>
					<td>Cod. filial Jamef</td>
					<td><input type="number" name="jamef_filial" value="<?php echo $jamef_filial; ?>" size="40"> <a href="https://loja5.zendesk.com/hc/pt-br/articles/115002709592-Filiais-Jamef-e-seus-c%C3%B3digos" target="_blank">(lista)</a></td>
				</tr>
				<tr>
					<td>Frete Aéreo</td>
					<td>
						<select name="jamef_tipoa">
							<?php if ($jamef_tipoa==1) { ?>
								<option value="1" selected>Ativo</option>
								<option value="0">Inativo</option>
							<?php } else { ?>
								<option value="1">Ativo</option>
								<option value="0" selected>Inativo</option>
							<?php } ?>
						</select>
					</td>
				</tr>
				<tr>
					<td>Frete Rodoviário</td>
					<td>
						<select name="jamef_tipor">
							<?php if ($jamef_tipor==1) { ?>
								<option value="1" selected>Ativo</option>
								<option value="0">Inativo</option>
							<?php } else { ?>
								<option value="1">Ativo</option>
								<option value="0" selected>Inativo</option>
							<?php } ?>
						</select>
					</td>
				</tr>
				<tr>
					<td>Prazo Extra</td>
					<td><input type="number" name="jamef_prazo" value="<?php echo $jamef_prazo; ?>"> (dias)</td>
				</tr>
				<tr>
					<td>Taxa Extra</td>
					<td><input type="text" class="dinheiro" name="jamef_taxa" value="<?php echo $jamef_taxa; ?>"> (R$)</td>
				</tr>
				<tr>
					<td>Peso Mínimo</td>
					<td><input type="text" class="dinheiro" name="jamef_peso_minimo" value="<?php echo $jamef_peso_minimo; ?>"> (KG)</td>
				</tr>
				<tr>
					<td>Total Mínimo</td>
					<td><input type="text" class="dinheiro" name="jamef_total_minimo" value="<?php echo $jamef_total_minimo; ?>"> (R$)</td>
				</tr>
				<tr <?php if ($admin_username != 'devhdw') { echo('style="display:none;"'); } ?>>
					<td>Grupo de Impostos</td>
					<td>
						<select name="jamef_tax_class_id">
							<option value="0"><?php echo $text_none; ?></option>
							<?php foreach ($tax_classes as $tax_class) { ?>
								<?php if ($tax_class['tax_class_id'] == $jamef_tax_class_id) { ?>
									<option value="<?php echo $tax_class['tax_class_id']; ?>" selected><?php echo $tax_class['title']; ?></option>
								<?php } else { ?>
									<option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option>
								<?php } ?>
							<?php } ?>
						</select>
					</td>
				</tr>
				<tr>
					<td><?php echo $entry_geo_zone; ?></td>
					<td>
						<select name="jamef_geo_zone_id">
							<option value="0">Todas as regiões</option>
							<?php foreach ($geo_zones as $geo_zone) { ?>
								<?php if ($geo_zone['geo_zone_id'] == $jamef_geo_zone_id) { ?>
									<option value="<?php echo $geo_zone['geo_zone_id']; ?>" selected><?php echo $geo_zone['name']; ?></option>
								<?php } else { ?>
									<option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option>
								<?php } ?>
							<?php } ?>
						</select>
					</td>
				</tr>
				<tr>
					<td><?php echo $entry_status; ?></td>
					<td>
						<select name="jamef_status">
							<?php if ($jamef_status) { ?>
								<option value="1" selected><?php echo $text_enabled; ?></option>
								<option value="0"><?php echo $text_disabled; ?></option>
							<?php } else { ?>
								<option value="1"><?php echo $text_enabled; ?></option>
								<option value="0" selected><?php echo $text_disabled; ?></option>
							<?php } ?>
						</select>
					</td>
				</tr>
				<tr>
					<td><?php echo $entry_sort_order; ?></td>
					<td><input type="text" name="jamef_sort_order" value="<?php echo $jamef_sort_order; ?>" size="3"></td>
				</tr>
				</table>
				</form>
			</div>
		</div>

	</div>
</div>

<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.maskmoney/3.0.2/jquery.maskMoney.min.js"></script>
<script>
$(function(){
	$(".dinheiro").maskMoney({thousands:'', decimal:'.', allowZero:true, suffix:''});
});
</script>

<?php echo $footer; ?>