@eeplatform/nuxt-layer-common 1.7.28 → 1.7.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/components/EnrollmentForm.vue +620 -265
- package/components/Layout/Header.vue +2 -12
- package/composables/useEnrollment.ts +12 -2
- package/package.json +1 -1
- package/pages/forgot-password.vue +76 -0
- package/pages/login.vue +139 -0
- package/pages/logout.vue +34 -0
- package/pages/reset-password/[otp].vue +106 -0
- package/pages/sign-up/[id].vue +214 -0
- package/pages/sign-up/index.vue +142 -0
- package/pages/verify/invitation/[id].vue +164 -0
- package/pages/verify/member-invite/[id].vue +67 -0
- package/types/enrollment.d.ts +11 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row no-gutters class="fill-height" justify="center" align-content="center">
|
|
3
|
+
<v-col cols="12" lg="3" md="4" sm="6">
|
|
4
|
+
<v-form
|
|
5
|
+
v-model="valid"
|
|
6
|
+
@submit.prevent="submit(email, referralCode)"
|
|
7
|
+
:disabled="loading"
|
|
8
|
+
>
|
|
9
|
+
<v-row no-gutters>
|
|
10
|
+
<v-col cols="12">
|
|
11
|
+
<v-row no-gutters justify="center">
|
|
12
|
+
<nuxt-link
|
|
13
|
+
class="text-h2 font-weight-bold text-decoration-none"
|
|
14
|
+
style="color: unset"
|
|
15
|
+
:to="{ name: 'index' }"
|
|
16
|
+
>
|
|
17
|
+
EEPlatform
|
|
18
|
+
</nuxt-link>
|
|
19
|
+
</v-row>
|
|
20
|
+
</v-col>
|
|
21
|
+
|
|
22
|
+
<v-col cols="12" class="mt-6">
|
|
23
|
+
<v-row no-gutters>
|
|
24
|
+
<v-col cols="12" class="text-h6 font-weight-bold"> Email </v-col>
|
|
25
|
+
<v-col cols="12">
|
|
26
|
+
<v-text-field
|
|
27
|
+
v-model="email"
|
|
28
|
+
:rules="[requiredRule, emailRule]"
|
|
29
|
+
></v-text-field>
|
|
30
|
+
</v-col>
|
|
31
|
+
</v-row>
|
|
32
|
+
</v-col>
|
|
33
|
+
|
|
34
|
+
<!-- Honeypot Field (Hidden) -->
|
|
35
|
+
<v-text-field
|
|
36
|
+
v-model="goWeekdaysHoneypot"
|
|
37
|
+
label="Leave this field empty"
|
|
38
|
+
class="goWeekdaysHoneypot"
|
|
39
|
+
autocomplete="off"
|
|
40
|
+
></v-text-field>
|
|
41
|
+
|
|
42
|
+
<v-col cols="12">
|
|
43
|
+
<v-row no-gutters justify="center">
|
|
44
|
+
<v-col
|
|
45
|
+
cols="12"
|
|
46
|
+
class="text-subtitle-1 font-weight-medium text-center font-italic"
|
|
47
|
+
>
|
|
48
|
+
{{ message }}
|
|
49
|
+
</v-col>
|
|
50
|
+
</v-row>
|
|
51
|
+
</v-col>
|
|
52
|
+
|
|
53
|
+
<v-col cols="12" class="mt-4">
|
|
54
|
+
<v-btn
|
|
55
|
+
block
|
|
56
|
+
type="submit"
|
|
57
|
+
variant="tonal"
|
|
58
|
+
:disabled="!valid"
|
|
59
|
+
rounded="xl"
|
|
60
|
+
size="large"
|
|
61
|
+
class="text-none"
|
|
62
|
+
:loading="loading"
|
|
63
|
+
>
|
|
64
|
+
Sign up
|
|
65
|
+
</v-btn>
|
|
66
|
+
</v-col>
|
|
67
|
+
|
|
68
|
+
<v-col cols="12" class="my-4">
|
|
69
|
+
<v-divider></v-divider>
|
|
70
|
+
</v-col>
|
|
71
|
+
|
|
72
|
+
<v-col cols="12" class="text-center font-weight-bold">
|
|
73
|
+
<v-btn
|
|
74
|
+
block
|
|
75
|
+
variant="flat"
|
|
76
|
+
color="black"
|
|
77
|
+
rounded="xl"
|
|
78
|
+
size="large"
|
|
79
|
+
class="text-none"
|
|
80
|
+
:to="{ name: 'index' }"
|
|
81
|
+
>
|
|
82
|
+
Login
|
|
83
|
+
</v-btn>
|
|
84
|
+
</v-col>
|
|
85
|
+
</v-row>
|
|
86
|
+
</v-form>
|
|
87
|
+
</v-col>
|
|
88
|
+
</v-row>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<script setup lang="ts">
|
|
92
|
+
definePageMeta({
|
|
93
|
+
layout: "plain",
|
|
94
|
+
});
|
|
95
|
+
const APP_AFFILIATE = useRuntimeConfig().public.APP_AFFILIATE;
|
|
96
|
+
const { requiredRule, emailRule } = useUtils();
|
|
97
|
+
const email = ref("");
|
|
98
|
+
const valid = ref(false);
|
|
99
|
+
const referralCode = ref("");
|
|
100
|
+
|
|
101
|
+
const _referralCode = (useRoute().query.referralCode as string) ?? "";
|
|
102
|
+
if (_referralCode) {
|
|
103
|
+
referralCode.value = _referralCode;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const goWeekdaysHoneypot = ref("");
|
|
107
|
+
|
|
108
|
+
const { signUp } = useLocalAuth();
|
|
109
|
+
|
|
110
|
+
const message = ref("");
|
|
111
|
+
|
|
112
|
+
const loading = ref(false);
|
|
113
|
+
|
|
114
|
+
async function submit(email = "", referral = "") {
|
|
115
|
+
loading.value = true;
|
|
116
|
+
if (goWeekdaysHoneypot.value) {
|
|
117
|
+
console.warn("Bot detected! Form rejected.");
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
await signUp(email, referral);
|
|
123
|
+
message.value = "Verification email sent! Please check your inbox.";
|
|
124
|
+
} catch (error: any) {
|
|
125
|
+
message.value = error.data.message;
|
|
126
|
+
console.log(error);
|
|
127
|
+
} finally {
|
|
128
|
+
loading.value = false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
</script>
|
|
132
|
+
|
|
133
|
+
<style scoped>
|
|
134
|
+
.goWeekdaysHoneypot {
|
|
135
|
+
position: absolute;
|
|
136
|
+
left: -9999px;
|
|
137
|
+
opacity: 0;
|
|
138
|
+
height: 0;
|
|
139
|
+
width: 0;
|
|
140
|
+
pointer-events: none;
|
|
141
|
+
}
|
|
142
|
+
</style>
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row no-gutters class="fill-height" justify="center" align-content="center">
|
|
3
|
+
<v-col
|
|
4
|
+
v-if="validating"
|
|
5
|
+
cols="12"
|
|
6
|
+
class="text-subtitle-1 font-weight-medium text-center"
|
|
7
|
+
>
|
|
8
|
+
{{ message }}
|
|
9
|
+
</v-col>
|
|
10
|
+
<v-col v-else cols="12" lg="3" md="4" sm="6">
|
|
11
|
+
<v-row no-gutters>
|
|
12
|
+
<v-col v-if="validInvitation" cols="12">
|
|
13
|
+
<v-form
|
|
14
|
+
v-model="isValid"
|
|
15
|
+
@submit.prevent="submit({ firstName, lastName, password, id })"
|
|
16
|
+
id="form1"
|
|
17
|
+
autocomplete="off"
|
|
18
|
+
>
|
|
19
|
+
<v-row no-gutters>
|
|
20
|
+
<v-col cols="12">
|
|
21
|
+
<v-row no-gutters>
|
|
22
|
+
<InputLabel
|
|
23
|
+
class="text-capitalize"
|
|
24
|
+
title="First Name"
|
|
25
|
+
required
|
|
26
|
+
/>
|
|
27
|
+
<v-col cols="12">
|
|
28
|
+
<v-text-field
|
|
29
|
+
v-model="firstName"
|
|
30
|
+
density="comfortable"
|
|
31
|
+
:rules="[requiredRule]"
|
|
32
|
+
></v-text-field>
|
|
33
|
+
</v-col>
|
|
34
|
+
</v-row>
|
|
35
|
+
</v-col>
|
|
36
|
+
|
|
37
|
+
<v-col cols="12" class="mt-2">
|
|
38
|
+
<v-row no-gutters>
|
|
39
|
+
<InputLabel
|
|
40
|
+
class="text-capitalize"
|
|
41
|
+
title="Last Name"
|
|
42
|
+
required
|
|
43
|
+
/>
|
|
44
|
+
<v-col cols="12">
|
|
45
|
+
<v-text-field
|
|
46
|
+
v-model="lastName"
|
|
47
|
+
density="comfortable"
|
|
48
|
+
:rules="[requiredRule]"
|
|
49
|
+
></v-text-field>
|
|
50
|
+
</v-col>
|
|
51
|
+
</v-row>
|
|
52
|
+
</v-col>
|
|
53
|
+
|
|
54
|
+
<v-col cols="12">
|
|
55
|
+
<v-row no-gutters>
|
|
56
|
+
<InputLabel
|
|
57
|
+
class="text-capitalize"
|
|
58
|
+
title="Password"
|
|
59
|
+
required
|
|
60
|
+
/>
|
|
61
|
+
<v-col cols="12">
|
|
62
|
+
<InputPassword v-model="password" :rules="[requiredRule]" />
|
|
63
|
+
</v-col>
|
|
64
|
+
</v-row>
|
|
65
|
+
</v-col>
|
|
66
|
+
|
|
67
|
+
<v-col
|
|
68
|
+
v-if="errorOnSubmit"
|
|
69
|
+
cols="12"
|
|
70
|
+
class="my-2 text-error text-center"
|
|
71
|
+
>
|
|
72
|
+
{{ message }}
|
|
73
|
+
</v-col>
|
|
74
|
+
|
|
75
|
+
<v-col cols="12">
|
|
76
|
+
<v-btn
|
|
77
|
+
block
|
|
78
|
+
type="submit"
|
|
79
|
+
variant="text"
|
|
80
|
+
:disabled="!isValid"
|
|
81
|
+
rounded="xl"
|
|
82
|
+
size="large"
|
|
83
|
+
>
|
|
84
|
+
submit
|
|
85
|
+
</v-btn>
|
|
86
|
+
</v-col>
|
|
87
|
+
</v-row>
|
|
88
|
+
</v-form>
|
|
89
|
+
</v-col>
|
|
90
|
+
|
|
91
|
+
<v-col
|
|
92
|
+
v-else
|
|
93
|
+
cols="12"
|
|
94
|
+
class="text-subtitle-1 font-weight-medium text-center"
|
|
95
|
+
>
|
|
96
|
+
<span>{{ message }}</span>
|
|
97
|
+
<v-row no-gutters justify="center">
|
|
98
|
+
<nuxt-link :to="{ name: 'index' }">Go to homepage</nuxt-link>
|
|
99
|
+
</v-row>
|
|
100
|
+
</v-col>
|
|
101
|
+
</v-row>
|
|
102
|
+
</v-col>
|
|
103
|
+
</v-row>
|
|
104
|
+
</template>
|
|
105
|
+
|
|
106
|
+
<script setup lang="ts">
|
|
107
|
+
definePageMeta({
|
|
108
|
+
layout: "plain",
|
|
109
|
+
});
|
|
110
|
+
const { verify } = useLocalAuth();
|
|
111
|
+
|
|
112
|
+
const id = (useRoute().params.id as string) ?? "";
|
|
113
|
+
|
|
114
|
+
const validating = ref(true);
|
|
115
|
+
const validInvitation = ref(false);
|
|
116
|
+
|
|
117
|
+
const message = ref("Validating invitation...");
|
|
118
|
+
const invite = ref<Record<string, any> | null>(null);
|
|
119
|
+
|
|
120
|
+
async function validate() {
|
|
121
|
+
try {
|
|
122
|
+
invite.value = await verify(id);
|
|
123
|
+
validInvitation.value = true;
|
|
124
|
+
} catch (error: any) {
|
|
125
|
+
message.value = error.data.message;
|
|
126
|
+
}
|
|
127
|
+
validating.value = false;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
await validate();
|
|
131
|
+
|
|
132
|
+
const { requiredRule } = useUtils();
|
|
133
|
+
const firstName = ref("");
|
|
134
|
+
const lastName = ref("");
|
|
135
|
+
const password = ref("");
|
|
136
|
+
const isValid = ref(false);
|
|
137
|
+
|
|
138
|
+
const { createUserByVerification } = useUser();
|
|
139
|
+
|
|
140
|
+
const errorOnSubmit = ref(false);
|
|
141
|
+
|
|
142
|
+
async function submit({
|
|
143
|
+
firstName = "",
|
|
144
|
+
lastName = "",
|
|
145
|
+
password = "",
|
|
146
|
+
id = "",
|
|
147
|
+
} = {}) {
|
|
148
|
+
errorOnSubmit.value = false;
|
|
149
|
+
try {
|
|
150
|
+
await createUserByVerification({
|
|
151
|
+
firstName,
|
|
152
|
+
lastName,
|
|
153
|
+
password,
|
|
154
|
+
id,
|
|
155
|
+
type: invite.value?.type,
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
await navigateTo({ name: "login" });
|
|
159
|
+
} catch (error: any) {
|
|
160
|
+
message.value = error.response._data.message;
|
|
161
|
+
errorOnSubmit.value = true;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
</script>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row no-gutters class="fill-height" justify="center" align-content="center">
|
|
3
|
+
<v-col cols="12" class="text-subtitle-1 font-weight-medium text-center">
|
|
4
|
+
{{ message }}
|
|
5
|
+
</v-col>
|
|
6
|
+
</v-row>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
definePageMeta({
|
|
11
|
+
layout: "plain",
|
|
12
|
+
});
|
|
13
|
+
const { verify } = useLocalAuth();
|
|
14
|
+
|
|
15
|
+
const id = (useRoute().params.id as string) ?? "";
|
|
16
|
+
|
|
17
|
+
const validating = ref(true);
|
|
18
|
+
const validInvitation = ref(false);
|
|
19
|
+
|
|
20
|
+
const message = ref("Validating invitation...");
|
|
21
|
+
const invite = ref<Record<string, any> | null>(null);
|
|
22
|
+
|
|
23
|
+
async function validate() {
|
|
24
|
+
try {
|
|
25
|
+
invite.value = await verify(id);
|
|
26
|
+
validInvitation.value = true;
|
|
27
|
+
message.value =
|
|
28
|
+
invite.value.message || "Successfully accepted the invitation!";
|
|
29
|
+
} catch (error: any) {
|
|
30
|
+
message.value = error.data.message;
|
|
31
|
+
}
|
|
32
|
+
validating.value = false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
await validate();
|
|
36
|
+
|
|
37
|
+
const { requiredRule } = useUtils();
|
|
38
|
+
const firstName = ref("");
|
|
39
|
+
const lastName = ref("");
|
|
40
|
+
const password = ref("");
|
|
41
|
+
const isValid = ref(false);
|
|
42
|
+
|
|
43
|
+
const { createUserByVerification } = useUser();
|
|
44
|
+
|
|
45
|
+
const errorOnSubmit = ref(false);
|
|
46
|
+
|
|
47
|
+
async function submit({
|
|
48
|
+
firstName = "",
|
|
49
|
+
lastName = "",
|
|
50
|
+
password = "",
|
|
51
|
+
id = "",
|
|
52
|
+
} = {}) {
|
|
53
|
+
errorOnSubmit.value = false;
|
|
54
|
+
try {
|
|
55
|
+
await createUserByVerification({
|
|
56
|
+
firstName,
|
|
57
|
+
lastName,
|
|
58
|
+
password,
|
|
59
|
+
id,
|
|
60
|
+
type: invite.value?.type,
|
|
61
|
+
});
|
|
62
|
+
} catch (error: any) {
|
|
63
|
+
message.value = error.response._data.message;
|
|
64
|
+
errorOnSubmit.value = true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
</script>
|
package/types/enrollment.d.ts
CHANGED
|
@@ -51,7 +51,14 @@ declare type EnrLearnerInfo = {
|
|
|
51
51
|
birthDate: string; // ISO format: YYYY-MM-DD
|
|
52
52
|
sex: string;
|
|
53
53
|
age: number;
|
|
54
|
-
placeOfBirth:
|
|
54
|
+
placeOfBirth: {
|
|
55
|
+
region: string;
|
|
56
|
+
regionName?: string;
|
|
57
|
+
province: string;
|
|
58
|
+
provinceName?: string;
|
|
59
|
+
cityMunicipality: string;
|
|
60
|
+
cityMunicipalityName?: string;
|
|
61
|
+
};
|
|
55
62
|
motherTongue?: string;
|
|
56
63
|
fourPsHouseholdId?: string;
|
|
57
64
|
indigenousCommunity?: string;
|
|
@@ -82,8 +89,11 @@ declare type EnrAddress = {
|
|
|
82
89
|
streetName?: string;
|
|
83
90
|
sitio?: string;
|
|
84
91
|
barangay: string;
|
|
92
|
+
barangayName?: string;
|
|
85
93
|
municipalityCity: string;
|
|
94
|
+
municipalityCityName?: string;
|
|
86
95
|
province: string;
|
|
96
|
+
provinceName?: string;
|
|
87
97
|
country?: string;
|
|
88
98
|
zipCode?: string;
|
|
89
99
|
};
|