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,69 @@
|
|
1
|
+
module Comable
|
2
|
+
module Admin
|
3
|
+
module ThemesHelper
|
4
|
+
def editable?
|
5
|
+
params[:path].present?
|
6
|
+
end
|
7
|
+
|
8
|
+
def display_views_directory_tree
|
9
|
+
views_direcotry_tree = load_directory_tree(views_dir)
|
10
|
+
build_directory_tree(views_direcotry_tree)
|
11
|
+
end
|
12
|
+
|
13
|
+
def liquidable_models
|
14
|
+
Comable.constants.map do |constant|
|
15
|
+
klass = "Comable::#{constant}".constantize
|
16
|
+
klass.constants.include?(:LiquidDropClass) ? klass : nil
|
17
|
+
end.compact
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def views_dir
|
23
|
+
spec = Gem::Specification.find_by_name('comable-frontend')
|
24
|
+
fail 'Please install "comable-frontend" gem!' unless spec
|
25
|
+
"#{spec.gem_dir}/app/views"
|
26
|
+
end
|
27
|
+
|
28
|
+
def load_directory_tree(path, parent = nil)
|
29
|
+
children = []
|
30
|
+
tree = { (parent || :root) => children }
|
31
|
+
|
32
|
+
Dir.foreach(path) do |entry|
|
33
|
+
next if entry.start_with? '.'
|
34
|
+
fullpath = File.join(path, entry)
|
35
|
+
children << (File.directory?(fullpath) ? load_directory_tree(fullpath, entry.to_sym) : entry.sub(/\..+$/, '.liquid'))
|
36
|
+
end
|
37
|
+
|
38
|
+
tree
|
39
|
+
end
|
40
|
+
|
41
|
+
def build_directory_tree(tree, dirpath = nil)
|
42
|
+
content_tag(:dl, build_directory_tree_nodes(tree, dirpath))
|
43
|
+
end
|
44
|
+
|
45
|
+
def build_directory_tree_nodes(tree, dirpath)
|
46
|
+
entries = tree.values.first
|
47
|
+
entries.map do |entry|
|
48
|
+
if entry.is_a? Hash
|
49
|
+
build_directory_tree_children(entry, dirpath)
|
50
|
+
else
|
51
|
+
build_directory_tree_child(entry, dirpath)
|
52
|
+
end
|
53
|
+
end.join.html_safe
|
54
|
+
end
|
55
|
+
|
56
|
+
def build_directory_tree_children(entry, dirpath)
|
57
|
+
dirname = entry.keys.first.to_s
|
58
|
+
path = dirpath ? File.join(dirpath, dirname) : dirname
|
59
|
+
content_tag(:dt, dirname) + build_directory_tree(entry, path)
|
60
|
+
end
|
61
|
+
|
62
|
+
def build_directory_tree_child(filename, dirpath)
|
63
|
+
path = File.join(dirpath, filename)
|
64
|
+
link = link_to(filename, comable.file_admin_theme_path(@theme, path: path))
|
65
|
+
content_tag(:dd, link)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
/ TODO: Move to a file.
|
2
|
+
javascript:
|
3
|
+
comable_jstree_json = #{raw @categories.to_jstree(state: { opened: true }, icon: 'fa fa-bars')};
|
4
|
+
comable_new_node_label = '#{Comable.t('admin.categories.new_node')}';
|
5
|
+
comable_action_new = '#{Comable.t('admin.actions.new')}';
|
6
|
+
comable_action_edit = '#{Comable.t('admin.actions.edit')}';
|
7
|
+
comable_action_destroy = '#{Comable.t('admin.actions.destroy')}';
|
8
|
+
comable_destroied_nodes = [];
|
9
|
+
|
10
|
+
.comable-page
|
11
|
+
.comable-main-fixed-top
|
12
|
+
.comable-page-heading
|
13
|
+
ul.pull-right.list-inline
|
14
|
+
li
|
15
|
+
= link_to_save
|
16
|
+
|
17
|
+
h1.page-header
|
18
|
+
= Comable.t('admin.nav.category')
|
19
|
+
|
20
|
+
.comable-page-body
|
21
|
+
fieldset
|
22
|
+
.col-md-3
|
23
|
+
legend
|
24
|
+
= Comable.t('admin.note')
|
25
|
+
.help-block
|
26
|
+
ul
|
27
|
+
li
|
28
|
+
= Comable.t('admin.you_can_drag_and_drop')
|
29
|
+
li
|
30
|
+
= Comable.t('admin.you_can_right_click')
|
31
|
+
li
|
32
|
+
= Comable.t('admin.link_to_add_new_node')
|
33
|
+
= link_to Comable.t('admin.actions.new'), 'javascript:void(0)', onclick: 'add_comable_jstree_node()'
|
34
|
+
|
35
|
+
.col-md-9
|
36
|
+
#comable-jstree
|
37
|
+
= form_tag comable.admin_categories_path do
|
38
|
+
.hidden
|
39
|
+
= submit_tag
|
40
|
+
= hidden_field_tag :jstree_json
|
@@ -0,0 +1,13 @@
|
|
1
|
+
- progress = '-' if progress.nan? || progress.infinite?
|
2
|
+
|
3
|
+
.widget.widget-stats class="widget-bg-#{color}"
|
4
|
+
.stats-icon.stats-icon-lg
|
5
|
+
i.fa class="fa-#{fa}"
|
6
|
+
.stats-title
|
7
|
+
= title
|
8
|
+
.stats-number
|
9
|
+
= number
|
10
|
+
.stats-progress.progress
|
11
|
+
.progress-bar style="width: #{progress}%;"
|
12
|
+
.stats-desc
|
13
|
+
= Comable.t('admin.better_than_last_week', percentage: progress)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
.comable-page
|
2
|
+
.comable-page-heading
|
3
|
+
h1.page-header
|
4
|
+
= Comable.t('admin.nav.dashboard')
|
5
|
+
|
6
|
+
.comable-page-body
|
7
|
+
section.row
|
8
|
+
.col-md-4
|
9
|
+
- number = @this_week_orders.count
|
10
|
+
= render 'widget',
|
11
|
+
title: Comable.t('admin.new_orders'),
|
12
|
+
number: number_with_delimiter(number),
|
13
|
+
progress: (number.to_f / @last_week_orders.count) * 100,
|
14
|
+
color: 'green',
|
15
|
+
fa: 'shopping-cart'
|
16
|
+
|
17
|
+
.col-md-4
|
18
|
+
- number = @this_week_orders.sum(:total_price)
|
19
|
+
= render 'widget',
|
20
|
+
title: Comable.t('admin.sales'),
|
21
|
+
number: number_to_currency(number),
|
22
|
+
progress: (number.to_f / @last_week_orders.sum(:total_price)) * 100,
|
23
|
+
color: 'blue',
|
24
|
+
fa: 'dollar'
|
25
|
+
|
26
|
+
.col-md-4
|
27
|
+
- number = @this_week_users.count
|
28
|
+
= render 'widget',
|
29
|
+
title: Comable.t('admin.new_users'),
|
30
|
+
number: number_with_delimiter(number),
|
31
|
+
progress: (number.to_f / @last_week_users.count) * 100,
|
32
|
+
color: 'black',
|
33
|
+
fa: 'user'
|
34
|
+
|
35
|
+
section
|
36
|
+
.panel.panel-default
|
37
|
+
.panel-body
|
38
|
+
#comable-morris.morris style="height: 300px;"
|
39
|
+
|
40
|
+
javascript:
|
41
|
+
comable_morris_data = #{raw @this_month_orders.to_morris};
|
42
|
+
comable_morris_keys = #{raw Comable::Order.morris_keys};
|
43
|
+
comable_morris_labels = ['#{Comable.t('admin.order_count')}', '#{Comable.t('admin.sales')}'];
|
@@ -0,0 +1,39 @@
|
|
1
|
+
javascript:
|
2
|
+
comable_google_map_element_id = "#{id}";
|
3
|
+
comable_google_map_address = "#{address.full_address}";
|
4
|
+
|
5
|
+
coffee:
|
6
|
+
window.can_google_map = ->
|
7
|
+
return false unless comable_google_map_element_id?
|
8
|
+
return false unless comable_google_map_address?
|
9
|
+
return false unless $('#' + comable_google_map_element_id).length
|
10
|
+
true
|
11
|
+
|
12
|
+
window.initialize_google_map_api = ->
|
13
|
+
script = document.createElement('script')
|
14
|
+
script.type = 'text/javascript'
|
15
|
+
script.src = '//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&callback=initialize_google_map'
|
16
|
+
script.async = true
|
17
|
+
document.body.appendChild(script)
|
18
|
+
|
19
|
+
window.initialize_google_map = ->
|
20
|
+
return unless can_google_map()
|
21
|
+
google_map = new google.maps.Map(document.getElementById(comable_google_map_element_id), { zoom: 15 })
|
22
|
+
google_geo = new google.maps.Geocoder()
|
23
|
+
google_geo.geocode({ address: comable_google_map_address }, (result, status) =>
|
24
|
+
return if status != google.maps.GeocoderStatus.OK
|
25
|
+
location = result[0].geometry.location
|
26
|
+
google_map.setCenter(location)
|
27
|
+
new google.maps.Marker({ map: google_map, position: location })
|
28
|
+
)
|
29
|
+
|
30
|
+
$(document).ready(->
|
31
|
+
if google?
|
32
|
+
initialize_google_map()
|
33
|
+
else
|
34
|
+
initialize_google_map_api()
|
35
|
+
)
|
36
|
+
|
37
|
+
.comable-map
|
38
|
+
.comable-google-map id="#{id}"
|
39
|
+
| Loading map...
|
@@ -0,0 +1,40 @@
|
|
1
|
+
section.row
|
2
|
+
.col-sm-2
|
3
|
+
.comable-flow-label
|
4
|
+
.comable-flow-label-container
|
5
|
+
label
|
6
|
+
| #{payment.order.class.human_attribute_name(:payment_state)}:
|
7
|
+
p
|
8
|
+
= payment.human_state_name
|
9
|
+
|
10
|
+
.col-sm-10
|
11
|
+
ul.comable-flow
|
12
|
+
li
|
13
|
+
= content_tag :div, options_of_payment_badge_for(payment, state: :pending) do
|
14
|
+
i.fa.fa-circle
|
15
|
+
|
16
|
+
li
|
17
|
+
= content_tag :div, options_of_payment_badge_for(payment, state: :ready) do
|
18
|
+
i.fa.fa-check-circle
|
19
|
+
|
20
|
+
li
|
21
|
+
= content_tag :div, options_of_payment_badge_for(payment, state: :completed) do
|
22
|
+
i.fa.fa-money
|
23
|
+
|
24
|
+
- if payment.state?(:resumed)
|
25
|
+
li
|
26
|
+
= content_tag :div, options_of_payment_badge_for(payment, state: :resumed) do
|
27
|
+
i.fa.fa-refresh
|
28
|
+
|
29
|
+
- if payment.state?(:completed) || payment.state?(:resumed)
|
30
|
+
li
|
31
|
+
= link_to comable.cancel_payment_admin_order_path(payment.order), options_of_payment_badge_for(payment, state: :canceled).merge(method: :post) do
|
32
|
+
i.fa.fa-close
|
33
|
+
|
34
|
+
- if payment.state?(:canceled)
|
35
|
+
li
|
36
|
+
= content_tag :div, options_of_payment_badge_for(payment, state: :canceled) do
|
37
|
+
i.fa.fa-close
|
38
|
+
li
|
39
|
+
= link_to comable.resume_payment_admin_order_path(payment.order), options_of_payment_badge_for(payment, state: :resumed).merge(method: :post) do
|
40
|
+
i.fa.fa-refresh
|
@@ -0,0 +1,44 @@
|
|
1
|
+
section.row
|
2
|
+
.col-sm-2
|
3
|
+
.comable-flow-label
|
4
|
+
.comable-flow-label-container
|
5
|
+
label
|
6
|
+
| #{shipment.order.class.human_attribute_name(:shipment_state)}:
|
7
|
+
p
|
8
|
+
= shipment.human_state_name
|
9
|
+
|
10
|
+
.col-sm-10
|
11
|
+
ul.comable-flow
|
12
|
+
li
|
13
|
+
= content_tag :div, options_of_shipment_badge_for(shipment, state: :pending) do
|
14
|
+
i.fa.fa-circle
|
15
|
+
|
16
|
+
li
|
17
|
+
= content_tag :div, options_of_shipment_badge_for(shipment, state: :ready) do
|
18
|
+
i.fa.fa-check-circle
|
19
|
+
|
20
|
+
li
|
21
|
+
- if shipment.state?(:ready)
|
22
|
+
= link_to comable.ship_admin_order_path(shipment.order), options_of_shipment_badge_for(shipment, state: :completed).merge(method: :post, disabled: !@order.can_ship?) do
|
23
|
+
i.fa.fa-truck
|
24
|
+
- else
|
25
|
+
= content_tag :div, options_of_shipment_badge_for(shipment, state: :completed) do
|
26
|
+
i.fa.fa-truck
|
27
|
+
|
28
|
+
- if shipment.state?(:resumed)
|
29
|
+
li
|
30
|
+
= content_tag :div, options_of_shipment_badge_for(shipment, state: :resumed) do
|
31
|
+
i.fa.fa-refresh
|
32
|
+
|
33
|
+
- if shipment.state?(:completed) || shipment.state?(:resumed)
|
34
|
+
li
|
35
|
+
= link_to comable.cancel_shipment_admin_order_path(shipment.order), options_of_shipment_badge_for(shipment, state: :canceled).merge(method: :post) do
|
36
|
+
i.fa.fa-close
|
37
|
+
|
38
|
+
- if shipment.state?(:canceled)
|
39
|
+
li
|
40
|
+
= content_tag :div, options_of_shipment_badge_for(shipment, state: :canceled) do
|
41
|
+
i.fa.fa-close
|
42
|
+
li
|
43
|
+
= link_to comable.resume_shipment_admin_order_path(shipment.order), options_of_shipment_badge_for(shipment, state: :resumed).merge(method: :post) do
|
44
|
+
i.fa.fa-refresh
|
@@ -0,0 +1,170 @@
|
|
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.order'), comable.admin_orders_path
|
12
|
+
li>
|
13
|
+
= link_to @order.code, comable.admin_order_path(@order)
|
14
|
+
li.active
|
15
|
+
= Comable.t('admin.actions.edit')
|
16
|
+
|
17
|
+
.comable-page-body
|
18
|
+
section
|
19
|
+
= error_messages_for @order
|
20
|
+
|
21
|
+
= form_for @order, url: comable.admin_order_path(@order) do |f|
|
22
|
+
.hidden
|
23
|
+
= f.submit
|
24
|
+
|
25
|
+
fieldset
|
26
|
+
.col-md-3
|
27
|
+
legend
|
28
|
+
= Comable.t('admin.general')
|
29
|
+
.help-block
|
30
|
+
|
31
|
+
.col-md-9
|
32
|
+
.form-group
|
33
|
+
= f.label :email
|
34
|
+
= f.email_field :email
|
35
|
+
|
36
|
+
- if f.object.bill_address
|
37
|
+
hr
|
38
|
+
|
39
|
+
fieldset
|
40
|
+
.col-md-3
|
41
|
+
legend
|
42
|
+
= f.object.class.human_attribute_name(:bill_address)
|
43
|
+
.help-block
|
44
|
+
|
45
|
+
.col-md-9
|
46
|
+
= f.fields_for :bill_address do |ff|
|
47
|
+
.form-group
|
48
|
+
= ff.label :full_name
|
49
|
+
.row
|
50
|
+
.col-sm-6
|
51
|
+
= ff.text_field :family_name, placeholder: ff.object.class.human_attribute_name(:family_name)
|
52
|
+
.col-sm-6
|
53
|
+
= ff.text_field :first_name, placeholder: ff.object.class.human_attribute_name(:first_name)
|
54
|
+
|
55
|
+
.form-group
|
56
|
+
= ff.label :zip_code
|
57
|
+
= ff.text_field :zip_code, max_length: 8
|
58
|
+
|
59
|
+
.form-group
|
60
|
+
= ff.label :state_name
|
61
|
+
= ff.text_field :state_name
|
62
|
+
|
63
|
+
.form-group
|
64
|
+
= ff.label :city
|
65
|
+
= ff.text_field :city
|
66
|
+
|
67
|
+
.form-group
|
68
|
+
= ff.label :detail
|
69
|
+
= ff.text_field :detail
|
70
|
+
|
71
|
+
.form-group
|
72
|
+
= ff.label :phone_number
|
73
|
+
= ff.text_field :phone_number, max_length: 18
|
74
|
+
|
75
|
+
- if f.object.ship_address
|
76
|
+
hr
|
77
|
+
|
78
|
+
fieldset
|
79
|
+
.col-md-3
|
80
|
+
legend
|
81
|
+
= f.object.class.human_attribute_name(:ship_address)
|
82
|
+
.help-block
|
83
|
+
|
84
|
+
.col-md-9
|
85
|
+
= f.fields_for :ship_address do |ff|
|
86
|
+
.form-group
|
87
|
+
= ff.label :full_name
|
88
|
+
.row
|
89
|
+
.col-sm-6
|
90
|
+
= ff.text_field :family_name, placeholder: ff.object.class.human_attribute_name(:family_name)
|
91
|
+
.col-sm-6
|
92
|
+
= ff.text_field :first_name, placeholder: ff.object.class.human_attribute_name(:first_name)
|
93
|
+
|
94
|
+
.form-group
|
95
|
+
= ff.label :zip_code
|
96
|
+
= ff.text_field :zip_code, max_length: 8
|
97
|
+
|
98
|
+
.form-group
|
99
|
+
= ff.label :state_name
|
100
|
+
= ff.text_field :state_name
|
101
|
+
|
102
|
+
.form-group
|
103
|
+
= ff.label :city
|
104
|
+
= ff.text_field :city
|
105
|
+
|
106
|
+
.form-group
|
107
|
+
= ff.label :detail
|
108
|
+
= ff.text_field :detail
|
109
|
+
|
110
|
+
.form-group
|
111
|
+
= ff.label :phone_number
|
112
|
+
= ff.text_field :phone_number, max_length: 18
|
113
|
+
|
114
|
+
- if f.object.order_items
|
115
|
+
hr
|
116
|
+
|
117
|
+
fieldset
|
118
|
+
.col-md-3
|
119
|
+
legend
|
120
|
+
= f.object.class.human_attribute_name(:order_items)
|
121
|
+
.help-block
|
122
|
+
|
123
|
+
.col-md-9
|
124
|
+
table.table
|
125
|
+
thead
|
126
|
+
tr
|
127
|
+
th colspan="2"
|
128
|
+
= f.object.order_items.klass.human_attribute_name(:product)
|
129
|
+
th
|
130
|
+
= f.object.order_items.klass.human_attribute_name(:price)
|
131
|
+
th
|
132
|
+
= f.object.order_items.klass.human_attribute_name(:quantity)
|
133
|
+
th
|
134
|
+
= f.object.order_items.klass.human_attribute_name(:subtotal_price)
|
135
|
+
tbody
|
136
|
+
= f.fields_for :order_items do |ff|
|
137
|
+
tr.comable-order-items
|
138
|
+
td width="180"
|
139
|
+
= image_tag ff.object.image_url, width: '100%'
|
140
|
+
td
|
141
|
+
p
|
142
|
+
= ff.text_field :name, placeholder: ff.object.class.human_attribute_name(:name), data: { name: 'name' }
|
143
|
+
p.text-muted
|
144
|
+
= ff.text_field :code, placeholder: ff.object.class.human_attribute_name(:code), data: { name: 'code' }
|
145
|
+
td
|
146
|
+
= ff.text_field :price, placeholder: ff.object.class.human_attribute_name(:price), data: { name: 'price' }
|
147
|
+
td
|
148
|
+
= ff.text_field :quantity, placeholder: ff.object.class.human_attribute_name(:quantity), data: { name: 'quantity' }
|
149
|
+
td
|
150
|
+
= ff.text_field :subtotal_price, disabled: true, data: { name: 'subtotal_price' }
|
151
|
+
tr
|
152
|
+
th.text-right colspan="4"
|
153
|
+
= f.object.class.human_attribute_name(:item_total_price)
|
154
|
+
td
|
155
|
+
= f.text_field :item_total_price, disabled: true, data: { name: 'item_total_price' }
|
156
|
+
tr
|
157
|
+
th.text-right colspan="4"
|
158
|
+
= f.object.class.human_attribute_name(:payment_fee)
|
159
|
+
td
|
160
|
+
= f.text_field :payment_fee, data: { name: 'payment_fee' }
|
161
|
+
tr
|
162
|
+
th.text-right colspan="4"
|
163
|
+
= f.object.class.human_attribute_name(:shipment_fee)
|
164
|
+
td
|
165
|
+
= f.text_field :shipment_fee, data: { name: 'shipment_fee' }
|
166
|
+
tr
|
167
|
+
th.text-right colspan="4"
|
168
|
+
= f.object.class.human_attribute_name(:total_price)
|
169
|
+
td
|
170
|
+
= f.text_field :total_price, disabled: true, data: { name: 'total_price' }
|