-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
110 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,33 @@ | ||
<script lang="ts" setup> | ||
import { storeToRefs } from 'pinia' | ||
import { useGroupStore } from '/@/stores/group' | ||
import { useRequestDetailStore } from '/@/stores/requestDetail' | ||
import { useUserStore } from '/@/stores/user' | ||
import EditButton from '/@/components/shared/EditButton.vue' | ||
import InputSelectSingle from '/@/components/shared/InputSelectSingle.vue' | ||
import SimpleButton from '/@/components/shared/SimpleButton.vue' | ||
import type { EditMode } from '/@/pages/composables/useRequestDetail' | ||
interface Props { | ||
isEditMode: boolean | ||
} | ||
const props = defineProps<Props>() | ||
const emit = defineEmits<{ | ||
(e: 'changeEditMode', value: EditMode): void | ||
}>() | ||
import { computed } from 'vue' | ||
const userStore = useUserStore() | ||
const groupStore = useGroupStore() | ||
const requestDetailStore = useRequestDetailStore() | ||
const { isRequestCreator } = requestDetailStore | ||
const { groupOptions } = storeToRefs(groupStore) | ||
const { request, editedValue } = storeToRefs(requestDetailStore) | ||
const { request } = storeToRefs(requestDetailStore) | ||
const { me } = storeToRefs(userStore) | ||
const hasAuthority = isRequestCreator(me.value) | ||
const handleComplete = () => { | ||
emit('changeEditMode', '') | ||
} | ||
const groupName = computed(() => | ||
request.value?.group ? request.value.group.name : 'なし' | ||
) | ||
</script> | ||
|
||
<template> | ||
<div class="flex items-center"> | ||
グループ: | ||
<div v-if="!props.isEditMode && request"> | ||
<span v-if="!request.group">なし</span> | ||
<span v-else>{{ request.group.name }}</span> | ||
<EditButton | ||
v-if="hasAuthority" | ||
class="ml-1" | ||
@click="emit('changeEditMode', 'group')" /> | ||
<div class="flex flex-col gap-1"> | ||
<div class="flex items-center justify-between"> | ||
<div>グループ</div> | ||
<EditButton v-if="hasAuthority" /> | ||
</div> | ||
<div v-else class="flex"> | ||
<InputSelectSingle | ||
v-model="editedValue.group" | ||
class="w-52" | ||
:options="groupOptions" | ||
placeholder="グループ" /> | ||
<SimpleButton | ||
class="ml-2" | ||
font-size="sm" | ||
padding="sm" | ||
@click.stop="handleComplete"> | ||
完了 | ||
</SimpleButton> | ||
<div> | ||
{{ groupName }} | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<script lang="ts" setup> | ||
import RequestGroup from '/@/components/requestDetail/RequestGroup.vue' | ||
import RequestTags from '/@/components/requestDetail/RequestTags.vue' | ||
import RequestTargets from '/@/components/requestDetail/RequestTargets.vue' | ||
</script> | ||
|
||
<template> | ||
<div class="px-12 flex flex-col gap-8"> | ||
<div class="flex flex-col gap-3"> | ||
<RequestGroup /> | ||
<RequestTags /> | ||
</div> | ||
<RequestTargets /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<script lang="ts" setup> | ||
import { storeToRefs } from 'pinia' | ||
import { useUserStore } from '/@/stores/user' | ||
import type { RequestTarget } from '/@/features/requestTarget/model' | ||
import UserIcon from '/@/components/shared/UserIcon.vue' | ||
import { RouterLink } from 'vue-router' | ||
defineProps<{ | ||
target: RequestTarget | ||
}>() | ||
const userStore = useUserStore() | ||
const { userMap } = storeToRefs(userStore) | ||
</script> | ||
|
||
<template> | ||
<div class="flex items-center gap-3 justify-between"> | ||
<div class="flex items-center gap-1"> | ||
<UserIcon class="w-12" :name="userMap[target.target]" /> | ||
<span>{{ userMap[target.target] }}</span> | ||
</div> | ||
<div class="flex gap-3"> | ||
<span>{{ target.amount }}円</span> | ||
<!--TODO: link--> | ||
<RouterLink class="text-blue-500 underline" to="/"> | ||
入出金記録を作成 | ||
</RouterLink> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,32 @@ | ||
<script lang="ts" setup> | ||
import { storeToRefs } from 'pinia' | ||
import { computed } from 'vue' | ||
import { useRequestDetailStore } from '/@/stores/requestDetail' | ||
import { useUserStore } from '/@/stores/user' | ||
import EditButton from '/@/components/shared/EditButton.vue' | ||
import InputSelectMultiple from '/@/components/shared/InputSelectMultiple.vue' | ||
import SimpleButton from '/@/components/shared/SimpleButton.vue' | ||
import type { EditMode } from '/@/pages/composables/useRequestDetail' | ||
interface Props { | ||
isEditMode: boolean | ||
} | ||
const props = defineProps<Props>() | ||
const emit = defineEmits<{ | ||
(e: 'changeEditMode', value: EditMode): void | ||
}>() | ||
import RequestTarget from '/@/components/requestDetail/RequestTarget.vue' | ||
const userStore = useUserStore() | ||
const requestDetailStore = useRequestDetailStore() | ||
const { isRequestCreator } = requestDetailStore | ||
const { request, editedValue } = storeToRefs(requestDetailStore) | ||
const { me, userOptions, userMap } = storeToRefs(userStore) | ||
const formattedTargets = computed( | ||
() => | ||
request.value?.targets | ||
.map(target => userMap.value[target.target]) | ||
.join(', ') ?? '' | ||
) | ||
const { request } = storeToRefs(requestDetailStore) | ||
const { me } = storeToRefs(userStore) | ||
const hasAuthority = isRequestCreator(me.value) | ||
const handleComplete = () => { | ||
emit('changeEditMode', '') | ||
} | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<div v-if="!props.isEditMode"> | ||
払い戻し対象者: | ||
{{ formattedTargets }} | ||
<EditButton | ||
v-if="hasAuthority" | ||
class="ml-1" | ||
@click="emit('changeEditMode', 'targets')" /> | ||
<div class="flex flex-col gap-2"> | ||
<div class="flex items-center justify-between"> | ||
<div>払い戻し対象者</div> | ||
<EditButton v-if="hasAuthority" /> | ||
</div> | ||
<div v-else class="flex items-center"> | ||
払い戻し対象者: | ||
<InputSelectMultiple | ||
v-model="editedValue.targets" | ||
:options="userOptions" | ||
placeholder="払い戻し対象者" | ||
uniq-key="target" /> | ||
<SimpleButton | ||
class="ml-2" | ||
font-size="sm" | ||
padding="sm" | ||
@click.stop="handleComplete"> | ||
完了 | ||
</SimpleButton> | ||
<div class="flex flex-col gap-2"> | ||
<RequestTarget | ||
v-for="target in request?.targets" | ||
:key="target.target" | ||
:target="target" /> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.