list.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <?php
  2. ob_start();
  3. ?>
  4. <div class="min-h-screen bg-gray-50 py-6">
  5. <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
  6. <!-- Header -->
  7. <div class="md:flex md:items-center md:justify-between mb-8">
  8. <div class="flex-1 min-w-0">
  9. <h2 class="text-2xl font-bold leading-7 text-gray-900 sm:text-3xl sm:truncate">
  10. Slot Management
  11. </h2>
  12. <p class="mt-1 text-sm text-gray-500">
  13. Manage casino slots and games
  14. </p>
  15. </div>
  16. <div class="mt-4 flex md:mt-0 md:ml-4">
  17. <a href="/admin/slots/?action=create"
  18. class="ml-3 inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors">
  19. <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
  20. <path fill-rule="evenodd" d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z" clip-rule="evenodd"/>
  21. </svg>
  22. Add New Slot
  23. </a>
  24. </div>
  25. </div>
  26. <!-- Success/Error Messages -->
  27. <?php if (isset($success)): ?>
  28. <div class="mb-6 bg-green-50 border border-green-200 rounded-md p-4">
  29. <div class="flex">
  30. <div class="flex-shrink-0">
  31. <svg class="h-5 w-5 text-green-400" viewBox="0 0 20 20" fill="currentColor">
  32. <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
  33. </svg>
  34. </div>
  35. <div class="ml-3">
  36. <p class="text-sm font-medium text-green-800"><?= htmlspecialchars($success) ?></p>
  37. </div>
  38. </div>
  39. </div>
  40. <?php endif; ?>
  41. <?php if (isset($error)): ?>
  42. <div class="mb-6 bg-red-50 border border-red-200 rounded-md p-4">
  43. <div class="flex">
  44. <div class="flex-shrink-0">
  45. <svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor">
  46. <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/>
  47. </svg>
  48. </div>
  49. <div class="ml-3">
  50. <p class="text-sm font-medium text-red-800"><?= htmlspecialchars($error) ?></p>
  51. </div>
  52. </div>
  53. </div>
  54. <?php endif; ?>
  55. <!-- Slots Table -->
  56. <div class="bg-white shadow overflow-hidden sm:rounded-md">
  57. <div class="px-4 py-5 sm:px-6 border-b border-gray-200">
  58. <h3 class="text-lg leading-6 font-medium text-gray-900">All Slots</h3>
  59. <p class="mt-1 max-w-2xl text-sm text-gray-500">A list of all slots in the system.</p>
  60. </div>
  61. <?php if (empty($slots)): ?>
  62. <div class="text-center py-12">
  63. <svg class="mx-auto h-12 w-12 text-gray-400" stroke="currentColor" fill="none" viewBox="0 0 48 48">
  64. <path d="M34 40h10v-4a6 6 0 00-10.712-3.714M34 40H14m20 0v-4a9.971 9.971 0 00-.712-3.714M14 40H4v-4a6 6 0 0110.713-3.714M14 40v-4c0-1.313.253-2.566.713-3.714m0 0A9.971 9.971 0 0124 24c4.004 0 7.625 2.349 9.287 6m-9.287-6C16.348 24 12.723 26.349 11.061 30M4 16l4-4m0 0l4-4m-4 4L4 4m4 4v12"/>
  65. </svg>
  66. <h3 class="mt-2 text-sm font-medium text-gray-900">No slots</h3>
  67. <p class="mt-1 text-sm text-gray-500">Get started by creating a new slot.</p>
  68. <div class="mt-6">
  69. <a href="/admin/slots/?action=create" class="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
  70. <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
  71. <path fill-rule="evenodd" d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z" clip-rule="evenodd"/>
  72. </svg>
  73. Add Slot
  74. </a>
  75. </div>
  76. </div>
  77. <?php else: ?>
  78. <div class="overflow-x-auto">
  79. <table class="min-w-full divide-y divide-gray-200">
  80. <thead class="bg-gray-50">
  81. <tr>
  82. <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
  83. Slot
  84. </th>
  85. <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
  86. Provider
  87. </th>
  88. <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
  89. RTP
  90. </th>
  91. <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
  92. Created
  93. </th>
  94. <th scope="col" class="relative px-6 py-3">
  95. <span class="sr-only">Actions</span>
  96. </th>
  97. </tr>
  98. </thead>
  99. <tbody class="bg-white divide-y divide-gray-200">
  100. <?php foreach ($slots as $slot): ?>
  101. <tr class="hover:bg-gray-50">
  102. <td class="px-6 py-4 whitespace-nowrap">
  103. <div class="flex items-center">
  104. <?php if (!empty($slot['image'])): ?>
  105. <div class="flex-shrink-0 h-10 w-10">
  106. <img class="h-10 w-10 rounded-lg object-cover" src="/<?= htmlspecialchars($slot['image']) ?>" alt="<?= htmlspecialchars($slot['name']) ?>">
  107. </div>
  108. <?php else: ?>
  109. <div class="flex-shrink-0 h-10 w-10 bg-gray-300 rounded-lg flex items-center justify-center">
  110. <svg class="h-6 w-6 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  111. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
  112. </svg>
  113. </div>
  114. <?php endif; ?>
  115. <div class="ml-4">
  116. <div class="text-sm font-medium text-gray-900"><?= htmlspecialchars($slot['name']) ?></div>
  117. <?php if (!empty($slot['demo_url'])): ?>
  118. <div class="text-sm text-gray-500">
  119. <a href="<?= htmlspecialchars($slot['demo_url']) ?>" target="_blank" class="text-blue-600 hover:text-blue-800">Demo available</a>
  120. </div>
  121. <?php endif; ?>
  122. </div>
  123. </div>
  124. </td>
  125. <td class="px-6 py-4 whitespace-nowrap">
  126. <div class="text-sm text-gray-900"><?= htmlspecialchars($slot['provider'] ?? 'N/A') ?></div>
  127. </td>
  128. <td class="px-6 py-4 whitespace-nowrap">
  129. <div class="text-sm text-gray-900"><?= $slot['rtp'] ? number_format($slot['rtp'], 2) . '%' : 'N/A' ?></div>
  130. </td>
  131. <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
  132. <?= date('M j, Y', strtotime($slot['created_at'])) ?>
  133. </td>
  134. <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
  135. <div class="flex items-center justify-end space-x-2">
  136. <a href="/admin/slots/?action=edit&id=<?= $slot['id'] ?>"
  137. class="text-blue-600 hover:text-blue-900 font-medium">Edit</a>
  138. <form method="POST" class="inline" onsubmit="return confirm('Are you sure you want to delete this slot?');">
  139. <input type="hidden" name="action" value="delete">
  140. <input type="hidden" name="id" value="<?= $slot['id'] ?>">
  141. <button type="submit" class="text-red-600 hover:text-red-900 font-medium ml-2">Delete</button>
  142. </form>
  143. </div>
  144. </td>
  145. </tr>
  146. <?php endforeach; ?>
  147. </tbody>
  148. </table>
  149. </div>
  150. <?php endif; ?>
  151. </div>
  152. </div>
  153. </div>
  154. <?php
  155. $content = ob_get_clean();
  156. include __DIR__ . '/../partials/layout.php';
  157. ?>