315 lines
9.3 KiB
JavaScript
315 lines
9.3 KiB
JavaScript
$(document).ready(function(){
|
|
$(".pack-submit").click(function(){
|
|
id = $(this).attr("id");
|
|
console.log(id);
|
|
url = $('#url').val();
|
|
$.ajax({
|
|
type: "post",
|
|
url: ''+url+'add_package_cartdata',
|
|
data: { 'id' : id , 'c_token' : $('#c_token').val() },
|
|
json: true,
|
|
success: function(res) {
|
|
res = JSON.parse(res);
|
|
window.location = ''+url+'view_cart/'+res.token+'';
|
|
},
|
|
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
$(document).ready(function(){
|
|
$(".input-text").change(function(){
|
|
id = $(this).attr("id");
|
|
url = $('#url').val();
|
|
var cost = $('#cost_'+id+'').val();
|
|
$('.'+id+'').html('$'+$('#'+id+'').val() * cost+'');
|
|
// console.log($('.0').text().replace("$", ""));
|
|
subtotal = Number($('.0').text().replace("$", "")) + Number($('.1').text().replace("$", ""));
|
|
$('.subtotal').html('$'+subtotal+'');
|
|
pst = subtotal * $('#pst').val() / 100;
|
|
$('.pst').html('$'+pst+'');
|
|
gst = subtotal * $('#gst').val() / 100;
|
|
$('.gst').html('$'+gst+'');
|
|
total = subtotal + pst + gst;
|
|
$('.total').html('$'+total+'')
|
|
|
|
|
|
$.ajax({
|
|
type: "post",
|
|
url: ''+url+'change_count_onclick',
|
|
data: { 'id' : $('#cart_token_id_'+id+'').val() , 'count' : $('#'+id+'').val() },
|
|
json: true,
|
|
success: function(res) {
|
|
},
|
|
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
$(document).ready(function(){
|
|
$(".editAddress").click(function(){
|
|
id = $(this).attr("id");
|
|
alert(id);
|
|
url = $('#url').val();
|
|
$.ajax({
|
|
type: "post",
|
|
url: ''+url+'member_address_form',
|
|
data: { 'id' : id },
|
|
json: true,
|
|
success: function(res) {
|
|
$('.address-form').css('display','block');
|
|
$('.address-form').append(res);
|
|
// window.location = ''+url+'view_cart/'+res.token+'';
|
|
},
|
|
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
|
});
|
|
});
|
|
});
|
|
|
|
$(document).ready(function(){
|
|
$(".submit").click(function(){
|
|
var formData = $('#member_address').serialize();
|
|
alert(formData);
|
|
url = $('#url').val();
|
|
$.ajax({
|
|
type: "post",
|
|
url: ''+url+'member_address_edit_or_add',
|
|
data: formData,
|
|
json: true,
|
|
success: function(res) {
|
|
if(res == true){
|
|
$('.address-form').css('display','none');
|
|
// $("#address_list").load(window.location + "#address_list");
|
|
}
|
|
},
|
|
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
|
});
|
|
});
|
|
});
|
|
|
|
$(document).ready(function(){
|
|
$("#card-button").click(function(){
|
|
// $('#loading-spinner-overlay').css('visibility', 'visible');
|
|
|
|
});
|
|
|
|
$(".select-address").click(function(){
|
|
|
|
var value = $(this).attr("value");
|
|
$('#address_id').val(value);
|
|
|
|
});
|
|
|
|
var val = $('.checked').val();
|
|
$('#address_id').val(val);
|
|
});
|
|
|
|
$(document).ready(function(e){
|
|
$("#address-btn").click(function(){
|
|
// var formData = $('#member-address-save').serialize();
|
|
url = $('#url').val();
|
|
$.ajax({
|
|
type: "post",
|
|
url: ''+url+'member_address_edit',
|
|
data: {
|
|
id : $('#id').val(),
|
|
name : $('#first_name').val(),
|
|
last_name : $('#last_name').val(),
|
|
address : $('#street_address').val(),
|
|
gender : $("input[name='gender']:checked").val(),
|
|
city : $('#city').val(),
|
|
state : $('#state').val(),
|
|
pincode : $('#pincode').val()
|
|
},
|
|
json: true,
|
|
success: function(res) {
|
|
if(res == true){
|
|
// $("#member-address").load(location.href + " #member-address");
|
|
console.log((res));
|
|
$('.success-message').show();
|
|
$('.success-message').delay(3000).fadeOut('slow');
|
|
}
|
|
},
|
|
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
$(document).ready(function(e){
|
|
$("#pass-btn").click(function(){
|
|
const passwordPattern = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,}/;
|
|
if ($('#old_password').val() != '' && $('#new_password').val() != "" && $('#confirm_password').val() != "" )
|
|
{
|
|
if ($('#old_password').val() != $('#new_password').val())
|
|
{
|
|
if (passwordPattern.test($('#new_password').val()))
|
|
{
|
|
$('#error_np').html("");
|
|
old_password = $('#old_password').val();
|
|
new_password = $('#new_password').val();
|
|
confirm_password = $('#confirm_password').val();
|
|
var formData = $('#member-pass-save').serialize();
|
|
url = $('#url').val();
|
|
if (new_password == confirm_password)
|
|
{
|
|
$.ajax({
|
|
type: "post",
|
|
url: ''+url+'member_password_edit',
|
|
data: formData,
|
|
json: true,
|
|
success: function(res) {
|
|
if(res == 1){
|
|
window.location.href = url+"member_logout";
|
|
}
|
|
else{
|
|
$('#error_op_after_check').html("Please check your old password").css('color' , 'red');
|
|
$('#old_password').val(old_password);
|
|
$('#new_password').val(new_password);
|
|
$('#old_password').val(old_password);
|
|
$('#confirm_password').val('');
|
|
}
|
|
},
|
|
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
|
});
|
|
}
|
|
else
|
|
{
|
|
$('#error_op_after_check').html("Please check your old password").css('color' , 'red');
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$('#error_np').html("Must contain at least one number 
and one uppercase 
and one special character like !@#$%^&*() 
and lowercase letter,
and at least 8 or more characters").css('color' , 'red');
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$('#error_np').html("Old password and new passowrd is same").css('color' , 'red');
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if ($('#old_password').val() == "" )
|
|
{
|
|
$('#error_op_after_check').html("Input required").css('color' , 'red');
|
|
}
|
|
if ($('#new_password').val() == "")
|
|
{
|
|
$('#error_np').html("Input required").css('color' , 'red');
|
|
}
|
|
if ($('#confirm_password').val() == "" )
|
|
{
|
|
$('#error_cp').html("Input required").css('color' , 'red');
|
|
}
|
|
}
|
|
|
|
});
|
|
});
|
|
|
|
$(document).ready(function(e){
|
|
$('#old_password').on('keyup', function () {
|
|
$('#error_op_after_check').html("");
|
|
url = $('#url').val();
|
|
$.ajax({
|
|
type: "post",
|
|
url: ''+url+'check_old_password',
|
|
data: { id : $('#id').val() ,old_password : $('#old_password').val() },
|
|
json: true,
|
|
success: function(res) {
|
|
console.log(res);
|
|
if(res == 1){
|
|
$('#error_op').html("Matching").css('color' , 'green')
|
|
}
|
|
else{
|
|
if ($('#old_password').val().length == 0) {
|
|
$('#error_op').html("");
|
|
} else {
|
|
$('#error_op').html("Not matching").css('color' , 'red');
|
|
}
|
|
|
|
}
|
|
},
|
|
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
$(document).ready(function(){
|
|
$('#new_password, #confirm_password').on('keyup', function () {
|
|
if ($('#confirm_password').val() == "" )
|
|
{
|
|
$('#error_cp').html('');
|
|
}
|
|
if ($('#new_password').val() == "" )
|
|
{
|
|
$('#error_np').html("");
|
|
}
|
|
if($('#confirm_password').val() != $('#new_password').val())
|
|
{
|
|
$('#error_cp').html("Password and confirm password doesn't match").css('color', 'red');
|
|
}
|
|
else
|
|
{
|
|
$('#error_cp').html("");
|
|
}
|
|
if ($('#new_password').val() == $('#confirm_password').val() && $('#confirm_password').val().length > 0 ) {
|
|
// $('#error_cp').html('Matching').css('color', 'green');
|
|
}
|
|
else if($('#new_password').val().length == 0 || $('#confirm_password').val().length == 0){
|
|
if ($('#confirm_password').val() == "" )
|
|
$('#error_cp').html('');
|
|
if ($('#new_password').val() != "" )
|
|
$('#error_np').html("");
|
|
}
|
|
|
|
});
|
|
});
|
|
|
|
$(document).ready(function(e){
|
|
$("#pincode").change(function(){
|
|
zip_id = $("#pincode").val();
|
|
url = $('#url').val();
|
|
$.ajax({
|
|
type: "post",
|
|
url: ''+url+'zipcode_data',
|
|
data: { 'id' : zip_id },
|
|
json: true,
|
|
success: function(res) {
|
|
res = JSON.parse(res);
|
|
if(res != 0){
|
|
$('#city').val(res[0].city);
|
|
$('#state').val(res[0].state);
|
|
}
|
|
},
|
|
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// $(document).ready(function(){
|
|
// $(".pack-submit").click(function(){
|
|
// id = $(this).attr("id");
|
|
// url = $('#url').val();
|
|
// console.log($('#c_token').val())
|
|
// $.ajax({
|
|
// type: "post",
|
|
// url: ''+url+'add_package_cartdata',
|
|
// data: { 'id' : id , 'c_token' : $('#c_token').val() },
|
|
// json: true,
|
|
// success: function(res) {
|
|
// res = JSON.parse(res);
|
|
// console.log(res);
|
|
// $('#c_token').val(res.token);
|
|
// $('#'+id+'').html('View Cart');
|
|
// $('#'+id+'').attr('href', ''+url+'view_cart/'+res.token+'')
|
|
// },
|
|
// error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
|
// });
|
|
// });
|
|
// });
|