🎉 First commit
This commit is contained in:
76
app/Filament/Pages/Articles.php
Normal file
76
app/Filament/Pages/Articles.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Services\LogisticsService;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class Articles extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = Heroicon::OutlinedCube;
|
||||
|
||||
protected static ?string $navigationLabel = 'Articles';
|
||||
|
||||
protected static ?string $title = 'Articles';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected string $view = 'filament.pages.articles';
|
||||
|
||||
public string $search = '';
|
||||
|
||||
public string $select = 'artid,artname';
|
||||
|
||||
public int $results = 10;
|
||||
|
||||
public string $stockArticleId = '';
|
||||
|
||||
public array $data = [];
|
||||
|
||||
public array $stockData = [];
|
||||
|
||||
public ?array $metadata = null;
|
||||
|
||||
public ?string $errorMessage = null;
|
||||
|
||||
public function searchArticles(): void
|
||||
{
|
||||
try {
|
||||
$service = app(LogisticsService::class);
|
||||
|
||||
$params = array_filter([
|
||||
'select' => $this->select,
|
||||
'results' => $this->results,
|
||||
'search' => $this->search,
|
||||
]);
|
||||
|
||||
$response = $service->artList($params);
|
||||
|
||||
$this->data = $response['data'] ?? [];
|
||||
$this->metadata = $response['metadata'] ?? null;
|
||||
$this->errorMessage = $response['error'] ?? null;
|
||||
} catch (\Throwable $e) {
|
||||
$this->errorMessage = $e->getMessage();
|
||||
$this->data = [];
|
||||
}
|
||||
}
|
||||
|
||||
public function getStock(): void
|
||||
{
|
||||
if (blank($this->stockArticleId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$service = app(LogisticsService::class);
|
||||
$response = $service->artGetStock($this->stockArticleId);
|
||||
|
||||
$this->stockData = $response['data'] ?? [];
|
||||
$this->errorMessage = $response['error'] ?? null;
|
||||
} catch (\Throwable $e) {
|
||||
$this->errorMessage = $e->getMessage();
|
||||
$this->stockData = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
75
app/Filament/Pages/Documents.php
Normal file
75
app/Filament/Pages/Documents.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Services\LogisticsService;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class Documents extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = Heroicon::OutlinedDocumentText;
|
||||
|
||||
protected static ?string $navigationLabel = 'Documents';
|
||||
|
||||
protected static ?string $title = 'Documents';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
protected string $view = 'filament.pages.documents';
|
||||
|
||||
public string $select = 'jnl,number,thirdid,date';
|
||||
|
||||
public string $thirdId = '';
|
||||
|
||||
public string $detailJnl = '';
|
||||
|
||||
public string $detailNumber = '';
|
||||
|
||||
public array $data = [];
|
||||
|
||||
public array $detailData = [];
|
||||
|
||||
public ?array $metadata = null;
|
||||
|
||||
public ?string $errorMessage = null;
|
||||
|
||||
public function searchDocuments(): void
|
||||
{
|
||||
try {
|
||||
$service = app(LogisticsService::class);
|
||||
|
||||
$params = array_filter([
|
||||
'select' => $this->select,
|
||||
'thirdid' => $this->thirdId,
|
||||
]);
|
||||
|
||||
$response = $service->documentList($params);
|
||||
|
||||
$this->data = $response['data'] ?? [];
|
||||
$this->metadata = $response['metadata'] ?? null;
|
||||
$this->errorMessage = $response['error'] ?? null;
|
||||
} catch (\Throwable $e) {
|
||||
$this->errorMessage = $e->getMessage();
|
||||
$this->data = [];
|
||||
}
|
||||
}
|
||||
|
||||
public function getDocumentDetail(): void
|
||||
{
|
||||
if (blank($this->detailJnl) || blank($this->detailNumber)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$service = app(LogisticsService::class);
|
||||
$response = $service->documentDetail($this->detailJnl, $this->detailNumber);
|
||||
|
||||
$this->detailData = $response['data'] ?? [];
|
||||
$this->errorMessage = $response['error'] ?? null;
|
||||
} catch (\Throwable $e) {
|
||||
$this->errorMessage = $e->getMessage();
|
||||
$this->detailData = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
54
app/Filament/Pages/Journaux.php
Normal file
54
app/Filament/Pages/Journaux.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Services\LogisticsService;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class Journaux extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = Heroicon::OutlinedBookOpen;
|
||||
|
||||
protected static ?string $navigationLabel = 'Journaux';
|
||||
|
||||
protected static ?string $title = 'Journaux';
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
protected string $view = 'filament.pages.journaux';
|
||||
|
||||
public string $select = '';
|
||||
|
||||
public int $results = 10;
|
||||
|
||||
public string $type = '';
|
||||
|
||||
public array $data = [];
|
||||
|
||||
public ?array $metadata = null;
|
||||
|
||||
public ?string $errorMessage = null;
|
||||
|
||||
public function searchJournaux(): void
|
||||
{
|
||||
try {
|
||||
$service = app(LogisticsService::class);
|
||||
|
||||
$params = array_filter([
|
||||
'select' => $this->select,
|
||||
'results' => $this->results,
|
||||
'TYPE' => $this->type,
|
||||
]);
|
||||
|
||||
$response = $service->jnlList($params);
|
||||
|
||||
$this->data = $response['data'] ?? [];
|
||||
$this->metadata = $response['metadata'] ?? null;
|
||||
$this->errorMessage = $response['error'] ?? null;
|
||||
} catch (\Throwable $e) {
|
||||
$this->errorMessage = $e->getMessage();
|
||||
$this->data = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
67
app/Filament/Pages/TablesExplorer.php
Normal file
67
app/Filament/Pages/TablesExplorer.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Services\LogisticsService;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Livewire\Attributes\Url;
|
||||
|
||||
class TablesExplorer extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = Heroicon::OutlinedTableCells;
|
||||
|
||||
protected static ?string $navigationLabel = 'Tables';
|
||||
|
||||
protected static ?string $title = 'Explorateur de tables';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected string $view = 'filament.pages.tables-explorer';
|
||||
|
||||
#[Url]
|
||||
public string $selectedTable = '';
|
||||
|
||||
public array $tables = [];
|
||||
|
||||
public array $columns = [];
|
||||
|
||||
public ?string $errorMessage = null;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->loadTables();
|
||||
}
|
||||
|
||||
public function loadTables(): void
|
||||
{
|
||||
try {
|
||||
$service = app(LogisticsService::class);
|
||||
$response = $service->tablesList();
|
||||
|
||||
$this->tables = $response['data'] ?? [];
|
||||
$this->errorMessage = $response['error'] ?? null;
|
||||
} catch (\Throwable $e) {
|
||||
$this->errorMessage = $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public function loadColumns(): void
|
||||
{
|
||||
if (blank($this->selectedTable)) {
|
||||
$this->columns = [];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$service = app(LogisticsService::class);
|
||||
$response = $service->columnList($this->selectedTable);
|
||||
|
||||
$this->columns = $response['data'] ?? [];
|
||||
$this->errorMessage = $response['error'] ?? null;
|
||||
} catch (\Throwable $e) {
|
||||
$this->errorMessage = $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
76
app/Filament/Pages/Tiers.php
Normal file
76
app/Filament/Pages/Tiers.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Services\LogisticsService;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class Tiers extends Page
|
||||
{
|
||||
protected static string|\BackedEnum|null $navigationIcon = Heroicon::OutlinedUsers;
|
||||
|
||||
protected static ?string $navigationLabel = 'Tiers';
|
||||
|
||||
protected static ?string $title = 'Tiers';
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
protected string $view = 'filament.pages.tiers';
|
||||
|
||||
public string $select = 'custid,custname';
|
||||
|
||||
public string $search = '';
|
||||
|
||||
public int $results = 10;
|
||||
|
||||
public string $historyThirdId = '';
|
||||
|
||||
public array $data = [];
|
||||
|
||||
public array $historyData = [];
|
||||
|
||||
public ?array $metadata = null;
|
||||
|
||||
public ?string $errorMessage = null;
|
||||
|
||||
public function searchTiers(): void
|
||||
{
|
||||
try {
|
||||
$service = app(LogisticsService::class);
|
||||
|
||||
$params = array_filter([
|
||||
'select' => $this->select,
|
||||
'results' => $this->results,
|
||||
'search' => $this->search,
|
||||
]);
|
||||
|
||||
$response = $service->thirdList($params);
|
||||
|
||||
$this->data = $response['data'] ?? [];
|
||||
$this->metadata = $response['metadata'] ?? null;
|
||||
$this->errorMessage = $response['error'] ?? null;
|
||||
} catch (\Throwable $e) {
|
||||
$this->errorMessage = $e->getMessage();
|
||||
$this->data = [];
|
||||
}
|
||||
}
|
||||
|
||||
public function getArtHistory(): void
|
||||
{
|
||||
if (blank($this->historyThirdId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$service = app(LogisticsService::class);
|
||||
$response = $service->thirdGetArtHistory($this->historyThirdId);
|
||||
|
||||
$this->historyData = $response['data'] ?? [];
|
||||
$this->errorMessage = $response['error'] ?? null;
|
||||
} catch (\Throwable $e) {
|
||||
$this->errorMessage = $e->getMessage();
|
||||
$this->historyData = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user