Subversion Repositories SmartDukaan

Rev

Rev 31474 | Rev 32471 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 31474 Rev 32464
Line 228... Line 228...
228
			var state = $("#state").val();
228
			var state = $("#state").val();
229
			var remark = $("#createRemark").val();
229
			var remark = $("#createRemark").val();
230
			var assignTo = $("#createAssignTo").val();
230
			var assignTo = $("#createAssignTo").val();
231
			var source = $("#leadSource").val();
231
			var source = $("#leadSource").val();
232
			var communicationType = $("#communicationTye").val();
232
			var communicationType = $("#communicationTye").val();
-
 
233
			var outletName = $('input[name="leadoutletName"]').val();
-
 
234
			var counterSize = $('input[name="leadcounterSize"]').val();
-
 
235
			var table = document.getElementById('brandtable');
-
 
236
			var brandValueJson = [];
-
 
237
			var leadBrands;
-
 
238
 
-
 
239
			console.log(outletName)
-
 
240
 
233
 
241
 
234
			console.log(communicationType);
-
 
235
			if (firstName === "" && lastName === "" && mobile === ""
242
			if (firstName === "" && lastName === "" && mobile === ""
236
				&& address === "" && status === "" && city === ""
243
				&& address === "" && status === "" && city === ""
237
				&& state === "" && remark === "" && source === "") {
244
				&& state === "" && remark === "" && source === "") {
238
				alert("Field can't be empty");
245
				alert("Field can't be empty");
239
				return;
246
				return;
240
			}
247
			}
241
 
248
 
-
 
249
 
242
			if (firstName === "") {
250
			if (firstName === "") {
243
				alert("First Name is required");
251
				alert("First Name is required");
244
				return;
252
				return;
245
			}
253
			}
246
			if (lastName === "") {
254
			if (lastName === "") {
Line 276... Line 284...
276
			if (remark === "") {
284
			if (remark === "") {
277
				alert("Remark is required");
285
				alert("Remark is required");
278
				return;
286
				return;
279
			}
287
			}
280
 
288
 
-
 
289
			if (status == "followUp" || status == "pending" || status == "finalized") {
-
 
290
				if (outletName === "") {
-
 
291
					alert("Outlet Name is required");
-
 
292
					return;
-
 
293
				}
-
 
294
 
-
 
295
				if (counterSize === "") {
-
 
296
					alert("Counter Size is required");
-
 
297
					return;
-
 
298
				}
-
 
299
 
-
 
300
				if (localStorage.getItem("frontph") == "undefined" && localStorage.getItem("frontph") == null) {
-
 
301
					alert("Front Document is required");
-
 
302
					return;
-
 
303
				}
-
 
304
 
-
 
305
				if (localStorage.getItem("internalMarketh") == "undefined" || localStorage.getItem("internalMarketh") == null) {
-
 
306
					alert("Front With Market Document is required");
-
 
307
					return;
-
 
308
				}
-
 
309
 
-
 
310
				if (localStorage.getItem("leftShoth") == "undefined" || localStorage.getItem("leftShoth") == null) {
-
 
311
					alert("Internal Left Shot Document is required");
-
 
312
					return;
-
 
313
				}
-
 
314
 
-
 
315
				if (localStorage.getItem("leftWallh") == "undefined" || localStorage.getItem("leftWallh") == null) {
-
 
316
					alert("Internal Left Wall Document is required");
-
 
317
					return;
-
 
318
				}
-
 
319
 
-
 
320
 
-
 
321
				if (localStorage.getItem("rightWallh") == "undefined" || localStorage.getItem("rightWallh") == null) {
-
 
322
					alert("Internal Right Wall Document is required");
-
 
323
					return;
-
 
324
				}
-
 
325
 
-
 
326
 
-
 
327
				for (i = 1; i < table.rows.length; i++) {
-
 
328
 
-
 
329
					var objCells = table.rows[i].cells;
-
 
330
 
-
 
331
					leadBrands = {
-
 
332
						brand: objCells[0].innerText,
-
 
333
						value: objCells[1].getElementsByTagName('input')[0].value
-
 
334
					}
-
 
335
					brandValueJson.push(leadBrands);
-
 
336
				}
-
 
337
 
-
 
338
 
-
 
339
			}
-
 
340
 
-
 
341
 
281
			var leaddetailData = {}
342
			var leaddetailData = {}
282
			leaddetailData['firstName'] = firstName;
343
			leaddetailData['firstName'] = firstName;
283
			leaddetailData['lastName'] = lastName
344
			leaddetailData['lastName'] = lastName
284
			leaddetailData['mobile'] = mobile
345
			leaddetailData['mobile'] = mobile
285
			leaddetailData['address'] = address
346
			leaddetailData['address'] = address
Line 287... Line 348...
287
			leaddetailData['state'] = state
348
			leaddetailData['state'] = state
288
			leaddetailData['status'] = status
349
			leaddetailData['status'] = status
289
			leaddetailData['remark'] = remark
350
			leaddetailData['remark'] = remark
290
			leaddetailData['assignTo'] = assignTo
351
			leaddetailData['assignTo'] = assignTo
291
			leaddetailData['source'] = source
352
			leaddetailData['source'] = source
-
 
353
 
-
 
354
 
-
 
355
 
292
			if (status == "followUp") {
356
			if (status == "followUp") {
293
				leaddetailData['schelduleTimestamp'] = getDatesFromPicker('#scheduleTime').startDate;
357
				leaddetailData['schelduleTimestamp'] = getDatesFromPicker('#scheduleTime').startDate;
294
 
358
 
295
				leaddetailData['communicationType'] = communicationType
359
				leaddetailData['communicationType'] = communicationType
296
			}
360
			}
-
 
361
 
-
 
362
 
-
 
363
 
-
 
364
 
-
 
365
			leaddetailData['outletName'] = outletName;
-
 
366
 
-
 
367
			leaddetailData['counterSize'] = counterSize;
-
 
368
 
-
 
369
 
-
 
370
			leaddetailData['leadBrands'] = brandValueJson;
-
 
371
 
-
 
372
			console.log(localStorage.getItem("frontp"));
-
 
373
 
-
 
374
 
-
 
375
			leaddetailData['frontp'] = localStorage
-
 
376
				.getItem("frontph");
-
 
377
 
-
 
378
 
-
 
379
			leaddetailData['frontWithMarket'] = localStorage
-
 
380
				.getItem("internalMarketh");
-
 
381
 
-
 
382
 
-
 
383
			leaddetailData['internalLongShot'] = localStorage
-
 
384
				.getItem("leftShoth");
-
 
385
 
-
 
386
 
-
 
387
			leaddetailData['internalLeftWall'] = localStorage
-
 
388
				.getItem("leftWallh");
-
 
389
 
-
 
390
 
-
 
391
			leaddetailData['internalRightWall'] = localStorage
-
 
392
				.getItem("rightWallh");
-
 
393
 
297
			console.log(leaddetailData);
394
			console.log(leaddetailData);
298
 
395
 
299
			if (confirm("Are you sure you want to add lead!") == true) {
396
			if (confirm("Are you sure you want to add lead!") == true) {
300
				doPostAjaxRequestWithJsonHandler(context + "/createLead",
397
				doPostAjaxRequestWithJsonHandler(context + "/createLead",
301
					JSON.stringify(leaddetailData), function(response) {
398
					JSON.stringify(leaddetailData), function(response) {
Line 320... Line 417...
320
		$("#assignTo").val("")
417
		$("#assignTo").val("")
321
		$("#editStatus").val("");
418
		$("#editStatus").val("");
322
		$("#reason").val("");
419
		$("#reason").val("");
323
		$("#statusFilter").val("");
420
		$("#statusFilter").val("");
324
 
421
 
325
		localStorage.removeItem("frontp");
422
		localStorage.removeItem("frontph");
326
		localStorage.removeItem("leftShot");
423
		localStorage.removeItem("leftShoth");
327
		localStorage.removeItem("rightWall");
424
		localStorage.removeItem("rightWallh");
328
		localStorage.removeItem("leftWall");
425
		localStorage.removeItem("leftWallh");
329
		localStorage.removeItem("internalMarket");
426
		localStorage.removeItem("internalMarketh");
330
 
427
 
331
 
428
 
332
		row = $(this).closest("tr");
429
		row = $(this).closest("tr");
333
		$("#editScheduleTime").hide();
430
		$("#editScheduleTime").hide();
334
		leadId = $(this).data('leadid');
431
		leadId = $(this).data('leadid');
Line 358... Line 455...
358
		function() {
455
		function() {
359
 
456
 
360
 
457
 
361
			console.log(row);
458
			console.log(row);
362
			var rowIndex = $(this).closest('tr').prevAll().length;
459
			var rowIndex = $(this).closest('tr').prevAll().length;
363
 
-
 
364
			var remark = $('input[name="remark"]').val();
460
			var remark = $('input[name="remark"]').val();
365
			var assignTo = $("#assignTo").val();
461
			var assignTo = $("#assignTo").val();
366
			var editStatus = $("#editStatus").val();
462
			var editStatus = $("#editStatus").val();
367
			var reason = $("#reason").val();
463
			var reason = $("#reason").val();
368
 
464
 
Line 451... Line 547...
451
		function() {
547
		function() {
452
 
548
 
453
			console.log("hello");
549
			console.log("hello");
454
			var outletName = $('input[name="outletName"]').val();
550
			var outletName = $('input[name="outletName"]').val();
455
			var counterSize = $('input[name="counterSize"]').val();
551
			var counterSize = $('input[name="counterSize"]').val();
456
			var table = document.getElementById('brandtable');
552
			var table = document.getElementById('editbrandtable');
457
			var brandValueJson = [];
553
			var brandValueJson = [];
458
			var leadBrands;
554
			var leadBrands;
459
 
555
 
460
			if (outletName === "") {
556
			if (outletName === "") {
461
				alert("Outlet Name is required");
557
				alert("Outlet Name is required");
Line 465... Line 561...
465
			if (counterSize === "") {
561
			if (counterSize === "") {
466
				alert("Counter Size is required");
562
				alert("Counter Size is required");
467
				return;
563
				return;
468
			}
564
			}
469
 
565
 
470
			if (localStorage.getItem("frontp") == "undefined" && localStorage.getItem("frontp") == null) {
566
			if (localStorage.getItem("frontph") == "undefined" && localStorage.getItem("frontph") == null) {
471
				alert("Front Document is required");
567
				alert("Front Document is required");
472
				return;
568
				return;
473
			}
569
			}
474
 
570
 
475
			if (localStorage.getItem("internalMarket") == "undefined" || localStorage.getItem("internalMarket") == null) {
571
			if (localStorage.getItem("internalMarketh") == "undefined" || localStorage.getItem("internalMarketh") == null) {
476
				alert("Front With Market Document is required");
572
				alert("Front With Market Document is required");
477
				return;
573
				return;
478
			}
574
			}
479
 
575
 
480
			if (localStorage.getItem("leftShot") == "undefined" || localStorage.getItem("leftShot") == null) {
576
			if (localStorage.getItem("leftShoth") == "undefined" || localStorage.getItem("leftShoth") == null) {
481
				alert("Internal Left Shot Document is required");
577
				alert("Internal Left Shot Document is required");
482
				return;
578
				return;
483
			}
579
			}
484
 
580
 
485
			if (localStorage.getItem("leftWall") == "undefined" || localStorage.getItem("leftWall") == null) {
581
			if (localStorage.getItem("leftWallh") == "undefined" || localStorage.getItem("leftWallh") == null) {
486
				alert("Internal Left Wall Document is required");
582
				alert("Internal Left Wall Document is required");
487
				return;
583
				return;
488
			}
584
			}
489
 
585
 
490
 
586
 
491
			if (localStorage.getItem("rightWall") == "undefined" || localStorage.getItem("rightWall") == null) {
587
			if (localStorage.getItem("rightWallh") == "undefined" || localStorage.getItem("rightWallh") == null) {
492
				alert("Internal Right Wall Document is required");
588
				alert("Internal Right Wall Document is required");
493
				return;
589
				return;
494
			}
590
			}
495
 
591
 
496
 
592
 
Line 520... Line 616...
520
 
616
 
521
			console.log(localStorage.getItem("frontp"));
617
			console.log(localStorage.getItem("frontp"));
522
 
618
 
523
 
619
 
524
			leadDetailObject['frontp'] = localStorage
620
			leadDetailObject['frontp'] = localStorage
525
				.getItem("frontp");
621
				.getItem("frontph");
526
 
622
 
527
 
623
 
528
			leadDetailObject['frontWithMarket'] = localStorage
624
			leadDetailObject['frontWithMarket'] = localStorage
529
				.getItem("internalMarket");
625
				.getItem("internalMarketh");
530
 
626
 
531
 
627
 
532
			leadDetailObject['internalLongShot'] = localStorage
628
			leadDetailObject['internalLongShot'] = localStorage
533
				.getItem("leftShot");
629
				.getItem("leftShoth");
534
 
630
 
535
 
631
 
536
			leadDetailObject['internalLeftWall'] = localStorage
632
			leadDetailObject['internalLeftWall'] = localStorage
537
				.getItem("leftWall");
633
				.getItem("leftWallh");
538
 
634
 
539
 
635
 
540
			leadDetailObject['internalRightWall'] = localStorage
636
			leadDetailObject['internalRightWall'] = localStorage
541
				.getItem("rightWall");
637
				.getItem("rightWallh");
542
 
638
 
543
			console.log(leadDetailObject);
639
			console.log(leadDetailObject);
544
 
640
 
545
			if (confirm("Are you sure you want to add lead detail!") == true) {
641
			if (confirm("Are you sure you want to add lead detail!") == true) {
546
				doPostAjaxRequestWithJsonHandler(context + "/leadDetail", JSON.stringify(leadDetailObject), function(response) {
642
				doPostAjaxRequestWithJsonHandler(context + "/leadDetail", JSON.stringify(leadDetailObject), function(response) {
Line 553... Line 649...
553
			}
649
			}
554
 
650
 
555
		});
651
		});
556
 
652
 
557
 
653
 
558
	$(document).on('change', '#frontp',
654
	$(document).on('change', '.frontp',
559
		function() {
655
		function() {
560
 
656
 
561
			if (confirm('Document has been selected, Do you want to upload ?')) {
657
			if (confirm('Document has been selected, Do you want to upload ?')) {
562
 
658
 
563
				var fileSelector = $('#frontp')[0];
-
 
564
 
-
 
565
				var documentId = uploadImage(fileSelector, "frontp");
659
				var documentId = uploadImage(this, "frontph");
566
 
660
 
567
 
661
 
568
 
662
 
569
 
663
 
570
 
664
 
571
			} else {
665
			} else {
572
 
666
 
573
			}
667
			}
574
		});
668
		});
575
 
669
 
576
	$(document).on('change', '#internalMarket',
670
	$(document).on('change', '.internalMarket',
577
		function() {
671
		function() {
578
 
672
 
579
			if (confirm('Document has been selected, Do you want to upload ?')) {
673
			if (confirm('Document has been selected, Do you want to upload ?')) {
580
 
674
 
581
				var fileSelector = $('#internalMarket')[0];
-
 
582
 
-
 
583
				var documentId = uploadImage(fileSelector, "internalMarket");
675
				var documentId = uploadImage(this, "internalMarketh");
584
 
676
 
585
			} else {
677
			} else {
586
 
678
 
587
			}
679
			}
588
		});
680
		});
589
 
681
 
590
	$(document).on('change', '#leftShot',
682
	$(document).on('change', '.leftShot',
591
 
683
 
592
		function() {
684
		function() {
593
 
-
 
594
			if (confirm('Document has been selected, Do you want to upload ?')) {
685
			if (confirm('Document has been selected, Do you want to upload ?')) {
595
				var fileSelector = $('#leftShot')[0];
-
 
596
 
-
 
597
				var documentId = uploadImage(fileSelector, "leftShot");
686
				var documentId = uploadImage(this, "leftShoth");
598
 
-
 
599
 
-
 
600
 
-
 
601
			} else {
687
			} else {
602
 
688
 
603
			}
689
			}
604
		});
690
		});
605
 
691
 
606
	$(document).on('change', '#leftWall',
692
	$(document).on('change', '.leftWall',
607
		function() {
693
		function() {
608
 
-
 
609
			if (confirm('Document has been selected, Do you want to upload ?')) {
694
			if (confirm('Document has been selected, Do you want to upload ?')) {
610
				var fileSelector = $('#leftWall')[0];
-
 
611
 
-
 
612
				var documentId = uploadImage(fileSelector, "leftWall");
695
				var documentId = uploadImage(this, "leftWallh");
613
 
-
 
614
 
-
 
615
 
-
 
616
			} else {
696
			} else {
617
 
697
 
618
			}
698
			}
619
		});
699
		});
620
 
700
 
621
	$(document).on('change', '#rightWall',
701
	$(document).on('change', '.rightWall',
622
 
-
 
623
		function() {
702
		function() {
624
 
-
 
625
			if (confirm('Document has been selected, Do you want to upload ?')) {
703
			if (confirm('Document has been selected, Do you want to upload ?')) {
626
				var fileSelector = $('#rightWall')[0];
-
 
627
 
-
 
628
				var documentId = uploadImage(fileSelector, "rightWall");
704
				var documentId = uploadImage(this, "rightWallh");
629
 
-
 
630
 
-
 
631
 
-
 
632
 
-
 
633
			} else {
705
			} else {
634
 
-
 
635
			}
706
			}
636
		});
707
		});
637
 
708
 
638
 
709
 
639
 
710