Skip to content

Commit

Permalink
Changed var to const
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaMelazzo committed Aug 7, 2023
1 parent 387c450 commit fd762c0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
26 changes: 13 additions & 13 deletions view/frontend/web/js/core/checkout/PaymentMethodController.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,10 @@ PaymentMethodController.prototype.addCreditCardHolderNameListener = function(for
}

PaymentMethodController.prototype.addValidatorListener = function(formObject) {
var paymentMethodController = this;
const paymentMethodController = this;

jQuery(formObject.containerSelector).on('change', function (event) {
var element = jQuery(event.target);
const element = jQuery(event.target);
if (
element.attr('name').startsWith('payment[cc_type]')
&& element.val() !== 'default'
Expand Down Expand Up @@ -728,15 +728,15 @@ PaymentMethodController.prototype.validateCcNumberField = function (element, for
};

PaymentMethodController.prototype.validateCcExpDateField = function (formObject) {
var cardExpirationMonth = formObject.creditCardExpMonth;
var cardExpirationYear = formObject.creditCardExpYear;
const cardExpirationMonth = formObject.creditCardExpMonth;
const cardExpirationYear = formObject.creditCardExpYear;

var cardDate = new Date (cardExpirationYear.val(), cardExpirationMonth.val() -1);
var dateNow = new Date();
const cardDate = new Date (cardExpirationYear.val(), cardExpirationMonth.val() -1);
const dateNow = new Date();

var monthParentsElements = cardExpirationMonth.parent().parent();
var yearParentsElements = cardExpirationYear.parent().parent();
var parentsElements = yearParentsElements.parents('.field');
const monthParentsElements = cardExpirationMonth.parent().parent();
const yearParentsElements = cardExpirationYear.parent().parent();
const parentsElements = yearParentsElements.parents('.field');

if (cardDate < dateNow) {
monthParentsElements.addClass('_error');
Expand All @@ -752,9 +752,9 @@ PaymentMethodController.prototype.validateCcExpDateField = function (formObject)
};

PaymentMethodController.prototype.validateDefaultField = function (element) {
var requiredElement = element.parent().parent();
const requiredElement = element.parent().parent();

if (element.val() == '') {
if (element.val() === '') {
requiredElement.addClass('_error');
requiredElement.children('.field-error').show();
return true;
Expand All @@ -766,8 +766,8 @@ PaymentMethodController.prototype.validateDefaultField = function (element) {
};

PaymentMethodController.prototype.validateBrandField = function (formObject) {
var element = formObject.creditCardBrand;
var requiredElement = element.parent().parent();
const element = formObject.creditCardBrand;
const requiredElement = element.parent().parent();

var brands = [];
PlatformConfig.PlatformConfig.avaliableBrands[formObject.savedCardSelectUsed].forEach(function (item) {
Expand Down
6 changes: 3 additions & 3 deletions view/frontend/web/js/core/checkout/PlatformFormHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ FormHandler.prototype.init = function (formObject) {
};

FormHandler.prototype.switchBrand = function (brand) {
var brandsSelector = this.formObject.containerSelector + ' .brands';
var brandElement = this.formObject.creditCardBrand;
const brandsSelector = this.formObject.containerSelector + ' .brands';
const brandElement = this.formObject.creditCardBrand;

jQuery(brandsSelector).css('filter', 'grayscale(100%) opacity(60%)');

if(typeof brand != 'undefined' && brand.length > 0){
var brandSelector =
const brandSelector =
this.formObject.containerSelector + ' .' +
brand.toLowerCase();

Expand Down

0 comments on commit fd762c0

Please sign in to comment.