mirror of https://github.com/OCA/social.git
[17.0][IMP] connector_social_base, connector_social_linkedin, connector_social_x: Filter Ads, Charts
parent
245b6f5ede
commit
d152cedb1e
|
@ -1,9 +0,0 @@
|
|||
/** @odoo-module **/
|
||||
export {SocialNetworkImagesDialog} from "./social_network_images_dialog/social_network_images_dialog.esm";
|
||||
export {SocialNetworkAccount} from "./social_network_account/social_network_account.esm";
|
||||
export {SocialNetworkComment} from "./social_network_comment/social_network_comment.esm";
|
||||
export {SocialNetworkCommentDialog} from "./social_network_comment_dialog/social_network_comment_dialog.esm";
|
||||
export {SocialNetworkAds} from "./social_network_ads/social_network_ads.esm";
|
||||
export {SocialNetworkAdsAccount} from "./social_network_ads_account/social_network_ads_account.esm";
|
||||
export {SocialNetworkChartAccount} from "./social_network_chart_account/social_network_chart_account.esm";
|
||||
export {SocialNetworkChart} from "./social_network_chart/social_network_chart.esm";
|
|
@ -0,0 +1,10 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import {Component} from "@odoo/owl";
|
||||
|
||||
export class SocialNetworkAccount extends Component {
|
||||
static template = "connector_social_base.SocialNetworkAccount";
|
||||
static props = {
|
||||
socialAccounts: {type: Array},
|
||||
};
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
div.social-account-oca {
|
||||
> div {
|
||||
margin: 0 0 5px 0 !important;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="connector_social_base.SocialNetworkAccount">
|
||||
<div
|
||||
class="row d-flex flex-column justify-content-between flex-md-row w-100 px-4 "
|
||||
>
|
||||
<div
|
||||
class="col-12 col-md-3 shadow bg-white pt-2 cursor-pointer w-md-25 m-2 rounded "
|
||||
t-foreach="props.socialAccounts"
|
||||
t-key="social_account.id"
|
||||
t-as="social_account"
|
||||
>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="mx-1">
|
||||
<img
|
||||
class="me-2"
|
||||
height="50"
|
||||
t-attf-src="/web/image/social.network.media/{{ social_account.media_id[0] }}/image"
|
||||
alt="Social Media"
|
||||
/>
|
||||
</div>
|
||||
<span class="mx-1" t-esc="social_account.name" />
|
||||
<a
|
||||
t-if="social_account.account_url"
|
||||
t-att-href="social_account.account_url"
|
||||
target="_blank"
|
||||
>
|
||||
Go to account
|
||||
</a>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="d-flex justify-content-center">
|
||||
<i class="text-700 fa fa-eye px-1 pt-1" />
|
||||
<span
|
||||
class="fw-bold px-1"
|
||||
t-esc="social_account.impression_count"
|
||||
/>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center px-1">
|
||||
<i class="text-700 fa fa-hand-o-up px-1 pt-1" />
|
||||
<span
|
||||
class="fw-bold px-1"
|
||||
t-esc="social_account.interactions_count"
|
||||
/>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<i class="text-700 fa fa-star px-1 pt-1" />
|
||||
<span class="fw-bold px-1" t-esc="social_account.engagement" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</templates>
|
|
@ -0,0 +1,15 @@
|
|||
/** @odoo-module */
|
||||
|
||||
export const SocialNetworkMixin = (T) =>
|
||||
class extends T {
|
||||
/**
|
||||
* Validates that the start date is before or equal to the end date.
|
||||
* If the dates are invalid, it displays a notification and clears the input values.
|
||||
*/
|
||||
validateRangeDate(startDate, endDate) {
|
||||
if (startDate && endDate) {
|
||||
return startDate <= endDate;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
|
@ -0,0 +1,35 @@
|
|||
/** @odoo-module */
|
||||
import {SocialNetworkImagesDialog} from "../../components/social_network_images_dialog/social_network_images_dialog.esm";
|
||||
import {_t} from "@web/core/l10n/translation";
|
||||
|
||||
export const SocialPostAccountMixin = (T) =>
|
||||
class extends T {
|
||||
onShowMoreMessage(ev) {
|
||||
ev.stopPropagation();
|
||||
this.record.messageLength = this.record.message.raw_value.length;
|
||||
}
|
||||
|
||||
onShowAllImages(ev) {
|
||||
ev.stopPropagation();
|
||||
this.dialogService.add(SocialNetworkImagesDialog, {
|
||||
title: _t("All Images"),
|
||||
images: JSON.parse(this.record.image_urls.raw_value),
|
||||
fullscreen: true,
|
||||
});
|
||||
}
|
||||
|
||||
async onLikePost(ev) {
|
||||
ev.stopPropagation();
|
||||
const response = await this.env.model.onLikePost(this.record);
|
||||
if (response.success) {
|
||||
this.effectService.add({
|
||||
type: "rainbow_man",
|
||||
message: _t("You have liked the post."),
|
||||
imgUrl: "/connector_social_base/static/src/img/like.png",
|
||||
fadeout: "fast",
|
||||
});
|
||||
} else {
|
||||
this.notification.add(_t(response.message), {type: "info"});
|
||||
}
|
||||
}
|
||||
};
|
|
@ -1,14 +0,0 @@
|
|||
/** @odoo-module */
|
||||
|
||||
/**
|
||||
* Validate that the start date is before (or equal to) the end date.
|
||||
* @param {String} startDate - The start date in any format understood by the luxon library.
|
||||
* @param {String} endDate - The end date in any format understood by the luxon library.
|
||||
* @returns {Boolean} whether the start date is before (or equal to) the end date.
|
||||
*/
|
||||
export function validateRangeDate(startDate, endDate) {
|
||||
if (startDate && endDate) {
|
||||
return startDate <= endDate;
|
||||
}
|
||||
return true;
|
||||
}
|
Loading…
Reference in New Issue