<?php

namespace App\Providers;

use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;

class ViewServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        View::composer('*', function ($view) {
            $sidebar = [
                [
                    'heading' => 'Dasbor',
                    'items' => [
                        [
                            'label' => 'Ringkasan',
                            'icon' => 'squares-plus',
                            'route' => 'studio.dashboard.overview',
                            'match' => 'studio.dashboard.overview',
                            'can' => 'view overview',
                        ],
                    ],
                ],
                [
                    'heading' => 'Master',
                    'items' => [
                        [
                            'label' => 'Outlet',
                            'icon' => 'home-modern',
                            'route' => 'studio.master.outlet.index',
                            'match' => 'studio.master.outlet.*',
                            'can' => 'view outlet',
                        ],
                        [
                            'label' => 'Pegawai',
                            'icon' => 'users',
                            'route' => 'studio.master.user.index',
                            'match' => 'studio.master.user.*',
                            'can' => 'view user',
                        ],
                        [
                            'label' => 'Rumus',
                            'icon' => 'variable',
                            'route' => 'studio.master.formula.index',
                            'match' => 'studio.master.formula.*',
                            'can' => 'view formula',
                        ],
                    ],
                ],
                [
                    'heading' => 'Loyalty',
                    'items' => [
                        [
                            'label' => 'Tier',
                            'icon' => 'star',
                            'route' => 'studio.loyalty.tier.index',
                            'match' => 'studio.loyalty.tier.*',
                            'can' => 'view tier',
                        ],
                        [
                            'label' => 'Voucher',
                            'icon' => 'ticket',
                            'route' => 'studio.loyalty.voucher.index',
                            'match' => 'studio.loyalty.voucher.*',
                            'can' => 'view voucher',
                        ],
                        [
                            'label' => 'Customer',
                            'icon' => 'user-plus',
                            'route' => 'studio.loyalty.customer.index',
                            'match' => 'studio.loyalty.customer.*',
                            'can' => 'view customer',
                        ],
                    ],
                ],
                [
                    'heading' => 'Katalog',
                    'items' => [
                        [
                            'label' => 'Kategori',
                            'icon' => 'list-bullet',
                            'route' => 'studio.catalog.category.index',
                            'match' => 'studio.catalog.category.*',
                            'can' => 'view category',
                        ],
                        [
                            'label' => 'Merek',
                            'icon' => 'tag',
                            'route' => 'studio.catalog.brand.index',
                            'match' => 'studio.catalog.brand.*',
                            'can' => 'view brand',
                        ],
                        [
                            'label' => 'Parfum',
                            'icon' => 'flower-2',
                            'route' => 'studio.catalog.perfume.index',
                            'match' => 'studio.catalog.perfume.*',
                            'can' => 'view perfume',
                        ],
                        [
                            'label' => 'Produk',
                            'icon' => 'boxes',
                            'route' => 'studio.catalog.product.index',
                            'match' => 'studio.catalog.product.*',
                            'can' => 'view product',
                        ],
                        [
                            'label' => 'Botol',
                            'icon' => 'beaker',
                            'route' => 'studio.catalog.bottle.index',
                            'match' => 'studio.catalog.bottle.*',
                            'can' => 'view bottle',
                        ],
                    ],
                ],
                [
                    'heading' => 'Keuangan',
                    'items' => [
                        [
                            'label' => 'Pengeluaran',
                            'icon' => 'banknote-arrow-down',
                            'route' => 'studio.finance.expense.index',
                            'match' => 'studio.finance.expense.*',
                            'can' => 'view expense',
                        ],
                        [
                            'label' => 'Penggajian',
                            'icon' => 'hand-coins',
                            'route' => 'studio.finance.payroll.index',
                            'match' => 'studio.finance.payroll.*',
                            'can' => 'view payroll',
                        ],
                    ],
                ],
                [
                    'heading' => 'Kelola',
                    'items' => [
                        [
                            'label' => 'Order',
                            'icon' => 'truck',
                            'route' => 'studio.manage.order.index',
                            'match' => 'studio.manage.order.*',
                            'can' => 'view order',
                        ],
                        [
                            'label' => 'Belanja',
                            'icon' => 'shopping-bag',
                            'route' => 'studio.manage.purchase.index',
                            'match' => 'studio.manage.purchase.*',
                            'can' => 'view purchase',
                        ],
                        [
                            'label' => 'Artikel',
                            'icon' => 'newspaper',
                            'route' => 'studio.manage.article.index',
                            'match' => 'studio.manage.article.*',
                            'can' => 'view article',
                        ],
                        [
                            'label' => 'FAQs',
                            'icon' => 'question-mark-circle',
                            'route' => 'studio.manage.faq.index',
                            'match' => 'studio.manage.faq.*',
                            'can' => 'view faq',
                        ],
                    ],
                ],
                [
                    'heading' => 'Keunggulan',
                    'items' => [
                        [
                            'label' => 'Keunggulan Parfum',
                            'icon' => 'rocket-launch',
                            'route' => 'studio.feature.perfume_feature.index',
                            'match' => 'studio.feature.perfume_feature.*',
                            'can' => 'view perfume feature',
                        ],
                        [
                            'label' => 'Pilih Kami',
                            'icon' => 'trophy',
                            'route' => 'studio.feature.choose_us.index',
                            'match' => 'studio.feature.choose_us.*',
                            'can' => 'view choose us',
                        ],
                    ],
                ],
                [
                    'heading' => 'Pengaturan',
                    'items' => [
                        [
                            'label' => 'Aplikasi',
                            'icon' => 'cog-6-tooth',
                            'route' => 'studio.setting.application',
                            'match' => 'studio.setting.application',
                            'can' => 'view application settings',
                        ],
                        [
                            'label' => 'Whatsapp',
                            'icon' => 'chat-bubble-oval-left-ellipsis',
                            'route' => 'studio.setting.whatsapp',
                            'match' => 'studio.setting.whatsapp',
                            'can' => 'view whatsapp settings',
                        ],
                    ],
                ],
            ];

            $view->with('sidebar', $sidebar);
        });
    }
}
