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