<%= form_for(@expensesconcept, :html => {:class=>"form-horizontal"}) do |f| %>

<div class="portlet-body form">
	<% if @expensesconcept.errors.any? %>
	<div class="alert alert-danger">
		<strong>Tiene <%= pluralize(@expensesconcept.errors.count, "error") %> no se puede guardar el concepto de egreso</strong><br>
	</div>
	<% end %>
	<div class="form-body">
		<div class="form-group">
			<%= f.label :name, "Nombre del Concepto", {:class=>"col-md-3 control-label"} do %> Nombre del concepto
				<span class="required">*</span>
			<% end %>
			<div class="col-md-9">
				<%= f.text_field :name, {:class=>"form-control"} %>
			</div>
		</div>
		<div class="form-group">
			<%= f.label :decription, "Descripción", {:class=>"col-md-3 control-label"} %>
			<div class="col-md-9">
				<%= f.text_field :description, {:class=>"form-control"} %>
			</div>
		</div>
		<% if @expensesconcept.persisted? %>
		<div class="form-group">
			<%= f.label :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 class="form-group ">
			<%= f.label :allpoints, "Aplica a todo los puntos de venta?", {:class=>"col-md-3 control-label"} %>
			<div class="col-md-9">
				<%= f.check_box(:allpoints,
					{
						class: "make-switch",
						data: {
							on_color: "success",
							off_color: "danger",
							on_text: "Si",
							off_text: "No"
						}
					},"true", "false"
				) %>
			</div>
		</div>
		<div class="form-group" id="boxpointsales" <% if @expensesconcept.allpoints? %> style="display:none;"  <% end %> >
			<%= f.label :pointsale_ids, "Puntos de Venta", {:class=>"col-md-3 control-label"} %>
			<div class="col-md-9">
				<%= f.collection_select :pointsale_ids, Pointsale.activos, :id, :name, {:selected => @expensesconcept.pointsale_ids, :include_blank => false}, {:multiple => true, :class => "multi-select "}   %>
			</div>
		</div>
	</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', expensesconcepts_path(:filter => @filter, :current_page => @current_page), {:class=>"btn default"} %>
			</div>
		</div>
	</div>
</div>
<% end %>
<script type="text/javascript">
	$(document).ready(function() {
		handleMultiSelect();
		App.init();

		$('input[name="expensesconcept[allpoints]"]').on('switchChange.bootstrapSwitch', function(event, state) {
			if (state) {
				$("#boxpointsales").hide();

			}else{
				$("#boxpointsales").show();
			}
		});
	});
</script>
