<div class="page-container">
	<div class="page-content-wrapper">
		<div class="page-head">
			<div class="container-fluid">
				<div class="page-title">
					<h1>Unidades de medida </h1>
				</div>
			</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">
					<li>
						<a href="/">Inicio</a>
						<i class="fa fa-circle"></i>
					</li>
					<li>
						<span>Unidades de medida</span>
					</li>
				</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-8">
							<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 Unidades de medida</span>
									</div>
									<div class="actions">
										<% if can? :create, Unit %>
                      <%= link_to new_unit_path, remote: true, class: "btn bold green pull-right" do %> Nueva unidad de medida <i class="fa fa-plus"></i>
                      <% end %>
                    <% end %>
									</div>
								</div>
								<div class="portlet-body">
									<table class="table table-striped table-hover tableadvanced">
										<thead>
											<tr>
												<th>#</th>
												<th>Unidad de medida</th>
												<th>Acciones</th>
											</tr>
										</thead>
										<tbody>
											<% @units.each_with_index do |unit, key| %>
												<tr>
													<td><%= key + 1 %></td>
													<td><%= unit.unit %></td>
													<td>
														<%= link_to edit_unit_path(unit), remote: true, class: "btn btn-icon-only btn-primary", title: "Editar unidad de medida" do %><i class="fa fa-edit"></i> <% end %>
														<% if unit.active? %>
                              <%= link_to unit_status_path(unit), class: "btn btn-icon-only default", title: "Desactivar unidad de medida", data: { confirm: '¿Está seguro de desactivar la unidad de medida?', method: 'post' } do %>
                                <i class="fa fa-toggle-off"></i>
                              <% end %>
                            <% elsif unit.inactive? %>
                              <%= link_to unit_status_path(unit), class: "btn btn-icon-only green-jungle", title: "Activar unidad de medida", data: { confirm: '¿Está seguro de activar la unidad de medida?', method: 'post' } do %>
                                <i class="fa fa-toggle-on"></i>
                              <% end %>
                            <% end %>
													</td>
												</tr>
											<% end %>
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
				</div>
				<!-- END PAGE CONTENT INNER -->
			</div>
		</div>
	</div>
</div>
