spree_backend 3.7.14.1 → 4.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/app/assets/javascripts/spree/backend.js +2 -1
- data/app/assets/javascripts/spree/backend/admin.js +75 -66
- data/app/assets/javascripts/spree/backend/calculator.js +3 -3
- data/app/assets/javascripts/spree/backend/gateway.js +1 -1
- data/app/assets/javascripts/spree/backend/line_items_on_order_edit.js +23 -24
- data/app/assets/javascripts/spree/backend/promotions.js +4 -4
- data/app/assets/javascripts/spree/backend/shipments.js +32 -33
- data/app/assets/javascripts/spree/backend/taxonomy.js +75 -72
- data/app/assets/stylesheets/spree/backend/components/_badges.scss +46 -0
- data/app/assets/stylesheets/spree/backend/components/_buttons.scss +7 -23
- data/app/assets/stylesheets/spree/backend/components/_filters.scss +16 -6
- data/app/assets/stylesheets/spree/backend/components/_main.scss +4 -6
- data/app/assets/stylesheets/spree/backend/components/_navbar.scss +21 -0
- data/app/assets/stylesheets/spree/backend/components/_navigation.scss +2 -10
- data/app/assets/stylesheets/spree/backend/components/_page_header.scss +0 -23
- data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +25 -69
- data/app/assets/stylesheets/spree/backend/components/_tables.scss +53 -12
- data/app/assets/stylesheets/spree/backend/components/_taxon_products_view.scss +2 -2
- data/app/assets/stylesheets/spree/backend/global/_variables.scss +10 -13
- data/app/assets/stylesheets/spree/backend/plugins/_jquery_ui.scss +33 -20
- data/app/assets/stylesheets/spree/backend/plugins/_select2.scss +23 -18
- data/app/assets/stylesheets/spree/backend/shared/_base.scss +0 -8
- data/app/assets/stylesheets/spree/backend/shared/_forms.scss +5 -38
- data/app/assets/stylesheets/spree/backend/spree_admin.css.scss +3 -6
- data/app/controllers/spree/admin/customer_returns_controller.rb +2 -2
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +1 -1
- data/app/controllers/spree/admin/orders_controller.rb +2 -2
- data/app/controllers/spree/admin/payment_methods_controller.rb +1 -1
- data/app/controllers/spree/admin/products_controller.rb +2 -2
- data/app/controllers/spree/admin/reimbursement_types_controller.rb +1 -1
- data/app/controllers/spree/admin/resource_controller.rb +1 -1
- data/app/controllers/spree/admin/return_authorizations_controller.rb +1 -1
- data/app/controllers/spree/admin/stores_controller.rb +5 -0
- data/app/controllers/spree/admin/taxons_controller.rb +1 -1
- data/app/controllers/spree/admin/users_controller.rb +2 -2
- data/app/helpers/spree/admin/base_helper.rb +9 -4
- data/app/helpers/spree/admin/customer_returns_helper.rb +1 -1
- data/app/helpers/spree/admin/navigation_helper.rb +41 -25
- data/app/helpers/spree/admin/orders_helper.rb +2 -2
- data/app/views/kaminari/{_first_page.html.erb → twitter-bootstrap-4/_first_page.html.erb} +5 -3
- data/app/views/kaminari/{_gap.html.erb → twitter-bootstrap-4/_gap.html.erb} +5 -1
- data/app/views/kaminari/{_last_page.html.erb → twitter-bootstrap-4/_last_page.html.erb} +5 -3
- data/app/views/kaminari/{_next_page.html.erb → twitter-bootstrap-4/_next_page.html.erb} +5 -7
- data/app/views/kaminari/{_page.html.erb → twitter-bootstrap-4/_page.html.erb} +8 -2
- data/app/views/kaminari/{_paginator.html.erb → twitter-bootstrap-4/_paginator.html.erb} +3 -1
- data/app/views/kaminari/{_prev_page.html.erb → twitter-bootstrap-4/_prev_page.html.erb} +5 -7
- data/app/views/spree/admin/adjustments/_adjustment.html.erb +14 -4
- data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +6 -6
- data/app/views/spree/admin/adjustments/index.html.erb +7 -5
- data/app/views/spree/admin/countries/_form.html.erb +13 -1
- data/app/views/spree/admin/customer_returns/index.html.erb +2 -2
- data/app/views/spree/admin/general_settings/edit.html.erb +14 -14
- data/app/views/spree/admin/images/_form.html.erb +2 -2
- data/app/views/spree/admin/images/edit.html.erb +6 -6
- data/app/views/spree/admin/option_types/_form.html.erb +2 -2
- data/app/views/spree/admin/option_types/edit.html.erb +5 -5
- data/app/views/spree/admin/orders/_add_line_item.html.erb +5 -5
- data/app/views/spree/admin/orders/_add_product.html.erb +5 -5
- data/app/views/spree/admin/orders/_adjustments.html.erb +4 -3
- data/app/views/spree/admin/orders/_line_items.html.erb +4 -4
- data/app/views/spree/admin/orders/_risk_analysis.html.erb +3 -3
- data/app/views/spree/admin/orders/_shipment.html.erb +5 -5
- data/app/views/spree/admin/orders/_shipment_manifest.html.erb +1 -1
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +17 -17
- data/app/views/spree/admin/orders/customer_details/edit.html.erb +4 -4
- data/app/views/spree/admin/orders/index.html.erb +56 -33
- data/app/views/spree/admin/payment_methods/_form.html.erb +4 -4
- data/app/views/spree/admin/payments/_list.html.erb +3 -3
- data/app/views/spree/admin/payments/index.html.erb +1 -1
- data/app/views/spree/admin/product_properties/index.html.erb +10 -2
- data/app/views/spree/admin/products/_add_stock_form.html.erb +6 -6
- data/app/views/spree/admin/products/_form.html.erb +26 -31
- data/app/views/spree/admin/products/edit.html.erb +1 -1
- data/app/views/spree/admin/products/index.html.erb +5 -5
- data/app/views/spree/admin/products/new.html.erb +5 -5
- data/app/views/spree/admin/products/stock.html.erb +3 -3
- data/app/views/spree/admin/promotions/_actions.html.erb +4 -4
- data/app/views/spree/admin/promotions/_form.html.erb +7 -7
- data/app/views/spree/admin/promotions/_promotion_action.html.erb +4 -4
- data/app/views/spree/admin/promotions/_promotion_rule.html.erb +12 -5
- data/app/views/spree/admin/promotions/_rules.html.erb +5 -5
- data/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb +5 -5
- data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +5 -5
- data/app/views/spree/admin/promotions/actions/_create_line_items.html.erb +3 -3
- data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +10 -6
- data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +10 -6
- data/app/views/spree/admin/promotions/edit.html.erb +5 -5
- data/app/views/spree/admin/promotions/index.html.erb +3 -3
- data/app/views/spree/admin/promotions/rules/_country.html.erb +2 -2
- data/app/views/spree/admin/promotions/rules/_item_total.html.erb +4 -4
- data/app/views/spree/admin/promotions/rules/_option_value.html.erb +8 -8
- data/app/views/spree/admin/promotions/rules/_product.html.erb +2 -2
- data/app/views/spree/admin/promotions/rules/_taxon.html.erb +2 -2
- data/app/views/spree/admin/promotions/rules/_user.html.erb +2 -2
- data/app/views/spree/admin/properties/_form.html.erb +2 -2
- data/app/views/spree/admin/properties/index.html.erb +3 -3
- data/app/views/spree/admin/prototypes/_prototypes.html.erb +10 -2
- data/app/views/spree/admin/reimbursement_types/_form.html.erb +6 -6
- data/app/views/spree/admin/reports/sales_total.html.erb +4 -2
- data/app/views/spree/admin/return_authorizations/index.html.erb +1 -1
- data/app/views/spree/admin/return_index/customer_returns.html.erb +3 -3
- data/app/views/spree/admin/return_index/return_authorizations.html.erb +15 -9
- data/app/views/spree/admin/shared/_account_nav.html.erb +60 -48
- data/app/views/spree/admin/shared/_address_form.html.erb +11 -4
- data/app/views/spree/admin/shared/_calculator_fields.html.erb +4 -4
- data/app/views/spree/admin/shared/_content_header.html.erb +4 -4
- data/app/views/spree/admin/shared/_header.html.erb +18 -21
- data/app/views/spree/admin/shared/_index_table_options.html.erb +4 -5
- data/app/views/spree/admin/shared/_main_menu.html.erb +37 -35
- data/app/views/spree/admin/shared/_order_summary.html.erb +6 -7
- data/app/views/spree/admin/shared/_order_tabs.html.erb +47 -20
- data/app/views/spree/admin/shared/_product_tabs.html.erb +35 -11
- data/app/views/spree/admin/shared/_refunds.html.erb +1 -1
- data/app/views/spree/admin/shared/_table_filter.html.erb +7 -5
- data/app/views/spree/admin/shared/_version.html.erb +4 -2
- data/app/views/spree/admin/shared/named_types/_form.html.erb +1 -1
- data/app/views/spree/admin/shared/sub_menu/_configuration.html.erb +1 -1
- data/app/views/spree/admin/shared/sub_menu/_product.html.erb +1 -1
- data/app/views/spree/admin/shared/sub_menu/_promotion.html.erb +1 -1
- data/app/views/spree/admin/shared/sub_menu/_returns.html.erb +1 -1
- data/app/views/spree/admin/shipping_methods/_form.html.erb +21 -21
- data/app/views/spree/admin/states/_form.html.erb +2 -2
- data/app/views/spree/admin/stock_locations/_form.html.erb +6 -6
- data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +4 -4
- data/app/views/spree/admin/stock_movements/index.html.erb +1 -1
- data/app/views/spree/admin/stock_transfers/index.html.erb +34 -32
- data/app/views/spree/admin/stock_transfers/new.html.erb +13 -11
- data/app/views/spree/admin/stores/_form.html.erb +5 -6
- data/app/views/spree/admin/stores/index.html.erb +3 -1
- data/app/views/spree/admin/tax_categories/_form.html.erb +1 -1
- data/app/views/spree/admin/tax_rates/_form.html.erb +11 -9
- data/app/views/spree/admin/taxons/_form.html.erb +4 -4
- data/app/views/spree/admin/users/_addresses_form.html.erb +10 -10
- data/app/views/spree/admin/users/_form.html.erb +2 -2
- data/app/views/spree/admin/users/_lifetime_stats.html.erb +3 -3
- data/app/views/spree/admin/users/_sidebar.html.erb +26 -11
- data/app/views/spree/admin/users/addresses.html.erb +4 -2
- data/app/views/spree/admin/users/edit.html.erb +8 -8
- data/app/views/spree/admin/users/index.html.erb +3 -3
- data/app/views/spree/admin/users/items.html.erb +2 -2
- data/app/views/spree/admin/users/orders.html.erb +2 -2
- data/app/views/spree/admin/variants/_autocomplete.js.erb +5 -5
- data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +1 -1
- data/app/views/spree/admin/variants/_form.html.erb +2 -2
- data/app/views/spree/admin/variants/_split.js.erb +3 -3
- data/app/views/spree/admin/variants/index.html.erb +2 -2
- data/app/views/spree/admin/variants/new.html.erb +8 -6
- data/app/views/spree/admin/zones/_country_members.html.erb +4 -4
- data/app/views/spree/admin/zones/_form.html.erb +9 -9
- data/app/views/spree/admin/zones/_state_members.html.erb +4 -4
- data/app/views/spree/admin/zones/index.html.erb +2 -2
- data/app/views/spree/layouts/admin.html.erb +9 -6
- data/lib/spree/backend.rb +3 -2
- data/lib/spree_backend.rb +2 -1
- data/spree_backend.gemspec +3 -2
- metadata +39 -27
- data/app/assets/stylesheets/spree/backend/components/_labels.scss +0 -55
- data/app/assets/stylesheets/spree/backend/components/_panels.scss +0 -3
- data/app/assets/stylesheets/spree/backend/components/_wells.scss +0 -3
- data/app/assets/stylesheets/spree/backend/sections/_account.scss +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c6bb4782e47150187105202e4dd34777fbb307d3331e193b3b8c4cd58904208
|
4
|
+
data.tar.gz: 95a899a53419588fc599d0b171e83d1d1b447101253571021051a22bf14c838d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 447eeb4c95197a72921edbfe4c96ce7c8f6316a9cf4e2ecac621ba75fe1599a5704193a8ffdbba616857935bbd9721161cda4c6f244fec48a7ae76d7502ab87b
|
7
|
+
data.tar.gz: '059c56e08cb4605d838c23845d198252f71c38311b5173f30355f66c7d9806513715613e7498dca9b3bfb39c3e482b5cefcc419ecd01d99c9e552acf06bded5d'
|
data/Gemfile
CHANGED
@@ -25,25 +25,38 @@ jQuery(function ($) {
|
|
25
25
|
})
|
26
26
|
|
27
27
|
// Sidebar nav toggle functionality
|
28
|
-
$('#sidebar-toggle')
|
29
|
-
var wrapper = $('#wrapper')
|
30
|
-
var main = $('#main-part')
|
31
|
-
var sidebar = $('#main-sidebar')
|
28
|
+
const sidebar_toggle = $('#sidebar-toggle')
|
32
29
|
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
sidebar_toggle.on('click', function() {
|
31
|
+
const wrapper = $('#wrapper')
|
32
|
+
const main = $('#main-part')
|
33
|
+
const sidebar = $('#main-sidebar')
|
34
|
+
const version = $('.spree-version')
|
35
|
+
const collapsed = sidebar.find('[aria-expanded="true"]')
|
36
|
+
const collapsedIcons = sidebar.find('.icon-chevron-down')
|
36
37
|
|
37
38
|
wrapper.toggleClass('sidebar-minimized')
|
38
|
-
|
39
|
+
|
40
|
+
collapsed
|
41
|
+
.attr('aria-expanded', 'false')
|
42
|
+
.next()
|
43
|
+
.removeClass('show')
|
44
|
+
|
45
|
+
collapsedIcons
|
46
|
+
.removeClass('icon-chevron-down')
|
47
|
+
.addClass('icon-chevron-left')
|
48
|
+
|
49
|
+
// these should match `spree/backend/app/helpers/spree/admin/navigation_helper.rb#main_part_classes`
|
39
50
|
main
|
40
|
-
.toggleClass(
|
41
|
-
.toggleClass(
|
51
|
+
.toggleClass('col-12 sidebar-collapsed')
|
52
|
+
.toggleClass('col-9 offset-3 col-md-10 offset-md-2')
|
42
53
|
|
43
54
|
if (wrapper.hasClass('sidebar-minimized')) {
|
44
55
|
Cookies.set('sidebar-minimized', 'true', { path: '/admin' })
|
56
|
+
version.removeClass('d-md-block')
|
45
57
|
} else {
|
46
58
|
Cookies.set('sidebar-minimized', 'false', { path: '/admin' })
|
59
|
+
version.addClass('d-md-block')
|
47
60
|
}
|
48
61
|
})
|
49
62
|
|
@@ -72,16 +85,16 @@ jQuery(function ($) {
|
|
72
85
|
})
|
73
86
|
|
74
87
|
// Main menu active item submenu show
|
75
|
-
var
|
76
|
-
|
77
|
-
|
88
|
+
var active_item = $('#main-sidebar').find('.selected')
|
89
|
+
active_item.closest('.nav-pills').addClass('in show')
|
90
|
+
active_item.closest('.nav-sidebar')
|
78
91
|
.find('.icon-chevron-left')
|
79
92
|
.removeClass('icon-chevron-left')
|
80
93
|
.addClass('icon-chevron-down')
|
81
94
|
|
82
95
|
// Replace ▼ and ▲ in sort_link with nicer icons
|
83
96
|
$('.sort_link').each(function () {
|
84
|
-
// Remove the  
|
97
|
+
// Remove the   in the text
|
85
98
|
var sortLinkText = $(this).text().replace('\xA0', '')
|
86
99
|
|
87
100
|
if (sortLinkText.indexOf('▼') >= 0) {
|
@@ -136,8 +149,8 @@ jQuery(function ($) {
|
|
136
149
|
|
137
150
|
label = ransackField(label.text()) + ': ' + ransackValue
|
138
151
|
|
139
|
-
filter = '<span class="js-filter
|
140
|
-
$(
|
152
|
+
filter = '<span class="js-filter badge badge-secondary" data-ransack-field="' + ransackFieldId + '">' + label + '<span class="icon icon-delete js-delete-filter"></span></span>'
|
153
|
+
$(".js-filters").append(filter).show()
|
141
154
|
}
|
142
155
|
})
|
143
156
|
|
@@ -205,7 +218,8 @@ function handle_date_picker_fields () {
|
|
205
218
|
monthNames: Spree.translations.month_names,
|
206
219
|
prevText: Spree.translations.previous,
|
207
220
|
nextText: Spree.translations.next,
|
208
|
-
showOn: 'focus'
|
221
|
+
showOn: 'focus',
|
222
|
+
showAnim: ''
|
209
223
|
})
|
210
224
|
|
211
225
|
// Correctly display range dates
|
@@ -217,18 +231,18 @@ function handle_date_picker_fields () {
|
|
217
231
|
})
|
218
232
|
}
|
219
233
|
|
220
|
-
$(document).ready(function
|
234
|
+
$(document).ready(function(){
|
221
235
|
handle_date_picker_fields()
|
222
|
-
$('.observe_field').on('change', function
|
223
|
-
|
236
|
+
$('.observe_field').on('change', function() {
|
237
|
+
target = $(this).data('update')
|
224
238
|
$(target).hide()
|
225
|
-
$.ajax({
|
239
|
+
$.ajax({
|
240
|
+
dataType: 'html',
|
226
241
|
url: $(this).data('base-url') + encodeURIComponent($(this).val()),
|
227
|
-
type: '
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
}
|
242
|
+
type: 'GET'
|
243
|
+
}).done(function (data) {
|
244
|
+
$(target).html(data)
|
245
|
+
$(target).show()
|
232
246
|
})
|
233
247
|
})
|
234
248
|
|
@@ -263,25 +277,23 @@ $(document).ready(function () {
|
|
263
277
|
_method: 'delete',
|
264
278
|
authenticity_token: AUTH_TOKEN
|
265
279
|
},
|
266
|
-
dataType: 'script'
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
}
|
274
|
-
},
|
275
|
-
error: function (response, textStatus, errorThrown) {
|
276
|
-
show_flash('error', response.responseText)
|
280
|
+
dataType: 'script'
|
281
|
+
}).done(function () {
|
282
|
+
var $flash_element = $('.alert-success')
|
283
|
+
if ($flash_element.length) {
|
284
|
+
el.parents('tr').fadeOut('hide', function () {
|
285
|
+
$(this).remove()
|
286
|
+
})
|
277
287
|
}
|
288
|
+
}).fail(function (response) {
|
289
|
+
show_flash('error', response.responseText)
|
278
290
|
})
|
279
291
|
}
|
280
292
|
return false
|
281
293
|
})
|
282
294
|
|
283
295
|
$('body').on('click', 'a.spree_remove_fields', function () {
|
284
|
-
|
296
|
+
el = $(this)
|
285
297
|
el.prev('input[type=hidden]').val('1')
|
286
298
|
el.closest('.fields').hide()
|
287
299
|
if (el.prop('href').substr(-1) === '#') {
|
@@ -293,31 +305,28 @@ $(document).ready(function () {
|
|
293
305
|
data: {
|
294
306
|
_method: 'delete',
|
295
307
|
authenticity_token: AUTH_TOKEN
|
296
|
-
},
|
297
|
-
success: function (response) {
|
298
|
-
el.parents('tr').fadeOut('hide', function () {
|
299
|
-
$(this).remove()
|
300
|
-
})
|
301
|
-
},
|
302
|
-
error: function (response, textStatus, errorThrown) {
|
303
|
-
show_flash('error', response.responseText)
|
304
308
|
}
|
305
|
-
|
309
|
+
}).done(function () {
|
310
|
+
el.parents('tr').fadeOut('hide', function () {
|
311
|
+
$(this).remove()
|
312
|
+
})
|
313
|
+
}).fail(function (response) {
|
314
|
+
show_flash('error', response.responseText)
|
306
315
|
})
|
307
316
|
}
|
308
317
|
return false
|
309
318
|
})
|
310
319
|
|
311
|
-
$('body').on('click', '.select_properties_from_prototype', function
|
320
|
+
$('body').on('click', '.select_properties_from_prototype', function(){
|
312
321
|
$('#busy_indicator').show()
|
313
|
-
var
|
314
|
-
$.ajax({
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
322
|
+
var clicked_link = $(this)
|
323
|
+
$.ajax({
|
324
|
+
dataType: 'script',
|
325
|
+
url: clicked_link.prop('href'),
|
326
|
+
type: 'GET'
|
327
|
+
}).done(function () {
|
328
|
+
clicked_link.parent('td').parent('tr').hide()
|
329
|
+
$('#busy_indicator').hide()
|
321
330
|
})
|
322
331
|
return false
|
323
332
|
})
|
@@ -337,13 +346,13 @@ $(document).ready(function () {
|
|
337
346
|
handle: '.handle',
|
338
347
|
helper: fixHelper,
|
339
348
|
placeholder: 'ui-sortable-placeholder',
|
340
|
-
update: function
|
349
|
+
update: function(event, ui) {
|
341
350
|
var tbody = this
|
342
351
|
$('#progress').show()
|
343
|
-
|
344
|
-
$.each($('tr', tbody), function
|
345
|
-
|
346
|
-
|
352
|
+
positions = {}
|
353
|
+
$.each($('tr', tbody), function(position, obj) {
|
354
|
+
reg = /spree_(\w+_?)+_(\d+)/
|
355
|
+
parts = reg.exec($(obj).prop('id'))
|
347
356
|
if (parts) {
|
348
357
|
positions['positions[' + parts[2] + ']'] = position + 1
|
349
358
|
}
|
@@ -352,8 +361,9 @@ $(document).ready(function () {
|
|
352
361
|
type: 'POST',
|
353
362
|
dataType: 'script',
|
354
363
|
url: $(ui.item).closest('table.sortable').data('sortable-link'),
|
355
|
-
data: positions
|
356
|
-
|
364
|
+
data: positions
|
365
|
+
}).done(function () {
|
366
|
+
$('#progress').hide()
|
357
367
|
})
|
358
368
|
},
|
359
369
|
start: function (event, ui) {
|
@@ -375,16 +385,15 @@ $(document).ready(function () {
|
|
375
385
|
$(this).parent().fadeOut()
|
376
386
|
})
|
377
387
|
|
378
|
-
window.Spree.advanceOrder = function
|
388
|
+
window.Spree.advanceOrder = function() {
|
379
389
|
$.ajax({
|
380
390
|
type: 'PUT',
|
381
391
|
async: false,
|
382
392
|
data: {
|
383
393
|
token: Spree.api_key
|
384
394
|
},
|
385
|
-
// eslint-disable-next-line camelcase
|
386
395
|
url: Spree.url(Spree.routes.checkouts_api + '/' + order_number + '/advance')
|
387
|
-
}).done(function
|
396
|
+
}).done(function() {
|
388
397
|
window.location.reload()
|
389
398
|
})
|
390
399
|
}
|
@@ -3,15 +3,15 @@ $(function () {
|
|
3
3
|
var originalCalcType = calculatorSelect.prop('value')
|
4
4
|
$('.calculator-settings-warning').hide()
|
5
5
|
calculatorSelect.change(function () {
|
6
|
-
// eslint-disable-next-line
|
6
|
+
// eslint-disable-next-line
|
7
7
|
if (calculatorSelect.prop('value') == originalCalcType) {
|
8
8
|
$('div.calculator-settings').show()
|
9
9
|
$('.calculator-settings-warning').hide()
|
10
|
-
$('.calculator-settings').find('input,textarea').prop('disabled', false)
|
10
|
+
$('.calculator-settings').find('input, textarea').prop('disabled', false)
|
11
11
|
} else {
|
12
12
|
$('div.calculator-settings').hide()
|
13
13
|
$('.calculator-settings-warning').show()
|
14
|
-
$('.calculator-settings').find('input,
|
14
|
+
$('.calculator-settings').find('input, textarea').prop('disabled', true)
|
15
15
|
}
|
16
16
|
})
|
17
17
|
})
|
@@ -2,7 +2,7 @@ $(function () {
|
|
2
2
|
var originalGtwyType = $('#gtwy-type').prop('value')
|
3
3
|
$('div#gateway-settings-warning').hide()
|
4
4
|
$('#gtwy-type').change(function () {
|
5
|
-
// eslint-disable-next-line
|
5
|
+
// eslint-disable-next-line
|
6
6
|
if ($('#gtwy-type').prop('value') == originalGtwyType) {
|
7
7
|
$('div.gateway-settings').show()
|
8
8
|
$('div#gateway-settings-warning').hide()
|
@@ -20,34 +20,33 @@ $(document).ready(function () {
|
|
20
20
|
function addVariant () {
|
21
21
|
$('#stock_details').hide()
|
22
22
|
var variantId = $('input.variant_autocomplete').val()
|
23
|
-
var quantity = $(
|
23
|
+
var quantity = $('input#variant_quantity').val()
|
24
24
|
|
25
25
|
adjustLineItems(order_number, variantId, quantity)
|
26
26
|
return 1
|
27
27
|
}
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
adjustLineItems = function(order_number, variant_id, quantity){
|
30
|
+
var url = Spree.routes.orders_api + '/' + order_number + '/line_items'
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
}
|
52
|
-
})
|
32
|
+
$.ajax({
|
33
|
+
type: 'POST',
|
34
|
+
url: Spree.url(url),
|
35
|
+
data: {
|
36
|
+
line_item: {
|
37
|
+
variant_id: variant_id,
|
38
|
+
quantity: quantity
|
39
|
+
},
|
40
|
+
token: Spree.api_key
|
41
|
+
}
|
42
|
+
}).done(function () {
|
43
|
+
window.Spree.advanceOrder()
|
44
|
+
window.location.reload()
|
45
|
+
}).fail(function (msg) {
|
46
|
+
if (typeof msg.responseJSON.message != 'undefined') {
|
47
|
+
alert(msg.responseJSON.message)
|
48
|
+
} else {
|
49
|
+
alert(msg.responseJSON.exception)
|
50
|
+
}
|
51
|
+
})
|
53
52
|
}
|
@@ -140,12 +140,12 @@ function initProductActions () {
|
|
140
140
|
|
141
141
|
setupRemoveLineItems()
|
142
142
|
// Add line item to list
|
143
|
-
$('.promotion_action.create_line_items button.add').
|
143
|
+
$('.promotion_action.create_line_items button.add').off('click').click(function () {
|
144
144
|
var $container = $(this).parents('.promotion_action')
|
145
|
-
var
|
146
|
-
var
|
145
|
+
var product_name = $container.find('input[name="add_product_name"]').val()
|
146
|
+
var variant_id = $container.find('input[name="add_variant_id"]').val()
|
147
147
|
var quantity = $container.find('input[name="add_quantity"]').val()
|
148
|
-
if (
|
148
|
+
if (variant_id) {
|
149
149
|
// Add to the table
|
150
150
|
var newRow = '<tr><td>' + productName + '</td><td>' + quantity + '</td><td><img src="/assets/admin/icons/cross.png"/></td></tr>'
|
151
151
|
$container.find('table').append(newRow)
|
@@ -5,12 +5,12 @@ $(document).ready(function () {
|
|
5
5
|
|
6
6
|
// handle variant selection, show stock level.
|
7
7
|
$('#add_variant_id').change(function () {
|
8
|
-
var variantId = $(this).val()
|
8
|
+
var variantId = parseInt($(this).val())
|
9
9
|
|
10
10
|
var variant = _.find(window.variants, function (variant) {
|
11
|
-
|
12
|
-
return variant.id == variantId
|
11
|
+
return variant.id === variantId
|
13
12
|
})
|
13
|
+
|
14
14
|
$('#stock_details').html(variantStockTemplate({ variant: variant }))
|
15
15
|
$('#stock_details').show()
|
16
16
|
|
@@ -80,7 +80,7 @@ $(document).ready(function () {
|
|
80
80
|
}
|
81
81
|
}).done(function () {
|
82
82
|
window.location.reload()
|
83
|
-
}).
|
83
|
+
}).fail(function (msg) {
|
84
84
|
alert(msg.responseJSON.message || msg.responseJSON.exception)
|
85
85
|
})
|
86
86
|
})
|
@@ -111,12 +111,12 @@ $(document).ready(function () {
|
|
111
111
|
}
|
112
112
|
}).done(function () {
|
113
113
|
window.location.reload()
|
114
|
-
}).
|
114
|
+
}).fail(function (msg) {
|
115
115
|
alert(msg.responseJSON.message || msg.responseJSON.exception)
|
116
116
|
})
|
117
117
|
})
|
118
118
|
|
119
|
-
function toggleTrackingEdit
|
119
|
+
function toggleTrackingEdit(event) {
|
120
120
|
event.preventDefault()
|
121
121
|
|
122
122
|
var link = $(this)
|
@@ -128,7 +128,7 @@ $(document).ready(function () {
|
|
128
128
|
$('a.edit-tracking').click(toggleTrackingEdit)
|
129
129
|
$('a.cancel-tracking').click(toggleTrackingEdit)
|
130
130
|
|
131
|
-
function createTrackingValueContent
|
131
|
+
function createTrackingValueContent(data) {
|
132
132
|
var selectedShippingMethod = data.shipping_methods.filter(function (method) {
|
133
133
|
return method.id === data.selected_shipping_rate.shipping_method_id
|
134
134
|
})[0]
|
@@ -174,7 +174,7 @@ $(document).ready(function () {
|
|
174
174
|
})
|
175
175
|
})
|
176
176
|
|
177
|
-
function adjustShipmentItems
|
177
|
+
function adjustShipmentItems(shipmentNumber, variantId, quantity) {
|
178
178
|
var shipment = _.findWhere(shipments, { number: shipmentNumber + '' })
|
179
179
|
var inventoryUnits = _.where(shipment.inventory_units, { variant_id: variantId })
|
180
180
|
var url = Spree.routes.shipments_api + '/' + shipmentNumber
|
@@ -209,7 +209,7 @@ function adjustShipmentItems (shipmentNumber, variantId, quantity) {
|
|
209
209
|
}
|
210
210
|
}
|
211
211
|
|
212
|
-
function toggleMethodEdit
|
212
|
+
function toggleMethodEdit() {
|
213
213
|
var link = $(this)
|
214
214
|
link.parents('tbody').find('tr.edit-method').toggle()
|
215
215
|
link.parents('tbody').find('tr.show-method').toggle()
|
@@ -217,7 +217,7 @@ function toggleMethodEdit () {
|
|
217
217
|
return false
|
218
218
|
}
|
219
219
|
|
220
|
-
function toggleItemEdit
|
220
|
+
function toggleItemEdit() {
|
221
221
|
var link = $(this)
|
222
222
|
var linkParent = link.parent()
|
223
223
|
linkParent.find('a.edit-item').toggle()
|
@@ -231,7 +231,7 @@ function toggleItemEdit () {
|
|
231
231
|
return false
|
232
232
|
}
|
233
233
|
|
234
|
-
function startItemSplit
|
234
|
+
function startItemSplit(event) {
|
235
235
|
event.preventDefault()
|
236
236
|
$('.cancel-split').each(function () {
|
237
237
|
$(this).click()
|
@@ -253,9 +253,9 @@ function startItemSplit (event) {
|
|
253
253
|
},
|
254
254
|
token: Spree.api_key
|
255
255
|
}
|
256
|
-
}).
|
256
|
+
}).done(function (data) {
|
257
257
|
variant = data['variants'][0]
|
258
|
-
}).
|
258
|
+
}).fail(function (msg) {
|
259
259
|
alert(msg.responseJSON.message || msg.responseJSON.exception)
|
260
260
|
})
|
261
261
|
|
@@ -268,7 +268,7 @@ function startItemSplit (event) {
|
|
268
268
|
$('#item_stock_location').select2({ width: 'resolve', placeholder: Spree.translations.item_stock_placeholder })
|
269
269
|
}
|
270
270
|
|
271
|
-
function completeItemSplit
|
271
|
+
function completeItemSplit(event) {
|
272
272
|
event.preventDefault()
|
273
273
|
|
274
274
|
if ($('#item_stock_location').val() === '') {
|
@@ -287,24 +287,13 @@ function completeItemSplit (event) {
|
|
287
287
|
var selectedShipment = stockItemRow.find($('#item_stock_location').select2('data').element)
|
288
288
|
var targetShipmentNumber = selectedShipment.data('shipment-number')
|
289
289
|
var newShipment = selectedShipment.data('new-shipment')
|
290
|
-
// eslint-disable-next-line
|
291
|
-
if (stockLocationId
|
292
|
-
|
290
|
+
// eslint-disable-next-line eqeqeq
|
291
|
+
if (stockLocationId != 'new_shipment') {
|
292
|
+
if (newShipment !== undefined) {
|
293
|
+
// TRANSFER TO A NEW LOCATION
|
293
294
|
$.ajax({
|
294
295
|
type: 'POST',
|
295
296
|
async: false,
|
296
|
-
url: opts.url,
|
297
|
-
data: opts.data
|
298
|
-
}).error(function (msg) {
|
299
|
-
alert(msg.responseJSON.message || msg.responseJSON.exception)
|
300
|
-
}).done(function () {
|
301
|
-
window.location.reload()
|
302
|
-
})
|
303
|
-
}
|
304
|
-
|
305
|
-
if (newShipment !== undefined) {
|
306
|
-
// TRANSFER TO A NEW LOCATION
|
307
|
-
splitItems({
|
308
297
|
url: Spree.url(Spree.routes.shipments_api + '/transfer_to_location'),
|
309
298
|
data: {
|
310
299
|
original_shipment_number: originalShipmentNumber,
|
@@ -313,10 +302,16 @@ function completeItemSplit (event) {
|
|
313
302
|
stock_location_id: stockLocationId,
|
314
303
|
token: Spree.api_key
|
315
304
|
}
|
305
|
+
}).fail(function (msg) {
|
306
|
+
alert(msg.responseJSON.message || msg.responseJSON.exception)
|
307
|
+
}).done(function (msg) {
|
308
|
+
window.location.reload()
|
316
309
|
})
|
317
310
|
} else {
|
318
311
|
// TRANSFER TO AN EXISTING SHIPMENT
|
319
|
-
|
312
|
+
$.ajax({
|
313
|
+
type: 'POST',
|
314
|
+
async: false,
|
320
315
|
url: Spree.url(Spree.routes.shipments_api + '/transfer_to_shipment'),
|
321
316
|
data: {
|
322
317
|
original_shipment_number: originalShipmentNumber,
|
@@ -325,12 +320,16 @@ function completeItemSplit (event) {
|
|
325
320
|
quantity: quantity,
|
326
321
|
token: Spree.api_key
|
327
322
|
}
|
323
|
+
}).fail(function (msg) {
|
324
|
+
alert(msg.responseJSON.message || msg.responseJSON.exception)
|
325
|
+
}).done(function (msg) {
|
326
|
+
window.location.reload()
|
328
327
|
})
|
329
328
|
}
|
330
329
|
}
|
331
330
|
}
|
332
331
|
|
333
|
-
function cancelItemSplit
|
332
|
+
function cancelItemSplit(event) {
|
334
333
|
event.preventDefault()
|
335
334
|
var link = $(this)
|
336
335
|
var prevRow = link.closest('tr').prev()
|
@@ -340,7 +339,7 @@ function cancelItemSplit (event) {
|
|
340
339
|
prevRow.find('a.delete-item').toggle()
|
341
340
|
}
|
342
341
|
|
343
|
-
function addVariantFromStockLocation
|
342
|
+
function addVariantFromStockLocation(event) {
|
344
343
|
event.preventDefault()
|
345
344
|
|
346
345
|
$('#stock_details').hide()
|
@@ -366,7 +365,7 @@ function addVariantFromStockLocation (event) {
|
|
366
365
|
}
|
367
366
|
}).done(function (msg) {
|
368
367
|
window.location.reload()
|
369
|
-
}).
|
368
|
+
}).fail(function (msg) {
|
370
369
|
alert(msg.responseJSON.message || msg.responseJSON.exception)
|
371
370
|
})
|
372
371
|
} else {
|