<div x-data="{ open: {{ request()->routeIs('purchase-requisitions.*', 'purchase-orders.*', 'quotations.*', 'quotation-requests.*', 'goods-receipt-notes.*') ? 'true' : 'false' }} }" class="mb-1">
    @permission('purchasing.requisitions.view')
    <button @click="open = !open" class="group flex items-center p-3 py-2 text-base font-medium rounded-md
        {{ request()->routeIs('purchase-requisitions.*', 'purchase-orders.*', 'quotations.*', 'quotation-requests.*', 'goods-receipt-notes.*') ? 'bg-red-100 text-red-800' : 'text-gray-700 hover:bg-red-50 hover:text-red-800' }}">
        <svg xxmlns="http://www.w3.org/2000/svg" class="ml-3 flex-shrink-0 h-6 w-6
            {{ request()->routeIs('purchase-requisitions.*', 'purchase-orders.*', 'quotations.*', 'quotation-requests.*', 'goods-receipt-notes.*') ? 'text-red-700' : 'text-gray-500 group-hover:text-red-700' }}"
            fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                d="M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z" />
        </svg>
        <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Purchasing System', __('Purchasing System')) }}</span>
        <svg :class="{'rotate-180': open, 'rotate-0': !open}" class="mr-auto h-5 w-5 transform transition-transform duration-200"
            xxmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
            <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
        </svg>
    </button>
    <div x-show="open" x-transition class="pr-4 mr-4 border-r border-gray-200">
        @permission('purchasing.requisitions.view')
        <a href="{{ route('purchase-requisitions.index') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('purchase-requisitions.index') ? 'text-red-800 bg-red-100' : 'text-gray-700 hover:text-red-800 hover:bg-red-50' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('purchase-requisitions.index') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Purchase Requisitions', __('Purchase Requisitions')) }}</span>
        </a>
        @endpermission

        @permission('purchasing.requisitions.create')
        <a href="{{ route('purchase-requisitions.create') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('purchase-requisitions.create') ? 'text-red-800 bg-red-100' : 'text-gray-700 hover:text-red-800 hover:bg-red-50' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('purchase-requisitions.create') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Add New Requisition', __('Add New Requisition')) }}</span>
        </a>
        @endpermission

        @permission('purchasing.orders.view')
        <a href="{{ route('purchase-orders.index') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('purchase-orders.index') ? 'text-red-800 bg-red-100' : 'text-gray-700 hover:text-red-800 hover:bg-red-50' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('purchase-orders.index') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Purchase Orders', __('Purchase Orders')) }}</span>
        </a>
        @endpermission

        @permission('purchasing.orders.create')
        <a href="{{ route('purchase-orders.create') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('purchase-orders.create') ? 'text-red-800 bg-red-100' : 'text-gray-700 hover:text-red-800 hover:bg-red-50' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('purchase-orders.create') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Add New Purchase Order', __('Add New Purchase Order')) }}</span>
        </a>
        @endpermission

        @permission('purchasing.quotations.view')
        <a href="{{ route('quotations.index') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('quotations.index') ? 'text-red-800 bg-red-100' : 'text-gray-700 hover:text-red-800 hover:bg-red-50' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('quotations.index') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Quotations', __('Quotations')) }}</span>
        </a>
        @endpermission

        @permission('purchasing.quotations.create')
        <a href="{{ route('quotations.create') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('quotations.create') ? 'text-red-800 bg-red-100' : 'text-gray-700 hover:text-red-800 hover:bg-red-50' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('quotations.create') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Add New Quotation', __('Add New Quotation')) }}</span>
        </a>
        @endpermission

        @permission('purchasing.quotations.compare')
        <a href="{{ route('quotations.compare') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('quotations.compare') ? 'text-red-800 bg-red-100' : 'text-gray-700 hover:text-red-800 hover:bg-red-50' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('quotations.compare') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Compare Quotations', __('Compare Quotations')) }}</span>
        </a>
        @endpermission

        @permission('purchasing.quotation-requests.view')
        <a href="{{ route('quotation-requests.index') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('quotation-requests.index') ? 'text-red-800 bg-red-100' : 'text-gray-700 hover:text-red-800 hover:bg-red-50' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('quotation-requests.index') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Quotation Requests', __('Quotation Requests')) }}</span>
        </a>
        @endpermission

        @permission('purchasing.quotation-requests.create')
        <a href="{{ route('quotation-requests.create') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('quotation-requests.create') ? 'text-red-800 bg-red-100' : 'text-gray-700 hover:text-red-800 hover:bg-red-50' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('quotation-requests.create') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Add New Quotation Request', __('Add New Quotation Request')) }}</span>
        </a>
        @endpermission

        @permission('purchasing.grn.view')
        <a href="{{ route('goods-receipt-notes.index') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('goods-receipt-notes.index') ? 'text-red-800 bg-red-100' : 'text-gray-700 hover:text-red-800 hover:bg-red-50' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('goods-receipt-notes.index') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Goods Receipt Notes', __('Goods Receipt Notes')) }}</span>
        </a>
        @endpermission

        @permission('purchasing.grn.create')
        <a href="{{ route('goods-receipt-notes.create') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('goods-receipt-notes.create') ? 'text-red-800 bg-red-100' : 'text-gray-700 hover:text-red-800 hover:bg-red-50' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('goods-receipt-notes.create') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Add New Goods Receipt Note', __('Add New Goods Receipt Note')) }}</span>
        </a>
        @endpermission
    </div>
    @endpermission
</div>
