MMCT TEAM
Server IP : 162.214.80.37  /  Your IP : 216.73.216.83
Web Server : Apache
System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : imyrqtmy ( 2189)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home2/imyrqtmy/public_html/agriba/js/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/public_html/agriba/js/newcustom.js
// Increase product quantity on cart page
$(".increaseQty").on('click', function() {
    var getval = ("#setavlqty").html();
    var maxVal = $(this).attr('avlincqty');
    alert(getval);
    var minVal = 1; // Set Max and Min values
    var $parentElm = $(this).parents(".qtySelector");
    $(this).addClass("clicked");
    setTimeout(function() {
        $(".clicked").removeClass("clicked");
    }, 100);
    var value = $parentElm.find(".cart-quantity-input").val();
    if (value < maxVal) {
        value++;
    }
    $parentElm.find(".cart-quantity-input").val(value);
});
// Decrease product quantity on cart page
$(".decreaseQty").on('click', function() {
    var $parentElm = $(this).parents(".qtySelector");
    $(this).addClass("clicked");
    setTimeout(function() {
        $(".clicked").removeClass("clicked");
    }, 100);
    var value = $parentElm.find(".cart-quantity-input").val();
    if (value > 1) {
        value--;
    }
    $parentElm.find(".cart-quantity-input").val(value);
});


$(".getsize").click(function() {
    // var size = $(this).attr('size');
    var price = $(this).attr('price');
    var mrp = $(this).attr('mrp');
    // var productid = $(this).attr('productid');
    var unitsize = $(this).attr('getunitsize');
    var unitsizeqty = $(this).attr('getunitsizeqty');
    var skucode = $(this).attr('getskucode');
    var productid = $(this).attr('getproductid');
    var varientid = $(this).attr('getvarientid');
    // $('#addtocart').attr('price',price)
    // $('#addtocart').attr('productid',productid)
    // productid
    $("#setsalprice").html("<del style='color: grey;'>₹ " + mrp + "</del><span>₹ " + price + "</span>");
    // $("#setmrp").html(price);

    // $('.getsize').removeClass('selectsize');
    // $(this).addClass('selectsize');
    // alert(unitsize);
    // exit();
    $('#getunitsize').val(unitsizeqty);
    $('#getproductsize').val(unitsize);
    $('#getproductprice').val(price);
    $('#getproductmrp').val(mrp);
    $('#getskucode').val(skucode);
    $('#getproductid').val(productid);
    $('#getvarientid').val(varientid);
    $('#getvarientid').val(varientid);
})

function myFunction() {
    var x = document.getElementById("snackbar");
    x.className = "show";
    setTimeout(function() { x.className = x.className.replace("show", ""); }, 3000);
}

/// auto login 
// var userid=localStorage.getItem("userloginid");
//   // alert(userid)
// if(userid==null){
//     console.log(userid)
// }else{

//      $.ajax({
//         type: "POST",
//         url: "function/ajax_function.php",
//         data: "action=autoLogin&userid="+userid,
//         success: function(html) {
//             if(html==1){
//                 location.reload()
//             }
//         }
//     });   
// }

/// auto login close 

$(".logout").click(function() {
    // alert('call')
    $.ajax({
        type: "POST",
        url: "function/ajax_function.php",
        data: "action=logout",
        success: function(html) {
            localStorage.clear()
            window.location.href = "index.php";
        }
    });
});


$(".addtocart").click(function() {
    var formData = new FormData();
      var quantity = $("#steve").val();
      var pprice = $("#getproductprice").val();
      var pmrp = $("#getproductmrp").val();
      var sku = $("#getskucode").val();
      var productid = $("#getproductid").val();
      var size = $("#getproductsize").val();
      var unitsizeqty = $("#getunitsize").val();
      var ordernote = $('#getordernote').val();
      var vistingcarddetail = $('#getvistingcarddetail').val();
      var image1 = $('#getimageid').val();
      var image2 = $('#getimageid2').val();
      var name = $('#getname').val();
      var email = $('#getemail').val();
      var mobile = $('#getmobile').val();
      var address = $('#getaddress').val();

      formData.append('quantity', quantity);
      formData.append('price', pprice);
      formData.append('productid', productid);
      formData.append('sku', sku);
      formData.append('mrp', pmrp);
      formData.append('size', size);
      formData.append('unit', unitsizeqty);
      formData.append('ordernote', ordernote);
      formData.append('vistingcarddetail', vistingcarddetail);
      formData.append('image1', image1);
      formData.append('image2', image2);
      formData.append('name', name);
      formData.append('email', email);
      formData.append('mobile', mobile);
      formData.append('address', address);


      // alert(
      //   "quantity=" + quantity +
      //   " price=" + pprice +
      //   " productid=" + productid +
      //   " sku=" + sku +
      //   " mrp=" + pmrp +
      //   " size=" + size +
      //   " unitsizeqty=" + unitsizeqty +
      //   " ordernote=" + ordernote +
      //    " name=" + name +
      //     " email=" + email +
      //      " mobile=" + mobile +
      //       " address=" + address +
      //   " vistingcarddetail=" + vistingcarddetail +
      //   " image1=" + (image1 ? image1.name : '') +
      //   " image2=" + (image2 ? image2.name : '')
      // );

      // exit();
    
    if (size == "") {
        $("body").append("<div class='selectsize-notification animated fadeIn'>Please Select Size !</div>");
        $(".selectsize-notification").delay(2000).fadeOut();

        return false
    }

    $("body").append("<div class='add2cart-notification animated fadeIn'>Added to cart successfully!</div>");
    $(".add2cart-notification").delay(2000).fadeOut();

    $.ajax({
        type: "POST",
        url: 'function/ajax_function.php',
        data: "action=addCart&quantity=" + quantity + "&price=" + pprice + "&productid=" + productid + "&sku=" + sku + "&mrp=" + pmrp + "&size=" + size + "&unit=" + unitsizeqty + "&ordernote=" + ordernote + "&vistingcarddetail=" + vistingcarddetail + "&image1=" + image1 + "&image2=" + image2 + "&name=" + name + "&email=" + email + "&address=" + address + "&mobile=" + mobile,
        success: function(returndata) {
            var obj = jQuery.parseJSON(returndata);
            if (obj.data[0].status == 1) {
                 window.location.href = "checkout.php";
                $('.cartvalue').html(obj.data[0].cart);
            }
            // ==============================  
        }
    });

});

// $(".addtocart2").click(function () {
//      var quantity  =   $("#steve").val();
//      var pprice =   $("#getproductprice1").val(); 
//      var pmrp   =   $("#getproductmrp1").val(); 
//      var sku   =   $("#getskucode1").val(); 
//      var productid   =   $("#getproductid1").val(); 
//      var currency   =   $("#getcurrency1").val(); 
//      var varientid   =   $("#getvarientid1").val(); 
//       var size   =  $("#getproductsize1").val(); 

//     // alert(currency);
//     //   exit();

//         $("body").append("<div class='add2cart-notification animated fadeIn'>Added to cart successfully!</div>");
//         $(".add2cart-notification").delay(2000).fadeOut();

//           $.ajax({
//           type: "POST",
//           url: 'function/ajax_function.php',
//           data: "action=addCart&quantity="+quantity+"&price="+pprice+"&productid="+productid+"&sku="+sku+"&mrp="+pmrp+"&currency="+currency+"&varientid="+varientid+"&size="+size,
//           success: function(returndata){
//               var obj = jQuery.parseJSON( returndata );
//               if(obj.data[0].status==1){

//                  $('.cartvalue').html(obj.data[0].cart);
//                     // location.reload();


//               }
//             // ==============================  
//             }
//       }); 

// });



$(".qunatitychange").change(function() {
    var itemid = $(this).attr('itemid');
    var price = $(this).attr('price');
    var qty = $(this).val();
    $("#price" + itemid).html((qty * price));
    $("#save" + itemid).show();
});

$(".removecart").click(function() {
    var itemid = $(this).attr('itemid');
    $(this).html('<i class="fa fa-circle-o-notch fa-spin" aria-hidden="true"></i>')
    $.ajax({
        type: "POST",
        url: 'function/ajax_function.php',
        data: "action=deleteCart&cartitemid=" + itemid,
        success: function(returndata) {

            if (returndata == 1) {
                location.reload();
            }
            // ==============================  
        }
    });
});

$("#frmlogin").submit(function(event) {
    event.preventDefault();

    var email = $("#getloginemail").val();
    var password = $("#getloginpassword").val();
    var flag = 1;
    //============================================================
    if (email == "") {
        $('#error_loginemail').html('* Email can not be empty');
        flag = 0;
    }
    if (password == "") {
        $('#error_loginpassword').html('* Password can not be empty');
        flag = 0;
    }

    // email address validation
    var x = email;

    if (x.length == 0) {
        $('#error_loginemail').html('Enter your Email ID');
        flag = 0
    }

    if (flag == 0) {
        return false;
    }

    //=============================================================
    var myArray = new Array();
    // $("#btnsubmit").html('');
    // $("#btnsubmit").html('<i class="fa fa-circle-o-notch fa-spin" aria-hidden="true"></i>');
    var formData = new FormData($(this)[0]);
    $.ajax({
        url: 'function/ajax_function.php',
        type: 'POST',
        data: formData,
        async: true,
        cache: false,
        contentType: false,
        processData: false,
        success: function(returndata) {
            if (returndata == 1) {
                //alert(myArray[1])
                $("#btnsubmit").html('<i class="fa fa-spinner fa-spin"  aria-hidden="true"></i>');
                window.location.href = "index.php";
                // alert("Success")
                $('#message').html('')
            } else if (returndata == 2) {
                window.location.href = "checkout.php";
            } else {
                // $("#btnsubmit").html('<i class="fa fa-lock"></i>&nbsp; <span>Login</span>');
                //  $("#getloginemail").focus();

                //  $("#getpassword").val('');

                // swal("Sorry!", "Email ID and password not matched.", "error");

                $('#error_details').html('Invalid Email ID and Passowrd !');

            }
        },
        error: function() {
            alert("error in ajax form submission");
        }
    });
    return false;
});

MMCT - 2023