<div class="tabbable">
	<ul class="nav nav-tabs">
		<li class="active"><a href="#tab0" data-toggle="tab"><i class="icon-tasks"></i> <?php echo __('admin.informations'); ?></a></li>
		<?php if($customer): ?>
			<li><a href="#tab2" data-toggle="tab"><i class="icon-file"></i> Fichier(s) </a></li>
		<?php endif; ?>
	</ul>
	<div class="tab-content">
		<div class="tab-pane active" id="tab0">
			<table class="table table-striped table-hover">
				<?php if($customer): ?>
				<tr>
					<td style="width:300px">ID Client</td>
					<td><strong><?php echo $customer->id; ?></strong></td>
				</tr>
				<?php endif; ?>
				<tr <?php if($errors->first('valid')) echo 'class="error"'; ?>>
					<td style="width:300px">Compte valide</td>
					<td>
						<?php echo  Form::select('valid', array('y'=>'Oui','n'=>'Non') , Input::old('valid', (isset($customer) ? $customer->valid : NULL))); ; ?>
						<?php echo  $errors->first('valid', '<span class="help-inline">:message</span>') ; ?>
					</td>
				</tr>
				<tr <?php if($errors->first('taux_id')) echo 'class="error"'; ?>>
					<td style="width:300px">Appliquer une remise</td>
					<td>
						<?php echo  Form::select('taux_id', $taux, Input::old('taux_id', (isset($customer) ? $customer->taux_id : NULL)), array('style'=>'width:400px;')); ; ?>
						<?php echo  $errors->first('taux_id', '<span class="help-inline">:message</span>') ; ?>
					</td>
				</tr>
				<tr <?php if($errors->first('type')) echo 'class="error"'; ?>>
					<td style="width:300px">Type *</td>
					<td>
						<?php echo  Form::select('type', array('Client'=>'Client', 'Distributeur'=>'Distributeur', 'Client et Distributeur'=>'Client et Distributeur') , Input::old('type', (isset($customer) ? $customer->type : NULL))); ; ?>
						<?php echo  $errors->first('type', '<span class="help-inline">:message</span>') ; ?>
					</td>
				</tr>
				<tr <?php if($errors->first('civilite')) echo 'class="error"'; ?>>
					<td style="width:300px"><?php echo __('admin.civilite'); ?> *</td>
					<td>
						<?php echo  Form::select('civilite', array('Mr'=>'Mr', 'Mme'=>'Mme', 'Mlle'=>'Mlle') , Input::old('civilite', (isset($customer) ? $customer->civilite : NULL))); ; ?>
						<?php echo  $errors->first('civilite', '<span class="help-inline">:message</span>') ; ?>
					</td>
				</tr>
				<tr <?php if($errors->first('first_name')) echo 'class="error"'; ?>>
					<td style="width:300px"><?php echo __('admin.prenom'); ?> *</td>
					<td>
						<?php echo  Form::text('first_name', Input::old('first_name', (isset($customer) ? $customer->first_name : NULL))); ; ?>
						<?php echo  $errors->first('first_name', '<span class="help-inline">:message</span>') ; ?>
					</td>
				</tr>
				<tr <?php if($errors->first('last_name')) echo 'class="error"'; ?>>
					<td style="width:300px"><?php echo __('admin.nom'); ?> *</td>
					<td>
						<?php echo  Form::text('last_name', Input::old('last_name', (isset($customer) ? $customer->last_name : NULL))); ; ?>
						<?php echo  $errors->first('last_name', '<span class="help-inline">:message</span>') ; ?>
					</td>
				</tr>
				<tr <?php if($errors->first('email') || ($customer && $customer->email=='')) echo 'class="error"'; ?>>
					<td style="width:300px"><?php echo __('admin.adresse_email'); ?> *</td>
					<td>
						<?php echo  Form::text('email', Input::old('email', (isset($customer) ? $customer->email : NULL))); ; ?>
						<?php echo  $errors->first('email', '<span class="help-inline">:message</span>') ; ?>
					</td>
				</tr>
				<tr <?php if($errors->first('tel')) echo 'class="error"'; ?>>
					<td style="width:300px"><?php echo __('admin.tel_fixe'); ?></td>
					<td>
						<?php echo  Form::text('tel', Input::old('tel', (isset($customer) ? $customer->tel : NULL)),array('class'=>'setUcFirstOnly','autocomplete'=>'off')); ; ?>
						<?php echo  $errors->first('tel', '<span class="help-inline">:message</span>') ; ?>
					</td>
				</tr>
				<tr <?php if($errors->first('password')) echo 'class="error"'; ?>>
					<td style="width:300px">
						<?php echo __('admin.mot_passe'); ?> 
						<?php if(!$customer): ?>
						*
						<?php endif; ?>
					</td>
					<td>
						<?php echo  Form::text('password','',array('autocomplete'=>'off')); ; ?>
						<?php echo  $errors->first('password', '<span class="help-inline">:message</span>') ; ?>
						<?php if($customer): ?>
						<br /><span class="help-inline"><?php echo __('admin.laisser_vide'); ?></span>
						<?php endif; ?>
					</td>
				</tr>
				<tr <?php if($errors->first('facturation_societe')) echo 'class="error"'; ?>>
					<td style="width:300px">Société</td>
					<td>
						<?php echo  Form::text('facturation_societe', Input::old('facturation_societe', (isset($customer) ? $customer->facturation_societe : NULL))); ; ?>
						<?php echo  $errors->first('facturation_societe', '<span class="help-inline">:message</span>') ; ?>
					</td>
				</tr>
				<tr <?php if($errors->first('facturation_adresse')) echo 'class="error"'; ?>>
					<td style="width:300px"><?php echo __('admin.adresse'); ?></td>
					<td>
						<?php echo  Form::textarea('facturation_adresse', Input::old('facturation_adresse', (isset($customer) ? $customer->facturation_adresse : NULL)),array('style'=>'width:500px;height:70px')); ; ?>
						<?php echo  $errors->first('facturation_adresse', '<span class="help-inline">:message</span>') ; ?>
					</td>
				</tr>
				<tr <?php if($errors->first('facturation_zipcode')) echo 'class="error"'; ?>>
					<td style="width:300px"><?php echo __('admin.code_postal'); ?></td>
					<td>
						<?php echo  Form::text('facturation_zipcode', Input::old('facturation_zipcode', (isset($customer) ? $customer->facturation_zipcode : NULL))); ; ?>
						<?php echo  $errors->first('facturation_zipcode', '<span class="help-inline">:message</span>') ; ?>
					</td>
				</tr>
				<tr <?php if($errors->first('facturation_city')) echo 'class="error"'; ?>>
					<td style="width:300px"><?php echo __('admin.ville'); ?></td>
					<td>
						<?php echo  Form::text('facturation_city', Input::old('facturation_city', (isset($customer) ? $customer->facturation_city : NULL))); ; ?>
						<?php echo  $errors->first('facturation_city', '<span class="help-inline">:message</span>') ; ?>
					</td>
				</tr>
				<tr <?php if($errors->first('facturation_country_id')) echo 'class="error"'; ?>>
					<td style="width:300px"><?php echo __('admin.pays'); ?></td>
					<td>
						<?php echo  Form::select('facturation_country_id',$countries, Input::old('facturation_country_id', ((isset($customer) && $customer->facturation_country_id>=1) ? $customer->facturation_country_id : 67))); ; ?>
						<?php echo  $errors->first('facturation_country_id', '<span class="help-inline">:message</span>') ; ?>
					</td>
				</tr>
				<?php if($customer): ?>
				<tr>
					<td style="width:300px">Date d'ajout</td>
					<td><?php echo $customer->created_at; ?></td>
				</tr>
				<tr>
					<td style="width:300px">Dernière modification</td>
					<td><?php echo $customer->updated_at; ?></td>
				</tr>
				<?php endif; ?>
			</table>
		</div>
		
		<?php if($customer): ?>
			<div class="tab-pane" id="tab2">
				<div style="margin-bottom: 10px;">
					<?php echo __('admin.organiser_fichiers'); ?>
				</div>
				<div>
					<ul id="sortable2" class="unstyled">
					<?php if(isset($customer)): ?>
					<?php foreach($customer->files as $f): ?>
					<li>
						<input type="hidden" name="files[]" value="<?php echo  $f->id ; ?>">
						<br /><a href="<?php echo URL::to_asset('uploads/files/customers/'.$f->name);; ?>" target="_blank"><?php echo  substr($f->short_name(),0,24) ; ?></a>
						<br /><br />
						<a class="btn btn-danger delete_file"><?php echo __('admin.supprimer'); ?></a></li>
					<?php endforeach; ?>
					<?php endif; ?>
					</ul>
					<div style="clear:both"><br /></div>
				</div>	
	
				<input class="btn" id="file_upload1" name="file_upload1" type="file" multiple="true">
				<div style="clear:both; margin-bottom: 15px;"></div>
				<div id="queue2"></div>
			</div>
		<?php endif; ?>
	</div>
</div>
<script type="text/javascript">
	$('.datepicker').datepicker({
		dateFormat: 'yy-mm-d'
	});
	var upload_script = '<?php echo URL::to_action('backend::customers@file'); ?>';
</script>
