@extends('layouts.admin')
@section ('title')
SisVentas | Almacenes
@endsection
@section('contenido')
<!-- start page title -->
<div class="row">
    <div class="col-12">
        <div class="page-title-box">
            <div class="page-title-right">
                <ol class="breadcrumb m-0">
                    <li class="breadcrumb-item"><a href="javascript: void(0);">Inicio</a></li>
                    <li class="breadcrumb-item"><a href="javascript: void(0);">Configuración</a></li>
                    <li class="breadcrumb-item active">Almacenes</li>
                </ol>
            </div>
            <h4 class="page-title">Administración de Almacenes</h4>
        </div>
    </div>
</div>     
<!-- end page title --> 

<div class="row">
    <div class="col-12">
        <div class="card">
            <div class="card-body">
                <div class="row mb-2">
                    <div class="col-sm-4">
                        @can('almacen-create')
                        <a href="{{ route('almacenes.create') }}" class="btn btn-success mb-2"><i class="mdi mdi-plus-circle me-2"></i> Nuevo Almacen</a>
                        @endcan
                    </div>
                  
                    @include('almacen.almacenes.search')
                </div>                
                <div class="table-responsive">
                    <table class="table table-centered w-100 dt-responsive nowrap table-bordered table-condensed table-hover"> 
                        <thead class="table-light">
                            <tr>
                                <th>Id</th>
                                <th>Almacenes</th>
                                <th>Nivel</th>
                                <th>Sucursal</th>
                                <th>Ubicación</th>
                                <th style="width: 250px;">Acciones</th>
                            </tr>
                        </thead>
                        
                        <tbody>
                            @foreach ($almacenes as $alm)
                            <tr>
                                <td>{{ $alm->id_almacen }}</td>
                                <td>{{ $alm->almacen }}</td>
                                <td>{{ $alm->nivel }}</td>
                                <td>{{ $alm->sucursal }}</td>
                                <td>{{ $alm->ubicacion }}</td>
                                <td style="width: 350px" align="center">
                                    @can('almacen-edit')
                                    <a href="{{route('almacenes.edit',$alm->id_almacen)}}"><button class="btn btn-info"><i class="mdi mdi-square-edit-outline"></i> Editar</button></a>
                                    @endcan
                                    @can('almacen-delete')
                                    <button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#modal-delete-{{$alm->id_almacen}}"><i class="mdi mdi-delete"></i> Eliminar</button>
                                    @endcan
                                    @can('almacen-agregar_productos')
                                    <a href="{{url('almacen/almacenes/agregar-producto',$alm->id_almacen)}}"><button class="btn btn-success"><i class="mdi mdi-square-edit-outline"></i> Almacén</button></a>
                                    @endcan
                                </td>
                            </tr>
                            @include('almacen.almacenes.modal')
                            @endforeach
                        </tbody>
                        
                    </table>
                    {{$almacenes->render()}}
                </div>
            </div> <!-- end card-body-->
        </div> <!-- end card-->
    </div> <!-- end col -->
</div>
@push ('scripts')
<script>
    $('#liAlmacen').addClass("sub active");
    $('#aAlmacen').addClass("active");
    $('#liCategorias').addClass("active");
</script>
@endpush
@endsection