<?php $__env->startSection('title', $title); ?>
<?php $__env->startSection('page-title', 'Investment plans'); ?>
<?php $__env->startSection('page-description', 'Choose a plan set up by your bank. Payment from your available balance.'); ?>

<?php $__env->startSection('content'); ?>

<?php
    $currency = $settings->currency ?? '$';
?>

<div class="min-h-screen bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-100 dark:from-slate-900 dark:via-slate-800 dark:to-slate-900 p-3 lg:p-4">
    <div class="max-w-8xl mx-auto">
        <?php if (isset($component)) { $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4 = $component; } ?>
<?php $component = $__env->getContainer()->make(Illuminate\View\AnonymousComponent::class, ['view' => 'components.danger-alert','data' => []]); ?>
<?php $component->withName('danger-alert'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4)): ?>
<?php $component = $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4; ?>
<?php unset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4); ?>
<?php endif; ?>
        <?php if (isset($component)) { $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4 = $component; } ?>
<?php $component = $__env->getContainer()->make(Illuminate\View\AnonymousComponent::class, ['view' => 'components.success-alert','data' => []]); ?>
<?php $component->withName('success-alert'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4)): ?>
<?php $component = $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4; ?>
<?php unset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4); ?>
<?php endif; ?>
        <?php if (isset($component)) { $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4 = $component; } ?>
<?php $component = $__env->getContainer()->make(Illuminate\View\AnonymousComponent::class, ['view' => 'components.error-alert','data' => []]); ?>
<?php $component->withName('error-alert'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4)): ?>
<?php $component = $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4; ?>
<?php unset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4); ?>
<?php endif; ?>

        <div class="lg:hidden mb-2">
            <?php echo $__env->make('partials._mobile_header', [
                'title' => 'Investment plans',
                'showBackButton' => true,
                'backUrl' => route('dashboard'),
                'showNotifications' => true,
                'showDarkMode' => true,
                'financeUser' => Auth::user()
            ], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
        </div>

        <div class="hidden lg:flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 mb-4">
            <div>
                <h1 class="text-xl font-bold text-gray-900 dark:text-white">Investment plans</h1>
                <p class="text-sm text-gray-500 dark:text-gray-400 mt-1 max-w-2xl">
                    Invest from your account balance. Returns are credited automatically on each interval until the plan matures.
                    This is separate from any legacy investment products.
                </p>
            </div>
            <a href="<?php echo e(route('managed-investments.portfolio')); ?>"
               class="inline-flex items-center px-4 py-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg text-sm font-semibold text-gray-800 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-700">
                <i class="fas fa-briefcase mr-2 text-primary-600"></i>
                My investments
            </a>
        </div>

        <div class="lg:hidden mb-4">
            <a href="<?php echo e(route('managed-investments.portfolio')); ?>"
               class="flex items-center justify-center w-full py-3 rounded-xl bg-white/90 dark:bg-gray-800 border border-gray-200 dark:border-gray-600 text-sm font-semibold text-gray-800 dark:text-gray-200">
                <i class="fas fa-briefcase mr-2 text-primary-600"></i>
                My investments
            </a>
        </div>

        <div class="mb-4 rounded-xl bg-primary-50 dark:bg-primary-900/20 border border-primary-100 dark:border-primary-800 p-4 text-sm text-primary-900 dark:text-primary-100">
            <i class="fas fa-info-circle mr-2"></i>
            Available balance: <strong><?php echo e($currency); ?><?php echo e(number_format((float) Auth::user()->account_bal, 2)); ?></strong>
        </div>

        <?php if($investmentPlans->isEmpty()): ?>
            <div class="text-center py-16 px-6 rounded-xl bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 shadow-sm">
                <i class="fas fa-clipboard-list text-4xl text-gray-300 dark:text-gray-600 mb-4"></i>
                <h2 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">No plans available</h2>
                <p class="text-gray-600 dark:text-gray-400 text-sm">New options will appear here when your administrator publishes them.</p>
            </div>
        <?php else: ?>
            <div class="grid md:grid-cols-2 xl:grid-cols-3 gap-5">
                <?php $__currentLoopData = $investmentPlans; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $plan): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="bg-white/95 dark:bg-gray-800/95 backdrop-blur-xl rounded-2xl border border-gray-200 dark:border-gray-700 shadow-lg overflow-hidden flex flex-col">
                        <div class="h-1.5 bg-gradient-to-r from-primary-500 to-primary-700"></div>
                        <div class="p-6 flex-1 flex flex-col">
                            <div class="flex items-start justify-between gap-2 mb-4">
                                <h3 class="text-lg font-bold text-gray-900 dark:text-white"><?php echo e($plan->name); ?></h3>
                                <span class="text-xs font-semibold uppercase tracking-wide text-primary-600 dark:text-primary-400">Managed</span>
                            </div>
                            <?php if($plan->description): ?>
                                <p class="text-sm text-gray-600 dark:text-gray-400 mb-4"><?php echo e($plan->description); ?></p>
                            <?php endif; ?>
                            <ul class="space-y-2 text-sm text-gray-700 dark:text-gray-300 mb-4 flex-1">
                                <li class="flex justify-between border-b border-gray-100 dark:border-gray-700 pb-2">
                                    <span class="text-gray-500 dark:text-gray-400">Invest</span>
                                    <span class="font-semibold text-right"><?php echo e($currency); ?><?php echo e(number_format($plan->min_amount, 0)); ?> – <?php echo e($currency); ?><?php echo e(number_format($plan->max_amount, 0)); ?></span>
                                </li>
                                <li class="flex justify-between border-b border-gray-100 dark:border-gray-700 pb-2">
                                    <span class="text-gray-500 dark:text-gray-400">Target ROI (info)</span>
                                    <span class="font-semibold"><?php echo e($plan->min_roi_percent); ?>% – <?php echo e($plan->max_roi_percent); ?>%</span>
                                </li>
                                <li class="flex justify-between border-b border-gray-100 dark:border-gray-700 pb-2">
                                    <span class="text-gray-500 dark:text-gray-400">Payout</span>
                                    <span class="font-medium text-right text-xs sm:text-sm">
                                        <?php echo e($plan->topup_type); ?> <?php echo e($plan->topup_amount); ?><?php echo e($plan->topup_type === 'Percentage' ? '%' : ' ' . $currency); ?>

                                        <span class="text-gray-500 dark:text-gray-400"> / <?php echo e($plan->topup_interval); ?></span>
                                    </span>
                                </li>
                                <li class="flex justify-between pb-2">
                                    <span class="text-gray-500 dark:text-gray-400">Term</span>
                                    <span class="font-semibold text-right"><?php echo e($plan->investment_duration); ?></span>
                                </li>
                                <?php if((float)$plan->gift_bonus > 0): ?>
                                    <li class="flex justify-between text-green-600 dark:text-green-400">
                                        <span>Welcome gift</span>
                                        <span class="font-bold">+<?php echo e($currency); ?><?php echo e(number_format($plan->gift_bonus, 2)); ?></span>
                                    </li>
                                <?php endif; ?>
                            </ul>

                            <form action="<?php echo e(route('managed-investments.subscribe')); ?>" method="post" class="mt-auto space-y-3" x-data="{ amt: '<?php echo e(number_format($plan->min_amount, 2, '.', '')); ?>' }">
                                <?php echo csrf_field(); ?>
                                <input type="hidden" name="managed_investment_plan_id" value="<?php echo e($plan->id); ?>">
                                <label class="block text-xs font-medium text-gray-600 dark:text-gray-400">Amount (<?php echo e($currency); ?>)</label>
                                <input type="number" name="amount" x-model="amt" step="0.01" min="<?php echo e($plan->min_amount); ?>" max="<?php echo e($plan->max_amount); ?>"
                                       class="w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-900 dark:text-white shadow-sm focus:border-primary-500 focus:ring-primary-500 text-sm"
                                       required>
                                <button type="submit"
                                        class="w-full inline-flex items-center justify-center px-4 py-3 rounded-xl bg-gradient-to-r from-primary-600 to-primary-700 hover:from-primary-700 hover:to-primary-800 text-white text-sm font-bold shadow-lg shadow-primary-600/25 transition-all">
                                    <i class="fas fa-lock-open mr-2"></i>
                                    Invest now
                                </button>
                            </form>
                        </div>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
        <?php endif; ?>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.dash2', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/nezemgrh/bnk.nezertechy.xyz/resources/views/user/investment-plans.blade.php ENDPATH**/ ?>