<?php
/**
 * مالی — کامپوننت پرداخت‌ها (AG Grid).
 */
if (!defined('ABSPATH')) {
    exit;
}

$wc_ok = class_exists('WooCommerce') && function_exists('wc_get_orders');
?>
<?php
zerti_ui_component_open('financial-payments', [
    'class' => 'zerti-component-financial zerti-financial-sub-slot',
    'data-zerti-fin-active' => 'payments',
    'data-zerti-fin-component' => 'payments',
]);
?>
    <?php if (!$wc_ok) : ?>
        <?php zerti_ui_wc_required_notice(__('WooCommerce must be installed and active to view payments.', 'zerti')); ?>
    <?php else : ?>
        <div class="zerti-payments-panel">
            <div class="zerti-payments-wrap">
                <?php
                zerti_ui_toolbar_open(
                    __('Search and export payments list', 'zerti'),
                    'zerti-payments-grid-toolbar'
                );
                ?>
                    <div class="zerti-payments-grid-toolbar-search"></div>
                    <?php do_action('zerti_payments_toolbar_export'); ?>
                <?php zerti_ui_toolbar_close(); ?>
                <?php
                zerti_ui_ag_grid_region(
                    'zertiPaymentsGrid',
                    'zerti-payments-grid',
                    __('Payments table', 'zerti')
                );
                ?>
            </div>
        </div>
    <?php endif; ?>
<?php zerti_ui_component_close(); ?>
