<%= form_for( setup_supplier(@supplier), :html => {:class=>"form-horizontal"}) do |f| %>
	<div class="portlet-body form">
		<% if @supplier.errors.any? %>
			<div class="alert alert-danger">
				<strong>Tiene <%= pluralize(@supplier.errors.count, "error") %> no se puede guardar el proveedor</strong><br>
			</div>
		<% end %>
		<div class="form-body">
			<h4 class="form-section">Información general</h4>
			<div class="row">
				<div class="form-group ">
					<%= f.label :nick_name,  {:class=>"col-md-3 control-label"} do %>Proveedor <span class="required">*</span>
					<% end %> 
					<div class="col-md-9">
						<%= f.text_field :nick_name, {:class=>"form-control input-xlarge" }  %>
					</div>
				</div>
				<div class="form-group">
					<%= f.label :phone, "Teléfono", {:class=>"col-md-3 control-label"} do %> Teléfono <span class="required">*</span>
					<% end %> 
					<div class="col-md-9">
						<div class="input-icon">
							<i class="fa fa-phone"></i>
							<%= f.text_field :phone, {:class=>"form-control input-small mask_phone" } %>
						</div>
					</div>
				</div>
				<div class="form-group">
					<%= f.label :email, "Correo", {:class=>"col-md-3 control-label"} do %> Correo electrónico <span class="required">*</span>
					<% end %> 
					<div class="col-md-9">
						<div class="input-icon">
							<i class="fa fa-envelope"></i>
							<%= f.text_field :email, {:class=>"form-control input-xlarge", :placeholder=>"ejemplo@correo.com" } %>
						</div>
					</div>
				</div>
				<div class="form-group">
					<%= f.label :notes, "Observaciones", {:class=>"col-md-3 control-label"} %>
					<div class="col-md-8">
						<%= f.text_area :notes, {:class=>"form-control", :rows=>5 } %>
					</div>
				</div>
				<% if @supplier.persisted? %>
				<!-- <div class="form-group last">
					<%= f.label :status, "Status", {:class=>"col-md-3 control-label"} %>
					<div class="col-md-9">
						<%= f.check_box(:status,  
							{
								class: "make-switch",
								data: {
									on_color: "success",
									off_color: "danger",
									on_text: "Activo", 
									off_text: "Inactivo"
								}
							},"active", "inactive"
						) %>
					</div>
				</div> -->
				<% end %>
			</div>
			<%= f.fields_for :billing_information, @supplier.billing_information do |b| %>
				<%= render partial: "billing_information/form", locals: { info: @supplier, b: b } %>
			<% end %>
			<%= f.fields_for :contact, @supplier.contact do |b| %>
				<%= render partial: "contacts/form", locals: { info: @supplier, c: b } %>
			<% end %>
		</div>
		<div class="form-actions">
			<div class="row">
				<div class="col-md-offset-3 col-md-9">
					<%= f.submit 'Guardar', {:class=>"btn green"} %> 
					<%= link_to 'Cancelar', suppliers_path(:filter => @filter, :current_page => @current_page), {:class=>"btn default"} %>
				</div>
			</div>
		</div>
	</div>
<% end %>
<script type="text/javascript">
	$(document).ready(function() {
		handleInputMasks();
		App.init();
	});
</script>
