aa
This commit is contained in:
@@ -12,7 +12,8 @@ use DateTime;
|
||||
|
||||
class ArticleController extends Controller
|
||||
{
|
||||
private function convDate($data_italiana) {
|
||||
private function convDate($data_italiana)
|
||||
{
|
||||
return DateTime::createFromFormat('Y-m-d', $data_italiana)->format('Y-d-m');
|
||||
}
|
||||
private function articoliByDataStart($data_start)
|
||||
@@ -84,6 +85,21 @@ class ArticleController extends Controller
|
||||
return $ordini;
|
||||
|
||||
}
|
||||
private function queryshowInfoArticolo($idArticolo)
|
||||
{
|
||||
try {
|
||||
ini_set("memory_limit", "512M");
|
||||
|
||||
$articoli = Article::where('IdArticolo', $idArticolo)
|
||||
->get(); // Usa
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Registrazione dell'errore
|
||||
return response()->json(['error' => 'Si è verificato un errore durante il recupero dei dati: ' . $e->getMessage()], 500);
|
||||
}
|
||||
|
||||
return $articoli;
|
||||
}
|
||||
private function queryArticlesSales()
|
||||
{
|
||||
try {
|
||||
@@ -186,7 +202,7 @@ class ArticleController extends Controller
|
||||
return view('error', ['message' => $articoliVenduti['error']]);
|
||||
}
|
||||
|
||||
return view('export_articles_test', ['articoli' => $articoliVenduti]);
|
||||
return view('view-lista-ordini-totale', ['articoli' => $articoliVenduti]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Potresti considerare di registrare l'errore per debugging
|
||||
@@ -220,6 +236,20 @@ class ArticleController extends Controller
|
||||
|
||||
}
|
||||
}
|
||||
public function showInfoArticolo($numrec)
|
||||
{
|
||||
try {
|
||||
|
||||
$articoli = $this->queryshowInfoArticolo($numrec);
|
||||
|
||||
return view('info-articolo', ['articoli' => $articoli]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Potresti considerare di registrare l'errore per debugging
|
||||
return new Response('Error exporting articles: ' . $e->getMessage(), 500);
|
||||
|
||||
}
|
||||
}
|
||||
public function exportArticlesSales(Request $request): Response
|
||||
{
|
||||
try {
|
||||
|
||||
48
resources/views/info-articolo.blade.php
Normal file
48
resources/views/info-articolo.blade.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Articoli</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Elenco Articoli</h1>
|
||||
|
||||
@if($articoli->isEmpty())
|
||||
<p>Nessun articolo trovato.</p>
|
||||
@else
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Id Articolo</th>
|
||||
<th>EAN13</th>
|
||||
<th>Titolo</th>
|
||||
<th>Autori</th>
|
||||
<th>Argomenti</th>
|
||||
<th>Prezzo Ivato</th>
|
||||
<th>Data di Pubblicazione</th>
|
||||
<th>Enabled</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($articoli as $articolo)
|
||||
<tr>
|
||||
<td>{{ $articolo->Id }}</td>
|
||||
<td>{{ $articolo->IdArticolo }}</td>
|
||||
<td>{{ $articolo->Ean13 }}</td>
|
||||
<td>{{ $articolo->Titolo }}</td>
|
||||
<td>{{ $articolo->ListaAutori }}</td>
|
||||
<td>{{ $articolo->ListaArgomenti }}</td>
|
||||
<td>{{ $articolo->PrezzoIvato }}</td>
|
||||
<td>{{ $articolo->DataPubblicazione }}</td>
|
||||
<td>{{ $articolo->Enabled ? 'Sì' : 'No' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -11,13 +11,13 @@
|
||||
<body>
|
||||
<div class="container">
|
||||
|
||||
<h1>Totale Vendite per Articolo</h1>
|
||||
<h1>Lista Ordini Libri - Totale Venduti (scegli data)</h1>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID Articolo</th>
|
||||
<th>Descrizione</th>
|
||||
<th>ultimaDataOra</th>
|
||||
<th>Data ultima Vendita</th>
|
||||
<th>Totale Venduti</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -6466,6 +6466,7 @@ Route::get('/export-articles-sales', [ArticleController::class, 'exportArticlesS
|
||||
Route::get('/export-articles-sales-json', [ArticleController::class, 'exportArticlesSalesByJSON']);
|
||||
|
||||
Route::get('/view-articles-sales', [ArticleController::class, 'showArticlesSales']);
|
||||
Route::get('/view-articles-test/{data_start}', [ArticleController::class, 'showArticoliByDataStart']);
|
||||
Route::get('/view-lista-ordini-totale/{data_start}', [ArticleController::class, 'showArticoliByDataStart']);
|
||||
Route::get('/view-ordini-test/{numrec}', [ArticleController::class, 'showOrdini']);
|
||||
Route::get('/article-test', [ArticleController::class, 'test']);
|
||||
Route::get('/view-info-articolo', [ArticleController::class, 'showInfoArticolo']);
|
||||
|
||||
Reference in New Issue
Block a user