Subversion Repositories SmartDukaan

Rev

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

Rev 18604 Rev 18633
Line 495... Line 495...
495
        $('#message').append("Please select an address...");
495
        $('#message').append("Please select an address...");
496
        $('#message').removeClass('hidden');
496
        $('#message').removeClass('hidden');
497
        setTimeout(function() {
497
        setTimeout(function() {
498
            $('#message').addClass('hidden');
498
            $('#message').addClass('hidden');
499
        }, 2000);
499
        }, 2000);
-
 
500
        $('.confirmprepaid').addClass('confirmprepaid').removeClass('confirmprepaidDisabled');
500
        return;
501
        return;
501
	}
502
	}
502
	
503
	
503
	var url = apihost + 'checkout/?user_id='+me+'&cod=0';
504
	var url = apihost + 'checkout/?user_id='+me+'&cod=0';
504
    var newForm = $('<form>', {
505
    var newForm = $('<form>', {
Line 507... Line 508...
507
    }).append($('<input>', {
508
    }).append($('<input>', {
508
        'name': 'addressid',
509
        'name': 'addressid',
509
        'value': addressid,
510
        'value': addressid,
510
        'type': 'hidden'
511
        'type': 'hidden'
511
    })).append($('<input>', {
512
    })).append($('<input>', {
-
 
513
        'name': 'paymethod',
-
 
514
        'value': 'oth',
-
 
515
        'type': 'hidden'
-
 
516
    })).append($('<input>', {
512
        'name': 'cart_details',
517
        'name': 'cart_details',
513
        'value': localStorage.getItem('cart_details'),
518
        'value': localStorage.getItem('cart_details'),
514
        'type': 'hidden'
519
        'type': 'hidden'
515
    }));
520
    }));
516
    newForm.submit();
521
    newForm.submit();
Line 527... Line 532...
527
        $('#message').append("Please select an address...");
532
        $('#message').append("Please select an address...");
528
        $('#message').removeClass('hidden');
533
        $('#message').removeClass('hidden');
529
        setTimeout(function() {
534
        setTimeout(function() {
530
            $('#message').addClass('hidden');
535
            $('#message').addClass('hidden');
531
        }, 2000);
536
        }, 2000);
-
 
537
        $('button.confirmcheckout').prop( "disabled", false );
532
        return;
538
        return;
533
	}
539
	}
534
	
540
	
535
    var newForm = $('<form>', {
541
    var newForm = $('<form>', {
536
        'action': url,
542
        'action': url,
Line 541... Line 547...
541
        'type': 'hidden'
547
        'type': 'hidden'
542
    }));
548
    }));
543
    newForm.submit();
549
    newForm.submit();
544
}
550
}
545
 
551
 
-
 
552
function confirmCreditCheckout(){
-
 
553
	if (typeof addressid=="undefined"){
-
 
554
		addressid=$("input.css-checkbox:checked").val();
-
 
555
	}
-
 
556
	if (addressid==undefined || typeof addressid=="undefined"){
-
 
557
		$('#loadingModal').modal('hide');
-
 
558
		$('#message').empty();
-
 
559
        $('#message').append("Please select an address...");
-
 
560
        $('#message').removeClass('hidden');
-
 
561
        setTimeout(function() {
-
 
562
            $('#message').addClass('hidden');
-
 
563
        }, 2000);
-
 
564
        $('button.confirmcredit').prop( "disabled", false );
-
 
565
        return;
-
 
566
	}
-
 
567
	
-
 
568
	var url = apihost + 'checkout/?user_id='+me+'&cod=0';
-
 
569
    var newForm = $('<form>', {
-
 
570
        'action': url,
-
 
571
        'method':'post'
-
 
572
    }).append($('<input>', {
-
 
573
        'name': 'addressid',
-
 
574
        'value': addressid,
-
 
575
        'type': 'hidden'
-
 
576
    })).append($('<input>', {
-
 
577
        'name': 'paymethod',
-
 
578
        'value': 'cap_float',
-
 
579
        'type': 'hidden'
-
 
580
    })).append($('<input>', {
-
 
581
        'name': 'cart_details',
-
 
582
        'value': localStorage.getItem('cart_details'),
-
 
583
        'type': 'hidden'
-
 
584
    }));
-
 
585
    newForm.submit();
-
 
586
}
-
 
587
 
546
$(document).on('click','.confirmprepaid', function(){
588
$(document).on('click','.confirmprepaid', function(){
547
	$('.confirmprepaid').addClass('confirmprepaidDisabled').removeClass('confirmprepaid');
589
	$('.confirmprepaid').addClass('confirmprepaidDisabled').removeClass('confirmprepaid');
548
	$('#loadingModal').modal('show');
590
	$('#loadingModal').modal('show');
549
	confirmPrepaid();
591
	confirmPrepaid();
550
});
592
});
551
$(document).on('click','button.confirmcheckout', function(){
593
$(document).on('click','button.confirmcheckout', function(){
552
	$('button.confirmcheckout').prop( "disabled", true );
594
	$('button.confirmcheckout').prop( "disabled", true );
553
	$('#loadingModal').modal('show');
595
	$('#loadingModal').modal('show');
554
	confirmCheckout();
596
	confirmCheckout();
555
});
597
});
556
 
-
 
557
/*
-
 
558
$('.button-checkbox').each(function () {
598
$(document).on('click','button.confirmcredit', function(){
559
 
-
 
560
    // Settings
-
 
561
    var $widget = $(this),
-
 
562
        $button = $widget.find('button'),
-
 
563
        $checkbox = $widget.find('input:checkbox'),
-
 
564
        color = $button.data('color'),
-
 
565
        settings = {
-
 
566
            on: {
-
 
567
                icon: 'glyphicon glyphicon-check'
-
 
568
            },
-
 
569
            off: {
-
 
570
                icon: 'glyphicon glyphicon-unchecked'
-
 
571
            }
-
 
572
        };
-
 
573
 
-
 
574
    // Event Handlers
-
 
575
    $button.on('click', function () {
-
 
576
        $checkbox.prop('checked', !$checkbox.is(':checked'));
-
 
577
        $checkbox.triggerHandler('change');
-
 
578
        updateDisplay();
-
 
579
    });
-
 
580
    $checkbox.on('change', function () {
-
 
581
        updateDisplay();
-
 
582
    });
-
 
583
 
-
 
584
    // Actions
-
 
585
    function updateDisplay() {
-
 
586
        var isChecked = $checkbox.is(':checked');
-
 
587
 
-
 
588
        // Set the button's state
-
 
589
        $button.data('state', (isChecked) ? "on" : "off");
599
	$('button.confirmcredit').prop( "disabled", true );
590
 
-
 
591
        // Set the button's icon
-
 
592
        $button.find('.state-icon')
600
	$('#loadingModal').modal('show');
593
            .removeClass()
-
 
594
            .addClass('state-icon ' + settings[$button.data('state')].icon);
-
 
595
 
-
 
596
        // Update the button's color
-
 
597
        if (isChecked) {
601
	confirmCreditCheckout();
598
            $button
-
 
599
                .removeClass('btn-default')
-
 
600
                .addClass('colorbtn active');
-
 
601
        }
-
 
602
        else {
-
 
603
            $button
-
 
604
                .removeClass('colorbtn active')
-
 
605
                .addClass('btn-default');
-
 
606
        }
-
 
607
    }
-
 
608
 
-
 
609
    // Initialization
-
 
610
    function init() {
-
 
611
 
-
 
612
        updateDisplay();
-
 
613
 
-
 
614
        // Inject the icon if applicable
-
 
615
        if ($button.find('.state-icon').length == 0) {
-
 
616
            $button.prepend('<i class="state-icon ' + settings[$button.data('state')].icon + '"></i>');
-
 
617
        }
-
 
618
    }
-
 
619
    init();
-
 
620
});*/
602
});
621
 
-
 
622
 
603