Skip to content

Commit

Permalink
feat: tweak citizen job props display by adding a wildcard to custom
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Trost <[email protected]>
  • Loading branch information
galexrt committed Sep 27, 2024
1 parent a077b3c commit a7cff85
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/components/citizens/CitizensList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ defineShortcuts({
</template>
<template #jobLabel-data="{ row: citizen }">
{{ citizen.jobLabel.value }}
{{ citizen.props?.jobName || citizen.props?.jobGradeNumber ? '*' : '' }}
</template>
<template #sex-data="{ row: citizen }">
{{ citizen.sex?.value.toUpperCase() ?? $t('common.na') }}
Expand Down
2 changes: 1 addition & 1 deletion app/components/citizens/info/CitizenInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const isOpen = ref(false);
<template v-if="user.jobGrade > 0 && user.job !== game.unemployedJobName">
({{ $t('common.rank') }}: {{ user.jobGradeLabel }})
</template>
{{ user.props?.jobGrade ? '*' : '' }}
{{ user.props?.jobName || user.props?.jobGradeNumber ? '*' : '' }}
</UBadge>
<UBadge v-if="user?.props?.wanted" color="red">
Expand Down
5 changes: 2 additions & 3 deletions app/components/jobs/timeclock/TimeclockInactiveList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,15 @@ const columns = [
class="flex-1"
>
<template #name-data="{ row: colleague }">
<div class="inline-flex items-center">
<div class="inline-flex items-center gap-1 text-gray-900 dark:text-white">
<ProfilePictureImg
:src="colleague.avatar?.url"
:name="`${colleague.firstname} ${colleague.lastname}`"
size="sm"
:enable-popup="true"
class="mr-2"
/>
{{ colleague.firstname }} {{ colleague.lastname }}
<span> {{ colleague.firstname }} {{ colleague.lastname }} </span>
</div>
<dl class="font-normal lg:hidden">
<dt class="sr-only">{{ $t('common.job_grade') }}</dt>
Expand Down
8 changes: 7 additions & 1 deletion app/components/partials/WebSocketStatusOverlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const status = useDebounce(webSocket.status, 150);
const notificationId = ref<string | undefined>();
const overlay = ref<HTMLDivElement | null>(null);
async function checkWebSocketStatus(previousStatus: WebSocketStatus, status: WebSocketStatus): Promise<void> {
if (notificationId.value !== undefined && status === 'OPEN') {
toast.remove(notificationId.value);
Expand All @@ -28,6 +30,8 @@ async function checkWebSocketStatus(previousStatus: WebSocketStatus, status: Web
description: t('notifications.grpc_errors.available.content'),
timeout: timeouts.notification,
});
overlay.value?.blur();
} else if (previousStatus === 'CONNECTING' && status === 'CLOSED') {
if (notificationId.value !== undefined) {
return;
Expand Down Expand Up @@ -61,6 +65,8 @@ async function checkWebSocketStatus(previousStatus: WebSocketStatus, status: Web
},
],
});
overlay.value?.focus();
}
}
Expand All @@ -84,7 +90,7 @@ useTimeoutFn(() => {
</script>

<template>
<div v-if="notificationId" class="relative z-150">
<div v-if="notificationId" ref="overlay" class="relative z-150">
<div class="fixed inset-0 bg-gray-200/75 transition-opacity dark:bg-gray-800/75" />

<div class="fixed inset-0 overflow-y-auto">
Expand Down
7 changes: 7 additions & 0 deletions gen/go/proto/services/citizenstore/citizenstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,28 +129,34 @@ func (s *Server) ListCitizens(ctx context.Context, req *ListCitizensRequest) (*L
phoneNumber := strings.ReplaceAll(strings.ReplaceAll(*req.PhoneNumber, "%", ""), " ", "") + "%"
condition = condition.AND(tUser.PhoneNumber.LIKE(jet.String(phoneNumber)))
}

case "UserProps.Wanted":
selectors = append(selectors, tUserProps.Wanted)

if req.Wanted != nil && *req.Wanted {
condition = condition.AND(tUserProps.Wanted.IS_TRUE())
}

case "UserProps.Job":
selectors = append(selectors, tUserProps.Job, tUserProps.JobGrade)

case "UserProps.TrafficInfractionPoints":
selectors = append(selectors, tUserProps.TrafficInfractionPoints)

if req.TrafficInfractionPoints != nil && *req.TrafficInfractionPoints > 0 {
condition = condition.AND(tUserProps.TrafficInfractionPoints.GT_EQ(jet.Uint32(*req.TrafficInfractionPoints)))
}

case "UserProps.OpenFines":
selectors = append(selectors, tUserProps.OpenFines)

if req.OpenFines != nil && *req.OpenFines > 0 {
condition = condition.AND(tUserProps.OpenFines.GT_EQ(jet.Uint64(*req.OpenFines)))
}

case "UserProps.BloodType":
selectors = append(selectors, tUserProps.BloodType)

case "UserProps.MugShot":
selectors = append(selectors, tUserProps.MugShot)
}
Expand All @@ -159,6 +165,7 @@ func (s *Server) ListCitizens(ctx context.Context, req *ListCitizensRequest) (*L
req.Search = strings.TrimSpace(req.Search)
req.Search = strings.ReplaceAll(req.Search, "%", "")
req.Search = strings.ReplaceAll(req.Search, " ", "%")
req.Search = strings.ReplaceAll(req.Search, "\t", " ")
if req.Search != "" {
req.Search = "%" + req.Search + "%"
condition = condition.AND(
Expand Down

0 comments on commit a7cff85

Please sign in to comment.