| 1 |
<?php |
| 2 |
namespace FluentCart\App\Modules\Integrations\FluentPlugins; |
| 3 |
|
| 4 |
use FluentCart\App\Helpers\Helper; |
| 5 |
use FluentCart\App\Models\Customer; |
| 6 |
use FluentCart\App\Models\Order; |
| 7 |
use FluentCart\App\Services\URL; |
| 8 |
|
| 9 |
class FluentSupportWidget |
| 10 |
{ |
| 11 |
public function register() |
| 12 |
{ |
| 13 |
add_filter('fluent_support/customer_extra_widgets', array($this, 'getPurchaseWidgets'), 10, 2); |
| 14 |
} |
| 15 |
|
| 16 |
public function getPurchaseWidgets($widgets, $customer) |
| 17 |
{ |
| 18 |
|
| 19 |
$customer = Customer::query()->where('email', $customer->email)->first(); |
| 20 |
|
| 21 |
if (!$customer) { |
| 22 |
return $widgets; |
| 23 |
} |
| 24 |
|
| 25 |
$html = (new FluentCRMDeepIntegration())->getStatsHtml($customer); |
| 26 |
|
| 27 |
if($html) { |
| 28 |
$css = 'ul.fc_full_listed { |
| 29 |
border-radius: 4px; |
| 30 |
list-style: none; |
| 31 |
margin: 0; |
| 32 |
padding: 0; |
| 33 |
} |
| 34 |
|
| 35 |
ul.fc_full_listed li { |
| 36 |
border-bottom: 1px solid #ebeef4; |
| 37 |
display: block; |
| 38 |
margin: 0; |
| 39 |
padding: 5px 0; |
| 40 |
} |
| 41 |
|
| 42 |
ul.fc_full_listed>li span.fc_list_sub { |
| 43 |
font-weight: 500; |
| 44 |
} |
| 45 |
ul.fc_full_listed>li span.fc_list_value { |
| 46 |
float: right; |
| 47 |
}'; |
| 48 |
|
| 49 |
$html .= '<style>'.$css.'</style>'; |
| 50 |
} |
| 51 |
|
| 52 |
$widgets['fluent_cart_purchases'] = [ |
| 53 |
'header' => __('Purchases', 'fluent-cart'), |
| 54 |
'body_html' => $html, |
| 55 |
]; |
| 56 |
return $widgets; |
| 57 |
} |
| 58 |
} |
| 59 |
|