feat: show helpdesk and crm banner on sidebar

This commit is contained in:
Ejaaz Khan 2025-03-17 13:28:15 +05:30
parent 18b01453cd
commit b133c7e34d

View file

@ -42,6 +42,8 @@ frappe.views.ListSidebar = class ListSidebar {
if (frappe.user.has_role("System Manager")) {
this.add_insights_banner();
this.add_crm_banner();
this.add_helpdesk_banner();
}
}
@ -279,25 +281,12 @@ frappe.views.ListSidebar = class ListSidebar {
this.get_stats();
}
add_insights_banner() {
add_banner(message, link, cta) {
try {
if (this.list_view.view != "Report") {
return;
}
if (localStorage.getItem("show_insights_banner") == "false") {
return;
}
if (this.insights_banner) {
this.insights_banner.remove();
}
const message = __("Get more insights with");
const link = "https://frappe.io/s/insights";
const cta = "Frappe Insights";
this.insights_banner = $(`
// if (this.banner) {
// this.banner.remove();
// }
this.banner = $(`
<div class="sidebar-section">
${message} <a href="${link}" target="_blank" style="color: var(--text-color)">${cta} &rarr; </a>
</div>
@ -306,4 +295,43 @@ frappe.views.ListSidebar = class ListSidebar {
console.error(error);
}
}
add_insights_banner() {
if (this.list_view.view != "Report") {
return;
}
if (localStorage.getItem("show_insights_banner") == "false") {
return;
}
const message = __("Get more insights with");
const link = "https://frappe.io/s/insights";
const cta = "Frappe Insights";
this.add_banner(message, link, cta);
}
add_crm_banner() {
if (this.list_view.meta.module != "CRM") {
return;
}
const message = __("Switch to Frappe CRM for smarter sales");
const link =
"https://frappe.io/crm?utm_source=crm-sidebar&utm_medium=sidebar&utm_campaign=frappe-ad";
const cta = "Frappe CRM";
this.add_banner(message, link, cta);
}
add_helpdesk_banner() {
if (this.list_view.meta.module != "Support") {
return;
}
const message = __("Upgrade your support experience with Frappe Helpdesk");
const link =
"https://frappe.io/helpdesk?utm_source=support-sidebar&utm_medium=sidebar&utm_campaign=frappe-ad";
const cta = "Frappe Helpdesk";
this.add_banner(message, link, cta);
}
};