Skip to content

Commit

Permalink
fix: a lot of issues found while using fivenet in-game
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Trost <[email protected]>
  • Loading branch information
galexrt committed Oct 13, 2024
1 parent 03d028a commit 7b05ea1
Show file tree
Hide file tree
Showing 35 changed files with 326 additions and 100 deletions.
12 changes: 12 additions & 0 deletions app/components/calendar/FindCalendarsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type { ListCalendarsResponse, SubscribeToCalendarResponse } from '~~/gen/
const { isOpen } = useModal();
const calendarStore = useCalendarStore();
const { currentDate } = storeToRefs(calendarStore);
const page = ref(1);
const offset = computed(() => (data.value?.pagination?.pageSize ? data.value?.pagination?.pageSize * (page.value - 1) : 0));
Expand Down Expand Up @@ -43,6 +44,17 @@ async function subscribeToCalendar(calendarId: string, subscribe: boolean): Prom
const calendar = data.value?.calendars.find((c) => c.id === calendarId);
if (calendar) {
calendar.subscription = response.sub;
// Update calendar list and entries if necessary after (un-)subscribing
await calendarStore.listCalendars({
onlyPublic: false,
});
calendarStore.listCalendarEntries({
calendarIds: [calendarId],
year: currentDate.value.year,
month: currentDate.value.month,
});
}
return response;
Expand Down
29 changes: 28 additions & 1 deletion app/components/centrum/settings/CentrumSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ const schema = z.object({
unitStatus: z.string().array().max(10),
dispatchStatus: z.string().array().max(10),
timings: z.object({
dispatchMaxWait: z.coerce.number().min(60).max(6000),
dispatchMaxWait: z.coerce.number().min(30).max(6000),
requireUnit: z.boolean(),
requireUnitReminderSeconds: z.coerce.number().min(60).max(6000),
}),
});
Expand All @@ -58,6 +60,8 @@ const state = reactive<Schema>({
dispatchStatus: [],
timings: {
dispatchMaxWait: 900,
requireUnit: false,
requireUnitReminderSeconds: 180,
},
});
Expand Down Expand Up @@ -354,6 +358,29 @@ const onSubmitThrottle = useThrottleFn(async (event: FormSubmitEvent<Schema>) =>
trailing-icon="i-mdi-access-time"
/>
</UFormGroup>
<UFormGroup
name="timings.requireUnit"
:label="$t('components.centrum.settings.timings.require_unit')"
class="grid grid-cols-2 items-center gap-2"
:ui="{ container: '' }"
>
<UToggle v-model="state.timings.requireUnit" />
</UFormGroup>
<UFormGroup
name="timings.requireUnitReminderSeconds"
:label="$t('components.centrum.settings.timings.require_unit_reminder_seconds')"
class="grid grid-cols-2 items-center gap-2"
:ui="{ container: '' }"
>
<UInput
v-model="state.timings.requireUnitReminderSeconds"
type="number"
:placeholder="$t('common.time_ago.second', 2)"
trailing-icon="i-mdi-access-time"
/>
</UFormGroup>
</UDashboardSection>
</UDashboardPanelContent>
</template>
Expand Down
2 changes: 1 addition & 1 deletion app/components/citizens/info/CitizenActivityFeed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ watch(offset, async () => refresh());

<template>
<UAlert
v-if="userId === activeChar?.userId && attr('CitizenStoreService.ListUserActivity', 'Fields', 'Own')"
v-if="userId === activeChar?.userId && !attr('CitizenStoreService.ListUserActivity', 'Fields', 'Own').value"
variant="subtle"
color="red"
icon="i-mdi-denied"
Expand Down
12 changes: 10 additions & 2 deletions app/components/citizens/info/CitizenDocuments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const props = defineProps<{
}>();
const openclose: OpenClose[] = [
{ id: 0, label: t('common.not_selected') },
{ id: 0, label: t('common.not_selected'), closed: undefined },
{ id: 1, label: t('common.open', 2), closed: false },
{ id: 2, label: t('common.close', 2), closed: true },
];
Expand Down Expand Up @@ -96,7 +96,15 @@ const columns = [
:options="openclose"
value-attribute="closed"
:searchable-placeholder="$t('common.search_field')"
/>
>
<template #label>
{{
query.closed === undefined
? openclose[0]!.label
: (openclose.findLast((o) => o.closed === query.closed)?.label ?? $t('common.na'))
}}
</template>
</USelectMenu>
</ClientOnly>
</UFormGroup>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/components/clipboard/modal/ClipboardCitizens.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ watch(props, async (newVal) => {
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium sm:pl-1">
{{ item.firstname }} {{ item.lastname }}
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
{{ item.jobLabel }}
</td>
<td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-0">
Expand Down
4 changes: 3 additions & 1 deletion app/components/clipboard/modal/ClipboardDocuments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ watch(props, async (newVal) => {
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium sm:pl-1">
{{ item.title }}
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">{{ item.creator.firstname }} {{ item.creator.lastname }}</td>
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
{{ item.creator.firstname }} {{ item.creator.lastname }}
</td>
<td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-0">
<UButton variant="link" icon="i-mdi-trash-can" @click="remove(item, true)" />
</td>
Expand Down
6 changes: 4 additions & 2 deletions app/components/clipboard/modal/ClipboardVehicles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,12 @@ watch(props, (newVal) => {
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium sm:pl-1">
{{ item.plate }}
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
{{ item.model }}
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">{{ item.owner.firstname }} {{ item.owner.lastname }}</td>
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
{{ item.owner.firstname }} {{ item.owner.lastname }}
</td>
<td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-0">
<UButton variant="link" icon="i-mdi-trash-can" @click="remove(item, true)" />
</td>
Expand Down
13 changes: 11 additions & 2 deletions app/components/documents/DocumentList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const settingsStore = useSettingsStore();
const { design } = storeToRefs(settingsStore);
const openclose: OpenClose[] = [
{ id: 0, label: t('common.not_selected') },
{ id: 0, label: t('common.not_selected'), closed: undefined },
{ id: 1, label: t('common.open', 2), closed: false },
{ id: 2, label: t('common.close', 2), closed: true },
];
Expand Down Expand Up @@ -251,7 +251,16 @@ defineShortcuts({
:options="openclose"
value-attribute="closed"
:searchable-placeholder="$t('common.search_field')"
/>
>
<template #label>
{{
query.closed === undefined
? openclose[0]!.label
: (openclose.findLast((o) => o.closed === query.closed)?.label ??
$t('common.na'))
}}
</template>
</USelectMenu>
</ClientOnly>
</UFormGroup>
Expand Down
24 changes: 12 additions & 12 deletions app/components/documents/DocumentReferenceManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,16 @@ function removeReference(id: string): void {
>
{{ reference.targetDocument?.title }}
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
{{ reference.targetDocument?.state }}
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
<CitizenInfoPopover
:user="reference.targetDocument?.creator"
:trailing="false"
/>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
{{
$t(
`enums.docstore.DocReference.${
Expand All @@ -176,7 +176,7 @@ function removeReference(id: string): void {
)
}}
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
<div class="flex flex-row gap-2">
<UButton
:to="{
Expand Down Expand Up @@ -251,20 +251,20 @@ function removeReference(id: string): void {
>
{{ document.title }}
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
{{ document.state }}
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
<CitizenInfoPopover
:user="getUser(document.creator)"
:trailing="false"
/>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
{{ $t('common.created') }}
<GenericTime :value="new Date(Date.parse(document.createdAt ?? ''))" />
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
<div class="flex flex-row gap-2">
<UButton
:title="$t('components.documents.document_managers.links')"
Expand Down Expand Up @@ -360,16 +360,16 @@ function removeReference(id: string): void {
>
{{ document.title }}
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
{{ document.state }}
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
<CitizenInfoPopover :user="document.creator" :trailing="false" />
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
<GenericTime :value="document.createdAt" :ago="true" />
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
<div class="flex flex-row gap-2">
<UButton
:title="$t('components.documents.document_managers.links')"
Expand Down
14 changes: 7 additions & 7 deletions app/components/documents/DocumentRelationManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@ function removeRelation(id: string): void {
({{ relation.targetUser?.dateofbirth }})
</span>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
<CitizenInfoPopover :user="relation.sourceUser" :trailing="false" />
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
{{ $t(`enums.docstore.DocRelation.${DocRelation[relation.relation]}`) }}
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
<div class="flex flex-row gap-2">
<UButton
:to="{
Expand Down Expand Up @@ -230,10 +230,10 @@ function removeRelation(id: string): void {
({{ user.dateofbirth }})
</span>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
{{ user.jobLabel }}
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
<div class="flex flex-row gap-2">
<UButton
:title="$t('components.documents.document_managers.mentioned')"
Expand Down Expand Up @@ -319,10 +319,10 @@ function removeRelation(id: string): void {
({{ user.dateofbirth }})
</span>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
{{ user.jobLabel }}
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<td class="whitespace-nowrap px-2 py-2 text-sm sm:px-4">
<div class="flex flex-row gap-2">
<UButton
:title="$t('components.documents.document_managers.mentioned')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ async function setAbsenceDate(values: Schema): Promise<void> {
});
const { response } = await call;
console.log('AbsenceDate', userProps, response.props);
emit('update:absenceDates', {
userId: props.userId,
absenceBegin: response.props?.absenceBegin,
Expand Down
Loading

0 comments on commit 7b05ea1

Please sign in to comment.