|
| 1 | +<div class="geofence-events-panel flex flex-col h-full" ...attributes> |
| 2 | + <div class="flex items-center justify-between px-4 py-2.5 border-b border-gray-200 dark:border-gray-700"> |
| 3 | + <div class="flex items-center space-x-2"> |
| 4 | + <FaIcon @icon="map-pin" class="text-blue-500 w-4 h-4" /> |
| 5 | + <h3 class="text-sm font-semibold text-gray-900 dark:text-white">Geofence Events</h3> |
| 6 | + {{#if this.events.length}} |
| 7 | + <span class="inline-flex items-center px-2 py-0.5 rounded-full text-[11px] font-medium bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300"> |
| 8 | + {{this.events.length}} |
| 9 | + </span> |
| 10 | + {{/if}} |
| 11 | + </div> |
| 12 | + <button |
| 13 | + type="button" |
| 14 | + class="text-[11px] text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors" |
| 15 | + {{on "click" this.clearFeed}} |
| 16 | + > |
| 17 | + Clear |
| 18 | + </button> |
| 19 | + </div> |
| 20 | + |
| 21 | + {{#if this.isLoading}} |
| 22 | + <div class="flex items-center justify-center py-8"> |
| 23 | + <Spinner class="w-5 h-5 text-blue-500" /> |
| 24 | + <span class="ml-2 text-sm text-gray-500">Loading events…</span> |
| 25 | + </div> |
| 26 | + {{else if (eq this.events.length 0)}} |
| 27 | + <div class="flex flex-col items-center justify-center py-10 px-4 text-center"> |
| 28 | + <FaIcon @icon="map-pin" class="w-8 h-8 text-gray-300 dark:text-gray-600 mb-3" /> |
| 29 | + <p class="text-sm font-medium text-gray-500 dark:text-gray-400">No geofence events yet</p> |
| 30 | + <p class="text-xs text-gray-400 dark:text-gray-500 mt-1"> |
| 31 | + Events will appear here in real time as drivers and vehicles cross zone and service area boundaries. |
| 32 | + </p> |
| 33 | + </div> |
| 34 | + {{else}} |
| 35 | + <div class="flex-1 overflow-y-auto divide-y divide-gray-100 dark:divide-gray-800"> |
| 36 | + {{#each this.events as |event|}} |
| 37 | + <div class="px-4 py-2.5 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors {{if event.isNew 'bg-blue-50 dark:bg-blue-900/10'}}"> |
| 38 | + <div class="flex items-start gap-2.5"> |
| 39 | + <div class="flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-md bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-300"> |
| 40 | + <FaIcon @icon={{this.iconFor event.eventType}} @size="xs" /> |
| 41 | + </div> |
| 42 | + |
| 43 | + <div class="min-w-0 flex-1"> |
| 44 | + <div class="flex items-start justify-between gap-3"> |
| 45 | + <div class="min-w-0 flex-1"> |
| 46 | + <div class="flex items-center gap-2 text-[11px] leading-4"> |
| 47 | + <span class="inline-flex items-center rounded px-1.5 py-0.5 font-medium {{this.badgeColorFor event.eventType}}"> |
| 48 | + {{this.labelFor event.eventType}} |
| 49 | + </span> |
| 50 | + <span class="inline-flex items-center gap-1 text-gray-400 dark:text-gray-500"> |
| 51 | + <FaIcon @icon={{this.subjectIconFor event.subjectType}} @size="xs" /> |
| 52 | + <span class="capitalize">{{event.subjectType}}</span> |
| 53 | + </span> |
| 54 | + <span class="text-gray-300 dark:text-gray-600">•</span> |
| 55 | + <span class="text-gray-500 dark:text-gray-400">{{this.geofenceTypeLabel event.geofenceType}}</span> |
| 56 | + </div> |
| 57 | + |
| 58 | + <div class="mt-1 flex items-center gap-1.5 text-sm leading-5"> |
| 59 | + <span class="truncate font-medium text-gray-900 dark:text-white">{{event.subjectName}}</span> |
| 60 | + <FaIcon @icon="arrow-right" @size="xs" class="text-gray-300 dark:text-gray-600" /> |
| 61 | + <span class="truncate text-gray-600 dark:text-gray-300">{{event.geofenceName}}</span> |
| 62 | + </div> |
| 63 | + |
| 64 | + <div class="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] leading-4 text-gray-500 dark:text-gray-400"> |
| 65 | + {{#if event.driverName}} |
| 66 | + {{#unless (eq event.subjectType "driver")}} |
| 67 | + <span class="inline-flex items-center gap-1"> |
| 68 | + <FaIcon @icon="id-card" @size="xs" class="text-gray-400" /> |
| 69 | + {{event.driverName}} |
| 70 | + </span> |
| 71 | + {{/unless}} |
| 72 | + {{/if}} |
| 73 | + |
| 74 | + {{#if event.vehiclePlate}} |
| 75 | + <span class="inline-flex items-center gap-1"> |
| 76 | + <FaIcon @icon="car" @size="xs" class="text-gray-400" /> |
| 77 | + {{event.vehiclePlate}} |
| 78 | + </span> |
| 79 | + {{/if}} |
| 80 | + |
| 81 | + {{#if event.orderPublicId}} |
| 82 | + <span class="inline-flex items-center gap-1"> |
| 83 | + <FaIcon @icon="hashtag" @size="xs" class="text-gray-400" /> |
| 84 | + {{event.orderPublicId}} |
| 85 | + </span> |
| 86 | + {{/if}} |
| 87 | + |
| 88 | + {{#if event.dwellMinutes}} |
| 89 | + <span class="inline-flex items-center gap-1"> |
| 90 | + <FaIcon @icon="clock" @size="xs" class="text-gray-400" /> |
| 91 | + {{event.dwellMinutes}} min |
| 92 | + </span> |
| 93 | + {{/if}} |
| 94 | + |
| 95 | + {{#if event.latitude}} |
| 96 | + {{#if event.longitude}} |
| 97 | + <span class="inline-flex items-center gap-1"> |
| 98 | + <FaIcon @icon="location-dot" @size="xs" class="text-gray-400" /> |
| 99 | + {{event.latitude}}, {{event.longitude}} |
| 100 | + </span> |
| 101 | + {{/if}} |
| 102 | + {{/if}} |
| 103 | + </div> |
| 104 | + </div> |
| 105 | + |
| 106 | + <div class="flex-shrink-0 text-right"> |
| 107 | + <div class="text-[11px] leading-4 text-gray-500 dark:text-gray-400"> |
| 108 | + {{format-date-fns event.occurredAt "dd MMM, HH:mm"}} |
| 109 | + </div> |
| 110 | + {{#if event.isNew}} |
| 111 | + <div class="mt-1 text-[10px] font-medium uppercase tracking-wide text-blue-500 dark:text-blue-300"> |
| 112 | + Live |
| 113 | + </div> |
| 114 | + {{/if}} |
| 115 | + </div> |
| 116 | + </div> |
| 117 | + </div> |
| 118 | + </div> |
| 119 | + </div> |
| 120 | + {{/each}} |
| 121 | + </div> |
| 122 | + {{/if}} |
| 123 | +</div> |
0 commit comments