Skip to content

Instantly share code, notes, and snippets.

@eltonsantos
Last active April 14, 2016 12:36
Show Gist options
  • Select an option

  • Save eltonsantos/7c010f87f6c58fb433382dd58e1a37e7 to your computer and use it in GitHub Desktop.

Select an option

Save eltonsantos/7c010f87f6c58fb433382dd58e1a37e7 to your computer and use it in GitHub Desktop.
<form name="form" action="/refinancings/new" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="✓">
<input type="hidden" name="search_employee_by_cpf" id="search_employee_by_cpf" value="111111">
<table class="table table-condensed">
<tbody><tr>
<th>Name</th>
<td>Elton</td>
</tr>
<tr>
<th>Matrícula</th>
<td>100000</td>
</tr>
<tr>
<th>CPF</th>
<td>111111</td>
</tr>
</tbody></table>
<hr>
<table class="table table-condensed table-bordered table-hover">
<thead>
<tr><th>&nbsp;</th>
<th>Contract number</th>
<th>Value of parcel</th>
<th>Qtd of parcel</th>
<th>Total Value</th>
<th>Value to Solve</th>
</tr></thead>
<tbody>
<tr>
<td><input type="checkbox" name="authorization[contract_ids][]" id="authorization_contract_ids_" value="010101"></td>
<td>010101</td>
<td>$100.00</td>
<td>10</td>
<td>$1,000.00</td>
<td>
<div class="input string required authorization_value_solve"><input class="string required" placeholder="Digit a value" type="text" name="authorization[value_solve]" id="authorization_value_solve"></div>
</td>
</tr>
<tr>
<td><input type="checkbox" name="authorization[contract_ids][]" id="authorization_contract_ids_" value="343434"></td>
<td>343434</td>
<td>$999.00</td>
<td>99</td>
<td>$9,999.00</td>
<td>
<div class="input string required authorization_value_solve"><input class="string required" placeholder="Digit a value" type="text" name="authorization[value_solve]" id="authorization_value_solve"></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-condensed">
<tbody><tr>
<th>Name</th>
<td>Elton</td>
</tr>
<tr>
<th>Matrícula</th>
<td>200000</td>
</tr>
<tr>
<th>CPF</th>
<td>111111</td>
</tr>
</tbody></table>
<hr>
<table class="table table-condensed table-bordered table-hover">
<thead>
<tr><th>&nbsp;</th>
<th>Contract number</th>
<th>Value of parcel</th>
<th>Qtd of parcel</th>
<th>Total Value</th>
<th>Value to Solve</th>
</tr></thead>
<tbody>
<tr>
<td><input type="checkbox" name="authorization[contract_ids][]" id="authorization_contract_ids_" value="222222"></td>
<td>222222</td>
<td>$200.00</td>
<td>20</td>
<td>$2,000.00</td>
<td>
<div class="input string required authorization_value_solve"><input class="string required" placeholder="Digit a value" type="text" name="authorization[value_solve]" id="authorization_value_solve"></div>
</td>
</tr>
</tbody>
</table>
<input type="submit" name="commit" value="Reserve" class="btn btn-primary btn-reserva">
</form>
<%= form_tag(new_refinancing_path, name: 'form', method: :get) do %>
<%= hidden_field_tag 'search_employee_by_cpf', params[:search_employee_by_cpf] %>
<% @employees.each do |employee| %>
<table class="table table-condensed">
<tr>
<th>Name</th>
<td><%= employee.person.name %></td>
</tr>
<tr>
<th>Matrícula</th>
<td><%= employee.register %></td>
</tr>
<tr>
<th>CPF</th>
<td><%= employee.person.cpf %></td>
</tr>
</table>
<hr />
<table class="table table-condensed table-bordered table-hover">
<thead>
<th>&nbsp;</th>
<th>Contract number</th>
<th>Value of parcel</th>
<th>Qtd of parcel</th>
<th>Total Value</th>
<th>Value to Solve</th>
</thead>
<tbody>
<% employee.authorizations.each do |authorization| %>
<tr>
<td><%= check_box_tag 'authorization[contract_ids][]', authorization.contract_number %></td>
<td><%= authorization.contract_number %></td>
<td><%= number_to_currency authorization.parcel_value %></td>
<td><%= authorization.qtd_parcel %></td>
<td><%= number_to_currency authorization.total_value %></td>
<td>
<%= simple_fields_for(:authorization, remote: true) do |f| %>
<%= f.input :value_solve, label: false, placeholder: "Digit a value" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<%= submit_tag "Reserve", :class => 'btn btn-primary btn-reserva' %>
<% end %>
Started GET "/refinancings/new?utf8=%E2%9C%93&search_employee_by_cpf=02849112321&authorization%5Bcontract_ids%5D%5B%5D=11&authorization%5Bvalue_solve%5D=545454&authorization%5Bvalue_solve%5D=&authorization%5Bvalue_solve%5D=&commit=Reserve" for 127.0.0.1 at 2016-04-13 15:32:26 -0300
Processing by RefinancingsController#new as HTML
Parameters: {"utf8"=>"✓", "search_employee_by_cpf"=>"02849112321", "authorization"=>{"contract_ids"=>["11"], "value_solve"=>""}, "commit"=>"Reserve"}
Employee Load (0.3ms) SELECT "employees".* FROM "employees" INNER JOIN "people" ON "people"."id" = "employees"."person_id" WHERE (people.cpf LIKE '%02849112321%') ORDER BY "employees"."id" ASC LIMIT 1
Person Load (0.1ms) SELECT "people".* FROM "people" WHERE "people"."id" = ? LIMIT 1 [["id", 1]]
Authorization Load (0.2ms) SELECT "authorizations".* FROM "authorizations" WHERE (contract_number in ('11'))
Rendered refinancings/new.html.erb within layouts/application (17.1ms)
Completed 200 OK in 36ms (Views: 33.3ms | ActiveRecord: 0.6ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment