inventorymaster 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +37 -0
- data/app/assets/javascripts/inventorymaster/application.js +14 -0
- data/app/assets/javascripts/inventorymaster/areas.js +2 -0
- data/app/assets/javascripts/inventorymaster/locations.js +2 -0
- data/app/assets/javascripts/inventorymaster/manufacturers.js +2 -0
- data/app/assets/javascripts/inventorymaster/products.js +2 -0
- data/app/assets/javascripts/inventorymaster/settings.js +2 -0
- data/app/assets/javascripts/inventorymaster/transaction_types.js +2 -0
- data/app/assets/javascripts/inventorymaster/transactions.js +2 -0
- data/app/assets/stylesheets/inventorymaster/application.css +15 -0
- data/app/assets/stylesheets/inventorymaster/areas.css +4 -0
- data/app/assets/stylesheets/inventorymaster/locations.css +4 -0
- data/app/assets/stylesheets/inventorymaster/manufacturers.css +4 -0
- data/app/assets/stylesheets/inventorymaster/products.css +4 -0
- data/app/assets/stylesheets/inventorymaster/settings.css +4 -0
- data/app/assets/stylesheets/inventorymaster/transaction_types.css +4 -0
- data/app/assets/stylesheets/inventorymaster/transactions.css +4 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/controllers/inventorymaster/application_controller.rb +5 -0
- data/app/controllers/inventorymaster/areas_controller.rb +62 -0
- data/app/controllers/inventorymaster/locations_controller.rb +62 -0
- data/app/controllers/inventorymaster/manufacturers_controller.rb +62 -0
- data/app/controllers/inventorymaster/products_controller.rb +68 -0
- data/app/controllers/inventorymaster/settings_controller.rb +62 -0
- data/app/controllers/inventorymaster/transaction_types_controller.rb +62 -0
- data/app/controllers/inventorymaster/transactions_controller.rb +86 -0
- data/app/helpers/inventorymaster/application_helper.rb +4 -0
- data/app/helpers/inventorymaster/areas_helper.rb +4 -0
- data/app/helpers/inventorymaster/locations_helper.rb +4 -0
- data/app/helpers/inventorymaster/manufacturers_helper.rb +4 -0
- data/app/helpers/inventorymaster/products_helper.rb +5 -0
- data/app/helpers/inventorymaster/settings_helper.rb +4 -0
- data/app/helpers/inventorymaster/transaction_types_helper.rb +4 -0
- data/app/helpers/inventorymaster/transactions_helper.rb +4 -0
- data/app/models/inventorymaster/area.rb +4 -0
- data/app/models/inventorymaster/location.rb +4 -0
- data/app/models/inventorymaster/manufacturer.rb +4 -0
- data/app/models/inventorymaster/product.rb +6 -0
- data/app/models/inventorymaster/setting.rb +4 -0
- data/app/models/inventorymaster/transaction.rb +5 -0
- data/app/models/inventorymaster/transaction_type.rb +4 -0
- data/app/views/inventorymaster/areas/_form.html.erb +21 -0
- data/app/views/inventorymaster/areas/edit.html.erb +6 -0
- data/app/views/inventorymaster/areas/index.html.erb +27 -0
- data/app/views/inventorymaster/areas/new.html.erb +5 -0
- data/app/views/inventorymaster/areas/show.html.erb +9 -0
- data/app/views/inventorymaster/locations/_form.html.erb +37 -0
- data/app/views/inventorymaster/locations/edit.html.erb +6 -0
- data/app/views/inventorymaster/locations/index.html.erb +35 -0
- data/app/views/inventorymaster/locations/new.html.erb +5 -0
- data/app/views/inventorymaster/locations/show.html.erb +29 -0
- data/app/views/inventorymaster/manufacturers/_form.html.erb +25 -0
- data/app/views/inventorymaster/manufacturers/edit.html.erb +6 -0
- data/app/views/inventorymaster/manufacturers/index.html.erb +29 -0
- data/app/views/inventorymaster/manufacturers/new.html.erb +5 -0
- data/app/views/inventorymaster/manufacturers/show.html.erb +14 -0
- data/app/views/inventorymaster/products/_transaction_fields.html.erb +52 -0
- data/app/views/inventorymaster/products/edit.html.erb +55 -0
- data/app/views/inventorymaster/products/index.html.erb +38 -0
- data/app/views/inventorymaster/products/new.html.erb +56 -0
- data/app/views/inventorymaster/products/show.html.erb +94 -0
- data/app/views/inventorymaster/settings/_form.html.erb +29 -0
- data/app/views/inventorymaster/settings/edit.html.erb +6 -0
- data/app/views/inventorymaster/settings/index.html.erb +19 -0
- data/app/views/inventorymaster/settings/new.html.erb +5 -0
- data/app/views/inventorymaster/settings/show.html.erb +19 -0
- data/app/views/inventorymaster/transaction_types/_form.html.erb +21 -0
- data/app/views/inventorymaster/transaction_types/edit.html.erb +6 -0
- data/app/views/inventorymaster/transaction_types/index.html.erb +27 -0
- data/app/views/inventorymaster/transaction_types/new.html.erb +5 -0
- data/app/views/inventorymaster/transaction_types/show.html.erb +9 -0
- data/app/views/inventorymaster/transactions/_form.html.erb +65 -0
- data/app/views/inventorymaster/transactions/edit.html.erb +6 -0
- data/app/views/inventorymaster/transactions/index.html.erb +51 -0
- data/app/views/inventorymaster/transactions/new.html.erb +5 -0
- data/app/views/inventorymaster/transactions/show.html.erb +69 -0
- data/app/views/layouts/inventorymaster/application.html.erb +14 -0
- data/config/routes.rb +16 -0
- data/db/migrate/20150502125839_create_inventorymaster_locations.rb +13 -0
- data/db/migrate/20150502133104_create_inventorymaster_areas.rb +9 -0
- data/db/migrate/20150502133153_create_inventorymaster_manufacturers.rb +10 -0
- data/db/migrate/20150502134515_create_inventorymaster_settings.rb +11 -0
- data/db/migrate/20150502140131_create_inventorymaster_products.rb +16 -0
- data/db/migrate/20150502140953_create_inventorymaster_transactions.rb +21 -0
- data/db/migrate/20150502141015_create_inventorymaster_transaction_types.rb +9 -0
- data/db/migrate/20150502141139_addproduct_to_transaction.rb +5 -0
- data/db/migrate/20150502144050_add_amount_to_product.rb +5 -0
- data/lib/inventorymaster/engine.rb +12 -0
- data/lib/inventorymaster/version.rb +3 -0
- data/lib/inventorymaster.rb +4 -0
- data/lib/tasks/inventorymaster_tasks.rake +4 -0
- data/test/controllers/inventorymaster/areas_controller_test.rb +51 -0
- data/test/controllers/inventorymaster/locations_controller_test.rb +51 -0
- data/test/controllers/inventorymaster/manufacturers_controller_test.rb +51 -0
- data/test/controllers/inventorymaster/products_controller_test.rb +51 -0
- data/test/controllers/inventorymaster/settings_controller_test.rb +51 -0
- data/test/controllers/inventorymaster/transaction_types_controller_test.rb +51 -0
- data/test/controllers/inventorymaster/transactions_controller_test.rb +51 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/fixtures/inventorymaster/areas.yml +7 -0
- data/test/fixtures/inventorymaster/locations.yml +15 -0
- data/test/fixtures/inventorymaster/manufacturers.yml +9 -0
- data/test/fixtures/inventorymaster/products.yml +21 -0
- data/test/fixtures/inventorymaster/settings.yml +11 -0
- data/test/fixtures/inventorymaster/transaction_types.yml +7 -0
- data/test/fixtures/inventorymaster/transactions.yml +31 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/inventorymaster_test.rb +7 -0
- data/test/models/inventorymaster/area_test.rb +9 -0
- data/test/models/inventorymaster/location_test.rb +9 -0
- data/test/models/inventorymaster/manufacturer_test.rb +9 -0
- data/test/models/inventorymaster/product_test.rb +9 -0
- data/test/models/inventorymaster/setting_test.rb +9 -0
- data/test/models/inventorymaster/transaction_test.rb +9 -0
- data/test/models/inventorymaster/transaction_type_test.rb +9 -0
- data/test/test_helper.rb +19 -0
- metadata +295 -0
@@ -0,0 +1,86 @@
|
|
1
|
+
require_dependency "inventorymaster/application_controller"
|
2
|
+
|
3
|
+
module Inventorymaster
|
4
|
+
class TransactionsController < ApplicationController
|
5
|
+
before_action :set_transaction, only: [:show, :edit, :update, :destroy]
|
6
|
+
|
7
|
+
# GET /transactions
|
8
|
+
def index
|
9
|
+
@transactions = Transaction.all
|
10
|
+
end
|
11
|
+
|
12
|
+
# GET /transactions/1
|
13
|
+
def show
|
14
|
+
end
|
15
|
+
|
16
|
+
# GET /transactions/new
|
17
|
+
def new
|
18
|
+
@transaction = Transaction.new
|
19
|
+
@products = Product.all
|
20
|
+
@locations = Location.all
|
21
|
+
@transactiontypes = TransactionType.all
|
22
|
+
@transaction.product_id = params[:product_id]
|
23
|
+
@transaction.kind = params[:kind]
|
24
|
+
end
|
25
|
+
|
26
|
+
# GET /transactions/1/edit
|
27
|
+
def edit
|
28
|
+
@products = Product.all
|
29
|
+
@locations = Location.all
|
30
|
+
@transactiontypes = TransactionType.all
|
31
|
+
end
|
32
|
+
|
33
|
+
# POST /transactions
|
34
|
+
def create
|
35
|
+
@transaction = Transaction.new(transaction_params)
|
36
|
+
@product = Product.find(@transaction.product_id)
|
37
|
+
|
38
|
+
if @transaction.kind =="Entrada" && @product.ammount!= nil
|
39
|
+
@product.ammount += @transaction.ammount
|
40
|
+
elsif @transaction.kind == "Saida" && @product.ammount!= nil
|
41
|
+
@product.ammount -= @transaction.ammount
|
42
|
+
elsif @transaction.kind =="Entrada" && @product.ammount == nil
|
43
|
+
@product.ammount = @transaction.ammount
|
44
|
+
elsif @transaction.kind == "Saida" && @product.ammount== nil
|
45
|
+
#@product.ammount =0
|
46
|
+
@product.ammount - @transaction.ammount
|
47
|
+
else
|
48
|
+
end
|
49
|
+
|
50
|
+
if @transaction.save && @product.save
|
51
|
+
redirect_to @product, notice: 'Transaction was successfully created.'
|
52
|
+
else
|
53
|
+
render :new
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# PATCH/PUT /transactions/1
|
58
|
+
def update
|
59
|
+
@products = Product.all
|
60
|
+
@locations = Location.all
|
61
|
+
@transactiontypes = TransactionType.all
|
62
|
+
if @transaction.update(transaction_params)
|
63
|
+
redirect_to @transaction, notice: 'Transaction was successfully updated.'
|
64
|
+
else
|
65
|
+
render :edit
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# DELETE /transactions/1
|
70
|
+
def destroy
|
71
|
+
@transaction.destroy
|
72
|
+
redirect_to transactions_url, notice: 'Transaction was successfully destroyed.'
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
# Use callbacks to share common setup or constraints between actions.
|
77
|
+
def set_transaction
|
78
|
+
@transaction = Transaction.find(params[:id])
|
79
|
+
end
|
80
|
+
|
81
|
+
# Only allow a trusted parameter "white list" through.
|
82
|
+
def transaction_params
|
83
|
+
params.require(:transaction).permit(:kind, :date, :location_id, :user_id, :upc, :unit_cost, :unit_sale, :ammount, :average_cost, :reason, :comment, :serial_number, :transaction_type_id,:product_id)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= form_for(@area) do |f| %>
|
2
|
+
<% if @area.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@area.errors.count, "error") %> prohibited this area from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @area.errors.full_messages.each do |message| %>
|
8
|
+
<li><%= message %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :name %><br>
|
16
|
+
<%= f.text_field :name %>
|
17
|
+
</div>
|
18
|
+
<div class="actions">
|
19
|
+
<%= f.submit %>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<h1>Listing Areas</h1>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th>Name</th>
|
9
|
+
<th colspan="3"></th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
|
13
|
+
<tbody>
|
14
|
+
<% @areas.each do |area| %>
|
15
|
+
<tr>
|
16
|
+
<td><%= area.name %></td>
|
17
|
+
<td><%= link_to 'Show', area %></td>
|
18
|
+
<td><%= link_to 'Edit', edit_area_path(area) %></td>
|
19
|
+
<td><%= link_to 'Destroy', area, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
20
|
+
</tr>
|
21
|
+
<% end %>
|
22
|
+
</tbody>
|
23
|
+
</table>
|
24
|
+
|
25
|
+
<br>
|
26
|
+
|
27
|
+
<%= link_to 'New Area', new_area_path %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<%= form_for(@location) do |f| %>
|
2
|
+
<% if @location.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@location.errors.count, "error") %> prohibited this location from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @location.errors.full_messages.each do |message| %>
|
8
|
+
<li><%= message %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :name %><br>
|
16
|
+
<%= f.text_field :name %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :street_adress %><br>
|
20
|
+
<%= f.text_field :street_adress %>
|
21
|
+
</div>
|
22
|
+
<div class="field">
|
23
|
+
<%= f.label :city %><br>
|
24
|
+
<%= f.text_field :city %>
|
25
|
+
</div>
|
26
|
+
<div class="field">
|
27
|
+
<%= f.label :state %><br>
|
28
|
+
<%= f.text_field :state %>
|
29
|
+
</div>
|
30
|
+
<div class="field">
|
31
|
+
<%= f.label :zip_code %><br>
|
32
|
+
<%= f.text_field :zip_code %>
|
33
|
+
</div>
|
34
|
+
<div class="actions">
|
35
|
+
<%= f.submit %>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<h1>Listing Locations</h1>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th>Name</th>
|
9
|
+
<th>Street adress</th>
|
10
|
+
<th>City</th>
|
11
|
+
<th>State</th>
|
12
|
+
<th>Zip code</th>
|
13
|
+
<th colspan="3"></th>
|
14
|
+
</tr>
|
15
|
+
</thead>
|
16
|
+
|
17
|
+
<tbody>
|
18
|
+
<% @locations.each do |location| %>
|
19
|
+
<tr>
|
20
|
+
<td><%= location.name %></td>
|
21
|
+
<td><%= location.street_adress %></td>
|
22
|
+
<td><%= location.city %></td>
|
23
|
+
<td><%= location.state %></td>
|
24
|
+
<td><%= location.zip_code %></td>
|
25
|
+
<td><%= link_to 'Show', location %></td>
|
26
|
+
<td><%= link_to 'Edit', edit_location_path(location) %></td>
|
27
|
+
<td><%= link_to 'Destroy', location, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
28
|
+
</tr>
|
29
|
+
<% end %>
|
30
|
+
</tbody>
|
31
|
+
</table>
|
32
|
+
|
33
|
+
<br>
|
34
|
+
|
35
|
+
<%= link_to 'New Location', new_location_path %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<strong>Name:</strong>
|
5
|
+
<%= @location.name %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<strong>Street adress:</strong>
|
10
|
+
<%= @location.street_adress %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<strong>City:</strong>
|
15
|
+
<%= @location.city %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
<p>
|
19
|
+
<strong>State:</strong>
|
20
|
+
<%= @location.state %>
|
21
|
+
</p>
|
22
|
+
|
23
|
+
<p>
|
24
|
+
<strong>Zip code:</strong>
|
25
|
+
<%= @location.zip_code %>
|
26
|
+
</p>
|
27
|
+
|
28
|
+
<%= link_to 'Edit', edit_location_path(@location) %> |
|
29
|
+
<%= link_to 'Back', locations_path %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= form_for(@manufacturer) do |f| %>
|
2
|
+
<% if @manufacturer.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@manufacturer.errors.count, "error") %> prohibited this manufacturer from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @manufacturer.errors.full_messages.each do |message| %>
|
8
|
+
<li><%= message %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :name %><br>
|
16
|
+
<%= f.text_field :name %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :cnpj %><br>
|
20
|
+
<%= f.text_field :cnpj %>
|
21
|
+
</div>
|
22
|
+
<div class="actions">
|
23
|
+
<%= f.submit %>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<h1>Listing Manufacturers</h1>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th>Name</th>
|
9
|
+
<th>Cnpj</th>
|
10
|
+
<th colspan="3"></th>
|
11
|
+
</tr>
|
12
|
+
</thead>
|
13
|
+
|
14
|
+
<tbody>
|
15
|
+
<% @manufacturers.each do |manufacturer| %>
|
16
|
+
<tr>
|
17
|
+
<td><%= manufacturer.name %></td>
|
18
|
+
<td><%= manufacturer.cnpj %></td>
|
19
|
+
<td><%= link_to 'Show', manufacturer %></td>
|
20
|
+
<td><%= link_to 'Edit', edit_manufacturer_path(manufacturer) %></td>
|
21
|
+
<td><%= link_to 'Destroy', manufacturer, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</tbody>
|
25
|
+
</table>
|
26
|
+
|
27
|
+
<br>
|
28
|
+
|
29
|
+
<%= link_to 'New Manufacturer', new_manufacturer_path %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<strong>Name:</strong>
|
5
|
+
<%= @manufacturer.name %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<strong>Cnpj:</strong>
|
10
|
+
<%= @manufacturer.cnpj %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<%= link_to 'Edit', edit_manufacturer_path(@manufacturer) %> |
|
14
|
+
<%= link_to 'Back', manufacturers_path %>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<%item.hidden_field :user_id,:value=>current_user.id%>
|
2
|
+
|
3
|
+
<div class="field">
|
4
|
+
<%= item.label :product_id ,"Produto"%><br>
|
5
|
+
<%= item.select :product_id , @products.collect { |c| [ c.name, c.id ] },:prompt => 'Selecione um Produto' %>
|
6
|
+
</div>
|
7
|
+
<div class="field">
|
8
|
+
<%= item.label :kind %><br>
|
9
|
+
<%= item.select :kind, options_for_select(["Selecione um", "Entrada", "Saida"],:disabled => ["Selecione um"]) %>
|
10
|
+
</div>
|
11
|
+
<div class="field">
|
12
|
+
<%= item.label :date %><br>
|
13
|
+
<%= item.date_select :date %>
|
14
|
+
</div>
|
15
|
+
<div class="field">
|
16
|
+
<%= item.label :location_id %><br>
|
17
|
+
<%= item.select :location_id , @locations.collect { |c| [ c.name, c.id ] },:prompt => 'Selecione um Produto' %>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="field">
|
21
|
+
<%= item.label :upc %><br>
|
22
|
+
<%= item.text_field :upc %>
|
23
|
+
</div>
|
24
|
+
<div class="field">
|
25
|
+
<%= item.label :unit_cost %><br>
|
26
|
+
<%= item.text_field :unit_cost %>
|
27
|
+
</div>
|
28
|
+
<div class="field">
|
29
|
+
<%= item.label :unit_sale %><br>
|
30
|
+
<%= item.text_field :unit_sale %>
|
31
|
+
</div>
|
32
|
+
<div class="field">
|
33
|
+
<%= item.label :ammount %><br>
|
34
|
+
<%= item.number_field :ammount %>
|
35
|
+
</div>
|
36
|
+
<div class="field">
|
37
|
+
<%= item.label :average_cost %><br>
|
38
|
+
<%= item.text_field :average_cost %>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div class="field">
|
42
|
+
<%= item.label :comment %><br>
|
43
|
+
<%= item.text_field :comment %>
|
44
|
+
</div>
|
45
|
+
<div class="field">
|
46
|
+
<%= item.label :serial_number %><br>
|
47
|
+
<%= item.text_field :serial_number %>
|
48
|
+
</div>
|
49
|
+
<div class="field">
|
50
|
+
<%= item.label :transaction_type_id %><br>
|
51
|
+
<%= item.select :transaction_type_id , @transactiontypes.collect { |c| [ c.name, c.id ] },:prompt => 'Selecione um tipo ' %>
|
52
|
+
</div>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<h1>Editing Product</h1>
|
2
|
+
|
3
|
+
<%= form_for(@product) do |f| %>
|
4
|
+
<% if @product.errors.any? %>
|
5
|
+
<div id="error_explanation">
|
6
|
+
<h2><%= pluralize(@product.errors.count, "error") %> prohibited this product from being saved:</h2>
|
7
|
+
|
8
|
+
<ul>
|
9
|
+
<% @product.errors.full_messages.each do |message| %>
|
10
|
+
<li><%= message %></li>
|
11
|
+
<% end %>
|
12
|
+
</ul>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<div class="field">
|
17
|
+
<%= f.label :name %><br>
|
18
|
+
<%= f.text_field :name %>
|
19
|
+
</div>
|
20
|
+
<div class="field">
|
21
|
+
<%= f.label :sku %><br>
|
22
|
+
<%= f.text_field :sku %>
|
23
|
+
</div>
|
24
|
+
<div class="field">
|
25
|
+
<%= f.label :upc %><br>
|
26
|
+
<%= f.text_field :upc %>
|
27
|
+
</div>
|
28
|
+
<div class="field">
|
29
|
+
<%= f.label :summary %><br>
|
30
|
+
<%= f.text_area :summary %>
|
31
|
+
</div>
|
32
|
+
<div class="field">
|
33
|
+
<%= f.label :labels %><br>
|
34
|
+
<%= f.text_field :labels %>
|
35
|
+
</div>
|
36
|
+
<div class="field">
|
37
|
+
<%= f.label :area_id %><br>
|
38
|
+
<%= f.number_field :area_id %>
|
39
|
+
</div>
|
40
|
+
<div class="field">
|
41
|
+
<%= f.label :manufacturer_id %><br>
|
42
|
+
<%= f.number_field :manufacturer_id %>
|
43
|
+
</div>
|
44
|
+
<div class="field">
|
45
|
+
<%= f.label :minimum_stock_count %><br>
|
46
|
+
<%= f.number_field :minimum_stock_count %>
|
47
|
+
</div>
|
48
|
+
<div class="actions">
|
49
|
+
<%= f.submit %>
|
50
|
+
</div>
|
51
|
+
<% end %>
|
52
|
+
|
53
|
+
|
54
|
+
<%= link_to 'Show', @product %> |
|
55
|
+
<%= link_to 'Back', products_path %>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<div class="page-header">
|
2
|
+
<h3><span class="glyphicon glyphicon-users"></span> Produtos</h3>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div align="right"><%= link_to 'Inserir Produto', new_product_path ,:class=>"btn btn-primary"%></div>
|
6
|
+
<br>
|
7
|
+
|
8
|
+
<table class="table table-condesed">
|
9
|
+
<thead>
|
10
|
+
<tr>
|
11
|
+
<th>Nome</th>
|
12
|
+
<th>SKU</th>
|
13
|
+
<th>UPC</th>
|
14
|
+
<th>Area</th>
|
15
|
+
<th>Fabricante</th>
|
16
|
+
<th>Estoque Minimo</th>
|
17
|
+
<th colspan="3"></th>
|
18
|
+
</tr>
|
19
|
+
</thead>
|
20
|
+
|
21
|
+
<tbody>
|
22
|
+
<% @products.each do |product| %>
|
23
|
+
<tr>
|
24
|
+
<td><%= product.name %></td>
|
25
|
+
<td><%= product.sku %></td>
|
26
|
+
<td><%= product.upc %></td>
|
27
|
+
<td><%= product.area_id %></td>
|
28
|
+
<td><%= product.manufacturer_id %></td>
|
29
|
+
<td><%= product.minimum_stock_count %></td>
|
30
|
+
<td><%= link_to 'Detalhar', product ,:class=>"btn btn-xs btn-default"%></td>
|
31
|
+
<td><%= link_to 'Editar', edit_product_path(product) ,:class=>"btn btn-xs btn-warning"%></td>
|
32
|
+
<td><%= link_to 'Deletar', product, method: :delete, data: { confirm: 'Voce tem Certeza?' },:class=>"btn btn-xs btn-danger" %></td>
|
33
|
+
</tr>
|
34
|
+
<% end %>
|
35
|
+
</tbody>
|
36
|
+
</table>
|
37
|
+
<br>
|
38
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<h1>New Product</h1>
|
2
|
+
|
3
|
+
<%= nested_form_for(@product) do |f| %>
|
4
|
+
<% if @product.errors.any? %>
|
5
|
+
<div id="error_explanation">
|
6
|
+
<h2><%= pluralize(@product.errors.count, "error") %> prohibited this product from being saved:</h2>
|
7
|
+
|
8
|
+
<ul>
|
9
|
+
<% @product.errors.full_messages.each do |message| %>
|
10
|
+
<li><%= message %></li>
|
11
|
+
<% end %>
|
12
|
+
</ul>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<div class="field">
|
17
|
+
<%= f.label :name %><br>
|
18
|
+
<%= f.text_field :name %>
|
19
|
+
</div>
|
20
|
+
<div class="field">
|
21
|
+
<%= f.label :sku %><br>
|
22
|
+
<%= f.text_field :sku %>
|
23
|
+
</div>
|
24
|
+
<div class="field">
|
25
|
+
<%= f.label :upc %><br>
|
26
|
+
<%= f.text_field :upc %>
|
27
|
+
</div>
|
28
|
+
<div class="field">
|
29
|
+
<%= f.label :summary %><br>
|
30
|
+
<%= f.text_area :summary %>
|
31
|
+
</div>
|
32
|
+
<div class="field">
|
33
|
+
<%= f.label :labels %><br>
|
34
|
+
<%= f.text_field :labels %>
|
35
|
+
</div>
|
36
|
+
<div class="field">
|
37
|
+
<%= f.label :area_id %><br>
|
38
|
+
<%= f.number_field :area_id %>
|
39
|
+
</div>
|
40
|
+
<div class="field">
|
41
|
+
<%= f.label :manufacturer_id %><br>
|
42
|
+
<%= f.number_field :manufacturer_id %>
|
43
|
+
</div>
|
44
|
+
<div class="field">
|
45
|
+
<%= f.label :minimum_stock_count %><br>
|
46
|
+
<%= f.number_field :minimum_stock_count %>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
|
50
|
+
<div class="actions">
|
51
|
+
<%= f.submit %>
|
52
|
+
</div>
|
53
|
+
<% end %>
|
54
|
+
|
55
|
+
|
56
|
+
<%= link_to 'Back', products_path %>
|