codefix after review
This commit is contained in:
parent
0c4b5b2570
commit
36288d9036
5 changed files with 27 additions and 18 deletions
|
@ -1,28 +1,22 @@
|
|||
$(document).ready(function() {
|
||||
let intervalId;
|
||||
|
||||
function makeAjaxRequest() {
|
||||
setTimeout(function() {
|
||||
$('#bonus-msg').html('Сколько бонусов потратить?');
|
||||
BX.Sale.OrderAjaxComponent.sendRequest();
|
||||
}, 1005);
|
||||
}
|
||||
|
||||
$('#bonus-input').on('keydown', function() {
|
||||
$('#bonus-msg').html('Обработка информации');
|
||||
clearInterval(intervalId);
|
||||
})
|
||||
});
|
||||
|
||||
$('#bonus-input').keyup(function() {
|
||||
let availableBonuses = Number.parseInt($('#available-bonus-input').val());
|
||||
let inputBonuses = Number.parseInt($('#bonus-input').val());
|
||||
if (inputBonuses > availableBonuses) {
|
||||
$('#bonus-input-error').text('Вы не можете потратить более ' + availableBonuses + ' бонусов');
|
||||
}else{
|
||||
} else {
|
||||
$('#bonus-input-error').html(null);
|
||||
}
|
||||
});
|
||||
|
||||
$('#bonus-input').on('keydown',
|
||||
_.debounce(makeAjaxRequest, 1000));
|
||||
$('#bonus-input').on('keydown', _.debounce(makeAjaxRequest, 1000));
|
||||
});
|
||||
|
|
|
@ -27,7 +27,12 @@ class AdminPanel extends Controller
|
|||
public function LoyaltyProgramToggleAction(): array
|
||||
{
|
||||
$status = ConfigProvider::getLoyaltyProgramStatus();
|
||||
$newStatus = $status !== 'Y' ? 'Y' : 'N';
|
||||
|
||||
if ($status !== 'Y') {
|
||||
$newStatus = 'Y';
|
||||
} else {
|
||||
$newStatus = 'N';
|
||||
}
|
||||
|
||||
ConfigProvider::setLoyaltyProgramStatus($newStatus);
|
||||
|
||||
|
|
|
@ -27,4 +27,12 @@ class AbstractApiResponseModel extends AbstractApiModel
|
|||
* @Mapping\SerializedName("errorMsg")
|
||||
*/
|
||||
public $errorMsg;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*
|
||||
* @Mapping\Type("array")
|
||||
* @Mapping\SerializedName("errors")
|
||||
*/
|
||||
public $errors;
|
||||
}
|
||||
|
|
|
@ -12,12 +12,14 @@
|
|||
*/
|
||||
namespace Intaro\RetailCrm\Model\Api\Response\Settings;
|
||||
|
||||
use Intaro\RetailCrm\Model\Api\Response\AbstractApiResponseModel;
|
||||
|
||||
/**
|
||||
* Class CredentialsResponse
|
||||
*
|
||||
* @package Intaro\RetailCrm\Model\Api\Response\Settings
|
||||
*/
|
||||
class CredentialsResponse
|
||||
class CredentialsResponse extends AbstractApiResponseModel
|
||||
{
|
||||
/**
|
||||
* Результат запроса (успешный/неуспешный)
|
||||
|
|
|
@ -42,11 +42,11 @@ class LoyaltyService
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $orderId
|
||||
* @param $bonusCount
|
||||
* @param int $orderId
|
||||
* @param int $bonusCount
|
||||
* @return \Intaro\RetailCrm\Model\Api\Response\Order\Loyalty\OrderLoyaltyApplyResponse|mixed|null
|
||||
*/
|
||||
public function sendBonusPayment($orderId, $bonusCount)
|
||||
public function sendBonusPayment(int $orderId, int $bonusCount)
|
||||
{
|
||||
$request = new OrderLoyaltyApplyRequest();
|
||||
$request->order->id = $orderId;
|
||||
|
@ -62,12 +62,12 @@ class LoyaltyService
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $basketItems
|
||||
* @param $discountPrice
|
||||
* @param $discountPercent
|
||||
* @param array $basketItems
|
||||
* @param int $discountPrice
|
||||
* @param int $discountPercent
|
||||
* @return \Intaro\RetailCrm\Model\Api\Response\Loyalty\LoyaltyCalculateResponse|mixed|null
|
||||
*/
|
||||
public function calculateBonus($basketItems, $discountPrice, $discountPercent)
|
||||
public function calculateBonus(array $basketItems, int $discountPrice, int $discountPercent)
|
||||
{
|
||||
global $USER;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue