-
Notifications
You must be signed in to change notification settings - Fork 1
/
add-age.html
217 lines (200 loc) · 11.2 KB
/
add-age.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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<!DOCTYPE html>
<html lang="en">
<head>
<!-- SITE TITTLE -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tozis Int. | Add animal age</title>
<!-- PLUGINS CSS STYLE -->
<link href="assets/plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet">
<link href="assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="assets/plugins/bootstrapthumbnail/bootstrap-thumbnail.css" rel="stylesheet">
<link href="assets/plugins/owl-carousel/owl.carousel.min.css" rel="stylesheet">
<link href="assets/plugins/selectbox/select_option1.css" rel="stylesheet">
<link href="assets/plugins/animate/animate.css" rel="stylesheet">
<link href="#" rel="stylesheet" id="bootstrap-rtl">
<!-- GOOGLE FONT -->
<link href="https://fonts.googleapis.com/css?family=Muli:200,300,400,600,700,800,900" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Herr+Von+Muellerhoff" rel="stylesheet">
<!-- CUSTOM CSS -->
<link href="assets/css/app.css" rel="stylesheet">
<link href="assets/css/dashboard.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/default.css" id="option_color">
<!-- FAVICON -->
<link href="assets/img/favico.jpg" rel="shortcut icon">
</head>
<body id="body" class="body-wrapper boxed-menu" >
<div class="main-wrapper">
<!-- Dashboard header -->
<section class="navbar-dashboard-area">
<nav class="navbar navbar-default lightHeader navbar-dashboard" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-dash">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-dash">
<ul class="nav navbar-nav mr0">
<li class="active">
<a href="dashboard.html"><i class="fa fa-tachometer icon-dash" aria-hidden="true"></i> Dashboard</a>
</li>
<li class="dropdown singleDro ">
<a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-leaf icon-dash" aria-hidden="true"></i> Farm <i class="fa fa-angle-down" aria-hidden="true"></i></a>
<ul class="dropdown-menu">
<li><a href="add-farm.html">Add Farm</a></li>
<li><a href="view-farms.html">View Farms</a></li>
<li><a href="add-rating.html">Add rating</a></li>
<li><a href="view-rating.html">View rating</a></li>
</ul>
</li>
<li class="dropdown singleDro ">
<a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-list-ul icon-dash" aria-hidden="true"></i> Products <i class="fa fa-angle-down" aria-hidden="true"></i></a>
<ul class="dropdown-menu">
<li><a href="add-listings.html">Add Product</a></li>
<li><a href="view-listings.html">View Products</a></li>
<li><a href="restock-listings.html">Restock Product</a></li>
</ul>
</li>
<li class="dropdown singleDro ">
<a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-paw icon-dash" aria-hidden="true"></i> Animals <i class="fa fa-angle-down" aria-hidden="true"></i></a>
<ul class="dropdown-menu">
<li><a href="add-animals.html">Add Animals</a></li>
<li><a href="view-animals.html">View Animals</a></li>
<li><a href="add-breed.html">Add breed</a></li>
<li><a href="view-breed.html">View breed</a></li>
<li><a href="add-age.html">Add age</a></li>
<li><a href="view-age.html">View age</a></li>
</ul>
</li>
<li class="dropdown singleDro ">
<a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-user icon-dash" aria-hidden="true"></i> Orders <i class="fa fa-angle-down" aria-hidden="true"></i></a>
<ul class="dropdown-menu">
<li><a href="add-orders.html">Add Order</a></li>
<li><a href="view-orders.html">View Orders</a></li>
<li><a href="add-receipt.html">Add Receipt</a></li>
<li><a href="view-receipt.html">Verify Receipt</a></li>
<li><a href="inquiries.html">Inquiries</a></li>
</ul>
</li>
<li class="dropdown singleDro ">
<a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-user icon-dash" aria-hidden="true"></i> Admin <i class="fa fa-angle-down" aria-hidden="true"></i></a>
<ul class="dropdown-menu">
<li><a href="add-admin.html">Add Admin</a></li>
<li><a href="view-admin.html">View Admin</a></li>
<li><a href="edit-privilege.html">Edit Admin privilege</a></li>
<li><a href="create-page.html">Create Page</a></li>
<li><a href="edit-page.html">Edit Page</a></li>
<li><a href="website-log.html">Logs</a></li>
</ul>
</li>
</ul>
<div class="row adjustRow">
<div class="pull-right col-xs-12 col-sm-2 teee">
<a href="login.html"><i class="fa fa-unlock-alt icon-dash" aria-hidden="true"></i> Logout</a>
</div>
</div>
</div>
</div>
</nav>
</section>
<!-- Dashboard breadcrumb section -->
<div class="section dashboard-breadcrumb-section bg-dark">
<div class="container">
<div class="row">
<div class="col-xs-12">
<h2>Add Age</h2>
<ol class="breadcrumb">
<li><a href="dashboard.html">Dashboard</a></li>
<li class="active">Add Age</li>
</ol>
</div>
</div>
</div>
</div>
</div>
<section class="clearfix bg-dark listingSection" id="listing-add-edit">
<div class="container">
<div class="row ">
<div class="col-xs-6 col-xs-offset-3 form-root">
<form action="#" method="" class="listing__form">
<div class="dashboardBoxBg mb30">
<div class="profileIntro paraMargin">
<p class="text-danger">All fields are required.</p>
<div class="row test">
<div class="form-group col-xs-12">
<label for="animal">Animal</label>
<div class="contactSelect">
<select name="animal" id="guiest_id9" class="select-drop">
<option value="1">Goat</option>
<option value="2">Cow</option>
<option value="3">Rabbit</option>
</select>
</div>
</div>
<div class="form-group col-xs-12">
<label for="age">Age</label>
<input type="text" class="form-control" id="age" name="age">
</div>
<div class="more-field"></div>
<div class="form-group col-xs-12">
<button type="button" class="btn btn-primary btn-md" id="add-more">Add More</button>
</div>
<div class="form-group text-center">
<button type="submit" class="btn-submit">Submit</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</section>
</body>
<script src="assets/plugins/jquery/jquery.min.js"></script>
<script src="assets/plugins/jquery-ui/jquery-ui.min.js"></script>
<script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/plugins/smoothscroll/SmoothScroll.min.js"></script>
<script src="assets/plugins/selectbox/jquery.selectbox-0.1.3.min.js"></script>
<script src="assets/plugins/owl-carousel/owl.carousel.min.js"></script>
<script src="assets/js/app.js"></script>
<script>
let form = document.querySelector('.more-field');
let addBtn = document.querySelector('#add-more');
let maxField = 10;
const extraField = '<div class="form-group col-xs-12"><label for="age">Age</label><input type="text" class="form-control" id="age" name="age"><button type="button" class="text-danger removeBtn btn btn-remove">X</button></div>';
let increment = 1;
addBtn.addEventListener('click', e => {
if(increment < maxField){
increment++;
$(form).append(extraField);
} else {
const container = document.querySelector('.form-root');
const form = document.querySelector('.listing__form');
const errorDiv = document.createElement('div');
errorDiv.className = 'alert text-danger';
errorDiv.appendChild(document.createTextNode("Maximum number of fields reached"));
container.insertBefore(errorDiv, form);
setTimeout(() => {
document.querySelector('.alert').remove();
}, 5000);
}
})
document.querySelector('.test').addEventListener('click', e => {
if(e.target.classList.contains('removeBtn')){
e.target.parentElement.remove();
increment--;
}
})
</script>