<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
    <!-- Header -->
    <div class="flex items-center mb-6">
        <a href="<?php echo e(route('accounts.show', $account)); ?>" class="text-slate-400 hover:text-teal-600 mr-3 sm:mr-4 transition">
            <i class="fas fa-arrow-left text-lg sm:text-xl"></i>
        </a>
        <div>
            <h2 class="text-xl sm:text-2xl font-bold text-slate-800">Edit Akun</h2>
            <p class="text-slate-500 mt-1 text-sm"><?php echo e($account->name); ?></p>
        </div>
    </div>

    <div class="w-full max-w-2xl space-y-6">
        <!-- Edit Details Form -->
        <div class="bg-white border border-slate-100 rounded-xl sm:rounded-2xl p-4 sm:p-6 shadow-sm">
            <h3 class="text-lg font-bold text-slate-800 mb-4">Informasi Akun</h3>
            <form action="<?php echo e(route('accounts.update', $account)); ?>" method="POST" x-data="{ accountType: '<?php echo e(old('type', $account->type)); ?>' }">
                <?php echo csrf_field(); ?>
                <?php echo method_field('PUT'); ?>

                <div class="space-y-6">
                    <!-- Account Name -->
                    <div>
                        <label for="name" class="block text-sm font-medium text-slate-700 mb-2">Nama Akun</label>
                        <input type="text" id="name" name="name" value="<?php echo e(old('name', $account->name)); ?>" required
                               class="w-full bg-slate-50 border-slate-200 text-slate-800 rounded-xl focus:border-teal-500 focus:ring-teal-500">
                        <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <p class="mt-1 text-sm text-rose-500"><?php echo e($message); ?></p> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <!-- Account Type -->
                    <div>
                        <label for="type" class="block text-sm font-medium text-slate-700 mb-2">Jenis Akun</label>
                        <select id="type" name="type" x-model="accountType" required
                                class="w-full bg-slate-50 border-slate-200 text-slate-800 rounded-xl focus:border-teal-500 focus:ring-teal-500">
                            <?php $__currentLoopData = $accountTypes ?? ['cash' => 'Tunai', 'bank' => 'Bank', 'e_wallet' => 'E-Wallet', 'credit_card' => 'Kartu Kredit', 'investment' => 'Investasi', 'loan' => 'Pinjaman']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($value); ?>" <?php echo e(old('type', $account->type) === $value ? 'selected' : ''); ?>>
                                    <?php echo e($label); ?>

                                </option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                        <?php $__errorArgs = ['type'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <p class="mt-1 text-sm text-rose-500"><?php echo e($message); ?></p> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <!-- Credit Card Fields -->
                    <div x-show="accountType === 'credit_card' || accountType === 'loan'" x-cloak class="space-y-6">
                        <div class="grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-6">
                            <div>
                                <label for="credit_limit" class="block text-sm font-medium text-slate-700 mb-2">Limit Kredit</label>
                                <input type="number" id="credit_limit" name="credit_limit" step="1"
                                       value="<?php echo e(old('credit_limit', $account->credit_limit)); ?>"
                                       class="w-full bg-slate-50 border-slate-200 text-slate-800 rounded-xl focus:border-teal-500 focus:ring-teal-500">
                            </div>
                            <div>
                                <label for="interest_rate" class="block text-sm font-medium text-slate-700 mb-2">Suku Bunga (%)</label>
                                <input type="number" id="interest_rate" name="interest_rate" step="0.01"
                                       value="<?php echo e(old('interest_rate', $account->interest_rate)); ?>"
                                       class="w-full bg-slate-50 border-slate-200 text-slate-800 rounded-xl focus:border-teal-500 focus:ring-teal-500">
                            </div>
                        </div>
                    </div>

                    <!-- Bank Details -->
                    <div class="grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-6">
                        <div>
                            <label for="bank_name" class="block text-sm font-medium text-slate-700 mb-2">Nama Bank</label>
                            <input type="text" id="bank_name" name="bank_name"
                                   value="<?php echo e(old('bank_name', $account->bank_name)); ?>"
                                   class="w-full bg-slate-50 border-slate-200 text-slate-800 rounded-xl focus:border-teal-500 focus:ring-teal-500">
                        </div>
                        <div>
                            <label for="account_number" class="block text-sm font-medium text-slate-700 mb-2">Nomor Rekening</label>
                            <input type="text" id="account_number" name="account_number"
                                   value="<?php echo e(old('account_number', $account->account_number)); ?>"
                                   class="w-full bg-slate-50 border-slate-200 text-slate-800 rounded-xl focus:border-teal-500 focus:ring-teal-500">
                        </div>
                    </div>

                    <!-- Appearance -->
                    <div class="grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-6">
                        <div>
                            <label for="icon" class="block text-sm font-medium text-slate-700 mb-2">Ikon</label>
                            <select id="icon" name="icon"
                                    class="w-full bg-slate-50 border-slate-200 text-slate-800 rounded-xl focus:border-teal-500 focus:ring-teal-500">
                                <option value="wallet" <?php echo e(old('icon', $account->icon) === 'wallet' ? 'selected' : ''); ?>>👛 Dompet</option>
                                <option value="university" <?php echo e(old('icon', $account->icon) === 'university' ? 'selected' : ''); ?>>🏦 Bank</option>
                                <option value="credit-card" <?php echo e(old('icon', $account->icon) === 'credit-card' ? 'selected' : ''); ?>>💳 Kartu</option>
                                <option value="mobile-alt" <?php echo e(old('icon', $account->icon) === 'mobile-alt' ? 'selected' : ''); ?>>📱 E-Wallet</option>
                                <option value="piggy-bank" <?php echo e(old('icon', $account->icon) === 'piggy-bank' ? 'selected' : ''); ?>>🐷 Tabungan</option>
                                <option value="chart-line" <?php echo e(old('icon', $account->icon) === 'chart-line' ? 'selected' : ''); ?>>📈 Investasi</option>
                                <option value="money-bill" <?php echo e(old('icon', $account->icon) === 'money-bill' ? 'selected' : ''); ?>>💵 Uang</option>
                            </select>
                        </div>
                        <div>
                            <label for="color" class="block text-sm font-medium text-slate-700 mb-2">Warna</label>
                            <input type="color" id="color" name="color"
                                   value="<?php echo e(old('color', $account->color ?? '#14b8a6')); ?>"
                                   class="w-full h-11 bg-slate-50 border-slate-200 rounded-xl cursor-pointer">
                        </div>
                    </div>

                    <!-- Description -->
                    <div>
                        <label for="description" class="block text-sm font-medium text-slate-700 mb-2">Deskripsi</label>
                        <textarea id="description" name="description" rows="2"
                                  class="w-full bg-slate-50 border-slate-200 text-slate-800 rounded-xl focus:border-teal-500 focus:ring-teal-500 placeholder-slate-400"><?php echo e(old('description', $account->description)); ?></textarea>
                    </div>

                    <!-- Active Status -->
                    <div class="flex items-center">
                        <input type="checkbox" id="is_active" name="is_active" value="1"
                               class="rounded border-slate-300 text-teal-600 focus:ring-teal-500"
                               <?php echo e(old('is_active', $account->is_active ?? true) ? 'checked' : ''); ?>>
                        <label for="is_active" class="ml-2 text-sm text-slate-700">
                            Aktif (tampilkan di daftar akun)
                        </label>
                    </div>
                </div>

                <!-- Actions -->
                <div class="flex items-center justify-end space-x-4 mt-8 pt-6 border-t border-slate-100">
                    <a href="<?php echo e(route('accounts.show', $account)); ?>" class="px-5 py-2.5 text-slate-600 hover:text-slate-800 font-medium rounded-xl transition">Batal</a>
                    <button type="submit" class="px-6 py-2.5 bg-gradient-to-r from-teal-500 to-emerald-500 hover:from-teal-600 hover:to-emerald-600 text-white font-medium rounded-xl transition shadow-lg shadow-teal-500/30">
                        <i class="fas fa-save mr-2"></i>Simpan Perubahan
                    </button>
                </div>
            </form>
        </div>

        <!-- Balance Adjustment -->
        <div class="bg-white border border-slate-100 rounded-xl sm:rounded-2xl p-4 sm:p-6 shadow-sm">
            <h3 class="text-lg font-bold text-slate-800 mb-2">Penyesuaian Saldo</h3>
            <p class="text-sm text-slate-500 mb-4">Ubah manual saldo akun jika tidak sesuai. Sistem akan mencatatnya sebagai transaksi penyesuaian.</p>
            
            <form action="<?php echo e(route('accounts.update-balance', $account)); ?>" method="POST" class="bg-slate-50 rounded-xl p-4 sm:p-5 border border-slate-100">
                <?php echo csrf_field(); ?>
                <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
                    <div>
                        <label class="block text-sm font-medium text-slate-500 mb-1">Saldo Saat Ini</label>
                        <p class="text-xl font-bold text-slate-800">Rp <?php echo e(number_format($account->current_balance, 0, ',', '.')); ?></p>
                    </div>
                    <div>
                        <label for="new_balance" class="block text-sm font-medium text-slate-700 mb-2">Saldo Baru (Rp)</label>
                        <input type="number" id="new_balance" name="new_balance" step="1" required
                               placeholder="<?php echo e($account->current_balance); ?>"
                               class="w-full bg-white border-slate-200 text-slate-800 rounded-xl focus:border-teal-500 focus:ring-teal-500">
                    </div>
                    <div class="sm:col-span-2">
                        <label for="adjustment_note" class="block text-sm font-medium text-slate-700 mb-2">Catatan Penyesuaian</label>
                        <input type="text" id="adjustment_note" name="adjustment_note" placeholder="Contoh: Koreksi selisih saldo"
                               class="w-full bg-white border-slate-200 text-slate-800 rounded-xl focus:border-teal-500 focus:ring-teal-500">
                    </div>
                </div>
                <div class="mt-4 flex justify-end">
                    <button type="submit" class="px-5 py-2.5 bg-slate-800 text-white font-medium rounded-xl hover:bg-slate-900 transition shadow-lg shadow-slate-800/20">
                        Update Saldo
                    </button>
                </div>
            </form>
        </div>

        <!-- Danger Zone -->
        <div class="bg-white border border-rose-100 rounded-xl sm:rounded-2xl p-4 sm:p-6 shadow-sm">
            <h3 class="text-lg font-bold text-rose-600 mb-2">Zona Berbahaya</h3>
            <p class="text-sm text-slate-500 mb-4">Menghapus akun akan <?php echo e($account->transactions()->count() > 0 ? 'mengarsipkan akun ini (soft delete) karena memiliki riwayat transaksi.' : 'menghapus permanen akun ini.'); ?></p>
            
            <form action="<?php echo e(route('accounts.destroy', $account)); ?>" method="POST" onsubmit="return confirm('Apakah Anda yakin ingin menghapus akun ini?');">
                <?php echo csrf_field(); ?>
                <?php echo method_field('DELETE'); ?>
                <button type="submit" class="px-5 py-2.5 bg-rose-50 text-rose-600 border border-rose-100 font-medium rounded-xl hover:bg-rose-100 hover:text-rose-700 transition">
                    <i class="fas fa-trash-alt mr-2"></i>Hapus Akun
                </button>
            </form>
        </div>
    </div>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php /**PATH C:\xampp\htdocs\mymoney-app\resources\views\accounts\edit.blade.php ENDPATH**/ ?>