-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·195 lines (151 loc) · 8.16 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>IS Cart POC</title>
<script>
document.write('<base href="' + document.location + '" />');
</script>
<link data-require="bootstrap-css" data-semver="3.3.6" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css" />
<link rel="stylesheet" href="style.css" />
<script data-require="[email protected]" src="https://code.angularjs.org/1.4.8/angular.js" data-semver="1.4.8"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script src="ngAutocomplete.js"></script>
</head>
<body ng-app="isCheckout" class="wrapper">
<div id="cartLoader" ng-show="cartloader"></div>
<section class="form-wrapper">
<h2>Cart POC [AEM & Ng]</h2>
<!--
#############################################################################################
Common Form for all the controllers, this should be in the page level
**When you have the action attribute specified for the form, angularjs will not do preventDefault.
**In this case the form will always have preventDefault and on submit your $scope.SubmitForm() function will be called
where you can proceed with an ajax post to the backend or further validation.
Note that by using proper validation attributes on your inputs (like type="email" and required),
angularjs will perform some basic validation for you. You can have an extra ng-disabled="!mainForm.$valid"
on the submit button to keep the button disabled while the email is not correctly entered.
SubmitForm(formName) auther should able to provice formName, to decied which page to show next.
#############################################################################################
-->
<form class="row" name="mainForm" ng-controller="mainForm"
novalidate data-main-form ng-submit="SubmitForm(formName)" ng-cloak>
<div ng-show="formError" class="alert alert-danger" role="alert">
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<span class="sr-only">Error:</span>
<span ng-bind="formError"></span>
</div>
<p>Hello {{name}}!</p>
<!--<p>Parent Billing : {{child.billing.fname}}</p>
<p>Parent Email: {{child.account.email}}</p>
<p>Parent Payment: {{child.payment.ptype}}</p>-->
<!--Each component will have one controller and ng-form.
Forms can't be nested, so angular provides ng-form to overcome this issue
Using CSS classes - https://docs.angularjs.org/guide/forms
To allow styling of form as well as controls, ngModel adds these CSS classes:
ng-valid: the model is valid
ng-invalid: the model is invalid
ng-valid-[key]: for each valid key added by $setValidity
ng-invalid-[key]: for each invalid key added by $setValidity
ng-pristine: the control hasn't been interacted with yet
ng-dirty: the control has been interacted with
ng-touched: the control has been blurred
ng-untouched: the control hasn't been blurred
ng-pending: any $asyncValidators are unfulfilled
-->
<div ng-controller="emailCtrl" ng-cloak>
<div ng-form="emailLookup" data-child-form class="form">
<h3>Child : {{emailName}}</h3>
<input class="form-control" name="field0" type="email" placeholder="Field Name*" ng-model="account.email" required />
<div ng-show="emailLookup.field0.$touched">
<span ng-show="emailLookup.field0.$error.required">Tell us your email.</span>
<span ng-show="emailLookup.field0.$error.email">This is not a valid email.</span>
</div>
<br />
</div>
<!--div class="form-group"
ng-class='{ "has-focus": emailLookup.name.hasFocus,
"has-success": emailLookup.name.$valid,
"has-error": emailLookup.name.$invalid && (emailLookup.$submitted || emailLookup.name.$touched),
"is-empty": !emailLookup.name.$viewValue }'>
<label for="name">Email</label>
<input type="text" name="name" ng-model="account.email" required
ng-focus='emailLookup.name.hasFocus=true' ng-blur='emailLookup.name.hasFocus=false'>
<p ng-show="emailLookup.name.$error.required && (emailLookup.name.$touched || submitted)"
class="error-block">Name is Required!</p>
</div-->
</div>
<div ng-controller="billingCtrl" ng-cloak class="billingCtrl">
<div ng-form="billingForm" data-child-form class="form">
<h3>Child : {{billingName}}</h3>
<input class="form-control" name="field1" type="text" placeholder="First Name*" ng-model="billing.fname" required />
<div ng-show="billingForm.$submitted || billingForm.field1.$touched">
<span ng-show="billingForm.field1.$error.required">Tell us your First Name.</span>
</div>
<br />
<input class="form-control" name="field2" type="text" placeholder="Last Name*" ng-model="billing.lname" required />
<div ng-show="billingForm.$submitted || billingForm.field2.$touched">
<span ng-show="billingForm.field2.$error.required">Tell us your last Name.</span>
</div>
<label for="country"> Country: </label>
<select class="form-control" name="country" ng-model="billing.country" ng-change="countryChange()">
<option value="">Select Country</option>
<option value="US">USA</option>
<option value="CA">CANADA</option>
</select>
<br> Countries autocomplete
<br />
<input class="form-control" type="text" id="Autocomplete" ng-model="billing.country1" ng-autocomplete="billing.country1" required details="details1" options="options1" />
<br /> Phone number formatting
<br />
<input name="field4" class="form-control input-phone" type='text' phone-input="{{billing.country}}" ng-model="billing.phoneVal" ng-init="billing.phoneVal=''" placeholder="Phone number" required />
<span ng-show="phoneInvalid">Phone number is not right.</span>
</div>
<br/>
</div>
<div ng-controller="paymentCtrl" ng-cloak >
<div ng-form="paymentForm" data-child-form class="form">
<h3>Child : {{paymentName}}</h3>
<input class="form-control" name="field1" type="text" placeholder="Payment Type*" ng-model="payment.ptype" required />
<div ng-show="paymentForm.$submitted || paymentForm.field1.$touched">
<span ng-show="paymentForm.field1.$error.required">Tell us your Payment Type.</span>
</div>
<br />
<input class="form-control" name="field2" type="text" placeholder="CVV*" ng-model="payment.pcvv" required />
<div ng-show="paymentForm.$submitted || paymentForm.field2.$touched">
<span ng-show="paymentForm.field2.$error.required">Tell us your CVV.</span>
</div>
</div>
</div>
<br/>
<div class="row pull-right">
<button class="btn btn-info" type="submit" submit-forms id="submintBtn"
ng-disabled="mainForm.$invalid">Submit</button>
</div>
<br/>
<br/>
<br/>
<figure class=highlight ng-show="request">
<pre>
<code class=language-html data-lang=html>
<h4>Child data [from parent]:</h4> <span>{{request}}</span>
</code>
</pre>
</figure>
</form>
<br />
<br />
</section>
<script src="http-auth-interceptor.js"></script>
<script src="isCheckout.js"></script>
<script src="cartFactory.js"></script>
<script src="pubSubFactory.js"></script>
<script src="cartConstants.js"></script>
<script src="emailController.js"></script>
<script src="billingController.js"></script>
<script src="paymentController.js"></script>
<script src="filter.js"></script>
<script src="directive.js"></script>
</body>
</html>