<?php $__env->startSection('content'); ?>
<div class="d-flex flex-wrap justify-content-between align-items-center gap-3 mb-4">
    <div>
        <h1 class="h3 mb-1">Profit Summary</h1>
        <p class="text-muted mb-0">Daily transaction profit and all-time total profit.</p>
    </div>
    <form class="d-flex gap-2 ajax-filter" method="GET" action="<?php echo e(route('profits.index')); ?>" data-ajax-target="#profit-results">
        <input class="form-control" name="date" type="date" value="<?php echo e($date); ?>">
        <button class="btn btn-primary" type="submit">View</button>
    </form>
</div>

<div id="profit-results">
<div class="row g-3 mb-4">
    <div class="col-md-4">
        <div class="card">
            <div class="card-body">
                <div class="text-muted small">Daily Exchange Profit</div>
                <div class="h3 mb-0"><?php echo e(number_format($dailyExchangeProfit, 4)); ?></div>
            </div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="card">
            <div class="card-body">
                <div class="text-muted small">Daily Total Profit</div>
                <div class="h3 mb-0"><?php echo e(number_format($dailyTotalProfit, 4)); ?></div>
            </div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="card">
            <div class="card-body">
                <div class="text-muted small">Total Profit</div>
                <div class="h3 mb-0"><?php echo e(number_format((float) $totalProfit, 4)); ?></div>
            </div>
        </div>
    </div>
</div>

<div class="card">
    <div class="card-body">
        <h2 class="h4 mb-3">Transaction-wise Profit</h2>
        <div class="table-responsive">
            <table class="table table-striped align-middle">
                <thead>
                        <th>Date</th>
                        <th>Type</th>
                        <th>Currency</th>
                        <th class="text-end">Quantity</th>
                        <th class="text-end">Rate</th>
                        <th class="text-end">Exchange Profit</th>
                        <th class="text-end">Total Profit</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $transactions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transaction): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td><?php echo e($transaction->created_at->format('Y-m-d H:i')); ?></td>
                            <td class="text-capitalize"><?php echo e($transaction->type); ?></td>
                            <td><?php echo e($transaction->currency->code); ?></td>
                            <td class="text-end"><?php echo e(number_format((float) $transaction->quantity, 4)); ?></td>
                            <td class="text-end"><?php echo e(number_format((float) $transaction->rate, 4)); ?></td>
                            <td class="text-end"><?php echo e(number_format((float) $transaction->exchange_profit, 4)); ?></td>
                            <td class="text-end fw-semibold"><?php echo e(number_format((float) $transaction->total_profit, 4)); ?></td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td class="text-muted text-center" colspan="7">No transactions found for this date.</td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH F:\christopher\currencychangerui\resources\views/profits/index.blade.php ENDPATH**/ ?>