Skip to content

Commit

Permalink
Small js changes
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed May 10, 2024
1 parent 3e56f8e commit 0c16dec
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/Resources/public/js/pickup-point-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PickupPointManager {
endpoint: null,
allowedShippingMethods: [],
shippingMethodSelector: 'input[type="radio"][name^="sylius_checkout_select_shipping[shipments]"]',
insertHtmlCallback: (radio) => {
insertHtmlCallback: function (radio) {
radio.closest('.item').insertAdjacentHTML('afterend', this.getHtml(radio.value));
},
}, config);
Expand Down Expand Up @@ -67,8 +67,7 @@ class PickupPointManager {
/**
* @param {HTMLInputElement} radio
*/
#insertHtml(radio)
{
#insertHtml(radio) {
if(!this.hasData(radio.value)) {
radio.dispatchEvent(new CustomEvent('pickup_point_manager:loading', { bubbles: true, detail: { radio: radio, shippingMethod: radio.value } }));

Expand Down Expand Up @@ -127,17 +126,15 @@ class PickupPointManager {
* @param {string} shippingMethod
* @return {boolean}
*/
hasData(shippingMethod)
{
hasData(shippingMethod) {
return Object.hasOwn(this.#data, shippingMethod);
}

/**
* @param {string} shippingMethod
* @return {string}
*/
getHtml(shippingMethod)
{
getHtml(shippingMethod) {
if(!this.hasData(shippingMethod)) {
throw new Error('No pickup point data found for shipping method ' + shippingMethod);
}
Expand Down

0 comments on commit 0c16dec

Please sign in to comment.