vyapari 0.1.5dev10 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/vyapari/admin/base_controller.rb +0 -9
- data/app/controllers/vyapari/admin/countries_controller.rb +2 -2
- data/app/controllers/vyapari/admin/dashboard_controller.rb +1 -3
- data/app/controllers/vyapari/admin/exchange_rates_controller.rb +2 -2
- data/app/controllers/vyapari/admin/regions_controller.rb +1 -1
- data/app/controllers/vyapari/admin/resource_controller.rb +0 -1
- data/app/controllers/vyapari/admin/users_controller.rb +130 -0
- data/app/controllers/vyapari/application_controller.rb +0 -11
- data/app/models/brand.rb +19 -67
- data/app/models/category.rb +19 -63
- data/app/models/country.rb +7 -31
- data/app/models/exchange_rate.rb +7 -32
- data/app/models/product.rb +20 -75
- data/app/models/region.rb +20 -37
- data/app/models/vyapari/application_record.rb +0 -3
- data/app/views/layouts/kuppayam/_footer.html.erb +1 -1
- data/app/views/layouts/kuppayam/_sidebar.html.erb +44 -45
- data/app/views/vyapari/admin/countries/_index.html.erb +1 -1
- data/app/views/vyapari/admin/countries/index.html.erb +3 -19
- data/app/views/vyapari/admin/exchange_rates/_form.html.erb +4 -3
- 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 +0 -1
- data/app/views/vyapari/admin/exchange_rates/index.html.erb +3 -19
- data/app/views/vyapari/admin/regions/_index.html.erb +1 -1
- data/app/views/vyapari/admin/regions/index.html.erb +3 -19
- data/app/views/vyapari/admin/users/_form.html.erb +39 -0
- data/app/views/vyapari/admin/users/_index.html.erb +101 -0
- data/app/views/vyapari/admin/users/_row.html.erb +72 -0
- data/app/views/vyapari/admin/users/_show.html.erb +199 -0
- data/app/views/vyapari/admin/{categories → users}/index.html.erb +24 -8
- data/config/routes.rb +5 -66
- data/db/migrate/20170000000200_create_exchange_rates.rb +2 -3
- data/lib/tasks/vyapari_tasks.rake +4 -0
- data/lib/vyapari/version.rb +1 -1
- metadata +15 -167
- data/app/assets/images/vyapari/sample_stock_bundle.csv +0 -1
- data/app/controllers/vyapari/admin/brands_controller.rb +0 -99
- data/app/controllers/vyapari/admin/categories_controller.rb +0 -115
- data/app/controllers/vyapari/admin/products_controller.rb +0 -79
- data/app/controllers/vyapari/admin/stores_controller.rb +0 -67
- data/app/controllers/vyapari/admin/suppliers_controller.rb +0 -67
- data/app/controllers/vyapari/admin/terminals_controller.rb +0 -150
- data/app/controllers/vyapari/store_manager/base_controller.rb +0 -33
- data/app/controllers/vyapari/store_manager/dashboard_controller.rb +0 -31
- data/app/controllers/vyapari/store_manager/reports/invoices_controller.rb +0 -249
- data/app/controllers/vyapari/store_manager/reports/sales_controller.rb +0 -299
- data/app/controllers/vyapari/store_manager/reports/stock_controller.rb +0 -132
- data/app/controllers/vyapari/store_manager/resource_controller.rb +0 -17
- data/app/controllers/vyapari/store_manager/stock_bundles_controller.rb +0 -206
- data/app/controllers/vyapari/store_manager/stock_entries_controller.rb +0 -161
- data/app/controllers/vyapari/terminal_staff/base_controller.rb +0 -38
- data/app/controllers/vyapari/terminal_staff/dashboard_controller.rb +0 -35
- data/app/controllers/vyapari/terminal_staff/invoices_controller.rb +0 -147
- data/app/controllers/vyapari/terminal_staff/line_items_controller.rb +0 -139
- data/app/controllers/vyapari/terminal_staff/resource_controller.rb +0 -17
- data/app/controllers/vyapari/user_dashboard_controller.rb +0 -31
- data/app/models/bank_account.rb +0 -44
- data/app/models/contact.rb +0 -72
- data/app/models/image/brand_image.rb +0 -3
- data/app/models/image/category_image.rb +0 -3
- data/app/models/image/product_image.rb +0 -3
- data/app/models/invoice.rb +0 -256
- data/app/models/line_item.rb +0 -207
- data/app/models/stock_bundle.rb +0 -249
- data/app/models/stock_entry.rb +0 -275
- data/app/models/store.rb +0 -302
- data/app/models/supplier.rb +0 -79
- data/app/models/terminal.rb +0 -158
- data/app/uploaders/brand_image_uploader.rb +0 -14
- data/app/uploaders/category_image_uploader.rb +0 -14
- data/app/uploaders/product_image_uploader.rb +0 -14
- data/app/uploaders/stock_bundle_uploader.rb +0 -10
- data/app/views/layouts/vyapari/_store_manager_menu.html.erb +0 -126
- data/app/views/layouts/vyapari/_terminal_staff_menu.html.erb +0 -106
- data/app/views/layouts/vyapari/store_manager.html.erb +0 -112
- data/app/views/layouts/vyapari/terminal_staff.html.erb +0 -116
- data/app/views/vyapari/admin/brands/_form.html.erb +0 -23
- data/app/views/vyapari/admin/brands/_index.html.erb +0 -89
- data/app/views/vyapari/admin/brands/_row.html.erb +0 -63
- data/app/views/vyapari/admin/brands/_show.html.erb +0 -104
- data/app/views/vyapari/admin/brands/index.html.erb +0 -48
- data/app/views/vyapari/admin/categories/_form.html.erb +0 -28
- data/app/views/vyapari/admin/categories/_index.html.erb +0 -101
- data/app/views/vyapari/admin/categories/_row.html.erb +0 -69
- data/app/views/vyapari/admin/categories/_show.html.erb +0 -115
- data/app/views/vyapari/admin/products/_form.html.erb +0 -32
- data/app/views/vyapari/admin/products/_index.html.erb +0 -58
- data/app/views/vyapari/admin/products/_row.html.erb +0 -30
- data/app/views/vyapari/admin/products/_show.html.erb +0 -81
- data/app/views/vyapari/admin/products/index.html.erb +0 -48
- data/app/views/vyapari/admin/stores/_form.html.erb +0 -37
- data/app/views/vyapari/admin/stores/_index.html.erb +0 -84
- data/app/views/vyapari/admin/stores/_row.html.erb +0 -55
- data/app/views/vyapari/admin/stores/_show.html.erb +0 -110
- data/app/views/vyapari/admin/stores/index.html.erb +0 -48
- data/app/views/vyapari/admin/suppliers/_form.html.erb +0 -32
- data/app/views/vyapari/admin/suppliers/_index.html.erb +0 -58
- data/app/views/vyapari/admin/suppliers/_row.html.erb +0 -30
- data/app/views/vyapari/admin/suppliers/_show.html.erb +0 -81
- data/app/views/vyapari/admin/suppliers/index.html.erb +0 -48
- data/app/views/vyapari/admin/terminals/_form.html.erb +0 -24
- data/app/views/vyapari/admin/terminals/_index.html.erb +0 -75
- data/app/views/vyapari/admin/terminals/_row.html.erb +0 -49
- data/app/views/vyapari/admin/terminals/_show.html.erb +0 -74
- data/app/views/vyapari/store_manager/dashboard/_sales_counts.html.erb +0 -90
- data/app/views/vyapari/store_manager/dashboard/_stock_counts.html.erb +0 -63
- data/app/views/vyapari/store_manager/dashboard/_terminals.html.erb +0 -23
- data/app/views/vyapari/store_manager/dashboard/index.html.erb +0 -64
- data/app/views/vyapari/store_manager/reports/invoices/_index.html.erb +0 -65
- data/app/views/vyapari/store_manager/reports/invoices/index.html.erb +0 -105
- data/app/views/vyapari/store_manager/reports/sales/_index.html.erb +0 -64
- data/app/views/vyapari/store_manager/reports/sales/index.html.erb +0 -105
- data/app/views/vyapari/store_manager/reports/stock/_index.html.erb +0 -72
- data/app/views/vyapari/store_manager/reports/stock/index.html.erb +0 -32
- data/app/views/vyapari/store_manager/stock_bundles/_form.html.erb +0 -99
- data/app/views/vyapari/store_manager/stock_bundles/_index.html.erb +0 -74
- data/app/views/vyapari/store_manager/stock_bundles/_row.html.erb +0 -44
- data/app/views/vyapari/store_manager/stock_bundles/_show.html.erb +0 -110
- data/app/views/vyapari/store_manager/stock_bundles/create.html.erb +0 -57
- data/app/views/vyapari/store_manager/stock_bundles/index.html.erb +0 -36
- data/app/views/vyapari/store_manager/stock_bundles/update.html.erb +0 -57
- data/app/views/vyapari/store_manager/stock_entries/_form.html.erb +0 -50
- data/app/views/vyapari/store_manager/stock_entries/_index.html.erb +0 -80
- data/app/views/vyapari/store_manager/stock_entries/_row.html.erb +0 -33
- data/app/views/vyapari/store_manager/stock_entries/_show.html.erb +0 -110
- data/app/views/vyapari/store_manager/stock_entries/_stock_bundle.html.erb +0 -61
- data/app/views/vyapari/store_manager/stock_entries/index.html.erb +0 -45
- data/app/views/vyapari/terminal_staff/dashboard/_counts.html.erb +0 -131
- data/app/views/vyapari/terminal_staff/dashboard/_invoices.html.erb +0 -44
- data/app/views/vyapari/terminal_staff/dashboard/_search_form.html.erb +0 -6
- data/app/views/vyapari/terminal_staff/dashboard/_search_results.html.erb +0 -24
- data/app/views/vyapari/terminal_staff/dashboard/index.html.erb +0 -56
- data/app/views/vyapari/terminal_staff/dashboard/search.js.erb +0 -12
- data/app/views/vyapari/terminal_staff/invoices/_draft.html.erb +0 -62
- data/app/views/vyapari/terminal_staff/invoices/_form.html.erb +0 -134
- data/app/views/vyapari/terminal_staff/invoices/_index.html.erb +0 -70
- data/app/views/vyapari/terminal_staff/invoices/_row.html.erb +0 -33
- data/app/views/vyapari/terminal_staff/invoices/_show.html.erb +0 -204
- data/app/views/vyapari/terminal_staff/invoices/index.html.erb +0 -35
- data/app/views/vyapari/terminal_staff/invoices/new.js.erb +0 -18
- data/app/views/vyapari/terminal_staff/invoices/show.html.erb +0 -1
- data/app/views/vyapari/terminal_staff/invoices/show.js.erb +0 -13
- data/app/views/vyapari/terminal_staff/line_items/_form.html.erb +0 -40
- data/app/views/vyapari/terminal_staff/line_items/_index.html.erb +0 -96
- data/app/views/vyapari/terminal_staff/line_items/create.js.erb +0 -34
- data/app/views/vyapari/terminal_staff/line_items/destroy.js.erb +0 -25
- data/app/views/vyapari/user_dashboard/index.html.erb +0 -51
- data/db/import_data/brands.csv +0 -7
- data/db/import_data/categories.csv +0 -12
- data/db/import_data/countries.csv +0 -1
- data/db/import_data/dummy/brands.csv +0 -7
- data/db/import_data/dummy/categories.csv +0 -12
- data/db/import_data/dummy/countries.csv +0 -1
- data/db/import_data/dummy/exchange_rates.csv +0 -5
- data/db/import_data/dummy/products-copy.csv +0 -1
- data/db/import_data/dummy/products.csv +0 -1
- data/db/import_data/dummy/products.xlsx +0 -0
- data/db/import_data/dummy/regions.csv +0 -13
- data/db/import_data/dummy/stores.csv +0 -10
- data/db/import_data/dummy/suppliers.csv +0 -14
- data/db/import_data/dummy/terminals.csv +0 -11
- data/db/import_data/exchange_rates.csv +0 -5
- data/db/import_data/regions.csv +0 -13
- data/db/import_data/stores.csv +0 -3
- data/db/import_data/suppliers.csv +0 -14
- data/db/import_data/terminals.csv +0 -3
- data/db/migrate/20170000000203_create_contacts.rb +0 -22
- data/db/migrate/20170000000204_create_bank_accounts.rb +0 -21
- data/db/migrate/20170000000205_create_suppliers.rb +0 -18
- data/db/migrate/20170000000206_create_stores.rb +0 -21
- data/db/migrate/20170000000207_create_terminals.rb +0 -18
- data/db/migrate/20170000000210_create_brands.rb +0 -14
- data/db/migrate/20170000000211_create_categories.rb +0 -22
- data/db/migrate/20170000000212_create_products.rb +0 -29
- data/db/migrate/20170000000213_create_invoices.rb +0 -61
- data/db/migrate/20170000000215_create_stock_bundles.rb +0 -17
- data/db/migrate/20170000000216_create_stock_entries.rb +0 -20
- data/db/sample_reports/products.xlsx +0 -0
- data/lib/tasks/vyapari/all.rake +0 -73
@@ -1 +0,0 @@
|
|
1
|
-
name ean_sku reference_number one_liner description brand category purchased_price landing_price selling_price retail_price quantity
|
@@ -1,99 +0,0 @@
|
|
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
|
@@ -1,115 +0,0 @@
|
|
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
|
@@ -1,79 +0,0 @@
|
|
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
|
@@ -1,67 +0,0 @@
|
|
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
|
@@ -1,67 +0,0 @@
|
|
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
|
@@ -1,150 +0,0 @@
|
|
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
|