fix dashboard issue

This commit is contained in:
radhika587
2022-02-05 18:16:10 +05:30
parent 2019e9be03
commit 2fcc87180f
3 changed files with 19 additions and 20 deletions

View File

@ -12,6 +12,7 @@ use Crater\Models\Expense;
use Crater\Models\Invoice; use Crater\Models\Invoice;
use Crater\Models\Payment; use Crater\Models\Payment;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Silber\Bouncer\BouncerFacade;
class DashboardController extends Controller class DashboardController extends Controller
{ {
@ -151,8 +152,8 @@ class DashboardController extends Controller
'total_invoice_count' => $total_invoice_count, 'total_invoice_count' => $total_invoice_count,
'total_estimate_count' => $total_estimate_count, 'total_estimate_count' => $total_estimate_count,
'recent_due_invoices' => $recent_due_invoices, 'recent_due_invoices' => BouncerFacade::can('view-invoice', Invoice::class) ? $recent_due_invoices : [],
'recent_estimates' => $recent_estimates, 'recent_estimates' => BouncerFacade::can('view-estimate', Estimate::class) ? $recent_estimates : [],
'chart_data' => $chart_data, 'chart_data' => $chart_data,

View File

@ -2,11 +2,10 @@
<div class="grid gap-6 sm:grid-cols-2 lg:grid-cols-9 xl:gap-8"> <div class="grid gap-6 sm:grid-cols-2 lg:grid-cols-9 xl:gap-8">
<!-- Amount Due --> <!-- Amount Due -->
<DashboardStatsItem <DashboardStatsItem
v-if="userStore.hasAbilities(abilities.VIEW_INVOICE)"
:icon-component="DollarIcon" :icon-component="DollarIcon"
:loading="!dashboardStore.isDashboardDataLoaded" :loading="!dashboardStore.isDashboardDataLoaded"
:route=" route="/admin/invoices"
userStore.hasAbilities(abilities.VIEW_INVOICE) ? `/admin/invoices` : ''
"
:large="true" :large="true"
:label="$t('dashboard.cards.due_amount')" :label="$t('dashboard.cards.due_amount')"
> >
@ -18,13 +17,10 @@
<!-- Customers --> <!-- Customers -->
<DashboardStatsItem <DashboardStatsItem
v-if="userStore.hasAbilities(abilities.VIEW_CUSTOMER)"
:icon-component="CustomerIcon" :icon-component="CustomerIcon"
:loading="!dashboardStore.isDashboardDataLoaded" :loading="!dashboardStore.isDashboardDataLoaded"
:route=" route="/admin/customers"
userStore.hasAbilities(abilities.VIEW_CUSTOMER)
? `/admin/customers`
: ''
"
:label="$t('dashboard.cards.customers')" :label="$t('dashboard.cards.customers')"
> >
{{ dashboardStore.stats.totalCustomerCount }} {{ dashboardStore.stats.totalCustomerCount }}
@ -32,11 +28,10 @@
<!-- Invoices --> <!-- Invoices -->
<DashboardStatsItem <DashboardStatsItem
v-if="userStore.hasAbilities(abilities.VIEW_INVOICE)"
:icon-component="InvoiceIcon" :icon-component="InvoiceIcon"
:loading="!dashboardStore.isDashboardDataLoaded" :loading="!dashboardStore.isDashboardDataLoaded"
:route=" route="/admin/invoices"
userStore.hasAbilities(abilities.VIEW_INVOICE) ? `/admin/invoices` : ''
"
:label="$t('dashboard.cards.invoices')" :label="$t('dashboard.cards.invoices')"
> >
{{ dashboardStore.stats.totalInvoiceCount }} {{ dashboardStore.stats.totalInvoiceCount }}
@ -44,13 +39,10 @@
<!-- Estimates --> <!-- Estimates -->
<DashboardStatsItem <DashboardStatsItem
v-if="userStore.hasAbilities(abilities.VIEW_ESTIMATE)"
:icon-component="EstimateIcon" :icon-component="EstimateIcon"
:loading="!dashboardStore.isDashboardDataLoaded" :loading="!dashboardStore.isDashboardDataLoaded"
:route=" route="/admin/estimates"
userStore.hasAbilities(abilities.VIEW_ESTIMATE)
? `/admin/estimates`
: ''
"
:label="$t('dashboard.cards.estimates')" :label="$t('dashboard.cards.estimates')"
> >
{{ dashboardStore.stats.totalEstimateCount }} {{ dashboardStore.stats.totalEstimateCount }}

View File

@ -2,7 +2,10 @@
<div> <div>
<div class="grid grid-cols-1 gap-6 mt-10 xl:grid-cols-2"> <div class="grid grid-cols-1 gap-6 mt-10 xl:grid-cols-2">
<!-- Due Invoices --> <!-- Due Invoices -->
<div class="due-invoices"> <div
v-if="userStore.hasAbilities(abilities.VIEW_INVOICE)"
class="due-invoices"
>
<div class="relative z-10 flex items-center justify-between mb-3"> <div class="relative z-10 flex items-center justify-between mb-3">
<h6 class="mb-0 text-xl font-semibold leading-normal"> <h6 class="mb-0 text-xl font-semibold leading-normal">
{{ $t('dashboard.recent_invoices_card.title') }} {{ $t('dashboard.recent_invoices_card.title') }}
@ -49,7 +52,10 @@
</div> </div>
<!-- Recent Estimates --> <!-- Recent Estimates -->
<div class="recent-estimates"> <div
v-if="userStore.hasAbilities(abilities.VIEW_ESTIMATE)"
class="recent-estimates"
>
<div class="relative z-10 flex items-center justify-between mb-3"> <div class="relative z-10 flex items-center justify-between mb-3">
<h6 class="mb-0 text-xl font-semibold leading-normal"> <h6 class="mb-0 text-xl font-semibold leading-normal">
{{ $t('dashboard.recent_estimate_card.title') }} {{ $t('dashboard.recent_estimate_card.title') }}