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.
Files changed (153) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +37 -0
  5. data/app/assets/javascripts/inventorymaster/application.js +14 -0
  6. data/app/assets/javascripts/inventorymaster/areas.js +2 -0
  7. data/app/assets/javascripts/inventorymaster/locations.js +2 -0
  8. data/app/assets/javascripts/inventorymaster/manufacturers.js +2 -0
  9. data/app/assets/javascripts/inventorymaster/products.js +2 -0
  10. data/app/assets/javascripts/inventorymaster/settings.js +2 -0
  11. data/app/assets/javascripts/inventorymaster/transaction_types.js +2 -0
  12. data/app/assets/javascripts/inventorymaster/transactions.js +2 -0
  13. data/app/assets/stylesheets/inventorymaster/application.css +15 -0
  14. data/app/assets/stylesheets/inventorymaster/areas.css +4 -0
  15. data/app/assets/stylesheets/inventorymaster/locations.css +4 -0
  16. data/app/assets/stylesheets/inventorymaster/manufacturers.css +4 -0
  17. data/app/assets/stylesheets/inventorymaster/products.css +4 -0
  18. data/app/assets/stylesheets/inventorymaster/settings.css +4 -0
  19. data/app/assets/stylesheets/inventorymaster/transaction_types.css +4 -0
  20. data/app/assets/stylesheets/inventorymaster/transactions.css +4 -0
  21. data/app/assets/stylesheets/scaffold.css +56 -0
  22. data/app/controllers/inventorymaster/application_controller.rb +5 -0
  23. data/app/controllers/inventorymaster/areas_controller.rb +62 -0
  24. data/app/controllers/inventorymaster/locations_controller.rb +62 -0
  25. data/app/controllers/inventorymaster/manufacturers_controller.rb +62 -0
  26. data/app/controllers/inventorymaster/products_controller.rb +68 -0
  27. data/app/controllers/inventorymaster/settings_controller.rb +62 -0
  28. data/app/controllers/inventorymaster/transaction_types_controller.rb +62 -0
  29. data/app/controllers/inventorymaster/transactions_controller.rb +86 -0
  30. data/app/helpers/inventorymaster/application_helper.rb +4 -0
  31. data/app/helpers/inventorymaster/areas_helper.rb +4 -0
  32. data/app/helpers/inventorymaster/locations_helper.rb +4 -0
  33. data/app/helpers/inventorymaster/manufacturers_helper.rb +4 -0
  34. data/app/helpers/inventorymaster/products_helper.rb +5 -0
  35. data/app/helpers/inventorymaster/settings_helper.rb +4 -0
  36. data/app/helpers/inventorymaster/transaction_types_helper.rb +4 -0
  37. data/app/helpers/inventorymaster/transactions_helper.rb +4 -0
  38. data/app/models/inventorymaster/area.rb +4 -0
  39. data/app/models/inventorymaster/location.rb +4 -0
  40. data/app/models/inventorymaster/manufacturer.rb +4 -0
  41. data/app/models/inventorymaster/product.rb +6 -0
  42. data/app/models/inventorymaster/setting.rb +4 -0
  43. data/app/models/inventorymaster/transaction.rb +5 -0
  44. data/app/models/inventorymaster/transaction_type.rb +4 -0
  45. data/app/views/inventorymaster/areas/_form.html.erb +21 -0
  46. data/app/views/inventorymaster/areas/edit.html.erb +6 -0
  47. data/app/views/inventorymaster/areas/index.html.erb +27 -0
  48. data/app/views/inventorymaster/areas/new.html.erb +5 -0
  49. data/app/views/inventorymaster/areas/show.html.erb +9 -0
  50. data/app/views/inventorymaster/locations/_form.html.erb +37 -0
  51. data/app/views/inventorymaster/locations/edit.html.erb +6 -0
  52. data/app/views/inventorymaster/locations/index.html.erb +35 -0
  53. data/app/views/inventorymaster/locations/new.html.erb +5 -0
  54. data/app/views/inventorymaster/locations/show.html.erb +29 -0
  55. data/app/views/inventorymaster/manufacturers/_form.html.erb +25 -0
  56. data/app/views/inventorymaster/manufacturers/edit.html.erb +6 -0
  57. data/app/views/inventorymaster/manufacturers/index.html.erb +29 -0
  58. data/app/views/inventorymaster/manufacturers/new.html.erb +5 -0
  59. data/app/views/inventorymaster/manufacturers/show.html.erb +14 -0
  60. data/app/views/inventorymaster/products/_transaction_fields.html.erb +52 -0
  61. data/app/views/inventorymaster/products/edit.html.erb +55 -0
  62. data/app/views/inventorymaster/products/index.html.erb +38 -0
  63. data/app/views/inventorymaster/products/new.html.erb +56 -0
  64. data/app/views/inventorymaster/products/show.html.erb +94 -0
  65. data/app/views/inventorymaster/settings/_form.html.erb +29 -0
  66. data/app/views/inventorymaster/settings/edit.html.erb +6 -0
  67. data/app/views/inventorymaster/settings/index.html.erb +19 -0
  68. data/app/views/inventorymaster/settings/new.html.erb +5 -0
  69. data/app/views/inventorymaster/settings/show.html.erb +19 -0
  70. data/app/views/inventorymaster/transaction_types/_form.html.erb +21 -0
  71. data/app/views/inventorymaster/transaction_types/edit.html.erb +6 -0
  72. data/app/views/inventorymaster/transaction_types/index.html.erb +27 -0
  73. data/app/views/inventorymaster/transaction_types/new.html.erb +5 -0
  74. data/app/views/inventorymaster/transaction_types/show.html.erb +9 -0
  75. data/app/views/inventorymaster/transactions/_form.html.erb +65 -0
  76. data/app/views/inventorymaster/transactions/edit.html.erb +6 -0
  77. data/app/views/inventorymaster/transactions/index.html.erb +51 -0
  78. data/app/views/inventorymaster/transactions/new.html.erb +5 -0
  79. data/app/views/inventorymaster/transactions/show.html.erb +69 -0
  80. data/app/views/layouts/inventorymaster/application.html.erb +14 -0
  81. data/config/routes.rb +16 -0
  82. data/db/migrate/20150502125839_create_inventorymaster_locations.rb +13 -0
  83. data/db/migrate/20150502133104_create_inventorymaster_areas.rb +9 -0
  84. data/db/migrate/20150502133153_create_inventorymaster_manufacturers.rb +10 -0
  85. data/db/migrate/20150502134515_create_inventorymaster_settings.rb +11 -0
  86. data/db/migrate/20150502140131_create_inventorymaster_products.rb +16 -0
  87. data/db/migrate/20150502140953_create_inventorymaster_transactions.rb +21 -0
  88. data/db/migrate/20150502141015_create_inventorymaster_transaction_types.rb +9 -0
  89. data/db/migrate/20150502141139_addproduct_to_transaction.rb +5 -0
  90. data/db/migrate/20150502144050_add_amount_to_product.rb +5 -0
  91. data/lib/inventorymaster/engine.rb +12 -0
  92. data/lib/inventorymaster/version.rb +3 -0
  93. data/lib/inventorymaster.rb +4 -0
  94. data/lib/tasks/inventorymaster_tasks.rake +4 -0
  95. data/test/controllers/inventorymaster/areas_controller_test.rb +51 -0
  96. data/test/controllers/inventorymaster/locations_controller_test.rb +51 -0
  97. data/test/controllers/inventorymaster/manufacturers_controller_test.rb +51 -0
  98. data/test/controllers/inventorymaster/products_controller_test.rb +51 -0
  99. data/test/controllers/inventorymaster/settings_controller_test.rb +51 -0
  100. data/test/controllers/inventorymaster/transaction_types_controller_test.rb +51 -0
  101. data/test/controllers/inventorymaster/transactions_controller_test.rb +51 -0
  102. data/test/dummy/README.rdoc +28 -0
  103. data/test/dummy/Rakefile +6 -0
  104. data/test/dummy/app/assets/javascripts/application.js +13 -0
  105. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  106. data/test/dummy/app/controllers/application_controller.rb +5 -0
  107. data/test/dummy/app/helpers/application_helper.rb +2 -0
  108. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  109. data/test/dummy/bin/bundle +3 -0
  110. data/test/dummy/bin/rails +4 -0
  111. data/test/dummy/bin/rake +4 -0
  112. data/test/dummy/bin/setup +29 -0
  113. data/test/dummy/config/application.rb +26 -0
  114. data/test/dummy/config/boot.rb +5 -0
  115. data/test/dummy/config/database.yml +25 -0
  116. data/test/dummy/config/environment.rb +5 -0
  117. data/test/dummy/config/environments/development.rb +41 -0
  118. data/test/dummy/config/environments/production.rb +79 -0
  119. data/test/dummy/config/environments/test.rb +42 -0
  120. data/test/dummy/config/initializers/assets.rb +11 -0
  121. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  122. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  123. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  124. data/test/dummy/config/initializers/inflections.rb +16 -0
  125. data/test/dummy/config/initializers/mime_types.rb +4 -0
  126. data/test/dummy/config/initializers/session_store.rb +3 -0
  127. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  128. data/test/dummy/config/locales/en.yml +23 -0
  129. data/test/dummy/config/routes.rb +4 -0
  130. data/test/dummy/config/secrets.yml +22 -0
  131. data/test/dummy/config.ru +4 -0
  132. data/test/dummy/public/404.html +67 -0
  133. data/test/dummy/public/422.html +67 -0
  134. data/test/dummy/public/500.html +66 -0
  135. data/test/dummy/public/favicon.ico +0 -0
  136. data/test/fixtures/inventorymaster/areas.yml +7 -0
  137. data/test/fixtures/inventorymaster/locations.yml +15 -0
  138. data/test/fixtures/inventorymaster/manufacturers.yml +9 -0
  139. data/test/fixtures/inventorymaster/products.yml +21 -0
  140. data/test/fixtures/inventorymaster/settings.yml +11 -0
  141. data/test/fixtures/inventorymaster/transaction_types.yml +7 -0
  142. data/test/fixtures/inventorymaster/transactions.yml +31 -0
  143. data/test/integration/navigation_test.rb +10 -0
  144. data/test/inventorymaster_test.rb +7 -0
  145. data/test/models/inventorymaster/area_test.rb +9 -0
  146. data/test/models/inventorymaster/location_test.rb +9 -0
  147. data/test/models/inventorymaster/manufacturer_test.rb +9 -0
  148. data/test/models/inventorymaster/product_test.rb +9 -0
  149. data/test/models/inventorymaster/setting_test.rb +9 -0
  150. data/test/models/inventorymaster/transaction_test.rb +9 -0
  151. data/test/models/inventorymaster/transaction_type_test.rb +9 -0
  152. data/test/test_helper.rb +19 -0
  153. metadata +295 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c08baa06dd7ae6f7d9ef110c71bea3b7c056721d
4
+ data.tar.gz: b0118198395f9d383c218a69a1af3f072b5677db
5
+ SHA512:
6
+ metadata.gz: 9475080feb1672870d2b52f88cb8f7001729003c5c79d7997800a574aa6e6cc8e3d8a966dcc93e80ac01907bb610e607e85e742c69344149f79a3c0156ea264c
7
+ data.tar.gz: c3605029322249f49b639086f0cd36e78e5ef9a7472784f8878ab69b24276d261942ab549d9869ef7def32e87f9e66be18e34e2c9a24880f60d26e7b14996185
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2015 jcottobboni
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = Inventorymaster
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Inventorymaster'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'lib'
31
+ t.libs << 'test'
32
+ t.pattern = 'test/**/*_test.rb'
33
+ t.verbose = false
34
+ end
35
+
36
+
37
+ task default: :test
@@ -0,0 +1,14 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
14
+ //= require jquery_nested_form
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -0,0 +1,5 @@
1
+ module Inventorymaster
2
+ class ApplicationController < ::ApplicationController
3
+ layout 'layouts/application'
4
+ end
5
+ end
@@ -0,0 +1,62 @@
1
+ require_dependency "inventorymaster/application_controller"
2
+
3
+ module Inventorymaster
4
+ class AreasController < ApplicationController
5
+ before_action :set_area, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /areas
8
+ def index
9
+ @areas = Area.all
10
+ end
11
+
12
+ # GET /areas/1
13
+ def show
14
+ end
15
+
16
+ # GET /areas/new
17
+ def new
18
+ @area = Area.new
19
+ end
20
+
21
+ # GET /areas/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /areas
26
+ def create
27
+ @area = Area.new(area_params)
28
+
29
+ if @area.save
30
+ redirect_to @area, notice: 'Area was successfully created.'
31
+ else
32
+ render :new
33
+ end
34
+ end
35
+
36
+ # PATCH/PUT /areas/1
37
+ def update
38
+ if @area.update(area_params)
39
+ redirect_to @area, notice: 'Area was successfully updated.'
40
+ else
41
+ render :edit
42
+ end
43
+ end
44
+
45
+ # DELETE /areas/1
46
+ def destroy
47
+ @area.destroy
48
+ redirect_to areas_url, notice: 'Area was successfully destroyed.'
49
+ end
50
+
51
+ private
52
+ # Use callbacks to share common setup or constraints between actions.
53
+ def set_area
54
+ @area = Area.find(params[:id])
55
+ end
56
+
57
+ # Only allow a trusted parameter "white list" through.
58
+ def area_params
59
+ params.require(:area).permit(:name)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,62 @@
1
+ require_dependency "inventorymaster/application_controller"
2
+
3
+ module Inventorymaster
4
+ class LocationsController < ApplicationController
5
+ before_action :set_location, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /locations
8
+ def index
9
+ @locations = Location.all
10
+ end
11
+
12
+ # GET /locations/1
13
+ def show
14
+ end
15
+
16
+ # GET /locations/new
17
+ def new
18
+ @location = Location.new
19
+ end
20
+
21
+ # GET /locations/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /locations
26
+ def create
27
+ @location = Location.new(location_params)
28
+
29
+ if @location.save
30
+ redirect_to @location, notice: 'Location was successfully created.'
31
+ else
32
+ render :new
33
+ end
34
+ end
35
+
36
+ # PATCH/PUT /locations/1
37
+ def update
38
+ if @location.update(location_params)
39
+ redirect_to @location, notice: 'Location was successfully updated.'
40
+ else
41
+ render :edit
42
+ end
43
+ end
44
+
45
+ # DELETE /locations/1
46
+ def destroy
47
+ @location.destroy
48
+ redirect_to locations_url, notice: 'Location was successfully destroyed.'
49
+ end
50
+
51
+ private
52
+ # Use callbacks to share common setup or constraints between actions.
53
+ def set_location
54
+ @location = Location.find(params[:id])
55
+ end
56
+
57
+ # Only allow a trusted parameter "white list" through.
58
+ def location_params
59
+ params.require(:location).permit(:name, :street_adress, :city, :state, :zip_code)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,62 @@
1
+ require_dependency "inventorymaster/application_controller"
2
+
3
+ module Inventorymaster
4
+ class ManufacturersController < ApplicationController
5
+ before_action :set_manufacturer, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /manufacturers
8
+ def index
9
+ @manufacturers = Manufacturer.all
10
+ end
11
+
12
+ # GET /manufacturers/1
13
+ def show
14
+ end
15
+
16
+ # GET /manufacturers/new
17
+ def new
18
+ @manufacturer = Manufacturer.new
19
+ end
20
+
21
+ # GET /manufacturers/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /manufacturers
26
+ def create
27
+ @manufacturer = Manufacturer.new(manufacturer_params)
28
+
29
+ if @manufacturer.save
30
+ redirect_to @manufacturer, notice: 'Manufacturer was successfully created.'
31
+ else
32
+ render :new
33
+ end
34
+ end
35
+
36
+ # PATCH/PUT /manufacturers/1
37
+ def update
38
+ if @manufacturer.update(manufacturer_params)
39
+ redirect_to @manufacturer, notice: 'Manufacturer was successfully updated.'
40
+ else
41
+ render :edit
42
+ end
43
+ end
44
+
45
+ # DELETE /manufacturers/1
46
+ def destroy
47
+ @manufacturer.destroy
48
+ redirect_to manufacturers_url, notice: 'Manufacturer was successfully destroyed.'
49
+ end
50
+
51
+ private
52
+ # Use callbacks to share common setup or constraints between actions.
53
+ def set_manufacturer
54
+ @manufacturer = Manufacturer.find(params[:id])
55
+ end
56
+
57
+ # Only allow a trusted parameter "white list" through.
58
+ def manufacturer_params
59
+ params.require(:manufacturer).permit(:name, :cnpj)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,68 @@
1
+ require_dependency "inventorymaster/application_controller"
2
+
3
+ module Inventorymaster
4
+ class ProductsController < ApplicationController
5
+ before_action :set_product, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /products
8
+ def index
9
+ @products = Product.all
10
+ end
11
+
12
+ # GET /products/1
13
+ def show
14
+ end
15
+
16
+ # GET /products/new
17
+ def new
18
+ @product = Product.new
19
+ @products = Product.all
20
+ @locations = Location.all
21
+ @transactiontypes = TransactionType.all
22
+ #@product.transaction.build
23
+
24
+ end
25
+
26
+ # GET /products/1/edit
27
+ def edit
28
+ end
29
+
30
+ # POST /products
31
+ def create
32
+ @product = Product.new(product_params)
33
+ @product.ammount = 0
34
+
35
+ if @product.save
36
+ redirect_to @product, notice: 'Product was successfully created.'
37
+ else
38
+ render :new
39
+ end
40
+ end
41
+
42
+ # PATCH/PUT /products/1
43
+ def update
44
+ if @product.update(product_params)
45
+ redirect_to @product, notice: 'Product was successfully updated.'
46
+ else
47
+ render :edit
48
+ end
49
+ end
50
+
51
+ # DELETE /products/1
52
+ def destroy
53
+ @product.destroy
54
+ redirect_to products_url, notice: 'Product was successfully destroyed.'
55
+ end
56
+
57
+ private
58
+ # Use callbacks to share common setup or constraints between actions.
59
+ def set_product
60
+ @product = Product.find(params[:id])
61
+ end
62
+
63
+ # Only allow a trusted parameter "white list" through.
64
+ def product_params
65
+ params.require(:product).permit(:name, :sku, :upc, :summary, :labels, :area_id, :manufacturer_id, :minimum_stock_count,:transactions_attributes=>[:id,:kind, :date, :location_id, :user_id, :upc, :unit_cost, :unit_sale, :ammount, :average_cost, :reason, :comment, :serial_number, :transaction_type_id,:product_id])
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,62 @@
1
+ require_dependency "inventorymaster/application_controller"
2
+
3
+ module Inventorymaster
4
+ class SettingsController < ApplicationController
5
+ before_action :set_setting, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /settings
8
+ def index
9
+ @setting = Setting.find(1)
10
+ end
11
+
12
+ # GET /settings/1
13
+ def show
14
+ end
15
+
16
+ # GET /settings/new
17
+ def new
18
+ @setting = Setting.new
19
+ end
20
+
21
+ # GET /settings/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /settings
26
+ def create
27
+ @setting = Setting.new(setting_params)
28
+
29
+ if @setting.save
30
+ redirect_to @setting, notice: 'Setting was successfully created.'
31
+ else
32
+ render :new
33
+ end
34
+ end
35
+
36
+ # PATCH/PUT /settings/1
37
+ def update
38
+ if @setting.update(setting_params)
39
+ redirect_to @setting, notice: 'Setting was successfully updated.'
40
+ else
41
+ render :edit
42
+ end
43
+ end
44
+
45
+ # DELETE /settings/1
46
+ def destroy
47
+ @setting.destroy
48
+ redirect_to settings_url, notice: 'Setting was successfully destroyed.'
49
+ end
50
+
51
+ private
52
+ # Use callbacks to share common setup or constraints between actions.
53
+ def set_setting
54
+ @setting = Setting.find(params[:id])
55
+ end
56
+
57
+ # Only allow a trusted parameter "white list" through.
58
+ def setting_params
59
+ params.require(:setting).permit(:stok_alerts, :minimum_stock_count, :currency)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,62 @@
1
+ require_dependency "inventorymaster/application_controller"
2
+
3
+ module Inventorymaster
4
+ class TransactionTypesController < ApplicationController
5
+ before_action :set_transaction_type, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /transaction_types
8
+ def index
9
+ @transaction_types = TransactionType.all
10
+ end
11
+
12
+ # GET /transaction_types/1
13
+ def show
14
+ end
15
+
16
+ # GET /transaction_types/new
17
+ def new
18
+ @transaction_type = TransactionType.new
19
+ end
20
+
21
+ # GET /transaction_types/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /transaction_types
26
+ def create
27
+ @transaction_type = TransactionType.new(transaction_type_params)
28
+
29
+ if @transaction_type.save
30
+ redirect_to @transaction_type, notice: 'Transaction type was successfully created.'
31
+ else
32
+ render :new
33
+ end
34
+ end
35
+
36
+ # PATCH/PUT /transaction_types/1
37
+ def update
38
+ if @transaction_type.update(transaction_type_params)
39
+ redirect_to @transaction_type, notice: 'Transaction type was successfully updated.'
40
+ else
41
+ render :edit
42
+ end
43
+ end
44
+
45
+ # DELETE /transaction_types/1
46
+ def destroy
47
+ @transaction_type.destroy
48
+ redirect_to transaction_types_url, notice: 'Transaction type was successfully destroyed.'
49
+ end
50
+
51
+ private
52
+ # Use callbacks to share common setup or constraints between actions.
53
+ def set_transaction_type
54
+ @transaction_type = TransactionType.find(params[:id])
55
+ end
56
+
57
+ # Only allow a trusted parameter "white list" through.
58
+ def transaction_type_params
59
+ params.require(:transaction_type).permit(:name)
60
+ end
61
+ end
62
+ end