{% load sri %}

{% sri_static 'taxsystem/libs/x-editable/1.5.8/css/bootstrap-editable.css' %}
{% sri_static 'taxsystem/libs/x-editable/1.5.8/js/bootstrap-editable.js' %}
{% sri_static 'taxsystem/js/manage.js' %}
{% sri_static 'taxsystem/js/modals/members-delete.js' %}
{% sri_static 'taxsystem/js/modals/payments-reject.js' %}
{% sri_static 'taxsystem/js/modals/payments-approve.js' %}
{% sri_static 'taxsystem/js/modals/payments-undo.js' %}
{% sri_static 'taxsystem/js/modals/payments-add.js' %}
{% sri_static 'taxsystem/js/modals/payments-delete.js' %}
{% sri_static 'taxsystem/js/modals/paymentsystem-switchuser.js' %}

<script>
    // Funktion zum Neuladen der Statistikdaten
    function reloadStatistics() {
        $.ajax({
            url: taxsystemsettings.corporationmanageDashboardUrl,
            type: 'GET',
            success: function (data) {
                // Statistics
                const statistics = data.statistics;
                const statisticsKey = Object.keys(statistics)[0];
                const stat = statistics[statisticsKey];

                $('#statistics_payments').text(stat.payments);
                $('#statistics_payments_pending').text(stat.payments_pending);
                $('#statistics_payments_auto').text(stat.payments_auto);
                $('#statistics_payments_manually').text(stat.payments_manually);
            },
            error: function(xhr, status, error) {
                console.error('Error fetching statistics data:', error);
            }
        });
    }
</script>
