<?php $__env->startSection('content'); ?>
<div class="container-xxl flex-grow-1 container-p-y">
  <div class="card mb-4">
    <div class="card-body">
      <form class="row g-2" method="GET" action="<?php echo e(route('messages.index')); ?>">
        <div class="col-md-9">
          <select name="subscription_id" class="form-select">
            <option value="">All subscriptions</option>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $subscriptions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $subscription): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <option value="<?php echo e($subscription->id); ?>" <?php if((string)$subscriptionId === (string)$subscription->id): echo 'selected'; endif; ?>>
                <?php echo e($subscription->title ?: ($subscription->service->name . ' - ' . $subscription->servicePlan->name)); ?>

              </option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
          </select>
        </div>
        <div class="col-md-3 d-grid"><button class="btn btn-outline-primary">Filter</button></div>
      </form>
    </div>
  </div>

  <div class="row g-4">
    <div class="col-md-5">
      <div class="card">
        <div class="card-header"><h6 class="mb-0">Send Message</h6></div>
        <div class="card-body">
          <form method="POST" action="<?php echo e(route('messages.store')); ?>" class="row g-2">
            <?php echo csrf_field(); ?>
            <div class="col-12"><input type="number" name="shared_subscription_id" class="form-control" placeholder="Subscription ID (optional)"></div>
            <div class="col-12"><input type="number" name="receiver_id" class="form-control" placeholder="Receiver User ID (optional)"></div>
            <div class="col-12"><textarea name="message" rows="4" class="form-control" placeholder="Write message..." required></textarea></div>
            <div class="col-12 d-grid"><button class="btn btn-primary">Send</button></div>
          </form>
        </div>
      </div>
    </div>

    <div class="col-md-7">
      <div class="card">
        <div class="card-header"><h5 class="mb-0">Messages</h5></div>
        <div class="list-group list-group-flush">
          <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $messages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $msg): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
          <div class="list-group-item">
            <div class="d-flex justify-content-between">
              <strong><?php echo e($msg->sender->name ?? 'Unknown'); ?></strong>
              <small><?php echo e($msg->created_at->format('Y-m-d H:i')); ?></small>
            </div>
            <div><?php echo e($msg->message); ?></div>
            <small class="text-muted">Sub #<?php echo e($msg->shared_subscription_id ?? 'N/A'); ?> | To: <?php echo e($msg->receiver->name ?? 'Group'); ?></small>
          </div>
          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
          <div class="list-group-item text-center py-4">No messages found.</div>
          <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>
        <div class="card-body"><?php echo e($messages->links()); ?></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 F:\xampp\htdocs\G_desizn\marketplace\resources\views\messages\index.blade.php ENDPATH**/ ?>