Subversion Repositories SmartDukaan

Rev

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

// franchisee sale reports ---------------------------
// franchisee sale reports ---------------------------
// franchisee sale reports ---------------------------

$(document).on('click', '.analysis-franchise-sales', function () {

    var fofoId = $(this).data("fofoid");


    let endPoint = `${context}/analysis-franchiseeSalesReport?fofoId=${fofoId}`;

    doGetAjaxRequestHandler(endPoint,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});


$(document).on('click', '.analysis-franchisee-sales-fetch-report', function () {
    var startDate = $("#analysis-startDate-franchisee-sales").val();

    var fofoId = $(this).data("fofoid");

    var endDate = $("#analysis-endDate-franchisee-sales").val();

    let endPoint = `${context}/analysis-franchiseeSalesReport?fofoId=${fofoId}&startDate=${startDate}&endDate=${endDate}`;

    doGetAjaxRequestHandler(endPoint,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});

$(document).on('click', '.analysis-download-franchisee-sales', function () {
    var fofoId = $(this).data("fofoid");
    var startDate = $("#analysis-startDate-franchisee-sales").val();

    var endDate = $("#analysis-endDate-franchisee-sales").val();

    if (startDate == "" || startDate == undefined) {

        alert("start date is not be empty!!");
        return;
    }
    if (endDate == "" || endDate == undefined) {

        alert("end date is not be empty!!");
        return;
    }
    let endPoint = `${context}/analysis-downloadFranchiseeSales?startDate=${startDate}&endDate=${endDate}&fofoId=${fofoId}`;
    window.location.href = endPoint;
});


// wallet summuary reports-----------------
// wallet summuary reports-----------------
// wallet summuary reports-----------------

$(document).on('click', ".analysis-wallet_statement", function () {
    var fofoId = $(this).data("fofoid");
    doGetAjaxRequestHandler(context + "/analysis-walletSummaryFetchReportByDate?fofoId=" + fofoId,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});

$(document).on('click', '.analysis-wallet-summary-fetch-report', function () {
    var startDate = $("#analysis-startDate-wallet-summary-report").val();

    var fofoId = $(this).data("fofoid");

    var endDate = $("#analysis-endDate-wallet-summary-report").val();

    let endPoint = `${context}/analysis-walletSummaryFetchReportByDate?fofoId=${fofoId}&startDate=${startDate}&endDate=${endDate}`;

    doGetAjaxRequestHandler(endPoint,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});

$(document).on('click', '.analysis-download-wallet-summary-report', function () {
    var fofoId = $(this).data("fofoid");
    var startDate = $("#analysis-startDate-wallet-summary-report").val();

    var endDate = $("#analysis-endDate-wallet-summary-report").val();

    if (startDate == "" || startDate == undefined) {

        alert("start date is not be empty!!");
        return;
    }
    if (endDate == "" || endDate == undefined) {

        alert("end date is not be empty!!");
        return;
    }
    let endPoint = `${context}/analysis-downloadWalletSummaryReport?startDate=${startDate}&endDate=${endDate}&fofoId=${fofoId}`;
    window.location.href = endPoint;
});


// account statement reports -----------------
// account statement reports -----------------
// account statement reports -----------------
// account statement reports -----------------

$(document).on('click', ".analysis-account-statement", function () {
    var fofoId = $(this).data("fofoid");
    doGetAjaxRequestHandler(context + "/analysis-account-statement?fofoId=" + fofoId,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});

$(document).on('click', '.analysis-download-partner-account-statement-report', function () {
    var startDate = getDatesFromPicker('input[name="analysis-accountStatementPeriod"]').startDate;
    var endDate = getDatesFromPicker('input[name="analysis-accountStatementPeriod"]').endDate;
    var fofoId = $(this).data("fofoid");
    if (startDate == "" || startDate == undefined) {
        alert("start date is not be empty!!");
        return;
    }
    if (endDate == "" || endDate == undefined) {

        alert("end date is not be empty!!");
        return;
    }
    let endPoint = `${context}/analysis/account/statement?startDate=${startDate}&endDate=${endDate}&fofoId=${fofoId}`;

    window.location.href = endPoint;
});
$(document).on('click', '.analysis-fetch-partner-account-statement-report', function () {
    var fofoId = $(this).data("fofoid");
    var startDate = getDatesFromPicker('input[name="analysis-accountStatementPeriod"]').startDate;
    var endDate = getDatesFromPicker('input[name="analysis-accountStatementPeriod"]').endDate;

    if (startDate == "" || startDate == undefined) {
        alert("start date is not be empty!!");
        return;
    }
    if (endDate == "" || endDate == undefined) {

        alert("end date is not be empty!!");
        return;
    }

    doGetAjaxRequestHandler(context + "/analysis-account-statement-report?startDate=" + startDate + "&endDate=" + endDate + "&fofoId=" + fofoId,
        function (response) {
            $('.account-statement-conatiner').html(response);
        });

});


// loan statement here ..................///
// loan statement here ..................///
// loan statement here ..................///
// loan statement here ..................///


$(document).on('click', ".analysis-loan-statement", function () {
    var fofoId = $(this).data("fofoid");
    doGetAjaxRequestHandler(context + "/analysis-loan/loan-statement?fofoId=" + fofoId,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});

$(document).on('click', '.analysis-partner-loan-statement-report', function () {
    var fofoId = $(this).data("fofoid");
    var startDate = getDatesFromPicker('input[name="analysis-loanStatementPeriod"]').startDate;
    var endDate = getDatesFromPicker('input[name="analysis-loanStatementPeriod"]').endDate;

    if (startDate == "" || startDate == undefined) {
        alert("start date is not be empty!!");
        return;
    }
    if (endDate == "" || endDate == undefined) {

        alert("end date is not be empty!!");
        return;
    }
    doGetAjaxRequestHandler(context + "/analysis-loan/partner-loan-statement-report?startDate=" + startDate + "&endDate=" + endDate + "&fofoId=" + fofoId,
        function (response) {
            $('.loan-statement-conatiner').html(response);
            $('#loanStatementSummaryReport').DataTable({
                "scrollX": true,
                "bPaginate": true,
                "bLengthChange": true,
                "bFilter": true,
                "bInfo": false,
                "bAutoWidth": false
            });
        });


});

$(document).on('click', '.analysis-download-partner-loan-statement', function () {
    var fofoId = $(this).data("fofoid");
    var startDate = getDatesFromPicker('input[name="analysis-loanStatementPeriod"]').startDate;
    var endDate = getDatesFromPicker('input[name="analysis-loanStatementPeriod"]').endDate;

    if (startDate == "" || startDate == undefined) {

        alert("start date is not be empty!!");
        return;
    }
    if (endDate == "" || endDate == undefined) {

        alert("end date is not be empty!!");
        return;
    }
    let endPoint = `${context}/analysis-loan/download-partner-loan-statement-report?startDate=${startDate}&endDate=${endDate}&fofoId=${fofoId}`;

    window.location.href = endPoint;
});


// scheme payout report--------------
// scheme payout report--------------
// scheme payout report--------------
// scheme payout report--------------

$(document).on('click', ".analysis-download-scheme-payout-report", function () {
    var fofoId = $(this).data("fofoid");
    var startDate = $("#analysis-startDate-scheme-payout").val();

    var endDate = $("#analysis-endDate-scheme-payout").val();

    if (startDate == "" || startDate == undefined) {
        alert("start date is not be empty!!");
        return;
    }
    if (endDate == "" || endDate == undefined) {

        alert("end date is not be empty!!");
        return;
    }
    let endPoint = `${context}/analysis-schemePayoutReportDownload?startDate=${startDate}&endDate=${endDate}&fofoId=${fofoId}`;

    window.location.href = endPoint;
});

$(document).on('click', ".analysis-scheme-payout-fetch-report", function () {
    var fofoId = $(this).data("fofoid");
    var startDate = $("#analysis-startDate-scheme-payout").val();

    var endDate = $("#analysis-endDate-scheme-payout").val();

    if (startDate == "" || startDate == undefined) {
        alert("start date is not be empty!!");
        return;
    }
    if (endDate == "" || endDate == undefined) {

        alert("end date is not be empty!!");
        return;
    }

    let endPoint = `${context}/analysis-schemePayoutReport?startDate=${startDate}&endDate=${endDate}&fofoId=${fofoId}`;

    doGetAjaxRequestHandler(endPoint,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});

$(document).on('click', ".analysis-scheme-payout-report", function () {
    var fofoId = $(this).data("fofoid");

    let endPoint = `${context}/analysis-schemePayoutReport?fofoId=${fofoId}`;

    doGetAjaxRequestHandler(endPoint,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});

// price drop ....................price drop ....................
// price drop ....................price drop ....................
// price drop ....................price drop ....................

$(document).on('click', ".analysis-price-drop-report", function () {
    var fofoId = $(this).data("fofoid");
    doGetAjaxRequestHandler(context + "/analysis-priceDropFetchReportByDate?fofoId=" + fofoId,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});


$(document).on('click', '.analysis-price-drop-fetch-report', function () {
    var fofoId = $(this).data("fofoid");
    var startDate = $("#analysis-startDate-price-drop-report").val();

    var endDate = $("#analysis-endDate-price-drop-report").val();

    if (startDate == "" || startDate == undefined) {

        alert("start date is not be empty!!");
        return;
    }
    if (endDate == "" || endDate == undefined) {

        alert("end date is not be empty!!");
        return;
    }
    let endPoint = `${context}/analysis-priceDropFetchReportByDate?startDate=${startDate}&endDate=${endDate}&fofoId=${fofoId}`;


    doGetAjaxRequestHandler(endPoint,
        function (response) {
            $('#' + 'main-content').html(response);
        });

});

$(document).on('click', '.analysis-download-price-drop-report', function () {
    var fofoId = $(this).data("fofoid");

    var startDate = $("#analysis-startDate-price-drop-report").val();

    var endDate = $("#analysis-endDate-price-drop-report").val();

    if (startDate == "" || startDate == undefined) {

        alert("start date is not be empty!!");
        return;
    }
    if (endDate == "" || endDate == undefined) {

        alert("end date is not be empty!!");
        return;
    }
    let endPoint = `${context}/analysis-downloadPriceDropReport?startDate=${startDate}&endDate=${endDate}&fofoId=${fofoId}`;


    window.location.href = endPoint;


});


// collection summary report ------------------
// collection summary report ------------------
// collection summary report ------------------
// collection summary report ------------------


$(document).on('click', ".analysis-partner-collection-summary", function () {
    var fofoId = $(this).data("fofoid");
    doGetAjaxRequestHandler(context + "/analysis-collectionSummaryFetchReport?fofoId=" + fofoId,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});


$(document).on('click', '.analysis-download-collection-summary', function () {
    var fofoId = $(this).data("fofoid");
    var startDate = $("#analysis-startDate-collection-summary").val();

    var endDate = $("#analysis-endDate-collection-summary").val();

    if (startDate == "" || startDate == undefined) {

        alert("start date is not be empty!!");
        return;
    }
    if (endDate == "" || endDate == undefined) {

        alert("end date is not be empty!!");
        return;
    }
    let endPoint = `${context}/analysis-downloadCollectionSummary?startDate=${startDate}&endDate=${endDate}&fofoId=${fofoId}`;

    window.location.href = endPoint;

});
$(document).on('click', ".analysis-collection-summary-fetch-report", function () {
    var fofoId = $(this).data("fofoid");
    var startDate = $("#analysis-startDate-collection-summary").val();

    var endDate = $("#analysis-endDate-collection-summary").val();

    if (startDate == "" || startDate == undefined) {
        alert("start date is not be empty!!");
        return;
    }
    if (endDate == "" || endDate == undefined) {

        alert("end date is not be empty!!");
        return;
    }
    let endPoint = `${context}/analysis-collectionSummaryFetchReport?startDate=${startDate}&endDate=${endDate}&fofoId=${fofoId}`;


    doGetAjaxRequestHandler(endPoint,
        function (response) {
            $('#' + 'main-content').html(response);
        });


});


// credit note report .............
// credit note report .............
// credit note report .............

$(document).on('click', ".analysis-credit-note", function () {
    var fofoId = $(this).data("fofoid");
    doGetAjaxRequestHandler(context + "/analysis-report/credit-note?fofoId=" + fofoId,
        function (response) {
            $('#' + 'main-content').html(response);
        });
});

$(document).on('click', '.analysis-credit-not-list', function () {
    var selectedDate = $('input[name="analysis-creditNotePeriod"]').val(); // Get the selected year-month
    var fofoId = $(this).data("fofoid");
    if (!selectedDate) {
        alert("Month-Year selection cannot be empty!");
        return;
    }
    doGetAjaxRequestHandler(context + "analysis-credit/credit-note-report?yearMonth=" + selectedDate + "&fofoId=" + fofoId,
        function (response) {
            $('.credit-note-conatiner').html(response);
            $('#creditNoteList').DataTable({
                "scrollX": true,
                "bPaginate": true,
                "bLengthChange": true,
                "bFilter": true,
                "bInfo": false,
                "bAutoWidth": false
            });
        });

});

$(document).on('click', '.analysis-download-credit-note', function () {
    var cnNumber = $(this).data("creditnumber");

    if (!cnNumber) {
        alert("CN-Number cannot be empty!");
        return;
    }

    let endPoint = `${context}/analysis-credit-note/download?cnNumber=${cnNumber}`;

    window.location.href = endPoint; // Redirect to the download URL
});

$(document).on('click', '.analysis-download-credit-note-attachement', function () {
    var cnNumber = $(this).data("creditnumber");

    if (!cnNumber) {
        alert("CN-Number cannot be empty!");
        return;
    }

    let endPoint = `${context}/analysis-credit-note/attachements?cnNumber=${cnNumber}`;

    window.location.href = endPoint; // Redirect to the download URL
});


// schemes ...........//
// schemes ...........//
// schemes ...........//


$(document).on('click', ".analysis-schemes", function () {
    var fofoId = $(this).data('fofoid');
    schemesNew("main-content", fofoId);
    console.log("Active Schemes Button Clicked...")
});


function schemesNew(domId, fofoId) {
    doGetAjaxRequestHandler(context + "/getAnalysisSchemes?fofoId=" + fofoId, function (response) {
        $('#' + domId).html(response);
    });
}

$(document).on("keyup", "#analysis-scheme-item-search-text", function (e) {
    var keyCode = e.keyCode || e.which;
    if (keyCode == 13) {
        $("#analysis-scheme-item-search-button").click();
    }
});

$(document).on("keyup", "#analysis-scheme-search-text", function (e) {
    var keyCode = e.keyCode || e.which;
    if (keyCode == 13) {
        $("#analysis-scheme-search-button").click();
    }
});

$(document).on('click', "#analysis-scheme-imei-search-button", function () {
    var fofoId = $(this).data('fofoid');
    var searchText = $("#analysis-scheme-imei-search-text").val();
    var date = $(".analysis-schemes-date").val();
    if (typeof (searchText) == "undefined" || !searchText) {
        searchText = "";
        alert("please select imei");
        return;
    }
    if (typeof imei != "undefined") {
        console.log(imei);
        loadSchemeImeiSearchInfoNew(imei, date, fofoId);
    } else {
        console.log("reeffff")
        alert("Data No Found")
    }
});

function loadSchemeImeiSearchInfoNew(selectedImei, date, fofoId) {

    loadSearchImeiSchemeNew("main-content", selectedImei, date, fofoId);
}

function loadSearchImeiSchemeNew(domId, selected_imei, date, fofoId) {
    var category = $('#partner-category').val();
    var searchText = $("#analysis-scheme-imei-search-text").val();

    var category = $('#partner-category').val();

    console.log(category)

    if (typeof (searchText) == "undefined" || !searchText) {
        searchText = "";
    }
    if (typeof (category) == "undefined" || !category) {
        category = "";
    }
    if ((searchText) && (category)) {
        doGetAjaxRequestHandler(context + "/getAnalysisSchemes?fofoId=" + fofoId + "&searchImei="
            + selected_imei + "&partnerType=" + category, function (
            response) {
            $('#' + domId).html(response);

            $('#partner-category').val(category);
            $('#scheme-imei-search-text').val(selected_imei);
        });
    } else if ((searchText)) {
        doGetAjaxRequestHandler(`${context}/getAnalysisSchemes?fofoId=${fofoId}&searchImei=${selected_imei}&date=${date}`, function (response) {
            $('#' + domId).html(response);
            $('#scheme-imei-search-text').val(selected_imei);

        });
    }
}

$(document).on('click', "#analysis-scheme-search-button",
    function () {
        var searchText = $("#analysis-scheme-search-text").val();
        var fofoId = $(this).data('fofoid');
        if (typeof (searchText) == "undefined" || !searchText) {
            searchText = "";
        }
        doGetAjaxRequestHandler(context + "/getAnalysisSchemes?fofoId=" + fofoId + "&searchScheme="
            + searchText, function (response) {
            $('#' + "main-content").html(response);
        });
    });

$(document).on('click', "#analysis-scheme-item-search-button", function () {
    var searchText = $("#analysis-scheme-item-search-text").val();
    var fofoId = $(this).data('fofoid');
    var date = $(".analysis-schemes-date").val();
    if (typeof (searchText) == "undefined" || !searchText) {
        searchText = "";
        alert("please select item");
        return;
    }
    if (typeof currentItem != "undefined") {
        console.log(currentItem);
        loadSchemeItemSearchInfoNew(currentItem, date, fofoId);
    } else {
        console.log("reeffff")
        alert("Data No Found")
    }
});


function loadSchemeItemSearchInfoNew(selectedModel, date, fofoId) {
    loadSearchItemSchemeNew("main-content", selectedModel, date, fofoId);
}

function loadSearchItemSchemeNew(domId, selectedModel, date, fofoId) {
    var searchText = $("#analysis-scheme-item-search-text").val();
    var category = $('#partner-category').val();

    if (typeof (searchText) == "undefined" || !searchText) {
        searchText = "";
    }
    if (typeof (category) == "undefined" || !category) {
        category = "";
    }
    if (searchText && category) {
        doGetAjaxRequestHandler(`${context}/getAnalysisSchemes?fofoId=${fofoId}&searchModel=${selectedModel}&partnerType=${category}&date=${date}`, function (response) {
            $('#' + domId).html(response);
            $('#partner-category').val(category);
        });
    } else if (searchText) {
        doGetAjaxRequestHandler(`${context}/getAnalysisSchemes?fofoId=${fofoId}&searchModel=${selectedModel}&date=${date}`, function (response) {
            $('#' + domId).html(response);
            $('#partner-category').val(category);
        });

    }

}


// price circular table start ............
// price circular table start ............
// price circular table start ............

$(document).on('click', ".analysis-submit-circular-request", function () {
    let brand = $("#brands").val();
    var fofoId = $(this).data('fofoid');
    let priceCircularUrl = `${context}/analysisPriceCircularByBrand?brand=${brand}&fofoId=${fofoId}`;
    if (typeof partnerId == "number") {
        priceCircularUrl = `${priceCircularUrl}&fofoId=${partnerId}`;
    }
    doGetAjaxRequestHandler(priceCircularUrl,
        function (response) {
            console.log(response)
            $('.price-circular-container').html(response);
        });
});


$(document).on('click', ".analysis-partner-price-circular", function () {
    var fofoId = $(this).data('fofoid');
    bootbox.confirm({
        message: "<div class = 'disclosurehindata'> <img src='resources/images/disclosure.png' style='width:100%'> </div>"
        ,
        buttons: {
            confirm: {
                label: 'I agree',
                className: 'btn-success'
            },
            cancel: {
                label: 'I disagree',
                className: 'btn-danger'
            }
        },
        callback: function (result) {
            if (result == true) {
                analysisloadPartnerPriceCircular("main-content", fofoId);
            }
        }
    });

});


function analysisloadPartnerPriceCircular(domId, fofoId) {

    doGetAjaxRequestHandler(context + "/analysisPartnerPriceCircular?fofoId=" + fofoId,
        function (response) {
            $('#' + domId).html(response);
        });
}