Subversion Repositories SmartDukaan

Rev

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

$(function() {
        
        $(".punch-in-outs").live('click', function() {
                loadPunchInOuts("main-content");
        });
        
        $("#punch-in-outs-paginated .next").live('click', function() {
                loadPaginatedNextItems('/getPaginatedPunchInOuts', null, 'punch-in-outs-paginated', 'punch-in-outs-table', null);
                $(this).blur();
    });
        
        $("#punch-in-outs-paginated .previous").live('click', function() {
                loadPaginatedPreviousItems('/getPaginatedPunchInOuts', null, 'punch-in-outs-paginated', 'punch-in-outs-table', null);
                $(this).blur();
    });
});

function createPunchInOut(inOut){
        if(confirm("Are you sure you want to do punch "+inOut) == true){
                var distance = $('.fofo-store-distance').val();
                if(distance == undefined){
                        alert("Unable to fetch your device location");
                        return;
                }
                if(distance < 500){
                        doPostAjaxRequestWithParamsHandler(context+"/createPunchInOut", {}, function(response){
                                $('#main-content').html(response);
                                alert("Punch "+inOut+" done successfully");
                        });
                }else{
                        alert("Punch "+inOut+" can only be done in 500M range from actual location");
                }
        }
}

function loadPunchInOuts(domId){
        doGetAjaxRequestHandler(context+"/getPunchInOuts", function(response){
                $('#' + domId).html(response);
        });
}