comable_backend 0.3.4 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/comable/admin/application.coffee +4 -0
  3. data/app/assets/stylesheets/comable/admin/_common.scss +23 -0
  4. data/app/assets/stylesheets/comable/admin/_flow.scss +149 -0
  5. data/app/assets/stylesheets/comable/admin/application.scss +1 -0
  6. data/app/assets/stylesheets/comable/admin/overrides/bootstrap.scss +1 -0
  7. data/app/controllers/comable/admin/application_controller.rb +24 -4
  8. data/app/controllers/comable/admin/dashboard_controller.rb +4 -4
  9. data/app/controllers/comable/admin/orders_controller.rb +82 -1
  10. data/app/controllers/comable/admin/payment_methods_controller.rb +1 -0
  11. data/app/controllers/comable/admin/products_controller.rb +16 -0
  12. data/app/controllers/comable/admin/stocks_controller.rb +16 -0
  13. data/app/controllers/comable/admin/trackers_controller.rb +58 -0
  14. data/app/controllers/comable/admin/{customers_controller.rb → users_controller.rb} +8 -8
  15. data/app/helpers/comable/admin/orders_helper.rb +30 -0
  16. data/app/views/comable/admin/categories/index.slim +2 -2
  17. data/app/views/comable/admin/dashboard/show.slim +9 -10
  18. data/app/views/comable/admin/orders/_payment_state.slim +40 -0
  19. data/app/views/comable/admin/orders/_shipment_state.slim +44 -0
  20. data/app/views/comable/admin/orders/edit.slim +112 -0
  21. data/app/views/comable/admin/orders/index.slim +22 -6
  22. data/app/views/comable/admin/orders/show.slim +141 -110
  23. data/app/views/comable/admin/payment_methods/_form.slim +6 -2
  24. data/app/views/comable/admin/products/_form.slim +9 -9
  25. data/app/views/comable/admin/products/index.slim +16 -0
  26. data/app/views/comable/admin/shared/_header.slim +3 -3
  27. data/app/views/comable/admin/shared/_sidebar.slim +5 -3
  28. data/app/views/comable/admin/shared/export.xlsx.axlsx +17 -0
  29. data/app/views/comable/admin/shipment_methods/_form.slim +2 -2
  30. data/app/views/comable/admin/stocks/_form.slim +2 -2
  31. data/app/views/comable/admin/stocks/index.slim +16 -0
  32. data/app/views/comable/admin/store/_form.slim +2 -2
  33. data/app/views/comable/admin/trackers/_form.slim +109 -0
  34. data/app/views/comable/admin/trackers/edit.slim +27 -0
  35. data/app/views/comable/admin/trackers/index.slim +37 -0
  36. data/app/views/comable/admin/trackers/new.slim +16 -0
  37. data/app/views/comable/admin/{customers → users}/edit.slim +10 -10
  38. data/app/views/comable/admin/{customers → users}/index.slim +20 -20
  39. data/app/views/comable/admin/users/show.slim +88 -0
  40. data/app/views/layouts/comable/admin/application.slim +1 -1
  41. data/config/routes.rb +31 -4
  42. metadata +19 -8
  43. data/app/views/comable/admin/customers/show.slim +0 -88
@@ -5,11 +5,11 @@
5
5
  = f.submit
6
6
 
7
7
  fieldset
8
- .col-sm-3
8
+ .col-md-3
9
9
  legend
10
10
  = Comable.t('admin.general')
11
11
 
12
- .col-sm-9
12
+ .col-md-9
13
13
  .form-group
14
14
  = f.label :name
15
15
  = f.text_field :name
@@ -8,12 +8,12 @@
8
8
  = f.submit
9
9
 
10
10
  fieldset
11
- .col-sm-3
11
+ .col-md-3
12
12
  legend
13
13
  = Comable.t('admin.general')
14
14
  .help-block
15
15
 
16
- .col-sm-9
16
+ .col-md-9
17
17
  .form-group
18
18
  = f.label :code
19
19
  = f.text_field :code
@@ -9,6 +9,22 @@
9
9
  = link_to_next_page @stocks, '>', class: 'btn btn-default' do
10
10
  .btn.btn-default disabled="disabled"
11
11
  | >
12
+ li.dropdown
13
+ = link_to '#', class: 'btn btn-default', 'data-toggle' => 'dropdown' do
14
+ = Comable.t('admin.more')
15
+ i.fa.fa-angle-down<
16
+ ul.dropdown-menu.dropdown-menu-right
17
+ li
18
+ = link_to Comable.t('admin.export_to_csv'), comable.export_admin_stocks_path(format: :csv, q: params[:q])
19
+ li
20
+ = link_to Comable.t('admin.export_to_excel'), comable.export_admin_stocks_path(format: :xlsx, q: params[:q])
21
+ li.divider
22
+ li
23
+ a.btn-file
24
+ span>
25
+ = Comable.t('admin.import')
26
+ = form_tag comable.import_admin_stocks_path, multipart: true do
27
+ = file_field_tag :file
12
28
 
13
29
  h1.page-header
14
30
  = Comable.t('admin.nav.stock')
@@ -5,12 +5,12 @@
5
5
  = f.submit
6
6
 
7
7
  fieldset
8
- .col-sm-3
8
+ .col-md-3
9
9
  legend
10
10
  = Comable.t('admin.general')
11
11
  .help-block
12
12
 
13
- .col-sm-9
13
+ .col-md-9
14
14
  .form-group
15
15
  = f.label :name
16
16
  = f.text_field :name, placeholder: f.object.class.default_name
@@ -0,0 +1,109 @@
1
+ = error_messages_for @tracker
2
+
3
+ = form_for [comable, :admin, @tracker] 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
+ .checkbox
15
+ = f.label :activate_flag do
16
+ = f.check_box :activate_flag
17
+ = f.object.class.human_attribute_name(:activate_flag)
18
+
19
+ .form-group
20
+ = f.label :name
21
+ = f.text_field :name
22
+
23
+ .form-group
24
+ = f.label :tracker_id
25
+ = f.text_field :tracker_id
26
+
27
+ .form-group
28
+ = f.label :code
29
+ = f.text_area :code, rows: (f.object.code ? f.object.code.lines.count : nil)
30
+
31
+ br
32
+
33
+ .panel.panel-default
34
+ .panel-heading type="button" data-toggle="collapse" data-target="#comable-help-code"
35
+ strong
36
+ span.fa.fa-angle-down>
37
+ = Comable.t('admin.help')
38
+ .collapse#comable-help-code
39
+ .panel-body.help-block
40
+ p
41
+ == Comable.t('admin.tracker_code_help_introduction')
42
+ p
43
+ = Comable.t('admin.list_of_usable_variables')
44
+ dl.dl-horizontal
45
+ dt
46
+ = Comable::Tracker.human_attribute_name(:tracker_id)
47
+ dd
48
+ | tracker_id
49
+ dt
50
+ = Comable::Order.human_attribute_name(:code)
51
+ dd
52
+ | order.code
53
+ dt
54
+ = Comable::Order.human_attribute_name(:payment_fee)
55
+ dd
56
+ | order.payment_fee
57
+ dt
58
+ = Comable::Order.human_attribute_name(:shipment_fee)
59
+ dd
60
+ | order.shipment_fee
61
+ dt
62
+ = Comable::Order.human_attribute_name(:item_total_price)
63
+ dd
64
+ | order.item_total_price
65
+ dt
66
+ = Comable::Order.human_attribute_name(:total_price)
67
+ dd
68
+ | order.total_price
69
+ dt
70
+ = Comable::Order.human_attribute_name(:order_items)
71
+ dd
72
+ | order.order_items
73
+ p
74
+ == Comable.t('admin.tracker_code_help_additional')
75
+ dl.dl-horizontal
76
+ dt
77
+ = Comable::OrderItem.human_attribute_name(:code)
78
+ dd
79
+ | order_item.code
80
+ dt
81
+ = Comable::OrderItem.human_attribute_name(:name)
82
+ dd
83
+ | order_item.name
84
+ dt
85
+ = Comable::OrderItem.human_attribute_name(:name_with_sku)
86
+ dd
87
+ | order_item.name_with_sku
88
+ dt
89
+ = Comable::OrderItem.human_attribute_name(:subtotal_price)
90
+ dd
91
+ | order_item.subtotal_price
92
+ dt
93
+ = Comable::OrderItem.human_attribute_name(:quantity)
94
+ dd
95
+ | order_item.quantity
96
+ dt
97
+ = Comable::OrderItem.human_attribute_name(:price)
98
+ dd
99
+ | order_item.price
100
+ p
101
+ = Comable.t('admin.mote_infomation_for_syntax')
102
+ | &nbsp;
103
+ = link_to 'http://liquidmarkup.org/', target: :_blank do
104
+ | Liquid Templating language
105
+ i.fa.fa-external-link<
106
+
107
+ .form-group
108
+ = f.label :place
109
+ = f.select :place, f.object.class.place.options
@@ -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.tracker'), comable.admin_trackers_path
12
+ li.active
13
+ = @tracker.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_tracker_path(@tracker), method: :delete, class: 'btn btn-danger'
@@ -0,0 +1,37 @@
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_tracker_path, class: 'btn btn-default'
6
+
7
+ h1.page-header
8
+ = Comable.t('admin.nav.tracker')
9
+ small<
10
+ | #{@trackers.total_count} #{Comable.t('admin.results')}
11
+
12
+ .comable-page-body
13
+ - if @trackers.empty?
14
+ = Comable.t('admin.not_found')
15
+ - else
16
+ table.table.table-striped
17
+ thead
18
+ th
19
+ = @trackers.klass.human_attribute_name(:name)
20
+ th
21
+ = @trackers.klass.human_attribute_name(:tracker_id)
22
+ th
23
+ = @trackers.klass.human_attribute_name(:place)
24
+ tbody
25
+ - @trackers.each do |tracker|
26
+ tr
27
+ td
28
+ = link_to tracker.name, comable.admin_tracker_path(tracker)
29
+ - unless tracker.activate_flag
30
+ span.fa.fa-eye-slash.text-muted<
31
+ td
32
+ = tracker.tracker_id
33
+ td
34
+ = tracker.place.text
35
+
36
+ .text-center
37
+ = paginate @trackers, 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.tracker'), comable.admin_trackers_path
12
+ li.active
13
+ = Comable.t('admin.actions.new')
14
+
15
+ .comable-page-body
16
+ = render 'form'
@@ -8,30 +8,30 @@
8
8
  h1.page-header
9
9
  ol.breadcrumb
10
10
  li>
11
- = link_to Comable.t('admin.nav.customer'), comable.admin_customers_path
11
+ = link_to Comable.t('admin.nav.user'), comable.admin_users_path
12
12
  li>
13
- = link_to @customer.human_id, comable.admin_customer_path(@customer)
13
+ = link_to @user.human_id, comable.admin_user_path(@user)
14
14
  li.active
15
15
  = Comable.t('admin.actions.edit')
16
16
 
17
17
  .comable-page-body
18
18
  section
19
- = error_messages_for @customer
19
+ = error_messages_for @user
20
20
 
21
- = form_for @customer, url: comable.admin_customer_path(@customer) do |f|
21
+ = form_for @user, url: comable.admin_user_path(@user) do |f|
22
22
  .hidden
23
23
  = f.submit
24
24
 
25
25
  fieldset
26
- .col-sm-3
26
+ .col-md-3
27
27
  legend
28
28
  = Comable.t('admin.general')
29
29
  .help-block
30
30
 
31
- .col-sm-9
31
+ .col-md-9
32
32
  .form-group
33
33
  = f.label :role
34
- = f.select :role, @customer.class.role.options, {}, disabled: (@customer == current_customer)
34
+ = f.select :role, @user.class.role.options, {}, disabled: (@user == current_comable_user)
35
35
 
36
36
  .form-group
37
37
  = f.label :email
@@ -41,14 +41,14 @@
41
41
  = f.label :password
42
42
  = f.password_field :password
43
43
 
44
- - if @customer.bill_address
44
+ - if @user.bill_address
45
45
  fieldset
46
- .col-sm-3
46
+ .col-md-3
47
47
  legend
48
48
  = f.object.class.human_attribute_name(:bill_address)
49
49
  .help-block
50
50
 
51
- .col-sm-9
51
+ .col-md-9
52
52
  = f.fields_for :bill_address do |ff|
53
53
  .form-group
54
54
  = ff.label :full_name
@@ -3,21 +3,21 @@
3
3
  ul.pull-right.list-inline
4
4
  li
5
5
  .btn-group role="group"
6
- = link_to_previous_page @customers, '<', class: 'btn btn-default' do
6
+ = link_to_previous_page @users, '<', class: 'btn btn-default' do
7
7
  .btn.btn-default disabled="disabled"
8
8
  | <
9
- = link_to_next_page @customers, '>', class: 'btn btn-default' do
9
+ = link_to_next_page @users, '>', class: 'btn btn-default' do
10
10
  .btn.btn-default disabled="disabled"
11
11
  | >
12
12
 
13
13
  h1.page-header
14
- = Comable.t('admin.nav.customer')
14
+ = Comable.t('admin.nav.user')
15
15
  small<
16
- | #{@customers.total_count} #{Comable.t('admin.results')}
16
+ | #{@users.total_count} #{Comable.t('admin.results')}
17
17
 
18
18
  .comable-page-body
19
19
  .comable-search
20
- = search_form_for @q, url: comable.admin_customers_path do |f|
20
+ = search_form_for @q, url: comable.admin_users_path do |f|
21
21
  .input-group
22
22
  span.input-group-btn
23
23
  button.btn.btn-default.dropdown-toggle type="button" data-toggle="dropdown"
@@ -27,7 +27,7 @@
27
27
  li
28
28
  = link_to Comable.t('admin.advanced_search'), 'javascript:void(0)', 'data-toggle' => 'collapse', 'data-target' => '#comable-advanced-search'
29
29
  li
30
- = link_to Comable.t('admin.clear_search_conditions'), comable.admin_customers_path
30
+ = link_to Comable.t('admin.clear_search_conditions'), comable.admin_users_path
31
31
  = f.text_field :email_cont, class: 'form-control'
32
32
  span.input-group-btn
33
33
  = f.submit Comable.t('admin.search'), class: 'btn btn-default'
@@ -35,7 +35,7 @@
35
35
  = render 'comable/admin/shared/advanced_search', f: f
36
36
 
37
37
  section
38
- - if @customers.empty?
38
+ - if @users.empty?
39
39
  = Comable.t('admin.not_found')
40
40
  - else
41
41
  table.table.table-striped
@@ -45,27 +45,27 @@
45
45
  th
46
46
  = sort_link [:comable, @q], :email
47
47
  th
48
- = @customers.klass.human_attribute_name(:bill_full_name)
48
+ = @users.klass.human_attribute_name(:bill_full_name)
49
49
  th
50
- = @customers.klass.human_attribute_name(:bill_address)
50
+ = @users.klass.human_attribute_name(:bill_address)
51
51
  th
52
- = @customers.klass.human_attribute_name(:orders)
52
+ = @users.klass.human_attribute_name(:orders)
53
53
  tbody
54
- - @customers.each do |customer|
54
+ - @users.each do |user|
55
55
  tr
56
56
  td
57
- = link_to customer.human_id, comable.admin_customer_path(customer)
57
+ = link_to user.human_id, comable.admin_user_path(user)
58
58
  td
59
- = customer.email
59
+ = user.email
60
60
  td
61
- = customer.bill_full_name
61
+ = user.bill_full_name
62
62
  td
63
- - if customer.bill_address
64
- span> = customer.bill_address.state_name
65
- span> = customer.bill_address.city
66
- span> = customer.bill_address.detail
63
+ - if user.bill_address
64
+ span> = user.bill_address.state_name
65
+ span> = user.bill_address.city
66
+ span> = user.bill_address.detail
67
67
  td
68
- | #{customer.orders.count} #{Comable.t('admin.times')}
68
+ | #{user.orders.count} #{Comable.t('admin.times')}
69
69
 
70
70
  .text-center
71
- = paginate @customers, theme: :comable_backend
71
+ = paginate @users, theme: :comable_backend
@@ -0,0 +1,88 @@
1
+ .comable-page
2
+ .comable-page-heading
3
+ ul.pull-right.list-inline
4
+ li.btn-group
5
+ = link_to comable.edit_admin_user_path(@user), class: 'btn btn-default' do
6
+ span.fa.fa-edit>
7
+ = Comable.t('admin.actions.edit')
8
+ = link_to Comable.t('admin.nav.order'), comable.admin_orders_path(q: { user_id_eq: @user.id }), class: 'btn btn-default'
9
+ li
10
+ / TODO: Comment out after implemented.
11
+ / = link_to Comable.t('admin.nav.orders.cart'), '#', class: 'btn btn-default'
12
+
13
+ h1.page-header
14
+ ol.breadcrumb
15
+ li>
16
+ = link_to Comable.t('admin.nav.user'), comable.admin_users_path
17
+ li.active
18
+ = @user.human_id
19
+ - if @user.bill_full_name
20
+ small<
21
+ = Comable.t('honorific', name: @user.bill_full_name)
22
+
23
+ .comable-page-body
24
+ section
25
+ dl.dl-horizontal
26
+ dt
27
+ = @user.class.human_attribute_name(:role)
28
+ dd
29
+ = @user.role.text
30
+ dt
31
+ = @user.class.human_attribute_name(:email)
32
+ dd
33
+ = @user.email
34
+ - if @user.bill_address
35
+ dt
36
+ = @user.class.human_attribute_name(:bill_address)
37
+ dd
38
+ ul.list-unstyled
39
+ li = @user.bill_address.zip_code
40
+ li = @user.bill_address.full_name
41
+ li = @user.bill_address.state_name
42
+ li = @user.bill_address.city
43
+ li = @user.bill_address.detail
44
+ li = "#{@user.bill_address.class.human_attribute_name(:phone_number)}: #{@user.bill_address.phone_number}"
45
+
46
+ - if @user.orders.any?
47
+ section
48
+ .panel.panel-default
49
+ .panel-heading
50
+ .panel-title
51
+ = Comable.t('admin.nav.users.new_orders', count: 5)
52
+
53
+ table.table
54
+ thead
55
+ tr
56
+ th
57
+ = @user.orders.klass.human_attribute_name(:code)
58
+ th
59
+ = @user.orders.klass.human_attribute_name(:state)
60
+ th
61
+ = @user.orders.klass.human_attribute_name(:bill_full_name)
62
+ th
63
+ = @user.orders.klass.human_attribute_name(:order_items)
64
+ th
65
+ = @user.orders.klass.human_attribute_name(:total_price)
66
+ th
67
+ = @user.orders.klass.human_attribute_name(:completed_at)
68
+ tbody
69
+ - @user.orders.limit(5).each do |order|
70
+ tr
71
+ td
72
+ = link_to order.code, comable.admin_order_path(order)
73
+ td
74
+ = order.human_state_name
75
+ td
76
+ = order.bill_full_name
77
+ td
78
+ ul.list-unstyled
79
+ - order.order_items.each do |order_item|
80
+ li
81
+ | #{order_item.name_with_sku} x #{order_item.quantity}
82
+ td
83
+ = number_to_currency order.total_price
84
+ td
85
+ = l order.completed_at
86
+
87
+ .panel-footer.text-right
88
+ = link_to Comable.t('admin.more'), comable.admin_orders_path(search_user_id: @user.id), class: 'btn btn-default'