@extends('layouts.template')

@section('title', 'Modules')
@section('page-title', 'Liste des Modules')

@section('content')
<div class="card">
    <div class="card-body">
        <div class="container">
        <div class="card-header bg-info text-white">
                <h4 class="text-center">Liste des modules</h4>
            </div>
    <a href="{{ route('modules.create') }}" class="btn btn-primary mt-3"><i class="fa fa-plus"></i>Créer un Module</a>

    @if(session('success'))
        <div class="alert alert-success">
            {{ session('success') }}
        </div>
    @endif

    <table class="table table-striped table-bordered display table-responsive" id="zero_config">
        <thead>
            <tr>
                <th>Nom module</th>
                <th>Progiciel</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            @foreach($modules as $module)
                <tr>
                    <td>{{ $module->nom }}</td>
                    <td>{{ $module->progiciel->nom }}</td>
                    <td>
                        <a href="{{ route('modules.edit', $module->id) }}" class="btn btn-warning btn-sm"><i class="fa fa-edit"></i></a>
                        <form action="{{ route('modules.destroy', $module->id) }}" method="POST" style="display:inline;">
                            @csrf
                            @method('DELETE')
                            <button type="submit" class="btn btn-danger btn-sm rounded-pill "><i class="fa fa-trash"></i></button>
                        </form>
                    </td>
                </tr>
            @endforeach
        </tbody>
    </table>
</div>
    </div>
</div>

@endsection
