初始提交
This commit is contained in:
BIN
iap/static/description/icon.png
Normal file
BIN
iap/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 586 B |
1
iap/static/description/icon.svg
Normal file
1
iap/static/description/icon.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg width="50" height="50" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg"><path d="M0 12h50v26a4 4 0 0 1-4 4H0V12Z" fill="#03AF89"/><path d="M4 21a4 4 0 0 1-4-4v-5a4 4 0 0 1 4-4h46v9a4 4 0 0 1-4 4H4Z" fill="#FBB945"/><path d="M0 16h50v4a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4v-4Z" fill="#1A6F66"/></svg>
|
||||
|
After Width: | Height: | Size: 304 B |
BIN
iap/static/description/icon_hi.png
Normal file
BIN
iap/static/description/icon_hi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
@@ -0,0 +1,45 @@
|
||||
import { registry } from "@web/core/registry";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { standardWidgetProps } from "@web/views/widgets/standard_widget_props";
|
||||
import { Component, t, useProps } from "@odoo/owl";
|
||||
|
||||
class IAPActionButtonsWidget extends Component {
|
||||
static template = "iap.ActionButtonsWidget";
|
||||
props = useProps({
|
||||
...standardWidgetProps,
|
||||
serviceName: t.string(),
|
||||
showServiceButtons: t.boolean(),
|
||||
label: t.string().optional(),
|
||||
});
|
||||
|
||||
setup() {
|
||||
this.orm = useService("orm");
|
||||
this.action = useService("action");
|
||||
}
|
||||
|
||||
async onViewServicesClicked() {
|
||||
this.action.doAction("iap.iap_account_action");
|
||||
}
|
||||
|
||||
async onManageServiceLinkClicked() {
|
||||
const account_id = await this.orm.silent.call("iap.account", "get_account_id", [this.props.serviceName]);
|
||||
this.action.doAction({
|
||||
type: "ir.actions.act_window",
|
||||
res_model: "iap.account",
|
||||
res_id: account_id,
|
||||
views: [[false, "form"]],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const iapActionButtonsWidget = {
|
||||
component: IAPActionButtonsWidget,
|
||||
extractProps: ({ attrs }) => {
|
||||
return {
|
||||
serviceName: attrs.service_name,
|
||||
showServiceButtons: !Boolean(attrs.hide_service),
|
||||
label: attrs.label,
|
||||
};
|
||||
},
|
||||
};
|
||||
registry.category("view_widgets").add("iap_buy_more_credits", iapActionButtonsWidget);
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<template id="template" xml:space="preserve">
|
||||
|
||||
<t t-name="iap.ActionButtonsWidget">
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<button t-on-click="this.onManageServiceLinkClicked" class="btn btn-link px-0 o-hidden-ios text-nowrap"><i class="oi" data-icon="east"/> <t t-if="this.props.label" t-out="this.props.label"/><t t-else="">Manage Service & Buy Credits</t></button><br/>
|
||||
<button t-if="this.props.showServiceButtons" t-on-click="this.onViewServicesClicked" class="btn btn-link px-0 o-hidden-ios text-nowrap"><i class="oi" data-icon="east"/> View My Services</button>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</template>
|
||||
Reference in New Issue
Block a user