'', 'label' => __('-- Select a Lingxing store --')]]; $stores = $this->repository->getAll(); if ($stores === []) { $options[] = [ 'value' => '', 'label' => __('No local stores. Use Esun > Lingxing ERP > Stores > Sync Stores.'), 'disabled' => true, ]; return $options; } foreach ($stores as $store) { $platformCode = (int)$store['platform_code']; $storeId = (string)$store['store_id']; $active = (int)$store['is_sync'] === 1 && (int)$store['status'] === 1; $options[] = [ 'value' => $platformCode . '|' . $storeId, 'disabled' => !$active, 'label' => sprintf( '%s[%s / %d] %s (%s)', $active ? '' : (string)__('Inactive: '), (string)($store['platform_name'] ?? 'Platform'), $platformCode, (string)($store['store_name'] ?? $storeId), $storeId ), ]; } return $options; } }