* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Adapter\Kpi; use ConfigurationKPI; use Context; use HelperKpi; use PrestaShop\PrestaShop\Core\Kpi\KpiInterface; /** * @internal */ final class NetProfitPerVisitKpi implements KpiInterface { /** * {@inheritdoc} */ public function render() { $translator = Context::getContext()->getTranslator(); $helper = new HelperKpi(); $helper->id = 'box-net-profit-visit'; $helper->icon = 'account_box'; $helper->color = 'color1'; $helper->title = $translator->trans('Net Profit per Visit', [], 'Admin.Orderscustomers.Feature'); $helper->subtitle = $translator->trans('30 days', [], 'Admin.Orderscustomers.Feature'); if (ConfigurationKPI::get('NETPROFIT_VISIT') !== false) { $helper->value = ConfigurationKPI::get('NETPROFIT_VISIT'); } $helper->source = Context::getContext()->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=netprofit_visit'; $helper->refresh = (bool) (ConfigurationKPI::get('NETPROFIT_VISIT_EXPIRE') < time()); return $helper->generate(); } }