mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-11 01:32:16 +01:00
only show invoicing tab when module is activated
This commit is contained in:
@@ -40,6 +40,7 @@ class HandleInertiaRequests extends Middleware
|
||||
public function share(Request $request): array
|
||||
{
|
||||
$hasBilling = Module::has('Billing') && Module::isEnabled('Billing');
|
||||
$hasInvoicing = Module::has('Invoicing') && Module::isEnabled('Invoicing');
|
||||
|
||||
/** @var BillingContract $billing */
|
||||
$billing = app(BillingContract::class);
|
||||
@@ -48,6 +49,7 @@ class HandleInertiaRequests extends Middleware
|
||||
|
||||
return array_merge(parent::share($request), [
|
||||
'has_billing_extension' => $hasBilling,
|
||||
'has_invoicing_extension' => $hasInvoicing,
|
||||
'billing' => $billing !== null && $currentOrganization !== null ? [
|
||||
'has_subscription' => $billing->hasSubscription($currentOrganization),
|
||||
'has_trial' => $billing->hasTrial($currentOrganization),
|
||||
|
||||
@@ -26,12 +26,12 @@ import { initializeStores, refreshStores } from '@/utils/init';
|
||||
import {
|
||||
canManageBilling,
|
||||
canUpdateOrganization,
|
||||
canViewClients,
|
||||
canViewClients, canViewInvoices,
|
||||
canViewMembers,
|
||||
canViewProjects, canViewReport,
|
||||
canViewTags,
|
||||
} from '@/utils/permissions';
|
||||
import { isBillingActivated } from '@/utils/billing';
|
||||
import {isBillingActivated, isInvoicingActivated} from '@/utils/billing';
|
||||
import type { User } from '@/types/models';
|
||||
import { ArrowsRightLeftIcon } from '@heroicons/vue/16/solid';
|
||||
import { fetchToken, isTokenValid } from '@/utils/session';
|
||||
@@ -188,6 +188,7 @@ const page = usePage<{
|
||||
:current="route().current('tags')"
|
||||
:href="route('tags')"></NavigationSidebarItem>
|
||||
<NavigationSidebarItem
|
||||
v-if="isInvoicingActivated() && canViewInvoices()"
|
||||
title="Invoices"
|
||||
:icon="DocumentTextIcon"
|
||||
:current="route().current('invoices')"
|
||||
@@ -272,8 +273,6 @@ const page = usePage<{
|
||||
v-if="$slots.header"
|
||||
class="bg-default-background border-b border-default-background-separator shadow">
|
||||
<div class="pt-8 pb-3">
|
||||
|
||||
|
||||
<MainContainer>
|
||||
<slot name="header" />
|
||||
</MainContainer>
|
||||
|
||||
@@ -9,6 +9,14 @@ export function isBillingActivated() {
|
||||
return page.props.has_billing_extension;
|
||||
}
|
||||
|
||||
export function isInvoicingActivated() {
|
||||
const page = usePage<{
|
||||
has_invoicing_extension: boolean;
|
||||
}>();
|
||||
|
||||
return page.props.has_invoicing_extension;
|
||||
}
|
||||
|
||||
export function isInTrial() {
|
||||
const page = usePage<{
|
||||
billing: {
|
||||
|
||||
@@ -122,3 +122,7 @@ export function canDeleteReport() {
|
||||
export function canViewAllTimeEntries() {
|
||||
return currentUserHasPermission('time-entries:view:all');
|
||||
}
|
||||
export function canViewInvoices() {
|
||||
return currentUserHasPermission('invoices:view');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user