/
BusinessStep.vue
207 lines (192 loc) · 7.48 KB
/
BusinessStep.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
// Copyright (C) 2023 Storj Labs, Inc.
// See LICENSE for copying information.
<template>
<v-container>
<v-row justify="center">
<v-col class="text-center pt-10 pb-7">
<icon-business />
<div class="text-overline mt-2 mb-1">
Business Account
</div>
<h2 class="pb-3">Experience Storj for your business</h2>
<p>Tell us a bit about yourself and the company.</p>
</v-col>
</v-row>
<v-form v-model="formValid">
<v-row justify="center">
<v-col cols="12" sm="5" md="4" lg="3">
<v-text-field
id="First Name"
v-model="firstName"
:rules="[RequiredRule]"
label="First Name"
hide-details="auto"
required
/>
</v-col>
<v-col cols="12" sm="5" md="4" lg="3">
<v-text-field
id="Last Name"
v-model="lastName"
label="Last Name"
hide-details="auto"
/>
</v-col>
</v-row>
<v-row justify="center">
<v-col cols="12" sm="5" md="4" lg="3">
<v-text-field
id="Company Name"
v-model="companyName"
:rules="[RequiredRule]"
label="Company Name"
hide-details="auto"
required
/>
</v-col>
<v-col cols="12" sm="5" md="4" lg="3">
<v-select
id="Job Role"
v-model="position"
:rules="[RequiredRule]"
:items="['Executive/C-Level', 'Director', 'Manager', 'Software Developer', 'Partner', 'Student/Professor', 'Other']"
label="Job Role"
variant="outlined"
hide-details="auto"
required
/>
</v-col>
</v-row>
<v-row justify="center">
<v-col cols="12" sm="5" md="4" lg="3">
<v-select
v-model="functionalArea"
:items="['Cloud Storage', 'IT Security', 'IT Operations', 'Business', 'Other']"
label="Functional Area"
variant="outlined"
hide-details="auto"
/>
</v-col>
<v-col cols="12" sm="5" md="4" lg="3">
<v-select
v-model="employeeCount"
:items="['1-50', '50-1000', '1000+']"
label="Number of Employees"
variant="outlined"
hide-details="auto"
/>
</v-col>
</v-row>
<v-row justify="center">
<v-col cols="12" sm="5" md="4" lg="3">
<v-select
v-model="storageNeeds"
:items="['Under 25 TB', '25 TB - 50 TB', '51 TB - 150 TB', '151 TB - 250 TB', '251 TB -500 TB', '501 TB and above']"
label="Storage Needs"
variant="outlined"
hide-details="auto"
/>
</v-col>
<v-col cols="12" sm="5" md="4" lg="3">
<v-select
v-model="useCase"
:items="['Backup/Archive', 'Media Sharing & Collaboration', 'Large File Distribution', 'Video Streaming', 'Web3 Storage', 'Other']"
label="Use Case"
variant="outlined"
hide-details="auto"
/>
</v-col>
</v-row>
<v-row justify="center">
<v-col cols="12" sm="6" md="5" lg="4">
<v-checkbox id="sales" v-model="haveSalesContact" density="compact">
<template #label>
<p class="text-body-2">Please have the Sales Team contact me</p>
</template>
</v-checkbox>
</v-col>
<v-col v-if="smAndUp" cols="12" sm="4" md="3" lg="2" />
</v-row>
</v-form>
<v-row justify="center" class="mt-4">
<v-col cols="12" sm="5" md="4" lg="3">
<v-btn
size="large"
variant="tonal"
:prepend-icon="mdiChevronLeft"
color="default"
:disabled="isLoading"
block
@click="emit('next', AccountSetupStep.Choice)"
>
Back
</v-btn>
</v-col>
<v-col cols="12" sm="5" md="4" lg="3">
<v-btn
size="large"
:append-icon="mdiChevronRight"
:loading="isLoading"
:disabled="!formValid"
block
@click="setupAccount()"
>
Continue
</v-btn>
</v-col>
</v-row>
</v-container>
</template>
<script setup lang="ts">
import { VBtn, VCheckbox, VCol, VContainer, VForm, VRow, VSelect, VTextField } from 'vuetify/components';
import { ref } from 'vue';
import { mdiChevronLeft, mdiChevronRight } from '@mdi/js';
import { useDisplay } from 'vuetify';
import { AccountSetupStep } from '@/types/users';
import { AuthHttpApi } from '@/api/auth';
import { useNotify } from '@/utils/hooks';
import { useLoading } from '@/composables/useLoading';
import { AnalyticsErrorEventSource } from '@/utils/constants/analyticsEventNames';
import { RequiredRule } from '@poc/types/common';
import IconBusiness from '@poc/components/icons/IconBusiness.vue';
const auth = new AuthHttpApi();
const notify = useNotify();
const { isLoading, withLoading } = useLoading();
const { smAndUp } = useDisplay();
const formValid = ref(false);
const firstName = ref('');
const lastName = ref('');
const companyName = ref('');
const position = ref<string>();
const employeeCount = ref<string>();
const storageNeeds = ref<string>();
const useCase = ref<string>();
const functionalArea = ref<string>();
const haveSalesContact = ref(false);
const emit = defineEmits<{
next: [AccountSetupStep];
}>();
function setupAccount() {
withLoading(async () => {
if (!formValid.value) {
return;
}
try {
await auth.setupAccount({
fullName: `${firstName.value} ${lastName.value}`,
position: position.value,
companyName: companyName.value,
employeeCount: employeeCount.value,
storageNeeds: storageNeeds.value,
storageUseCase: useCase.value,
functionalArea: functionalArea.value,
isProfessional: true,
haveSalesContact: haveSalesContact.value,
});
emit('next', AccountSetupStep.Success);
} catch (error) {
notify.notifyError(error, AnalyticsErrorEventSource.ACCOUNT_SETUP_DIALOG);
}
});
}
</script>