userstory_timeline.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <?php include 'admin_header.php'; ?>
  2. <style>
  3. .us-timeline {
  4. position: relative;
  5. padding: 20px 0;
  6. max-width: 700px;
  7. margin: 0 auto;
  8. }
  9. .us-timeline::before {
  10. content: '';
  11. position: absolute;
  12. left: 84px;
  13. top: 0;
  14. bottom: 0;
  15. width: 3px;
  16. background: #3c8dbc;
  17. }
  18. .us-event {
  19. position: relative;
  20. margin-bottom: 0;
  21. padding-left: 120px;
  22. padding-bottom: 30px;
  23. }
  24. .us-event:last-child {
  25. padding-bottom: 0;
  26. }
  27. .us-event-number {
  28. position: absolute;
  29. left: 0;
  30. top: 5px;
  31. font-size: 48px;
  32. font-weight: 700;
  33. color: #d2d6de;
  34. line-height: 1;
  35. text-align: right;
  36. width: 60px;
  37. }
  38. .us-event-dot {
  39. position: absolute;
  40. left: 75px;
  41. top: 18px;
  42. width: 22px;
  43. height: 22px;
  44. border-radius: 50%;
  45. background: #3c8dbc;
  46. border: 3px solid #fff;
  47. box-shadow: 0 0 0 2px #3c8dbc;
  48. z-index: 1;
  49. }
  50. .us-event-dot.uuid_change {
  51. background: #f39c12;
  52. box-shadow: 0 0 0 2px #f39c12;
  53. }
  54. .us-event-dot.redirect,
  55. .us-event-dot.return {
  56. background: #00a65a;
  57. box-shadow: 0 0 0 2px #00a65a;
  58. }
  59. .us-event-dot.ajax_request {
  60. background: #605ca8;
  61. box-shadow: 0 0 0 2px #605ca8;
  62. }
  63. .us-event-dot.ajax_response {
  64. background: #00c0ef;
  65. box-shadow: 0 0 0 2px #00c0ef;
  66. }
  67. .us-event-card {
  68. background: #fff;
  69. border: 1px solid #ddd;
  70. border-left: 4px solid #3c8dbc;
  71. border-radius: 4px;
  72. padding: 14px 18px;
  73. box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  74. transition: box-shadow 0.2s;
  75. }
  76. .us-event-card:hover {
  77. box-shadow: 0 3px 12px rgba(0,0,0,0.12);
  78. }
  79. .us-event-card.uuid_change {
  80. border-left-color: #f39c12;
  81. }
  82. .us-event-card.redirect,
  83. .us-event-card.return {
  84. border-left-color: #00a65a;
  85. }
  86. .us-event-card.ajax_request {
  87. border-left-color: #605ca8;
  88. }
  89. .us-event-card.ajax_response {
  90. border-left-color: #00c0ef;
  91. }
  92. .us-event-type {
  93. font-size: 16px;
  94. font-weight: 700;
  95. margin-bottom: 2px;
  96. }
  97. .us-event-name {
  98. font-size: 14px;
  99. color: #555;
  100. margin-bottom: 6px;
  101. }
  102. .us-event-time {
  103. font-size: 12px;
  104. font-style: italic;
  105. color: #888;
  106. margin-bottom: 4px;
  107. }
  108. .us-event-meta {
  109. font-size: 11px;
  110. color: #aaa;
  111. }
  112. .us-event-meta span {
  113. margin-right: 15px;
  114. }
  115. .us-event-url {
  116. display: inline-block;
  117. max-width: 350px;
  118. overflow: hidden;
  119. text-overflow: ellipsis;
  120. white-space: nowrap;
  121. vertical-align: bottom;
  122. cursor: default;
  123. }
  124. .us-event-data {
  125. margin-top: 8px;
  126. padding: 8px 10px;
  127. background: #f7f7f7;
  128. border-radius: 3px;
  129. font-size: 12px;
  130. font-family: monospace;
  131. word-break: break-all;
  132. max-height: 200px;
  133. overflow-y: auto;
  134. display: none;
  135. }
  136. .us-event-toggle {
  137. cursor: pointer;
  138. color: #3c8dbc;
  139. font-size: 11px;
  140. margin-top: 6px;
  141. display: inline-block;
  142. }
  143. .us-event-toggle:hover {
  144. text-decoration: underline;
  145. }
  146. .us-badge {
  147. display: inline-block;
  148. padding: 2px 8px;
  149. border-radius: 3px;
  150. color: #fff;
  151. font-size: 11px;
  152. font-weight: 600;
  153. }
  154. .us-badge.click { background: #3c8dbc; }
  155. .us-badge.page_view { background: #3c8dbc; }
  156. .us-badge.ajax_request { background: #605ca8; }
  157. .us-badge.ajax_response { background: #00c0ef; }
  158. .us-badge.redirect { background: #00a65a; }
  159. .us-badge.return { background: #00a65a; }
  160. .us-badge.uuid_change { background: #f39c12; }
  161. .us-badge.form_submit { background: #d81b60; }
  162. </style>
  163. <div class="content-wrapper">
  164. <section class="content-header">
  165. <h1>
  166. User Story Timeline
  167. <small><code><?=htmlspecialchars($uuid)?></code></small>
  168. </h1>
  169. <div style="margin-top: 10px;">
  170. <a href="/userstory" class="btn btn-default btn-sm"><i class="fa fa-arrow-left"></i> Back to list</a>
  171. </div>
  172. </section>
  173. <section class="content">
  174. <div class="box box-info">
  175. <div class="box-header with-border">
  176. <h3 class="box-title"><i class="fa fa-clock-o"></i> Timeline</h3>
  177. <span class="badge bg-blue pull-right"><?=count($events)?> events</span>
  178. </div>
  179. <div class="box-body">
  180. <div class="us-timeline">
  181. <?php foreach ($events as $i => $event) : ?>
  182. <div class="us-event">
  183. <div class="us-event-number"><?=$i + 1?></div>
  184. <div class="us-event-dot <?=htmlspecialchars($event->event_type)?>"></div>
  185. <div class="us-event-card <?=htmlspecialchars($event->event_type)?>">
  186. <div class="us-event-type">
  187. <span class="us-badge <?=htmlspecialchars($event->event_type)?>"><?=htmlspecialchars($event->event_type)?></span>
  188. <?=htmlspecialchars($event->event_name)?>
  189. </div>
  190. <div class="us-event-time"><?=$event->created_at?></div>
  191. <div class="us-event-meta">
  192. <span><i class="fa fa-globe"></i> <?=htmlspecialchars($event->ip_address ?: '-')?></span>
  193. <span><i class="fa fa-link"></i> <span class="us-event-url" title="<?=htmlspecialchars($event->page_url ?: '-')?>"><?=htmlspecialchars($event->page_url ?: '-')?></span></span>
  194. </div>
  195. <?php if ($event->event_type === 'uuid_change' && !empty($event->previous_uuid)) : ?>
  196. <div class="us-event-meta" style="margin-top: 4px;">
  197. <span><i class="fa fa-exchange"></i> <strong><?=htmlspecialchars($event->previous_uuid)?></strong> &rarr; <strong><?=htmlspecialchars($event->uuid)?></strong></span>
  198. </div>
  199. <?php endif; ?>
  200. <?php if (!empty($event->hotel)) : ?>
  201. <div class="us-event-meta" style="margin-top: 4px;">
  202. <span><i class="fa fa-building"></i> Hotel: <?=htmlspecialchars($event->hotel)?></span>
  203. </div>
  204. <?php endif; ?>
  205. <?php if (!empty($event->order_id)) : ?>
  206. <div class="us-event-meta" style="margin-top: 4px;">
  207. <span><i class="fa fa-shopping-cart"></i> Order: <?=htmlspecialchars($event->order_id)?></span>
  208. </div>
  209. <?php endif; ?>
  210. <?php if (!empty($event->event_data) && $event->event_data !== '""') : ?>
  211. <span class="us-event-toggle" onclick="$(this).next().slideToggle(200)"><i class="fa fa-code"></i> Show data</span>
  212. <div class="us-event-data"><pre style="margin:0;white-space:pre-wrap;"><?=htmlspecialchars($event->event_data)?></pre></div>
  213. <?php endif; ?>
  214. <?php if (!empty($event->cart) && $event->cart !== '""') : ?>
  215. <span class="us-event-toggle" onclick="$(this).next().slideToggle(200)"><i class="fa fa-shopping-basket"></i> Show cart</span>
  216. <div class="us-event-data"><pre style="margin:0;white-space:pre-wrap;"><?=htmlspecialchars($event->cart)?></pre></div>
  217. <?php endif; ?>
  218. </div>
  219. </div>
  220. <?php endforeach; ?>
  221. </div>
  222. </div>
  223. </div>
  224. </section>
  225. </div>
  226. <?php include 'admin_footer.php'; ?>