|
|
@ -32,24 +32,10 @@ odoo.define('vracoop_click_and_collect.vracoop_retrait', function (require) { |
|
|
|
|
|
|
|
var _onRetraitUpdateAnswer = function(result) { |
|
|
|
var $retrait_badge = $('#point_retrait input[name="point_retrait_type"][value=' + result.vracoop_point_retrait_id + ']'); |
|
|
|
// var $retrait_bloc = $('#slots_point_retrait_' + result.vracoop_point_retrait_id)
|
|
|
|
// console.log($retrait_bloc);
|
|
|
|
if (result.status === true) { |
|
|
|
// $retrait_bloc.removeClass('d-none');
|
|
|
|
$pay_button.data('disabled_reasons').retrait_selection = false; |
|
|
|
$pay_button.prop('disabled', _.contains($pay_button.data('disabled_reasons'), true)); |
|
|
|
} |
|
|
|
else { |
|
|
|
console.error(result.error_message); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
var _onRetraitClick = function(ev) { |
|
|
|
$pay_button.data('disabled_reasons', $pay_button.data('disabled_reasons') || {}); |
|
|
|
$pay_button.prop('disabled', true); |
|
|
|
$pay_button.data('disabled_reasons').retrait_selection = true; |
|
|
|
var vracoop_point_retrait_id = $(ev.currentTarget).val(); |
|
|
|
console.log(vracoop_point_retrait_id); |
|
|
|
var values = {'vracoop_point_retrait_id': vracoop_point_retrait_id}; |
|
|
|
dp.add(ajax.jsonRpc('/shop/update_retrait', 'call', values)) |
|
|
|
.then(_onRetraitUpdateAnswer); |
|
|
@ -64,21 +50,10 @@ odoo.define('vracoop_click_and_collect.vracoop_retrait', function (require) { |
|
|
|
|
|
|
|
var _onDayUpdateAnswer = function(result) { |
|
|
|
|
|
|
|
if (result.status === true) { |
|
|
|
$pay_button.data('disabled_reasons').day_selection = false; |
|
|
|
$pay_button.prop('disabled', _.contains($pay_button.data('disabled_reasons'), true)); |
|
|
|
} |
|
|
|
else { |
|
|
|
console.error(result.error_message); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
var _onDayClick = function(ev) { |
|
|
|
$pay_button.data('disabled_reasons', $pay_button.data('disabled_reasons') || {}); |
|
|
|
$pay_button.data('disabled_reasons').day_selection = true; |
|
|
|
$pay_button.prop('disabled', true); |
|
|
|
var day_retrait = $(ev.currentTarget).val(); |
|
|
|
console.log(day_retrait); |
|
|
|
var values = {'day_retrait': day_retrait}; |
|
|
|
dp.add(ajax.jsonRpc('/shop/update_retrait', 'call', values)) |
|
|
|
.then(_onDayUpdateAnswer); |
|
|
@ -92,9 +67,8 @@ odoo.define('vracoop_click_and_collect.vracoop_retrait', function (require) { |
|
|
|
} |
|
|
|
|
|
|
|
var _onHourUpdateAnswer = function(result) { |
|
|
|
|
|
|
|
if (result.status === true) { |
|
|
|
$pay_button.data('disabled_reasons').hour_selection = false; |
|
|
|
$pay_button.data('disabled_reasons').retrait_selection = false; |
|
|
|
$pay_button.prop('disabled', _.contains($pay_button.data('disabled_reasons'), true)); |
|
|
|
} |
|
|
|
else { |
|
|
@ -103,9 +77,6 @@ odoo.define('vracoop_click_and_collect.vracoop_retrait', function (require) { |
|
|
|
}; |
|
|
|
|
|
|
|
var _onHourClick = function(ev) { |
|
|
|
$pay_button.data('disabled_reasons', $pay_button.data('disabled_reasons') || {}); |
|
|
|
$pay_button.data('disabled_reasons').hour_selection = true; |
|
|
|
$pay_button.prop('disabled', true); |
|
|
|
var hour_retrait = $(ev.currentTarget).val(); |
|
|
|
var values = {'hour_retrait': hour_retrait}; |
|
|
|
dp.add(ajax.jsonRpc('/shop/update_retrait', 'call', values)) |
|
|
@ -124,8 +95,13 @@ odoo.define('vracoop_click_and_collect.vracoop_retrait', function (require) { |
|
|
|
var $point_retrait = $('#point_retrait'); |
|
|
|
if (result.point_retrait === true) { |
|
|
|
$point_retrait.removeClass('d-none'); |
|
|
|
$pay_button.data('disabled_reasons', $pay_button.data('disabled_reasons') || {}); |
|
|
|
$pay_button.prop('disabled', true); |
|
|
|
$pay_button.data('disabled_reasons').retrait_selection = true; |
|
|
|
} |
|
|
|
else { |
|
|
|
$pay_button.data('disabled_reasons').retrait_selection = false; |
|
|
|
$pay_button.prop('disabled', _.contains($pay_button.data('disabled_reasons'), true)); |
|
|
|
$point_retrait.addClass('d-none'); |
|
|
|
} |
|
|
|
}; |
|
|
|