Subversion Repositories SmartDukaan

Rev

Rev 23884 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

$(function() {
        $(".price_drop").live('click', function() {
                loadPriceDrop("main-content");
        });
        $('#download').live('click', function (){
                if (confirm("Are you sure you want to Download!") == true) {
                        priceDropId=$(this).data('download');
                console.log(priceDropId);
                doAjaxGetDownload(context+"/downloadPriceDropIMEI/"+priceDropId,
                "priceDrop"+priceDropId+".xlsx");
                }
        });
        $('#downloadtotalIMEI').live('click', function (){
                if (confirm("Are you sure you want to Download!") == true) {
                priceDropId=$(this).data('pricedropidfortotalimei');
                console.log(priceDropId);
                doAjaxGetDownload(context+"/downloadtotalPriceDropIMEI/"+priceDropId,
                "totalPriceDropIMEI"+priceDropId+".xlsx");
                }
        });
        
        
        $('#cashTopartner').live('click', function (){
                if (confirm("Are you sure you want to ProcessAmount!") == true) {
                        priceDropId=$(this).data('cashback');
                var processedamount=$("#" +priceDropId).val();
                console.log("#" + priceDropId);
                //alert(processedamount);
                if(processedamount)
                        {
                console.log(priceDropId);
                console.log(processedamount);
                loadProcessedamount(priceDropId,processedamount);
                }
                else
                        {
                        console.log(priceDropId);
                        console.log(processedamount);
                        alert("ProcessedAmount can't be empty");
                        }
                }
        });
        
});
function loadPriceDrop(domId){
        doGetAjaxRequestHandler(context+"/getItemDescription", function(response){
                $('#' + domId).html(response);
        });
}
function loadProcessedamount(priceDropId,amount){
        doPostAjaxRequestHandler(context+"/paymentAgainstPriceDrop/"+priceDropId+"/"+amount,
                function(response) {
                        if (response == 'true') {
                                alert("PriceDrop sends successfully");
                                loadPriceDrop("main-content");
                        }
                        else
                                {
                                alert("No IMEI is Eligible for PriceDrop");
                                loadPriceDrop("main-content");
                                }
        });

}