errorMessage = null; $this->hasSearched = true; try { $service = app(LogisticsService::class); $params = array_filter([ 'select' => $this->select, 'search' => $this->search, 'barcode' => $this->barcode, ]); $response = $service->artList($params); $this->data = $response['data'] ?? []; $this->metadata = $response['metadata'] ?? null; $this->errorMessage = ApiErrorTranslator::translate($response['error'] ?? null); } catch (LogisticsApiException $e) { $this->errorMessage = ApiErrorTranslator::translate($e->getMessage()); $this->data = []; } catch (\Throwable $e) { $this->errorMessage = ApiErrorTranslator::translate($e->getMessage()); $this->data = []; } } public function getStock(): void { $this->errorMessage = null; if (blank($this->stockArticleId)) { $this->errorMessage = 'Le champ identifiant article (ARTID) est obligatoire pour verifier le stock.'; return; } $this->hasCheckedStock = true; try { $service = app(LogisticsService::class); $response = $service->artGetStock($this->stockArticleId); $this->stockData = $response['data'] ?? []; $this->errorMessage = ApiErrorTranslator::translate($response['error'] ?? null); } catch (LogisticsApiException $e) { $this->errorMessage = ApiErrorTranslator::translate($e->getMessage()); $this->stockData = []; } catch (\Throwable $e) { $this->errorMessage = ApiErrorTranslator::translate($e->getMessage()); $this->stockData = []; } } }