Subversion Repositories SmartDukaan

Rev

Rev 12676 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<!DOCTYPE html PUBLIC 
    "-//W3C//DTD XHTML 1.1 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link type="image/x-icon" href="/Support/images/favicon_alt.ico" rel="shortcut icon">
<link href="/Support/css/demo_page_amazon.css" type="text/css" rel="stylesheet">
<link href="/Support/css/demo_table_amazon.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="/Support/js/jquery-1.4.2.js"></script>
<style type="text/css">   
* { font-family: Verdana; font-size: 96%; }
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
p { clear: both; }
.submit { margin-left: 12em; }
em { font-weight: bold; padding-right: 1em; vertical-align: top; }
ul { padding-left: 13px;}
td{background-color:#B0BED9};
.diffColor {
    background: grey;
}
</style>
<style>
.loading-image {
position: fixed;
top: 50%;
left: 50%;
margin-top: -50px;
margin-left: -100px;
z-index: 100;
}
</style>
<script type="text/javascript">
                $(function(){
jQuery.ajax({
        type : "GET",
        url : "/Support/amazon-list!fetchItems?searchText="+"&next=0",
                beforeSend: function(){
        $('#ajax-spinner').show();
        },
        complete: function(){
        $('#ajax-spinner').hide();
        },
        success : function(response) {
        $('#' + 'amazon-table').html(response);
                $(".previous").css("display", "none");
                var temp = $('.totalValue').text();
                $('.total').text(temp);
        }
    });  
});
</script>
                
<script type="text/javascript">
  $(function(){ 
        $(".next").live('click', function() {
                var start = $( ".valueStart" ).text();
                var end = $( ".valueEnd" ).text();
                var searchText = $('#search_text').val();
                getNextItems(start,end,searchText);
    });
        $(".previous").live('click', function() {
                var start = $( ".valueStart" ).text();
                var end = $( ".valueEnd" ).text();
                var pre = end - 20;
                var searchText = $('#search_text').val();
                getPreviousItems(start,end,pre,searchText);
    });
        $("#search_item").live('click', function() {
                var searchText = $('#search_text').val();
                loadSearchInfo(searchText);
    });
        
        $("#search_text").keyup(function(event){
        if(event.keyCode == 13){
                $("#search_item").click();
        }
        });
        
        $(".editItem").live('click', function() {
                $("tr").removeClass("diffColor");
                $("td").css("background-color","")
        $(this).parents("tr").addClass("diffColor");
                $('tr.diffColor').children('td').css('backgroundColor', '#7F98FA');
                var itemId = $(this).attr('itemid')
                loadItemDetails("/Support/amazon-list/"+ itemId +"/edit");
    });
});
</script>
<script type="text/javascript">
function getNextItems(start,end,searchText){
jQuery.ajax({
        type : "GET",
        url : "/Support/amazon-list!fetchItems?searchText="+searchText+"&next="+end,
                beforeSend: function(){
        $('#ajax-spinner').show();
        },
        complete: function(){
        $('#ajax-spinner').hide();
        },
        success : function(response) {
                        $('.valueEnd').text(+end + +10);
                        $('.valueStart').text(+start + +10);
                        var last = $('.valueEnd').text();
                        var temp = $('.total').text();
                        if (parseInt(last) >= parseInt(temp)){
                                $(".next").css("display", "none");
                        }
            $('#' + 'amazon-table').html(response);
                        $(".previous").css("display", "");
        },
                error : function() {
                        alert("Unable to fetch items");
                 },
    });  
}
function getPreviousItems(start,end,pre,searchText){
jQuery.ajax({
        type : "GET",
        url : "/Support/amazon-list!fetchItems?searchText="+searchText+"&next="+pre,
                beforeSend: function(){
        $('#ajax-spinner').show();
        },
        complete: function(){
        $('#ajax-spinner').hide();
        },
        success : function(response) {
                        $('.valueEnd').text(+end - +10);
                        $('.valueStart').text(+start - +10);
            $('#' + 'amazon-table').html(response);
                        $(".next").css("display", "");  
                        if (parseInt(start)==11)
                        {
                          $(".previous").css("display", "none");        
                        }
                        
        },
                error : function() {
                        alert("Unable to fetch items");
                 },
    });
}
function loadSearchInfo(searchText){
jQuery.ajax({
        type : "GET",
        url : "/Support/amazon-list!fetchItems?searchText="+searchText+"&next=0",beforeSend: function(){
        $('#ajax-spinner').show();
        },
        complete: function(){
        $('#ajax-spinner').hide();
        },
                beforeSend: function(){
        $('#ajax-spinner').show();
        },
        complete: function(){
        $('#ajax-spinner').hide();
        },
        success : function(response) {
            $('#' + 'amazon-table').html(response);
                        $('#' + 'item-details').html('');
                        $('.valueEnd').text(10);
                        $('.valueStart').text(1);
                        $(".previous").css("display", "none");
                        $(".next").css("display", "");
                        var temp = $('.totalValue').text();
                        var end = $('.valueEnd').text();
                        $('.total').text(temp);
                        if(parseInt(temp)<=10){
                                $(".previous").css("display", "none");
                                $(".next").css("display", "none");
                                $('.valueEnd').text(temp);
                        }
                        
                        if(searchText==""){
                                $(".previous").css("display", "none");
                                $(".next").css("display", "");
                                $('.valueEnd').text(10);
                        }
                        
        },
                error : function() {
                        alert("Unable to search given item.Please try again.");
                 },
    });  
}
function loadItemDetails(getUrl){
jQuery.ajax({
        type : "GET",
        url : getUrl,
                beforeSend: function(){
        $('#ajax-spinner').show();
        },
        complete: function(){
        $('#ajax-spinner').hide();
        },
        success : function(response) {
            $('#' + 'item-details').html(response);
        },
                error : function() {
                        alert("Unable to get Item details.Please try again.");
                 },
    });  
}
</script>
<script type="text/javascript">
$(function(){   
$("#amazon-form").live('submit', function(){
    var fbaPrice = $('#fbaPrice').val();
    var nonFbaPrice = $('#sellingPrice').val();
        var fbbPrice = $('#fbbPrice').val();
    var holdInventory = $('#holdInventory').val();
    var defaultInventory = $('#defaultInventory').val();
    var customHandlingTime = $('#customHandlingTime').val();
    if ( fbaPrice==null || fbaPrice=="" || isNaN(fbaPrice))
      {
      jAlert('Illegal Entry In Fba Price Field', 'ERROR');
      return false;
      }
          
    if ( nonFbaPrice==null || nonFbaPrice=="" || isNaN(nonFbaPrice) )
      {
      jAlert('Illegal Entry In Non Fba Price Field', 'ERROR');
      return false;
      }
          
    if ( fbbPrice==null || fbbPrice=="" || isNaN(fbbPrice) )
      {
      jAlert('Illegal Entry In Fbb Price Field', 'ERROR');
      return false;
      }
      
    if ( customHandlingTime > 30 || customHandlingTime==null || customHandlingTime=="" || isNaN(customHandlingTime) )
      {
      jAlert('Unacceptable Value In Lead Time To Ship', 'ERROR');
      return false;
      }
          
    if ( holdInventory==null || holdInventory=="" || isNaN(holdInventory))
      {
      jAlert('Illegal Entry In Hold Inventory Field', 'ERROR');
      return false;
      }
          
    if ( defaultInventory==null || defaultInventory=="" || isNaN(defaultInventory) )
      {
      jAlert('Illegal Entry In Default Inventory Field', 'ERROR');
      return false;
      }         


    var data = $(this).serialize() 

    jQuery.ajax({
        url: "/Support/amazon-list!update",
        type: 'POST',
        data: data,
        async: false,
                beforeSend: function(){
        $('#ajax-spinner').show();
        },
        complete: function(){
        $('#ajax-spinner').hide();
        },
        success: function (data) {
            alert("Changes propagated successfully");
        },
                 error : function() {
                        alert("OOPS!!!Failed to do changes.Try Again.");
                 },
        cache: false,
        contentType: "application/x-www-form-urlencoded",
        processData: false
    });

    return false;
});
});
</script>
<script type="text/javascript">
$(function(){   
$("#amazon-promo-form").live('submit', function(){
    var fbaPromoStatus = $('#isFbaPromotionActive').val();
        var fbbPromoStatus = $('#isFbbPromotionActive').val();
        if (fbaPromoStatus=="true"){
                var fbaPromoPrice = parseFloat($('#fbaPromoPrice').val());
                var maxFbaSalePrice = parseFloat($('#fbaMaxSalePrice').val());
                
                if (fbaPromoPrice<=0 || fbaPromoPrice==null || fbaPromoPrice=="" || isNaN(fbaPromoPrice)){
                        jAlert('Illegal value in Fba Promo Price field', 'ERROR');
                return false;
                }
                
                if (maxFbaSalePrice<=0){
                        jAlert('Illegal value in Fba Max Promo Price field', 'ERROR');
                return false;
                }
                
                if (fbaPromoPrice > maxFbaSalePrice){
                        jAlert('Fba Promo Price cant be greater than Fba Max Promo Price', 'ERROR');
                return false;
                }
        }
        
        if (fbbPromoStatus=="true"){
                var fbbPromoPrice = parseFloat($('#fbbPromoPrice').val());
                var maxFbbSalePrice = parseFloat($('#fbbMaxSalePrice').val());
                
                if (fbbPromoPrice<=0 || fbbPromoPrice==null || fbbPromoPrice=="" || isNaN(fbbPromoPrice)){
                        jAlert('Illegal value in Fbb Promo Price field', 'ERROR');
                return false;
                }
                
                if (maxFbbSalePrice<=0){
                        jAlert('Illegal value in Fbb Max Promo Price field', 'ERROR');
                return false;
                }
                
                if (fbbPromoPrice > maxFbbSalePrice){
                        jAlert('Fbb Promo Price cant be greater than Fbb Max Promo Price', 'ERROR');
                return false;
                }
        }

        var data = $(this).serialize() 

    jQuery.ajax({
        url: "/Support/amazon-list!updatePromo",
        type: 'POST',
        data: data,
        async: false,
                beforeSend: function(){
        $('#ajax-spinner').show();
        },
        complete: function(){
        $('#ajax-spinner').hide();
        },
        success: function (data) {
            alert("Changes propagated successfully");
        },
                 error : function() {
                        alert("OOPS!!!Failed to do changes.Try Again.");
                 },
        cache: false,
        contentType: "application/x-www-form-urlencoded",
        processData: false
    });

    return false;
});
});
</script>
<title>Amazon Listed Items</title>
</head>
<body>
        <div style="padding: 20px 0px;">
           <a style="padding-left: 10px;" href="/Support/amazon-list/options">Back</a>
       <a style="padding-left: 10px;" href="/Support/logout">Logout</a>
           <input type="submit" id="search_item" value="Search" style="float: right;width:8%;">
           <input id="search_text" style="float: right;width:10%;">
</div>
<div>
    <div style="color:blue;">
    #sactionmessage()
    </div>
    <div style="color:red;">
    #sactionerror()
    </div>
                <div id="ajax-spinner" style="display:none;">
                <img src="/Support/images/ajax_loader_blue.gif" class="loading-image">
                </div>
           <div id="amazon-table">
           </div>
        <br>
        <div class="display" style="float: left;">
                Showing&nbsp;<span class="valueStart">1</span>&nbsp;to&nbsp;<span class="valueEnd">10</span>&nbsp;of&nbsp;
                <span class="total"></span>&nbsp;entries
        </div>
        <div class="paginate" style="float: right;">
                <a class="previous" href="#" style="margin: 20px;">Previous</a>
                <a class="next" href="#" style="margin: 0px;">Next</a>
        </div>
        <div id="item-details" style="padding-top: 30px;">
        </div>
    

</div>

</body>
</html>