<?php

namespace App\View\Page;

use Livewire\Component;

class Sidebar extends Component
{

    public $isShifted = false;

    public function render()
    {
        return <<<'HTML'
        <div
            class="fixed z-40 bg-gray-800 p-6 w-56 top-0 h-screen border-r border-gray-600 border-solid flex flex-col justify-between transition-all {{ $isShifted ? '-left-[14rem]' : 'left-0' }}"
        >
            <div class="grid gap-2">
                <x-page::menu-entry href="/" menu="dashboard" icon="loss">Dashboard</x-page::menu-entry>
                <x-page::menu-entry href="/member" menu="member" icon="user">Mitglieder</x-page::menu-entry>
                <x-page::menu-entry v-show="hasModule('bill')" href="/subscription" menu="subscription" icon="money">Beiträge</x-page::menu-entry>
                <x-page::menu-entry v-show="hasModule('bill')" href="/invoice" menu="invoice" icon="moneypaper">Rechnungen</x-page::menu-entry>
                <x-page::menu-entry href="/contribution" menu="contribution" icon="contribution">Zuschüsse</x-page::menu-entry>
                <x-page::menu-entry href="/activity" menu="activity" icon="activity">Tätigkeiten</x-page::menu-entry>
                <x-page::menu-entry href="/group" menu="group" icon="group">Gruppierungen</x-page::menu-entry>
                <x-page::menu-entry v-if="hasModule('event')" href="/form" menu="form" icon="event">Veranstaltungen</x-page::menu-entry>
                <x-page::menu-entry href="/maildispatcher" menu="maildispatcher" icon="at">Mail-Verteiler</x-page::menu-entry>
            </div>
            <div class="grid gap-2">
                <a href="#" class="flex w-full px-3 py-2 rounded-xl text-gray-300 bg-gray-700" @click.prevent="searchVisible = true">
                    <x-ui::sprite class="text-white w-6 h-6 mr-4" src="search"></x-ui::sprite>
                    <div class="">Suchen</div>
                </a>
                <x-page::menu-entry href="/setting" menu="setting" icon="setting">Einstellungen</x-page::menu-entry>
                <x-page::menu-entry href="/logout" menu="" icon="logout">Abmelden</x-page::menu-entry>
            </div>
            <a v-if="menuStore.hideable" href="#" class="absolute right-0 top-0 mr-2 mt-2" @click.prevent="menuStore.hide()">
                <ui-sprite src="close" class="w-5 h-5 text-gray-300"></ui-sprite>
            </a>
        </div>
        HTML;
    }
}