spree_admin 5.1.0.beta4 → 5.1.0.rc1
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.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/spree/admin/components/_badges.scss +4 -0
- data/app/assets/stylesheets/spree/admin/components/_buttons.scss +13 -2
- data/app/assets/stylesheets/spree/admin/components/_filters.scss +8 -1
- data/app/assets/stylesheets/spree/admin/components/_main.scss +13 -1
- data/app/assets/stylesheets/spree/admin/components/_media_form.scss +1 -1
- data/app/assets/stylesheets/spree/admin/components/_modals.scss +3 -1
- data/app/assets/stylesheets/spree/admin/components/_navbar.scss +1 -1
- data/app/assets/stylesheets/spree/admin/components/_tables.scss +6 -10
- data/app/assets/stylesheets/spree/admin/components/_variants_form.scss +1 -1
- data/app/assets/stylesheets/spree/admin/global/_variables.scss +12 -7
- data/app/assets/stylesheets/spree/admin/shared/_base.scss +5 -0
- data/app/controllers/spree/admin/gift_card_batches_controller.rb +23 -0
- data/app/controllers/spree/admin/gift_cards_controller.rb +94 -0
- data/app/controllers/spree/admin/orders_controller.rb +19 -2
- data/app/controllers/spree/admin/payments_controller.rb +3 -0
- data/app/controllers/spree/admin/products_controller.rb +3 -3
- data/app/controllers/spree/admin/reimbursements_controller.rb +5 -1
- data/app/controllers/spree/admin/resource_controller.rb +12 -1
- data/app/controllers/spree/admin/search_controller.rb +22 -0
- data/app/controllers/spree/admin/store_credits_controller.rb +8 -5
- data/app/helpers/spree/admin/base_helper.rb +55 -0
- data/app/helpers/spree/admin/navigation_helper.rb +2 -2
- data/app/helpers/spree/admin/payments_helper.rb +0 -5
- data/app/helpers/spree/admin/products_helper.rb +1 -1
- data/app/helpers/spree/admin/promotion_rules_helper.rb +13 -1
- data/app/helpers/spree/admin/shipment_helper.rb +2 -0
- data/app/javascript/spree/admin/application.js +2 -0
- data/app/javascript/spree/admin/controllers/active_storage_upload_controller.js +2 -11
- data/app/javascript/spree/admin/controllers/return_items_controller.js +6 -1
- data/app/javascript/spree/admin/controllers/sticky_controller.js +24 -0
- data/app/javascript/spree/admin/controllers/variants_form_controller.js +1 -1
- data/app/javascript/spree/admin/helpers/uppy_active_storage.js +15 -3
- data/app/views/active_storage/_upload_form.html.erb +3 -3
- data/app/views/spree/admin/coupon_codes/_coupon_code.html.erb +2 -6
- data/app/views/spree/admin/coupon_codes/index.csv.erb +1 -1
- data/app/views/spree/admin/custom_domains/edit.html.erb +2 -3
- data/app/views/spree/admin/custom_domains/new.html.erb +2 -3
- data/app/views/spree/admin/dashboard/_setup_progress.html.erb +2 -3
- data/app/views/spree/admin/dashboard/_store_preview.html.erb +3 -9
- data/app/views/spree/admin/gift_card_batches/_form.html.erb +30 -0
- data/app/views/spree/admin/gift_card_batches/new.html.erb +15 -0
- data/app/views/spree/admin/gift_cards/_filters.html.erb +43 -0
- data/app/views/spree/admin/gift_cards/_form.html.erb +30 -0
- data/app/views/spree/admin/gift_cards/_gift_card.html.erb +28 -0
- data/app/views/spree/admin/gift_cards/_list.html.erb +24 -0
- data/app/views/spree/admin/gift_cards/_table_filter_dropdown.html.erb +25 -0
- data/app/views/spree/admin/gift_cards/edit.html.erb +20 -0
- data/app/views/spree/admin/gift_cards/index.csv.erb +22 -0
- data/app/views/spree/admin/gift_cards/index.html.erb +41 -0
- data/app/views/spree/admin/gift_cards/new.html.erb +30 -0
- data/app/views/spree/admin/gift_cards/show.html.erb +199 -0
- data/app/views/spree/admin/integrations/new.html.erb +7 -4
- data/app/views/spree/admin/oauth_applications/edit.html.erb +2 -3
- data/app/views/spree/admin/oauth_applications/new.html.erb +2 -3
- data/app/views/spree/admin/orders/_customer.html.erb +5 -2
- data/app/views/spree/admin/orders/_payments.html.erb +1 -1
- data/app/views/spree/admin/orders/_return_authorizations.html.erb +3 -1
- data/app/views/spree/admin/orders/_shipment.html.erb +1 -1
- data/app/views/spree/admin/orders/_shipments.html.erb +1 -1
- data/app/views/spree/admin/orders/return_authorizations/_form.html.erb +13 -11
- data/app/views/spree/admin/page_sections/forms/_featured_posts.html.erb +0 -5
- data/app/views/spree/admin/pages/_form.html.erb +20 -26
- data/app/views/spree/admin/pages/new.html.erb +10 -4
- data/app/views/spree/admin/payments/_payment.html.erb +14 -9
- data/app/views/spree/admin/payments/new.html.erb +1 -1
- data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +1 -1
- data/app/views/spree/admin/post_categories/edit.html.erb +2 -3
- data/app/views/spree/admin/post_categories/new.html.erb +2 -3
- data/app/views/spree/admin/products/edit.html.erb +2 -2
- data/app/views/spree/admin/promotion_actions/_promotion_action.html.erb +1 -1
- data/app/views/spree/admin/promotion_actions/edit.html.erb +2 -2
- data/app/views/spree/admin/promotion_rules/_promotion_rule.html.erb +26 -9
- data/app/views/spree/admin/promotion_rules/edit.html.erb +2 -2
- data/app/views/spree/admin/promotion_rules/forms/_option_value.html.erb +1 -1
- data/app/views/spree/admin/promotions/_actions.html.erb +2 -2
- data/app/views/spree/admin/promotions/_rules.html.erb +2 -2
- data/app/views/spree/admin/promotions/_sidebar.html.erb +5 -13
- data/app/views/spree/admin/properties/edit.html.erb +9 -5
- data/app/views/spree/admin/properties/new.html.erb +9 -5
- data/app/views/spree/admin/refunds/new.html.erb +6 -1
- data/app/views/spree/admin/reimbursement_types/edit.html.erb +2 -3
- data/app/views/spree/admin/reimbursement_types/new.html.erb +2 -4
- data/app/views/spree/admin/shared/_content_header.html.erb +9 -4
- data/app/views/spree/admin/shared/_edit_resource_links.html.erb +3 -1
- data/app/views/spree/admin/shared/_header.html.erb +2 -2
- data/app/views/spree/admin/shared/_index_table_options.html.erb +1 -1
- data/app/views/spree/admin/shared/_preferences.html.erb +1 -0
- data/app/views/spree/admin/shared/_sidebar.html.erb +1 -1
- data/app/views/spree/admin/shared/_user.html.erb +2 -7
- data/app/views/spree/admin/shared/named_types/_edit.html.erb +2 -3
- data/app/views/spree/admin/shared/named_types/_new.html.erb +2 -3
- data/app/views/spree/admin/shared/sortable_tree/_taxonomy.html.erb +1 -1
- data/app/views/spree/admin/shipping_categories/edit.html.erb +7 -4
- data/app/views/spree/admin/shipping_categories/new.html.erb +7 -6
- data/app/views/spree/admin/shipping_methods/form/_display.html.erb +23 -1
- data/app/views/spree/admin/stock_locations/_form.html.erb +35 -51
- data/app/views/spree/admin/stock_locations/edit.html.erb +8 -3
- data/app/views/spree/admin/stock_locations/new.html.erb +8 -5
- data/app/views/spree/admin/store_credit_events/_store_credit_event.html.erb +29 -0
- data/app/views/spree/admin/store_credits/_form.html.erb +13 -21
- data/app/views/spree/admin/store_credits/_list.html.erb +4 -24
- data/app/views/spree/admin/store_credits/_store_credit.html.erb +11 -0
- data/app/views/spree/admin/store_credits/edit.html.erb +16 -31
- data/app/views/spree/admin/store_credits/new.html.erb +14 -12
- data/app/views/spree/admin/store_credits/show.html.erb +145 -0
- data/app/views/spree/admin/stores/form/_basic.html.erb +26 -10
- data/app/views/spree/admin/tax_categories/_form.html.erb +1 -1
- data/app/views/spree/admin/tax_categories/edit.html.erb +7 -4
- data/app/views/spree/admin/tax_categories/new.html.erb +7 -4
- data/app/views/spree/admin/tax_rates/_form.html.erb +34 -32
- data/app/views/spree/admin/tax_rates/edit.html.erb +7 -4
- data/app/views/spree/admin/tax_rates/new.html.erb +7 -7
- data/app/views/spree/admin/taxonomies/edit.html.erb +2 -4
- data/app/views/spree/admin/taxonomies/new.html.erb +2 -2
- data/app/views/spree/admin/translations/edit.html.erb +2 -2
- data/app/views/spree/admin/translations/stores/_form.html.erb +2 -0
- data/app/views/spree/admin/users/_details.html.erb +1 -0
- data/app/views/spree/admin/users/index.html.erb +1 -1
- data/app/views/spree/admin/users/new.html.erb +9 -5
- data/app/views/spree/admin/users/show.html.erb +3 -3
- data/app/views/spree/admin/variants/form/_inventory.html.erb +1 -1
- data/app/views/spree/admin/zones/_form.html.erb +36 -40
- data/app/views/spree/admin/zones/edit.html.erb +7 -5
- data/app/views/spree/admin/zones/new.html.erb +7 -4
- data/config/locales/en.yml +12 -1
- data/config/routes.rb +8 -2
- metadata +27 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfb0755ba829d1de51777fd66fa98729eb800e9e16987ac363aa681234e7e753
|
4
|
+
data.tar.gz: 45e85e834bd1d24a4b06c326c67da0cf3ba4e8e6d659aab47092274545e37c4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d80798a2622f42da2419e1fc3d97ad57a7f54f15464179200a27ac445c4ffdb6f154b08ea735d21b542e85583aa0e4bd2c2cc90cecb273a07e25d3bd4ea4c456
|
7
|
+
data.tar.gz: b0028cb04dbfa94bc254045ab7316effbf0b9b4f23a1c3923ce7bf570b873a122091f82f016052a7d3d1e45eb1e58eda9d49b1081f935604e432a7a3d8df462b
|
@@ -34,6 +34,7 @@
|
|
34
34
|
.badge-approved,
|
35
35
|
.badge-resolved,
|
36
36
|
.badge-reimbursed,
|
37
|
+
.badge-allocation,
|
37
38
|
.bg-success {
|
38
39
|
border: 1px solid rgba($success, 0.05);
|
39
40
|
background-color: #C6F6D5 !important;
|
@@ -89,6 +90,8 @@
|
|
89
90
|
.badge-draft,
|
90
91
|
.badge-onboarding,
|
91
92
|
.badge-light,
|
93
|
+
.badge-authorize,
|
94
|
+
.badge-eligible,
|
92
95
|
.badge-invited {
|
93
96
|
@extend .bg-white;
|
94
97
|
@extend .text-muted;
|
@@ -104,6 +107,7 @@
|
|
104
107
|
.badge-notice,
|
105
108
|
.badge-update,
|
106
109
|
.badge-partial,
|
110
|
+
.badge-capture,
|
107
111
|
.badge-info {
|
108
112
|
border: 1px solid rgba($info, 0.05);
|
109
113
|
background-color: #E0EFFE;
|
@@ -68,7 +68,7 @@ button[disabled] .show-when-enabled { display: none; }
|
|
68
68
|
|
69
69
|
.hover-light {
|
70
70
|
&:hover, &:focus {
|
71
|
-
background-color: $
|
71
|
+
background-color: $gray-25;
|
72
72
|
text-decoration: none;
|
73
73
|
}
|
74
74
|
}
|
@@ -148,7 +148,7 @@ button[disabled] .show-when-enabled { display: none; }
|
|
148
148
|
color: $gray-700;
|
149
149
|
|
150
150
|
&:hover, &:focus {
|
151
|
-
border-color: $
|
151
|
+
border-color: $border-color;
|
152
152
|
background-color: $gray-25;
|
153
153
|
color: $gray-900;
|
154
154
|
}
|
@@ -174,6 +174,17 @@ button[disabled] .show-when-enabled { display: none; }
|
|
174
174
|
}
|
175
175
|
}
|
176
176
|
|
177
|
+
.btn-clipboard {
|
178
|
+
@extend .btn-light;
|
179
|
+
@extend .btn-sm;
|
180
|
+
@extend .px-1;
|
181
|
+
@extend .ml-2;
|
182
|
+
@extend .font-size-sm;
|
183
|
+
|
184
|
+
min-width: 24px;
|
185
|
+
height: 24px;
|
186
|
+
}
|
187
|
+
|
177
188
|
.page-link {
|
178
189
|
@extend .btn;
|
179
190
|
@extend .btn-sm;
|
@@ -1,10 +1,17 @@
|
|
1
1
|
.filter-wrap {
|
2
2
|
padding: 0.5rem;
|
3
|
-
border-bottom: 1px solid $
|
3
|
+
border-bottom: 1px solid $gray-50;
|
4
4
|
gap: 0.5rem;
|
5
|
+
position: sticky;
|
6
|
+
top: $header-height;
|
7
|
+
z-index: 1000;
|
8
|
+
background-color: $card-bg;
|
9
|
+
border-top-left-radius: $border-radius-lg;
|
10
|
+
border-top-right-radius: $border-radius-lg;
|
5
11
|
|
6
12
|
.btn {
|
7
13
|
height: 2.125rem;
|
14
|
+
border-style: dashed;
|
8
15
|
}
|
9
16
|
}
|
10
17
|
|
@@ -6,6 +6,19 @@
|
|
6
6
|
height: 70px;
|
7
7
|
display: flex;
|
8
8
|
align-items: center;
|
9
|
+
background-color: $body-bg;
|
10
|
+
padding-left: 1.5rem;
|
11
|
+
padding-right: 1.5rem;
|
12
|
+
border-bottom: 1px solid $border-color;
|
13
|
+
margin-bottom: 1rem;
|
14
|
+
|
15
|
+
&.sticky-top {
|
16
|
+
padding-left: 1rem;
|
17
|
+
padding-right: 1rem;
|
18
|
+
animation: slideDown 0.3s ease-out;
|
19
|
+
height: $header-height;
|
20
|
+
border-bottom: 1px solid $border-color;
|
21
|
+
}
|
9
22
|
}
|
10
23
|
|
11
24
|
.page-header-title {
|
@@ -76,7 +89,6 @@
|
|
76
89
|
background-color: $sidebar-bg;
|
77
90
|
box-shadow: inset -1px 0 0 $border-color;
|
78
91
|
height: calc(100vh - $header-height);
|
79
|
-
overflow-y: auto;
|
80
92
|
overflow-x: hidden;
|
81
93
|
position: fixed;
|
82
94
|
top: $header-height;
|
@@ -14,9 +14,11 @@ body.modal-open {
|
|
14
14
|
|
15
15
|
.modal-header {
|
16
16
|
@extend .align-items-center;
|
17
|
+
border-color: $gray-50;
|
17
18
|
|
18
19
|
.modal-title {
|
19
20
|
margin-bottom: 0;
|
21
|
+
font-weight: $font-weight-bold;
|
20
22
|
}
|
21
23
|
|
22
24
|
.btn-close {
|
@@ -28,7 +30,7 @@ body.modal-open {
|
|
28
30
|
justify-content: end;
|
29
31
|
padding: $modal-inner-padding;
|
30
32
|
background-color: $gray-25;
|
31
|
-
border-top: 1px solid $
|
33
|
+
border-top: 1px solid $gray-50;
|
32
34
|
|
33
35
|
.btn {
|
34
36
|
display: inline-flex ;
|
@@ -2,16 +2,6 @@
|
|
2
2
|
color: $gray-800;
|
3
3
|
}
|
4
4
|
|
5
|
-
.filter-wrap {
|
6
|
-
padding: 0.5rem;
|
7
|
-
border-bottom: 1px solid $border-color;
|
8
|
-
gap: 0.5rem;
|
9
|
-
|
10
|
-
.btn {
|
11
|
-
height: 2.375rem;
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
15
5
|
#filters-search-bar {
|
16
6
|
max-width: 300px;
|
17
7
|
margin-right: auto;
|
@@ -215,3 +205,9 @@ td.actions {
|
|
215
205
|
}
|
216
206
|
}
|
217
207
|
}
|
208
|
+
|
209
|
+
.pagination-container {
|
210
|
+
border-top: 1px solid $gray-50;
|
211
|
+
padding-top: 0.5rem;
|
212
|
+
padding-bottom: 0.5rem;
|
213
|
+
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
// https://github.com/twbs/bootstrap/blob/v4.6.2/scss/_variables.scss
|
2
2
|
|
3
|
-
$gray-25: #
|
3
|
+
$gray-25: #F8F8F9;
|
4
4
|
$gray-50: #F3F3F3;
|
5
|
-
$gray-100: #
|
5
|
+
$gray-100: #E3E3E3 !default;
|
6
6
|
$gray-200: #D5D5D5 !default;
|
7
7
|
$gray-300: #B3B3B3 !default;
|
8
8
|
$gray-400: #999999 !default;
|
@@ -27,7 +27,7 @@ $container-max-widths: (
|
|
27
27
|
sm: 540px,
|
28
28
|
md: 720px,
|
29
29
|
lg: 960px,
|
30
|
-
xl:
|
30
|
+
xl: 1260px
|
31
31
|
) !default;
|
32
32
|
$grid-gutter-width: 16px !default;
|
33
33
|
|
@@ -81,7 +81,7 @@ $list-group-active-border-color: $action-border !default;
|
|
81
81
|
|
82
82
|
$thumbnail-border-color: $border-color !default;
|
83
83
|
$hr-border-color: $border-color !default;
|
84
|
-
$table-border-color: $
|
84
|
+
$table-border-color: $gray-50 !default;
|
85
85
|
$card-border-color: $border-color !default;
|
86
86
|
$input-btn-focus-width: 0.18rem !default;
|
87
87
|
|
@@ -92,7 +92,7 @@ $component-active-bg: $blue !default;
|
|
92
92
|
|
93
93
|
$input-placeholder-color: $gray-500;
|
94
94
|
$input-padding-y: .5rem !default;
|
95
|
-
$input-disabled-bg: $gray-
|
95
|
+
$input-disabled-bg: $gray-25 !default;
|
96
96
|
$input-focus-border-color: $blue !default;
|
97
97
|
$input-box-shadow: none !default;
|
98
98
|
$btn-box-shadow: $input-box-shadow !default;
|
@@ -170,6 +170,7 @@ $dropdown-padding-y: 0.25rem !default;
|
|
170
170
|
$dropdown-divider-bg: $gray-50 !default;
|
171
171
|
$dropdown-divider-margin-y: 0.25rem !default;
|
172
172
|
$dropdown-header-color: $gray-500 !default;
|
173
|
+
$zindex-dropdown: 1050;
|
173
174
|
|
174
175
|
$modal-backdrop-bg: $body-bg !default;
|
175
176
|
$modal-backdrop-opacity: 0.8 !default;
|
@@ -207,10 +208,14 @@ $embed-responsive-aspect-ratios: (
|
|
207
208
|
$table-cell-padding: .75rem .50rem !default;
|
208
209
|
|
209
210
|
$code-color: $gray-600 !default;
|
211
|
+
$code-bg: $gray-25 !default;
|
210
212
|
|
211
213
|
$list-group-bg: transparent !default;
|
212
214
|
$list-group-item-padding-x: 1rem !default;
|
213
215
|
|
214
|
-
$header-
|
216
|
+
$header-bg: $gray-25 !default;
|
217
|
+
$header-height: 60px !default;
|
215
218
|
$sidebar-width: 220px !default;
|
216
|
-
$sidebar-bg: $
|
219
|
+
$sidebar-bg: $gray-25 !default;
|
220
|
+
|
221
|
+
$progress-bar-bg: $blue !default;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Spree
|
2
|
+
module Admin
|
3
|
+
class GiftCardBatchesController < ResourceController
|
4
|
+
add_breadcrumb_icon 'discount'
|
5
|
+
add_breadcrumb Spree.t(:promotions), :admin_promotions_path
|
6
|
+
add_breadcrumb Spree.t(:gift_cards), :admin_gift_cards_path
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def location_after_save
|
11
|
+
spree.admin_gift_cards_path(q: { batch_prefix_eq: @object.prefix })
|
12
|
+
end
|
13
|
+
|
14
|
+
def collection_url
|
15
|
+
spree.admin_gift_cards_path
|
16
|
+
end
|
17
|
+
|
18
|
+
def permitted_resource_params
|
19
|
+
params.require(:gift_card_batch).permit(permitted_gift_card_batch_attributes)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
module Spree
|
2
|
+
module Admin
|
3
|
+
class GiftCardsController < ResourceController
|
4
|
+
before_action :load_user
|
5
|
+
before_action :add_breadcrumbs
|
6
|
+
before_action :load_orders, only: :show
|
7
|
+
|
8
|
+
helper_method :gift_cards_filter_dropdown_value
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def permitted_resource_params
|
13
|
+
@permitted_resource_params ||= begin
|
14
|
+
params_hash = params.require(:gift_card).permit(permitted_gift_card_attributes)
|
15
|
+
|
16
|
+
if @user.present?
|
17
|
+
params_hash.merge(user_id: @user.id)
|
18
|
+
else
|
19
|
+
params_hash
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def collection
|
25
|
+
return @collection if @collection.present?
|
26
|
+
|
27
|
+
@collection = super
|
28
|
+
|
29
|
+
params[:q] ||= {}
|
30
|
+
params[:q][:s] ||= 'created_at desc'
|
31
|
+
params[:q][:user_id_eq] = params[:user_id] if params[:user_id].present?
|
32
|
+
|
33
|
+
@search = @collection
|
34
|
+
|
35
|
+
@search = @search.expired if params[:q][:status_eq] == 'expired'
|
36
|
+
@search = @search.active if params[:q][:status_eq] == 'active'
|
37
|
+
@search = @search.redeemed if params[:q][:status_eq] == 'redeemed'
|
38
|
+
|
39
|
+
@search = @search.ransack(params[:q])
|
40
|
+
|
41
|
+
@collection = @search.result.includes(:user, :created_by)
|
42
|
+
|
43
|
+
@collection = @collection.page(params[:page]).per(params[:per_page]) if params[:format] != 'csv'
|
44
|
+
|
45
|
+
@collection
|
46
|
+
end
|
47
|
+
|
48
|
+
def location_after_destroy
|
49
|
+
if @user.present?
|
50
|
+
spree.admin_user_path(@user)
|
51
|
+
else
|
52
|
+
spree.admin_gift_cards_path
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def location_after_save
|
57
|
+
spree.admin_gift_card_path(@object.id)
|
58
|
+
end
|
59
|
+
|
60
|
+
def load_user
|
61
|
+
@user = Spree.user_class.find_by(id: params[:user_id]) if params[:user_id].present?
|
62
|
+
end
|
63
|
+
|
64
|
+
def gift_cards_filter_dropdown_value
|
65
|
+
case params.dig(:q, :status_eq)
|
66
|
+
when 'active'
|
67
|
+
Spree.t('admin.gift_cards.active')
|
68
|
+
when 'expired'
|
69
|
+
Spree.t(:expired)
|
70
|
+
when 'redeemed'
|
71
|
+
Spree.t('admin.gift_cards.redeemed')
|
72
|
+
else
|
73
|
+
Spree.t('admin.gift_cards.all')
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def add_breadcrumbs
|
78
|
+
if @user.present?
|
79
|
+
@breadcrumb_icon = 'users'
|
80
|
+
add_breadcrumb Spree.t(:customers), :admin_users_path
|
81
|
+
add_breadcrumb @user.name, spree.admin_user_path(@user)
|
82
|
+
else
|
83
|
+
@breadcrumb_icon = 'discount'
|
84
|
+
add_breadcrumb Spree.t(:promotions), :admin_promotions_path
|
85
|
+
add_breadcrumb Spree.t(:gift_cards), :admin_gift_cards_path
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def load_orders
|
90
|
+
@orders = @object.orders.includes(:user).order(created_at: :desc)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -6,18 +6,20 @@ module Spree
|
|
6
6
|
include Spree::Admin::OrderBreadcrumbConcern
|
7
7
|
|
8
8
|
before_action :initialize_order_events
|
9
|
-
before_action :load_order, only: %i[edit cancel resend]
|
9
|
+
before_action :load_order, only: %i[edit cancel resend destroy]
|
10
10
|
before_action :load_order_items, only: :edit
|
11
11
|
before_action :load_user, only: [:index]
|
12
12
|
|
13
13
|
helper_method :model_class
|
14
14
|
|
15
|
+
# POST /admin/orders
|
15
16
|
def create
|
16
17
|
@order = Spree::Order.create(created_by: try_spree_current_user, store: current_store)
|
17
18
|
|
18
19
|
redirect_to spree.edit_admin_order_path(@order)
|
19
20
|
end
|
20
21
|
|
22
|
+
# GET /admin/orders/:id/edit
|
21
23
|
def edit
|
22
24
|
unless @order.completed?
|
23
25
|
add_breadcrumb Spree.t(:draft_orders), :admin_checkouts_path
|
@@ -26,6 +28,7 @@ module Spree
|
|
26
28
|
add_breadcrumb @order.number, spree.edit_admin_order_path(@order)
|
27
29
|
end
|
28
30
|
|
31
|
+
# GET /admin/orders
|
29
32
|
def index
|
30
33
|
params[:q] ||= {}
|
31
34
|
params[:q][:s] ||= 'completed_at desc'
|
@@ -33,12 +36,14 @@ module Spree
|
|
33
36
|
load_orders
|
34
37
|
end
|
35
38
|
|
39
|
+
# PUT /admin/orders/:id/cancel
|
36
40
|
def cancel
|
37
41
|
@order.canceled_by(try_spree_current_user)
|
38
42
|
flash[:success] = Spree.t(:order_canceled)
|
39
43
|
redirect_back fallback_location: spree.edit_admin_order_url(@order)
|
40
44
|
end
|
41
45
|
|
46
|
+
# POST /admin/orders/:id/resend
|
42
47
|
def resend
|
43
48
|
@order.deliver_order_confirmation_email
|
44
49
|
if @order.errors.any?
|
@@ -50,6 +55,18 @@ module Spree
|
|
50
55
|
redirect_back fallback_location: spree.edit_admin_order_url(@order)
|
51
56
|
end
|
52
57
|
|
58
|
+
# DELETE /admin/orders/:id
|
59
|
+
def destroy
|
60
|
+
@order.destroy
|
61
|
+
flash[:success] = flash_message_for(@order, :successfully_removed)
|
62
|
+
|
63
|
+
if @order.completed?
|
64
|
+
redirect_to spree.admin_orders_path
|
65
|
+
else
|
66
|
+
redirect_to spree.admin_checkouts_path
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
53
70
|
private
|
54
71
|
|
55
72
|
def scope
|
@@ -79,7 +96,7 @@ module Spree
|
|
79
96
|
@payments = @order.payments.includes(:payment_method, :source).order(:created_at)
|
80
97
|
@refunds = @order.refunds
|
81
98
|
|
82
|
-
@return_authorizations = @order.return_authorizations
|
99
|
+
@return_authorizations = @order.return_authorizations.includes(:return_items)
|
83
100
|
@customer_returns = @order.customer_returns.distinct
|
84
101
|
end
|
85
102
|
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Spree
|
2
2
|
module Admin
|
3
3
|
class PaymentsController < Spree::Admin::ResourceController
|
4
|
+
include Spree::Admin::OrderBreadcrumbConcern
|
5
|
+
|
4
6
|
belongs_to 'spree/order', find_by: :number
|
5
7
|
|
6
8
|
before_action :load_data
|
@@ -116,6 +118,7 @@ module Spree
|
|
116
118
|
def load_data
|
117
119
|
@payment_methods = @order.collect_backend_payment_methods
|
118
120
|
@store_credits = @order.available_store_credits if @payment_methods.any?(&:store_credit?)
|
121
|
+
add_breadcrumb @order.number, spree.edit_admin_order_path(@order)
|
119
122
|
end
|
120
123
|
end
|
121
124
|
end
|
@@ -173,17 +173,17 @@ module Spree
|
|
173
173
|
joins(option_type: :product_option_types).
|
174
174
|
includes(option_type: :option_values).
|
175
175
|
merge(@product.product_option_types).
|
176
|
-
reorder(
|
176
|
+
reorder("#{Spree::ProductOptionType.table_name}.position").
|
177
177
|
uniq.group_by(&:option_type).each_with_index do |option, index|
|
178
178
|
option_type, option_values = option
|
179
179
|
|
180
180
|
@product_options[option_type.id.to_s] = {
|
181
181
|
name: option_type.presentation,
|
182
182
|
position: index + 1,
|
183
|
-
values: option_values.
|
183
|
+
values: option_values.map { |ov| { value: ov.name, text: ov.presentation } }.uniq
|
184
184
|
}
|
185
185
|
|
186
|
-
@product_available_options[option_type.id.to_s] = option_type.option_values.
|
186
|
+
@product_available_options[option_type.id.to_s] = option_type.option_values.map { |ov| { id: ov.name, name: ov.presentation } }.uniq
|
187
187
|
end
|
188
188
|
|
189
189
|
@product_stock = {}
|
@@ -44,7 +44,11 @@ module Spree
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def permitted_resource_params
|
47
|
-
params
|
47
|
+
if params[:build_from_customer_return_id].present?
|
48
|
+
params.permit()
|
49
|
+
else
|
50
|
+
params.require(:reimbursement).permit(permitted_reimbursement_attributes)
|
51
|
+
end
|
48
52
|
end
|
49
53
|
end
|
50
54
|
end
|
@@ -49,6 +49,7 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
|
|
49
49
|
|
50
50
|
def create
|
51
51
|
invoke_callbacks(:create, :before)
|
52
|
+
set_created_by
|
52
53
|
@object.attributes = permitted_resource_params
|
53
54
|
if @object.save
|
54
55
|
invoke_callbacks(:create, :after)
|
@@ -60,7 +61,7 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
|
|
60
61
|
end
|
61
62
|
format.html do
|
62
63
|
flash[:success] = message_after_create
|
63
|
-
redirect_to
|
64
|
+
redirect_to location_after_create, status: :see_other
|
64
65
|
end
|
65
66
|
end
|
66
67
|
else
|
@@ -226,6 +227,10 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
|
|
226
227
|
collection_url
|
227
228
|
end
|
228
229
|
|
230
|
+
def location_after_create
|
231
|
+
location_after_save
|
232
|
+
end
|
233
|
+
|
229
234
|
def location_after_save
|
230
235
|
edit_object_url(@object)
|
231
236
|
end
|
@@ -244,6 +249,12 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
|
|
244
249
|
ensure_current_store(@object)
|
245
250
|
end
|
246
251
|
|
252
|
+
def set_created_by
|
253
|
+
return if @object.nil?
|
254
|
+
|
255
|
+
@object.created_by = try_spree_current_user if @object.respond_to?(:created_by_id)
|
256
|
+
end
|
257
|
+
|
247
258
|
def set_currency
|
248
259
|
return if @object.nil?
|
249
260
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Spree
|
2
|
+
module Admin
|
3
|
+
class SearchController < BaseController
|
4
|
+
def option_values
|
5
|
+
query = params[:q]&.strip
|
6
|
+
|
7
|
+
if query.present?
|
8
|
+
json = Spree::OptionValue.includes(:option_type).search_by_name(query).map do |ov|
|
9
|
+
{
|
10
|
+
id: ov.id,
|
11
|
+
name: ov.display_presentation
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
render json: json
|
16
|
+
else
|
17
|
+
render json: []
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -4,16 +4,21 @@ module Spree
|
|
4
4
|
|
5
5
|
class StoreCreditsController < Spree::Admin::BaseController
|
6
6
|
before_action :load_user
|
7
|
-
before_action :load_store_credit, only: [:new, :edit, :update]
|
7
|
+
before_action :load_store_credit, only: [:new, :edit, :update, :destroy]
|
8
8
|
before_action :ensure_unused_store_credit, only: [:update]
|
9
9
|
|
10
10
|
def index
|
11
|
-
@store_credits = scope.includes(:
|
11
|
+
@store_credits = scope.includes(:created_by).order(created_at: :desc)
|
12
12
|
@store_credits = @store_credits.page(params[:page]).per(params[:per_page])
|
13
13
|
|
14
14
|
@collection = @store_credits
|
15
15
|
end
|
16
16
|
|
17
|
+
def show
|
18
|
+
@store_credit = scope.find(params[:id])
|
19
|
+
@store_credit_events = @store_credit.store_credit_events.reverse_chronological.includes(:originator, :order)
|
20
|
+
end
|
21
|
+
|
17
22
|
def create
|
18
23
|
@store_credit = @user.store_credits.build(
|
19
24
|
permitted_store_credit_params.merge(
|
@@ -34,11 +39,10 @@ module Spree
|
|
34
39
|
|
35
40
|
def update
|
36
41
|
@store_credit.assign_attributes(permitted_store_credit_params)
|
37
|
-
@store_credit.created_by = try_spree_current_user
|
38
42
|
|
39
43
|
if @store_credit.save
|
40
44
|
flash[:success] = flash_message_for(@store_credit, :successfully_updated)
|
41
|
-
redirect_to spree.
|
45
|
+
redirect_to spree.admin_user_store_credit_path(@user, @store_credit)
|
42
46
|
else
|
43
47
|
flash[:error] = Spree.t('store_credit.errors.unable_to_update')
|
44
48
|
render :edit, status: :unprocessable_entity
|
@@ -46,7 +50,6 @@ module Spree
|
|
46
50
|
end
|
47
51
|
|
48
52
|
def destroy
|
49
|
-
@store_credit = @user.store_credits.for_store(current_store).find(params[:id])
|
50
53
|
ensure_unused_store_credit
|
51
54
|
|
52
55
|
if @store_credit.destroy
|