|
29 | 29 |
|
30 | 30 | <div |
31 | 31 | v-if="status" |
32 | | - class="q-ml-xs" |
| 32 | + class="q-ml-xs no-wrap row items-center" |
33 | 33 | > |
34 | 34 | <q-icon |
35 | 35 | :name="status.icon" |
|
41 | 41 | {{ status.text }} |
42 | 42 | </q-tooltip> |
43 | 43 | </q-icon> |
| 44 | + |
| 45 | + <span |
| 46 | + v-if="status.suffix" |
| 47 | + class="status-suffix" |
| 48 | + :class="`text-${status.color}`" |
| 49 | + > |
| 50 | + {{ status.suffix }} |
| 51 | + </span> |
44 | 52 | </div> |
45 | 53 | </div> |
46 | 54 |
|
@@ -104,6 +112,7 @@ import { useQuasar } from 'quasar'; |
104 | 112 | import { useProjectStore } from 'stores/project'; |
105 | 113 | import { useProjectSettings } from 'src/composables/projectSettings'; |
106 | 114 | import PersonInfoMenu from 'components/PersonInfoMenu.vue'; |
| 115 | +import { vehicleGroupLabel } from 'src/util/group'; |
107 | 116 |
|
108 | 117 | const quasar = useQuasar(); |
109 | 118 | const projectStore = useProjectStore(); |
@@ -149,6 +158,7 @@ interface StatusInfo { |
149 | 158 | color: string; |
150 | 159 | text: string; |
151 | 160 | icon: string; |
| 161 | + suffix?: string | undefined; |
152 | 162 | } |
153 | 163 |
|
154 | 164 | const flightsLabel = computed<string>(() => { |
@@ -185,7 +195,7 @@ const status = computed<StatusInfo | undefined>(() => { |
185 | 195 | operatorInfo.value, |
186 | 196 | multiLegStatus.value, |
187 | 197 | languageStatus.value, |
188 | | - ].filter((info) => info !== false)[0]; |
| 198 | + ].find((info): info is StatusInfo => info !== false); |
189 | 199 | }); |
190 | 200 |
|
191 | 201 | const overfillStatus: StatusInfo | false = overfilled |
@@ -280,6 +290,7 @@ const multiLegStatus = computed<StatusInfo | false>(() => { |
280 | 290 | icon: 'sym_o_swap_horiz', |
281 | 291 | color: 'negative', |
282 | 292 | text: `${person.name} was assigned to different group in previous flight`, |
| 293 | + suffix: findPreviousGroupLabel(person.id), |
283 | 294 | }; |
284 | 295 | }); |
285 | 296 |
|
@@ -334,13 +345,15 @@ function onDragEnd() { |
334 | 345 | if (!person) { |
335 | 346 | return; |
336 | 347 | } |
| 348 | +
|
337 | 349 | removePersonFromVehicle(person.id); |
338 | 350 | } |
339 | 351 |
|
340 | 352 | function onEdit() { |
341 | 353 | if (!project.value || !person) { |
342 | 354 | return; |
343 | 355 | } |
| 356 | +
|
344 | 357 | quasar |
345 | 358 | .dialog({ |
346 | 359 | component: EditPersonDialog, |
@@ -381,21 +394,63 @@ function wasInSameVehicleGroupInPreviousLeg(personId: string): boolean { |
381 | 394 | return false; |
382 | 395 | } |
383 | 396 |
|
384 | | - // Collect all vehicle IDs of this group |
385 | 397 | const groupVehicleIds = [group.balloonId, ...group.carIds]; |
386 | 398 |
|
387 | | - // Check if person was in any of these vehicles in the first leg |
388 | 399 | return groupVehicleIds.some((vid) => { |
389 | 400 | const assignment = previousLeg.assignments[vid]; |
390 | 401 | if (!assignment) { |
391 | 402 | return false; |
392 | 403 | } |
| 404 | +
|
393 | 405 | return ( |
394 | 406 | assignment.operatorId === personId || |
395 | 407 | assignment.passengerIds.includes(personId) |
396 | 408 | ); |
397 | 409 | }); |
398 | 410 | } |
| 411 | +
|
| 412 | +function findPreviousGroupLabel(personId: string): string | undefined { |
| 413 | + if (isFirstLeg.value) { |
| 414 | + return undefined; |
| 415 | + } |
| 416 | +
|
| 417 | + const idx = flightSeries.legs.findIndex((l) => l.id === flightLeg.id); |
| 418 | + const previousLeg = flightSeries.legs[idx - 1]; |
| 419 | + if (!previousLeg) { |
| 420 | + return undefined; |
| 421 | + } |
| 422 | +
|
| 423 | + const previousGroupIndex = flightSeries.vehicleGroups |
| 424 | + .map((group) => [group.balloonId, ...group.carIds]) |
| 425 | + .findIndex((vehicleIds) => { |
| 426 | + return vehicleIds.some((vehicleId) => { |
| 427 | + const assignment = previousLeg.assignments[vehicleId]; |
| 428 | + if (!assignment) { |
| 429 | + return false; |
| 430 | + } |
| 431 | +
|
| 432 | + return ( |
| 433 | + assignment.operatorId === personId || |
| 434 | + assignment.passengerIds.includes(personId) |
| 435 | + ); |
| 436 | + }); |
| 437 | + }); |
| 438 | +
|
| 439 | + if (previousGroupIndex === -1) { |
| 440 | + return undefined; |
| 441 | + } |
| 442 | +
|
| 443 | + return vehicleGroupLabel(previousGroupIndex); |
| 444 | +} |
399 | 445 | </script> |
400 | 446 |
|
401 | | -<style scoped></style> |
| 447 | +<style scoped> |
| 448 | +/* Compact “badge-like” suffix aligned to the icon */ |
| 449 | +.status-suffix { |
| 450 | + margin-left: 2px; |
| 451 | + font-size: 0.8em; |
| 452 | + line-height: 1; |
| 453 | + font-weight: 600; |
| 454 | + vertical-align: middle; |
| 455 | +} |
| 456 | +</style> |
0 commit comments