<?php
require_login
();

// Show workflows
$result mysqli_query($conn'SELECT pk_Workflow, title FROM TICKET_Workflow');
$hasWorkflows mysqli_num_rows($result) > 0;
?>
<div class="page-request-create">
  <div class="page-header">
    <h1 class="page-title">Create New Request</h1>
    <p class="page-subtitle">Select a workflow to start your request</p>
  </div>
  
  <?php if ($hasWorkflows): ?>
    <div class="workflows-grid">
      <?php while ($wf mysqli_fetch_assoc($result)): ?>
        <a href="index.php?page=request_fill&wf=<?= $wf['pk_Workflow'?>" class="workflow-card">
          <div class="workflow-icon">📋</div>
          <h3 class="workflow-title"><?= htmlspecialchars($wf['title']) ?></h3>
          <p class="workflow-description">
            Start a new request using this workflow. Follow the guided steps to complete your submission.
          </p>
          <span class="workflow-action">Start Request</span>
        </a>
      <?php endwhile; ?>
    </div>
  <?php else: ?>
    <div class="empty-state">
      <div class="empty-state-icon">📋</div>
      <h3 class="empty-state-title">No Workflows Available</h3>
      <p>There are no workflows available for creating requests. Please contact an administrator.</p>
    </div>
  <?php endif; ?>
</div>