Subversion Repositories SmartDukaan

Rev

Rev 10098 | 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:gainsboro};
.diffColor {
    background: grey;
}
</style>
<style type="text/css">
.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/flipkart-list!fetchItems?searchText="+"&next=0",
                beforeSend: function(){
        $('#ajax-spinner').show();
        },
        complete: function(){
        $('#ajax-spinner').hide();
        },
        success : function(response) {
        $('#' + 'snapdeal-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("it");
                loadItemDetails("/Support/flipkart-list/"+ itemId +"/edit");
    });
});
</script>
<script type="text/javascript">
function getNextItems(start,end,searchText){
jQuery.ajax({
        type : "GET",
        url : "/Support/flipkart-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");
                        }
            $('#' + 'snapdeal-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/flipkart-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);
            $('#' + 'snapdeal-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/flipkart-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) {
            $('#' + 'snapdeal-table').html(response);
                        $('#' + 'snapdealitem-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) {
            $('#' + 'snapdealitem-details').html(response);
        },
                error : function() {
                        alert("Unable to get Item details.Please try again.");
                 },
    });  
}
</script>
<script type="text/javascript">
$(function(){   
$("#snapdeal-form").live('submit', function(){
        var itemWeight=$('#itemWeight').val();
        var transferPrice=$('#transferPrice').val();
        var warehouseId=$('#warehouseId').val();
        var itemId=$('#itemId').val();
        var maxNlc=$('#maxNlc').val();
        var minPossibleSp=$('#minPosSp').val();
        var sellingPrice=$('#sellingPrice').val();
        var otherCost=$('#otherCost').val();
        var serial_number=$('#fkSerialNumber').val();
        var sdItem=$('#fkItemCode').val();
        var maxSellingPrice=$('#maxSp').val();
        var websiteMrp=$('#webisteMrp').val();
        
        if (serial_number=="" || serial_number==null){
                jAlert('Illegal Entry In Flipkart Serial Number', 'ERROR');
                return false;
        }
        
        if (sdItem=="" || sdItem==null){
                jAlert('Illegal Entry In Sku@Flipkart', 'ERROR');
                return false;
        }
        
        if (warehouseId=="" || isNaN(warehouseId)){
                jAlert('Illegal Entry In Warehouse Id', 'ERROR');
                return false;
        }
        
        if (transferPrice==0 || transferPrice=="" || isNaN(transferPrice)){
                jAlert('Illegal Entry In Transfer Price', 'ERROR');
                return false;
        }
        
        if (sellingPrice==0 || sellingPrice=="" || isNaN(sellingPrice)){
                jAlert('Illegal Entry In Selling Price', 'ERROR');
                return false;
        }
        
        if (maxSellingPrice=="" || isNaN(maxSellingPrice)){
                jAlert('Illegal Entry In Maximum Selling Price ', 'ERROR');
                return false;
        }
        
        if (parseFloat(maxSellingPrice) > parseFloat(websiteMrp)){
                jAlert('Maximum Selling Price can\'t be greater than MRP ', 'ERROR');
                return false;
        }
        
        if (otherCost=="" || isNaN(otherCost)){
                jAlert('Illegal Entry In Other Cost ', 'ERROR');
                return false;
        }
        
        if (maxNlc==0 || maxNlc=="" || isNaN(maxNlc)){
                jAlert('Illegal Entry In Max NLC field', 'ERROR');
                return false;
        }
        
        if (parseFloat(sellingPrice) < minPossibleSp){
                if ((confirm('Selling Price is below Minimum Possible Selling Price.Do you want to update?'))){
                        if (!(confirm('Are you sure?Selling Price is below Minimum Possible Selling Price.'))){
                        return false;
                        }
                }
                else{
                        return false;
                }
        }
        
        

        var data = $(this).serialize() 

    jQuery.ajax({
        url: "/Support/flipkart-list!update",
        type: 'POST',
        data: data,
        async: false,
                beforeSend: function(){
        $('#ajax-spinner').show();
        },
        complete: function(){
        $('#ajax-spinner').hide();
        },
        success: function (data) {
                        if(data==0){
                                alert("Backend validation failed");
                                return false;
                        }
                        else{
                                alert("Backend validation sucess");
                        }
            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(){   
$("#add-new-item").live('submit', function(){
        var itemWeight=$('#itemWeight').val();
        var transferPrice=$('#transferPrice').val();
        var warehouseId=$('#warehouseId').val();
        var itemId=$('#itemId').val();
        var maxNlc=$('#maxNlc').val();
        var otherCost=$('#otherCost').val();
        var minPossibleSp=$('#minPosSp').val();
        var sellingPrice=$('#sellingPrice').val();
        var maxSellingPrice=$('#maxSp').val();
        var websiteMrp=$('#webisteMrp').val();
        var serial_number=$('#fkSerialNumber').val();
        var sdItem=$('#fkItemCode').val();
        
        if (serial_number=="" || serial_number==null){
                jAlert('Illegal Entry In Flipkart Serial Number', 'ERROR');
                return false;
        }
        
        if (sdItem=="" || sdItem==null){
                jAlert('Illegal Entry In Sku@Flipkart', 'ERROR');
                return false;
        }
        
        if (itemId==0 || itemId=="" || isNaN(itemId)){
                jAlert('Illegal Entry In Item Id ', 'ERROR');
                return false;
        }
        
        if (warehouseId=="" || isNaN(warehouseId)){
                jAlert('Illegal Entry In Warehouse Id ', 'ERROR');
                return false;
        }
        
        if (sellingPrice==0 || sellingPrice=="" || isNaN(sellingPrice)){
                jAlert('Illegal Entry In Selling Price', 'ERROR');
                return false;
        }
        
        if (transferPrice==0 || transferPrice=="" || isNaN(transferPrice)){
                jAlert('Illegal Entry In Transfer Price ', 'ERROR');
                return false;
        }
        
        if (maxSellingPrice=="" || isNaN(maxSellingPrice)){
                jAlert('Illegal Entry In Maximum Selling Price ', 'ERROR');
                return false;
        }
        
        if (parseFloat(maxSellingPrice) > parseFloat(websiteMrp)){
                jAlert('Maximum Selling Price can\'t be greater than MRP ', 'ERROR');
                return false;
        }
        
        if (otherCost=="" || isNaN(otherCost)){
                jAlert('Illegal Entry In Other Cost ', 'ERROR');
                return false;
        }
        
        if (maxNlc==0 || maxNlc=="" || isNaN(maxNlc)){
                jAlert('Illegal Entry In Max NLC field', 'ERROR');
                return false;
        }
        
        if (parseFloat(sellingPrice) < minPossibleSp){
                if ((confirm('Selling Price is below Minimum Possible Selling Price.Do you want to update?'))){
                        if (!(confirm('Are you sure?Selling Price is below Minimum Possible Selling Price.'))){
                        return false;
                        }
                }
                else{
                        return false;
                }
        }
        
    var data = $(this).serialize() 

    jQuery.ajax({
        url: "/Support/flipkart-list!addNewItem",
        type: 'POST',
        data: data,
        async: false,
                beforeSend: function(){
        $('#ajax-spinner').show();
        },
        complete: function(){
        $('#ajax-spinner').hide();
        },
        success: function (data) {
           if(data==0){
                                alert("Backend validation failed");
                                return false;
                        }
                        else{
                                alert("Backend validation sucess");
                        }
            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">
$('#addNewItem').live('click', function(){
        jQuery.ajax({
        type : "GET",
        url : "/Support/flipkart-list!getAddNewItemForm",
                beforeSend: function(){
        $('#ajax-spinner').show();
        },
        complete: function(){
        $('#ajax-spinner').hide();
        },
        success : function(response) {
            $('#' + 'snapdealitem-details').html(response);
        },
                error : function() {
                        alert("Unable to get add new item form.");
                 },
    });
});
</script>
<script type="text/javascript">
$('.changeHeld').live('click', function(){
        var whId = $(this).attr('warehouse_id');
        var item_id = $(this).attr('item_id');
        var held=$('#heldInventory_'+whId).val();
        if (held<0 || held=="" || isNaN(held)){
                jAlert('Illegal Entry In Held ', 'ERROR');
                return false;
        }
        jQuery.ajax({
        type : "GET",
        url : "/Support/flipkart-list!changeHeldForSource?itemId="+item_id+"&warehouseId="+whId+"&held="+held,
                beforeSend: function(){
        $('#ajax-spinner').show();
        },
        complete: function(){
        $('#ajax-spinner').hide();
        },
        success : function(json){
                alert("Updated successfuly New Held="+held+" for warehouse Id "+whId);
        },
                error : function() {
                        alert("Unable to update");
                 },
    });
        return false;
});
</script>
<title>Flipkart Listed Items</title>
</head>
<body>
        <div style="padding: 20px 0px;">
           <a style="padding-left: 10px;" href="/Support/flipkart-list/flipkart-list-options">Back</a>
           <a style="padding-left: 10px;" href="/Support/logout">Logout</a>
           <input type="button" style="padding-left: 5px; margin-left: 10px;width: 15%;float:right;" id="addNewItem" name="addNewItem" value="Add New Item">
           <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="snapdeal-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="snapdealitem-details" style="padding-top: 30px;">
        </div>
    

</div>

</body>
</html>