@extends('layouts.app')

@section('content')
    <x-common.page-breadcrumb pageTitle="{{ $title ?? 'Dashboard' }}" />

    @if(session('success'))
        <div class="mb-4 rounded-lg bg-success-50 p-4 text-sm text-success-700 dark:bg-success-500/15 dark:text-success-500">
            {{ session('success') }}
        </div>
    @endif

    @if(session('error'))
        <div class="mb-4 rounded-lg bg-error-50 p-4 text-sm text-error-700 dark:bg-error-500/15 dark:text-error-500">
            {{ session('error') }}
        </div>
    @endif

    @php
        $user = auth()->user();
    @endphp

    @if($user && method_exists($user, 'isDeveloper') && $user->isDeveloper())
        @if(view()->exists('pages.dashboard.partials.developer'))
            @include('pages.dashboard.partials.developer')
        @endif
    @endif

    @if($user && method_exists($user, 'isOwner') && $user->isOwner())
        @if(view()->exists('pages.dashboard.partials.owner'))
            @include('pages.dashboard.partials.owner')
        @endif
    @endif

    @if($user && method_exists($user, 'isSPV') && $user->isSPV())
        @if(view()->exists('pages.dashboard.partials.spv'))
            @include('pages.dashboard.partials.spv')
        @endif
    @endif

    @if($user && method_exists($user, 'isDesigner') && $user->isDesigner())
        @if(view()->exists('pages.dashboard.partials.designer'))
            @include('pages.dashboard.partials.designer')
        @endif
    @endif

    @if($user && method_exists($user, 'isKasir') && $user->isKasir())
        @if(view()->exists('pages.dashboard.partials.kasir'))
            @include('pages.dashboard.partials.kasir')
        @endif
    @endif

    @if($user && method_exists($user, 'isOperator') && $user->isOperator())
        @if(view()->exists('pages.dashboard.partials.operator'))
            @include('pages.dashboard.partials.operator')
        @endif
    @endif

    @if($user && method_exists($user, 'isAdministrasi') && $user->isAdministrasi())
        @if(view()->exists('pages.dashboard.partials.administrasi'))
            @include('pages.dashboard.partials.administrasi')
        @endif
    @endif
@endsection