1
1
{{ define "main" }}
2
+ < script >
3
+ let __plan_name = "Professional" ;
4
+ </ script >
2
5
< div class ="isolate px-6 py-24 sm:py-32 lg:px-8 ">
3
6
< div class ="mx-auto max-w-2xl text-center ">
4
7
< h2 class ="text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl ">
@@ -10,6 +13,7 @@ <h2 class="text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl">
10
13
</ div >
11
14
12
15
< script >
16
+ let start_trial_form_submitted = false ;
13
17
window . onload = function ( ) {
14
18
let referralCode = localStorage . getItem ( "referral-code" ) ;
15
19
@@ -21,68 +25,55 @@ <h2 class="text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl">
21
25
document . getElementById ( "referral-code" ) . value = referralCode ;
22
26
}
23
27
24
- const serviceId = getQueryParam ( "service_id" ) ;
25
- const serviceName = getQueryParam ( "service_name" ) ;
28
+ const serviceName = getQueryParam ( "service" ) ;
26
29
27
- if ( serviceId && serviceName ) {
28
- document . getElementById ( "service-id" ) . value = serviceId ;
30
+ if ( serviceName ) {
29
31
document . getElementById ( "service-name" ) . value = serviceName ;
30
32
} else {
31
33
window . location = "/" ;
32
34
}
33
35
} ;
34
36
35
- async function submitForm ( form ) {
36
- event . preventDefault ( ) ;
37
-
38
- alert ( "Currently not accepting new accounts, Try after few minutes" ) ;
39
- return ;
40
-
37
+ function loading ( ) {
41
38
const btn = document . getElementById ( "submit-btn" ) ;
42
39
43
40
btn . disabled = true ;
44
41
btn . textContent = "Submitting..." ;
42
+ }
45
43
46
- const formData = new FormData ( form ) ;
47
- const requestData = Object . fromEntries ( formData . entries ( ) ) ;
48
-
49
- delete requestData . terms_and_conditions ;
50
-
51
- requestData . plan = requestData . plan . toLowerCase ( ) ;
44
+ function onFormSubmit ( ) {
45
+ if ( start_trial_form_submitted ) {
46
+ const plans = {
47
+ startup : "https://buy.stripe.com/4gwaF0bWd3nh2AwaEF" ,
48
+ professional : "https://buy.stripe.com/00gaF0gct9LF6QM6oq" ,
49
+ business : "https://buy.stripe.com/cN29AW4tL9LFeje7sv" ,
50
+ enterprise : "https://buy.stripe.com/dR614q2lD9LF0so6os" ,
51
+ } ;
52
52
53
- try {
54
- const response = await fetch (
55
- "https://admin.octabyte.app/items/customer_services" ,
56
- {
57
- method : "POST" ,
58
- headers : {
59
- "Content-Type" : "application/json" ,
60
- } ,
61
- body : JSON . stringify ( requestData ) ,
62
- } ,
63
- ) ;
53
+ __plan_name = __plan_name . toLowerCase ( ) ;
64
54
65
- if ( ! response . ok ) {
66
- throw new Error ( "There was an error submitting the form." ) ;
67
- }
55
+ const paymentLink = plans [ __plan_name ] || plans . professional ;
68
56
69
57
localStorage . removeItem ( "referral-code" ) ;
70
-
71
- const data = await response . json ( ) ;
72
- const session_url = data . data . session_url ;
73
- window . location = session_url ;
74
- } catch ( error ) {
75
- alert ( "There was an error submitting the form." ) ;
58
+ window . location = paymentLink ;
76
59
}
77
60
}
78
61
</ script >
79
62
63
+ < iframe
64
+ name ="hidden_iframe "
65
+ id ="hidden_iframe "
66
+ style ="display:none; "
67
+ onload ="onFormSubmit() "> </ iframe >
68
+
80
69
< form
70
+ action ="https://docs.google.com/forms/d/e/1FAIpQLSeaxk4nWWZZw6LvQPPS80PuSOfEC3rmAWPtzOYapioaYguzqQ/formResponse "
81
71
method ="post "
82
- onsubmit ="submitForm(this) "
72
+ target ="hidden_iframe "
73
+ onsubmit ="start_trial_form_submitted = true; loading() "
83
74
class ="mx-auto mt-16 max-w-xl sm:mt-20 ">
84
75
<!-- Referral Code -->
85
- < input id ="referral-code " type ="hidden " name ="referral_code " />
76
+ < input id ="referral-code " type ="hidden " name ="entry.1415040235 " />
86
77
87
78
< div class ="grid grid-cols-1 gap-x-8 gap-y-6 sm:grid-cols-2 ">
88
79
< div >
@@ -94,7 +85,7 @@ <h2 class="text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl">
94
85
< div class ="mt-2.5 ">
95
86
< input
96
87
type ="text "
97
- name ="first_name "
88
+ name ="entry.973173615 "
98
89
id ="first-name "
99
90
autocomplete ="given-name "
100
91
placeholder ="John "
@@ -111,7 +102,7 @@ <h2 class="text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl">
111
102
< div class ="mt-2.5 ">
112
103
< input
113
104
type ="text "
114
- name ="last_name "
105
+ name ="entry.876595051 "
115
106
id ="last-name "
116
107
autocomplete ="family-name "
117
108
placeholder ="Smith "
@@ -129,7 +120,7 @@ <h2 class="text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl">
129
120
< div class ="mt-2.5 ">
130
121
< input
131
122
type ="email "
132
- name ="admin_email "
123
+ name ="entry.943957029 "
133
124
id ="email "
134
125
autocomplete ="email "
135
126
placeholder ="Please provide valid email address to receive credentials "
@@ -146,7 +137,7 @@ <h2 class="text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl">
146
137
< div class ="mt-2.5 ">
147
138
< input
148
139
type ="tel "
149
- name ="phone_number "
140
+ name ="entry.621899747 "
150
141
id ="phone-number "
151
142
autocomplete ="tel "
152
143
placeholder ="+1 (555) 987-6543 "
@@ -160,10 +151,9 @@ <h2 class="text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl">
160
151
Service Name
161
152
</ label >
162
153
< div class ="mt-2.5 ">
163
- < input type ="hidden " id ="service-id " name ="service_id " />
164
154
< input
165
155
type ="text "
166
- name ="service_name "
156
+ name ="entry.2107164949 "
167
157
id ="service-name "
168
158
required
169
159
readonly
@@ -194,7 +184,7 @@ <h2 class="text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl">
194
184
< div class ="flex h-5 items-center ">
195
185
< input
196
186
id ="terms-and-conditions "
197
- name ="terms_and_conditions "
187
+ name ="terms-and-conditions "
198
188
type ="checkbox "
199
189
required
200
190
class ="h-4 w-4 cursor-pointer rounded border-gray-300 text-indigo-600 focus:ring-indigo-500 " />
0 commit comments