PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.10
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.10
4.4.10 4.4.9.1 4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 All 142 releases
← All changes | assets/dist/js/admin/list-students-enrolled.js +264 -128 4.3.8 → 4.4.10 View file →
@@ -1,4 +1,4 @@
1 1 /******/ (() => { // webpackBootstrap
2 2 /******/ "use strict";
3 3 /******/ var __webpack_modules__ = ({
4 4
@@ -11,8 +11,9 @@
11 11 __webpack_require__.r(__webpack_exports__);
12 12 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13 13 /* harmony export */ debounce: () => (/* binding */ debounce),
14 14 /* harmony export */ eventHandlers: () => (/* binding */ eventHandlers),
15 +/* harmony export */ fullScreenView: () => (/* binding */ fullScreenView),
15 16 /* harmony export */ getDataOfForm: () => (/* binding */ getDataOfForm),
16 17 /* harmony export */ getFieldKeysOfForm: () => (/* binding */ getFieldKeysOfForm),
17 18 /* harmony export */ listenElementCreated: () => (/* binding */ listenElementCreated),
18 19 /* harmony export */ listenElementViewed: () => (/* binding */ listenElementViewed),
@@ -24,18 +25,19 @@
24 25 /* harmony export */ lpOnElementReady: () => (/* binding */ lpOnElementReady),
25 26 /* harmony export */ lpSetLoadingEl: () => (/* binding */ lpSetLoadingEl),
26 27 /* harmony export */ lpShowHideEl: () => (/* binding */ lpShowHideEl),
27 28 /* harmony export */ mergeDataWithDatForm: () => (/* binding */ mergeDataWithDatForm),
28 -/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse)
29 +/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse),
30 +/* harmony export */ toggleEnable: () => (/* binding */ toggleEnable)
29 31 /* harmony export */ });
30 -/**
31 - * Utils functions
32 - *
33 - * @param url
34 - * @param data
35 - * @param functions
36 - * @since 4.2.5.1
37 - * @version 1.0.6
32 +/**
33 + * Utils functions
34 + *
35 + * @param url
36 + * @param data
37 + * @param functions
38 + * @since 4.2.5.1
39 + * @version 1.0.7
38 40 */
39 41 const lpClassName = {
40 42 hidden: 'lp-hidden',
41 43 loading: 'loading',
@@ -40,9 +42,12 @@
40 42 hidden: 'lp-hidden',
41 43 loading: 'loading',
42 44 elCollapse: 'lp-collapse',
43 45 elSectionToggle: '.lp-section-toggle',
44 - elTriggerToggle: '.lp-trigger-toggle'
46 + elTriggerToggle: '.lp-trigger-toggle',
47 + elBtnFullScreen: '.lp-btn-full-screen-view',
48 + elFullScreen: 'lp-full-screen-view',
49 + elBtnFullScreenClose: 'lp-full-screen-view__close'
45 50 };
46 51 const lpFetchAPI = (url, data = {}, functions = {}) => {
47 52 if ('function' === typeof functions.before) {
48 53 functions.before();
@@ -64,12 +69,12 @@
64 69 }
65 70 });
66 71 };
67 72
68 -/**
69 - * Get current URL without params.
70 - *
71 - * @since 4.2.5.1
73 +/**
74 + * Get current URL without params.
75 + *
76 + * @since 4.2.5.1
72 77 */
73 78 const lpGetCurrentURLNoParam = () => {
74 79 let currentUrl = window.location.href;
75 80 const hasParams = currentUrl.includes('?');
@@ -85,14 +90,14 @@
85 90 });
86 91 return url;
87 92 };
88 93
89 -/**
90 - * Listen element viewed.
91 - *
92 - * @param el
93 - * @param callback
94 - * @since 4.2.5.8
94 +/**
95 + * Listen element viewed.
96 + *
97 + * @param el
98 + * @param callback
99 + * @since 4.2.5.8
95 100 */
96 101 const listenElementViewed = (el, callback) => {
97 102 const observerSeeItem = new IntersectionObserver(function (entries) {
98 103 for (const entry of entries) {
@@ -103,13 +108,13 @@
103 108 });
104 109 observerSeeItem.observe(el);
105 110 };
106 111
107 -/**
108 - * Listen element created.
109 - *
110 - * @param callback
111 - * @since 4.2.5.8
112 +/**
113 + * Listen element created.
114 + *
115 + * @param callback
116 + * @since 4.2.5.8
112 117 */
113 118 const listenElementCreated = callback => {
114 119 const observerCreateItem = new MutationObserver(function (mutations) {
115 120 mutations.forEach(function (mutation) {
@@ -128,14 +133,14 @@
128 133 });
129 134 // End.
130 135 };
131 136
132 -/**
133 - * Listen element created.
134 - *
135 - * @param selector
136 - * @param callback
137 - * @since 4.2.7.1
137 +/**
138 + * Listen element created.
139 + *
140 + * @param selector
141 + * @param callback
142 + * @since 4.2.7.1
138 143 */
139 144 const lpOnElementReady = (selector, callback) => {
140 145 const element = document.querySelector(selector);
141 146 if (element) {
@@ -276,17 +281,17 @@
276 281 };
277 282 return dataHandle;
278 283 };
279 284
280 -/**
281 - * Event trigger
282 - * For each list of event handlers, listen event on document.
283 - *
284 - * eventName: 'click', 'change', ...
285 - * eventHandlers = [ { selector: '.lp-button', callBack: function(){}, class: object } ]
286 - *
287 - * @param eventName
288 - * @param eventHandlers
285 +/**
286 + * Event trigger
287 + * For each list of event handlers, listen event on document.
288 + *
289 + * eventName: 'click', 'change', ...
290 + * eventHandlers = [ { selector: '.lp-button', callBack: function(){}, class: object } ]
291 + *
292 + * @param eventName
293 + * @param eventHandlers
289 294 */
290 295 const eventHandlers = (eventName, eventHandlers) => {
291 296 document.addEventListener(eventName, e => {
292 297 const target = e.target;
@@ -327,32 +332,32 @@
327 332 });
328 333 });
329 334 };
330 335
331 -/**
332 - * Debounce - delays function execution until after `wait` ms of inactivity.
333 - *
334 - * Each call resets the timer. Only the last call in a burst executes.
335 - *
336 - * USE CASES:
337 - * - Search inputs, form validation, window resize
338 - * - Multiple elements need independent timers
339 - * - When you need to call with different arguments
340 - *
341 - * EXAMPLES:
342 - * const debouncedSearch = debounce( (query) => fetchResults(query), 300 );
343 - * searchInput.addEventListener('input', (e) => debouncedSearch(e.target.value));
344 - *
345 - * const debouncedResize = debounce( recalculateLayout, 250 );
346 - * window.addEventListener('resize', debouncedResize);
347 - *
348 - * ⚠️ Create ONCE outside event handlers, not inside.
349 - *
350 - * @param {Function} func - Function to debounce (can be anonymous)
351 - * @param {number} wait - Milliseconds to wait (default: 500)
352 - * @return {Function} Debounced wrapper function
353 - * @since 4.3.7
354 - * @version 1.0.0
336 +/**
337 + * Debounce - delays function execution until after `wait` ms of inactivity.
338 + *
339 + * Each call resets the timer. Only the last call in a burst executes.
340 + *
341 + * USE CASES:
342 + * - Search inputs, form validation, window resize
343 + * - Multiple elements need independent timers
344 + * - When you need to call with different arguments
345 + *
346 + * EXAMPLES:
347 + * const debouncedSearch = debounce( (query) => fetchResults(query), 300 );
348 + * searchInput.addEventListener('input', (e) => debouncedSearch(e.target.value));
349 + *
350 + * const debouncedResize = debounce( recalculateLayout, 250 );
351 + * window.addEventListener('resize', debouncedResize);
352 + *
353 + * ⚠️ Create ONCE outside event handlers, not inside.
354 + *
355 + * @param {Function} func - Function to debounce (can be anonymous)
356 + * @param {number} wait - Milliseconds to wait (default: 500)
357 + * @return {Function} Debounced wrapper function
358 + * @since 4.3.7
359 + * @version 1.0.0
355 360 */
356 361 const debounce = (func, wait = 500) => {
357 362 let timer;
358 363 return args => {
@@ -360,24 +365,157 @@
360 365 timer = setTimeout(() => func(args), wait);
361 366 };
362 367 };
363 368
369 +/**
370 + * Initialize lp-toggle-enable components.
371 + *
372 + * Finds all `.lp-toggle-enable` elements and wires up toggle behavior.
373 + * Reads initial state from `data-enabled` attribute ("true"/"false").
374 + * Calls `data-on-toggle` callback (if provided via options) on state change.
375 + *
376 + * HTML structure:
377 + * <label class="lp-toggle-enable" data-enabled="true">
378 + * <input type="checkbox" class="lp-toggle-enable__input" />
379 + * <span class="lp-toggle-enable__track"></span>
380 + * </label>
381 + *
382 + * @param {string} selector CSS selector for toggle elements (default: '.lp-toggle-enable')
383 + * @param {Function} onToggle Optional callback( el, isEnabled ) called on state change
384 + * @since 4.4.5
385 + * @version 1.0.0
386 + */
387 +window.lpToggleEnableInit = 0;
388 +const toggleEnable = (onToggle = null) => {
389 + if (window.lpToggleEnableInit) {
390 + return;
391 + }
392 + window.lpToggleEnableInit = 1;
393 + const selector = '.lp-toggle-enable';
394 + const updateUI = (toggle, isEnabled) => {
395 + toggle.classList.toggle('is-enabled', isEnabled);
396 + const input = toggle.querySelector('.lp-toggle-enable__input');
397 + if (input) {
398 + input.checked = isEnabled;
399 + input.value = isEnabled ? '1' : '0';
400 + }
401 + };
402 +
403 + // Delegate click handling via eventHandlers.
404 + eventHandlers('click', [{
405 + selector,
406 + callBack: args => {
407 + const {
408 + e,
409 + target
410 + } = args;
411 + const toggle = target.closest(selector);
412 + if (!toggle || toggle.classList.contains('is-disabled')) {
413 + return;
414 + }
415 + e.preventDefault();
416 + const isEnabled = !toggle.classList.contains('is-enabled');
417 + updateUI(toggle, isEnabled);
418 + if ('function' === typeof onToggle) {
419 + onToggle(toggle, isEnabled);
420 + }
421 + }
422 + }]);
423 +};
424 +
425 +/**
426 + * Initialize custom fullscreen view buttons.
427 + *
428 + * Delegates clicks on `.lp-btn-full-screen-view` buttons to
429 + * `lpToggleFullscreenView`. Reads the `data-target` attribute to find the
430 + * target element. Falls back to the button's parent element when
431 + * `data-target` is not provided.
432 + *
433 + * @since 4.4.5
434 + * @version 1.0.0
435 + */
436 +window.lpFullScreenViewInit = 0;
437 +const fullScreenView = () => {
438 + if (window.lpFullScreenViewInit) {
439 + return;
440 + }
441 + window.lpFullScreenViewInit = 1;
442 + let lastScrollY = 0;
443 + const lpToggleFullscreenView = (elTarget, elBtnFullScreen = null) => {
444 + const isFullscreen = elTarget.classList.contains(lpClassName.elFullScreen);
445 + if (isFullscreen) {
446 + elTarget.classList.remove(lpClassName.elFullScreen);
447 + document.documentElement.classList.remove('lp-full-screen-active');
448 + window.scrollTo(0, lastScrollY);
449 + } else {
450 + lastScrollY = window.scrollY;
451 + elTarget.classList.add(lpClassName.elFullScreen);
452 + document.documentElement.classList.add('lp-full-screen-active');
453 + }
454 + if (!isFullscreen) {
455 + if (!elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`)) {
456 + const closeButton = document.createElement('button');
457 + closeButton.type = 'button';
458 + closeButton.className = lpClassName.elBtnFullScreenClose;
459 + closeButton.setAttribute('aria-label', 'Close');
460 + closeButton.innerHTML = lpData.i18n.closeButtonFullScreen || 'Close &times;';
461 + closeButton.addEventListener('click', e => {
462 + e.preventDefault();
463 + lpToggleFullscreenView(elTarget);
464 + });
465 + elTarget.appendChild(closeButton);
466 + }
467 + } else {
468 + const closeButton = elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`);
469 + if (closeButton) {
470 + closeButton.remove();
471 + }
472 + }
473 + };
474 + eventHandlers('click', [{
475 + selector: lpClassName.elBtnFullScreen,
476 + callBack: args => {
477 + const {
478 + e,
479 + target
480 + } = args;
481 + const elBtnFullScreen = target.closest(lpClassName.elBtnFullScreen);
482 + if (!elBtnFullScreen) {
483 + console.log('No full screen button found');
484 + return;
485 + }
486 + e.preventDefault();
487 + let elTarget = null;
488 + const targetSelector = elBtnFullScreen.dataset.targetFullscreen;
489 + console.log(targetSelector);
490 + if (targetSelector) {
491 + elTarget = document.querySelector(targetSelector);
492 + }
493 + if (!elTarget) {
494 + console.log('No target element found');
495 + return;
496 + }
497 + lpToggleFullscreenView(elTarget, elBtnFullScreen);
498 + }
499 + }]);
500 +};
501 +
364 502 /***/ }
365 503
366 504 /******/ });
367 505 /************************************************************************/
368 506 /******/ // The module cache
369 -/******/ var __webpack_module_cache__ = {};
507 +/******/ const __webpack_module_cache__ = {};
370 508 /******/
371 509 /******/ // The require function
372 510 /******/ function __webpack_require__(moduleId) {
373 511 /******/ // Check if module is in cache
374 -/******/ var cachedModule = __webpack_module_cache__[moduleId];
512 +/******/ const cachedModule = __webpack_module_cache__[moduleId];
375 513 /******/ if (cachedModule !== undefined) {
376 514 /******/ return cachedModule.exports;
377 515 /******/ }
378 516 /******/ // Create a new module (and put it into the cache)
379 -/******/ var module = __webpack_module_cache__[moduleId] = {
517 +/******/ const module = __webpack_module_cache__[moduleId] = {
380 518 /******/ // no module.id needed
381 519 /******/ // no module.loaded needed
382 520 /******/ exports: {}
383 521 /******/ };
@@ -384,9 +522,9 @@
384 522 /******/
385 523 /******/ // Execute the module function
386 524 /******/ if (!(moduleId in __webpack_modules__)) {
387 525 /******/ delete __webpack_module_cache__[moduleId];
388 -/******/ var e = new Error("Cannot find module '" + moduleId + "'");
526 +/******/ const e = new Error("Cannot find module '" + moduleId + "'");
389 527 /******/ e.code = 'MODULE_NOT_FOUND';
390 528 /******/ throw e;
391 529 /******/ }
392 530 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
@@ -397,14 +535,29 @@
397 535 /******/
398 536 /************************************************************************/
399 537 /******/ /* webpack/runtime/define property getters */
400 538 /******/ (() => {
401 -/******/ // define getter functions for harmony exports
539 +/******/ // define getter/value functions for harmony exports
402 540 /******/ __webpack_require__.d = (exports, definition) => {
403 -/******/ for(var key in definition) {
404 -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
405 -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
541 +/******/ if(Array.isArray(definition)) {
542 +/******/ var i = 0;
543 +/******/ while(i < definition.length) {
544 +/******/ var key = definition[i++];
545 +/******/ var binding = definition[i++];
546 +/******/ if(!__webpack_require__.o(exports, key)) {
547 +/******/ if(binding === 0) {
548 +/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
549 +/******/ } else {
550 +/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
551 +/******/ }
552 +/******/ } else if(binding === 0) { i++; }
406 553 /******/ }
554 +/******/ } else {
555 +/******/ for(var key in definition) {
556 +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
557 +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
558 +/******/ }
559 +/******/ }
407 560 /******/ }
408 561 /******/ };
409 562 /******/ })();
410 563 /******/
@@ -409,9 +562,9 @@
409 562 /******/ })();
410 563 /******/
411 564 /******/ /* webpack/runtime/hasOwnProperty shorthand */
412 565 /******/ (() => {
413 -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
566 +/******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop))
414 567 /******/ })();
415 568 /******/
416 569 /******/ /* webpack/runtime/make namespace object */
417 570 /******/ (() => {
@@ -416,9 +569,9 @@
416 569 /******/ /* webpack/runtime/make namespace object */
417 570 /******/ (() => {
418 571 /******/ // define __esModule on exports
419 572 /******/ __webpack_require__.r = (exports) => {
420 -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
573 +/******/ if(Symbol.toStringTag) {
421 574 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
422 575 /******/ }
423 576 /******/ Object.defineProperty(exports, '__esModule', { value: true });
424 577 /******/ };
@@ -424,9 +577,9 @@
424 577 /******/ };
425 578 /******/ })();
426 579 /******/
427 580 /************************************************************************/
428 -var __webpack_exports__ = {};
581 +let __webpack_exports__ = {};
429 582 // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
430 583 (() => {
431 584 /*!*******************************************************!*\
432 585 !*** ./assets/src/js/admin/list-students-enrolled.js ***!
@@ -435,16 +588,16 @@
435 588 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
436 589 /* harmony export */ ListStudentsEnrolled: () => (/* binding */ ListStudentsEnrolled)
437 590 /* harmony export */ });
438 591 /* harmony import */ var lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lpAssetsJsPath/utils.js */ "./assets/src/js/utils.js");
439 -/**
440 - * List Students Enrolled Script
441 - *
442 - * Handles filter and search interactions for the enrolled students table.
443 - * Pagination is handled by loadAJAX.js clickNumberPage (via .page-numbers class).
444 - *
445 - * @since 4.3.3
446 - * @version 1.0.0
592 +/**
593 + * List Students Enrolled Script
594 + *
595 + * Handles filter and search interactions for the enrolled students table.
596 + * Pagination is handled by loadAJAX.js clickNumberPage (via .page-numbers class).
597 + *
598 + * @since 4.3.3
599 + * @version 1.0.0
447 600 */
448 601
449 602 class ListStudentsEnrolled {
450 603 constructor() {
@@ -449,12 +602,12 @@
449 602 class ListStudentsEnrolled {
450 603 constructor() {
451 604 this.instructorId = null;
452 605 this.elContainer = null;
453 - this.isRequesting = false;
454 606 }
455 607 static selectors = {
456 - elContainer: '#lp-enrolled-students',
608 + elContainer: '.lp-enrolled-students',
609 + elLayout: '.lp-students-enrolled-layout',
457 610 elForm: '.lp-enrolled-students-form',
458 611 elLPTarget: '.lp-target',
459 612 elCourseNameInput: '.lp-enrolled-filter-course-name',
460 613 elCourseIdInput: '#lp-enrolled-filter-course-id',
@@ -488,46 +641,38 @@
488 641
489 642 // Search/Clear button click.
490 643 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.eventHandlers('click', [{
491 644 selector: ListStudentsEnrolled.selectors.elBtnSearch,
492 - class: this,
493 - callBack: this.searchStudents.name
645 + callBack: this.searchStudents.bind(this)
494 646 }, {
495 647 selector: ListStudentsEnrolled.selectors.elBtnClear,
496 - class: this,
497 - callBack: this.clearFilters.name
648 + callBack: this.clearFilters.bind(this)
498 649 }]);
499 650
500 651 // Search on Enter key.
501 652 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.eventHandlers('keydown', [{
502 653 selector: ListStudentsEnrolled.selectors.elSearchInput,
503 - class: this,
504 - callBack: this.triggerBtnSearch.name,
654 + callBack: this.triggerBtnSearch.bind(this),
505 655 checkIsEventEnter: true
506 656 }, {
507 657 selector: ListStudentsEnrolled.selectors.elCourseNameInput,
508 - class: this,
509 - callBack: this.triggerBtnSearch.name,
658 + callBack: this.triggerBtnSearch.bind(this),
510 659 checkIsEventEnter: true
511 660 }, {
512 661 selector: ListStudentsEnrolled.selectors.elStartDateInput,
513 - class: this,
514 - callBack: this.triggerBtnSearch.name,
662 + callBack: this.triggerBtnSearch.bind(this),
515 663 checkIsEventEnter: true
516 664 }, {
517 665 selector: ListStudentsEnrolled.selectors.elEndDateInput,
518 - class: this,
519 - callBack: this.triggerBtnSearch.name,
666 + callBack: this.triggerBtnSearch.bind(this),
520 667 checkIsEventEnter: true
521 668 }]);
522 669 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.eventHandlers('change', [{
523 670 selector: ListStudentsEnrolled.selectors.elStartDateInput,
524 - class: this,
525 - callBack: this.checkDatesRange.name
671 + callBack: this.checkDatesRange.bind(this)
526 672 }, {
527 673 selector: ListStudentsEnrolled.selectors.elEndDateInput,
528 - class: this,
529 - callBack: this.checkDatesRange.name
674 + callBack: this.checkDatesRange.bind(this)
530 675 }]);
531 676 }
532 677
533 678 // Click button search.
@@ -577,9 +722,9 @@
577 722 if (!btn) {
578 723 return;
579 724 }
580 725 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(btn, isLoading ? 1 : 0);
581 - btn.disabled = !!isLoading;
726 + //btn.disabled = !! isLoading;
582 727 }
583 728 getAjaxHandle() {
584 729 const ajaxHandle = window.lpAJAXG;
585 730 if (!ajaxHandle || typeof ajaxHandle.getDataSetCurrent !== 'function' || typeof ajaxHandle.setDataSetCurrent !== 'function' || typeof ajaxHandle.showHideLoading !== 'function' || typeof ajaxHandle.fetchAJAX !== 'function') {
@@ -608,11 +753,11 @@
608 753 this.syncCourseIdFromName(elForm);
609 754 return lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.mergeDataWithDatForm(elForm, dataArgs);
610 755 }
611 756
612 - /**
613 - * Search students: update args.search, re-fetch.
614 - * @param args
757 + /**
758 + * Search students: update args.search, re-fetch.
759 + * @param args
615 760 */
616 761 searchStudents(args) {
617 762 const {
618 763 e
@@ -620,17 +765,14 @@
620 765 if (e) {
621 766 e.preventDefault();
622 767 }
623 768 const btn = args?.target?.closest(ListStudentsEnrolled.selectors.elBtnSearch);
624 - if (btn) {
625 - if (this.isRequesting || btn.classList.contains('loading') || btn.disabled) {
626 - return;
627 - }
628 - } else if (this.isRequesting) {
769 + if (!btn) {
629 770 return;
630 771 }
631 772 const elForm = btn.closest(ListStudentsEnrolled.selectors.elForm);
632 - const elLPTarget = this.elContainer.querySelector(ListStudentsEnrolled.selectors.elLPTarget);
773 + const elLayout = elForm.closest(ListStudentsEnrolled.selectors.elLayout);
774 + const elLPTarget = elLayout.querySelector(ListStudentsEnrolled.selectors.elLPTarget);
633 775 if (!elLPTarget || !elForm) {
634 776 return;
635 777 }
636 778 const ajaxHandle = this.getAjaxHandle();
@@ -644,11 +786,11 @@
644 786 ajaxHandle.setDataSetCurrent(elLPTarget, dataSend);
645 787 this.reloadContent(elLPTarget, dataSend, btn);
646 788 }
647 789
648 - /**
649 - * Clear all filters and reload default data.
650 - * @param args
790 + /**
791 + * Clear all filters and reload default data.
792 + * @param args
651 793 */
652 794 clearFilters(args) {
653 795 const {
654 796 e
@@ -656,17 +798,14 @@
656 798 if (e) {
657 799 e.preventDefault();
658 800 }
659 801 const btn = args?.target?.closest(ListStudentsEnrolled.selectors.elBtnClear);
660 - if (btn) {
661 - if (this.isRequesting || btn.classList.contains('loading') || btn.disabled) {
662 - return;
663 - }
664 - } else if (this.isRequesting) {
802 + if (!btn) {
665 803 return;
666 804 }
667 805 const elForm = btn.closest(ListStudentsEnrolled.selectors.elForm);
668 - const elLPTarget = this.elContainer.querySelector(ListStudentsEnrolled.selectors.elLPTarget);
806 + const elLayout = elForm.closest(ListStudentsEnrolled.selectors.elLayout);
807 + const elLPTarget = elLayout.querySelector(ListStudentsEnrolled.selectors.elLPTarget);
669 808 if (!elLPTarget || !elForm) {
670 809 return;
671 810 }
672 811 const ajaxHandle = this.getAjaxHandle();
@@ -682,22 +821,20 @@
682 821 ajaxHandle.setDataSetCurrent(elLPTarget, dataSend);
683 822 this.reloadContent(elLPTarget, dataSend, btn);
684 823 }
685 824
686 - /**
687 - * Shared reload helper: loading indicator + AJAX fetch.
688 - * @param elLPTarget
689 - * @param dataSend
690 - * @param btn
825 + /**
826 + * Shared reload helper: loading indicator + AJAX fetch.
827 + * @param elLPTarget
828 + * @param dataSend
829 + * @param btn
691 830 */
692 831 reloadContent(elLPTarget, dataSend, btn = null) {
693 832 const ajaxHandle = this.getAjaxHandle();
694 833 if (!ajaxHandle) {
695 - this.isRequesting = false;
696 834 this.setButtonLoadingState(btn, false);
697 835 return;
698 836 }
699 - this.isRequesting = true;
700 837 ajaxHandle.showHideLoading(elLPTarget, 1);
701 838 const callBack = {
702 839 success: response => {
703 840 const {
@@ -709,9 +846,8 @@
709 846 }
710 847 },
711 848 error: error => console.error(error),
712 849 completed: () => {
713 - this.isRequesting = false;
714 850 ajaxHandle.showHideLoading(elLPTarget, 0);
715 851 this.setButtonLoadingState(btn, false);
716 852 }
717 853 };