Subversion Repositories SmartDukaan

Rev

Rev 22618 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
22618 ashik.ali 1
function associateValidator() {
2
	validator = $('#form').bootstrapValidator({
3
		fields : {
4
			registeredBusinessName : {
5
				validators : {
22095 kshitij.so 6
 
22618 ashik.ali 7
					notEmpty : {
8
						message : 'Please fill the BusinessName'
9
					}
10
				}
11
			},
22095 kshitij.so 12
 
22618 ashik.ali 13
			line1 : {
14
				validators : {
22095 kshitij.so 15
 
22618 ashik.ali 16
					notEmpty : {
17
						message : 'Please fill the Address field.'
18
					}
19
				}
20
			},
21
			city : {
22
				validators : {
22095 kshitij.so 23
 
22618 ashik.ali 24
					notEmpty : {
25
						message : 'Please fill the city '
26
					}
27
				}
28
			},
22095 kshitij.so 29
 
22618 ashik.ali 30
			pincode : {
31
				validators : {
32
					notEmpty : {
33
						message : 'Please fill your pincode'
34
					},
22095 kshitij.so 35
 
22618 ashik.ali 36
				}
37
			},
22095 kshitij.so 38
 
22618 ashik.ali 39
			state : {
40
				validators : {
41
					notEmpty : {
42
						message : 'Please select your state'
43
					}
44
				}
45
			},
22095 kshitij.so 46
 
22618 ashik.ali 47
			district : {
48
				validators : {
49
					notEmpty : {
50
						message : 'Please select your district.'
51
					}
52
				}
53
			},
22095 kshitij.so 54
 
22618 ashik.ali 55
			mobile : {
56
				validators : {
57
					stringLength : {
58
						max : 10,
59
					},
60
					notEmpty : {
61
						message : 'Please fill your Mobile'
62
					},
22095 kshitij.so 63
 
22618 ashik.ali 64
				}
65
			},
22095 kshitij.so 66
 
22618 ashik.ali 67
			stdcode : {
68
				validators : {
22095 kshitij.so 69
 
22618 ashik.ali 70
					notEmpty : {
71
						message : 'Pleasefill your phone number'
72
					},
22095 kshitij.so 73
 
22618 ashik.ali 74
				}
75
			},
22095 kshitij.so 76
 
22618 ashik.ali 77
			telephone : {
78
				validators : {
22095 kshitij.so 79
 
22618 ashik.ali 80
					notEmpty : {
81
						message : 'Pleasefill your phone number'
82
					},
22095 kshitij.so 83
 
22618 ashik.ali 84
				}
85
			},
86
			registeredEmail1 : {
87
				validators : {
88
					notEmpty : {
89
						message : 'Please fill your email address'
90
					},
91
					emailAddress : {
92
						message : 'Please fill a valid email address'
93
					}
94
				}
95
			},
22095 kshitij.so 96
 
22618 ashik.ali 97
			registeredEmail2 : {
98
				validators : {
22095 kshitij.so 99
 
22618 ashik.ali 100
					emailAddress : {
101
						message : 'Please fill valid email address'
102
					}
103
				}
104
			},
22095 kshitij.so 105
 
22618 ashik.ali 106
			dinNumber : {
107
				validators : {
108
					notEmpty : {
109
						message : 'Please fill the DINumber'
110
					}
111
				}
112
			},
22095 kshitij.so 113
 
22618 ashik.ali 114
			bEntityDoc : {
115
				excluded : false,
116
				validators : {
22095 kshitij.so 117
 
22618 ashik.ali 118
					notEmpty : {
119
						message : 'Document is required.'
120
					}
121
				}
122
			},
123
 
124
			gstDoc : {
125
				excluded : false,
126
				validators : {
22095 kshitij.so 127
 
22618 ashik.ali 128
					notEmpty : {
129
						message : 'Document is required.'
130
					}
131
				}
132
			},			
22095 kshitij.so 133
 
22618 ashik.ali 134
			angleDoc1 : {
135
				excluded : false,
136
				validators : {
22095 kshitij.so 137
 
22618 ashik.ali 138
					notEmpty : {
139
						message : 'Document is required.'
140
					}
141
				}
142
			},
22095 kshitij.so 143
 
22618 ashik.ali 144
			angleDoc2 : {
145
				excluded : false,
146
				validators : {
22095 kshitij.so 147
 
22618 ashik.ali 148
					notEmpty : {
149
						message : 'Document is required.'
150
					}
151
				}
152
			},
153
			angleDoc3 : {
154
				excluded : false,
155
				validators : {
22095 kshitij.so 156
 
22618 ashik.ali 157
					notEmpty : {
158
						message : 'Document is required.'
159
					}
160
				}
161
			},
162
			angleDoc4 : {
163
				excluded : false,
164
				validators : {
22095 kshitij.so 165
 
22618 ashik.ali 166
					notEmpty : {
167
						message : 'Document is required.'
168
					}
169
				}
170
			},
22095 kshitij.so 171
 
22618 ashik.ali 172
			angleDoc5 : {
173
				excluded : false,
174
				validators : {
22095 kshitij.so 175
 
22618 ashik.ali 176
					notEmpty : {
177
						message : 'Document is required.'
178
					}
179
				}
180
			},
22095 kshitij.so 181
 
22618 ashik.ali 182
			pan : {
183
				validators : {
22095 kshitij.so 184
 
22618 ashik.ali 185
					stringLength : {
186
						max : 10,
187
					},
188
					notEmpty : {
189
						message : 'Please fill the valid pan Number'
190
					}
22095 kshitij.so 191
 
22618 ashik.ali 192
				}
193
			},
22095 kshitij.so 194
 
22618 ashik.ali 195
			panDoc : {
196
				excluded : false,
197
				validators : {
22095 kshitij.so 198
 
22618 ashik.ali 199
					notEmpty : {
200
						message : 'Pan card Document is required.'
201
					}
202
				}
203
			},
204
			proprietorBusineesName : {
205
				validators : {
22095 kshitij.so 206
 
22618 ashik.ali 207
					notEmpty : {
208
						message : 'Please fill the field'
209
					}
22095 kshitij.so 210
 
22618 ashik.ali 211
				}
212
			},
213
			proprietorAddress : {
214
				validators : {
215
					notEmpty : {
216
						message : 'Please fill the field'
217
					}
22095 kshitij.so 218
 
22618 ashik.ali 219
				}
220
			},
22095 kshitij.so 221
 
22618 ashik.ali 222
			proprietorPhone : {
223
				validators : {
22095 kshitij.so 224
 
22618 ashik.ali 225
					stringLength : {
226
						max : 10,
227
					},
228
					notEmpty : {
229
						message : 'Please fill the field'
230
					}
22095 kshitij.so 231
 
22618 ashik.ali 232
				}
233
			},
234
			proprietorPan : {
235
				validators : {
22095 kshitij.so 236
 
22618 ashik.ali 237
					stringLength : {
238
						max : 10,
239
					},
240
					notEmpty : {
241
						message : 'Please fill the field'
242
					}
22095 kshitij.so 243
 
22618 ashik.ali 244
				}
245
			},
246
			proprietorAdhaar : {
247
				validators : {
22095 kshitij.so 248
 
22618 ashik.ali 249
					notEmpty : {
250
						message : 'Please fill the field'
251
					}
22095 kshitij.so 252
 
22618 ashik.ali 253
				}
254
			},
22095 kshitij.so 255
 
22618 ashik.ali 256
			proprietorEmail : {
257
				validators : {
258
					notEmpty : {
259
						message : 'Please fill the field'
260
					},
261
					emailAddress : {
262
						message : 'Please fill a valid email address'
263
					}
264
				}
265
			},
22095 kshitij.so 266
 
22618 ashik.ali 267
			proprietorOwner : {
268
				validators : {
269
					stringLength : {
270
						max : 10,
271
					},
272
					notEmpty : {
273
						message : 'Please fill the field'
274
					}
22095 kshitij.so 275
 
22618 ashik.ali 276
				}
277
			},
22095 kshitij.so 278
 
22618 ashik.ali 279
			partnerName1 : {
280
				validators : {
22095 kshitij.so 281
 
22618 ashik.ali 282
					notEmpty : {
283
						message : 'Please fill the field'
284
					}
22095 kshitij.so 285
 
22618 ashik.ali 286
				}
287
			},
288
			partnerAddress1 : {
289
				validators : {
290
					notEmpty : {
291
						message : 'Please fill the field'
292
					}
22095 kshitij.so 293
 
22618 ashik.ali 294
				}
295
			},
22095 kshitij.so 296
 
22618 ashik.ali 297
			partnerPhone1 : {
298
				validators : {
299
					stringLength : {
300
						max : 10,
301
					},
302
					notEmpty : {
303
						message : 'Please fill the field'
304
					}
22095 kshitij.so 305
 
22618 ashik.ali 306
				}
307
			},
308
			partnerPan1 : {
309
				validators : {
310
					stringLength : {
311
						max : 10,
312
					},
313
					notEmpty : {
314
						message : 'Please fill the field'
315
					}
22095 kshitij.so 316
 
22618 ashik.ali 317
				}
318
			},
319
			partnerAdhaar1 : {
320
				validators : {
22095 kshitij.so 321
 
22618 ashik.ali 322
					notEmpty : {
323
						message : 'Please fill the field'
324
					}
22095 kshitij.so 325
 
22618 ashik.ali 326
				}
327
			},
22095 kshitij.so 328
 
22618 ashik.ali 329
			partnerEmail1 : {
330
				validators : {
331
					notEmpty : {
332
						message : 'Please fill the field'
333
					},
334
					emailAddress : {
335
						message : 'Please fill a valid email address'
336
					}
337
				}
338
			},
22095 kshitij.so 339
 
22618 ashik.ali 340
			partnerOwner1 : {
341
				validators : {
342
					stringLength : {
343
						max : 10,
344
					},
345
					notEmpty : {
346
						message : 'Please fill the field'
347
					}
22095 kshitij.so 348
 
22618 ashik.ali 349
				}
350
			},
22095 kshitij.so 351
 
22618 ashik.ali 352
			shareholderName1 : {
353
				validators : {
22095 kshitij.so 354
 
22618 ashik.ali 355
					notEmpty : {
356
						message : 'Please fill the field'
357
					}
22095 kshitij.so 358
 
22618 ashik.ali 359
				}
360
			},
361
			shareholderAddress1 : {
362
				validators : {
363
					notEmpty : {
364
						message : 'Please fill the field'
365
					}
22095 kshitij.so 366
 
22618 ashik.ali 367
				}
368
			},
22095 kshitij.so 369
 
22618 ashik.ali 370
			shareholderPhone1 : {
371
				validators : {
372
					stringLength : {
373
						max : 10,
374
					},
375
					notEmpty : {
376
						message : 'Please fill the field'
377
					}
22095 kshitij.so 378
 
22618 ashik.ali 379
				}
380
			},
381
			shareholderPan1 : {
382
				validators : {
383
					stringLength : {
384
						max : 10,
385
					},
386
					notEmpty : {
387
						message : 'Please fill the field'
388
					}
22095 kshitij.so 389
 
22618 ashik.ali 390
				}
391
			},
392
			shareholderAdhaar1 : {
393
				validators : {
22095 kshitij.so 394
 
22618 ashik.ali 395
					notEmpty : {
396
						message : 'Please fill the field'
397
					}
22095 kshitij.so 398
 
22618 ashik.ali 399
				}
400
			},
22095 kshitij.so 401
 
22618 ashik.ali 402
			shareholderEmail1 : {
403
				validators : {
404
					notEmpty : {
405
						message : 'Please fill the field'
406
					},
407
					emailAddress : {
408
						message : 'Please fill a valid email address'
409
					}
410
				}
411
			},
22095 kshitij.so 412
 
22618 ashik.ali 413
			shareholderOwner1 : {
414
				validators : {
415
					stringLength : {
416
						max : 10,
417
					},
418
					notEmpty : {
419
						message : 'Please fill the field'
420
					}
22095 kshitij.so 421
 
22618 ashik.ali 422
				}
423
			},
424
			managerName : {
425
				validators : {
22095 kshitij.so 426
 
22618 ashik.ali 427
					notEmpty : {
428
						message : 'Please fill the ManagerName'
429
					}
430
				}
431
			},
22095 kshitij.so 432
 
22618 ashik.ali 433
			managerNo : {
434
				validators : {
435
					stringLength : {
436
						max : 10,
437
					},
438
					notEmpty : {
439
						message : 'Please fill the ManagerNo'
440
					}
22095 kshitij.so 441
 
22618 ashik.ali 442
				}
443
			},
22095 kshitij.so 444
 
22618 ashik.ali 445
			managerEmail : {
446
				validators : {
447
					notEmpty : {
448
						message : 'Please fill the Manageremail'
449
					},
450
					emailAddress : {
451
						message : 'Please fill a valid email address'
452
					}
453
				}
454
			},
455
			noOfEmployees : {
456
				validators : {
457
					notEmpty : {
458
						message : 'Please fill the Number of employees'
459
					}
460
				}
461
			},
462
			managementStaff : {
463
				validators : {
464
					notEmpty : {
465
						message : 'Please fill the  Number of Managementstaff'
466
					}
467
				}
468
			},
22095 kshitij.so 469
 
22618 ashik.ali 470
			itrDoc : {
471
				excluded : false,
472
				validators : {
22095 kshitij.so 473
 
22618 ashik.ali 474
					notEmpty : {
475
						message : 'ITR Document is required.'
476
					}
477
				}
478
			},
22095 kshitij.so 479
 
22618 ashik.ali 480
			ownershipDoc : {
22095 kshitij.so 481
 
22618 ashik.ali 482
				excluded : false,
483
				validators : {
22095 kshitij.so 484
 
22618 ashik.ali 485
					notEmpty : {
486
						message : 'Ownership Document is required.'
487
					}
488
				}
489
			},
22095 kshitij.so 490
 
22618 ashik.ali 491
			insuranceDoc : {
492
				excluded : optionalDocsHandler,
493
				validators : {
494
 
495
					notEmpty : {
496
						message : 'Insurance Document is required.'
497
					}
498
				}
499
			},
500
			loanDoc : {
501
				excluded : optionalDocsHandler,
502
 
503
				validators : {
504
 
505
					notEmpty : {
506
						message : 'Document is required.'
507
					}
508
				}
509
			},
510
			sanctionDoc : {
511
				excluded : optionalDocsHandler,
512
 
513
				validators : {
514
 
515
					notEmpty : {
516
						message : 'Document is required.'
517
					}
518
				}
519
			},
520
 
521
			chequeCopy : {
522
				excluded : false,
523
 
524
				validators : {
525
 
526
					notEmpty : {
527
						message : 'Document is required.'
528
					}
529
				}
530
			},
531
 
532
			portalName1 : {
533
				validators : {
534
					notEmpty : {
535
						message : 'Please fill the PortalName'
536
					}
537
				}
538
			},
539
			east : {
540
				validators : {
541
					notEmpty : {
542
						message : 'Please fill the Area'
543
					}
544
				}
545
			},
546
			west : {
547
				validators : {
548
					notEmpty : {
549
						message : 'Please fill the Area'
550
					}
551
				}
552
			},
553
			north : {
554
				validators : {
555
					notEmpty : {
556
						message : 'Please fill the Area'
557
					}
558
				}
559
			},
560
 
561
			south : {
562
				validators : {
563
					notEmpty : {
564
						message : 'Please fill the Area'
565
					}
566
				}
567
			},
568
 
569
			front : {
570
				validators : {
571
					notEmpty : {
572
						message : 'Please fill the Area'
573
					}
574
				}
575
			},
576
 
577
			roadSize : {
578
				validators : {
579
					notEmpty : {
580
						message : 'Please fill the Area'
581
					}
582
				}
583
			},
584
			storeName : {
585
				validators : {
586
					notEmpty : {
587
						message : 'Please fill the storename'
588
					}
589
				}
590
			},
591
 
592
			storeAddress : {
593
				validators : {
594
					notEmpty : {
595
						message : 'Please fill the storeAddress'
596
					}
597
				}
598
			},
599
 
600
			accountNumber : {
601
				validators : {
602
					notEmpty : {
603
						message : 'Please fill the accountnumber'
604
					}
605
				}
606
			},
607
			bankName : {
608
				validators : {
609
					notEmpty : {
610
						message : 'Please fill the bankname'
611
					}
612
				}
613
			},
614
			ifscCode : {
615
				validators : {
616
					notEmpty : {
617
						message : 'Please fill the IFSCcode'
618
					}
619
				}
620
			},
621
			branchName : {
622
				validators : {
623
					notEmpty : {
624
						message : 'Please fill the Branchname'
625
					}
626
				}
627
			},
628
 
629
			utr : {
630
				validators : {
631
					notEmpty : {
632
						message : 'Please fill the field'
633
					}
634
				}
635
			}
636
 
637
		}
638
	}).on('success.form.bv', function(e) {
639
		$('#form').data('bootstrapValidator').resetForm();
640
 
641
		// Prevent form submission
642
		e.preventDefault();
643
 
644
		// Get the form instance
645
		var $form = $(e.target);
646
 
647
		// Get the BootstrapValidator instance
648
		var bv = $form.data('bootstrapValidator');
649
 
650
		// Use Ajax to submit form data
651
		var isChecked = jQuery("input[name=bEntity]:checked").val();
652
		if (!isChecked) {
653
			alert('Please select the type of BusinessEntity');
654
			return false;
655
		} else {
656
 
657
		}
658
		var isChecked = jQuery("input[name=bPmpDetail]:checked").val();
659
		if (!isChecked) {
660
			alert('Please select the detail of BusinessEntity');
661
			return false;
662
		} else {
663
 
664
		}
665
 
666
		var isChecked = jQuery("input[name=businessModel]:checked").val();
667
		if (!isChecked) {
668
			alert('Please select the BusinessModel');
669
			return false;
670
		} else {
671
		}
672
 
673
		var isChecked = jQuery("input[name=sellingOnline]:checked").val();
674
		if (!isChecked) {
675
			alert('Please select the Sellingonline');
676
			return false;
677
		} else {
678
		}
679
 
680
		var isChecked = jQuery("input[name=shopArea]:checked").val();
681
		if (!isChecked) {
682
			alert('Please select the Shop Area');
683
			return false;
684
		} else {
685
		}
686
 
687
		var isChecked = jQuery("input[name=shopStatus]:checked").val();
688
		if (!isChecked) {
689
			alert('Please select the shopstatus');
690
			return false;
691
		} else {
692
		}
693
 
694
		var isChecked = jQuery("input[name=shopAvailbility]:checked").val();
695
		if (!isChecked) {
696
			alert('Please select the Shop Availbility');
697
			return false;
698
		} else {
699
		}
700
 
701
		var isChecked = jQuery("input[name=location]:checked").val();
702
		if (!isChecked) {
703
			alert('Please select the Loacation of Shop');
704
			return false;
705
		} else {
706
		}
707
 
708
		var isChecked = jQuery("input[name=nearestStore]:checked").val();
709
		if (!isChecked) {
710
			alert('Please select the NearestStore');
711
			return false;
712
		} else {
713
		}
714
 
715
		var isChecked = jQuery("input[name=ownership]:checked").val();
716
		if (!isChecked) {
717
			alert('Please select the ownership of Shop');
718
			return false;
719
		} else {
720
		}
721
 
722
		var isChecked = jQuery("input[name=insurance]:checked").val();
723
		if (!isChecked) {
724
			alert('Please select the Insurance field');
725
			return false;
726
		} else {
727
		}
728
 
729
		var isChecked = jQuery("input[name=loan]:checked").val();
730
		if (!isChecked) {
731
			alert('Please select the loan field');
732
			return false;
733
		} else {
734
		}
735
		var isChecked = jQuery("input[type=checkbox]:checked").val();
736
		if (!isChecked) {
737
			alert('Please select the Status of shop');
738
			return false;
739
		}
740
		submitFormAsJson($(this));
741
	}).on('error.form.bv', function(e) {
742
		console.log("here");
743
	});
22095 kshitij.so 744
}
22618 ashik.ali 745
 
746
function submitFormAsJson(jQueryForm) {
747
	jQuery.blockUI({
748
		message : "<h5>Please wait while we upload data to our server</h5>"
749
	});
22620 ashik.ali 750
	formData = objectifyForm($("form").serializeArray());
751
	for ( var name in formData) {
22618 ashik.ali 752
		if (docsArray.indexOf(name) >= 0) {
22620 ashik.ali 753
			formData[name] = +formData[name];
22618 ashik.ali 754
		}
755
	}
756
	jQuery.ajax({
757
		url : contextPath + "/register",
758
		type : 'POST',
759
		contentType : 'application/json',
22620 ashik.ali 760
		data : JSON.stringify(formData),
22618 ashik.ali 761
		success : function(data) {
762
			// $('#form')[0].reset();
763
			jQuery.unblockUI();
764
			jQuery("html").html(data);
765
		},
766
		error : function() {
767
			jQuery.unblockUI();
768
			alert("OOPS!!!Failed to do changes.Try Again.");
769
		},
770
		cache : false,
771
		processData : false
772
	});
773
}
774
// serialize data function
22095 kshitij.so 775
function objectifyForm(formArray) {
776
 
22618 ashik.ali 777
	var returnArray = {};
778
	for (var i = 0; i < formArray.length; i++) {
779
		var name = formArray[i]['name'];
780
		var value = formArray[i]['value'];
781
		returnArray[name] = value;
782
	}
783
	return returnArray;
22148 amit.gupta 784
}
785
 
786
function optionalDocsHandler($field, validator) {
22618 ashik.ali 787
	return $("input[name=doc_" + $field.attr(name) + "]").is(":visible");
22095 kshitij.so 788
}