vyapari 0.1.4 → 0.1.5dev
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/vyapari/sample_stock_bundle.csv +1 -0
- data/app/controllers/vyapari/admin/base_controller.rb +10 -0
- data/app/controllers/vyapari/admin/brands_controller.rb +99 -0
- data/app/controllers/vyapari/admin/categories_controller.rb +115 -0
- data/app/controllers/vyapari/admin/countries_controller.rb +2 -2
- data/app/controllers/vyapari/admin/dashboard_controller.rb +3 -1
- data/app/controllers/vyapari/admin/exchange_rates_controller.rb +2 -2
- data/app/controllers/vyapari/admin/products_controller.rb +79 -0
- data/app/controllers/vyapari/admin/regions_controller.rb +1 -1
- data/app/controllers/vyapari/admin/resource_controller.rb +1 -0
- data/app/controllers/vyapari/admin/stores_controller.rb +67 -0
- data/app/controllers/vyapari/admin/suppliers_controller.rb +67 -0
- data/app/controllers/vyapari/admin/terminals_controller.rb +150 -0
- data/app/controllers/vyapari/application_controller.rb +12 -0
- data/app/controllers/vyapari/store_manager/base_controller.rb +28 -0
- data/app/controllers/vyapari/store_manager/dashboard_controller.rb +30 -0
- data/app/controllers/vyapari/store_manager/resource_controller.rb +17 -0
- data/app/controllers/vyapari/store_manager/stock_bundles_controller.rb +206 -0
- data/app/controllers/vyapari/store_manager/stock_entries_controller.rb +161 -0
- data/app/controllers/vyapari/terminal_staff/base_controller.rb +29 -0
- data/app/controllers/vyapari/terminal_staff/dashboard_controller.rb +29 -0
- data/app/controllers/vyapari/terminal_staff/invoices_controller.rb +138 -0
- data/app/controllers/vyapari/terminal_staff/line_items_controller.rb +123 -0
- data/app/controllers/vyapari/terminal_staff/resource_controller.rb +17 -0
- data/app/controllers/vyapari/user_dashboard_controller.rb +31 -0
- data/app/models/brand.rb +63 -10
- data/app/models/category.rb +60 -16
- data/app/models/country.rb +27 -5
- data/app/models/exchange_rate.rb +31 -6
- data/app/models/image/brand_image.rb +3 -0
- data/app/models/image/category_image.rb +3 -0
- data/app/models/image/product_image.rb +3 -0
- data/app/models/invoice.rb +223 -0
- data/app/models/line_item.rb +206 -0
- data/app/models/product.rb +67 -13
- data/app/models/region.rb +26 -3
- data/app/models/stock_bundle.rb +249 -0
- data/app/models/stock_entry.rb +271 -0
- data/app/models/store.rb +216 -0
- data/app/models/supplier.rb +85 -0
- data/app/models/terminal.rb +158 -0
- data/app/models/vyapari/application_record.rb +4 -0
- data/app/uploaders/brand_image_uploader.rb +14 -0
- data/app/uploaders/category_image_uploader.rb +14 -0
- data/app/uploaders/product_image_uploader.rb +14 -0
- data/app/uploaders/stock_bundle_uploader.rb +10 -0
- data/app/views/layouts/kuppayam/_footer.html.erb +1 -1
- data/app/views/layouts/kuppayam/_sidebar.html.erb +45 -44
- data/app/views/layouts/vyapari/_store_manager_menu.html.erb +107 -0
- data/app/views/layouts/vyapari/_terminal_staff_menu.html.erb +103 -0
- data/app/views/layouts/vyapari/store_manager.html.erb +112 -0
- data/app/views/layouts/vyapari/terminal_staff.html.erb +116 -0
- data/app/views/vyapari/admin/brands/_form.html.erb +23 -0
- data/app/views/vyapari/admin/brands/_index.html.erb +89 -0
- data/app/views/vyapari/admin/brands/_row.html.erb +63 -0
- data/app/views/vyapari/admin/brands/_show.html.erb +104 -0
- data/app/views/vyapari/admin/brands/index.html.erb +48 -0
- data/app/views/vyapari/admin/categories/_form.html.erb +28 -0
- data/app/views/vyapari/admin/categories/_index.html.erb +101 -0
- data/app/views/vyapari/admin/categories/_row.html.erb +69 -0
- data/app/views/vyapari/admin/categories/_show.html.erb +115 -0
- data/app/views/vyapari/admin/{users → categories}/index.html.erb +8 -24
- data/app/views/vyapari/admin/countries/_index.html.erb +1 -1
- data/app/views/vyapari/admin/countries/index.html.erb +19 -3
- data/app/views/vyapari/admin/exchange_rates/_form.html.erb +3 -4
- data/app/views/vyapari/admin/exchange_rates/_index.html.erb +7 -7
- data/app/views/vyapari/admin/exchange_rates/_row.html.erb +3 -3
- data/app/views/vyapari/admin/exchange_rates/_show.html.erb +1 -0
- data/app/views/vyapari/admin/exchange_rates/index.html.erb +19 -3
- data/app/views/vyapari/admin/products/_form.html.erb +32 -0
- data/app/views/vyapari/admin/products/_index.html.erb +58 -0
- data/app/views/vyapari/admin/products/_row.html.erb +30 -0
- data/app/views/vyapari/admin/products/_show.html.erb +81 -0
- data/app/views/vyapari/admin/products/index.html.erb +48 -0
- data/app/views/vyapari/admin/regions/_index.html.erb +1 -1
- data/app/views/vyapari/admin/regions/index.html.erb +19 -3
- data/app/views/vyapari/admin/stores/_form.html.erb +37 -0
- data/app/views/vyapari/admin/stores/_index.html.erb +84 -0
- data/app/views/vyapari/admin/stores/_row.html.erb +55 -0
- data/app/views/vyapari/admin/stores/_show.html.erb +110 -0
- data/app/views/vyapari/admin/stores/index.html.erb +48 -0
- data/app/views/vyapari/admin/suppliers/_form.html.erb +32 -0
- data/app/views/vyapari/admin/suppliers/_index.html.erb +58 -0
- data/app/views/vyapari/admin/suppliers/_row.html.erb +30 -0
- data/app/views/vyapari/admin/suppliers/_show.html.erb +81 -0
- data/app/views/vyapari/admin/suppliers/index.html.erb +48 -0
- data/app/views/vyapari/admin/terminals/_form.html.erb +24 -0
- data/app/views/vyapari/admin/terminals/_index.html.erb +75 -0
- data/app/views/vyapari/admin/terminals/_row.html.erb +49 -0
- data/app/views/vyapari/admin/terminals/_show.html.erb +74 -0
- data/app/views/vyapari/store_manager/dashboard/index.html.erb +93 -0
- data/app/views/vyapari/store_manager/stock_bundles/_form.html.erb +99 -0
- data/app/views/vyapari/store_manager/stock_bundles/_index.html.erb +74 -0
- data/app/views/vyapari/store_manager/stock_bundles/_row.html.erb +44 -0
- data/app/views/vyapari/store_manager/stock_bundles/_show.html.erb +110 -0
- data/app/views/vyapari/store_manager/stock_bundles/create.html.erb +57 -0
- data/app/views/vyapari/store_manager/stock_bundles/index.html.erb +36 -0
- data/app/views/vyapari/store_manager/stock_bundles/update.html.erb +57 -0
- data/app/views/vyapari/store_manager/stock_entries/_form.html.erb +50 -0
- data/app/views/vyapari/store_manager/stock_entries/_index.html.erb +80 -0
- data/app/views/vyapari/store_manager/stock_entries/_row.html.erb +33 -0
- data/app/views/vyapari/store_manager/stock_entries/_show.html.erb +110 -0
- data/app/views/vyapari/store_manager/stock_entries/_stock_bundle.html.erb +61 -0
- data/app/views/vyapari/store_manager/stock_entries/index.html.erb +45 -0
- data/app/views/vyapari/terminal_staff/dashboard/_counts.html.erb +88 -0
- data/app/views/vyapari/terminal_staff/dashboard/_invoices.html.erb +37 -0
- data/app/views/vyapari/terminal_staff/dashboard/index.html.erb +36 -0
- data/app/views/vyapari/terminal_staff/invoices/_draft.html.erb +62 -0
- data/app/views/vyapari/terminal_staff/invoices/_form.html.erb +120 -0
- data/app/views/vyapari/terminal_staff/invoices/_index.html.erb +64 -0
- data/app/views/vyapari/terminal_staff/invoices/_row.html.erb +33 -0
- data/app/views/vyapari/terminal_staff/invoices/_show.html.erb +171 -0
- data/app/views/vyapari/terminal_staff/invoices/index.html.erb +37 -0
- data/app/views/vyapari/terminal_staff/invoices/new.js.erb +13 -0
- data/app/views/vyapari/terminal_staff/invoices/show.html.erb +1 -0
- data/app/views/vyapari/terminal_staff/line_items/_form.html.erb +40 -0
- data/app/views/vyapari/terminal_staff/line_items/_index.html.erb +94 -0
- data/app/views/vyapari/terminal_staff/line_items/create.js.erb +34 -0
- data/app/views/vyapari/terminal_staff/line_items/destroy.js.erb +25 -0
- data/app/views/vyapari/terminal_staff/stores/index.html.erb +24 -0
- data/app/views/vyapari/user_dashboard/index.html.erb +51 -0
- data/config/routes.rb +62 -5
- data/db/import_data/brands.csv +7 -0
- data/db/import_data/categories.csv +12 -0
- data/db/import_data/countries.csv +1 -0
- data/db/import_data/dummy/brands.csv +7 -0
- data/db/import_data/dummy/categories.csv +12 -0
- data/db/import_data/dummy/countries.csv +1 -0
- data/db/import_data/dummy/exchange_rates.csv +5 -0
- data/db/import_data/dummy/products-copy.csv +1 -0
- data/db/import_data/dummy/products.csv +1 -0
- data/db/import_data/dummy/products.xlsx +0 -0
- data/db/import_data/dummy/regions.csv +13 -0
- data/db/import_data/dummy/stores.csv +10 -0
- data/db/import_data/dummy/suppliers.csv +14 -0
- data/db/import_data/dummy/terminals.csv +11 -0
- data/db/import_data/exchange_rates.csv +5 -0
- data/db/import_data/regions.csv +13 -0
- data/db/import_data/stores.csv +3 -0
- data/db/import_data/suppliers.csv +14 -0
- data/db/import_data/terminals.csv +3 -0
- data/db/migrate/20170000000200_create_exchange_rates.rb +3 -2
- data/db/migrate/20170000000203_create_contacts.rb +22 -0
- data/db/migrate/20170000000204_create_bank_accounts.rb +21 -0
- data/db/migrate/20170000000205_create_suppliers.rb +18 -0
- data/db/migrate/20170000000206_create_stores.rb +21 -0
- data/db/migrate/20170000000207_create_terminals.rb +18 -0
- data/db/migrate/20170000000210_create_brands.rb +14 -0
- data/db/migrate/20170000000211_create_categories.rb +22 -0
- data/db/migrate/20170000000212_create_products.rb +29 -0
- data/db/migrate/20170000000213_create_invoices.rb +58 -0
- data/db/migrate/20170000000215_create_stock_bundles.rb +17 -0
- data/db/migrate/20170000000216_create_stock_entries.rb +20 -0
- data/db/sample_reports/products.xlsx +0 -0
- data/lib/tasks/vyapari/all.rake +73 -0
- data/lib/vyapari/version.rb +1 -1
- metadata +150 -15
- data/app/controllers/vyapari/admin/users_controller.rb +0 -130
- data/app/views/vyapari/admin/users/_form.html.erb +0 -39
- data/app/views/vyapari/admin/users/_index.html.erb +0 -101
- data/app/views/vyapari/admin/users/_row.html.erb +0 -72
- data/app/views/vyapari/admin/users/_show.html.erb +0 -199
- data/lib/tasks/vyapari_tasks.rake +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56fe1df91f52bb3ed89982d4cb830559e644e533
|
4
|
+
data.tar.gz: aab510fe1843cdbc11a1f11ef3484fbb6a0aa1e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88d2f8f5a3f5cafa70451be2803b671f66d8c6329eb3496d1391b349c831bc22367fb7c0d34bef82b0aa99013283a63513ac03b3d1e1d8aa4000cbc60be08f67
|
7
|
+
data.tar.gz: 599c9c17dd2ede4b63ba96e7cc567be98d11f3d6643403800f534adad16e913dde080c65158100b43e0eed6e91e98d22db81d11ad776b2afb909ee5712b465b9
|
@@ -0,0 +1 @@
|
|
1
|
+
name ean_sku reference_number one_liner description brand category purchased_price landing_price selling_price retail_price quantity
|
@@ -5,12 +5,22 @@ module Vyapari
|
|
5
5
|
layout 'kuppayam/admin'
|
6
6
|
|
7
7
|
before_action :require_user
|
8
|
+
before_action :require_site_admin
|
8
9
|
|
9
10
|
private
|
10
11
|
|
11
12
|
def set_default_title
|
12
13
|
set_title("Vyapari Admin | Vyapari Stock Management Module")
|
13
14
|
end
|
15
|
+
|
16
|
+
def require_site_admin
|
17
|
+
unless @current_user.has_role?("Site Admin")
|
18
|
+
text = "#{I18n.t("authentication.permission_denied.heading")}: #{I18n.t("authentication.permission_denied.message")}"
|
19
|
+
set_flash_message(text, :error, false) if defined?(flash) && flash
|
20
|
+
redirect_to default_redirect_url_after_sign_in
|
21
|
+
end
|
22
|
+
#binding.pry
|
23
|
+
end
|
14
24
|
|
15
25
|
end
|
16
26
|
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
module Vyapari
|
2
|
+
module Admin
|
3
|
+
class BrandsController < ResourceController
|
4
|
+
|
5
|
+
def mark_as_featured
|
6
|
+
@brand = @r_object = Brand.find(params[:id])
|
7
|
+
if @brand
|
8
|
+
@brand.featured = true
|
9
|
+
if @brand.valid?
|
10
|
+
@brand.save
|
11
|
+
set_notification(true, I18n.t('status.success'), I18n.t('state.changed', item: default_item_name.titleize, new_state: "featured"))
|
12
|
+
else
|
13
|
+
set_notification(false, I18n.t('status.error'), I18n.translate("error"), @brand.errors.full_messages.join("<br>"))
|
14
|
+
end
|
15
|
+
else
|
16
|
+
set_notification(false, I18n.t('status.not_found'), I18n.t('status.not_found', item: default_item_name.titleize))
|
17
|
+
end
|
18
|
+
render_row
|
19
|
+
end
|
20
|
+
|
21
|
+
def remove_from_featured
|
22
|
+
@brand = @r_object = Brand.find(params[:id])
|
23
|
+
if @brand
|
24
|
+
@brand.featured = false
|
25
|
+
if @brand.valid?
|
26
|
+
@brand.save
|
27
|
+
set_notification(true, I18n.t('status.success'), I18n.t('state.changed', item: default_item_name.titleize, new_state: "featured"))
|
28
|
+
else
|
29
|
+
set_notification(false, I18n.t('status.error'), I18n.translate("error"), @brand.errors.full_messages.join("<br>"))
|
30
|
+
end
|
31
|
+
else
|
32
|
+
set_notification(false, I18n.t('status.not_found'), I18n.t('status.not_found', item: default_item_name.titleize))
|
33
|
+
end
|
34
|
+
render_row
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def get_collections
|
40
|
+
@relation = Brand.where("")
|
41
|
+
|
42
|
+
parse_filters
|
43
|
+
apply_filters
|
44
|
+
|
45
|
+
@brands = @r_objects = @relation.page(@current_page).per(@per_page)
|
46
|
+
|
47
|
+
return true
|
48
|
+
end
|
49
|
+
|
50
|
+
def apply_filters
|
51
|
+
@relation = @relation.search(@query) if @query
|
52
|
+
|
53
|
+
@order_by = "priority DESC, name ASC" unless @order_by
|
54
|
+
@relation = @relation.order(@order_by)
|
55
|
+
end
|
56
|
+
|
57
|
+
def configure_filter_settings
|
58
|
+
@filter_settings = {
|
59
|
+
string_filters: [
|
60
|
+
{ filter_name: :query }
|
61
|
+
],
|
62
|
+
boolean_filters: [],
|
63
|
+
reference_filters: [],
|
64
|
+
variable_filters: [],
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
def configure_filter_ui_settings
|
69
|
+
@filter_ui_settings = {}
|
70
|
+
end
|
71
|
+
|
72
|
+
def resource_controller_configuration
|
73
|
+
{
|
74
|
+
page_title: "Brands",
|
75
|
+
js_view_path: "/kuppayam/workflows/parrot",
|
76
|
+
view_path: "/vyapari/admin/brands"
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
def breadcrumbs_configuration
|
81
|
+
{
|
82
|
+
heading: "Manage Brands",
|
83
|
+
description: "Listing all Brands",
|
84
|
+
links: [{name: "Home", link: admin_dashboard_path, icon: 'fa-home'},
|
85
|
+
{name: "Manage Brands", link: admin_brands_path, icon: 'fa-calendar', active: true}]
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
def permitted_params
|
90
|
+
params.require(:brand).permit(:name, :featured, :status)
|
91
|
+
end
|
92
|
+
|
93
|
+
def set_navs
|
94
|
+
set_nav("admin/brands")
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
module Vyapari
|
2
|
+
module Admin
|
3
|
+
class CategoriesController < ResourceController
|
4
|
+
|
5
|
+
def make_parent
|
6
|
+
@category = @r_object = Category.find(params[:id])
|
7
|
+
if @category
|
8
|
+
@category.parent = nil
|
9
|
+
if @category.valid?
|
10
|
+
@category.save
|
11
|
+
set_notification(true, I18n.t('status.success'), I18n.t('state.changed', item: default_item_name.titleize, new_state: "made as parent"))
|
12
|
+
else
|
13
|
+
set_notification(false, I18n.t('status.error'), I18n.translate("error"), @category.errors.full_messages.join("<br>"))
|
14
|
+
end
|
15
|
+
else
|
16
|
+
set_notification(false, I18n.t('status.not_found'), I18n.t('status.not_found', item: default_item_name.titleize))
|
17
|
+
end
|
18
|
+
render_row
|
19
|
+
end
|
20
|
+
|
21
|
+
def mark_as_featured
|
22
|
+
@category = @r_object = Category.find(params[:id])
|
23
|
+
if @category
|
24
|
+
@category.featured = true
|
25
|
+
if @category.valid?
|
26
|
+
@category.save
|
27
|
+
set_notification(true, I18n.t('status.success'), I18n.t('state.changed', item: default_item_name.titleize, new_state: "featured"))
|
28
|
+
else
|
29
|
+
set_notification(false, I18n.t('status.error'), I18n.translate("error"), @category.errors.full_messages.join("<br>"))
|
30
|
+
end
|
31
|
+
else
|
32
|
+
set_notification(false, I18n.t('status.not_found'), I18n.t('status.not_found', item: default_item_name.titleize))
|
33
|
+
end
|
34
|
+
render_row
|
35
|
+
end
|
36
|
+
|
37
|
+
def remove_from_featured
|
38
|
+
@category = @r_object = Brand.find(params[:id])
|
39
|
+
if @category
|
40
|
+
@category.featured = false
|
41
|
+
if @category.valid?
|
42
|
+
@category.save
|
43
|
+
set_notification(true, I18n.t('status.success'), I18n.t('state.changed', item: default_item_name.titleize, new_state: "featured"))
|
44
|
+
else
|
45
|
+
set_notification(false, I18n.t('status.error'), I18n.translate("error"), @category.errors.full_messages.join("<br>"))
|
46
|
+
end
|
47
|
+
else
|
48
|
+
set_notification(false, I18n.t('status.not_found'), I18n.t('status.not_found', item: default_item_name.titleize))
|
49
|
+
end
|
50
|
+
render_row
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def get_collections
|
56
|
+
@relation = Category.includes(:parent).where("")
|
57
|
+
|
58
|
+
parse_filters
|
59
|
+
apply_filters
|
60
|
+
|
61
|
+
@categories = @r_objects = @relation.page(@current_page).per(@per_page)
|
62
|
+
|
63
|
+
return true
|
64
|
+
end
|
65
|
+
|
66
|
+
def apply_filters
|
67
|
+
@relation = @relation.search(@query) if @query
|
68
|
+
|
69
|
+
@order_by = "parent_id ASC, priority DESC, name ASC" unless @order_by
|
70
|
+
@relation = @relation.order(@order_by)
|
71
|
+
end
|
72
|
+
|
73
|
+
def configure_filter_settings
|
74
|
+
@filter_settings = {
|
75
|
+
string_filters: [
|
76
|
+
{ filter_name: :query }
|
77
|
+
],
|
78
|
+
boolean_filters: [],
|
79
|
+
reference_filters: [],
|
80
|
+
variable_filters: [],
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
def configure_filter_ui_settings
|
85
|
+
@filter_ui_settings = {}
|
86
|
+
end
|
87
|
+
|
88
|
+
def resource_controller_configuration
|
89
|
+
{
|
90
|
+
page_title: "Categories",
|
91
|
+
js_view_path: "/kuppayam/workflows/parrot",
|
92
|
+
view_path: "/vyapari/admin/categories"
|
93
|
+
}
|
94
|
+
end
|
95
|
+
|
96
|
+
def breadcrumbs_configuration
|
97
|
+
{
|
98
|
+
heading: "Manage Categories",
|
99
|
+
description: "Listing all Categories",
|
100
|
+
links: [{name: "Home", link: admin_dashboard_path, icon: 'fa-home'},
|
101
|
+
{name: "Manage Categories", link: admin_categories_path, icon: 'fa-calendar', active: true}]
|
102
|
+
}
|
103
|
+
end
|
104
|
+
|
105
|
+
def permitted_params
|
106
|
+
params.require(:category).permit(:name, :one_liner, :parent_id, :status, :featured)
|
107
|
+
end
|
108
|
+
|
109
|
+
def set_navs
|
110
|
+
set_nav("admin/categories")
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -18,7 +18,7 @@ module Vyapari
|
|
18
18
|
def apply_filters
|
19
19
|
@relation = @relation.search(@query) if @query
|
20
20
|
|
21
|
-
@order_by = "
|
21
|
+
@order_by = "name ASC" unless @order_by
|
22
22
|
@relation = @relation.order(@order_by)
|
23
23
|
end
|
24
24
|
|
@@ -39,7 +39,7 @@ module Vyapari
|
|
39
39
|
|
40
40
|
def resource_controller_configuration
|
41
41
|
{
|
42
|
-
page_title: "
|
42
|
+
page_title: "Countries",
|
43
43
|
current_nav: "admin/countries",
|
44
44
|
js_view_path: "/kuppayam/workflows/parrot",
|
45
45
|
view_path: "/vyapari/admin/countries"
|
@@ -2,6 +2,8 @@ module Vyapari
|
|
2
2
|
module Admin
|
3
3
|
class DashboardController < Vyapari::Admin::BaseController
|
4
4
|
|
5
|
+
before_action :require_site_admin
|
6
|
+
|
5
7
|
# GET /dashboard
|
6
8
|
def index
|
7
9
|
end
|
@@ -10,7 +12,7 @@ module Vyapari
|
|
10
12
|
|
11
13
|
def breadcrumbs_configuration
|
12
14
|
{
|
13
|
-
heading: "
|
15
|
+
heading: "Admin Dashboard",
|
14
16
|
description: "A Quick view of stocks",
|
15
17
|
links: [{name: "Dashboard", link: admin_dashboard_path, icon: 'fa-dashboard'}]
|
16
18
|
}
|
@@ -39,7 +39,7 @@ module Vyapari
|
|
39
39
|
|
40
40
|
def resource_controller_configuration
|
41
41
|
{
|
42
|
-
page_title: "
|
42
|
+
page_title: "Exchange Rates",
|
43
43
|
collection_name: :exchange_rates,
|
44
44
|
item_name: :exchange_rate,
|
45
45
|
class: ExchangeRate,
|
@@ -58,7 +58,7 @@ module Vyapari
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def permitted_params
|
61
|
-
params.require(:exchange_rate).permit(:
|
61
|
+
params.require(:exchange_rate).permit(:base_currency, :counter_currency, :value, :effective_date)
|
62
62
|
end
|
63
63
|
|
64
64
|
def set_navs
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module Vyapari
|
2
|
+
module Admin
|
3
|
+
class ProductsController < ResourceController
|
4
|
+
|
5
|
+
def mark_as_featured
|
6
|
+
@product = @r_object = Product.find(params[:id])
|
7
|
+
@product.update_attribute(:featured, true) if @product.published?
|
8
|
+
render_row
|
9
|
+
end
|
10
|
+
|
11
|
+
def remove_from_featured
|
12
|
+
@product = @r_object = Product.find(params[:id])
|
13
|
+
@product.update_attribute(:featured, false) if @product.featured?
|
14
|
+
render_row
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def get_collections
|
20
|
+
@relation = Product.where("")
|
21
|
+
|
22
|
+
parse_filters
|
23
|
+
apply_filters
|
24
|
+
|
25
|
+
@products = @r_objects = @relation.page(@current_page).per(@per_page)
|
26
|
+
|
27
|
+
return true
|
28
|
+
end
|
29
|
+
|
30
|
+
def apply_filters
|
31
|
+
@relation = @relation.search(@query) if @query
|
32
|
+
|
33
|
+
@order_by = "priority DESC, name ASC" unless @order_by
|
34
|
+
@relation = @relation.order(@order_by)
|
35
|
+
end
|
36
|
+
|
37
|
+
def configure_filter_settings
|
38
|
+
@filter_settings = {
|
39
|
+
string_filters: [
|
40
|
+
{ filter_name: :query }
|
41
|
+
],
|
42
|
+
boolean_filters: [],
|
43
|
+
reference_filters: [],
|
44
|
+
variable_filters: [],
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
def configure_filter_ui_settings
|
49
|
+
@filter_ui_settings = {}
|
50
|
+
end
|
51
|
+
|
52
|
+
def resource_controller_configuration
|
53
|
+
{
|
54
|
+
page_title: "Products",
|
55
|
+
js_view_path: "/kuppayam/workflows/parrot",
|
56
|
+
view_path: "/vyapari/admin/products"
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
def breadcrumbs_configuration
|
61
|
+
{
|
62
|
+
heading: "Manage Products",
|
63
|
+
description: "Listing all Products",
|
64
|
+
links: [{name: "Home", link: admin_dashboard_path, icon: 'fa-home'},
|
65
|
+
{name: "Manage Products", link: admin_products_path, icon: 'fa-calendar', active: true}]
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
def permitted_params
|
70
|
+
params.require(:product).permit(:name, :one_liner, :ean_sku, :reference_number, :brand_id, :category_id, :status, :featured)
|
71
|
+
end
|
72
|
+
|
73
|
+
def set_navs
|
74
|
+
set_nav("admin/products")
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Vyapari
|
2
|
+
module Admin
|
3
|
+
class StoresController < ResourceController
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def get_collections
|
8
|
+
@relation = Store.where("")
|
9
|
+
|
10
|
+
parse_filters
|
11
|
+
apply_filters
|
12
|
+
|
13
|
+
@stores = @r_objects = @relation.page(@current_page).per(@per_page)
|
14
|
+
|
15
|
+
return true
|
16
|
+
end
|
17
|
+
|
18
|
+
def apply_filters
|
19
|
+
@relation = @relation.search(@query) if @query
|
20
|
+
|
21
|
+
@order_by = "created_at desc" unless @order_by
|
22
|
+
@relation = @relation.order(@order_by)
|
23
|
+
end
|
24
|
+
|
25
|
+
def configure_filter_settings
|
26
|
+
@filter_settings = {
|
27
|
+
string_filters: [
|
28
|
+
{ filter_name: :query }
|
29
|
+
],
|
30
|
+
boolean_filters: [],
|
31
|
+
reference_filters: [],
|
32
|
+
variable_filters: [],
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def configure_filter_ui_settings
|
37
|
+
@filter_ui_settings = {}
|
38
|
+
end
|
39
|
+
|
40
|
+
def resource_controller_configuration
|
41
|
+
{
|
42
|
+
page_title: "Stores",
|
43
|
+
js_view_path: "/kuppayam/workflows/peacock",
|
44
|
+
view_path: "/vyapari/admin/stores"
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
def breadcrumbs_configuration
|
49
|
+
{
|
50
|
+
heading: "Manage Stores",
|
51
|
+
description: "Listing all Stores",
|
52
|
+
links: [{name: "Home", link: admin_dashboard_path, icon: 'fa-home'},
|
53
|
+
{name: "Manage Stores", link: admin_stores_path, icon: 'fa-calendar', active: true}]
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
def permitted_params
|
58
|
+
params.require(:store).permit(:name, :code, :store_type, :region_id, :country_id)
|
59
|
+
end
|
60
|
+
|
61
|
+
def set_navs
|
62
|
+
set_nav("admin/stores")
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Vyapari
|
2
|
+
module Admin
|
3
|
+
class SuppliersController < ResourceController
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def get_collections
|
8
|
+
@relation = Supplier.where("")
|
9
|
+
|
10
|
+
parse_filters
|
11
|
+
apply_filters
|
12
|
+
|
13
|
+
@suppliers = @r_objects = @relation.page(@current_page).per(@per_page)
|
14
|
+
|
15
|
+
return true
|
16
|
+
end
|
17
|
+
|
18
|
+
def apply_filters
|
19
|
+
@relation = @relation.search(@query) if @query
|
20
|
+
|
21
|
+
@order_by = "created_at desc" unless @order_by
|
22
|
+
@relation = @relation.order(@order_by)
|
23
|
+
end
|
24
|
+
|
25
|
+
def configure_filter_settings
|
26
|
+
@filter_settings = {
|
27
|
+
string_filters: [
|
28
|
+
{ filter_name: :query }
|
29
|
+
],
|
30
|
+
boolean_filters: [],
|
31
|
+
reference_filters: [],
|
32
|
+
variable_filters: [],
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def configure_filter_ui_settings
|
37
|
+
@filter_ui_settings = {}
|
38
|
+
end
|
39
|
+
|
40
|
+
def resource_controller_configuration
|
41
|
+
{
|
42
|
+
page_title: "Suppliers",
|
43
|
+
js_view_path: "/kuppayam/workflows/parrot",
|
44
|
+
view_path: "/vyapari/admin/suppliers"
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
def breadcrumbs_configuration
|
49
|
+
{
|
50
|
+
heading: "Manage Suppliers",
|
51
|
+
description: "Listing all Suppliers",
|
52
|
+
links: [{name: "Home", link: admin_dashboard_path, icon: 'fa-home'},
|
53
|
+
{name: "Manage Suppliers", link: admin_suppliers_path, icon: 'fa-calendar', active: true}]
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
def permitted_params
|
58
|
+
params.require(:supplier).permit(:name, :code, :address, :city, :country_id)
|
59
|
+
end
|
60
|
+
|
61
|
+
def set_navs
|
62
|
+
set_nav("admin/suppliers")
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
module Vyapari
|
2
|
+
module Admin
|
3
|
+
class TerminalsController < ResourceController
|
4
|
+
|
5
|
+
before_action :get_store
|
6
|
+
|
7
|
+
def index
|
8
|
+
get_collections
|
9
|
+
respond_to do |format|
|
10
|
+
format.html {}
|
11
|
+
format.js {
|
12
|
+
js_view_path = @resource_options && @resource_options[:js_view_path] ? "#{@resource_options[:js_view_path]}/index" : :index
|
13
|
+
render js_view_path
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def show
|
19
|
+
@terminal = @r_object = @resource_options[:class].find_by_id(params[:id])
|
20
|
+
set_notification(false, I18n.t('status.error'), I18n.t('status.not_found', item: default_item_name.titleize)) unless @r_object
|
21
|
+
render_accordingly
|
22
|
+
end
|
23
|
+
|
24
|
+
def new
|
25
|
+
@terminal = @r_object = @resource_options[:class].new(store: @store)
|
26
|
+
render_accordingly
|
27
|
+
end
|
28
|
+
|
29
|
+
def edit
|
30
|
+
@terminal = @r_object = @resource_options[:class].find_by_id(params[:id])
|
31
|
+
set_notification(false, I18n.t('status.error'), I18n.t('status.not_found', item: default_item_name.titleize)) unless @r_object
|
32
|
+
render_accordingly
|
33
|
+
end
|
34
|
+
|
35
|
+
def create
|
36
|
+
@terminal = @r_object = @resource_options[:class].new(store: @store)
|
37
|
+
@r_object.assign_attributes(permitted_params)
|
38
|
+
save_resource
|
39
|
+
end
|
40
|
+
|
41
|
+
def update
|
42
|
+
@terminal =@r_object = @resource_options[:class].find_by_id(params[:id])
|
43
|
+
if @r_object
|
44
|
+
@r_object.assign_attributes(permitted_params)
|
45
|
+
save_resource
|
46
|
+
else
|
47
|
+
set_notification(false, I18n.t('status.error'), I18n.t('status.not_found', item: default_item_name.titleize))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def destroy
|
52
|
+
@terminal = @r_object = @resource_options[:class].find_by_id(params[:id])
|
53
|
+
if @r_object
|
54
|
+
if @r_object.can_be_deleted?
|
55
|
+
@r_object.destroy
|
56
|
+
get_collections
|
57
|
+
set_flash_message(I18n.t('success.deleted'), :success)
|
58
|
+
set_notification(false, I18n.t('status.success'), I18n.t('success.deleted', item: default_item_name.titleize))
|
59
|
+
@destroyed = true
|
60
|
+
else
|
61
|
+
message = I18n.t('errors.failed_to_delete', item: default_item_name.titleize)
|
62
|
+
set_flash_message(message, :failure)
|
63
|
+
set_notification(false, I18n.t('status.error'), message)
|
64
|
+
@destroyed = false
|
65
|
+
end
|
66
|
+
else
|
67
|
+
set_notification(false, I18n.t('status.error'), I18n.t('status.not_found', item: default_item_name.titleize))
|
68
|
+
end
|
69
|
+
|
70
|
+
respond_to do |format|
|
71
|
+
format.html {}
|
72
|
+
format.js {
|
73
|
+
js_view_path = @resource_options && @resource_options[:js_view_path] ? "#{@resource_options[:js_view_path]}/destroy" : :destroy
|
74
|
+
render js_view_path
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def get_store
|
83
|
+
@store = Store.find_by_id(params[:store_id])
|
84
|
+
end
|
85
|
+
|
86
|
+
def get_collections
|
87
|
+
@relation = @store.terminals.where("")
|
88
|
+
|
89
|
+
parse_filters
|
90
|
+
apply_filters
|
91
|
+
|
92
|
+
@terminals = @r_objects = @relation.page(@current_page).per(@per_page)
|
93
|
+
|
94
|
+
return true
|
95
|
+
end
|
96
|
+
|
97
|
+
def apply_filters
|
98
|
+
@relation = @relation.search(@query) if @query
|
99
|
+
|
100
|
+
@order_by = "created_at desc" unless @order_by
|
101
|
+
@relation = @relation.order(@order_by)
|
102
|
+
end
|
103
|
+
|
104
|
+
def configure_filter_settings
|
105
|
+
@filter_settings = {
|
106
|
+
string_filters: [
|
107
|
+
{ filter_name: :query }
|
108
|
+
],
|
109
|
+
boolean_filters: [],
|
110
|
+
reference_filters: [],
|
111
|
+
variable_filters: [],
|
112
|
+
}
|
113
|
+
end
|
114
|
+
|
115
|
+
def configure_filter_ui_settings
|
116
|
+
@filter_ui_settings = {}
|
117
|
+
end
|
118
|
+
|
119
|
+
def resource_url(obj)
|
120
|
+
url_for([:admin, obj.store, obj])
|
121
|
+
end
|
122
|
+
|
123
|
+
def resource_controller_configuration
|
124
|
+
{
|
125
|
+
page_title: "Terminals",
|
126
|
+
js_view_path: "/kuppayam/workflows/parrot",
|
127
|
+
view_path: "/vyapari/admin/terminals"
|
128
|
+
}
|
129
|
+
end
|
130
|
+
|
131
|
+
def breadcrumbs_configuration
|
132
|
+
{
|
133
|
+
heading: "Manage Terminals",
|
134
|
+
description: "Listing all Terminals",
|
135
|
+
links: [{name: "Home", link: admin_dashboard_path, icon: 'fa-home'},
|
136
|
+
{name: "Manage Stores", link: admin_stores_path, icon: 'fa-calendar', active: true}]
|
137
|
+
}
|
138
|
+
end
|
139
|
+
|
140
|
+
def permitted_params
|
141
|
+
params.require(:terminal).permit(:name, :code)
|
142
|
+
end
|
143
|
+
|
144
|
+
def set_navs
|
145
|
+
set_nav("admin/terminals")
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|