| @@ -19,8 +19,10 @@ | ||
| 19 | 19 | use FluentCart\App\Models\AttributeTerm; |
| 20 | 20 | use FluentCart\App\Models\AttributeGroup; |
| 21 | 21 | use FluentCart\App\Models\ShippingMethod; |
| 22 | 22 | use FluentCart\App\Modules\Tax\TaxModule; |
| 23 | +use FluentCart\App\Modules\FluentPlayer\FluentPlayerBridge; | |
| 24 | +use FluentCart\App\Modules\AdminFooter\AdminFooter; | |
| 23 | 25 | use FluentCart\App\Helpers\CurrenciesHelper; |
| 24 | 26 | use FluentCart\App\Services\Filter\TaxFilter; |
| 25 | 27 | use FluentCart\App\Services\Filter\OrderFilter; |
| 26 | 28 | use FluentCart\App\Services\Filter\LicenseFilter; |
| @@ -26,9 +28,15 @@ | ||
| 26 | 28 | use FluentCart\App\Services\Filter\LicenseFilter; |
| 27 | 29 | use FluentCart\App\Services\Filter\LicenseSiteFilter; |
| 28 | 30 | use FluentCart\App\Services\Filter\ProductFilter; |
| 29 | 31 | use FluentCart\App\Services\Filter\CustomerFilter; |
| 32 | +use FluentCart\App\Services\Filter\CouponFilter; | |
| 33 | +use FluentCart\App\Services\Filter\LogFilter; | |
| 34 | +use FluentCart\App\Services\Filter\OrderBumpFilter; | |
| 35 | +use FluentCart\App\Modules\Shipping\Services\Filter\ShippingClassFilter; | |
| 36 | +use FluentCart\App\Modules\Shipping\Services\Filter\ShippingZoneFilter; | |
| 30 | 37 | use FluentCart\App\Modules\Integrations\AddOnModule; |
| 38 | +use FluentCart\App\Services\DateTime\DayjsFormatter; | |
| 31 | 39 | use FluentCart\App\Services\Translations\TransStrings; |
| 32 | 40 | use FluentCart\App\Services\Permission\PermissionManager; |
| 33 | 41 | use FluentCart\Database\DataBackfills; |
| 34 | 42 | use FluentCart\App\Modules\PaymentMethods\Core\GatewayManager; |
| @@ -44,8 +52,9 @@ | ||
| 44 | 52 | |
| 45 | 53 | if ($page == 'fluent-cart') { |
| 46 | 54 | |
| 47 | 55 | \FluentCart\App\Events\FirstTimePluginActivation::handle(); |
| 56 | + (new AdminFooter())->register(); | |
| 48 | 57 | add_action('admin_enqueue_scripts', function () { |
| 49 | 58 | Vite::enqueueStyle('fluent_cart_admin_app_css', |
| 50 | 59 | 'styles/tailwind/style.css', |
| 51 | 60 | ); |
| @@ -439,9 +448,10 @@ | ||
| 439 | 448 | |
| 440 | 449 | do_action('fluent_cart/loading_app', $app); |
| 441 | 450 | |
| 442 | 451 | //This should be done before enqueueing the global script. |
| 443 | - Vite::enqueueScript($slug . '_admin_app_start', 'admin/bootstrap/app.js', [$slug . '_global_admin_hooks']); | |
| 452 | + // wp-i18n backs the admin translator (resources/admin/utils/translator/Translator.js). | |
| 453 | + Vite::enqueueScript($slug . '_admin_app_start', 'admin/bootstrap/app.js', [$slug . '_global_admin_hooks', 'wp-i18n']); | |
| 444 | 454 | |
| 445 | 455 | //Don't register this script using vite. |
| 446 | 456 | if (!wp_script_is('wp-hooks', 'registered')) { |
| 447 | 457 | $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
| @@ -483,10 +493,30 @@ | ||
| 483 | 493 | 'license_sites' => ['filters' => Arr::get($filterOptions, 'license_site_filter_options', [])], |
| 484 | 494 | 'taxes_table' => ['filters' => Arr::get($filterOptions, 'tax_filter_options', [])], |
| 485 | 495 | 'subscriptions' => ['filters' => Arr::get($filterOptions, 'subscription_filter_options', [])], |
| 486 | 496 | 'shipping_zone_table' => ['filters' => Arr::get($filterOptions, 'shipping_zone_filter_options', [])], |
| 497 | + // The Order Sources report filters orders, so its advanced-filter UI | |
| 498 | + // reuses the Orders filter vocabulary rather than defining its own. | |
| 499 | + 'source_report' => ['filters' => Arr::get($filterOptions, 'order_filter_options', [])], | |
| 487 | 500 | ]; |
| 488 | 501 | |
| 502 | + // Tables that declare sort options on their filter class but carry no | |
| 503 | + // filter-options entry above: the Sort popover still needs them, and | |
| 504 | + // they are what `fluent_cart/{filterName}_table_sorts` feeds. | |
| 505 | + $sortOnlyTables = [ | |
| 506 | + 'coupon_table' => CouponFilter::class, | |
| 507 | + 'log_table' => LogFilter::class, | |
| 508 | + 'order_bump_table' => OrderBumpFilter::class, | |
| 509 | + 'shipping_class_table' => ShippingClassFilter::class, | |
| 510 | + 'shipping_zone_table' => ShippingZoneFilter::class, | |
| 511 | + ]; | |
| 512 | + | |
| 513 | + foreach ($sortOnlyTables as $tableName => $filterClass) { | |
| 514 | + if (empty($tableConfig[$tableName]['filters']['sorts'])) { | |
| 515 | + $tableConfig[$tableName]['filters']['sorts'] = call_user_func([$filterClass, 'getSortOptions']); | |
| 516 | + } | |
| 517 | + } | |
| 518 | + | |
| 489 | 519 | $tableConfig = apply_filters('fluent_cart/admin_table_saved_views', $tableConfig, [ |
| 490 | 520 | 'filterOptions' => $filterOptions |
| 491 | 521 | ]); |
| 492 | 522 | |
| @@ -497,8 +527,9 @@ | ||
| 497 | 527 | $appConfig['version'] = FLUENTCART_VERSION; |
| 498 | 528 | $appConfig['permissions'] = PermissionManager::getUserPermissions(); |
| 499 | 529 | $appConfig['isProActive'] = App::isProActive(); |
| 500 | 530 | $appConfig['proVersion'] = defined('FLUENTCART_PRO_PLUGIN_VERSION') ? FLUENTCART_PRO_PLUGIN_VERSION : null; |
| 531 | + $appConfig['fluentPlayer'] = FluentPlayerBridge::adminAppConfig(); | |
| 501 | 532 | |
| 502 | 533 | $appConfig['logos'] = [ |
| 503 | 534 | 'dark' => Vite::getAssetUrl('images/logo/logo-full-dark.svg'), |
| 504 | 535 | 'light' => Vite::getAssetUrl('images/logo/logo-full.svg'), |
| @@ -568,9 +599,9 @@ | ||
| 568 | 599 | // POSTs data-backfills/run until done; endpoint requires manage_options |
| 569 | 600 | 'has_data_migrations' => $hasDataMigrations, |
| 570 | 601 | 'subscription_intervals' => Helper::getAvailableSubscriptionIntervalOptions(), |
| 571 | 602 | |
| 572 | - 'datei18' => TransStrings::dateTimeStrings(), | |
| 603 | + 'datei18' => DayjsFormatter::localizedStrings(), | |
| 573 | 604 | 'el_strings' => TransStrings::elStrings(), |
| 574 | 605 | 'wp_locale' => get_locale(), |
| 575 | 606 | 'is_full_name_required' => CheckoutFieldsSchema::isFullNameRequired(), |
| 576 | 607 | 'business_details' => [ |