blob: 4fe1c28a7bab19384ca93e6ff8b1597d8c06c0e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
odoo.define('website_sale_slides.course.join.widget', function (require) {
"use strict";
var CourseJoinWidget = require('website_slides.course.join.widget').courseJoinWidget;
const wUtils = require('website.utils');
CourseJoinWidget.include({
xmlDependencies: (CourseJoinWidget.prototype.xmlDependencies || []).concat(
["/website_sale_slides/static/src/xml/slide_course_join.xml"]
),
init: function (parent, options) {
this._super.apply(this, arguments);
this.productId = options.channel.productId || false;
},
//--------------------------------------------------------------------------
// Handlers
//--------------------------------------------------------------------------
/**
* When the user joins the course, if it's set as "on payment" and the user is logged in,
* we redirect to the shop page for this course.
*
* @param {MouseEvent} ev
* @override
* @private
*/
_onClickJoin: function (ev) {
ev.preventDefault();
if (this.channel.channelEnroll === 'payment' && !this.publicUser) {
this.beforeJoin().then(function () {
wUtils.sendRequest('/shop/cart/update', {
product_id: this.productId,
express: 1,
});
});
} else {
this._super.apply(this, arguments);
}
},
});
return CourseJoinWidget;
});
|