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 +16 -33 4.4.7 → 4.4.10 View file →
@@ -602,12 +602,12 @@
602 602 class ListStudentsEnrolled {
603 603 constructor() {
604 604 this.instructorId = null;
605 605 this.elContainer = null;
606 - this.isRequesting = false;
607 606 }
608 607 static selectors = {
609 608 elContainer: '.lp-enrolled-students',
609 + elLayout: '.lp-students-enrolled-layout',
610 610 elForm: '.lp-enrolled-students-form',
611 611 elLPTarget: '.lp-target',
612 612 elCourseNameInput: '.lp-enrolled-filter-course-name',
613 613 elCourseIdInput: '#lp-enrolled-filter-course-id',
@@ -641,46 +641,38 @@
641 641
642 642 // Search/Clear button click.
643 643 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.eventHandlers('click', [{
644 644 selector: ListStudentsEnrolled.selectors.elBtnSearch,
645 - class: this,
646 - callBack: this.searchStudents.name
645 + callBack: this.searchStudents.bind(this)
647 646 }, {
648 647 selector: ListStudentsEnrolled.selectors.elBtnClear,
649 - class: this,
650 - callBack: this.clearFilters.name
648 + callBack: this.clearFilters.bind(this)
651 649 }]);
652 650
653 651 // Search on Enter key.
654 652 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.eventHandlers('keydown', [{
655 653 selector: ListStudentsEnrolled.selectors.elSearchInput,
656 - class: this,
657 - callBack: this.triggerBtnSearch.name,
654 + callBack: this.triggerBtnSearch.bind(this),
658 655 checkIsEventEnter: true
659 656 }, {
660 657 selector: ListStudentsEnrolled.selectors.elCourseNameInput,
661 - class: this,
662 - callBack: this.triggerBtnSearch.name,
658 + callBack: this.triggerBtnSearch.bind(this),
663 659 checkIsEventEnter: true
664 660 }, {
665 661 selector: ListStudentsEnrolled.selectors.elStartDateInput,
666 - class: this,
667 - callBack: this.triggerBtnSearch.name,
662 + callBack: this.triggerBtnSearch.bind(this),
668 663 checkIsEventEnter: true
669 664 }, {
670 665 selector: ListStudentsEnrolled.selectors.elEndDateInput,
671 - class: this,
672 - callBack: this.triggerBtnSearch.name,
666 + callBack: this.triggerBtnSearch.bind(this),
673 667 checkIsEventEnter: true
674 668 }]);
675 669 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.eventHandlers('change', [{
676 670 selector: ListStudentsEnrolled.selectors.elStartDateInput,
677 - class: this,
678 - callBack: this.checkDatesRange.name
671 + callBack: this.checkDatesRange.bind(this)
679 672 }, {
680 673 selector: ListStudentsEnrolled.selectors.elEndDateInput,
681 - class: this,
682 - callBack: this.checkDatesRange.name
674 + callBack: this.checkDatesRange.bind(this)
683 675 }]);
684 676 }
685 677
686 678 // Click button search.
@@ -730,9 +722,9 @@
730 722 if (!btn) {
731 723 return;
732 724 }
733 725 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(btn, isLoading ? 1 : 0);
734 - btn.disabled = !!isLoading;
726 + //btn.disabled = !! isLoading;
735 727 }
736 728 getAjaxHandle() {
737 729 const ajaxHandle = window.lpAJAXG;
738 730 if (!ajaxHandle || typeof ajaxHandle.getDataSetCurrent !== 'function' || typeof ajaxHandle.setDataSetCurrent !== 'function' || typeof ajaxHandle.showHideLoading !== 'function' || typeof ajaxHandle.fetchAJAX !== 'function') {
@@ -773,17 +765,14 @@
773 765 if (e) {
774 766 e.preventDefault();
775 767 }
776 768 const btn = args?.target?.closest(ListStudentsEnrolled.selectors.elBtnSearch);
777 - if (btn) {
778 - if (this.isRequesting || btn.classList.contains('loading') || btn.disabled) {
779 - return;
780 - }
781 - } else if (this.isRequesting) {
769 + if (!btn) {
782 770 return;
783 771 }
784 772 const elForm = btn.closest(ListStudentsEnrolled.selectors.elForm);
785 - const elLPTarget = this.elContainer.querySelector(ListStudentsEnrolled.selectors.elLPTarget);
773 + const elLayout = elForm.closest(ListStudentsEnrolled.selectors.elLayout);
774 + const elLPTarget = elLayout.querySelector(ListStudentsEnrolled.selectors.elLPTarget);
786 775 if (!elLPTarget || !elForm) {
787 776 return;
788 777 }
789 778 const ajaxHandle = this.getAjaxHandle();
@@ -809,17 +798,14 @@
809 798 if (e) {
810 799 e.preventDefault();
811 800 }
812 801 const btn = args?.target?.closest(ListStudentsEnrolled.selectors.elBtnClear);
813 - if (btn) {
814 - if (this.isRequesting || btn.classList.contains('loading') || btn.disabled) {
815 - return;
816 - }
817 - } else if (this.isRequesting) {
802 + if (!btn) {
818 803 return;
819 804 }
820 805 const elForm = btn.closest(ListStudentsEnrolled.selectors.elForm);
821 - const elLPTarget = this.elContainer.querySelector(ListStudentsEnrolled.selectors.elLPTarget);
806 + const elLayout = elForm.closest(ListStudentsEnrolled.selectors.elLayout);
807 + const elLPTarget = elLayout.querySelector(ListStudentsEnrolled.selectors.elLPTarget);
822 808 if (!elLPTarget || !elForm) {
823 809 return;
824 810 }
825 811 const ajaxHandle = this.getAjaxHandle();
@@ -844,13 +830,11 @@
844 830 */
845 831 reloadContent(elLPTarget, dataSend, btn = null) {
846 832 const ajaxHandle = this.getAjaxHandle();
847 833 if (!ajaxHandle) {
848 - this.isRequesting = false;
849 834 this.setButtonLoadingState(btn, false);
850 835 return;
851 836 }
852 - this.isRequesting = true;
853 837 ajaxHandle.showHideLoading(elLPTarget, 1);
854 838 const callBack = {
855 839 success: response => {
856 840 const {
@@ -862,9 +846,8 @@
862 846 }
863 847 },
864 848 error: error => console.error(error),
865 849 completed: () => {
866 - this.isRequesting = false;
867 850 ajaxHandle.showHideLoading(elLPTarget, 0);
868 851 this.setButtonLoadingState(btn, false);
869 852 }
870 853 };