-
Notifications
You must be signed in to change notification settings - Fork 3
/
customerdashboard.php
313 lines (292 loc) · 10.1 KB
/
customerdashboard.php
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/png" href="assets/img/favicon.ico">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Items Warehouse</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
<meta name="viewport" content="width=device-width" />
<?php include 'csslibrary.php';?>
<?php include 'jslibrary.php';?>
<style>
table.dataTable thead th { font-size: 15px; color: black;}
a { cursor: pointer; }
</style>
</head>
<body>
<div class="wrapper">
<?php include 'left-nav.php';?>
<div class="main-panel">
<?php include 'upper-nav.php';?>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="header">
<div class="row" style="margin:10px;">
<div class="col-md-8">
<h4 class="title">Customer Dashboard</h4>
<p class="category">*All Customer</p>
</div>
<div class="col-md-4">
<input type="button" value="Add Customer" id="btnCustomerAdd">
<input type="button" value="Edit Customer" id="btnItemChange" data-toggle="modal" data-target="#editCustomerModal">
</div>
</div>
</div>
<div class="content">
<div class="row" style="margin:20px;">
<table id="custDisplay" class="table table-condensed table-hover" width="100%"></table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<input type="hidden" class="form-control" value = "-99" id="custHiddensave">
</div>
<div class="modal fade" id="addCustomerModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<div class="row">
<div class="col-sm-4">
<h4 class="modal-title">Add Customer</h4>
</div>
<div class="col-sm-6" style="text-align:center">
<button type="button" class="btn btn-default" id="btnCustSave">Save</button>
</div>
<div class="col-sm-2">
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
</div>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<label for="usr">Customer Name(*required)</label>
<input type="text" value="" class="form-control" id="custName">
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-12">
<label for="usr">GST Number</label>
<input type="text" value="" class="form-control" id="custGST">
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-6">
<label for="usr">City</label>
<input type="text" class="form-control" id="custCity">
</div>
<div class="col-sm-6">
<label for="usr">State</label>
<div class="dropdown" id="drpState">
<button class="btn btn-default dropdown-toggle" id="custDrpstate" style="width:250px" type="button" data-toggle="dropdown">Select State
<span class="caret"></span></button>
<ul class="dropdown-menu" style="width:250px;height: 200px;overflow:auto">
<li><a value="Tamil Nadu">Tamil Nadu</a></li>
<li><a value="West Bengal">West Bengal</a></li>
<li><a value="Orissa">Orissa</a></li>
<li><a value="Delhi">Delhi</a></li>
<li><a value="Karnataka">Karnataka</a></li>
<li><a value="ANDAMANANDNICOBARISLANDS">Andaman and Nicobar Islands</a></li>
<li><a value="Andhra Pradesh">Andhra Pradesh</a></li>
<li><a value="ARUNACHALPRADESH">Arunachal Pradesh</a></li>
<li><a value="Assam">Assam</a></li>
<li><a value="Bihar">Bihar</a></li>
<li><a value="Chandigarh">Chandigarh</a></li>
<li><a value="Chhattisgarh">Chhattisgarh</a></li>
<li><a value="Dadra Nagar Haveli">Dadra Nagar Haveli</a></li>
<li><a value="Daman and Diu">Daman and Diu</a></li>
<li><a value="Goa">Goa</a></li>
<li><a value="Gujarat">Gujarat</a></li>
<li><a value="Haryana">Haryana</a></li>
<li><a value="Himachal Pradesh">Himachal Pradesh</a></li>
<li><a value="Jammu and Kashmir">Jammu and Kashmir</a></li>
<li><a value="Jharkhand">Jharkhand</a></li>
<li><a value="Kerala">Kerala</a></li>
<li><a value="Lakshadweep">Lakshadweep</a></li>
<li><a value="Madhya Pradesh">Madhya Pradesh</a></li>
<li><a value="Maharashtra">Maharashtra</a></li>
<li><a value="Manipur">Manipur</a></li>
<li><a value="Meghalaya">Meghalaya</a></li>
<li><a value="Mizoram">Mizoram</a></li>
<li><a value="Pondicherry">Pondicherry</a></li>
<li><a value="Punjab">Punjab</a></li>
<li><a value="Rajasthan">Rajasthan</a></li>
<li><a value="Sikkim">Sikkim</a></li>
<li><a value="OTHERTERRITORY">OTHERTERRITORY</a></li>
</ul>
</div>
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-6">
<label for="usr">Contact person</label>
<input type="text" value="" class="form-control" id="custContactName">
</div>
<div class="col-sm-6">
<label for="usr">Mobile No.</label>
<input type="text" value="" class="form-control" id="custMobileNumber">
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-6">
<label for="usr">PAN</label>
<input type="text" value="" class="form-control" id="custPAN">
</div>
<div class="col-sm-6">
<label for="usr">Pin code</label>
<input type="text" value="" class="form-control" id="custPin">
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-12">
<label for="usr">Address</label>
<input type="text" value="" class="form-control" id="custAddress">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="editCustomerModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Change Item</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-3">
<label for="usr" style="margin-top:10px;">Item Name:</label>
</div>
<div class="col-sm-9">
<input type="text" class="form-control" id="itemDespName" placeholder="Type an Item">
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-3">
<label for="usr" style="margin-top:10px;">Bill Date:</label>
</div>
<div class="col-sm-9">
<input class="form-control" id="itemBillDate" name="date" placeholder="MM/DD/YYYY" type="text"/>
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-12">
<input type="text" class="form-control" id="itemChangeValue" style="text-align:center;">
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-12" style="text-align:center;">
<button type="button" class="btn btn-default" id="btnItemAdd" style="width:80px;font-weight:bold; color: black;" >Add</button>
<button type="button" class="btn btn-default" id="btnItemMinus" style="width:80px;font-weight:bold; color: black;" >Minus</button>
<button type="button" class="btn btn-default" id="btnItemEdit" style="width:80px;font-weight:bold; color: black;" >Edit</button>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Save</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
$(document).ready(function(){
initTable();
function clearFields()
{
$("#addCustomerModal input").val("");
}
function initTable()
{
$.ajax({
url: 'webmethods.php',
type: 'POST',
data: {type: 2 },
success: function (data1) {
var arr = JSON.parse(data1);
fillCustomerTable(arr);
console.log(data1);
},
error: function (log) {
console.log(log.message);
}
});
}
function fillCustomerTable(dataSet)
{
$('#custDisplay').DataTable( {
data: dataSet,
dom: 'Bfrtip',
buttons: [
'pdf'
],
destroy: true,
columns: [
{ title: "Sr. no" },
{ title: "Vendor Name" },
{ title: "GSTIN" },
{ title: "STATE" },
{ title: "MOBILE NUMBER" },
]
} );
}
function saveCustomerinDB()
{
$.ajax({
url: 'webmethods.php',
type: 'POST',
data: {type: 1, vendorName: $("#custName").val(),custGST: $("#custGST").val(),custCity: $("#custCity").val(),drpState: $("#drpState button").text(),custContactName: $("#custContactName").val(),custMobileNumber: $("#custMobileNumber").val(), custPAN: $("#custPAN").val(),custPin: $("#custPin").val(),custAddress: $("#custAddress").val(), query_type: $("#custHiddensave").val() },
success: function (d) {
console.log(d);
initTable();
if(d == "1")
$("#addCustomerModal").modal('hide');
},
error: function (log) {
console.log(log);
}
});
}
$("#btnCustSave").on('click',function(){
if($("#custName").val().length > 0)
{
saveCustomerinDB();
}
else
alert("Please add Vendor Name");
})
$( function() {
$( "#itemBillDate" ).datepicker();
});
$("#btnCustomerAdd").on('click',function(){
clearFields();
$("#custDrpstate").html('Select State<span class="caret"></span>');
$("#addCustomerModal").modal('show');
})
});
</script>
</html>