Skip to content

Instantly share code, notes, and snippets.

@victorgiraldes
Created January 2, 2020 21:16
Show Gist options
  • Save victorgiraldes/b6d29353a56e53b5231bcf7a973d3beb to your computer and use it in GitHub Desktop.
Save victorgiraldes/b6d29353a56e53b5231bcf7a973d3beb to your computer and use it in GitHub Desktop.
<%= js "app/adjust-stock-form" %>
<div class='row p-10'>
<%= nested_form_for(@adjust_stock, html: { role: 'form' }) do |f| %>
<%= render 'shared/errors', :resource => @adjust_stock %>
<%= f.hidden_field :kind %>
<div class='col-md-4'>
<div class='form-group col-md-8'>
<%= f.label :date %>
<%= f.text_field :date, class: 'form-control', 'data-mask' => 'date'%>
</div>
<div class='form-group col-md-12'>
<%= f.label :description %>
<%= f.text_area :description, class: 'form-control' %>
<br>
<small> Responsável pelo ajuste: <%= current_user.login %> </small>
</div>
</div>
<%- if f.object.kind == 'product' %>
<div id='adjust_stock_products' class='col-md-8'>
<%= f.fields_for :adjust_stock_products do |d| %>
<%= render "adjust_stocks/adjust_stock_product_fields", { f: f, d: d } %>
<% end %>
<div class='form-group'>
<%= f.link_to_add "Adicionar Produtos", :adjust_stock_products, class: 'btn btn-xs btn-primary' %>
</div>
</div>
<% else %>
<div id='adjust_stock_fuels' class='col-md-8'>
<%= f.fields_for :adjust_stock_fuels do |d| %>
<%= render "adjust_stocks/adjust_stock_fuel_fields", { f: f, d: d } %>
<% end %>
<div class='form-group'>
<%= f.link_to_add "Adicionar Combustíveis", :adjust_stock_fuels, class: 'btn btn-xs btn-primary' %>
</div>
</div>
<% end %>
<div class='col-md-12'>
<% if current_user.only_view? %>
<%= link_to "Voltar","/adjust_stocks", class: "btn btn-info btn-sm" %>
<% else %>
<button type='submit' class='btn btn-success btn-sm'>
<span class='fa fa-check'> </span> Criar Ajuste de Estoque
</button>
<%= link_to "Voltar","/adjust_stocks", class: "btn btn-info btn-sm" %>
<% end %>
</div>
<% end %>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment