<?php $__env->startSection('header', 'Appointment Details'); ?>
<?php $__env->startSection('content'); ?>
<div class="bg-white rounded shadow p-6 max-w-4xl">
    
    <?php if(session('success')): ?>
    <div class="mb-6 bg-green-50 border-l-4 border-green-500 p-4 rounded-md">
        <p class="text-sm text-green-700 font-medium"><?php echo e(session('success')); ?></p>
    </div>
    <?php endif; ?>

    <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
        <div>
            <h3 class="text-lg font-bold text-gray-900 mb-2">Patient Information</h3>
            <p class="text-gray-700"><strong>Name:</strong> <?php echo e($appointment->name); ?></p>
            <p class="text-gray-700"><strong>Email:</strong> <?php echo e($appointment->email); ?></p>
            <p class="text-gray-700"><strong>Phone:</strong> <?php echo e($appointment->phone); ?></p>
        </div>
        <div>
            <h3 class="text-lg font-bold text-gray-900 mb-2">Appointment Details</h3>
            <p class="text-gray-700"><strong>Service:</strong> <?php echo e($appointment->service ?? 'N/A'); ?></p>
            <p class="text-gray-700"><strong>Preferred Date:</strong> <?php echo e($appointment->preferred_date ? \Carbon\Carbon::parse($appointment->preferred_date)->format('M d, Y') : 'Anytime'); ?></p>
            <p class="text-gray-700"><strong>Preferred Time:</strong> <?php echo e($appointment->preferred_time ?? 'Anytime'); ?></p>
            <p class="text-gray-700"><strong>Requested On:</strong> <?php echo e($appointment->created_at->format('M d, Y H:i A')); ?></p>
        </div>
    </div>

    <?php if($appointment->message): ?>
    <div class="mb-8">
        <h3 class="text-lg font-bold text-gray-900 mb-2">Additional Notes</h3>
        <div class="bg-gray-50 p-4 rounded-md border text-gray-800 whitespace-pre-wrap"><?php echo e($appointment->message); ?></div>
    </div>
    <?php endif; ?>

    <div class="border-t pt-6 mb-6">
        <h3 class="text-lg font-bold text-gray-900 mb-4">Update Status</h3>
        <form action="<?php echo e(route('admin.appointments.update', $appointment)); ?>" method="POST" class="flex items-center space-x-4">
            <?php echo csrf_field(); ?>
            <?php echo method_field('PUT'); ?>
            <select name="status" class="form-select rounded-md border-gray-300 shadow-sm focus:border-teal-300 focus:ring focus:ring-teal-200 focus:ring-opacity-50">
                <option value="pending" <?php echo e($appointment->status === 'pending' ? 'selected' : ''); ?>>Pending</option>
                <option value="confirmed" <?php echo e($appointment->status === 'confirmed' ? 'selected' : ''); ?>>Confirmed</option>
                <option value="completed" <?php echo e($appointment->status === 'completed' ? 'selected' : ''); ?>>Completed</option>
                <option value="cancelled" <?php echo e($appointment->status === 'cancelled' ? 'selected' : ''); ?>>Cancelled</option>
            </select>
            <button type="submit" class="bg-teal-600 text-white px-4 py-2 rounded hover:bg-teal-700">Update Status</button>
        </form>
    </div>

    <div class="mt-6 flex justify-between border-t pt-6">
        <a href="<?php echo e(route('admin.appointments.index')); ?>" class="bg-gray-200 text-gray-700 px-4 py-2 rounded">Back to Appointments</a>
        <form action="<?php echo e(route('admin.appointments.destroy', $appointment)); ?>" method="POST" onsubmit="return confirm('Delete this appointment?');">
            <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
            <button type="submit" class="bg-red-600 text-white px-4 py-2 rounded hover:bg-red-700">Delete Appointment</button>
        </form>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /Users/sumankc/Desktop/ Websites/Dr Rajan/resources/views/admin/appointments/show.blade.php ENDPATH**/ ?>