Skip to content

Commit

Permalink
feat: add closed/open filter for citizen documents
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Trost <[email protected]>
  • Loading branch information
galexrt committed Aug 9, 2024
1 parent 4212686 commit bce2b9d
Show file tree
Hide file tree
Showing 11 changed files with 3,909 additions and 3,821 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ protoc-gen-customizer:
protoc-gen-fronthelper:
$(GO) build -o ./internal/cmd/protoc-gen-fronthelper ./internal/cmd/protoc-gen-fronthelper

protoc-gen-doc:
$(GO) install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest

go-licenses:
ifeq (, $(shell which go-licenses))
@GO111MODULE=on $(GO) install github.com/google/go-licenses@latest
Expand Down Expand Up @@ -103,7 +106,7 @@ gen-sql:
find ./query/fivenet/table -type f -iname '*.go' -exec sed -i 's~("fivenet", ~("", ~g' {} \;

.PHONY: gen-proto
gen-proto: protoc-gen-validate protoc-gen-customizer protoc-gen-fronthelper
gen-proto: protoc-gen-validate protoc-gen-customizer protoc-gen-fronthelper protoc-gen-doc
mkdir -p ./gen/go/proto
PATH="$$PATH:./internal/cmd/protoc-gen-customizer/" \
$(PROTOC) \
Expand Down
30 changes: 30 additions & 0 deletions app/components/citizens/info/CitizenDocuments.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<script lang="ts" setup>
import { z } from 'zod';
import OpenClosedBadge from '~/components/partials/OpenClosedBadge.vue';
import Pagination from '~/components/partials/Pagination.vue';
import CitizenInfoPopover from '~/components/partials/citizens/CitizenInfoPopover.vue';
import DataErrorBlock from '~/components/partials/data/DataErrorBlock.vue';
import DocumentInfoPopover from '~/components/partials/documents/DocumentInfoPopover.vue';
import GenericTime from '~/components/partials/elements/GenericTime.vue';
import type { OpenClose } from '~/shims';
import { DocRelation } from '~~/gen/ts/resources/documents/documents';
import { ListUserDocumentsResponse } from '~~/gen/ts/services/docstore/docstore';
Expand All @@ -14,6 +16,20 @@ const props = defineProps<{
userId: number;
}>();
const openclose: OpenClose[] = [
{ id: 0, label: t('common.not_selected') },
{ id: 1, label: t('common.open', 2), closed: false },
{ id: 2, label: t('common.close', 2), closed: true },
];
const schema = z.object({
closed: z.boolean().optional(),
});
type Schema = z.output<typeof schema>;
const query = ref<Schema>({});
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 +59,7 @@ async function listUserDocuments(): Promise<ListUserDocumentsResponse> {
}
watch(offset, async () => refresh());
watchDebounced(query.value, async () => refresh(), { debounce: 200, maxWait: 1250 });
const columns = [
{
Expand All @@ -69,6 +86,19 @@ const columns = [
</script>

<template>
<div class="flex flex-row flex-wrap gap-2">
<UFormGroup name="closed" :label="$t('common.close', 2)" class="flex-1">
<USelectMenu
v-model="query.closed"
:options="openclose"
value-attribute="closed"
:searchable-placeholder="$t('common.search_field')"
@focusin="focusTablet(true)"
@focusout="focusTablet(false)"
/>
</UFormGroup>
</div>

<DataErrorBlock
v-if="error"
:title="$t('common.unable_to_load', [`${$t('common.citizen', 1)} ${$t('common.document', 2)}`])"
Expand Down
3 changes: 1 addition & 2 deletions app/components/documents/DocumentList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import DataErrorBlock from '~/components/partials/data/DataErrorBlock.vue';
import DataNoDataBlock from '~/components/partials/data/DataNoDataBlock.vue';
import DatePickerClient from '~/components/partials/DatePicker.client.vue';
import Pagination from '~/components/partials/Pagination.vue';
import type { OpenClose } from '~/shims';
import { useCompletorStore } from '~/store/completor';
import { useSettingsStore } from '~/store/settings';
import * as googleProtobufTimestamp from '~~/gen/ts/google/protobuf/timestamp';
Expand All @@ -21,8 +22,6 @@ const completorStore = useCompletorStore();
const settingsStore = useSettingsStore();
const { design } = storeToRefs(settingsStore);
type OpenClose = { id: number; label: string; closed?: boolean };
const openclose: OpenClose[] = [
{ id: 0, label: t('common.not_selected') },
{ id: 1, label: t('common.open', 2), closed: false },
Expand Down
2 changes: 2 additions & 0 deletions app/shims.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,7 @@ export type AppConfig = {
game: Game;
};

export type OpenClose = { id: number; label: string; closed?: boolean };

// It is always important to ensure you import/export something when augmenting a type
export {};
622 changes: 317 additions & 305 deletions gen/go/proto/services/docstore/docstore.pb.go

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions gen/go/proto/services/docstore/docstore.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bce2b9d

Please sign in to comment.