<!-- BEGIN CONTAINER -->
<div class="page-container">
	<!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<!-- BEGIN CONTENT BODY -->
		<!-- BEGIN PAGE HEAD-->
		<div class="page-head">
			<div class="container-fluid">
				<!-- BEGIN PAGE TITLE -->
				<div class="page-title">
					<h1>Vendedores</h1>
				</div>
				<!-- END PAGE TITLE -->
			</div>
		</div>
		<!-- END PAGE HEAD-->
		<!-- BEGIN PAGE CONTENT BODY -->
		<div class="page-content">
			<div class="container-fluid">
				<!-- BEGIN PAGE BREADCRUMBS -->
				<ul class="page-breadcrumb breadcrumb">
					<%= render_breadcrumbs :tag => :li, :separator => ' <i class="fa fa-circle"></i> ' %>
				</ul>
				<!-- END PAGE BREADCRUMBS -->
				<!-- BEGIN PAGE CONTENT INNER -->
				<div class="page-content-inner">
					<div id="notice">
					<% if success %>
						<div class="alert alert-success">
							<p><%= success %></p>
						</div>
					<% elsif warning %>
						<div class="alert alert-warning">
							<p><%= warning %></p>
						</div>
					<% end %>
					</div>
					<div class="row">
						<div class="col-md-12">
							<div class="portlet light ">
								<div class="portlet-title">
									<div class="caption">
										<i class="fa fa-list "></i>
										<span class="caption-subject bold uppercase">Lista de vendedores</span>
									</div>
									<div class="actions">
										<% if can? :create, Seller %>
										<%= link_to new_seller_path, {:class=>"btn bold green pull-right filtros"} do %> Nuevo Vendedor <i class="fa fa-plus"></i>
										<% end %>
										<% end %>
									</div>
								</div>
								<div class="portlet-body">
									<input type='hidden' name='filter' id='filter' value='<%= @filter %>' >
									<input type='hidden' name='current_page' id='current_page' value='<%= @current_page %>' >
									<table class="table table-striped table-bordered table-hover tableadvanced">
										<thead>
											<tr>
												<th>#</th>
												<th>Nombre</th>
												<th>Apellido</th>
												<% if current_user.usertype == "A" %>
													<th>Punto de venta</th>
												<% end %>
												<th>Status</th>
												<th width="15%">Acciones</th>
											</tr>
										</thead>
										<tbody>
											<% @sellers.each_with_index do |seller, key| %>
											<tr>
												<td><%= key + 1 %></td>
												<td><%= seller.name %></td>
												<td><%= seller.last_name %></td>
												<% if current_user.usertype == "A" %>
													<td> <%= seller.pointsale.name %> </td>
												<% end %>
												<td>
													<% if seller.status == "inactive" %>
														<i class='fa fa-times fa-2 font-red'></i>
													<% else %>
														<i class='fa fa-check fa-2 font-green'></i>
													<% end %>
												</td>
												<td>
												<% if can? :update, Seller %>
													<%= link_to edit_seller_path(seller), {:class=>"btn btn-icon-only btn-primary filtros", :title=>"Editar vendedor"} do %>
														<i class="fa fa-edit"></i>
													<% end %>
													<% if seller.active? %>
														<%= link_to seller_update_status_path(seller), :class=>"btn btn-icon-only default", :title=>"Desactivar vendedor", data: { confirm: '¿Esta seguro de desactivar el vendedor?', method: 'post'}  do %>
															<i class="fa fa-toggle-off"></i>
														<% end %>
													<% elsif seller.inactive? %>
														<%= link_to seller_update_status_path(seller), :class=>"btn btn-icon-only green-jungle", :title=>"Activar vendedor", data: { confirm: '¿Esta seguro de activar el vendedor?', method: 'post'}  do %>
															<i class="fa fa-toggle-on"></i>
														<% end %>
													<% end %>
												<% end %>
												<% if can? :destroy, Seller %>
													<%= link_to seller , method: :delete, :class => "btn btn-icon-only btn-danger", :title=>"Eliminar vendedor", data: { confirm: '¿Esta seguro de eliminar al vendedor?'}   do %>
														<i class="fa fa-trash-o"></i>
													<% end %>
												<% end %>
												</td>
											</tr>
											<% end %>
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
				</div>
				<!-- END PAGE CONTENT INNER -->
			</div>
		</div>
		<!-- END PAGE CONTENT BODY -->
		<!-- END CONTENT BODY -->
	</div>
	<!-- END CONTENT -->
</div>
<!-- END CONTAINER -->
