office_clerk 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +73 -0
- data/.rubocop.yml +6 -0
- data/.travis.yml +9 -0
- data/Gemfile +63 -0
- data/Gemfile.lock +367 -0
- data/Guardfile +28 -0
- data/README.md +44 -0
- data/Rakefile +6 -0
- data/app/assets/images/admin/baskets-2.jpg +0 -0
- data/app/assets/images/admin/baskets.jpg +0 -0
- data/app/assets/images/admin/categories-2.jpg +0 -0
- data/app/assets/images/admin/categories.jpg +0 -0
- data/app/assets/images/admin/clerks-2.jpg +0 -0
- data/app/assets/images/admin/clerks.jpg +0 -0
- data/app/assets/images/admin/orders-2.jpg +0 -0
- data/app/assets/images/admin/orders.jpg +0 -0
- data/app/assets/images/admin/products-2.jpg +0 -0
- data/app/assets/images/admin/products.jpg +0 -0
- data/app/assets/images/admin/purchases-2.jpg +0 -0
- data/app/assets/images/admin/purchases.jpg +0 -0
- data/app/assets/images/admin/suppliers-2.jpg +0 -0
- data/app/assets/images/admin/suppliers.jpg +0 -0
- data/app/assets/images/alpha.png +0 -0
- data/app/assets/images/down-icon.png +0 -0
- data/app/assets/images/header.gif +0 -0
- data/app/assets/images/hihih.jpg +0 -0
- data/app/assets/images/hue.png +0 -0
- data/app/assets/images/koe.jpg +0 -0
- data/app/assets/images/missing.png +0 -0
- data/app/assets/images/saturation.png +0 -0
- data/app/assets/images/shop/basket.jpg +0 -0
- data/app/assets/images/shop/farfalla-logo.jpg +0 -0
- data/app/assets/images/shop/header.gif +0 -0
- data/app/assets/images/shop/header.jpg +0 -0
- data/app/assets/images/shop/header.png +0 -0
- data/app/assets/images/shop/kansi.jpg +0 -0
- data/app/assets/images/shop/kansi.png +0 -0
- data/app/assets/images/shop/logo.png +0 -0
- data/app/assets/images/shop/menu-gourmet.jpg +0 -0
- data/app/assets/images/shop/menu-hius.jpg +0 -0
- data/app/assets/images/shop/menu-huonetuoksu.jpg +0 -0
- data/app/assets/images/shop/menu-info.jpg +0 -0
- data/app/assets/images/shop/menu-kasvo.jpg +0 -0
- data/app/assets/images/shop/menu-laukut.jpg +0 -0
- data/app/assets/images/shop/menu-luomu.jpg +0 -0
- data/app/assets/images/shop/menu-men.jpg +0 -0
- data/app/assets/images/shop/menu-oljy.jpg +0 -0
- data/app/assets/images/shop/menu-tuoksu1.jpg +0 -0
- data/app/assets/images/shop/menu-vaatteet.jpg +0 -0
- data/app/assets/images/shop/menu-valaisin.jpg +0 -0
- data/app/assets/images/shop/menu-vartalo.jpg +0 -0
- data/app/assets/images/shop/spacer.gif +0 -0
- data/app/assets/images/shop/tausta.jpg +0 -0
- data/app/assets/images/shop/tervetuloa.gif +0 -0
- data/app/assets/images/shop/valk.png +0 -0
- data/app/assets/images/shop/valk3.png +0 -0
- data/app/assets/images/shop/violetti-lev.jpg +0 -0
- data/app/assets/images/shop/violetti.jpg +0 -0
- data/app/assets/images/ui-anim_basic_16x16.gif +0 -0
- data/app/assets/images/up-icon.png +0 -0
- data/app/assets/javascripts/admin.js +29 -0
- data/app/assets/javascripts/shop.js +30 -0
- data/app/assets/stylesheets/admin.css.scss +129 -0
- data/app/assets/stylesheets/shop-receipt.css.scss +80 -0
- data/app/assets/stylesheets/shop.css.scss +403 -0
- data/app/controllers/admin_controller.rb +23 -0
- data/app/controllers/application_controller.rb +41 -0
- data/app/controllers/baskets_controller.rb +176 -0
- data/app/controllers/categories_controller.rb +69 -0
- data/app/controllers/clerks_controller.rb +64 -0
- data/app/controllers/orders_controller.rb +57 -0
- data/app/controllers/products_controller.rb +126 -0
- data/app/controllers/purchases_controller.rb +72 -0
- data/app/controllers/sessions_controller.rb +46 -0
- data/app/controllers/shop_controller.rb +90 -0
- data/app/controllers/suppliers_controller.rb +63 -0
- data/app/helpers/admin_helper.rb +28 -0
- data/app/helpers/application_helper.rb +25 -0
- data/app/helpers/baskets_helper.rb +4 -0
- data/app/helpers/categories_helper.rb +4 -0
- data/app/helpers/orders_helper.rb +4 -0
- data/app/helpers/products_helper.rb +4 -0
- data/app/helpers/purchases_helper.rb +4 -0
- data/app/helpers/shop_helper.rb +17 -0
- data/app/helpers/suppliers_helper.rb +4 -0
- data/app/mailers/.keep +0 -0
- data/app/models/basket.rb +114 -0
- data/app/models/category.rb +27 -0
- data/app/models/clerk.rb +46 -0
- data/app/models/item.rb +26 -0
- data/app/models/order.rb +72 -0
- data/app/models/product.rb +100 -0
- data/app/models/purchase.rb +26 -0
- data/app/models/supplier.rb +15 -0
- data/app/views/addresses/_form_fields.html.haml +4 -0
- data/app/views/addresses/show.html.haml +23 -0
- data/app/views/baskets/_small.html.haml +25 -0
- data/app/views/baskets/edit.html.haml +74 -0
- data/app/views/baskets/index.html.haml +55 -0
- data/app/views/baskets/show.html.haml +18 -0
- data/app/views/categories/_treeview.html.haml +8 -0
- data/app/views/categories/_triple.html.haml +12 -0
- data/app/views/categories/edit.html.haml +36 -0
- data/app/views/categories/index.html.haml +49 -0
- data/app/views/categories/show.html.haml +30 -0
- data/app/views/clerks/edit.html.haml +20 -0
- data/app/views/clerks/index.html.haml +37 -0
- data/app/views/clerks/show.html.haml +19 -0
- data/app/views/layouts/_admin_menu.html.haml +14 -0
- data/app/views/layouts/_google.haml +8 -0
- data/app/views/layouts/_messages.html.haml +5 -0
- data/app/views/layouts/admin.html.haml +42 -0
- data/app/views/layouts/shop.html.haml +96 -0
- data/app/views/orders/edit.html.haml +25 -0
- data/app/views/orders/index.html.haml +93 -0
- data/app/views/orders/show.html.haml +37 -0
- data/app/views/products/_line.html.haml +25 -0
- data/app/views/products/_name.html.haml +4 -0
- data/app/views/products/_online.html.haml +2 -0
- data/app/views/products/_triple.html.haml +12 -0
- data/app/views/products/edit.html.haml +42 -0
- data/app/views/products/index.html.haml +86 -0
- data/app/views/products/show.html.haml +94 -0
- data/app/views/purchases/edit.html.haml +9 -0
- data/app/views/purchases/index.html.haml +52 -0
- data/app/views/purchases/show.html.haml +32 -0
- data/app/views/sessions/new.html.haml +10 -0
- data/app/views/sessions/new_clerk.html.haml +22 -0
- data/app/views/shop/_groups.html.haml +8 -0
- data/app/views/shop/_menu.html.haml +5 -0
- data/app/views/shop/_sub.html.haml +0 -0
- data/app/views/shop/checkout.haml +142 -0
- data/app/views/shop/group.html.haml +9 -0
- data/app/views/shop/main_group.html.haml +9 -0
- data/app/views/shop/order.haml +104 -0
- data/app/views/shop/product.html.haml +67 -0
- data/app/views/shop/product_list.html.haml +50 -0
- data/app/views/shop/saved_search.html +6 -0
- data/app/views/shop/sub_group.html.haml +19 -0
- data/app/views/shop/tuotteista.html.haml +40 -0
- data/app/views/shop/welcome.html.haml +103 -0
- data/app/views/suppliers/edit.html.haml +10 -0
- data/app/views/suppliers/index.html.haml +40 -0
- data/app/views/suppliers/show.html.haml +27 -0
- data/bin/bundle +3 -0
- data/bin/rails +8 -0
- data/bin/rake +8 -0
- data/bin/rspec +7 -0
- data/bin/spring +18 -0
- data/config.ru +7 -0
- data/config/application.example.yml +13 -0
- data/config/application.rb +59 -0
- data/config/application.yml +13 -0
- data/config/boot.rb +7 -0
- data/config/database.yml +25 -0
- data/config/environment.rb +6 -0
- data/config/environments/development.rb +31 -0
- data/config/environments/production.rb +80 -0
- data/config/environments/test.rb +36 -0
- data/config/i18n-tasks.yml +11 -0
- data/config/initializers/attack.rb +32 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/filter_parameter_logging.rb +4 -0
- data/config/initializers/inflections.rb +16 -0
- data/config/initializers/migrate.rb +6 -0
- data/config/initializers/mime_types.rb +6 -0
- data/config/initializers/secret_token.rb +12 -0
- data/config/initializers/session_store.rb +3 -0
- data/config/initializers/simple_form.rb +149 -0
- data/config/initializers/simple_form_bootstrap.rb +48 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/config.yml +23 -0
- data/config/locales/en.yml +183 -0
- data/config/locales/fi.yml +211 -0
- data/config/routes.rb +108 -0
- data/db/migrate/20131224171442_clerks.rb +15 -0
- data/db/migrate/20131226110406_suppliers.rb +9 -0
- data/db/migrate/20131226143612_categories.rb +18 -0
- data/db/migrate/20131226143747_items.rb +14 -0
- data/db/migrate/20131226144134_orders.rb +21 -0
- data/db/migrate/20131226144316_baskets.rb +12 -0
- data/db/migrate/20131226151151_purchases.rb +11 -0
- data/db/migrate/20131226151332_products.rb +27 -0
- data/db/schema.rb +138 -0
- data/db/seeds.rb +4 -0
- data/lib/assets/.keep +0 -0
- data/lib/office_clerk.rb +20 -0
- data/lib/office_clerk/shipping_method.rb +35 -0
- data/lib/tasks/.keep +0 -0
- data/lib/tasks/import.rake +33 -0
- data/lib/templates/haml/scaffold/_form.html.haml +8 -0
- data/office_clerk.gemspec +46 -0
- data/public/404.html +58 -0
- data/public/422.html +58 -0
- data/public/500.html +57 -0
- data/public/favicon.ico +0 -0
- data/public/humans.txt +20 -0
- data/public/robots.txt +5 -0
- data/spec/controllers/baskets_controller_spec.rb +112 -0
- data/spec/controllers/categories_controller_spec.rb +133 -0
- data/spec/controllers/clerks_controller_spec.rb +70 -0
- data/spec/controllers/orders_controller_spec.rb +105 -0
- data/spec/controllers/products_controller_spec.rb +138 -0
- data/spec/controllers/purchases_controller_spec.rb +123 -0
- data/spec/controllers/sessions_controller_spec.rb +18 -0
- data/spec/controllers/suppliers_controller_spec.rb +137 -0
- data/spec/factories/addresses.rb +11 -0
- data/spec/factories/baskets.rb +15 -0
- data/spec/factories/categories.rb +8 -0
- data/spec/factories/clerks.rb +15 -0
- data/spec/factories/items.rb +19 -0
- data/spec/factories/orders.rb +9 -0
- data/spec/factories/products.rb +10 -0
- data/spec/factories/purchases.rb +10 -0
- data/spec/factories/suppliers.rb +7 -0
- data/spec/features/baskets/buttons_spec.rb +35 -0
- data/spec/features/baskets/edit_spec.rb +50 -0
- data/spec/features/baskets/index_spec.rb +12 -0
- data/spec/features/baskets/search_spec.rb +33 -0
- data/spec/features/baskets/show_spec.rb +21 -0
- data/spec/features/categories_spec.rb +21 -0
- data/spec/features/clerks_spec.rb +21 -0
- data/spec/features/orders_spec.rb +14 -0
- data/spec/features/products/index_spec.rb +30 -0
- data/spec/features/products/new_spec.rb +20 -0
- data/spec/features/purchases_spec.rb +14 -0
- data/spec/features/shops_spec.rb +18 -0
- data/spec/features/suppliers_spec.rb +18 -0
- data/spec/models/baskets/inventory_spec.rb +34 -0
- data/spec/models/baskets/items_spec.rb +37 -0
- data/spec/models/baskets/products_spec.rb +31 -0
- data/spec/models/category_spec.rb +18 -0
- data/spec/models/clerk/email_spec.rb +69 -0
- data/spec/models/clerk/password_spec.rb +83 -0
- data/spec/models/item_spec.rb +33 -0
- data/spec/models/locale_spec.rb +17 -0
- data/spec/models/order_spec.rb +19 -0
- data/spec/models/product_spec.rb +29 -0
- data/spec/models/purchase_spec.rb +8 -0
- data/spec/models/supplier_spec.rb +8 -0
- data/spec/routing/baskets_routing_spec.rb +35 -0
- data/spec/routing/categories_routing_spec.rb +35 -0
- data/spec/routing/orders_routing_spec.rb +35 -0
- data/spec/routing/products_routing_spec.rb +35 -0
- data/spec/routing/purchases_routing_spec.rb +35 -0
- data/spec/routing/suppliers_routing_spec.rb +35 -0
- data/spec/spec_helper.rb +74 -0
- data/spec/support/request_helper.rb +31 -0
- data/test/fixtures/baskets.yml +41993 -0
- data/test/fixtures/categories.yml +638 -0
- data/test/fixtures/clerks.yml +694 -0
- data/test/fixtures/items.yml +83651 -0
- data/test/fixtures/orders.yml +58918 -0
- data/test/fixtures/products.yml +110904 -0
- data/test/fixtures/purchases.yml +1755 -0
- data/test/fixtures/suppliers.yml +341 -0
- data/todo +8 -0
- metadata +607 -0
data/config/routes.rb
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
OfficeClerk::Application.routes.draw do
|
2
|
+
resources :shops
|
3
|
+
|
4
|
+
root :to => 'shop#group'
|
5
|
+
|
6
|
+
get "sign_out" => "sessions#destroy", :as => "sign_out"
|
7
|
+
get "sign_in" => "sessions#new", :as => "sign_in"
|
8
|
+
get "sign_up" => "sessios#new_clerk", :as => "sign_up"
|
9
|
+
# root :to => "clerks#new"
|
10
|
+
|
11
|
+
resources :sessions do
|
12
|
+
member do
|
13
|
+
get :new_clerk
|
14
|
+
get :create_clerk
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
resources :purchases do
|
19
|
+
collection do
|
20
|
+
match "search" => "purchases#index", :via => [:get, :post]
|
21
|
+
end
|
22
|
+
member do
|
23
|
+
get :order
|
24
|
+
get :receive
|
25
|
+
get :inventory
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
resources :baskets do
|
30
|
+
collection do
|
31
|
+
match "search" => "baskets#index", :via => [:get, :post]
|
32
|
+
end
|
33
|
+
member do
|
34
|
+
get :discount
|
35
|
+
post :ean
|
36
|
+
get :order
|
37
|
+
get :purchase
|
38
|
+
get :checkout
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
resources :orders do
|
43
|
+
collection do
|
44
|
+
match "search" => "orders#index", :via => [:get, :post]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
resources :items do
|
49
|
+
collection do
|
50
|
+
match "search" => "items#index", :via => [:get, :post]
|
51
|
+
end
|
52
|
+
member do
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
resources :categories do
|
57
|
+
collection do
|
58
|
+
match "search" => "categories#index", :via => [:get, :post]
|
59
|
+
end
|
60
|
+
member do
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
resources :products do
|
65
|
+
collection do
|
66
|
+
match "search" => "products#index", :via => [:get, :post]
|
67
|
+
end
|
68
|
+
member do
|
69
|
+
get :delete
|
70
|
+
get :barcode #print the barcode and price on a 50x25 mm area
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
resources :clerks do
|
75
|
+
collection do
|
76
|
+
match "search" => "clerks#index", :via => [:get, :post]
|
77
|
+
end
|
78
|
+
member do
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
resources :addresses do
|
83
|
+
collection do
|
84
|
+
match "search" => "addresses#index", :via => [:get, :post]
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
resources :suppliers do
|
89
|
+
collection do
|
90
|
+
match "search" => "suppliers#index", :via => [:get, :post]
|
91
|
+
end
|
92
|
+
member do
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
#shop
|
97
|
+
get 'group/:link' => 'shop#group', :as => :shop_group
|
98
|
+
get 'prod/:link' => 'shop#product', :as => :shop_product
|
99
|
+
get 'page/:id' => 'shop#page', :as => :shop_page
|
100
|
+
match 'cart/add/:id' => 'shop#add', :as => :cart_add , :via => [:get,:post]
|
101
|
+
get 'cart/remove/:id' => 'shop#remove', :as => :cart_remove
|
102
|
+
get 'welcome' => 'shop#welcome', :as => :shop_welcome
|
103
|
+
get 'cart/order/:id' => 'shop#order', :as => :shop_order
|
104
|
+
match 'cart/checkout' => 'shop#checkout', :as => :shop_checkout , :via => [:get,:post]
|
105
|
+
|
106
|
+
get "/404", :to => "application#error"
|
107
|
+
|
108
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Clerks < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table(:clerks) do |t|
|
4
|
+
t.string :email, :null => false, :default => ""
|
5
|
+
t.boolean :admin , :default => false
|
6
|
+
t.string :encrypted_password
|
7
|
+
t.string :password_salt
|
8
|
+
|
9
|
+
#this is a json attribute, so anything can be added to the class easily
|
10
|
+
t.string :address
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
add_index :clerks, :email, :unique => true
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class Categories < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :categories do |t|
|
4
|
+
t.references :category
|
5
|
+
t.boolean :online, :default => false
|
6
|
+
t.string :name
|
7
|
+
t.string :description
|
8
|
+
t.integer :position , :default => 1
|
9
|
+
t.string :link
|
10
|
+
t.attachment :main_picture
|
11
|
+
t.attachment :extra_picture
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
add_index :categories, :link, :unique => true
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class Items < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :items do |t|
|
4
|
+
t.integer :quantity , :default => 1
|
5
|
+
t.float :price , :default => 0
|
6
|
+
t.float :tax , :default => 0
|
7
|
+
t.string :name
|
8
|
+
t.references :product
|
9
|
+
t.references :basket
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Orders < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :orders do |t|
|
4
|
+
t.string :number
|
5
|
+
t.string :email
|
6
|
+
t.date :ordered_on
|
7
|
+
t.date :paid_on
|
8
|
+
t.date :canceled_on
|
9
|
+
t.date :shipped_on
|
10
|
+
t.string :payment_type
|
11
|
+
t.string :payment_info
|
12
|
+
t.string :shipment_type
|
13
|
+
t.string :shipment_info
|
14
|
+
t.float :shipment_price , :default => 0
|
15
|
+
t.float :shipment_tax , :default => 0
|
16
|
+
t.string :address
|
17
|
+
|
18
|
+
t.timestamps
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class Baskets < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :baskets do |t|
|
4
|
+
t.integer :kori_id
|
5
|
+
t.string :kori_type
|
6
|
+
t.decimal :total_price , :default => 0.0
|
7
|
+
t.decimal :total_tax , :default => 0.0
|
8
|
+
t.date :locked
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class Products < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :products do |t|
|
4
|
+
t.float :price , :null => false
|
5
|
+
t.string :name , :null => false
|
6
|
+
t.string :link
|
7
|
+
t.text :description
|
8
|
+
t.attachment :main_picture
|
9
|
+
t.attachment :extra_picture
|
10
|
+
t.boolean :online , :default => false
|
11
|
+
t.float :cost , :default => 0.0
|
12
|
+
t.float :weight , :default => 0.1
|
13
|
+
t.string :ean, :default => ""
|
14
|
+
t.float :tax, :default => 0.0
|
15
|
+
t.integer :inventory , :default => 0
|
16
|
+
t.integer :stock_level , :default => 0
|
17
|
+
t.string :properties, :default => ""
|
18
|
+
t.string :scode, :default => ""
|
19
|
+
t.date :deleted_on
|
20
|
+
t.references :product, index: true
|
21
|
+
t.references :category, index: true
|
22
|
+
t.references :supplier, index: true
|
23
|
+
t.timestamps
|
24
|
+
end
|
25
|
+
add_index :products, :link
|
26
|
+
end
|
27
|
+
end
|
data/db/schema.rb
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20131226151332) do
|
15
|
+
|
16
|
+
create_table "baskets", force: true do |t|
|
17
|
+
t.integer "kori_id"
|
18
|
+
t.string "kori_type"
|
19
|
+
t.decimal "total_price", default: 0.0
|
20
|
+
t.decimal "total_tax", default: 0.0
|
21
|
+
t.date "locked"
|
22
|
+
t.datetime "created_at"
|
23
|
+
t.datetime "updated_at"
|
24
|
+
end
|
25
|
+
|
26
|
+
create_table "categories", force: true do |t|
|
27
|
+
t.integer "category_id"
|
28
|
+
t.boolean "online", default: false
|
29
|
+
t.string "name"
|
30
|
+
t.string "description"
|
31
|
+
t.integer "position", default: 1
|
32
|
+
t.string "link"
|
33
|
+
t.string "main_picture_file_name"
|
34
|
+
t.string "main_picture_content_type"
|
35
|
+
t.integer "main_picture_file_size"
|
36
|
+
t.datetime "main_picture_updated_at"
|
37
|
+
t.string "extra_picture_file_name"
|
38
|
+
t.string "extra_picture_content_type"
|
39
|
+
t.integer "extra_picture_file_size"
|
40
|
+
t.datetime "extra_picture_updated_at"
|
41
|
+
t.datetime "created_at"
|
42
|
+
t.datetime "updated_at"
|
43
|
+
end
|
44
|
+
|
45
|
+
add_index "categories", ["link"], name: "index_categories_on_link", unique: true
|
46
|
+
|
47
|
+
create_table "clerks", force: true do |t|
|
48
|
+
t.string "email", default: "", null: false
|
49
|
+
t.boolean "admin", default: false
|
50
|
+
t.string "encrypted_password"
|
51
|
+
t.string "password_salt"
|
52
|
+
t.string "address"
|
53
|
+
t.datetime "created_at"
|
54
|
+
t.datetime "updated_at"
|
55
|
+
end
|
56
|
+
|
57
|
+
add_index "clerks", ["email"], name: "index_clerks_on_email", unique: true
|
58
|
+
|
59
|
+
create_table "items", force: true do |t|
|
60
|
+
t.integer "quantity", default: 1
|
61
|
+
t.float "price", default: 0.0
|
62
|
+
t.float "tax", default: 0.0
|
63
|
+
t.string "name"
|
64
|
+
t.integer "product_id"
|
65
|
+
t.integer "basket_id"
|
66
|
+
t.datetime "created_at"
|
67
|
+
t.datetime "updated_at"
|
68
|
+
end
|
69
|
+
|
70
|
+
create_table "orders", force: true do |t|
|
71
|
+
t.string "number"
|
72
|
+
t.string "email"
|
73
|
+
t.date "ordered_on"
|
74
|
+
t.date "paid_on"
|
75
|
+
t.date "canceled_on"
|
76
|
+
t.date "shipped_on"
|
77
|
+
t.string "payment_type"
|
78
|
+
t.string "payment_info"
|
79
|
+
t.string "shipment_type"
|
80
|
+
t.string "shipment_info"
|
81
|
+
t.float "shipment_price", default: 0.0
|
82
|
+
t.float "shipment_tax", default: 0.0
|
83
|
+
t.string "address"
|
84
|
+
t.datetime "created_at"
|
85
|
+
t.datetime "updated_at"
|
86
|
+
end
|
87
|
+
|
88
|
+
create_table "products", force: true do |t|
|
89
|
+
t.float "price", null: false
|
90
|
+
t.string "name", null: false
|
91
|
+
t.string "link"
|
92
|
+
t.text "description"
|
93
|
+
t.string "main_picture_file_name"
|
94
|
+
t.string "main_picture_content_type"
|
95
|
+
t.integer "main_picture_file_size"
|
96
|
+
t.datetime "main_picture_updated_at"
|
97
|
+
t.string "extra_picture_file_name"
|
98
|
+
t.string "extra_picture_content_type"
|
99
|
+
t.integer "extra_picture_file_size"
|
100
|
+
t.datetime "extra_picture_updated_at"
|
101
|
+
t.boolean "online", default: false
|
102
|
+
t.float "cost", default: 0.0
|
103
|
+
t.float "weight", default: 0.1
|
104
|
+
t.string "ean", default: ""
|
105
|
+
t.float "tax", default: 0.0
|
106
|
+
t.integer "inventory", default: 0
|
107
|
+
t.integer "stock_level", default: 0
|
108
|
+
t.string "properties", default: ""
|
109
|
+
t.string "scode", default: ""
|
110
|
+
t.date "deleted_on"
|
111
|
+
t.integer "product_id"
|
112
|
+
t.integer "category_id"
|
113
|
+
t.integer "supplier_id"
|
114
|
+
t.datetime "created_at"
|
115
|
+
t.datetime "updated_at"
|
116
|
+
end
|
117
|
+
|
118
|
+
add_index "products", ["category_id"], name: "index_products_on_category_id"
|
119
|
+
add_index "products", ["link"], name: "index_products_on_link"
|
120
|
+
add_index "products", ["product_id"], name: "index_products_on_product_id"
|
121
|
+
add_index "products", ["supplier_id"], name: "index_products_on_supplier_id"
|
122
|
+
|
123
|
+
create_table "purchases", force: true do |t|
|
124
|
+
t.string "name"
|
125
|
+
t.date "ordered_on"
|
126
|
+
t.date "received_on"
|
127
|
+
t.datetime "created_at"
|
128
|
+
t.datetime "updated_at"
|
129
|
+
end
|
130
|
+
|
131
|
+
create_table "suppliers", force: true do |t|
|
132
|
+
t.string "supplier_name"
|
133
|
+
t.string "address"
|
134
|
+
t.datetime "created_at"
|
135
|
+
t.datetime "updated_at"
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
data/db/seeds.rb
ADDED
data/lib/assets/.keep
ADDED
File without changes
|
data/lib/office_clerk.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require "haml"
|
2
|
+
require "jquery-rails"
|
3
|
+
require "jquery-ui-rails"
|
4
|
+
require "kramdown"
|
5
|
+
require "will_paginate"
|
6
|
+
|
7
|
+
require 'simple_form'
|
8
|
+
require "prawn"
|
9
|
+
require 'will_paginate-bootstrap'
|
10
|
+
require 'bootstrap-sass'
|
11
|
+
require 'bootstrap_form'
|
12
|
+
require "paperclip"
|
13
|
+
require 'turbolinks'
|
14
|
+
require 'rails-i18n'
|
15
|
+
|
16
|
+
require "barby"
|
17
|
+
require "chunky_png"
|
18
|
+
require "bcrypt"
|
19
|
+
|
20
|
+
require "office_clerk/shipping_method"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module OfficeClerk
|
2
|
+
class ShippingMethod
|
3
|
+
def initialize data
|
4
|
+
@data = data
|
5
|
+
@name = @data[:name]
|
6
|
+
@type = @data[:type]
|
7
|
+
@description = @data[:description]
|
8
|
+
end
|
9
|
+
attr_reader :data , :name , :type
|
10
|
+
|
11
|
+
def price_for(basket)
|
12
|
+
raise "Not implemented in #{self}"
|
13
|
+
end
|
14
|
+
@@methods = nil
|
15
|
+
def self.all
|
16
|
+
return @@methods if @@methods
|
17
|
+
@@methods = {}
|
18
|
+
config = OfficeClerk.config(:shipping)
|
19
|
+
config.each do |key , method|
|
20
|
+
clas_name = method[:class]
|
21
|
+
clas = clas_name.constantize
|
22
|
+
@@methods[key] = clas.new( method.merge(:type => key) )
|
23
|
+
end
|
24
|
+
@@methods
|
25
|
+
end
|
26
|
+
end
|
27
|
+
class Pickup < ShippingMethod
|
28
|
+
def initialize data
|
29
|
+
super(data)
|
30
|
+
end
|
31
|
+
def price_for(basket)
|
32
|
+
0
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|