Initial commit: Technical packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:51 +02:00
commit 3473fa71a0
873 changed files with 297766 additions and 0 deletions

View file

@ -0,0 +1,38 @@
/** @odoo-modules */
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
const { Component } = owl;
class IAPActionButtonsWidget extends Component {
setup() {
this.orm = useService("orm");
this.action = useService("action");
}
async onViewServicesClicked() {
const url = await this.orm.silent.call("iap.account", "get_account_url");
this.action.doAction({
type: "ir.actions.act_url",
url: url,
});
}
async onBuyLinkClicked() {
const url = await this.orm.silent.call("iap.account", "get_credits_url", [this.props.serviceName]);
this.action.doAction({
type: "ir.actions.act_url",
url: url,
});
}
}
IAPActionButtonsWidget.template = "iap.ActionButtonsWidget";
IAPActionButtonsWidget.extractProps = ({ attrs }) => {
return {
serviceName: attrs.service_name,
showServiceButtons: !Boolean(attrs.hide_service),
};
};
registry.category("view_widgets").add("iap_buy_more_credits", IAPActionButtonsWidget);

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<template id="template" xml:space="preserve">
<t t-name="iap.ActionButtonsWidget" owl="1">
<div class="mt-2 row">
<div class="col-sm">
<button t-on-click="onBuyLinkClicked" class="btn btn-link buy_credits px-0 o-hidden-ios"><i class="fa fa-arrow-right"/> Buy credits</button><br/>
<button t-if="props.showServiceButtons" t-on-click="onViewServicesClicked" class="btn btn-link px-0 o-hidden-ios"><i class="fa fa-arrow-right me-1"/> View My Services</button>
</div>
</div>
</t>
</template>