$(document).ready(function () { /* var items = $(".loadMore").data('items'); var shown = $(".loadMore").data('shown'); var time = $(".loadMore").data('time'); $('.dashboardListWrap li:lt(' + shown + ')').show(); $('.showLess').hide(); $('.loadMore').click(function () { $('.showLess').show(); shown = $('.dashboardListWrap li:visible').length + time; if (shown < items) { $('.dashboardListWrap li:lt(' + shown + ')').slideDown(); } else { $('.dashboardListWrap li:lt(' + items + ')').slideDown(); $('.loadMore').hide(); } }); $('.showLess').click(function () { $('.dashboardListWrap li').not(':lt(' + time + ')').slideUp(); $(this).hide(); $('.loadMore').show(); }); if ($(".singleSelect").length) { $(".singleSelect").select2(); } if ($(".multipleSelect").length) { $(".multipleSelect").select2(); } */ $(document).on("click", ".advancedSearchBtn", function () { $(".searchAdditionItem").fadeToggle("show"); }); $(document).on("click", ".addNewBtn", function () { $(".mainSearch").removeClass("active"); }); $(document).on("click", ".mainSearchInput", function () { $(".mainSearchWrap").removeClass("active"); $(this).parent().addClass("active"); }); $(document).on("click", function (event) { var $trigger = $(".mainSearchWrap"); if ($trigger !== event.target && !$trigger.has(event.target).length) { $(".mainSearchWrap").removeClass("active"); } }); /* $(document).click((event) => { if (!$(event.target).closest('.newGrid').length) { $(".newGrid").jsGrid("cancelEdit"); // the click occured outside '#element' } });*/ /* $(document).click((event) => { $(".newGrid").jsGrid("updateItem"); if (!$(event.target).closest('.newGrid').length) { $(".newGrid").jsGrid("updateItem"); // the click occured outside '#element' } }); */ $(document).on("click", ".submitDate", function () { $(".alertMessage").fadeIn(); $(".alertMessage .alert").text("Data update complete"); setTimeout(function () { $(".alertMessage").fadeOut(); }, 2000); $(".modal").modal("hide"); }); $(document).on("click", "#selectall", function () { $(".grouprecieptCheck").attr("checked", this.checked); }); $(document).on("click", ".grouprecieptCheck", function () { if ( $(".grouprecieptCheck").length == $(".grouprecieptCheck:checked").length ) { $("#selectall").attr("checked", "checked"); } else { $("#selectall").removeAttr("checked"); } }); $("select.form-control").change(function () { $(this).css("color", "#495057"); }); var items = $(".loadMore").data("items"); var shown = $(".loadMore").data("shown"); var time = $(".loadMore").data("time"); $(".dashboardListWrap li:lt(" + shown + ")").show(); $(".showLess").hide(); $(".loadMore").click(function () { $(".showLess").show(); shown = $(".dashboardListWrap li:visible").length + time; if (shown < items) { $(".dashboardListWrap li:lt(" + shown + ")").slideDown(); } else { $(".dashboardListWrap li:lt(" + items + ")").slideDown(); $(".loadMore").hide(); } }); $(".showLess").click(function () { $(".dashboardListWrap li") .not(":lt(" + time + ")") .slideUp(); $(this).hide(); $(".loadMore").show(); }); $(".inputSelectfield").select2({ placeholder: "Select Item", allowClear: false, }); $(".addRemarkPvBtn").click(function () { $addRemark = $(this); $previewContent = $addRemark.parent().next(); var text = $previewContent.text() + "\n"; var cursorPos = $("#PreviewRemark").prop("selectionStart"); console.log(text); var r = $("#PreviewRemark").val(); var textBefore = r.substring(0, cursorPos); var textAfter = r.substring(cursorPos, r.length); $("#PreviewRemark").val(textBefore + text + textAfter); // if ($content.hasClass('collapse_active')) { // $(this).find("i").addClass("rotate"); // } else { // $(this).find("i").removeClass("rotate"); // } }); $(document).on("click", ".textareaRow", function (e) { if ($(this).val() != "") { $(this).attr("rows", "4"); } else { $(this).attr("rows", "1"); } $(this).keyup(function () { if ($(this).val() != "") { $(this).attr("rows", "4"); } else { $(this).attr("rows", "1"); } }); }); $(".smallTabBtn").click(function () { $(this).parent().find(".smallTabBtn").removeClass("active"); $(this).addClass("active"); }); $(".collapseBtn").click(function () { $(this).toggleClass("active"); }); $(".navSearchBtn").click(function () { $(".navSearch").addClass("d-flex"); $(this).hide(); }); $(".navSearchCloseBtn").click(function () { $(".navSearch").removeClass("d-flex"); $(".navSearchInput").val(""); $(".navSearchBtn").show(); }); $(".navbar-toggler").click(function () { $(".topNav").toggleClass("active"); $(".sidebar-offcanvas").addClass("active"); }); $(".navMobileClose").click(function () { $(".sidebar-offcanvas").removeClass("active"); }); $(".appendRmark").click(function () { var previewRemark = $("#PreviewRemark").val(); var text = previewRemark; var cursorPos = $("#remarkText").prop("selectionStart"); var r = $("#remarkText").val(); var textBefore = r.substring(0, cursorPos); var textAfter = r.substring(cursorPos, r.length); $("#remarkText").val(textBefore + text + textAfter); // var text = $('input[name="remark"]:checked').next("label").text(); // var cursorPos = $('#remarkText').prop('selectionStart'); // var v = $('#remarkText').val(); // var textBefore = v.substring(0, cursorPos); // var textAfter = v.substring(cursorPos, v.length); // $('#remarkText').val(textBefore + text + textAfter); // textarea.focus().val(textarea.val() + text); $("#remark").modal("hide"); }); $(".markBtn").click(function () { $(".previewRemark").val(""); }); $(".clearRmark").click(function () { $(".previewRemark").val(""); }); // $(".toggleTitle").click(function() { // if ($('#collapseOne').hasClass('show')) { // $(this).find("i").addClass("rotate"); // } else { // $(this).find("i").removeClass("rotate"); // } // }); $(document).on("change", ".statusSelect", function () { var val = $(this).val(); switch (val) { case "Active": $(this).attr("class", "statusSelect badge-success"); // code block break; case "Paid": $(this).attr("class", "statusSelect badge-success"); // code block break; case "Inactive": $(this).attr("class", "statusSelect badge-close"); // code block break; case "Voided": // code block $(this).attr("class", "statusSelect badge-close"); break; case "Approved": // code block $(this).attr("class", "statusSelect badge-success"); break; case "Accept": // code block $(this).attr("class", "statusSelect badge-yellow"); break; case "Cancelled": // code block $(this).attr("class", "statusSelect badge-danger"); break; case "Rejected": // code block $(this).attr("class", "statusSelect badge-danger"); break; case "PartiallyPaid": // code block $(this).attr("class", "statusSelect badge-primary"); break; case "Pending": // code block $(this).attr("class", "statusSelect badge-deepred"); break; case "Confirmed": // code block $(this).attr("class", "statusSelect badge-pruple"); break; case "Completed": // code block $(this).attr("class", "statusSelect badge-success"); break; case "Cancel": // code block $(this).attr("class", "statusSelect badge-danger"); break; case "Received": // code block $(this).attr("class", "statusSelect badge-success"); break; } }); $(window).scroll(function () { if ($(this).scrollTop() >= 50) { // If page is scrolled more than 50px $(".sidebar-offcanvas.active").addClass("open"); // Fade in the arrow } else { $(".sidebar-offcanvas.active").removeClass("open"); // Else fade out the arrow } }); }); // $(".closeBtn").on("click", function () { // $(".searchOverlay").fadeToggle(200); // $(".button a") // .toggleClass("btn-open") // .toggleClass("btn-close"); // open = false; // }); // $(".mobileCloseBtn").click(function () { // $(".collapse").removeClass("show"); // }); // // ===== Scroll to Top ==== // $(window).scroll(function () { // if ($(this).scrollTop() >= 50) { // // If page is scrolled more than 50px // $(".scrollToTop").fadeIn(200); // Fade in the arrow // } else { // $(".scrollToTop").fadeOut(200); // Else fade out the arrow // } // }); // $(".scrollToTop").click(function () { // $("html, body").animate({ scrollTop: 0 }, 800); // return false; // });