mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-27 11:12:02 +02:00
Initial commit: Sale packages
This commit is contained in:
commit
14e3d26998
6469 changed files with 2479670 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import publicWidget from 'web.public.widget';
|
||||
import {registry} from "@web/core/registry";
|
||||
|
||||
const CouponToasterWidget = publicWidget.Widget.extend({
|
||||
start() {
|
||||
let options = {};
|
||||
const $content = this.$('.coupon-message-content');
|
||||
const $title = this.$('.coupon-message-title');
|
||||
|
||||
if ($content.length) {
|
||||
Object.assign(options, {message: $content[0].innerHTML});
|
||||
}
|
||||
if ($title.length) {
|
||||
Object.assign(options, {title: $title[0].innerHTML});
|
||||
}
|
||||
|
||||
if (this.$el.hasClass('coupon-info-message')) {
|
||||
this.displayNotification(Object.assign({type: 'success'}, options));
|
||||
} else if (this.$el.hasClass('coupon-error-message')) {
|
||||
this.displayNotification(Object.assign({type: 'danger'}, options));
|
||||
} else if (this.$el.hasClass('coupon-warning-message')) {
|
||||
this.displayNotification(Object.assign({type: 'warning'}, options));
|
||||
}
|
||||
|
||||
return this._super(...arguments);
|
||||
},
|
||||
});
|
||||
|
||||
registry.category("public_root_widgets").add("CouponToasterWidget", {
|
||||
Widget: CouponToasterWidget,
|
||||
selector: '.coupon-message',
|
||||
});
|
||||
|
||||
export default CouponToasterWidget;
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import publicWidget from 'web.public.widget';
|
||||
|
||||
publicWidget.registry.WebsiteSaleGiftCardCopy = publicWidget.Widget.extend({
|
||||
selector: '.o_purchased_gift_card',
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
start: function () {
|
||||
new ClipboardJS(this.$el.find('.copy-to-clipboard')[0]);
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue