From 30ed47d3fbf741b39e049bc6ea73780c0bc7c36e Mon Sep 17 00:00:00 2001 From: Gregor Vostrak Date: Wed, 4 Sep 2024 15:24:31 +0200 Subject: [PATCH] add trial banners and unblock member invite modal during trial --- resources/js/Components/Banner.vue | 24 +--- .../js/Components/Billing/BillingBanner.vue | 120 ++++++++++++++++++ .../Common/Member/MemberInviteModal.vue | 20 ++- resources/js/Layouts/AppLayout.vue | 2 + resources/js/utils/billing.ts | 23 ++++ 5 files changed, 166 insertions(+), 23 deletions(-) create mode 100644 resources/js/Components/Billing/BillingBanner.vue diff --git a/resources/js/Components/Banner.vue b/resources/js/Components/Banner.vue index ba88be2c..0bf1c1dd 100644 --- a/resources/js/Components/Banner.vue +++ b/resources/js/Components/Banner.vue @@ -26,22 +26,14 @@ watchEffect(async () => {
-
+ class="bg-secondary border-b border-border-secondary"> +
- + {
+
+ +
+
+ +
+ + + Your organization is currently blocked. + + + Please upgrade to a premium plan or remove all users except + the owner to unblock your organization. + +
+
+ +
+ Upgrade now +
+ + +
+
+
+
+ +
+ + + Your are currently using the Free Plan. + + To unlock all premium features & support the development of + solidtime, please upgrade your plan. +
+
+ +
+ Upgrade now +
+ + +
+
+
+ + + diff --git a/resources/js/Components/Common/Member/MemberInviteModal.vue b/resources/js/Components/Common/Member/MemberInviteModal.vue index 0dcbaefb..5e6f01eb 100644 --- a/resources/js/Components/Common/Member/MemberInviteModal.vue +++ b/resources/js/Components/Common/Member/MemberInviteModal.vue @@ -2,7 +2,7 @@ import TextInput from '@/packages/ui/src/Input/TextInput.vue'; import SecondaryButton from '@/packages/ui/src/Buttons/SecondaryButton.vue'; import DialogModal from '@/packages/ui/src/DialogModal.vue'; -import { ref } from 'vue'; +import { computed, ref } from 'vue'; import PrimaryButton from '@/packages/ui/src/Buttons/PrimaryButton.vue'; import { useFocus } from '@vueuse/core'; import InputLabel from '@/packages/ui/src/Input/InputLabel.vue'; @@ -11,7 +11,11 @@ import type { Role } from '@/types/jetstream'; import { Link, useForm } from '@inertiajs/vue3'; import { getCurrentOrganizationId } from '@/utils/useUser'; import { filterRoles } from '@/utils/roles'; -import { hasActiveSubscription, isBillingActivated } from '@/utils/billing'; +import { + hasActiveSubscription, + isBillingActivated, + isInTrial, +} from '@/utils/billing'; import { CreditCardIcon, UserGroupIcon } from '@heroicons/vue/20/solid'; import { canUpdateOrganization } from '@/utils/permissions'; import { api } from '@/packages/api/src'; @@ -80,6 +84,14 @@ async function submit() { const clientNameInput = ref(null); useFocus(clientNameInput, { initialValue: true }); + +const inviteMembersIsAllowed = computed(() => { + return ( + !isBillingActivated() || + (isBillingActivated() && hasActiveSubscription()) || + (isBillingActivated() && isInTrial()) + ); +});