

<?php $__env->startSection('page_title', 'Our Stories'); ?>
<?php $__env->startSection('page_subtitle', 'Read about our impact, volunteer experiences, and latest community updates.'); ?>

<?php use Illuminate\Support\Str; ?>

<?php $__env->startSection('content'); ?>
<section class="section blog-section" style="padding-top: 40px;">
    <div class="container">
        <div class="page-header" style="text-align: center; margin-bottom: 50px;">
            <?php if(auth()->guard()->check()): ?>
                <div>
                    <a class="button button-primary" href="<?php echo e(route('blog.create')); ?>">+ Create New Post</a>
                </div>
            <?php endif; ?>
        </div>

        <?php if(session('success')): ?>
            <div class="alert alert-success"><?php echo e(session('success')); ?></div>
        <?php endif; ?>

        <?php if($posts->isEmpty()): ?>
            <div class="empty-state">
                <div style="font-size: 4rem; margin-bottom: 20px;">✍️</div>
                <p>No blog posts yet. Be the first to share a story from our community.</p>
            </div>
        <?php else: ?>
            <div class="blog-grid">
                <?php $__currentLoopData = $posts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $post): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <article class="post-card">
                        <?php if($post->image_path): ?>
                            <div class="post-card-image">
                                <a href="<?php echo e(route('blog.show', $post)); ?>">
                                    <img src="<?php echo e(asset('storage/' . $post->image_path)); ?>" alt="<?php echo e($post->title); ?>">
                                </a>
                            </div>
                        <?php endif; ?>
                        <div class="post-card-content">
                            <h2><a href="<?php echo e(route('blog.show', $post)); ?>"><?php echo e($post->title); ?></a></h2>
                            <p><?php echo e($post->excerpt ?? Str::limit(strip_tags($post->content), 120)); ?></p>
                            <div class="post-meta">
                                <span style="font-size: 0.85rem; color: #999;"><?php echo e($post->created_at->format('M d, Y')); ?></span>
                                <div style="display: flex; gap: 15px; align-items: center;">
                                    <?php if(auth()->guard()->check()): ?>
                                        <form action="<?php echo e(route('blog.destroy', $post)); ?>" method="POST" onsubmit="return confirm('Are you sure you want to delete this post?')">
                                            <?php echo csrf_field(); ?>
                                            <?php echo method_field('DELETE'); ?>
                                            <button type="submit" style="background: none; border: none; color: #ff4d4d; cursor: pointer; font-weight: 700; font-size: 0.85rem; text-transform: uppercase;">Delete</button>
                                        </form>
                                    <?php endif; ?>
                                    <a href="<?php echo e(route('blog.show', $post)); ?>" class="read-more">Read Article →</a>
                                </div>
                            </div>
                        </div>
                    </article>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>

            <div style="margin-top: 60px;">
                <?php echo e($posts->links()); ?>

            </div>
        <?php endif; ?>
    </div>
</section>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\wamp64\www\Touchfoundation\resources\views/pages/blog.blade.php ENDPATH**/ ?>