@@ -8,31 +8,67 @@ import MembershipPageLoginLink from './MembershipPageLoginLink.vue'
8
8
9
9
const route = useRoute ()
10
10
11
+ const isUserTypeNew = computed (() => route .query .user_type === ' new' )
12
+ const isUserTypeRejoin = computed (() => route .query .user_type === ' rejoin' )
13
+ const isUserTypeActive = computed (() => route .query .user_type === ' active' )
14
+ const isUserTypeQueryValid = computed (
15
+ () => isUserTypeNew .value || isUserTypeRejoin .value || isUserTypeActive .value ,
16
+ )
17
+
11
18
const isLoggedIn = ref (false )
12
- const hasIsctAddress = ref (false )
19
+ const hasVerifiedMailAddress = ref (false )
13
20
const hasCustomerObjectOnTraqId = ref (false )
14
- const isUserTypeActive = computed (() => route .query .user_type === ' active' )
21
+ const shouldShowUserTypeSelector = computed (() => ! isLoggedIn .value )
22
+ const needUserTypeSelect = computed (() => ! isLoggedIn .value && ! isUserTypeQueryValid .value )
23
+ const needMailAddressInput = computed (
24
+ () =>
25
+ (isLoggedIn .value && ! hasCustomerObjectOnTraqId .value && ! hasVerifiedMailAddress .value ) ||
26
+ (! isLoggedIn .value &&
27
+ (isUserTypeNew .value || isUserTypeRejoin .value ) &&
28
+ ! hasVerifiedMailAddress .value ),
29
+ )
30
+ const needLogin = computed (() => isUserTypeActive .value && ! isLoggedIn .value )
31
+
32
+ const hasCustomerObjectOnMailAddress = ref (false )
33
+ const hasTraQIdOnCustomerObject = ref (false )
34
+ const hasCustomerObject = computed (
35
+ () => hasCustomerObjectOnMailAddress .value || hasCustomerObjectOnTraqId .value ,
36
+ )
37
+ const canShowInvoiceForm = computed (
38
+ () =>
39
+ (isLoggedIn .value && (hasCustomerObjectOnTraqId .value || hasVerifiedMailAddress .value )) ||
40
+ (! isLoggedIn .value &&
41
+ (isUserTypeNew .value || isUserTypeRejoin .value ) &&
42
+ hasVerifiedMailAddress .value ),
43
+ )
44
+ const needTraqIdInput = computed (
45
+ () =>
46
+ isUserTypeRejoin .value &&
47
+ (! hasCustomerObjectOnMailAddress .value || ! hasTraQIdOnCustomerObject .value ),
48
+ )
49
+ const needNameInput = computed (() => ! hasCustomerObject .value )
50
+ const hasValidTraqId = computed (() => ! needTraqIdInput .value && false )
51
+ const hasName = computed (() => ! needNameInput .value && false )
52
+ const canShowInvoiceInfoConfirm = computed (
53
+ () => needNameInput .value && hasValidTraqId .value && hasName .value ,
54
+ )
15
55
</script >
16
56
17
57
<template >
18
58
<div class =" flex flex-col gap-2" >
19
- <div v-if =" isLoggedIn" >
20
- <div v-if =" !hasCustomerObjectOnTraqId && !hasIsctAddress" >
21
- isct アドレスの認証が必要です
22
- <MemberShipPageVerifyEmailLink />
23
- </div >
24
- <div v-else >請求書情報入力へ</div >
25
- </div >
26
- <div v-else >
59
+ <div v-if =" shouldShowUserTypeSelector" >
27
60
<MemberShipPageUserTypeSelector />
28
- <div v-if =" isUserTypeActive" >
29
- ログインが必要です
30
- <MembershipPageLoginLink />
31
- </div >
32
- <div v-else-if =" !hasIsctAddress" >
33
- isct アドレスの認証が必要です <MemberShipPageVerifyEmailLink />
34
- </div >
35
- <div v-else >請求書情報入力へ</div >
36
61
</div >
62
+ <div v-if =" needUserTypeSelect" >新規入部、再入部、継続所属のいずれかを選択してください</div >
63
+ <div v-if =" needMailAddressInput" >
64
+ isct アドレスの認証が必要です <MemberShipPageVerifyEmailLink />
65
+ </div >
66
+ <div v-if =" needLogin" >
67
+ ログインが必要です
68
+ <MembershipPageLoginLink />
69
+ </div >
70
+ <div v-if =" canShowInvoiceForm && needTraqIdInput" >traQ ID を入力してください</div >
71
+ <div v-if =" canShowInvoiceForm && needNameInput" >名前を入力してください</div >
72
+ <div v-if =" canShowInvoiceInfoConfirm" >請求書発行のための情報を確認してください</div >
37
73
</div >
38
74
</template >
0 commit comments