comable-backend 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +97 -0
- data/app/assets/javascripts/comable/admin/application.coffee +76 -0
- data/app/assets/javascripts/comable/admin/categories.coffee +59 -0
- data/app/assets/javascripts/comable/admin/dashboard.coffee +32 -0
- data/app/assets/javascripts/comable/admin/dispatcher.coffee +21 -0
- data/app/assets/javascripts/comable/admin/orders.coffee +44 -0
- data/app/assets/javascripts/comable/admin/pages.coffee +69 -0
- data/app/assets/javascripts/comable/admin/products.coffee +21 -0
- data/app/assets/javascripts/comable/admin/search.coffee +35 -0
- data/app/assets/javascripts/comable/admin/themes.coffee +64 -0
- data/app/assets/stylesheets/comable/admin/_common.scss +153 -0
- data/app/assets/stylesheets/comable/admin/_dashboard.scss +81 -0
- data/app/assets/stylesheets/comable/admin/_errors.scss +18 -0
- data/app/assets/stylesheets/comable/admin/_flow.scss +149 -0
- data/app/assets/stylesheets/comable/admin/_mixins.scss +16 -0
- data/app/assets/stylesheets/comable/admin/_orders.scss +54 -0
- data/app/assets/stylesheets/comable/admin/_overrides.scss +4 -0
- data/app/assets/stylesheets/comable/admin/_pages.scss +30 -0
- data/app/assets/stylesheets/comable/admin/_products.scss +18 -0
- data/app/assets/stylesheets/comable/admin/_themes.scss +71 -0
- data/app/assets/stylesheets/comable/admin/_user_sessions.scss +57 -0
- data/app/assets/stylesheets/comable/admin/_variables.scss +38 -0
- data/app/assets/stylesheets/comable/admin/application.scss +26 -0
- data/app/assets/stylesheets/comable/admin/overrides/awesome_admin_layout.scss +25 -0
- data/app/assets/stylesheets/comable/admin/overrides/bootstrap.scss +81 -0
- data/app/assets/stylesheets/comable/admin/overrides/jstree.scss +71 -0
- data/app/assets/stylesheets/comable/admin/overrides/tagit.scss +22 -0
- data/app/controllers/comable/admin/application_controller.rb +58 -0
- data/app/controllers/comable/admin/categories_controller.rb +17 -0
- data/app/controllers/comable/admin/dashboard_controller.rb +19 -0
- data/app/controllers/comable/admin/orders_controller.rb +102 -0
- data/app/controllers/comable/admin/pages_controller.rb +72 -0
- data/app/controllers/comable/admin/payment_methods_controller.rb +59 -0
- data/app/controllers/comable/admin/products_controller.rb +82 -0
- data/app/controllers/comable/admin/shipment_methods_controller.rb +57 -0
- data/app/controllers/comable/admin/stocks_controller.rb +81 -0
- data/app/controllers/comable/admin/store_controller.rb +42 -0
- data/app/controllers/comable/admin/themes_controller.rb +101 -0
- data/app/controllers/comable/admin/trackers_controller.rb +58 -0
- data/app/controllers/comable/admin/user_sessions_controller.rb +8 -0
- data/app/controllers/comable/admin/users_controller.rb +47 -0
- data/app/helpers/comable/admin/application_helper.rb +53 -0
- data/app/helpers/comable/admin/orders_helper.rb +30 -0
- data/app/helpers/comable/admin/pages_helper.rb +6 -0
- data/app/helpers/comable/admin/products_helper.rb +6 -0
- data/app/helpers/comable/admin/shipment_methods_helper.rb +6 -0
- data/app/helpers/comable/admin/stores_helper.rb +6 -0
- data/app/helpers/comable/admin/themes_helper.rb +69 -0
- data/app/views/comable/admin/categories/index.slim +40 -0
- data/app/views/comable/admin/dashboard/_widget.slim +13 -0
- data/app/views/comable/admin/dashboard/show.slim +43 -0
- data/app/views/comable/admin/orders/_google_map.slim +39 -0
- data/app/views/comable/admin/orders/_payment_state.slim +40 -0
- data/app/views/comable/admin/orders/_shipment_state.slim +44 -0
- data/app/views/comable/admin/orders/edit.slim +170 -0
- data/app/views/comable/admin/orders/index.slim +95 -0
- data/app/views/comable/admin/orders/show.slim +177 -0
- data/app/views/comable/admin/pages/_form.slim +69 -0
- data/app/views/comable/admin/pages/edit.slim +31 -0
- data/app/views/comable/admin/pages/index.slim +55 -0
- data/app/views/comable/admin/pages/new.slim +16 -0
- data/app/views/comable/admin/payment_methods/_form.slim +35 -0
- data/app/views/comable/admin/payment_methods/edit.slim +27 -0
- data/app/views/comable/admin/payment_methods/index.slim +40 -0
- data/app/views/comable/admin/payment_methods/new.slim +16 -0
- data/app/views/comable/admin/products/_form.slim +137 -0
- data/app/views/comable/admin/products/edit.slim +41 -0
- data/app/views/comable/admin/products/index.slim +95 -0
- data/app/views/comable/admin/products/new.slim +16 -0
- data/app/views/comable/admin/shared/_advanced_search.slim +7 -0
- data/app/views/comable/admin/shared/_condition_fields.slim +15 -0
- data/app/views/comable/admin/shared/_footer.slim +8 -0
- data/app/views/comable/admin/shared/_grouping_fields.slim +8 -0
- data/app/views/comable/admin/shared/_image_fields.slim +15 -0
- data/app/views/comable/admin/shared/_notifier.slim +5 -0
- data/app/views/comable/admin/shared/_value_fields.slim +1 -0
- data/app/views/comable/admin/shared/export.xlsx.axlsx +17 -0
- data/app/views/comable/admin/shipment_methods/_form.slim +29 -0
- data/app/views/comable/admin/shipment_methods/edit.slim +27 -0
- data/app/views/comable/admin/shipment_methods/index.slim +37 -0
- data/app/views/comable/admin/shipment_methods/new.slim +16 -0
- data/app/views/comable/admin/stocks/_form.slim +34 -0
- data/app/views/comable/admin/stocks/edit.slim +37 -0
- data/app/views/comable/admin/stocks/index.slim +81 -0
- data/app/views/comable/admin/stocks/new.slim +18 -0
- data/app/views/comable/admin/store/_form.slim +32 -0
- data/app/views/comable/admin/store/edit.slim +12 -0
- data/app/views/comable/admin/themes/_editor.slim +8 -0
- data/app/views/comable/admin/themes/_form.slim +31 -0
- data/app/views/comable/admin/themes/edit.slim +35 -0
- data/app/views/comable/admin/themes/index.slim +37 -0
- data/app/views/comable/admin/themes/new.slim +16 -0
- data/app/views/comable/admin/themes/show_file.slim +93 -0
- data/app/views/comable/admin/trackers/_form.slim +109 -0
- data/app/views/comable/admin/trackers/edit.slim +27 -0
- data/app/views/comable/admin/trackers/index.slim +37 -0
- data/app/views/comable/admin/trackers/new.slim +16 -0
- data/app/views/comable/admin/user_sessions/new.slim +25 -0
- data/app/views/comable/admin/users/edit.slim +79 -0
- data/app/views/comable/admin/users/index.slim +71 -0
- data/app/views/comable/admin/users/show.slim +88 -0
- data/app/views/kaminari/comable_backend/_first_page.html.slim +2 -0
- data/app/views/kaminari/comable_backend/_gap.html.slim +2 -0
- data/app/views/kaminari/comable_backend/_last_page.html.slim +2 -0
- data/app/views/kaminari/comable_backend/_next_page.html.slim +2 -0
- data/app/views/kaminari/comable_backend/_page.html.slim +3 -0
- data/app/views/kaminari/comable_backend/_paginator.html.slim +15 -0
- data/app/views/kaminari/comable_backend/_prev_page.html.slim +2 -0
- data/app/views/layouts/comable/admin/application.slim +36 -0
- data/config/initializers/awesome_admin_layout.rb +110 -0
- data/config/routes.rb +63 -0
- data/lib/comable/backend.rb +1 -0
- data/lib/comable/backend/engine.rb +67 -0
- data/lib/tasks/comable_backend_tasks.rake +4 -0
- metadata +514 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
= error_messages_for @payment_method
|
2
|
+
|
3
|
+
= form_for [comable, :admin, @payment_method] do |f|
|
4
|
+
.hidden
|
5
|
+
= f.submit
|
6
|
+
|
7
|
+
fieldset
|
8
|
+
.col-md-3
|
9
|
+
legend
|
10
|
+
= Comable.t('admin.general')
|
11
|
+
|
12
|
+
.col-md-9
|
13
|
+
.form-group
|
14
|
+
= f.label :name
|
15
|
+
= f.text_field :name
|
16
|
+
|
17
|
+
.form-group
|
18
|
+
= f.label :payment_provider
|
19
|
+
.row
|
20
|
+
.col-sm-6
|
21
|
+
= f.select :payment_provider_type, Comable::PaymentProvider.all.map { |provider_class| [provider_class.display_name, provider_class.name] }
|
22
|
+
.col-sm-6
|
23
|
+
= f.select :payment_provider_kind, Comable::PaymentProvider::General.kind.map.with_index { |(_, value), index| [value, index] }
|
24
|
+
|
25
|
+
.form-group
|
26
|
+
= f.label :fee
|
27
|
+
= f.text_field :fee
|
28
|
+
|
29
|
+
.form-group
|
30
|
+
= f.label :enable_price
|
31
|
+
.row
|
32
|
+
.col-sm-6
|
33
|
+
= f.text_field :enable_price_from
|
34
|
+
.col-sm-6
|
35
|
+
= f.text_field :enable_price_to
|
@@ -0,0 +1,27 @@
|
|
1
|
+
.comable-page
|
2
|
+
.comable-main-fixed-top
|
3
|
+
.comable-page-heading
|
4
|
+
ul.pull-right.list-inline
|
5
|
+
li
|
6
|
+
= link_to_save
|
7
|
+
|
8
|
+
h1.page-header
|
9
|
+
ol.breadcrumb
|
10
|
+
li>
|
11
|
+
= link_to Comable.t('admin.nav.payment_method'), comable.admin_payment_methods_path
|
12
|
+
li.active
|
13
|
+
= @payment_method.name
|
14
|
+
|
15
|
+
.comable-page-body
|
16
|
+
= render 'form'
|
17
|
+
hr
|
18
|
+
.panel.panel-danger
|
19
|
+
.panel-heading type="button" data-toggle="collapse" data-target="#comable-danger"
|
20
|
+
strong
|
21
|
+
span.fa.fa-angle-down>
|
22
|
+
= Comable.t('admin.actions.destroy')
|
23
|
+
#comable-danger.collapse
|
24
|
+
.panel-body
|
25
|
+
p
|
26
|
+
= Comable.t('admin.confirmation_to_remove_product')
|
27
|
+
= link_to Comable.t('admin.actions.destroy'), comable.admin_payment_method_path(@payment_method), method: :delete, class: 'btn btn-danger'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
.comable-page
|
2
|
+
.comable-page-heading
|
3
|
+
ul.pull-right.list-inline
|
4
|
+
li
|
5
|
+
= link_to Comable.t('admin.actions.new'), comable.new_admin_payment_method_path, class: 'btn btn-default'
|
6
|
+
|
7
|
+
h1.page-header
|
8
|
+
= Comable.t('admin.nav.payment_method')
|
9
|
+
small<
|
10
|
+
| #{@payment_methods.total_count} #{Comable.t('admin.results')}
|
11
|
+
|
12
|
+
.comable-page-body
|
13
|
+
- if @payment_methods.empty?
|
14
|
+
= Comable.t('admin.not_found')
|
15
|
+
- else
|
16
|
+
table.table.table-striped
|
17
|
+
thead
|
18
|
+
th
|
19
|
+
= @payment_methods.klass.human_attribute_name(:name)
|
20
|
+
th
|
21
|
+
= @payment_methods.klass.human_attribute_name(:payment_provider)
|
22
|
+
th
|
23
|
+
= @payment_methods.klass.human_attribute_name(:enable_price)
|
24
|
+
tbody
|
25
|
+
- @payment_methods.each do |payment_method|
|
26
|
+
tr
|
27
|
+
td
|
28
|
+
= link_to payment_method.name, comable.admin_payment_method_path(payment_method)
|
29
|
+
/- unless payment_method.activated_flag
|
30
|
+
/ span.fa.fa-eye-slash.text-muted<
|
31
|
+
td
|
32
|
+
= payment_method.payment_provider.display_name
|
33
|
+
td
|
34
|
+
- if payment_method.enable_price_from || payment_method.enable_price_to
|
35
|
+
span = number_to_currency payment_method.enable_price_from
|
36
|
+
span>< ~
|
37
|
+
span = number_to_currency payment_method.enable_price_to
|
38
|
+
|
39
|
+
.text-center
|
40
|
+
= paginate @payment_methods, theme: :comable_backend
|
@@ -0,0 +1,16 @@
|
|
1
|
+
.comable-page
|
2
|
+
.comable-main-fixed-top
|
3
|
+
.comable-page-heading
|
4
|
+
ul.pull-right.list-inline
|
5
|
+
li
|
6
|
+
= link_to_save
|
7
|
+
|
8
|
+
h1.page-header
|
9
|
+
ol.breadcrumb
|
10
|
+
li>
|
11
|
+
= link_to Comable.t('admin.nav.payment_method'), comable.admin_payment_methods_path
|
12
|
+
li.active
|
13
|
+
= Comable.t('admin.actions.new')
|
14
|
+
|
15
|
+
.comable-page-body
|
16
|
+
= render 'form'
|
@@ -0,0 +1,137 @@
|
|
1
|
+
= error_messages_for @product
|
2
|
+
|
3
|
+
- url = comable.admin_products_path if @product.new_record?
|
4
|
+
- url ||= comable.admin_product_path(@product)
|
5
|
+
|
6
|
+
= form_for @product, url: url, html: { multipart: true } do |f|
|
7
|
+
.hidden
|
8
|
+
= f.submit
|
9
|
+
|
10
|
+
fieldset
|
11
|
+
.col-md-3
|
12
|
+
legend
|
13
|
+
= Comable.t('admin.general')
|
14
|
+
.help-block
|
15
|
+
|
16
|
+
.col-md-9
|
17
|
+
.form-group
|
18
|
+
= f.label :code
|
19
|
+
= f.text_field :code
|
20
|
+
|
21
|
+
.form-group
|
22
|
+
= f.label :name
|
23
|
+
= f.text_field :name
|
24
|
+
|
25
|
+
.form-group
|
26
|
+
= f.label :caption
|
27
|
+
= f.text_field :caption
|
28
|
+
|
29
|
+
.form-group
|
30
|
+
= f.label :price
|
31
|
+
= f.text_field :price
|
32
|
+
|
33
|
+
/ TODO: Refactoring
|
34
|
+
javascript:
|
35
|
+
comable_tagit_available_tags = #{raw Comable::Category.all.map(&:path).map { |path| path.map(&:name).join(' > ') }.sort.to_json};
|
36
|
+
|
37
|
+
.form-group
|
38
|
+
= f.label :categories
|
39
|
+
ul#comable-tagit
|
40
|
+
- @product.categories.each do |category|
|
41
|
+
li
|
42
|
+
= category.path.map(&:name).join(' > ')
|
43
|
+
|
44
|
+
hr
|
45
|
+
|
46
|
+
fieldset
|
47
|
+
.col-md-3
|
48
|
+
legend
|
49
|
+
= Comable.t('admin.stocks')
|
50
|
+
.help-block
|
51
|
+
- if @product.sku? || (@product.persisted? && @product.stocks.empty?)
|
52
|
+
= Comable.t('admin.link_to_add_new_stock')
|
53
|
+
= link_to Comable.t('admin.actions.new'), comable.new_admin_product_stock_path(@product)
|
54
|
+
|
55
|
+
.col-md-9
|
56
|
+
- if @product.stocks.any?
|
57
|
+
table.table.table-striped
|
58
|
+
thead
|
59
|
+
th
|
60
|
+
= @product.stocks.human_attribute_name(:code)
|
61
|
+
th
|
62
|
+
= @product.stocks.human_attribute_name(:quantity)
|
63
|
+
- if @product.sku?
|
64
|
+
- if @product.sku_h?
|
65
|
+
th
|
66
|
+
= @product.sku_h_item_name
|
67
|
+
- if @product.sku_v?
|
68
|
+
th
|
69
|
+
= @product.sku_v_item_name
|
70
|
+
th
|
71
|
+
= Comable.t('admin.operation')
|
72
|
+
tbody
|
73
|
+
- @product.stocks.each do |stock|
|
74
|
+
tr
|
75
|
+
td
|
76
|
+
= stock.code
|
77
|
+
td
|
78
|
+
strong class="#{(stock.quantity <= 0) ? 'text-danger' : (stock.quantity <= 10) ? 'text-warning' : 'text-success'}"
|
79
|
+
= number_with_delimiter stock.quantity
|
80
|
+
- if @product.sku?
|
81
|
+
- if @product.sku_h?
|
82
|
+
td
|
83
|
+
= stock.sku_h_choice_name
|
84
|
+
- if @product.sku_v?
|
85
|
+
td
|
86
|
+
= stock.sku_v_choice_name
|
87
|
+
td
|
88
|
+
= link_to comable.admin_stock_path(stock), class: 'btn btn-default'
|
89
|
+
i.fa.fa-edit>
|
90
|
+
= Comable.t('admin.actions.edit')
|
91
|
+
|
92
|
+
.form-group
|
93
|
+
= f.label :sku_h_item_name
|
94
|
+
= f.text_field :sku_h_item_name
|
95
|
+
.help-block
|
96
|
+
= Comable.t('admin.please_fill_when_using_sku')
|
97
|
+
|
98
|
+
.form-group
|
99
|
+
= f.label :sku_v_item_name
|
100
|
+
= f.text_field :sku_v_item_name
|
101
|
+
|
102
|
+
hr
|
103
|
+
|
104
|
+
fieldset
|
105
|
+
.col-md-3
|
106
|
+
legend
|
107
|
+
= Comable.t('admin.images')
|
108
|
+
.help-block
|
109
|
+
|
110
|
+
.col-md-9
|
111
|
+
- images = @product.images
|
112
|
+
- main_image = images.first || @product.images.build
|
113
|
+
- sub_images = images - [main_image]
|
114
|
+
|
115
|
+
.row
|
116
|
+
.col-md-6
|
117
|
+
= f.fields_for :images, main_image do |ff|
|
118
|
+
label
|
119
|
+
= Comable.t('admin.main_image')
|
120
|
+
p
|
121
|
+
= ff.file_field :file
|
122
|
+
- if ff.object.url
|
123
|
+
.thumbnail
|
124
|
+
= image_tag ff.object.url
|
125
|
+
- if ff.object.persisted?
|
126
|
+
label.remove
|
127
|
+
span> = ff.check_box :_destroy
|
128
|
+
span> = Comable.t('admin.actions.destroy')
|
129
|
+
|
130
|
+
.col-md-6
|
131
|
+
.row
|
132
|
+
- sub_images.each.with_index(1) do |image, index|
|
133
|
+
= f.fields_for :images, image do |ff|
|
134
|
+
= render 'comable/admin/shared/image_fields', ff: ff, index: index
|
135
|
+
|
136
|
+
.col-md-6
|
137
|
+
= link_to_add_fields Comable.t('admin.add_sub_image'), f, :images
|
@@ -0,0 +1,41 @@
|
|
1
|
+
.comable-page
|
2
|
+
.comable-main-fixed-top
|
3
|
+
.comable-page-heading
|
4
|
+
ul.pull-right.list-inline
|
5
|
+
li.dropdown
|
6
|
+
= link_to '#', class: 'btn btn-default', 'data-toggle' => 'dropdown' do
|
7
|
+
i.fa.fa-bars
|
8
|
+
ul.dropdown-menu.dropdown-menu-right
|
9
|
+
li
|
10
|
+
= link_to comable.product_path(@product) do
|
11
|
+
span.fa.fa-external-link>
|
12
|
+
= Comable.t('admin.check_this_product_in_frontend')
|
13
|
+
- if @product.sku? || @product.stocks.empty?
|
14
|
+
li.divider
|
15
|
+
li.dropdown-header
|
16
|
+
= Comable.t('admin.nav.stock')
|
17
|
+
li
|
18
|
+
= link_to Comable.t('admin.actions.new'), comable.new_admin_product_stock_path(@product)
|
19
|
+
li
|
20
|
+
= link_to_save
|
21
|
+
|
22
|
+
h1.page-header
|
23
|
+
ol.breadcrumb
|
24
|
+
li>
|
25
|
+
= link_to Comable.t('admin.nav.product'), comable.admin_products_path
|
26
|
+
li.active
|
27
|
+
= @product.name
|
28
|
+
|
29
|
+
.comable-page-body
|
30
|
+
= render 'form'
|
31
|
+
hr
|
32
|
+
.panel.panel-danger
|
33
|
+
.panel-heading type="button" data-toggle="collapse" data-target="#comable-danger"
|
34
|
+
strong
|
35
|
+
span.fa.fa-angle-down>
|
36
|
+
= Comable.t('admin.actions.destroy')
|
37
|
+
#comable-danger.collapse
|
38
|
+
.panel-body
|
39
|
+
p
|
40
|
+
= Comable.t('admin.confirmation_to_remove_product')
|
41
|
+
= link_to Comable.t('admin.actions.destroy'), comable.admin_product_path(@product), method: :delete, class: 'btn btn-danger'
|
@@ -0,0 +1,95 @@
|
|
1
|
+
.comable-page
|
2
|
+
.comable-page-heading
|
3
|
+
ul.pull-right.list-inline
|
4
|
+
li
|
5
|
+
.btn-group role="group"
|
6
|
+
= link_to_previous_page @products, '<', class: 'btn btn-default' do
|
7
|
+
.btn.btn-default disabled="disabled"
|
8
|
+
| <
|
9
|
+
= link_to_next_page @products, '>', class: 'btn btn-default' do
|
10
|
+
.btn.btn-default disabled="disabled"
|
11
|
+
| >
|
12
|
+
li
|
13
|
+
= link_to comable.root_path do
|
14
|
+
= link_to Comable.t('admin.actions.new'), comable.new_admin_product_path, class: 'btn btn-default'
|
15
|
+
li.dropdown
|
16
|
+
= link_to '#', class: 'btn btn-default', 'data-toggle' => 'dropdown' do
|
17
|
+
= Comable.t('admin.more')
|
18
|
+
i.fa.fa-angle-down<
|
19
|
+
ul.dropdown-menu.dropdown-menu-right
|
20
|
+
li
|
21
|
+
= link_to Comable.t('admin.export_to_csv'), comable.export_admin_products_path(format: :csv, q: params[:q])
|
22
|
+
li
|
23
|
+
= link_to Comable.t('admin.export_to_excel'), comable.export_admin_products_path(format: :xlsx, q: params[:q])
|
24
|
+
li.divider
|
25
|
+
li
|
26
|
+
a.btn-file
|
27
|
+
span>
|
28
|
+
= Comable.t('admin.import')
|
29
|
+
= form_tag comable.import_admin_products_path, multipart: true do
|
30
|
+
= file_field_tag :file
|
31
|
+
|
32
|
+
h1.page-header
|
33
|
+
= Comable.t('admin.nav.product')
|
34
|
+
small<
|
35
|
+
| #{@products.total_count} #{Comable.t('admin.results')}
|
36
|
+
|
37
|
+
.comable-page-body
|
38
|
+
.comable-search
|
39
|
+
= search_form_for @q, url: comable.admin_products_path do |f|
|
40
|
+
.input-group
|
41
|
+
span.input-group-btn
|
42
|
+
button.btn.btn-default.dropdown-toggle type="button" data-toggle="dropdown"
|
43
|
+
i.fa.fa-search
|
44
|
+
span.caret<
|
45
|
+
ul.dropdown-menu role="menu"
|
46
|
+
li
|
47
|
+
= link_to Comable.t('admin.advanced_search'), 'javascript:void(0)', 'data-toggle' => 'collapse', 'data-target' => '#comable-advanced-search'
|
48
|
+
li
|
49
|
+
= link_to Comable.t('admin.clear_search_conditions'), comable.admin_products_path
|
50
|
+
= f.text_field :code_or_name_cont_any_splitted, class: 'form-control'
|
51
|
+
span.input-group-btn
|
52
|
+
= f.submit Comable.t('admin.search'), class: 'btn btn-default'
|
53
|
+
|
54
|
+
= render 'comable/admin/shared/advanced_search', f: f
|
55
|
+
|
56
|
+
section
|
57
|
+
- if @products.empty?
|
58
|
+
= Comable.t('admin.not_found')
|
59
|
+
- else
|
60
|
+
table.table.table-striped
|
61
|
+
thead
|
62
|
+
th
|
63
|
+
th
|
64
|
+
= sort_link [:comable, @q], :code
|
65
|
+
th
|
66
|
+
= sort_link [:comable, @q], :name
|
67
|
+
th
|
68
|
+
= sort_link [:comable, @q], :price
|
69
|
+
th
|
70
|
+
= Comable.t('admin.stocks')
|
71
|
+
tbody
|
72
|
+
- @products.each do |product|
|
73
|
+
- quantity = product.stocks.to_a.sum(&:quantity)
|
74
|
+
tr
|
75
|
+
td.comable-image
|
76
|
+
= link_to comable.admin_product_path(product), class: 'thumbnail' do
|
77
|
+
= image_tag product.image_url, width: '100%'
|
78
|
+
td
|
79
|
+
= link_to product.code, comable.admin_product_path(product)
|
80
|
+
td
|
81
|
+
= product.name
|
82
|
+
td
|
83
|
+
= number_to_currency product.price
|
84
|
+
td
|
85
|
+
ul.list-unstyled
|
86
|
+
- product.stocks.each do |stock|
|
87
|
+
li
|
88
|
+
strong class="#{(quantity <= 0) ? 'text-danger' : (quantity <= 10) ? 'text-warning' : 'text-success'}"
|
89
|
+
= number_with_delimiter stock.quantity
|
90
|
+
- if stock.sku?
|
91
|
+
span<
|
92
|
+
| (#{stock.sku_name})
|
93
|
+
|
94
|
+
.text-center
|
95
|
+
= paginate @products, theme: :comable_backend
|
@@ -0,0 +1,16 @@
|
|
1
|
+
.comable-page
|
2
|
+
.comable-main-fixed-top
|
3
|
+
.comable-page-heading
|
4
|
+
ul.pull-right.list-inline
|
5
|
+
li
|
6
|
+
= link_to_save
|
7
|
+
|
8
|
+
h1.page-header
|
9
|
+
ol.breadcrumb
|
10
|
+
li>
|
11
|
+
= link_to Comable.t('admin.nav.product'), comable.admin_products_path
|
12
|
+
li.active
|
13
|
+
= Comable.t('admin.actions.new')
|
14
|
+
|
15
|
+
.comable-page-body
|
16
|
+
= render 'form'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
= content_tag :fieldset, { class: 'fields condition', 'data-object-name' => f.object_name } do
|
2
|
+
.row
|
3
|
+
.col-sm-2
|
4
|
+
= f.attribute_fields do |a|
|
5
|
+
- klass = f.object.context.object
|
6
|
+
- options = {}
|
7
|
+
- options = klass.ransack_options[:attribute_select] if klass.respond_to? :ransack_options
|
8
|
+
= content_tag(:span, a.attribute_select(options), { class: 'fields', 'data-object-name' => a.object_name }, false)
|
9
|
+
.col-sm-2
|
10
|
+
= f.predicate_select only: %i(gteq lteq eq_any_splitted cont_any_splitted), compounds: false
|
11
|
+
.col-sm-7
|
12
|
+
= f.value_fields do |v|
|
13
|
+
= render 'comable/admin/shared/value_fields', f: v
|
14
|
+
.col-sm-1.text-center
|
15
|
+
= button_to_remove_fields Comable.t('admin.remove_search_condition'), class: 'comable-remove-button'
|