diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000000..5008ddfcf5
Binary files /dev/null and b/.DS_Store differ
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..70c99c9403
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,30 @@
+# See https://help.github.com/articles/ignoring-files for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile '~/.gitignore_global'
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore all logfiles and tempfiles.
+/log/*
+/tmp/*
+!/log/.keep
+!/tmp/.keep
+
+# Ignore uploaded files in development
+/storage/*
+!/storage/.keep
+
+/node_modules
+/yarn-error.log
+
+/public/assets
+.byebug_history
+
+# Ignore master key for decrypting credentials and more.
+/config/master.key
+
+.env
+coverage
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000000..f7a91deda4
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,90 @@
+source 'https://rubygems.org'
+git_source(:github) { |repo| "https://github.com/#{repo}.git" }
+
+# ruby '2.5.1'
+# ruby '2.4.1'
+
+gem 'simplecov', require: false, group: :test
+
+
+
+# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
+gem 'rails', '~> 5.2.1'
+# Use postgresql as the database for Active Record
+gem 'pg', '>= 0.18', '< 2.0'
+# Use Puma as the app server
+gem 'puma', '~> 3.11'
+# Use SCSS for stylesheets
+gem 'sass-rails', '~> 5.0'
+# Use Uglifier as compressor for JavaScript assets
+gem 'uglifier', '>= 1.3.0'
+# See https://github.com/rails/execjs#readme for more supported runtimes
+# gem 'mini_racer', platforms: :ruby
+# Use CoffeeScript for .coffee assets and views
+# gem 'coffee-rails', '~> 4.2'
+# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
+gem 'turbolinks', '~> 5'
+# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
+gem 'jbuilder', '~> 2.5'
+# Use Redis adapter to run Action Cable in production
+# gem 'redis', '~> 4.0'
+# Use ActiveModel has_secure_password
+# gem 'bcrypt', '~> 3.1.7'
+
+# Use ActiveStorage variant
+# gem 'mini_magick', '~> 4.8'
+
+# Use Capistrano for deployment
+# gem 'capistrano-rails', group: :development
+
+# Reduces boot times through caching; required in config/boot.rb
+gem 'bootsnap', '>= 1.1.0', require: false
+
+gem "omniauth"
+gem "omniauth-github"
+
+group :development, :test do
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
+end
+
+group :development do
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
+ gem 'web-console', '>= 3.3.0'
+ gem 'listen', '>= 3.0.5', '< 3.2'
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
+ gem 'spring'
+ gem 'spring-watcher-listen', '~> 2.0.0'
+
+ gem 'dotenv-rails'
+end
+
+group :test do
+ # Adds support for Capybara system testing and selenium driver
+ gem 'capybara', '>= 2.15'
+ gem 'selenium-webdriver'
+ # Easy installation and use of chromedriver to run system tests with Chrome
+ gem 'chromedriver-helper'
+end
+
+# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
+gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
+
+gem 'jquery-rails'
+gem 'jquery-turbolinks'
+gem 'bootstrap', '~> 4.1.3'
+group :development, :test do
+ gem 'pry-rails'
+end
+
+group :development do
+ gem 'better_errors'
+ gem 'binding_of_caller'
+ gem 'guard'
+ gem 'guard-minitest'
+end
+
+group :test do
+ gem 'minitest-rails'
+ gem 'minitest-reporters'
+end
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 0000000000..0db682d77e
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,310 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actioncable (5.2.1)
+ actionpack (= 5.2.1)
+ nio4r (~> 2.0)
+ websocket-driver (>= 0.6.1)
+ actionmailer (5.2.1)
+ actionpack (= 5.2.1)
+ actionview (= 5.2.1)
+ activejob (= 5.2.1)
+ mail (~> 2.5, >= 2.5.4)
+ rails-dom-testing (~> 2.0)
+ actionpack (5.2.1)
+ actionview (= 5.2.1)
+ activesupport (= 5.2.1)
+ rack (~> 2.0)
+ rack-test (>= 0.6.3)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ actionview (5.2.1)
+ activesupport (= 5.2.1)
+ builder (~> 3.1)
+ erubi (~> 1.4)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
+ activejob (5.2.1)
+ activesupport (= 5.2.1)
+ globalid (>= 0.3.6)
+ activemodel (5.2.1)
+ activesupport (= 5.2.1)
+ activerecord (5.2.1)
+ activemodel (= 5.2.1)
+ activesupport (= 5.2.1)
+ arel (>= 9.0)
+ activestorage (5.2.1)
+ actionpack (= 5.2.1)
+ activerecord (= 5.2.1)
+ marcel (~> 0.3.1)
+ activesupport (5.2.1)
+ concurrent-ruby (~> 1.0, >= 1.0.2)
+ i18n (>= 0.7, < 2)
+ minitest (~> 5.1)
+ tzinfo (~> 1.1)
+ addressable (2.5.2)
+ public_suffix (>= 2.0.2, < 4.0)
+ ansi (1.5.0)
+ archive-zip (0.11.0)
+ io-like (~> 0.3.0)
+ arel (9.0.0)
+ autoprefixer-rails (9.2.1)
+ execjs
+ better_errors (2.5.0)
+ coderay (>= 1.0.0)
+ erubi (>= 1.0.0)
+ rack (>= 0.9.0)
+ bindex (0.5.0)
+ binding_of_caller (0.8.0)
+ debug_inspector (>= 0.0.1)
+ bootsnap (1.3.2)
+ msgpack (~> 1.0)
+ bootstrap (4.1.3)
+ autoprefixer-rails (>= 6.0.3)
+ popper_js (>= 1.12.9, < 2)
+ sass (>= 3.5.2)
+ builder (3.2.3)
+ byebug (10.0.2)
+ capybara (3.9.0)
+ addressable
+ mini_mime (>= 0.1.3)
+ nokogiri (~> 1.8)
+ rack (>= 1.6.0)
+ rack-test (>= 0.6.3)
+ xpath (~> 3.1)
+ childprocess (0.9.0)
+ ffi (~> 1.0, >= 1.0.11)
+ chromedriver-helper (2.1.0)
+ archive-zip (~> 0.10)
+ nokogiri (~> 1.8)
+ coderay (1.1.2)
+ concurrent-ruby (1.0.5)
+ crass (1.0.4)
+ debug_inspector (0.0.3)
+ docile (1.3.1)
+ dotenv (2.5.0)
+ dotenv-rails (2.5.0)
+ dotenv (= 2.5.0)
+ railties (>= 3.2, < 6.0)
+ erubi (1.7.1)
+ execjs (2.7.0)
+ faraday (0.15.3)
+ multipart-post (>= 1.2, < 3)
+ ffi (1.9.25)
+ formatador (0.2.5)
+ globalid (0.4.1)
+ activesupport (>= 4.2.0)
+ guard (2.14.2)
+ formatador (>= 0.2.4)
+ listen (>= 2.7, < 4.0)
+ lumberjack (>= 1.0.12, < 2.0)
+ nenv (~> 0.1)
+ notiffany (~> 0.0)
+ pry (>= 0.9.12)
+ shellany (~> 0.0)
+ thor (>= 0.18.1)
+ guard-compat (1.2.1)
+ guard-minitest (2.4.6)
+ guard-compat (~> 1.2)
+ minitest (>= 3.0)
+ hashie (3.5.7)
+ i18n (1.1.1)
+ concurrent-ruby (~> 1.0)
+ io-like (0.3.0)
+ jbuilder (2.7.0)
+ activesupport (>= 4.2.0)
+ multi_json (>= 1.2)
+ jquery-rails (4.3.3)
+ rails-dom-testing (>= 1, < 3)
+ railties (>= 4.2.0)
+ thor (>= 0.14, < 2.0)
+ jquery-turbolinks (2.1.0)
+ railties (>= 3.1.0)
+ turbolinks
+ json (2.1.0)
+ jwt (2.1.0)
+ listen (3.1.5)
+ rb-fsevent (~> 0.9, >= 0.9.4)
+ rb-inotify (~> 0.9, >= 0.9.7)
+ ruby_dep (~> 1.2)
+ loofah (2.2.2)
+ crass (~> 1.0.2)
+ nokogiri (>= 1.5.9)
+ lumberjack (1.0.13)
+ mail (2.7.1)
+ mini_mime (>= 0.1.1)
+ marcel (0.3.3)
+ mimemagic (~> 0.3.2)
+ method_source (0.9.0)
+ mimemagic (0.3.2)
+ mini_mime (1.0.1)
+ mini_portile2 (2.3.0)
+ minitest (5.11.3)
+ minitest-rails (3.0.0)
+ minitest (~> 5.8)
+ railties (~> 5.0)
+ minitest-reporters (1.3.5)
+ ansi
+ builder
+ minitest (>= 5.0)
+ ruby-progressbar
+ msgpack (1.2.4)
+ multi_json (1.13.1)
+ multi_xml (0.6.0)
+ multipart-post (2.0.0)
+ nenv (0.3.0)
+ nio4r (2.3.1)
+ nokogiri (1.8.5)
+ mini_portile2 (~> 2.3.0)
+ notiffany (0.1.1)
+ nenv (~> 0.1)
+ shellany (~> 0.0)
+ oauth2 (1.4.1)
+ faraday (>= 0.8, < 0.16.0)
+ jwt (>= 1.0, < 3.0)
+ multi_json (~> 1.3)
+ multi_xml (~> 0.5)
+ rack (>= 1.2, < 3)
+ omniauth (1.8.1)
+ hashie (>= 3.4.6, < 3.6.0)
+ rack (>= 1.6.2, < 3)
+ omniauth-github (1.3.0)
+ omniauth (~> 1.5)
+ omniauth-oauth2 (>= 1.4.0, < 2.0)
+ omniauth-oauth2 (1.5.0)
+ oauth2 (~> 1.1)
+ omniauth (~> 1.2)
+ pg (1.1.3)
+ popper_js (1.14.3)
+ pry (0.11.3)
+ coderay (~> 1.1.0)
+ method_source (~> 0.9.0)
+ pry-rails (0.3.6)
+ pry (>= 0.10.4)
+ public_suffix (3.0.3)
+ puma (3.12.0)
+ rack (2.0.5)
+ rack-test (1.1.0)
+ rack (>= 1.0, < 3)
+ rails (5.2.1)
+ actioncable (= 5.2.1)
+ actionmailer (= 5.2.1)
+ actionpack (= 5.2.1)
+ actionview (= 5.2.1)
+ activejob (= 5.2.1)
+ activemodel (= 5.2.1)
+ activerecord (= 5.2.1)
+ activestorage (= 5.2.1)
+ activesupport (= 5.2.1)
+ bundler (>= 1.3.0)
+ railties (= 5.2.1)
+ sprockets-rails (>= 2.0.0)
+ rails-dom-testing (2.0.3)
+ activesupport (>= 4.2.0)
+ nokogiri (>= 1.6)
+ rails-html-sanitizer (1.0.4)
+ loofah (~> 2.2, >= 2.2.2)
+ railties (5.2.1)
+ actionpack (= 5.2.1)
+ activesupport (= 5.2.1)
+ method_source
+ rake (>= 0.8.7)
+ thor (>= 0.19.0, < 2.0)
+ rake (12.3.1)
+ rb-fsevent (0.10.3)
+ rb-inotify (0.9.10)
+ ffi (>= 0.5.0, < 2)
+ ruby-progressbar (1.10.0)
+ ruby_dep (1.5.0)
+ rubyzip (1.2.2)
+ sass (3.6.0)
+ sass-listen (~> 4.0.0)
+ sass-listen (4.0.0)
+ rb-fsevent (~> 0.9, >= 0.9.4)
+ rb-inotify (~> 0.9, >= 0.9.7)
+ sass-rails (5.0.7)
+ railties (>= 4.0.0, < 6)
+ sass (~> 3.1)
+ sprockets (>= 2.8, < 4.0)
+ sprockets-rails (>= 2.0, < 4.0)
+ tilt (>= 1.1, < 3)
+ selenium-webdriver (3.14.1)
+ childprocess (~> 0.5)
+ rubyzip (~> 1.2, >= 1.2.2)
+ shellany (0.0.1)
+ simplecov (0.16.1)
+ docile (~> 1.1)
+ json (>= 1.8, < 3)
+ simplecov-html (~> 0.10.0)
+ simplecov-html (0.10.2)
+ spring (2.0.2)
+ activesupport (>= 4.2)
+ spring-watcher-listen (2.0.1)
+ listen (>= 2.7, < 4.0)
+ spring (>= 1.2, < 3.0)
+ sprockets (3.7.2)
+ concurrent-ruby (~> 1.0)
+ rack (> 1, < 3)
+ sprockets-rails (3.2.1)
+ actionpack (>= 4.0)
+ activesupport (>= 4.0)
+ sprockets (>= 3.0.0)
+ thor (0.20.0)
+ thread_safe (0.3.6)
+ tilt (2.0.8)
+ turbolinks (5.2.0)
+ turbolinks-source (~> 5.2)
+ turbolinks-source (5.2.0)
+ tzinfo (1.2.5)
+ thread_safe (~> 0.1)
+ uglifier (4.1.19)
+ execjs (>= 0.3.0, < 3)
+ web-console (3.7.0)
+ actionview (>= 5.0)
+ activemodel (>= 5.0)
+ bindex (>= 0.4.0)
+ railties (>= 5.0)
+ websocket-driver (0.7.0)
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.3)
+ xpath (3.2.0)
+ nokogiri (~> 1.8)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ better_errors
+ binding_of_caller
+ bootsnap (>= 1.1.0)
+ bootstrap (~> 4.1.3)
+ byebug
+ capybara (>= 2.15)
+ chromedriver-helper
+ dotenv-rails
+ guard
+ guard-minitest
+ jbuilder (~> 2.5)
+ jquery-rails
+ jquery-turbolinks
+ listen (>= 3.0.5, < 3.2)
+ minitest-rails
+ minitest-reporters
+ omniauth
+ omniauth-github
+ pg (>= 0.18, < 2.0)
+ pry-rails
+ puma (~> 3.11)
+ rails (~> 5.2.1)
+ sass-rails (~> 5.0)
+ selenium-webdriver
+ simplecov
+ spring
+ spring-watcher-listen (~> 2.0.0)
+ turbolinks (~> 5)
+ tzinfo-data
+ uglifier (>= 1.3.0)
+ web-console (>= 3.3.0)
+
+BUNDLED WITH
+ 1.16.6
diff --git a/Guardfile b/Guardfile
new file mode 100644
index 0000000000..e34f706f4a
--- /dev/null
+++ b/Guardfile
@@ -0,0 +1,9 @@
+guard :minitest, autorun: false, spring: true do
+ watch(%r{^app/(.+).rb$}) { |m| "test/#{m[1]}_test.rb" }
+ watch(%r{^app/controllers/application_controller.rb$}) { 'test/controllers' }
+ watch(%r{^app/controllers/(.+)_controller.rb$}) { |m| "test/integration/#{m[1]}_test.rb" }
+ watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
+ watch(%r{^lib/(.+).rb$}) { |m| "test/lib/#{m[1]}_test.rb" }
+ watch(%r{^test/.+_test.rb$})
+ watch(%r{^test/test_helper.rb$}) { 'test' }
+end
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000000..e85f913914
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,6 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require_relative 'config/application'
+
+Rails.application.load_tasks
diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js
new file mode 100644
index 0000000000..b16e53d6d5
--- /dev/null
+++ b/app/assets/config/manifest.js
@@ -0,0 +1,3 @@
+//= link_tree ../images
+//= link_directory ../javascripts .js
+//= link_directory ../stylesheets .css
diff --git a/app/assets/images/.DS_Store b/app/assets/images/.DS_Store
new file mode 100644
index 0000000000..e6f2e2e779
Binary files /dev/null and b/app/assets/images/.DS_Store differ
diff --git a/app/assets/images/.keep b/app/assets/images/.keep
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/app/assets/images/americat1.jpg b/app/assets/images/americat1.jpg
new file mode 100644
index 0000000000..f7fb9e53aa
Binary files /dev/null and b/app/assets/images/americat1.jpg differ
diff --git a/app/assets/images/americat2.jpg b/app/assets/images/americat2.jpg
new file mode 100644
index 0000000000..9380cdc6ab
Binary files /dev/null and b/app/assets/images/americat2.jpg differ
diff --git a/app/assets/images/bed.jpg b/app/assets/images/bed.jpg
new file mode 100644
index 0000000000..b79b976463
Binary files /dev/null and b/app/assets/images/bed.jpg differ
diff --git a/app/assets/images/car.jpg b/app/assets/images/car.jpg
new file mode 100644
index 0000000000..e575ab02c2
Binary files /dev/null and b/app/assets/images/car.jpg differ
diff --git a/app/assets/images/dust-transparent-red.gif b/app/assets/images/dust-transparent-red.gif
new file mode 100644
index 0000000000..e0b8cfcc71
Binary files /dev/null and b/app/assets/images/dust-transparent-red.gif differ
diff --git a/app/assets/images/firework.gif b/app/assets/images/firework.gif
new file mode 100644
index 0000000000..0e22a39d8a
Binary files /dev/null and b/app/assets/images/firework.gif differ
diff --git a/app/assets/images/flower.jpg b/app/assets/images/flower.jpg
new file mode 100644
index 0000000000..fcaad08333
Binary files /dev/null and b/app/assets/images/flower.jpg differ
diff --git a/app/assets/images/red-falling.gif b/app/assets/images/red-falling.gif
new file mode 100644
index 0000000000..72c0db0572
Binary files /dev/null and b/app/assets/images/red-falling.gif differ
diff --git a/app/assets/images/smallfirework.gif b/app/assets/images/smallfirework.gif
new file mode 100644
index 0000000000..f3819c94c4
Binary files /dev/null and b/app/assets/images/smallfirework.gif differ
diff --git a/app/assets/images/sparkle.gif b/app/assets/images/sparkle.gif
new file mode 100644
index 0000000000..782c5b4153
Binary files /dev/null and b/app/assets/images/sparkle.gif differ
diff --git a/app/assets/images/supreme.png b/app/assets/images/supreme.png
new file mode 100644
index 0000000000..c288aae4c7
Binary files /dev/null and b/app/assets/images/supreme.png differ
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
new file mode 100644
index 0000000000..4f73c21a7d
--- /dev/null
+++ b/app/assets/javascripts/application.js
@@ -0,0 +1,20 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
+// vendor/assets/javascripts directory can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// compiled file. JavaScript code in this file should be added after the last require_* statement.
+//
+// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
+// about supported directives.
+ //= require jquery3
+ //= require popper
+ //= require bootstrap-sprockets
+
+//
+//= require rails-ujs
+//= require activestorage
+//= require turbolinks
+//= require_tree .
diff --git a/app/assets/javascripts/cable.js b/app/assets/javascripts/cable.js
new file mode 100644
index 0000000000..739aa5f022
--- /dev/null
+++ b/app/assets/javascripts/cable.js
@@ -0,0 +1,13 @@
+// Action Cable provides the framework to deal with WebSockets in Rails.
+// You can generate new channels where WebSocket features live using the `rails generate channel` command.
+//
+//= require action_cable
+//= require_self
+//= require_tree ./channels
+
+(function() {
+ this.App || (this.App = {});
+
+ App.cable = ActionCable.createConsumer();
+
+}).call(this);
diff --git a/app/assets/javascripts/categories.js b/app/assets/javascripts/categories.js
new file mode 100644
index 0000000000..dee720facd
--- /dev/null
+++ b/app/assets/javascripts/categories.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/javascripts/channels/.keep b/app/assets/javascripts/channels/.keep
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/app/assets/javascripts/merchants.js b/app/assets/javascripts/merchants.js
new file mode 100644
index 0000000000..dee720facd
--- /dev/null
+++ b/app/assets/javascripts/merchants.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/javascripts/order.js b/app/assets/javascripts/order.js
new file mode 100644
index 0000000000..dee720facd
--- /dev/null
+++ b/app/assets/javascripts/order.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/javascripts/order_items.js b/app/assets/javascripts/order_items.js
new file mode 100644
index 0000000000..dee720facd
--- /dev/null
+++ b/app/assets/javascripts/order_items.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/javascripts/orders.js b/app/assets/javascripts/orders.js
new file mode 100644
index 0000000000..dee720facd
--- /dev/null
+++ b/app/assets/javascripts/orders.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/javascripts/products.js b/app/assets/javascripts/products.js
new file mode 100644
index 0000000000..dee720facd
--- /dev/null
+++ b/app/assets/javascripts/products.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/javascripts/sessions.js b/app/assets/javascripts/sessions.js
new file mode 100644
index 0000000000..dee720facd
--- /dev/null
+++ b/app/assets/javascripts/sessions.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/javascripts/welcome.js b/app/assets/javascripts/welcome.js
new file mode 100644
index 0000000000..dee720facd
--- /dev/null
+++ b/app/assets/javascripts/welcome.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
new file mode 100644
index 0000000000..e5854e2c2a
--- /dev/null
+++ b/app/assets/stylesheets/application.scss
@@ -0,0 +1,253 @@
+@import url('https://fonts.googleapis.com/css?family=Love+Ya+Like+A+Sister');
+@import url('https://fonts.googleapis.com/css?family=Quicksand');
+@import url('https://fonts.googleapis.com/css?family=Paytone+One');
+
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
+ * files in this directory. Styles in this file should be added after the last require_* statement.
+ * It is generally better to create a new file per style scope.
+ *
+ */
+
+/* Custom bootstrap variables must be set or imported *before* bootstrap. */
+@import "bootstrap";
+/* Import scss content */
+@import "**/*";
+
+body {
+ width: 100wh;
+ height: 90vh;
+ color: #fff;
+ background: linear-gradient(-45deg, #E54B4B, #E54B4B, #F7EBE8, #F72F26);
+ background-size: 400% 400%;
+ -webkit-animation: Gradient 15s ease infinite;
+ -moz-animation: Gradient 15s ease infinite;
+ animation: Gradient 15s ease infinite;
+}
+
+@-webkit-keyframes Gradient {
+ 0% {
+ background-position: 0% 50%
+ }
+ 50% {
+ background-position: 100% 50%
+ }
+ 100% {
+ background-position: 0% 50%
+ }
+}
+
+@-moz-keyframes Gradient {
+ 0% {
+ background-position: 0% 50%
+ }
+ 50% {
+ background-position: 100% 50%
+ }
+ 100% {
+ background-position: 0% 50%
+ }
+}
+
+@keyframes Gradient {
+ 0% {
+ background-position: 0% 50%
+ }
+ 50% {
+ background-position: 100% 50%
+ }
+ 100% {
+ background-position: 0% 50%
+ }
+}
+
+
+
+.welcome {
+ text-transform: uppercase;
+ letter-spacing: .2em;
+ text-shadow: 2px 2px grey;
+}
+
+
+h2 {
+ color: #292F36;
+ text-transform:uppercase;
+ letter-spacing: 1em;
+ text-shadow: 2px 2px #B1B3B5;
+}
+
+body {
+text-transform:capitalize;
+background-color: #fff;
+font-family: 'Quicksand', sans-serif;
+
+}
+
+strong {
+ color: #EA1300;
+ font-weight: bold;
+}
+
+footer {
+ color: #923030;
+ text-align: center;
+
+}
+main {
+ padding: 4rem;
+}
+
+li {
+ list-style: none;
+}
+
+.homepage-title {
+ text-align: center;
+}
+
+.header {
+ color: #EA1300;
+ background-color: #FFFFFF;
+ font-family: 'Paytone One', sans-serif;
+ padding: 2rem 2rem .1rem 2rem;
+
+}
+
+#logo-hover a:visited {
+ color:#EA1300;
+}
+
+#logo-hover a:link {
+ color:#EA1300;
+}
+
+.logo {
+ text-align: left;
+ font-weight: 600;
+ font-size: 7em;
+ letter-spacing: .2em;
+ margin-bottom: .25em;
+}
+
+.little-header {
+ font-size: 20px;
+ color: #292F36;
+ letter-spacing: .2em;
+ font-family: 'Quicksand', sans-serif;
+}
+
+.nav-app-header {
+ display: flex;
+ justify-content: flex-end;
+ flex-direction: row;
+ font-family: 'Quicksand', sans-serif;
+
+}
+
+.app-header__nav_item {
+ padding-left: 20px;
+}
+
+a:visited {
+ color: #292F36;
+
+}
+a:link {
+ color: #292F36;
+}
+
+a:hover {
+ color: #E54B4B;
+ transition: .6s;
+ text-decoration: none;
+}
+
+#logo-hover a:hover {
+ color: #B4231C;
+ background-image:image-url("smallfirework.gif");
+}
+
+#session {
+ background-color: #FFFFFF;
+}
+
+#session:hover {
+ color: #E54B4B;
+ border: #E54B4B solid 1px;
+}
+
+.btn-primary {
+ background-color: #E54B4B;
+ border: 1px #292F36 solid;
+}
+
+.btn-primary:hover {
+ color: #E54B4B;
+ background-color: #E54B4B;
+ border: 1px #E54B4B solid;
+}
+
+.btn-primary:visited {
+ background-color: #E54B4B;
+ border: 1px #292F36 solid;
+}
+
+.dropdown {
+ position: relative;
+ display: inline-block;
+}
+
+.dropdown-content {
+ display: none;
+ position: absolute;
+ background-color: #FFF;
+ background-image:image-url("red-falling.gif");
+
+ min-width: 130px;
+ box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
+ padding: 12px 36px;
+ z-index: 1;
+ font-weight: bold;
+ white-space: nowrap;
+}
+
+.dropdown:hover .dropdown-content {
+ display: block;
+}
+
+
+.carousel {
+ overflow: hidden;
+ height: 320px;
+ width: 95%;
+ background-color: white;
+ margin: 0 auto ;
+ border: 1px solid #E54B4B ;
+
+}
+
+.carousel img {
+ margin-top: -22%;
+ margin-bottom: auto;
+ height: auto;
+ width: 100%;
+}
+
+
+
+.mini-body {
+ color: black;
+ background-color: white;
+ width: 80%;
+ border: 10px solid white;
+ padding: 25px;
+ margin: auto;
+}
diff --git a/app/assets/stylesheets/categories.scss b/app/assets/stylesheets/categories.scss
new file mode 100644
index 0000000000..0bb756559b
--- /dev/null
+++ b/app/assets/stylesheets/categories.scss
@@ -0,0 +1,18 @@
+// Place all the styles related to the Categories controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+.category-title {
+ text-align: center;
+}
+
+/*---------------------- PRODUCT LIST ----------------------------*/
+
+.grid-container {
+ display: grid;
+ grid-template-columns: 1fr 1fr 1fr;
+ text-align: center;
+ justify-content: center;
+ grid-column-gap: 50px;
+ grid-row-gap: 25px;
+ align-self: auto;
+}
diff --git a/app/assets/stylesheets/merchants.scss b/app/assets/stylesheets/merchants.scss
new file mode 100644
index 0000000000..626b3f0060
--- /dev/null
+++ b/app/assets/stylesheets/merchants.scss
@@ -0,0 +1,101 @@
+// Place all the styles related to the merchants controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+
+.merchant-title {
+ text-align: center;
+}
+
+
+.mini-body{
+ color: black;
+ background-color: white;
+ width: 80%;
+ border: 10px solid white;
+ padding: 15px;
+ margin: auto;
+}
+
+.merchant-show-title {
+ text-align: center;
+ color: #292F36;
+ text-transform:uppercase;
+ letter-spacing: .5em;
+ text-shadow: 2px 2px #B1B3B5;
+}
+
+/*---------------------- PRODUCT LIST ----------------------------*/
+
+.grid-container {
+ display: grid;
+ grid-template-columns: 1fr 1fr 1fr;
+ text-align: center;
+ justify-content: center;
+ grid-column-gap: 50px;
+ grid-row-gap: 25px;
+ align-self: auto;
+}
+
+.order-items {
+ margin-bottom: 0;
+ padding: 0;
+}
+.order-items li {
+ list-style: disc;
+}
+
+.order-row td {
+ padding: 10px 20px;
+ vertical-align: top;
+}
+
+.order-header th {
+ padding: 10px 20px;
+}
+
+
+/*---------------------- MERCHANT SHOW ----------------------*/
+
+
+.add-category {
+ background-color: #F97A74 !important;
+ border: 1px #292F36 solid;
+}
+
+.add-product {
+ background-color: #F97A74 !important;
+ border: 1px #292F36 solid;
+}
+
+.order-summary {
+ background-color: #FFE5E7 !important;
+ border: 1px #292F36 solid;
+}
+
+
+
+
+.mini-body-about{
+justify-content: center;
+ color: black;
+ background-color: white;
+ width: 80%;
+ border: 10px solid white;
+ padding: 15px;
+ margin: auto;
+}
+
+.about-grid-container {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ text-align: center;
+ justify-content: center;
+ grid-column-gap: 50px;
+ grid-row-gap: 20px;
+ align-self: auto;
+}
+
+.grid-item {
+ padding: 20px
+
+}
diff --git a/app/assets/stylesheets/order.scss b/app/assets/stylesheets/order.scss
new file mode 100644
index 0000000000..3ee74f9f68
--- /dev/null
+++ b/app/assets/stylesheets/order.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the order controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/assets/stylesheets/order_items.scss b/app/assets/stylesheets/order_items.scss
new file mode 100644
index 0000000000..c02e2068ea
--- /dev/null
+++ b/app/assets/stylesheets/order_items.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the order_items controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/assets/stylesheets/orders.scss b/app/assets/stylesheets/orders.scss
new file mode 100644
index 0000000000..46d16d2504
--- /dev/null
+++ b/app/assets/stylesheets/orders.scss
@@ -0,0 +1,66 @@
+// Place all the styles related to the orders controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+
+table, th, td {
+ border: 0px solid black;
+ text-align: center !important;
+}
+
+table {
+ border-collapse: collapse;
+ width: 100%;
+}
+
+th, td {
+ text-align: left;
+ padding: 8px;
+ border-bottom: 1px solid #ddd;
+
+}
+
+// tr:nth-child(even){background-color: #f2f2f2}
+// th, td {
+// padding: 12px;
+// text-align: left;
+// height: 50px;
+// vertical-align: bottom;
+// }
+//
+// tr:hover {background-color: #F7EBE8;}
+// tr:nth-child(even) {background-color: #F7EBE8;}
+
+
+.update-order {
+ color: black;
+ background-color: #FFE5E7 !important;
+ border: 1px #292F36 solid;
+}
+
+
+.remove-item {
+ color: #fff !important;
+ background-color: #F72F26 !important;
+ border: 1px #292F36 solid;
+}
+
+.order-image img{
+ width: 75px;
+ height: 75px;
+ position: relative;
+ overflow: hidden;
+ border-radius: 50%;
+}
+
+
+.checkout {
+ color: white !important;
+ background-color: #23D552 !important;
+ border: 1px #292F36 solid;
+}
+
+.table-head {
+ align-items: center;
+ font-weight: bold;
+ background-color: #EBECEC;
+}
diff --git a/app/assets/stylesheets/products.scss b/app/assets/stylesheets/products.scss
new file mode 100644
index 0000000000..4ca71985a2
--- /dev/null
+++ b/app/assets/stylesheets/products.scss
@@ -0,0 +1,100 @@
+// Place all the styles related to the products controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+
+.product-title {
+ text-align: center;
+}
+
+/*---------------------- PRODUCT LIST ----------------------------*/
+
+.grid-container {
+ display: grid;
+ grid-template-columns: 1fr 1fr 1fr;
+ text-align: center;
+ justify-content: center;
+ grid-column-gap: 50px;
+ grid-row-gap: 25px;
+ align-self: auto;
+ margin: 4em
+}
+
+.grid-item img {
+ max-width: 100%;
+ height: 250px;
+ border-radius: 50;
+ padding: 2px;
+ border: 1px solid #EC7C7C ;
+ outline: 3px solid #FFE5E7;
+ outline-offset: 1px;
+
+ margin: 0 auto ;
+}
+
+
+
+
+.image {
+ opacity: 1;
+ display: block;
+ width: 100%;
+ height: auto;
+ transition: .5s ease;
+ backface-visibility: hidden;
+ margin: 0;
+}
+
+.middle {
+ transition: .5s ease;
+ opacity: 0;
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ -ms-transform: translate(-50%, -50%);
+ text-align: center;
+}
+
+.container:hover .image {
+ opacity: 0.6;
+}
+
+/*---------------------- PRODUCT DETAILS ----------------------------*/
+
+.show-grid-container {
+ display: flex;
+ grid-template-columns: 1fr 1fr;
+ justify-content: center;
+ grid-column-gap: 5px;
+ align-self: auto;
+}
+
+.show-grid-image {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 30%;
+ padding: 1px;
+}
+
+.show-grid-image img {
+ width: 90%;
+ padding: 1px;
+ border: 1px solid black ;
+
+}
+
+.review-container {
+ display: grid;
+ text-align: left;
+ width: 70%;
+ margin: -10px auto;
+ padding: 30px;
+
+}
+
+
+.add-cart {
+ background-color: #F97A74 !important;
+ border: 1px #292F36 solid;
+}
diff --git a/app/assets/stylesheets/sessions.scss b/app/assets/stylesheets/sessions.scss
new file mode 100644
index 0000000000..7bef9cf826
--- /dev/null
+++ b/app/assets/stylesheets/sessions.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the sessions controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/assets/stylesheets/welcome.scss b/app/assets/stylesheets/welcome.scss
new file mode 100644
index 0000000000..77ce11a740
--- /dev/null
+++ b/app/assets/stylesheets/welcome.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the welcome controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb
new file mode 100644
index 0000000000..d672697283
--- /dev/null
+++ b/app/channels/application_cable/channel.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Channel < ActionCable::Channel::Base
+ end
+end
diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb
new file mode 100644
index 0000000000..0ff5442f47
--- /dev/null
+++ b/app/channels/application_cable/connection.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Connection < ActionCable::Connection::Base
+ end
+end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
new file mode 100644
index 0000000000..61c2018d73
--- /dev/null
+++ b/app/controllers/application_controller.rb
@@ -0,0 +1,65 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery with: :exception
+ before_action :find_merchant
+
+ def render_404
+ # DPR: this will actually render a 404 page in production
+ raise ActionController::RoutingError.new('Not Found')
+ end
+
+ # return the current order or create a new order if none exists
+ def current_order
+ if !session[:order_id]
+ new_order = Order.new()
+ session[:order_id] = new_order.id
+ result = new_order.save
+ if result
+ # flash[:status] = :success
+ # flash[:result_text] = "Added item to your cart"
+ # redirect_to root_path
+ return new_order.id
+ else
+ # flash[:status] = :failure
+ # flash[:result_text] = "Could not add to order"
+ # redirect_to root_path
+ end
+
+ elsif
+ ongoing_order = Order.find_by(id: session[:order_id])
+ flash[:status] = :failure
+ flash[:result_text] = "You already have a cart in progress."
+ # redirect_to root_path
+ return ongoing_order.id
+ else
+ puts "oh no"
+ flash[:status] = :failure
+ flash[:result_text] = "Your order does not exist."
+ redirect_to root_path
+ end
+
+ end
+
+ private
+
+ # NOTE: can dry the code above private with this
+ def find_order
+ if session[:order_id]
+ @ongoing_order = Order.find_by(id: session[:order_id])
+ end
+ end
+
+ def find_merchant
+ if session[:merchant_id]
+ @login_user = Merchant.find_by(id: session[:merchant_id])
+ end
+ end
+
+ def require_login
+ if find_merchant.nil?
+ flash[:status] = :failure
+ flash[:result_text] = "You must be a logged in merchant to view this page."
+ redirect_to root_path
+ end
+ end
+
+end
diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb
new file mode 100644
index 0000000000..f1d91e2fdb
--- /dev/null
+++ b/app/controllers/categories_controller.rb
@@ -0,0 +1,43 @@
+class CategoriesController < ApplicationController
+
+ before_action :require_login, only: [:new, :create]
+
+ def index
+ @categories = Category.all
+ end
+
+ def new
+ if @login_user.nil?
+ render_404
+ else
+ @category = Category.new
+ end
+ end
+
+ def create
+ if @login_user.nil?
+ flash[:status] = :failure
+ flash[:result_text] = "You must be logged in to add a new category."
+ redirect_to root_path
+ else
+ @category = Category.new(category_params)
+ if @category.save
+ flash[:status] = :success
+ flash[:result_text] = "Successfully created category:
+ #{@category.category_name}."
+ redirect_to root_path
+ else
+ flash[:status] = :failure
+ flash[:result_text] = "Could not create category: #{@category.category_name}."
+ flash[:messages] = @category.errors.messages
+ render :new, status: :bad_request
+ end
+ end
+ end
+
+ private
+
+ def category_params
+ params.require(:category).permit(:category_name)
+ end
+end
diff --git a/app/controllers/concerns/.keep b/app/controllers/concerns/.keep
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/app/controllers/merchants_controller.rb b/app/controllers/merchants_controller.rb
new file mode 100644
index 0000000000..a1f14e191b
--- /dev/null
+++ b/app/controllers/merchants_controller.rb
@@ -0,0 +1,50 @@
+class MerchantsController < ApplicationController
+ # QUESTION: WHY ISN'T THIS WORKING????!?!?!
+ # skip_before_action :matching_merchant, only: [:index]
+ before_action :matching_merchant, only: [:show, :order_summary]
+
+ def index
+ @merchant = Merchant.all
+ end
+
+ def show
+ # QUESTION: add if/else so only login_user can view merchant account page??
+ @merchant = Merchant.find(params[:id])
+ render_404 unless @merchant
+ end
+
+ def order_summary
+ # show orders that belong only to merchant
+ @orders = Order.joins(:products).where(products: {merchant_id: params[:merchant_id]})
+
+ # show order_items that belong only to merchant
+ @order_items = @orders.map { |order| order.order_items }.flatten
+ end
+
+ private
+
+ def matching_merchant
+ # like, if you're not even logged in, don't try to view such things
+ require_login()
+
+ merchant_viewing = Merchant.find_by(id: params[:id])
+
+ # this allows the order summary page to work
+ if merchant_viewing.nil?
+ merchant_viewing = Merchant.find_by(id: params[:merchant_id])
+ end
+
+ if find_merchant != merchant_viewing
+ flash[:status] = :failure
+ flash[:result_text] = "Only merchant #{merchant_viewing.username} may view this page."
+
+ redirect_to root_path
+ end
+ end
+
+
+ def about_us
+ end
+
+
+end
diff --git a/app/controllers/order_items_controller.rb b/app/controllers/order_items_controller.rb
new file mode 100644
index 0000000000..d10331a1de
--- /dev/null
+++ b/app/controllers/order_items_controller.rb
@@ -0,0 +1,110 @@
+class OrderItemsController < ApplicationController
+
+
+
+ def create
+ #TODO: translate into strong params
+
+ @order_item = OrderItem.new(product_id: params[:product_id].to_i, quantity: params[:quantity].to_i, order_id: current_order)
+ session[:order_id] = @order_item.order.id
+ # order_id = OrderItem.add_order_item_to_order(@order_item)
+ # @order_item.order_id = order_id
+
+ # TODO: add if/else or model method to check against + edit product inventory
+
+ result = @order_item.save
+
+ if result
+ flash[:status] = :success
+ flash[:result_text] = "Successfully created
+ order item #{@order_item.product.name}."
+
+ else
+ flash[:status] = :failure
+ flash[:result_text] = "DID NOT create order item #{order_id}"
+ flash[:messages] = @order_item.errors.messages
+ end
+
+ redirect_back(fallback_location: root_path)
+ end
+
+ def update
+ @order_item = OrderItem.find_by(id: params[:order_item_id])
+
+ @order_item.update(quantity: params[:quantity])
+
+ if @order_item.save
+ flash[:status] = :success
+ flash[:result_text] = "Successfully updated order item: #{@order_item.product.name}"
+ flash[:messages] = @order_item.errors.messages
+ else
+ flash[:status] = :failure
+ flash[:result_text] = "Did not update order item: #{@order_item.product.name}"
+ flash[:messages] = @order_item.errors.messages
+ end
+ redirect_to orders_path
+
+ end
+
+ def change_shipping_status
+ @order_item = OrderItem.find_by(id: params[:order_item_id])
+
+ @order_item.update(shipped: params[:shipped])
+
+ if @order_item.save
+ flash[:status] = :success
+ flash[:result_text] = "Successfully changed shipping status for item #{@order_item.product.name}"
+ flash[:messages] = @order_item.errors.messages
+ else
+ flash[:status] = :failure
+ flash[:result_text] = "Could not change shipping status for order item #{@order_item.product.name}"
+ flash[:messages] = @order_item.errors.messages
+ end
+
+ redirect_back(fallback_location: root_path)
+ end
+
+
+ # NOTE: actions below are for order... should instead be for order_item?
+
+ # def update
+ # @order = current_order
+ # @order_item = @order.order_items.find(params[:id])
+ # @order_item.update_attributes(order_item_params)
+ # @order_items = @order.order_items
+ # end
+
+ # def destroy
+ # @order = current_order
+ # @order_item = @order.order_items.find(params[:id])
+ # @order_item.destroy
+ # @order_items = @order.order_items
+ # end
+
+ def destroy
+ @order_item = OrderItem.find_by(id: params[:id])
+
+ result = @order_item.destroy
+
+ if result
+ flash[:status] = :success
+ flash[:result_text] = "Successfully destroyed item: #{@order_item.product.name}"
+ redirect_to orders_path
+ else
+ flash[:status] = :failure
+ flash[:result_text] = "Did not delete #{@order_item.product.name}"
+ flash[:messages] = @order_item.errors.messages
+ end
+ end
+
+ # private
+ #
+ # def order_item_params
+ # params.require(:order_items).permit(:product_id, :quantity)
+ # end
+
+ # end
+
+
+
+end
diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb
new file mode 100644
index 0000000000..ba23a53fb9
--- /dev/null
+++ b/app/controllers/orders_controller.rb
@@ -0,0 +1,191 @@
+class OrdersController < ApplicationController
+ before_action :find_order, only: [:show, :edit, :update, :destroy]
+ before_action :matching_guest, only: [:show]
+
+
+ def index
+
+ @orders = Order.find_by(id: session[:order_id])
+ # commented out because it's confusong?
+ # if session[:merchant]
+ # merchant_id = session[:merchant]['id']
+ # @orders = Merchant.find(merchant_id).orders
+ # end
+
+ end
+
+ def new
+ @order = Order.new
+ end
+ # add @order_items
+ def show
+ # if @order.nil? || !@order.order_items
+ # head :not_found
+ # else @order_items = current_order.order_items
+ # end
+
+ # @order = Order.find_by(id: params[:id])
+ # unless @order
+ # render_404
+ # else
+ # merchants = @order.products.map { |p| p.merchant }
+ # if !merchants.include?(matching_guest)
+ # flash[:status] = :failure
+ # flash[:result_text] = "Access denied."
+ # redirect_to root_path
+ # end
+ # end
+ end
+
+ def create
+
+
+
+ # #TODO: translate into strong params
+ # @order_item = OrderItem.new(product_id: params[:product_id].to_i, quantity: params[:quantity].to_i, order_id: params[:order_id])
+ # # order_id = OrderItem.add_order_item_to_order(@order_item)
+ # # @order_item.order_id = order_id
+ #
+ # # TODO: add if/else or model method to check against + edit product inventory
+ #
+ # result = @order_item.save
+ #
+ # if result
+ # flash[:status] = :success
+ # flash[:result_text] = "Successfully created
+ # order item"
+ # else
+ # flash[:status] = :failure
+ # flash[:result_text] = "DID NOT create order item #{order_id}"
+ # flash[:messages] = @order_item.errors.messages
+ # end
+ # redirect_back(fallback_location: root_path)
+
+
+ # if session[:order_id] ==
+ # @order = Order.new #(params)
+ # @order_category = @order.category
+ # if @order.save
+ # flash[:status] = :success
+ # # flash[:result_text] = "Successfully created order"
+ # # redirect_to
+ # else
+ # flash[:status] = :failure
+ # # flash[:result_text] = "Could not create order"
+ # # flash[:messages] = @order.errors.messages
+ # # render :new, status: :bad_request
+ # end
+
+ # NOTE:
| + Name + | ++ Inventory + | ++ Price + | ++ Status + | ++ + | ++ + | + + + + +<% @merchant.products.each do |product| %> +
| + <%= link_to product.name, product_path(product) %> + | ++ <%= product.inventory %> + | ++ <%= number_to_currency(product.price_int_to_float, precision: 2) %> + | ++ + <%= product.status %> + | + ++ <%= link_to "Edit", edit_product_path(product.id) %> + | + ++ <%= link_to "Delete", product_path(product.id), method: :delete, data: { + confirm: "Are you sure you want to delete this entry #{product.name}?" }, class: "btn btn-danger" %> + | + <% end %> + +
Dionisia
+ <%= image_tag("americat2.jpg", class: "image") %>Layla
+ <%= image_tag("americat2.jpg", class: "image") %> +Melissa
+ <%= image_tag("americat2.jpg", class: "image") %> +Michelle
+ <%= image_tag("americat2.jpg", class: "image") %> +| + | Total Revenue: <%= number_to_currency(@orders.total_revenue, precision: 2) %> | + ++ By status Paid: <%= number_to_currency(@orders.revenue_by_status("paid"), precision: 2)%> + | ++ By status Complete: <%= number_to_currency(@orders.revenue_by_status("complete"), precision: 2)%> + | +
|---|
| + | Total Orders: <%= @orders.length %> | + ++ Orders Paid: <%= @orders.total_orders_by_status("paid") %> + | ++ Orders Complete: <%= @orders.total_orders_by_status("complete") %> + | +
|---|
| Order ID | +Purchase Date | +Item Name | +Item Quantity | +Item Price | +Item Subtotal | +Current Status | +Ship Status | ++ |
|---|---|---|---|---|---|---|---|---|
| + <%= link_to item.order.id, order_path(item.order) %> + | ++ + <%= item.order.created_at.strftime("%m/%d/%Y") %> + | ++ <%= item.product.name %> + | ++ + <%= item.quantity %> + | ++ + <%= number_to_currency(item.product.price_int_to_float, precision: 2) %> + | ++ <%= number_to_currency(item.order_item_subtotal, precision: 2) %> + + | ++ <%= item.order.payment_status %> + | ++ <%= item.shipped %> + | + ++ + <% if item.shipped == false %> + <%= link_to "Mark as shipped", ship_item_path({order_item_id: item.id, shipped: true}), method: :put, class: "btn btn-danger"%> + <% else %> + <%= link_to "Unship", ship_item_path({order_item_id: item.id, shipped: false}), method: :put, class: "btn btn-danger"%> + <% end %> + | + + +
+
+ +
+<%= render partial: "/layouts/merchant_account_products" %> +
+| + Image + | ++ Item Name + | ++ Unit Price + | ++ Current Quantity + | ++ Update Quantity + | ++ Remove + | ++ Subtotal + | + + + + +<% @orders.order_items.each do |order_item| %> +<% order_item.double_check_availability %> +
| + <%= link_to image_tag("#{order_item.product.photo_url}"), product_path(order_item.product.id), class: "order-image"%> + | ++ <%= link_to order_item.product.name, product_path(order_item.product.id) %> + + | ++ <%= number_to_currency((order_item.product.price_int_to_float), precision: 2) %> + | ++ <%= order_item.quantity %> + | + ++ <%= form_with model: @order_item, url: order_items_update_path(:order_item_id => order_item), method: :put do |f|%> + + <%= f.label :quantity%> + <%= f.select :quantity, (1..order_item.product.inventory) %> + <%= f.submit "Update", class: "btn btn-primary update-order" %> + + <% end %> + + + | ++ <%= link_to 'Remove from Cart', order_item_path(order_item.id), method: :delete, data: { confirm: "Are you sure you want to delete item: #{order_item.product.name}?" }, class: "btn btn-primary remove-item" %> + | + ++ <%= number_to_currency(order_item.order_item_subtotal, precision: 2) %> + | +
| + | ++ | ++ | ++ | ++ | ++ | ++ TOTAL: <%= number_to_currency(@orders.order_total, precision: 2) %> + | +
+
Order: #<%=@order.id %>
+Purchased on: <%=@order.created_at.strftime("%m/%d/%Y") %>
+Purchase status: <%=@order.payment_status %>
+Name: <%=@order.guest_cc_name %>
+Shipping address: <%=@order.guest_mailing %>
+Email: <%=@order.guest_email %>
+| Product: | +Price: | +Quantity: | +<%= link_to item.product.name, product_path(item.product.id) %> | +<%=number_to_currency(item.product.price_int_to_float, precision: 2) %> | +<%= item.quantity %> | + + <% end %> +
|---|
+ Purchase Total: <%= number_to_currency(@order.order_total, precision: 2) %> +
diff --git a/app/views/products/_product_form.html.erb b/app/views/products/_product_form.html.erb new file mode 100644 index 0000000000..ad4a60b71f --- /dev/null +++ b/app/views/products/_product_form.html.erb @@ -0,0 +1,39 @@ ++
+
+
+
+
You may have mistyped the address or the page may have moved.
+If you are the application owner check the logs for more information.
+Maybe you tried to change something you didn't have access to.
+If you are the application owner check the logs for more information.
+If you are the application owner check the logs for more information.
+