Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

通知の対象者を表示 #917

Merged
merged 2 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/event/EventFormBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</v-stepper-content>

<v-stepper-content step="3">
<event-form-summary v-bind="summary" />
<event-form-summary v-bind="{ ...summary, content }" />
<form-back-button class="mr-2" @click="step = 2">
Back
</form-back-button>
Expand Down
49 changes: 49 additions & 0 deletions src/components/event/EventFormSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,30 @@
<div v-if="!description" class="text--secondary">説明はありません</div>
<MarkdownField v-else :src="description" />
</SummaryItem>
<SummaryItem>
<SummaryItemCaption>Invitees</SummaryItemCaption>
<v-list>
<div v-if="!invitees.length" class="text--secondary">
参加予定者はいません
</div>
<v-list-item v-for="target in inviteesSlice" :key="target.userId">
<v-list-item-avatar>
<user-avatar
size="36"
:user-id="target.name"
:user-icon="target.icon"
/>
</v-list-item-avatar>
<v-list-item-content>
{{ target.name }}
</v-list-item-content>
</v-list-item>
</v-list>
<v-pagination
v-model="page"
:length="Math.ceil(invitees.length / inviteesPerPage)"
/>
</SummaryItem>
</div>
</template>

Expand All @@ -63,6 +87,8 @@ import SummaryItemText from '@/components/shared/SummaryItemText.vue'
import SummaryItemSubtext from '@/components/shared/SummaryItemSubtext.vue'
import { formatDate, DATETIME_DISPLAY_FORMAT } from '@/workers/date'
import EventPlace from '@/components/event/EventPlace.vue'
import { EventInputContent } from '@/components/event/EventFormContent.vue'
import { ResponseUser } from '@/api'
export type EventSummary = {
name: string
description: string
Expand All @@ -89,6 +115,9 @@ export type EventSummary = {
},
})
export default class EventFormSummary extends Vue {
@Prop({ type: Object, required: true })
content!: EventInputContent

@Prop({ type: String, required: true })
name!: string

Expand Down Expand Up @@ -119,6 +148,9 @@ export default class EventFormSummary extends Vue {
@Prop({ type: Boolean, required: true })
sharedRoom!: boolean

page: number = 1
inviteesPerPage: number = 6

get sharedRoomString(): string {
return this.sharedRoom ? '部屋の共用可能' : '部屋の共用不可能'
}
Expand All @@ -144,5 +176,22 @@ export default class EventFormSummary extends Vue {
get formatDate() {
return formatDate(DATETIME_DISPLAY_FORMAT)
}

get invitees(): ResponseUser[] {
const userById = this.$store.direct.getters.usersCache.userById
if (!this.content.group) return []
let invitees = this.content.group.members.flatMap(userId => {
const user = userById(userId)
return user ? user : []
})
return invitees
}

get inviteesSlice(): ResponseUser[] {
return this.invitees.slice(
(this.page - 1) * this.inviteesPerPage,
this.page * this.inviteesPerPage
)
}
}
</script>
Loading