feat: add FC billing banner on Desktop
This commit is contained in:
parent
9c0acda79a
commit
081908540d
1 changed files with 19 additions and 3 deletions
|
|
@ -24,6 +24,7 @@ $(document).ready(function () {
|
|||
generateTrialSubscriptionBanner(response.trial_end_date)
|
||||
);
|
||||
}
|
||||
addManageTrialBannerDesktop(response.trial_end_date);
|
||||
}
|
||||
addManageBillingDropdown();
|
||||
|
||||
|
|
@ -39,13 +40,28 @@ function setErrorMessage(message) {
|
|||
$("#fc-login-error").text(message);
|
||||
}
|
||||
|
||||
function addManageTrialBannerDesktop(trial_end_date) {
|
||||
$(document).on("desktop_screen", function (event, data) {
|
||||
const icons_container = data.desktop.wrapper.find(".icons-container").first();
|
||||
|
||||
$(".desktop-container").before(
|
||||
generateTrialSubscriptionBanner(trial_end_date).css({
|
||||
width: icons_container.width(),
|
||||
margin: "auto",
|
||||
padding: "20px 20px 0px",
|
||||
})
|
||||
);
|
||||
icons_container.css("margin-top", "40px");
|
||||
});
|
||||
}
|
||||
|
||||
function addManageBillingDropdown() {
|
||||
$(document).on("desktop_screen", function (event, data) {
|
||||
data.desktop.add_menu_item({
|
||||
label: __("Manage Billing"),
|
||||
icon: "receipt-text",
|
||||
condition: function () {
|
||||
return frappe.boot.sysdefaults.demo_company;
|
||||
return frappe.boot.is_fc_site;
|
||||
},
|
||||
onClick: function () {
|
||||
return openFrappeCloudDashboard();
|
||||
|
|
@ -65,7 +81,7 @@ function generateTrialSubscriptionBanner(trialEndDate) {
|
|||
const trial_end_string =
|
||||
trial_end_days > 1 ? `${trial_end_days} days` : `${trial_end_days} day`;
|
||||
|
||||
return $(`
|
||||
return $(`<div>
|
||||
<style>
|
||||
.trial-banner {
|
||||
display: flex;
|
||||
|
|
@ -143,5 +159,5 @@ function generateTrialSubscriptionBanner(trialEndDate) {
|
|||
: ""
|
||||
}
|
||||
</div>
|
||||
`);
|
||||
</div>`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue