PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
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 4.1.7.3.1 4.1.7.3.2 All 140 releases
learnpress / assets / js / dist / admin / editor / course.js

course.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.9, at assets/js/dist/admin/editor/course.js

1,014 lines 34.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /******/ (() => { // webpackBootstrap
2 /******/ "use strict";
3 /******/ var __webpack_modules__ = ({
4
5 /***/ "./assets/src/apps/js/admin/editor/actions/course-section.js":
6 /*!*******************************************************************!*\
7 !*** ./assets/src/apps/js/admin/editor/actions/course-section.js ***!
8 \*******************************************************************/
9 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10
11 __webpack_require__.r(__webpack_exports__);
12 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
14 /* harmony export */ });
15 const $ = window.jQuery || jQuery;
16 const CourseCurriculum = {
17 toggleAllSections(context) {
18 const hidden = context.getters.isHiddenAllSections;
19 if (hidden) {
20 context.commit('OPEN_ALL_SECTIONS');
21 } else {
22 context.commit('CLOSE_ALL_SECTIONS');
23 }
24 LP.Request({
25 type: 'hidden-sections',
26 hidden: context.getters.hiddenSections
27 });
28 },
29 updateSectionsOrder(context, order) {
30 LP.Request({
31 type: 'sort-sections',
32 order: JSON.stringify(order)
33 }).then(function (response) {
34 const result = response.body;
35 const order_sections = result.data;
36 context.commit('SORT_SECTION', order_sections);
37 }, function (error) {
38 console.error(error);
39 });
40 },
41 toggleSection(context, section) {
42 if (section.open) {
43 context.commit('CLOSE_SECTION', section);
44 } else {
45 context.commit('OPEN_SECTION', section);
46 }
47 LP.Request({
48 type: 'hidden-sections',
49 hidden: context.getters.hiddenSections
50 });
51 },
52 updateSection(context, section) {
53 context.commit('UPDATE_SECTION_REQUEST', section.id);
54 LP.Request({
55 type: 'update-section',
56 section: JSON.stringify(section)
57 }).then(function () {
58 context.commit('UPDATE_SECTION_SUCCESS', section.id);
59 }).catch(function () {
60 context.commit('UPDATE_SECTION_FAILURE', section.id);
61 });
62 },
63 removeSection(context, payload) {
64 context.commit('REMOVE_SECTION', payload.index);
65 LP.Request({
66 type: 'remove-section',
67 section_id: payload.section.id
68 }).then(function (response) {
69 const result = response.body;
70 }, function (error) {
71 console.error(error);
72 });
73 },
74 newSection(context, name) {
75 const newSection = {
76 type: 'new-section',
77 section_name: name,
78 temp_id: LP.uniqueId()
79 };
80 context.commit('ADD_NEW_SECTION', {
81 id: newSection.temp_id,
82 items: [],
83 open: false,
84 title: newSection.section_name
85 });
86 LP.Request(newSection).then(function (response) {
87 const result = response.body;
88 if (result.success) {
89 const section = $.extend({}, result.data, {
90 open: true
91 });
92 context.commit('ADD_NEW_SECTION', section);
93 }
94 }, function (error) {
95 console.error(error);
96 });
97 },
98 updateSectionItem(context, payload) {
99 context.commit('UPDATE_SECTION_ITEM_REQUEST', payload.item.id);
100 LP.Request({
101 type: 'update-section-item',
102 section_id: payload.section_id,
103 item: JSON.stringify(payload.item)
104 }).then(function (response) {
105 context.commit('UPDATE_SECTION_ITEM_SUCCESS', payload.item.id);
106 const result = response.body;
107 if (result.success) {
108 const item = result.data;
109 context.commit('UPDATE_SECTION_ITEM', {
110 section_id: payload.section_id,
111 item
112 });
113 }
114 }, function (error) {
115 context.commit('UPDATE_SECTION_ITEM_FAILURE', payload.item.id);
116 console.error(error);
117 });
118 },
119 removeSectionItem(context, payload) {
120 const id = payload.item.id;
121 context.commit('REMOVE_SECTION_ITEM', payload);
122 payload.item.temp_id = 0;
123 LP.Request({
124 type: 'remove-section-item',
125 section_id: payload.section_id,
126 item_id: id
127 }).then(function (rs) {
128 const {
129 data,
130 success
131 } = rs.body;
132 if (success) {
133 context.commit('REMOVE_SECTION_ITEM', payload);
134 } else {
135 alert(data);
136 payload.oldId = id;
137 context.commit('REMOVE_SECTION_ITEM', payload);
138 }
139 context.commit('REMOVE_SECTION_ITEM', payload);
140 });
141 },
142 deleteSectionItem(context, payload) {
143 const id = payload.item.id;
144 context.commit('REMOVE_SECTION_ITEM', payload);
145 payload.item.temp_id = 0;
146 LP.Request({
147 type: 'delete-section-item',
148 section_id: payload.section_id,
149 item_id: id
150 }).then(function (rs) {
151 const {
152 data,
153 success
154 } = rs.body;
155 if (success) {
156 context.commit('REMOVE_SECTION_ITEM', payload);
157 } else {
158 alert(data);
159 payload.oldId = id;
160 context.commit('REMOVE_SECTION_ITEM', payload);
161 }
162 });
163 },
164 newSectionItem(context, payload) {
165 context.commit('APPEND_EMPTY_ITEM_TO_SECTION', payload);
166 //context.commit('UPDATE_SECTION_ITEMS', {section_id: payload.section_id, items: result.data});
167 LP.Request({
168 type: 'new-section-item',
169 section_id: payload.section_id,
170 item: JSON.stringify(payload.item)
171 }).then(function (response) {
172 const result = response.body;
173 if (result.success) {
174 // context.commit('UPDATE_SECTION_ITEMS', {section_id: payload.section_id, items: result.data});
175 const items = {};
176 $.each(result.data, function (i, a) {
177 items[a.old_id ? a.old_id : a.id] = a;
178 });
179 context.commit('UPDATE_ITEM_SECTION_BY_ID', {
180 section_id: payload.section_id,
181 items
182 });
183 }
184 }, function (error) {
185 console.error(error);
186 });
187 },
188 updateSectionItems({
189 state
190 }, payload) {
191 LP.Request({
192 type: 'update-section-items',
193 section_id: payload.section_id,
194 items: JSON.stringify(payload.items),
195 last_section: state.sections[state.sections.length - 1] === payload.section_id
196 }).then(function (response) {
197 const result = response.body;
198 if (result.success) {
199 // console.log(result);
200 }
201 }, function (error) {
202 console.error(error);
203 });
204 }
205 };
206 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CourseCurriculum);
207
208 /***/ }),
209
210 /***/ "./assets/src/apps/js/admin/editor/actions/course.js":
211 /*!***********************************************************!*\
212 !*** ./assets/src/apps/js/admin/editor/actions/course.js ***!
213 \***********************************************************/
214 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
215
216 __webpack_require__.r(__webpack_exports__);
217 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
218 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
219 /* harmony export */ });
220 const Course = {
221 heartbeat: function (context) {
222 LP.Request({
223 type: 'heartbeat'
224 }).then(function (response) {
225 var result = response.body;
226 context.commit('UPDATE_HEART_BEAT', !!result.success);
227 }, function (error) {
228 context.commit('UPDATE_HEART_BEAT', false);
229 });
230 },
231 draftCourse: function (context, payload) {
232 var auto_draft = context.getters.autoDraft;
233 if (auto_draft) {
234 LP.Request({
235 type: 'draft-course',
236 course: JSON.stringify(payload)
237 }).then(function (response) {
238 var result = response.body;
239 if (!result.success) {
240 return;
241 }
242 context.commit('UPDATE_AUTO_DRAFT_STATUS', false);
243 });
244 }
245 },
246 newRequest: function (context) {
247 context.commit('INCREASE_NUMBER_REQUEST');
248 context.commit('UPDATE_STATUS', 'loading');
249 window.onbeforeunload = function () {
250 return '';
251 };
252 },
253 requestCompleted: function (context, status) {
254 context.commit('DECREASE_NUMBER_REQUEST');
255 if (context.getters.currentRequest === 0) {
256 context.commit('UPDATE_STATUS', status);
257 window.onbeforeunload = null;
258 }
259 }
260 };
261 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Course);
262
263 /***/ }),
264
265 /***/ "./assets/src/apps/js/admin/editor/actions/modal-course-items.js":
266 /*!***********************************************************************!*\
267 !*** ./assets/src/apps/js/admin/editor/actions/modal-course-items.js ***!
268 \***********************************************************************/
269 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
270
271 __webpack_require__.r(__webpack_exports__);
272 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
273 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
274 /* harmony export */ });
275 const ModalCourseItems = {
276 toggle: function (context) {
277 context.commit('TOGGLE');
278 },
279 open: function (context, sectionId) {
280 context.commit('SET_SECTION', sectionId);
281 context.commit('RESET');
282 context.commit('TOGGLE');
283 },
284 searchItems: function (context, payload) {
285 context.commit('SEARCH_ITEMS_REQUEST');
286 LP.Request({
287 type: 'search-items',
288 query: payload.query,
289 item_type: payload.type,
290 page: payload.page,
291 exclude: JSON.stringify([])
292 }).then(function (response) {
293 var result = response.body;
294 if (!result.success) {
295 return;
296 }
297 var data = result.data;
298 context.commit('SET_LIST_ITEMS', data.items);
299 context.commit('UPDATE_PAGINATION', data.pagination);
300 context.commit('SEARCH_ITEMS_SUCCESS');
301 }, function (error) {
302 context.commit('SEARCH_ITEMS_FAILURE');
303 console.error(error);
304 });
305 },
306 addItem: function (context, item) {
307 context.commit('ADD_ITEM', item);
308 },
309 removeItem: function (context, index) {
310 context.commit('REMOVE_ADDED_ITEM', index);
311 },
312 addItemsToSection: function (context) {
313 var items = context.getters.addedItems;
314 if (items.length > 0) {
315 LP.Request({
316 type: 'add-items-to-section',
317 section_id: context.getters.section,
318 items: JSON.stringify(items)
319 }).then(function (response) {
320 var result = response.body;
321 if (result.success) {
322 context.commit('TOGGLE');
323 var items = result.data;
324 context.commit('ss/UPDATE_SECTION_ITEMS', {
325 section_id: context.getters.section,
326 items: items
327 }, {
328 root: true
329 });
330 }
331 }, function (error) {
332 console.error(error);
333 });
334 }
335 }
336 };
337 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ModalCourseItems);
338
339 /***/ }),
340
341 /***/ "./assets/src/apps/js/admin/editor/getters/course-section.js":
342 /*!*******************************************************************!*\
343 !*** ./assets/src/apps/js/admin/editor/getters/course-section.js ***!
344 \*******************************************************************/
345 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
346
347 __webpack_require__.r(__webpack_exports__);
348 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
349 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
350 /* harmony export */ });
351 const CourseCurriculum = {
352 sections: function (state) {
353 return state.sections || [];
354 },
355 urlEdit: function (state) {
356 return state.urlEdit;
357 },
358 hiddenSections: function (state) {
359 return state.sections.filter(function (section) {
360 return !section.open;
361 }).map(function (section) {
362 return parseInt(section.id);
363 });
364 },
365 isHiddenAllSections: function (state, getters) {
366 var sections = getters.sections;
367 var hiddenSections = getters.hiddenSections;
368 return hiddenSections.length === sections.length;
369 },
370 statusUpdateSection: function (state) {
371 return state.statusUpdateSection;
372 },
373 statusUpdateSectionItem: function (state) {
374 return state.statusUpdateSectionItem;
375 }
376 };
377 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CourseCurriculum);
378
379 /***/ }),
380
381 /***/ "./assets/src/apps/js/admin/editor/getters/course.js":
382 /*!***********************************************************!*\
383 !*** ./assets/src/apps/js/admin/editor/getters/course.js ***!
384 \***********************************************************/
385 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
386
387 __webpack_require__.r(__webpack_exports__);
388 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
389 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
390 /* harmony export */ });
391 const Course = {
392 heartbeat: function (state) {
393 return state.heartbeat;
394 },
395 action: function (state) {
396 return state.action;
397 },
398 id: function (state) {
399 return state.course_id;
400 },
401 autoDraft: function (state) {
402 return state.auto_draft;
403 },
404 disable_curriculum: function (state) {
405 return state.disable_curriculum;
406 },
407 status: function (state) {
408 return state.status || 'error';
409 },
410 currentRequest: function (state) {
411 return state.countCurrentRequest || 0;
412 },
413 urlAjax: function (state) {
414 return state.ajax;
415 },
416 nonce: function (state) {
417 return state.nonce;
418 }
419 };
420 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Course);
421
422 /***/ }),
423
424 /***/ "./assets/src/apps/js/admin/editor/getters/modal-course-items.js":
425 /*!***********************************************************************!*\
426 !*** ./assets/src/apps/js/admin/editor/getters/modal-course-items.js ***!
427 \***********************************************************************/
428 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
429
430 __webpack_require__.r(__webpack_exports__);
431 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
432 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
433 /* harmony export */ });
434 const Getters = {
435 status: function (state) {
436 return state.status;
437 },
438 pagination: function (state) {
439 return state.pagination;
440 },
441 items: function (state, _getters) {
442 return state.items.map(function (item) {
443 var find = _getters.addedItems.find(function (_item) {
444 return item.id === _item.id;
445 });
446 item.added = !!find;
447 return item;
448 });
449 },
450 addedItems: function (state) {
451 return state.addedItems;
452 },
453 isOpen: function (state) {
454 return state.open;
455 },
456 types: function (state) {
457 return state.types;
458 },
459 section: function (state) {
460 return state.sectionId;
461 }
462 };
463 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Getters);
464
465 /***/ }),
466
467 /***/ "./assets/src/apps/js/admin/editor/http.js":
468 /*!*************************************************!*\
469 !*** ./assets/src/apps/js/admin/editor/http.js ***!
470 \*************************************************/
471 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
472
473 __webpack_require__.r(__webpack_exports__);
474 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
475 /* harmony export */ "default": () => (/* binding */ HTTP)
476 /* harmony export */ });
477 function HTTP(options) {
478 const $ = window.jQuery || jQuery;
479 const $VueHTTP = Vue.http;
480 options = $.extend({
481 ns: 'LPRequest',
482 store: false
483 }, options || {});
484 let $publishingAction = null;
485 LP.Request = function (payload) {
486 $publishingAction = $('#publishing-action');
487 payload.id = options.store.getters.id;
488 payload.nonce = options.store.getters.nonce;
489 payload['lp-ajax'] = options.store.getters.action;
490 //payload.code = options.store.getters.code;
491
492 $publishingAction.find('#publish').addClass('disabled');
493 $publishingAction.find('.spinner').addClass('is-active');
494 $publishingAction.addClass('code-' + payload.code);
495 return $VueHTTP.post(options.store.getters.urlAjax, payload, {
496 emulateJSON: true,
497 params: {
498 namespace: options.ns,
499 code: payload.code
500 }
501 });
502 };
503 $VueHTTP.interceptors.push(function (request, next) {
504 if (request.params.namespace !== options.ns) {
505 next();
506 return;
507 }
508 options.store.dispatch('newRequest');
509 next(function (response) {
510 if (!jQuery.isPlainObject(response.body)) {
511 response.body = LP.parseJSON(response.body);
512 }
513 const body = response.body;
514 const result = body.success || false;
515 if (result) {
516 options.store.dispatch('requestCompleted', 'successful');
517 } else {
518 options.store.dispatch('requestCompleted', 'failed');
519 }
520 $publishingAction.removeClass('code-' + request.params.code);
521 if (!$publishingAction.attr('class')) {
522 $publishingAction.find('#publish').removeClass('disabled');
523 $publishingAction.find('.spinner').removeClass('is-active');
524 }
525 });
526 });
527 }
528
529 /***/ }),
530
531 /***/ "./assets/src/apps/js/admin/editor/mutations/course-section.js":
532 /*!*********************************************************************!*\
533 !*** ./assets/src/apps/js/admin/editor/mutations/course-section.js ***!
534 \*********************************************************************/
535 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
536
537 __webpack_require__.r(__webpack_exports__);
538 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
539 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
540 /* harmony export */ });
541 const CourseCurriculum = {
542 SORT_SECTION(state, orders) {
543 state.sections = state.sections.map(function (section) {
544 section.order = orders[section.id];
545 return section;
546 });
547 },
548 SET_SECTIONS(state, sections) {
549 state.sections = sections;
550 },
551 ADD_NEW_SECTION(state, newSection) {
552 if (newSection.open === undefined) {
553 newSection.open = true;
554 }
555 let pos;
556 if (newSection.temp_id) {
557 state.sections.map(function (section, i) {
558 if (newSection.temp_id == section.id) {
559 pos = i;
560 return false;
561 }
562 });
563 }
564 if (pos !== undefined) {
565 $Vue.set(state.sections, pos, newSection);
566 } else {
567 state.sections.push(newSection);
568 }
569 },
570 ADD_EMPTY_SECTION(state, section) {
571 section.open = true;
572 state.sections.push(section);
573 },
574 REMOVE_SECTION(state, index) {
575 state.sections.splice(index, 1);
576 },
577 REMOVE_SECTION_ITEM(state, payload) {
578 const section = state.sections.find(function (section) {
579 return section.id === payload.section_id;
580 });
581 let items = section.items || [],
582 item = payload.item,
583 index = -1;
584 items.forEach(function (it, i) {
585 if (it.id === item.id) {
586 index = i;
587 }
588 });
589 if (index !== -1) {
590 if (payload.oldId !== undefined) {
591 items[index].id = payload.oldId;
592 return;
593 }
594 if (item.temp_id) {
595 items[index].id = item.temp_id;
596 } else {
597 items.splice(index, 1);
598 }
599 }
600 },
601 UPDATE_SECTION_ITEMS(state, payload) {
602 const section = state.sections.find(function (section) {
603 return parseInt(section.id) === parseInt(payload.section_id);
604 });
605 if (!section) {
606 return;
607 }
608 section.items = payload.items;
609 },
610 UPDATE_SECTION_ITEM(state, payload) {},
611 CLOSE_SECTION(state, section) {
612 state.sections.forEach(function (_section, index) {
613 if (section.id === _section.id) {
614 state.sections[index].open = false;
615 }
616 });
617 },
618 OPEN_SECTION(state, section) {
619 state.sections.forEach(function (_section, index) {
620 if (section.id === _section.id) {
621 state.sections[index].open = true;
622 }
623 });
624 },
625 OPEN_ALL_SECTIONS(state) {
626 state.sections = state.sections.map(function (_section) {
627 _section.open = true;
628 return _section;
629 });
630 },
631 CLOSE_ALL_SECTIONS(state) {
632 state.sections = state.sections.map(function (_section) {
633 _section.open = false;
634 return _section;
635 });
636 },
637 UPDATE_SECTION_REQUEST(state, sectionId) {
638 $Vue.set(state.statusUpdateSection, sectionId, 'updating');
639 },
640 UPDATE_SECTION_SUCCESS(state, sectionId) {
641 $Vue.set(state.statusUpdateSection, sectionId, 'successful');
642 },
643 UPDATE_SECTION_FAILURE(state, sectionId) {
644 $Vue.set(state.statusUpdateSection, sectionId, 'failed');
645 },
646 UPDATE_SECTION_ITEM_REQUEST(state, itemId) {
647 $Vue.set(state.statusUpdateSectionItem, itemId, 'updating');
648 },
649 UPDATE_SECTION_ITEM_SUCCESS(state, itemId) {
650 $Vue.set(state.statusUpdateSectionItem, itemId, 'successful');
651 },
652 UPDATE_SECTION_ITEM_FAILURE(state, itemId) {
653 $Vue.set(state.statusUpdateSectionItem, itemId, 'failed');
654 },
655 APPEND_EMPTY_ITEM_TO_SECTION(state, data) {
656 const section = state.sections.find(function (section) {
657 return parseInt(section.id) === parseInt(data.section_id);
658 });
659 if (!section) {
660 return;
661 }
662 section.items.push({
663 id: data.item.id,
664 title: data.item.title,
665 type: 'empty-item'
666 });
667 },
668 UPDATE_ITEM_SECTION_BY_ID(state, data) {
669 const section = state.sections.find(function (section) {
670 return parseInt(section.id) === parseInt(data.section_id);
671 });
672 if (!section) {
673 return;
674 }
675 for (let i = 0; i < section.items.length; i++) {
676 try {
677 if (!section.items[i]) {
678 continue;
679 }
680 const item_id = section.items[i].id;
681 if (item_id) {
682 if (data.items[item_id]) {
683 $Vue.set(section.items, i, data.items[item_id]);
684 }
685 }
686 } catch (ex) {
687 console.log(ex);
688 }
689 }
690
691 //section.items.push({id: data.item.id, title: data.item.title, type: 'empty-item'});
692 }
693 };
694 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CourseCurriculum);
695
696 /***/ }),
697
698 /***/ "./assets/src/apps/js/admin/editor/mutations/course.js":
699 /*!*************************************************************!*\
700 !*** ./assets/src/apps/js/admin/editor/mutations/course.js ***!
701 \*************************************************************/
702 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
703
704 __webpack_require__.r(__webpack_exports__);
705 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
706 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
707 /* harmony export */ });
708 const Course = {
709 UPDATE_HEART_BEAT: function (state, status) {
710 state.heartbeat = !!status;
711 },
712 UPDATE_AUTO_DRAFT_STATUS: function (state, status) {
713 state.auto_draft = status;
714 },
715 UPDATE_STATUS: function (state, status) {
716 state.status = status;
717 },
718 INCREASE_NUMBER_REQUEST: function (state) {
719 state.countCurrentRequest++;
720 },
721 DECREASE_NUMBER_REQUEST: function (state) {
722 state.countCurrentRequest--;
723 }
724 };
725 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Course);
726
727 /***/ }),
728
729 /***/ "./assets/src/apps/js/admin/editor/mutations/modal-course-items.js":
730 /*!*************************************************************************!*\
731 !*** ./assets/src/apps/js/admin/editor/mutations/modal-course-items.js ***!
732 \*************************************************************************/
733 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
734
735 __webpack_require__.r(__webpack_exports__);
736 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
737 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
738 /* harmony export */ });
739 const Mutations = {
740 TOGGLE: function (state) {
741 state.open = !state.open;
742 },
743 SET_SECTION: function (state, sectionId) {
744 state.sectionId = sectionId;
745 },
746 SET_LIST_ITEMS: function (state, items) {
747 state.items = items;
748 },
749 ADD_ITEM: function (state, item) {
750 state.addedItems.push(item);
751 },
752 REMOVE_ADDED_ITEM: function (state, item) {
753 state.addedItems.forEach(function (_item, index) {
754 if (_item.id === item.id) {
755 state.addedItems.splice(index, 1);
756 }
757 });
758 },
759 RESET: function (state) {
760 state.addedItems = [];
761 state.items = [];
762 },
763 UPDATE_PAGINATION: function (state, pagination) {
764 state.pagination = pagination;
765 },
766 SEARCH_ITEMS_REQUEST: function (state) {
767 state.status = 'loading';
768 },
769 SEARCH_ITEMS_SUCCESS: function (state) {
770 state.status = 'successful';
771 },
772 SEARCH_ITEMS_FAILURE: function (state) {
773 state.status = 'failed';
774 }
775 };
776 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Mutations);
777
778 /***/ }),
779
780 /***/ "./assets/src/apps/js/admin/editor/store/course-section.js":
781 /*!*****************************************************************!*\
782 !*** ./assets/src/apps/js/admin/editor/store/course-section.js ***!
783 \*****************************************************************/
784 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
785
786 __webpack_require__.r(__webpack_exports__);
787 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
788 /* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)
789 /* harmony export */ });
790 /* harmony import */ var _actions_course_section__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../actions/course-section */ "./assets/src/apps/js/admin/editor/actions/course-section.js");
791 /* harmony import */ var _mutations_course_section__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/course-section */ "./assets/src/apps/js/admin/editor/mutations/course-section.js");
792 /* harmony import */ var _getters_course_section__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../getters/course-section */ "./assets/src/apps/js/admin/editor/getters/course-section.js");
793
794
795
796 const $ = window.jQuery;
797 /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(data) {
798 var state = $.extend({}, data.sections);
799 state.statusUpdateSection = {};
800 state.statusUpdateSectionItem = {};
801 state.sections = state.sections.map(function (section) {
802 var hiddenSections = state.hidden_sections;
803 var find = hiddenSections.find(function (sectionId) {
804 return parseInt(section.id) === parseInt(sectionId);
805 });
806 section.open = !find;
807 return section;
808 });
809 return {
810 namespaced: true,
811 state: state,
812 getters: _getters_course_section__WEBPACK_IMPORTED_MODULE_2__["default"],
813 mutations: _mutations_course_section__WEBPACK_IMPORTED_MODULE_1__["default"],
814 actions: _actions_course_section__WEBPACK_IMPORTED_MODULE_0__["default"]
815 };
816 }
817
818 /***/ }),
819
820 /***/ "./assets/src/apps/js/admin/editor/store/course.js":
821 /*!*********************************************************!*\
822 !*** ./assets/src/apps/js/admin/editor/store/course.js ***!
823 \*********************************************************/
824 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
825
826 __webpack_require__.r(__webpack_exports__);
827 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
828 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
829 /* harmony export */ });
830 /* harmony import */ var _store_modal_course_items__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/modal-course-items */ "./assets/src/apps/js/admin/editor/store/modal-course-items.js");
831 /* harmony import */ var _store_course_section__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../store/course-section */ "./assets/src/apps/js/admin/editor/store/course-section.js");
832 /* harmony import */ var _store_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../store/i18n */ "./assets/src/apps/js/admin/editor/store/i18n.js");
833 /* harmony import */ var _getters_course__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../getters/course */ "./assets/src/apps/js/admin/editor/getters/course.js");
834 /* harmony import */ var _mutations_course__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../mutations/course */ "./assets/src/apps/js/admin/editor/mutations/course.js");
835 /* harmony import */ var _actions_course__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../actions/course */ "./assets/src/apps/js/admin/editor/actions/course.js");
836
837
838
839
840
841
842 const $ = window.jQuery;
843 const Course = function Course(data) {
844 var state = $.extend({}, data.root);
845 state.status = 'success';
846 state.heartbeat = true;
847 state.countCurrentRequest = 0;
848 return {
849 state: state,
850 getters: _getters_course__WEBPACK_IMPORTED_MODULE_3__["default"],
851 mutations: _mutations_course__WEBPACK_IMPORTED_MODULE_4__["default"],
852 actions: _actions_course__WEBPACK_IMPORTED_MODULE_5__["default"],
853 modules: {
854 ci: (0,_store_modal_course_items__WEBPACK_IMPORTED_MODULE_0__["default"])(data),
855 i18n: (0,_store_i18n__WEBPACK_IMPORTED_MODULE_2__["default"])(data.i18n),
856 ss: (0,_store_course_section__WEBPACK_IMPORTED_MODULE_1__["default"])(data)
857 }
858 };
859 };
860 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Course);
861
862 /***/ }),
863
864 /***/ "./assets/src/apps/js/admin/editor/store/i18n.js":
865 /*!*******************************************************!*\
866 !*** ./assets/src/apps/js/admin/editor/store/i18n.js ***!
867 \*******************************************************/
868 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
869
870 __webpack_require__.r(__webpack_exports__);
871 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
872 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
873 /* harmony export */ });
874 const $ = window.jQuery || jQuery;
875 const i18n = function i18n(i18n) {
876 const state = $.extend({}, i18n);
877 const getters = {
878 all: function (state) {
879 return state;
880 }
881 };
882 return {
883 namespaced: true,
884 state: state,
885 getters: getters
886 };
887 };
888 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (i18n);
889
890 /***/ }),
891
892 /***/ "./assets/src/apps/js/admin/editor/store/modal-course-items.js":
893 /*!*********************************************************************!*\
894 !*** ./assets/src/apps/js/admin/editor/store/modal-course-items.js ***!
895 \*********************************************************************/
896 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
897
898 __webpack_require__.r(__webpack_exports__);
899 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
900 /* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)
901 /* harmony export */ });
902 /* harmony import */ var _getters_modal_course_items__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getters/modal-course-items */ "./assets/src/apps/js/admin/editor/getters/modal-course-items.js");
903 /* harmony import */ var _mutations_modal_course_items__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/modal-course-items */ "./assets/src/apps/js/admin/editor/mutations/modal-course-items.js");
904 /* harmony import */ var _actions_modal_course_items__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/modal-course-items */ "./assets/src/apps/js/admin/editor/actions/modal-course-items.js");
905
906
907
908 const $ = window.jQuery || jQuery;
909 /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(data) {
910 var state = $.extend({}, data.chooseItems);
911 state.sectionId = false;
912 state.pagination = '';
913 state.status = '';
914 return {
915 namespaced: true,
916 state: state,
917 getters: _getters_modal_course_items__WEBPACK_IMPORTED_MODULE_0__["default"],
918 mutations: _mutations_modal_course_items__WEBPACK_IMPORTED_MODULE_1__["default"],
919 actions: _actions_modal_course_items__WEBPACK_IMPORTED_MODULE_2__["default"]
920 };
921 }
922
923 /***/ })
924
925 /******/ });
926 /************************************************************************/
927 /******/ // The module cache
928 /******/ var __webpack_module_cache__ = {};
929 /******/
930 /******/ // The require function
931 /******/ function __webpack_require__(moduleId) {
932 /******/ // Check if module is in cache
933 /******/ var cachedModule = __webpack_module_cache__[moduleId];
934 /******/ if (cachedModule !== undefined) {
935 /******/ return cachedModule.exports;
936 /******/ }
937 /******/ // Create a new module (and put it into the cache)
938 /******/ var module = __webpack_module_cache__[moduleId] = {
939 /******/ // no module.id needed
940 /******/ // no module.loaded needed
941 /******/ exports: {}
942 /******/ };
943 /******/
944 /******/ // Execute the module function
945 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
946 /******/
947 /******/ // Return the exports of the module
948 /******/ return module.exports;
949 /******/ }
950 /******/
951 /************************************************************************/
952 /******/ /* webpack/runtime/define property getters */
953 /******/ (() => {
954 /******/ // define getter functions for harmony exports
955 /******/ __webpack_require__.d = (exports, definition) => {
956 /******/ for(var key in definition) {
957 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
958 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
959 /******/ }
960 /******/ }
961 /******/ };
962 /******/ })();
963 /******/
964 /******/ /* webpack/runtime/hasOwnProperty shorthand */
965 /******/ (() => {
966 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
967 /******/ })();
968 /******/
969 /******/ /* webpack/runtime/make namespace object */
970 /******/ (() => {
971 /******/ // define __esModule on exports
972 /******/ __webpack_require__.r = (exports) => {
973 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
974 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
975 /******/ }
976 /******/ Object.defineProperty(exports, '__esModule', { value: true });
977 /******/ };
978 /******/ })();
979 /******/
980 /************************************************************************/
981 var __webpack_exports__ = {};
982 /*!***************************************************!*\
983 !*** ./assets/src/apps/js/admin/editor/course.js ***!
984 \***************************************************/
985 __webpack_require__.r(__webpack_exports__);
986 /* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./http */ "./assets/src/apps/js/admin/editor/http.js");
987 /* harmony import */ var _store_course__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./store/course */ "./assets/src/apps/js/admin/editor/store/course.js");
988
989
990 window.$Vue = window.$Vue || Vue;
991 window.$Vuex = window.$Vuex || Vuex;
992 const $ = window.jQuery;
993
994 /**
995 * Init app.
996 *
997 * @since 3.0.0
998 */
999 $(document).ready(function () {
1000 window.LP_Curriculum_Store = new $Vuex.Store((0,_store_course__WEBPACK_IMPORTED_MODULE_1__["default"])(lpAdminCourseEditorSettings));
1001 (0,_http__WEBPACK_IMPORTED_MODULE_0__["default"])({
1002 ns: 'LPCurriculumRequest',
1003 store: LP_Curriculum_Store
1004 });
1005 setTimeout(() => {
1006 window.LP_Course_Editor = new $Vue({
1007 el: '#admin-editor-lp_course',
1008 template: '<lp-course-editor></lp-course-editor>'
1009 });
1010 }, 100);
1011 });
1012 /******/ })()
1013 ;
1014 //# sourceMappingURL=course.js.map