<?php $__env->startSection('content'); ?>
    <?php echo $__env->make('admin.topmenu', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <?php echo $__env->make('admin.sidebar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <div class="main-panel">
        <div class="content">
            <div class="page-inner">
                <div class="mt-2 mb-4 d-flex justify-content-between align-items-center">
                    <h1 class="title1"><?php echo e($mode === 'create' ? 'Add investment plan' : 'Edit investment plan'); ?></h1>
                    <a href="<?php echo e(route('admin.managed-investments.index')); ?>" class="btn btn-secondary btn-sm">
                        <i class="fa fa-arrow-left"></i> Back
                    </a>
                </div>
                <?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; ?>

                <div class="card shadow-sm">
                    <div class="card-body">
                        <form method="post" action="<?php echo e($mode === 'create' ? route('admin.managed-investments.store') : route('admin.managed-investments.update', $plan)); ?>">
                            <?php echo csrf_field(); ?>
                            <?php if($mode === 'edit'): ?>
                                <?php echo method_field('PUT'); ?>
                            <?php endif; ?>

                            <div class="form-row">
                                <div class="form-group col-md-6">
                                    <h5>Plan name</h5>
                                    <input class="form-control" type="text" name="name" value="<?php echo e(old('name', $plan->name)); ?>" required placeholder="Plan name">
                                </div>
                                <div class="form-group col-md-6">
                                    <h5>Plan price / max amount (<?php echo e($settings->currency); ?>)</h5>
                                    <input class="form-control" type="number" step="0.01" name="max_amount" value="<?php echo e(old('max_amount', $plan->max_amount)); ?>" required>
                                    <small class="text-muted">Maximum a user can invest in this plan.</small>
                                </div>
                                <div class="form-group col-md-6">
                                    <h5>Minimum amount (<?php echo e($settings->currency); ?>)</h5>
                                    <input class="form-control" type="number" step="0.01" name="min_amount" value="<?php echo e(old('min_amount', $plan->min_amount)); ?>" required>
                                </div>
                                <div class="form-group col-md-6">
                                    <h5>Minimum return (%)</h5>
                                    <input class="form-control" type="number" step="any" name="min_roi_percent" value="<?php echo e(old('min_roi_percent', $plan->min_roi_percent)); ?>" required>
                                    <small class="text-muted">Shown to customers; payout uses top-up amount below.</small>
                                </div>
                                <div class="form-group col-md-6">
                                    <h5>Maximum return (%)</h5>
                                    <input class="form-control" type="number" step="any" name="max_roi_percent" value="<?php echo e(old('max_roi_percent', $plan->max_roi_percent)); ?>" required>
                                </div>
                                <div class="form-group col-md-6">
                                    <h5>Gift bonus (<?php echo e($settings->currency); ?>)</h5>
                                    <input class="form-control" type="number" step="0.01" name="gift_bonus" value="<?php echo e(old('gift_bonus', $plan->gift_bonus ?? 0)); ?>" required>
                                    <small class="text-muted">One-time credit to balance when they subscribe.</small>
                                </div>
                                <div class="form-group col-md-6">
                                    <h5>Top up interval</h5>
                                    <select class="form-control" name="topup_interval" required>
                                        <?php $__currentLoopData = ['Monthly','Weekly','Daily','Hourly','Every 30 Minutes','Every 10 Minutes']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $int): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($int); ?>" <?php echo e(old('topup_interval', $plan->topup_interval ?? 'Monthly') === $int ? 'selected' : ''); ?>><?php echo e($int); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                    <small class="text-muted">How often profit is credited to the user’s balance.</small>
                                </div>
                                <div class="form-group col-md-6">
                                    <h5>Top up type</h5>
                                    <select class="form-control" name="topup_type" required>
                                        <option value="Percentage" <?php echo e(old('topup_type', $plan->topup_type ?? 'Percentage') === 'Percentage' ? 'selected' : ''); ?>>Percentage</option>
                                        <option value="Fixed" <?php echo e(old('topup_type', $plan->topup_type ?? 'Percentage') === 'Fixed' ? 'selected' : ''); ?>>Fixed</option>
                                    </select>
                                </div>
                                <div class="form-group col-md-6">
                                    <h5>Top up amount (% or <?php echo e($settings->currency); ?>)</h5>
                                    <input class="form-control" type="number" step="any" name="topup_amount" value="<?php echo e(old('topup_amount', $plan->topup_amount)); ?>" required>
                                    <small class="text-muted">Per interval: % of principal or fixed amount added to balance.</small>
                                </div>
                                <div class="form-group col-md-12">
                                    <h5>Investment duration</h5>
                                    <input class="form-control" type="text" name="investment_duration" value="<?php echo e(old('investment_duration', $plan->investment_duration ?? '12 Months')); ?>" required placeholder="e.g. 12 Months, 1 Years">
                                    <small class="text-muted">Format: number + space + unit with <strong>s</strong> (e.g. <code>1 Days</code>, <code>6 Months</code>).</small>
                                </div>
                                <div class="form-group col-md-12">
                                    <h5>Description (optional)</h5>
                                    <textarea class="form-control" name="description" rows="3" placeholder="Short summary for customers"><?php echo e(old('description', $plan->description)); ?></textarea>
                                </div>
                                <div class="form-group col-md-6">
                                    <h5>Sort order</h5>
                                    <input class="form-control" type="number" name="sort_order" value="<?php echo e(old('sort_order', $plan->sort_order ?? 0)); ?>" min="0">
                                </div>
                                <div class="form-group col-md-6 d-flex align-items-center pt-4">
                                    <div class="custom-control custom-checkbox">
                                        <input type="checkbox" class="custom-control-input" id="is_active" name="is_active" value="1" <?php if(old('is_active', $plan->is_active ?? true)): ?> checked <?php endif; ?>>
                                        <label class="custom-control-label" for="is_active">Plan is active (visible to users)</label>
                                    </div>
                                </div>
                                <div class="form-group col-md-12">
                                    <button type="submit" class="btn btn-primary"><?php echo e($mode === 'create' ? 'Create plan' : 'Save changes'); ?></button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>

                <div class="modal fade" id="durationModal" tabindex="-1">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-body">
                                <p>Use a digit, space, then timeframe with capital first letter and trailing <strong>s</strong>.</p>
                                <p class="mb-0"><strong>Examples:</strong> 1 Days, 3 Weeks, 6 Months, 1 Years</p>
                            </div>
                        </div>
                    </div>
                </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 /home/nezemgrh/bnk.nezertechy.xyz/resources/views/admin/managed-investments/plan-form.blade.php ENDPATH**/ ?>