🎉 First commit
This commit is contained in:
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