66 lines
2.2 KiB
PHP

@extends('adminlte::page')
@section('content_header')
<h1>Regole di importazione e assegnazione delle categorie</h1>
@endsection
@section('content')
<div class="container">
<p>Qui puoi gestire le regole di importazione e assegnazione delle categorie.</p>
<div class="card">
<div class="card-header">
<h3 class="card-title">Regole di Importazione</h3>
</div>
<div class="card-body">
<table class="table table-bordered" id="importRulesTable">
<thead>
<tr>
<th>ID</th>
<th>Pattern</th>
<th>Descrizione</th>
<th>Categoria</th>
<th>Azioni</th>
</tr>
</thead>
<tbody>
@foreach($rules as $rule)
<tr>
<td>{{ $rule->id }}</td>
<td>{{ $rule->pattern }}</td>
<td>{{ $rule->description }}</td>
<td>{{ \App\Models\Categorie::find($rule->category_id)->cat_name ?? 'N/A' }}</td>
<td>
<a href="{{ route('import_rules.edit', $rule->id) }}" class="btn btn-primary btn-sm">Modifica</a>
<form action="{{ route('import_rules.destroy', $rule->id) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger btn-sm">Elimina</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="card-footer">
<a href="{{ route('import_rules.create') }}" class="btn btn-success">Aggiungi Nuova Regola</a>
</div>
</div>
</div>
@endsection
@section('js')
<script>
$(document).ready(function() {
$('#importRulesTable').DataTable({
responsive: true,
order: [[0, "desc"]]
});
// $('.select2').select2();
});
</script>
@endsection')