add changes
This commit is contained in:
Vendored
+383
@@ -0,0 +1,383 @@
|
||||
function initLogin() {
|
||||
let reg_name, reg_email, reg_number, reg_pwd, reg_otp_email;
|
||||
let loginForm = $("#login_form");
|
||||
let registerForm = $("#register_form");
|
||||
|
||||
// document.querySelector('#register_form .otp-input-group input.press').addEventListener("paste", function (p) {
|
||||
// var data = p.clipboardData.getData('text');
|
||||
// var dataLength = data.length;
|
||||
|
||||
// for (var i = 0; i < dataLength; i++) {
|
||||
// var input = document.querySelector("#register_form .otp-input-group input[tabindex='" + (i + 1) + "']");
|
||||
// input.value = data.charAt(i);
|
||||
// if (input.value.length >= input.maxLength) {
|
||||
// var nextInput = document.querySelector("#register_form .otp-input-group input[tabindex='" + (i + 2) + "']");
|
||||
// if (nextInput) {
|
||||
// nextInput.focus();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// p.preventDefault();
|
||||
// });
|
||||
// document.querySelectorAll('#register_form .otp-input-group input[type="text"]').forEach(function (input) {
|
||||
// input.addEventListener('keyup', function (e) {
|
||||
// if (this.value.length >= this.maxLength) {
|
||||
// if (e.keyCode !== 9 && e.keyCode !== 16) {
|
||||
// var tabIndex = this.tabIndex + 1;
|
||||
// document.querySelector("#register_form .otp-input-group input[tabindex='" + this.tabIndex + "']").value = this.value;
|
||||
// document.querySelector("#register_form .otp-input-group input[tabindex='" + tabIndex + "']").focus();
|
||||
// }
|
||||
// } else {
|
||||
// if (e.keyCode === 8) {
|
||||
// var tabIndex = this.tabIndex - 1;
|
||||
// document.querySelector("#register_form .otp-input-group input[tabindex='" + tabIndex + "']").focus();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
$('#register_form .otp-input-group input.press').on('paste', function (p) {
|
||||
var data = p.originalEvent.clipboardData.getData('text');
|
||||
var dataLength = data.length;
|
||||
|
||||
for (var i = 0; i < dataLength; i++) {
|
||||
var input = $('#register_form .otp-input-group input[tabindex="' + (i + 1) + '"]');
|
||||
input.val(data.charAt(i));
|
||||
if (input.val().length >= input.attr('maxlength')) {
|
||||
var nextInput = $('#register_form .otp-input-group input[tabindex="' + (i + 2) + '"]');
|
||||
if (nextInput) {
|
||||
nextInput.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
p.preventDefault();
|
||||
});
|
||||
|
||||
$('#register_form .otp-input-group input[type="text"]').on('keyup', function (e) {
|
||||
if ($(this).val().length >= $(this).attr('maxlength')) {
|
||||
if (e.keyCode !== 9 && e.keyCode !== 16) {
|
||||
var tabIndex = parseInt($(this).attr('tabindex')) + 1;
|
||||
$('#register_form .otp-input-group input[tabindex="' + $(this).attr('tabindex') + '"]').val($(this).val());
|
||||
$('#register_form .otp-input-group input[tabindex="' + tabIndex + '"]').focus();
|
||||
}
|
||||
} else {
|
||||
if (e.keyCode === 8) {
|
||||
var tabIndex = parseInt($(this).attr('tabindex')) - 1;
|
||||
$('#register_form .otp-input-group input[tabindex="' + tabIndex + '"]').focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
loginForm.find("#User_Email,#User_password").keypress(function (e) {
|
||||
if (e.which == 13)
|
||||
document.getElementById("Login_btn").click();
|
||||
|
||||
});
|
||||
|
||||
$("#Login_btn").click(function () {
|
||||
loginForm.find(".loader-btn").show();
|
||||
$(this).hide();
|
||||
let userEmail = loginForm.find("#User_Email").val();
|
||||
let userPassword = loginForm.find("#User_password").val();
|
||||
let emailInput = loginForm.find(".email-login-inputgroup");
|
||||
let passwordInput = loginForm.find(".password-login-inputgroup");
|
||||
if (userEmail == "") {
|
||||
emailInput.find('#User_Email').addClass('is-invalid');
|
||||
emailInput.find('.form-floating').addClass('is-invalid');
|
||||
emailInput.find('.invalid-feedback').text('Please enter your email');
|
||||
loginForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
|
||||
}
|
||||
if (userPassword == "") {
|
||||
passwordInput.find('#User_password').addClass('is-invalid');
|
||||
passwordInput.find('.form-floating').addClass('is-invalid');
|
||||
loginForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}
|
||||
else {
|
||||
emailInput.find('#User_Email').removeClass('is-invalid');
|
||||
emailInput.find('.form-floating').removeClass('is-invalid');
|
||||
passwordInput.find('#User_password').removeClass('is-invalid');
|
||||
passwordInput.find('.form-floating').removeClass('is-invalid');
|
||||
if (validateEmail(userEmail)) {
|
||||
let port = SERVERNAME
|
||||
// let port = "http://localhost:3088";
|
||||
let url = `${port}/account/getuserbyphoneormail/${userEmail}/${userEmail}`;
|
||||
getDataStatAxios(url, userEmail);
|
||||
} else {
|
||||
loginForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
emailInput.find('#User_Email').addClass('is-invalid');
|
||||
emailInput.find('.form-floating').addClass('is-invalid');
|
||||
emailInput.find('.invalid-feedback').text('Please enter a valid email');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
async function getDataStatAxios(url, userEmail) {
|
||||
const config = {
|
||||
url,
|
||||
method: "get",
|
||||
};
|
||||
let response = await axios(config);
|
||||
if (response.data.result == null) {
|
||||
$('.error-div').text(response.data.message);
|
||||
}
|
||||
else {
|
||||
let userEmail = $("#User_Email").val();
|
||||
let userPassword = $("#User_password").val();
|
||||
const loginPayload = {
|
||||
username: userEmail,
|
||||
Password: userPassword,
|
||||
UnibaseId: "",
|
||||
RememberMe: false,
|
||||
};
|
||||
const res = await postAPIService(
|
||||
`bizgaze/crm/webapi/crmuserlogin`,
|
||||
loginPayload
|
||||
);
|
||||
debugger;
|
||||
console.log(res);
|
||||
if (res.data.message == "200") {
|
||||
// Command: toastr["success"]("Logged in successfully")
|
||||
// toasterOpts();
|
||||
debugger;
|
||||
COOKIE_HELPER_ACTIONS.setCookie({
|
||||
token: res.data.result.sessionId,
|
||||
userid: res.data.result.userId,
|
||||
...res.data.result
|
||||
})
|
||||
// setInitLoginLocal();
|
||||
// window.localStorage.setItem("Useremail", userEmail);
|
||||
//window.localStorage.setItem("Userpassword", userPassword);
|
||||
//window.localStorage.setItem("Isloggedin", true);
|
||||
const isCartAdded = localStorage.getItem(CART_ADD);
|
||||
if(isCartAdded){
|
||||
localStorage.removeItem(CART_ADD);
|
||||
window.location.href = `/selectdelivery.html`;
|
||||
return;
|
||||
}
|
||||
window.location.href = `/index.html`;
|
||||
} else {
|
||||
$("#empt_num").removeClass("d-none text-success").text(res.data.message).addClass('text-danger');
|
||||
$(".my_avatar").attr("href", "./login.html");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this function will be triggered on new user registration
|
||||
async function userRegistration() {
|
||||
reg_form = $('#register_form');
|
||||
// reg_name = $("#User_Name").val();
|
||||
reg_email = reg_form.find("#User_Email").val();
|
||||
// reg_otp_email = $("#User_otp_Email").val();
|
||||
// reg_number = $("#user_number").val();
|
||||
reg_pwd = reg_form.find("#User_password").val();
|
||||
let userName = reg_email.split("@");
|
||||
let otpRes = null;
|
||||
const userRegistratioNPayload = {
|
||||
organizationtypeid: "2",
|
||||
organizationid: "0",
|
||||
contactid: "0",
|
||||
userid: "0",
|
||||
username: "0",
|
||||
users_phonenumber: "0",
|
||||
password: reg_pwd,
|
||||
users_emailaddress: "0",
|
||||
emailaddress: reg_email,
|
||||
contactname: userName[0],
|
||||
phonenumber: "0",
|
||||
branchid: "0",
|
||||
tenantname: "Anwi Systems",
|
||||
rolename: "Customer Admin",
|
||||
currencyid: "0",
|
||||
customerformuniqueid: "Bizgaze_Platform_Crm_RegisterCRMUser",
|
||||
};
|
||||
$('.spinner-border').removeClass('d-none');
|
||||
const res = await postAPIService(
|
||||
`bizgaze/crm/webapi/registercrmuser`,
|
||||
userRegistratioNPayload
|
||||
);
|
||||
console.log(res, "register");
|
||||
$('.spinner-border').addClass('d-none');
|
||||
if (res.data.message == "User Already Exists!") {
|
||||
$('.error-div').text('User Already Exists!');
|
||||
// $(".useralready_exist").removeClass("d-none");
|
||||
} else {
|
||||
}
|
||||
|
||||
$("#proceed").click(async function () {
|
||||
let userEnterOtp = "";
|
||||
let userEmail = registerForm.find("#User_Email").val();
|
||||
$('.otp-input-group input').each(function () {
|
||||
let presVal = $(this).val();
|
||||
userEnterOtp += presVal;
|
||||
})
|
||||
console.log(userEnterOtp);
|
||||
debugger;
|
||||
const userotppayload = {
|
||||
email: userEmail,
|
||||
otpid: res.data.result.OtpId,
|
||||
userotp: userEnterOtp,
|
||||
};
|
||||
$('.spinner-border').removeClass('d-none');
|
||||
otpRes = await postAPIService(
|
||||
`bizgaze/crm/webapi/ValidateOtp`,
|
||||
userotppayload
|
||||
);
|
||||
$('.spinner-border').addClass('d-none');
|
||||
debugger;
|
||||
console.log(otpRes, "otp");
|
||||
const verifyotpStatus = otpRes.data.result;
|
||||
debugger;
|
||||
if (verifyotpStatus == "Otp verified successfully") {
|
||||
alert("Account created successfully");
|
||||
window.location.href = `/myaccount.html`;
|
||||
} else {
|
||||
alert("please enter valid otp");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// to validate password on keyup in password input field
|
||||
function passwordValidate(pswd) {
|
||||
if (pswd.length < 11) {
|
||||
$('#chck_length').removeClass('pswd_valid').addClass('pswd_invalid');
|
||||
} else {
|
||||
$('#chck_length').removeClass('pswd_invalid').addClass('pswd_valid');
|
||||
}
|
||||
// validate uppercase letter
|
||||
if (pswd.match(/[A-Z]/)) {
|
||||
$('#chck_capital').removeClass('pswd_invalid').addClass('pswd_valid');
|
||||
} else {
|
||||
$('#chck_capital').removeClass('pswd_valid').addClass('pswd_invalid');
|
||||
}
|
||||
//validate special letter
|
||||
if (pswd.match(/[!@#$%^&*]/)) {
|
||||
$('#chck_special').removeClass('pswd_invalid').addClass('pswd_valid');
|
||||
} else {
|
||||
$('#chck_special').removeClass('pswd_valid').addClass('pswd_invalid');
|
||||
}
|
||||
let pswdVal = $('#register_form #User_password').val();
|
||||
let pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{11,}$/;
|
||||
if (pswdVal.match(pattern)) {
|
||||
$('#pswd_info').hide()
|
||||
}
|
||||
else {
|
||||
$('#pswd_info').show()
|
||||
}
|
||||
//validate number
|
||||
if (pswd.match(/\d/)) {
|
||||
$('#chck_number').removeClass('pswd_invalid').addClass('pswd_valid');
|
||||
} else {
|
||||
$('#chck_number').removeClass('pswd_valid').addClass('pswd_invalid');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//you have to use keyup, because keydown will not catch the currently entered value
|
||||
$('#register_form #User_password').keyup(function () {
|
||||
// set password variable
|
||||
var pswd = $(this).val();
|
||||
passwordValidate(pswd);
|
||||
}).focus(function () {
|
||||
let pswdVal = $('#register_form #User_password').val();
|
||||
let pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{11,}$/;
|
||||
if (pswdVal.match(pattern)) {
|
||||
$('#pswd_info').hide()
|
||||
}
|
||||
else {
|
||||
$('#pswd_info').show()
|
||||
}
|
||||
}).blur(function () {
|
||||
$('#pswd_info').hide();
|
||||
});
|
||||
|
||||
// function to validate user entered email
|
||||
function validateEmail(userEmail) {
|
||||
var pattern =
|
||||
/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
|
||||
return $.trim(userEmail).match(pattern) ? true : false;
|
||||
}
|
||||
|
||||
// function to validate user entered password
|
||||
function validatepassword(userPassword) {
|
||||
var pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{11,}$/;
|
||||
return $.trim(userPassword).match(pattern) ? true : false;
|
||||
}
|
||||
|
||||
registerForm.find("#User_Email,#User_password").keypress(function (e) {
|
||||
if (e.which == 13)
|
||||
document.getElementById("register_btn").click();
|
||||
|
||||
});
|
||||
|
||||
// this will be triggered on clicking continue in signup form
|
||||
$("#register_btn").click(function () {
|
||||
registerForm.find(".loader-btn").show();
|
||||
$(this).hide();
|
||||
let userEmail = registerForm.find("#User_Email").val();
|
||||
let userPassword = registerForm.find("#User_password").val();
|
||||
let emailInput = registerForm.find(".email-login-inputgroup");
|
||||
let passwordInput = registerForm.find(".password-login-inputgroup");
|
||||
if (userEmail == "") {
|
||||
emailInput.find('#User_Email').addClass('is-invalid');
|
||||
emailInput.find('.form-floating').addClass('is-invalid');
|
||||
emailInput.find('.invalid-feedback').text('Please enter your email');
|
||||
registerForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}
|
||||
if (userPassword == "") {
|
||||
passwordInput.find('#User_password').addClass('is-invalid');
|
||||
passwordInput.find('.form-floating').addClass('is-invalid');
|
||||
registerForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}
|
||||
else {
|
||||
emailInput.find('#User_Email').removeClass('is-invalid');
|
||||
emailInput.find('.form-floating').removeClass('is-invalid');
|
||||
passwordInput.find('#User_password').removeClass('is-invalid');
|
||||
passwordInput.find('.form-floating').removeClass('is-invalid');
|
||||
if (validateEmail(userEmail)) {
|
||||
$('#register_form .email-password-group').hide();
|
||||
$('#register_form .otp-input-group').show();
|
||||
$('#register_form .otp-input-group .otp-sent-email').text(userEmail);
|
||||
userRegistration();
|
||||
} else {
|
||||
emailInput.find('#User_Email').addClass('is-invalid');
|
||||
emailInput.find('.form-floating').addClass('is-invalid');
|
||||
emailInput.find('.invalid-feedback').text('Please enter a valid email');
|
||||
registerForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#forgotPassword').click(function () {
|
||||
$('.login-email-password-div').hide();
|
||||
$('.login-forgot-passsword-div').show();
|
||||
})
|
||||
|
||||
function toasterOpts() {
|
||||
toastr.options = {
|
||||
"closeButton": true,
|
||||
"debug": false,
|
||||
"newestOnTop": true,
|
||||
"progressBar": true,
|
||||
"positionClass": "toast-top-center",
|
||||
"preventDuplicates": true,
|
||||
"showDuration": "300",
|
||||
"hideDuration": "1000",
|
||||
"timeOut": "3000",
|
||||
"extendedTimeOut": "1000",
|
||||
"showEasing": "swing",
|
||||
"hideEasing": "linear",
|
||||
"showMethod": "fadeIn",
|
||||
"hideMethod": "fadeOut"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initLogin();
|
||||
Vendored
+780
@@ -0,0 +1,780 @@
|
||||
function initLogin() {
|
||||
// alert('as')
|
||||
// Command: toastr["success"]("Logged in successfully")
|
||||
// Command: toastr["success"]("My name is Inigo Montoya. You killed my father. Prepare to die!")
|
||||
|
||||
// toasterOpts();
|
||||
let reg_name, reg_email, reg_number, reg_pwd, reg_otp_email;
|
||||
let loginForm = $("#login_form");
|
||||
let registerForm = $("#register_form");
|
||||
|
||||
$("#register_form .otp-input-group input.press").on("paste", function (p) {
|
||||
var data = p.originalEvent.clipboardData.getData("text");
|
||||
var dataLength = data.length;
|
||||
|
||||
for (var i = 0; i < dataLength; i++) {
|
||||
var input = $(
|
||||
'#register_form .otp-input-group input[tabindex="' + (i + 1) + '"]'
|
||||
);
|
||||
input.val(data.charAt(i));
|
||||
if (input.val().length >= input.attr("maxlength")) {
|
||||
var nextInput = $(
|
||||
'#register_form .otp-input-group input[tabindex="' + (i + 2) + '"]'
|
||||
);
|
||||
if (nextInput) {
|
||||
nextInput.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
p.preventDefault();
|
||||
});
|
||||
|
||||
$('#register_form .otp-input-group input[type="text"]').on(
|
||||
"keyup",
|
||||
function (e) {
|
||||
if ($(this).val().length >= $(this).attr("maxlength")) {
|
||||
if (e.keyCode !== 9 && e.keyCode !== 16) {
|
||||
var tabIndex = parseInt($(this).attr("tabindex")) + 1;
|
||||
$(
|
||||
'#register_form .otp-input-group input[tabindex="' +
|
||||
$(this).attr("tabindex") +
|
||||
'"]'
|
||||
).val($(this).val());
|
||||
$(
|
||||
'#register_form .otp-input-group input[tabindex="' + tabIndex + '"]'
|
||||
).focus();
|
||||
}
|
||||
} else {
|
||||
if (e.keyCode === 8) {
|
||||
var tabIndex = parseInt($(this).attr("tabindex")) - 1;
|
||||
$(
|
||||
'#register_form .otp-input-group input[tabindex="' + tabIndex + '"]'
|
||||
).focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
loginForm.find("#User_Email,#User_password").keypress(function (e) {
|
||||
if (e.which == 13) $("#Login_btn").click();
|
||||
});
|
||||
|
||||
$("#Login_btn").click(function () {
|
||||
$('.error_msg').hide();
|
||||
// loginForm.find(".loader-btn").show();
|
||||
let userEmail = loginForm.find("#User_Email").val();
|
||||
let userPassword = loginForm.find("#User_password").val();
|
||||
let emailInput = loginForm.find(".email-login-inputgroup");
|
||||
let passwordInput = loginForm.find(".password-login-inputgroup");
|
||||
if (userEmail == "") {
|
||||
emailInput.find("#User_Email").addClass("is-invalid");
|
||||
emailInput.find(".form-floating").addClass("is-invalid");
|
||||
emailInput.find(".invalid-feedback").text("Please enter your email");
|
||||
loginForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}
|
||||
if (userPassword == "") {
|
||||
passwordInput.find("#User_password").addClass("is-invalid");
|
||||
passwordInput.find(".form-floating").addClass("is-invalid");
|
||||
loginForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
} else {
|
||||
emailInput.find("#User_Email").removeClass("is-invalid");
|
||||
emailInput.find(".form-floating").removeClass("is-invalid");
|
||||
passwordInput.find("#User_password").removeClass("is-invalid");
|
||||
passwordInput.find(".form-floating").removeClass("is-invalid");
|
||||
if (validateEmail(userEmail)) {
|
||||
let port = SERVERNAME
|
||||
// let port = "http://localhost:3088";
|
||||
let url = `${port}/account/getuserbyphoneormail/${userEmail}/${userEmail}`;
|
||||
getDataStatAxios(url, userEmail);
|
||||
} else {
|
||||
loginForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
emailInput.find("#User_Email").addClass("is-invalid");
|
||||
emailInput.find(".form-floating").addClass("is-invalid");
|
||||
emailInput.find(".invalid-feedback").text("Please enter a valid email");
|
||||
}
|
||||
}
|
||||
});
|
||||
async function getDataStatAxios(url, userEmail) {
|
||||
const config = {
|
||||
url,
|
||||
method: "get",
|
||||
};
|
||||
let response = await axios(config);
|
||||
if (response.data.result == null) {
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html(`User doesn't exists with the email, <a href="#" class="alert-link register_sectionbtn" id="register_sectionbtn">Sign Up </a>`);
|
||||
$(".register_sectionbtn").click(function(){
|
||||
|
||||
|
||||
$(".login_section").css("display","none");
|
||||
$(".register_section").css("display","block");
|
||||
$(".login_section").find("#User_Email").removeClass("is-invalid");
|
||||
$(".login_section").find(".form-floating").removeClass("is-invalid");
|
||||
$(".login_section").find("#User_password").removeClass("is-invalid");
|
||||
$(".login_section").find(".form-floating").removeClass("is-invalid");
|
||||
$('.error_msg').hide();
|
||||
});
|
||||
// toasterOpts();
|
||||
|
||||
// Command: toastr["error"]("Please enter Valid email / password");
|
||||
} else {
|
||||
let userEmail = $("#User_Email").val();
|
||||
let userPassword = $("#User_password").val();
|
||||
const loginPayload = {
|
||||
username: userEmail,
|
||||
Password: userPassword,
|
||||
UnibaseId: "",
|
||||
RememberMe: false,
|
||||
};
|
||||
$("#Login_btn").hide();
|
||||
$(".loader-btn").show();
|
||||
const res = await postAPIService(
|
||||
`bizgaze/crm/webapi/crmuserlogin`,
|
||||
loginPayload
|
||||
);
|
||||
debugger;
|
||||
console.log(res);
|
||||
$(".loader-btn").hide();
|
||||
$("#Login_btn").show();
|
||||
if (res.data.message == "200") {
|
||||
debugger;
|
||||
// Command: toastr["success"]("Logged in successfully")
|
||||
// toasterOpts();
|
||||
COOKIE_HELPER_ACTIONS.setCookie({
|
||||
token: res.data.result.sessionId,
|
||||
userid: res.data.result.userId,
|
||||
...res.data.result
|
||||
});
|
||||
// setInitLoginLocal();
|
||||
window.localStorage.setItem("Useremail", userEmail);
|
||||
//window.localStorage.setItem("Userpassword", userPassword);
|
||||
window.localStorage.setItem("Isloggedintoaster", true);
|
||||
window.localStorage.setItem("Isloggedin", true);
|
||||
|
||||
const isCartAdded = localStorage.getItem(CART_ADD);
|
||||
if(isCartAdded){
|
||||
localStorage.removeItem(CART_ADD);
|
||||
window.location.href = `/selectdelivery.html`;
|
||||
return;
|
||||
}
|
||||
|
||||
window.location.href = `./index.html`;
|
||||
} else {
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html(res.data.message + ' <a class="validate_mail text-danger"><b>Validate Email</b></a>');
|
||||
// toasterOpts();
|
||||
// Command: toastr["error"]()
|
||||
/*Email validation*/
|
||||
$('.validate_mail').click(function(){
|
||||
$(".login_section").hide();
|
||||
$(".email-validate-div").show();
|
||||
$('.error_msg').hide();
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this function will be triggered on new user registration
|
||||
async function userRegistration() {
|
||||
reg_form = $("#register_form");
|
||||
// reg_name = $("#User_Name").val();
|
||||
reg_email = reg_form.find("#User_Email").val();
|
||||
// reg_otp_email = $("#User_otp_Email").val();
|
||||
// reg_number = $("#user_number").val();
|
||||
reg_pwd = reg_form.find("#User_password").val();
|
||||
let userName = reg_email.split("@");
|
||||
let otpRes = null;
|
||||
const userRegistratioNPayload = {
|
||||
organizationtypeid: "2",
|
||||
organizationid: "0",
|
||||
contactid: "0",
|
||||
userid: "0",
|
||||
username: "0",
|
||||
users_phonenumber: "0",
|
||||
password: reg_pwd,
|
||||
users_emailaddress: "0",
|
||||
emailaddress: reg_email,
|
||||
contactname: userName[0],
|
||||
phonenumber: "0",
|
||||
branchid: "0",
|
||||
tenantname: "Anwi Systems",
|
||||
rolename: "Customer Admin",
|
||||
currencyid: "0",
|
||||
customerformuniqueid: "Bizgaze_Platform_Crm_RegisterCRMUser",
|
||||
};
|
||||
debugger;
|
||||
$('#register_btn').hide()
|
||||
$(".loader-btn").show();
|
||||
debugger;
|
||||
const res = await postAPIService(
|
||||
`bizgaze/crm/webapi/registercrmuser`,
|
||||
userRegistratioNPayload
|
||||
);
|
||||
console.log(res, "register");
|
||||
$(".loader-btn").hide();
|
||||
$('#register_btn').show()
|
||||
if (res.data.code == "404" ) {
|
||||
// toasterOpts();
|
||||
// Command: toastr["error"](res.data.message)
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html(res.data.message);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$("#register_form .email-password-group").hide();
|
||||
$("#register_form .register_otp.otp-input-group").show();
|
||||
}
|
||||
|
||||
$("#proceed").click(async function () {
|
||||
let userEnterOtp = "";
|
||||
let userEmail = registerForm.find("#User_Email").val();
|
||||
$(".otp-input-group input").each(function () {
|
||||
let presVal = $(this).val();
|
||||
userEnterOtp += presVal;
|
||||
});
|
||||
console.log(userEnterOtp);
|
||||
debugger;
|
||||
const userotppayload = {
|
||||
email: userEmail,
|
||||
otpid: res.data.result.OtpId,
|
||||
userotp: userEnterOtp,
|
||||
};
|
||||
$(".loader-btn").show();
|
||||
$('#proceed').hide()
|
||||
otpRes = await postAPIService(
|
||||
`bizgaze/crm/webapi/ValidateOtp`,
|
||||
userotppayload
|
||||
);
|
||||
$(".loader-btn").hide();
|
||||
$('#proceed').show()
|
||||
debugger;
|
||||
console.log(otpRes, "otp");
|
||||
const verifyotpStatus = otpRes.data.result;
|
||||
if (verifyotpStatus == "Otp verified successfully") {
|
||||
const loginPayload = {
|
||||
username: reg_email,
|
||||
Password: reg_pwd,
|
||||
UnibaseId: "",
|
||||
RememberMe: false,
|
||||
};
|
||||
const res = await postAPIService(
|
||||
`bizgaze/crm/webapi/crmuserlogin`,
|
||||
loginPayload
|
||||
);
|
||||
if (res.data.message == "200") {
|
||||
debugger;
|
||||
// Command: toastr["success"]("Logged in successfully")
|
||||
// toasterOpts();
|
||||
COOKIE_HELPER_ACTIONS.setCookie({
|
||||
token: res.data.result.sessionId,
|
||||
userid: res.data.result.userId,
|
||||
...res.data.result
|
||||
});
|
||||
// setInitLoginLocal();
|
||||
window.localStorage.setItem("Useremail", userEmail);
|
||||
//window.localStorage.setItem("Userpassword", userPassword);
|
||||
window.localStorage.setItem("isaccountCreated", true);
|
||||
const isCartAdded = localStorage.getItem(CART_ADD);
|
||||
if(isCartAdded){
|
||||
localStorage.removeItem(CART_ADD);
|
||||
window.location.href = `/selectdelivery.html`;
|
||||
return;
|
||||
}
|
||||
window.location.href = `./index.html`;
|
||||
} else {
|
||||
// toasterOpts();
|
||||
// Command: toastr["error"](res.data.message)
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html(res.data.message);
|
||||
}
|
||||
} else {
|
||||
// toasterOpts();
|
||||
// Command: toastr["error"]("Please enter Valid OTP");
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html("Please enter Valid OTP");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// to validate password on keyup in password input field
|
||||
function passwordValidate(pswd) {
|
||||
if (pswd.length < 8) {
|
||||
$("#chck_length").removeClass("pswd_valid").addClass("pswd_invalid");
|
||||
} else {
|
||||
$("#chck_length").removeClass("pswd_invalid").addClass("pswd_valid");
|
||||
}
|
||||
// validate uppercase letter
|
||||
if (pswd.match(/[A-Z]/)) {
|
||||
$("#chck_capital").removeClass("pswd_invalid").addClass("pswd_valid");
|
||||
} else {
|
||||
$("#chck_capital").removeClass("pswd_valid").addClass("pswd_invalid");
|
||||
}
|
||||
//validate special letter
|
||||
if (pswd.match(/[!@#$%^&*]/)) {
|
||||
$("#chck_special").removeClass("pswd_invalid").addClass("pswd_valid");
|
||||
} else {
|
||||
$("#chck_special").removeClass("pswd_valid").addClass("pswd_invalid");
|
||||
}
|
||||
let pswdVal = $("#register_form #User_password").val();
|
||||
let pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{8,}$/;
|
||||
if (pswdVal.match(pattern)) {
|
||||
$(".pswd_info").hide();
|
||||
} else {
|
||||
$(".pswd_info").show();
|
||||
}
|
||||
//validate number
|
||||
if (pswd.match(/\d/)) {
|
||||
$("#chck_number").removeClass("pswd_invalid").addClass("pswd_valid");
|
||||
} else {
|
||||
$("#chck_number").removeClass("pswd_valid").addClass("pswd_invalid");
|
||||
}
|
||||
}
|
||||
|
||||
//you have to use keyup, because keydown will not catch the currently entered value
|
||||
$("#register_form #User_password")
|
||||
.keyup(function () {
|
||||
// set password variable
|
||||
var pswd = $(this).val();
|
||||
passwordValidate(pswd);
|
||||
})
|
||||
.focus(function () {
|
||||
let pswdVal = $("#register_form #User_password").val();
|
||||
let pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{11,}$/;
|
||||
if (pswdVal.match(pattern)) {
|
||||
$(".pswd_info").hide();
|
||||
} else {
|
||||
$(".pswd_info").show();
|
||||
}
|
||||
})
|
||||
.blur(function () {
|
||||
$(".pswd_info").hide();
|
||||
});
|
||||
|
||||
// function to validate user entered email
|
||||
function validateEmail(userEmail) {
|
||||
var pattern = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
|
||||
// return $.trim(userEmail).test(pattern) ? true : false;
|
||||
return pattern.test(userEmail) ? true : false;
|
||||
}
|
||||
|
||||
// function to validate user entered password
|
||||
function validatepassword(userPassword) {
|
||||
var pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,15}$/;
|
||||
// return $.trim(userPassword).test(pattern) ? true : false;
|
||||
return pattern.test(userPassword) ? true : false;
|
||||
}
|
||||
|
||||
registerForm.find("#User_Email,#User_password").keypress(function (e) {
|
||||
if (e.which == 13) $("#register_btn").click();
|
||||
});
|
||||
|
||||
// this will be triggered on clicking continue in signup form
|
||||
$("#register_btn").click(function () {
|
||||
$('.error_msg').hide();
|
||||
registerForm.find(".loader-btn").show();
|
||||
$(this).hide();
|
||||
let userEmail = registerForm.find("#User_Email").val();
|
||||
let userPassword = registerForm.find("#User_password").val();
|
||||
let emailInput = registerForm.find(".email-login-inputgroup");
|
||||
let passwordInput = registerForm.find(".password-login-inputgroup");
|
||||
if (userEmail == "") {
|
||||
emailInput.find("#User_Email").addClass("is-invalid");
|
||||
emailInput.find(".form-floating").addClass("is-invalid");
|
||||
emailInput.find(".invalid-feedback").text("Please enter your email");
|
||||
registerForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}
|
||||
if (userPassword == "") {
|
||||
passwordInput.find("#User_password").addClass("is-invalid");
|
||||
passwordInput.find(".form-floating").addClass("is-invalid");
|
||||
registerForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
} else {
|
||||
emailInput.find("#User_Email").removeClass("is-invalid");
|
||||
emailInput.find(".form-floating").removeClass("is-invalid");
|
||||
passwordInput.find("#User_password").removeClass("is-invalid");
|
||||
passwordInput.find(".form-floating").removeClass("is-invalid");
|
||||
let Email_valid = validateEmail(userEmail);
|
||||
let Pwd_valid = validatepassword(userPassword);
|
||||
if (Email_valid === true && Pwd_valid === true) {
|
||||
userRegistration();
|
||||
$("#register_form .otp-input-group .otp-sent-email").text(userEmail);
|
||||
} else if(Email_valid === false) {
|
||||
emailInput.find("#User_Email").addClass("is-invalid");
|
||||
emailInput.find(".form-floating").addClass("is-invalid");
|
||||
emailInput.find(".invalid-feedback").text("Please enter a valid email");
|
||||
registerForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}else if(Pwd_valid === false){
|
||||
passwordInput.find("#User_password").addClass("is-invalid");
|
||||
passwordInput.find(".form-floating").addClass("is-invalid");
|
||||
passwordInput.find(".invalid-feedback").text("Please check the password!");
|
||||
registerForm.find(".loader-btn").hide();
|
||||
$(this).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
$(".pswd_eye").click(function(){
|
||||
let eyeClass = $(this).find('svg').hasClass("fa-eye-slash");
|
||||
if(eyeClass == true){
|
||||
$(this).find('svg').removeClass("fa-eye-slash");
|
||||
$(this).find('svg').addClass("fa-eye");
|
||||
$(this).siblings('input').attr('type','password')
|
||||
}else{
|
||||
$(this).find('svg').removeClass("fa-eye");
|
||||
$(this).find('svg').addClass("fa-eye-slash");
|
||||
$(this).siblings('input').attr('type','text')
|
||||
}
|
||||
})
|
||||
|
||||
$("#forgotPassword").click(function () {
|
||||
$(".login-email-password-div").hide();
|
||||
$(".login-forgot-password-div").show();
|
||||
});
|
||||
$("#forgot_Password_Back").click(function () {
|
||||
$(".login-forgot-password-div").hide();
|
||||
$(".login-email-password-div").show();
|
||||
});
|
||||
$("#forgot_password_submit").click(async function () {
|
||||
let forgot_email = $("#forgot_User_Email").val();
|
||||
if(forgot_email == ''){
|
||||
$('#forgot_User_Email').addClass('is-invalid')
|
||||
$('#forgot_User_Email').after(`<div class="invalid-feedback">Please enter Valid email</div>`);
|
||||
return
|
||||
}
|
||||
else{
|
||||
debugger;
|
||||
let port = SERVERNAME
|
||||
// let port = "http://localhost:3088";
|
||||
let url = `${port}/account/getuserbyphoneormail/${forgot_email}/${forgot_email}`;
|
||||
const config = {
|
||||
url,
|
||||
method: "get",
|
||||
};
|
||||
$(".loader-btn").show();
|
||||
$('#forgot_password_submit').hide()
|
||||
let response = await axios(config);
|
||||
debugger;
|
||||
console.log(response);
|
||||
$(".loader-btn").hide();
|
||||
$('#forgot_password_submit').show()
|
||||
if (response.data.result != null) {
|
||||
debugger;
|
||||
console.log(response.data);
|
||||
const forgotpassPayload = {
|
||||
firstname: "",
|
||||
lastname: "",
|
||||
contactnumber: "",
|
||||
email: "",
|
||||
tenantname: "",
|
||||
contactoremail: response.data.result.email,
|
||||
IsSignup: false,
|
||||
IsRegisterUser: false,
|
||||
IsForgotPswd: true,
|
||||
UnibaseId: response.data.result.userName,
|
||||
OtpId: 0,
|
||||
UserOtp: "",
|
||||
};
|
||||
$('#forgot_password_submit').hide()
|
||||
$(".loader-btn").show();
|
||||
const forgetpassRes = await postAPIService(
|
||||
`account/sendotp`,
|
||||
forgotpassPayload
|
||||
);
|
||||
$(".loader-btn").hide();
|
||||
console.log(forgetpassRes);
|
||||
$(".email-validation").hide();
|
||||
$('.user_email').html(forgot_email)
|
||||
$(".otp-validation .otp-input-group").show();
|
||||
$(".otp-validation .otp-input-group").on("paste", function (p) {
|
||||
let data = p.originalEvent.clipboardData.getData("text");
|
||||
let dataLength = data.length;
|
||||
for (let i = 0; i < dataLength; i++) {
|
||||
let input = $(
|
||||
'.otp-validation .otp-input-group input[tabindex="' + (i + 1) + '"]'
|
||||
);
|
||||
input.val(data.charAt(i));
|
||||
if (input.val().length >= input.attr("maxlength")) {
|
||||
let nextInput = $(
|
||||
'.otp-validation .otp-input-group input[tabindex="' +
|
||||
(i + 2) +
|
||||
'"]'
|
||||
);
|
||||
if (nextInput) {
|
||||
nextInput.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
p.preventDefault();
|
||||
});
|
||||
|
||||
$('.otp-validation .otp-input-group input[type="text"]').on(
|
||||
"keyup",
|
||||
function (e) {
|
||||
if ($(this).val().length >= $(this).attr("maxlength")) {
|
||||
if (e.keyCode !== 9 && e.keyCode !== 16) {
|
||||
let tabIndex = parseInt($(this).attr("tabindex")) + 1;
|
||||
$(
|
||||
'.otp-validation .otp-input-group input[tabindex="' +
|
||||
$(this).attr("tabindex") +
|
||||
'"]'
|
||||
).val($(this).val());
|
||||
$(
|
||||
'.otp-validation .otp-input-group input[tabindex="' +
|
||||
tabIndex +
|
||||
'"]'
|
||||
).focus();
|
||||
}
|
||||
} else {
|
||||
if (e.keyCode === 8) {
|
||||
let tabIndex = parseInt($(this).attr("tabindex")) - 1;
|
||||
$(
|
||||
'.otp-validation .otp-input-group input[tabindex="' +
|
||||
tabIndex +
|
||||
'"]'
|
||||
).focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
$("#Forgot_pass_proceed").click(async function () {
|
||||
debugger;
|
||||
let userotp='';
|
||||
$(".otp-validation .otp-input-group input").each(function () {
|
||||
let presVal = $(this).val();
|
||||
userotp += presVal;
|
||||
});
|
||||
console.log(userotp);
|
||||
const validateForgotpass = {
|
||||
email: forgot_email,
|
||||
otpid: forgetpassRes.data,
|
||||
userotp: userotp,
|
||||
};
|
||||
$('#Forgot_pass_proceed').hide()
|
||||
$(".loader-btn").show();
|
||||
const forgetpassResotp = await postAPIService(
|
||||
`hyperfusion/validateotp`,
|
||||
validateForgotpass
|
||||
);
|
||||
$(".loader-btn").hide();
|
||||
$('#Forgot_pass_proceed').show()
|
||||
console.log(forgetpassResotp);
|
||||
const Resotp = forgetpassResotp.data.result;
|
||||
if (Resotp == "Otp verified successfully") {
|
||||
$(".login-forgot-password-details-div").show();
|
||||
$(".otp-validation .otp-input-group").hide();
|
||||
} else {
|
||||
// toasterOpts()
|
||||
// Command: toastr["error"]("Please enter Valid OTP");
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html("Please enter Valid OTP");
|
||||
}
|
||||
});
|
||||
$("#forgot_password_details_submit").click(async function () {
|
||||
debugger;
|
||||
let pswdone =$("#forgot-password-input-one").val();
|
||||
let pswdtwo =$("#forgot-password-input-two").val();
|
||||
if(pswdone == pswdtwo) {
|
||||
const forgotpassPayload = {
|
||||
username: response.data.result.userName,
|
||||
password: pswdtwo,
|
||||
};
|
||||
$("#forgot_password_details_submit").hide();
|
||||
$(".loader-btn").show();
|
||||
const forgetpassRes = await postAPIService(
|
||||
`account/UpdatePassword`,
|
||||
forgotpassPayload
|
||||
);
|
||||
console.log(forgetpassRes);
|
||||
$(".loader-btn").hide();
|
||||
$("#forgot_password_details_submit").show();
|
||||
window.localStorage.setItem('Ispasswordupdate',true)
|
||||
window.location.href = `./myaccount.html`;
|
||||
}else {
|
||||
$("#forgot-password-input-one").addClass('is-invalid');
|
||||
$("#forgot-password-input-two").addClass('is-invalid')
|
||||
$('.password_display').text('Passwords are not matched !').addClass('text-danger')
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
else{
|
||||
$('#forgot_User_Email').addClass('is-invalid');
|
||||
$('#forgot_User_Email').after(`<div class="invalid-feedback">Please enter Valid email</div>`);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
$(".user_pass")
|
||||
.keyup(function () {
|
||||
// set password variable
|
||||
var pswd = $(this).val();
|
||||
passwordValidate(pswd);
|
||||
$('.pswd_info').hide();
|
||||
$(this).parent().siblings('.pswd_info').show();
|
||||
})
|
||||
.focus(function () {
|
||||
let pswdVal = $(this).val();
|
||||
let pattern = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{8,}$/;
|
||||
if (pswdVal.match(pattern)) {
|
||||
$(this).parent().siblings('.pswd_info').hide();
|
||||
} else {
|
||||
$(this).parent().siblings('.pswd_info').show();
|
||||
}
|
||||
})
|
||||
.blur(function () {
|
||||
$(this).parent().siblings('.pswd_info').hide();
|
||||
});
|
||||
|
||||
function toasterOpts(){
|
||||
toastr.options = {
|
||||
"closeButton": true,
|
||||
"debug": false,
|
||||
"newestOnTop": true,
|
||||
"progressBar": true,
|
||||
"positionClass": "toast-top-center",
|
||||
"preventDuplicates": true,
|
||||
"onclick": null,
|
||||
"showDuration": "300",
|
||||
"hideDuration": "1000",
|
||||
"timeOut": "5000",
|
||||
"extendedTimeOut": "1000",
|
||||
"showEasing": "swing",
|
||||
"hideEasing": "linear",
|
||||
"showMethod": "fadeIn",
|
||||
"hideMethod": "fadeOut"
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#email_validate_submit").click(async function () {
|
||||
let vaidate_otp;
|
||||
let validate_email = $("#email_validation_input").val();
|
||||
if(validate_email == ''){
|
||||
$('#email_validation_input').addClass('is-invalid')
|
||||
$('#email_validation_input').after(`<div class="invalid-feedback">Please enter Valid email</div>`);
|
||||
return
|
||||
}
|
||||
else{
|
||||
debugger;
|
||||
let port = SERVERNAME;
|
||||
// let port = "http://localhost:3088";
|
||||
let url = `${port}/account/getuserbyphoneormail/${validate_email}/${validate_email}`;
|
||||
const config = {
|
||||
url,
|
||||
method: "get",
|
||||
};
|
||||
$(".loader-btn").show();
|
||||
$('#email_validate_submit').hide()
|
||||
let response = await axios(config);
|
||||
debugger;
|
||||
console.log(response);
|
||||
$(".loader-btn").hide();
|
||||
$('#email_validate_submit').show()
|
||||
if (response.data.result != null) {
|
||||
debugger;
|
||||
console.log(response.data);
|
||||
const forgotpassPayload = {
|
||||
firstname: "",
|
||||
lastname: "",
|
||||
contactnumber: "",
|
||||
email: "",
|
||||
tenantname: "",
|
||||
contactoremail: response.data.result.email,
|
||||
IsSignup: false,
|
||||
IsRegisterUser: false,
|
||||
IsForgotPswd: true,
|
||||
UnibaseId: response.data.result.userName,
|
||||
OtpId: 0,
|
||||
UserOtp: "",
|
||||
};
|
||||
$('#email_validate_submit').hide()
|
||||
$(".loader-btn").show();
|
||||
const validate_email_res = await postAPIService(
|
||||
`account/sendotp`,
|
||||
forgotpassPayload
|
||||
);
|
||||
$(".loader-btn").hide();
|
||||
vaidate_otp = validate_email_res.data;
|
||||
console.log(validate_email_res);
|
||||
$(".email-validation").hide();
|
||||
$('.user_email').html(validate_email)
|
||||
$(".otp-validation .otp-input-group").show();
|
||||
$(".otp-validation .otp-input-group").on("paste", function (p) {
|
||||
let data = p.originalEvent.clipboardData.getData("text");
|
||||
let dataLength = data.length;
|
||||
for (let i = 0; i < dataLength; i++) {
|
||||
let input = $(
|
||||
'.otp-validation .otp-input-group input[tabindex="' + (i + 1) + '"]'
|
||||
);
|
||||
input.val(data.charAt(i));
|
||||
if (input.val().length >= input.attr("maxlength")) {
|
||||
let nextInput = $(
|
||||
'.otp-validation .otp-input-group input[tabindex="' +
|
||||
(i + 2) +
|
||||
'"]'
|
||||
);
|
||||
if (nextInput) {
|
||||
nextInput.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
p.preventDefault();
|
||||
});
|
||||
|
||||
}
|
||||
else{
|
||||
$('#email_validation_input').addClass('is-invalid');
|
||||
$('#email_validation_input').after(`<div class="invalid-feedback">Please enter Valid email</div>`);
|
||||
|
||||
}
|
||||
}
|
||||
$("#email_validate_proceed").click(async function () {
|
||||
debugger;
|
||||
let userotp='';
|
||||
let validate_email = $("#email_validation_input").val();
|
||||
$(".email-validate-div .otp-validation .otp-input-group input").each(function () {
|
||||
let presVal = $(this).val();
|
||||
userotp += presVal;
|
||||
});
|
||||
|
||||
if(userotp.length == 6){
|
||||
const validateForgotpass = {
|
||||
email: validate_email,
|
||||
otpid: vaidate_otp,
|
||||
userotp: userotp,
|
||||
};
|
||||
$('#email_validate_proceed').hide()
|
||||
$(".loader-btn").show();
|
||||
const validate_email_resopt = await postAPIService(
|
||||
`hyperfusion/validateotp`,
|
||||
validateForgotpass
|
||||
);
|
||||
|
||||
$(".loader-btn").hide();
|
||||
$('#email_validate_proceed').show()
|
||||
const Resotp = validate_email_resopt.data.result;
|
||||
if (Resotp == "Otp verified successfully") {
|
||||
$(".login_section").show();
|
||||
$(".otp-validation .otp-input-group").hide();
|
||||
$("#email_validate_back").hide();
|
||||
$('.error_msg').hide();
|
||||
} else {
|
||||
// toasterOpts()
|
||||
// Command: toastr["error"]("Please enter Valid OTP");
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html("Please enter Valid OTP");
|
||||
}
|
||||
}
|
||||
else{
|
||||
$('.error_msg').show();
|
||||
$('.error_msg .error_msg_res').html("Please enter OTP");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
initLogin();
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
class AccordionItem extends HTMLElement {
|
||||
static get observedAttributes() {
|
||||
return ['title'];
|
||||
}
|
||||
|
||||
#title = '';
|
||||
#collapsed = true;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.attachShadow({ mode: 'open' });
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
this.update();
|
||||
this.shadowRoot.addEventListener('click', this.toggle.bind(this));
|
||||
}
|
||||
|
||||
attributeChangedCallback(name, oldValue, newValue) {
|
||||
if (name === 'title') {
|
||||
this.#title = newValue;
|
||||
}
|
||||
this.update();
|
||||
}
|
||||
|
||||
toggle() {
|
||||
this.#collapsed = !this.#collapsed;
|
||||
this.update();
|
||||
|
||||
// Dispatch a custom event to notify the parent AccordionElement
|
||||
const event = new CustomEvent('accordion-item-toggle', {
|
||||
bubbles: true,
|
||||
detail: {
|
||||
collapsed: this.#collapsed,
|
||||
item: this,
|
||||
},
|
||||
});
|
||||
this.dispatchEvent(event);
|
||||
}
|
||||
|
||||
update() {
|
||||
this.shadowRoot.innerHTML = `
|
||||
<style>
|
||||
.accordion-item {
|
||||
|
||||
}
|
||||
.accordion-title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
padding: 0.5rem;
|
||||
background-color: white;
|
||||
}
|
||||
.accordion-title:hover {
|
||||
background-color: white;
|
||||
}
|
||||
.accordion-title::after {
|
||||
content: '${this.#collapsed ? '+' : '−'}';
|
||||
font-size: 1rem;
|
||||
font-weight: bold;
|
||||
color: #777;
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
.accordion-content {
|
||||
padding: 0.5rem;
|
||||
display: ${this.#collapsed ? 'none' : 'block'};
|
||||
}
|
||||
</style>
|
||||
<div class="accordion-item">
|
||||
<div class="accordion-title">${this.#title}</div>
|
||||
<div class="accordion-content">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
class AccordionElement extends HTMLElement {
|
||||
#activeItem = null;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.attachShadow({ mode: 'open' });
|
||||
this.shadowRoot.innerHTML = '<slot></slot>';
|
||||
this.addEventListener('accordion-item-toggle', this.handleItemToggle.bind(this));
|
||||
}
|
||||
|
||||
handleItemToggle(event) {
|
||||
const { collapsed, item } = event.detail;
|
||||
|
||||
// If the active item is different from the toggled item, collapse the active item
|
||||
if (this.#activeItem && this.#activeItem !== item && !collapsed) {
|
||||
this.#activeItem.toggle();
|
||||
}
|
||||
|
||||
// Update the active item
|
||||
if (!collapsed) {
|
||||
this.#activeItem = item;
|
||||
} else if (this.#activeItem === item) {
|
||||
this.#activeItem = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define('accordion-item', AccordionItem);
|
||||
customElements.define('accordion-element', AccordionElement);
|
||||
|
||||
|
||||
Vendored
+79
@@ -0,0 +1,79 @@
|
||||
function supportTicketMain() {
|
||||
// https://qa.anwisystems.com/apis/v4/anwisystems/integrations/products/getticket/contactid/{contactid}
|
||||
let cookieRes = COOKIE_HELPER_ACTIONS.getCookie();
|
||||
let { userId } = cookieRes;
|
||||
init()
|
||||
function init() {
|
||||
getTickets();
|
||||
};
|
||||
|
||||
async function getTickets() {
|
||||
let res = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/anwisystems/integrations/products/getticket/contactid/${userId}`);
|
||||
|
||||
if (res.isError) {
|
||||
toasterHelper("error", res.errorMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
res = JSON.parse(res.response.result);
|
||||
|
||||
if (!res.length) {
|
||||
$('.nosupportticket').removeClass('d-none');
|
||||
$('.headersupportlist').addClass('d-none');
|
||||
return;
|
||||
} else {
|
||||
$('.nosupportticket').addClass('d-none');
|
||||
$('.headersupportlist').removeClass('d-none');
|
||||
}
|
||||
|
||||
let supportHTMLTicketList = '';
|
||||
|
||||
debugger
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
supportHTMLTicketList += getTicketHTML(res[i]);
|
||||
}
|
||||
|
||||
$('.support-list-container').html(supportHTMLTicketList);
|
||||
|
||||
|
||||
console.log(res, "support");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getTicketHTML(ticket) {
|
||||
let color = '';
|
||||
let prioityName = ticket[`Priority Name`];
|
||||
if (prioityName.toLowerCase() === 'low') {
|
||||
color = 'info';
|
||||
} else if (prioityName.toLowerCase() === 'high') {
|
||||
color = 'danger';
|
||||
} else {
|
||||
color = 'warning';
|
||||
}
|
||||
|
||||
|
||||
|
||||
//<a href="#" data-bs-toggle="modal" data-bs-target="#supportmodalticket" class="supportlistview d-block
|
||||
return `<a href="supportticket.html?ticketno=${ticket[`ticketno`]}" class="supportlistview d-block bg-gradient-anwi-outline btn-sm btn "><div class="p-2"><div class="card p-2">
|
||||
<div class="row ">
|
||||
<div class="col-sm-3">
|
||||
${ticket[`Raised Date`]}
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
|
||||
${ticket[`ticketno`]}
|
||||
</div>
|
||||
<div class="col-sm-3 text-center">
|
||||
|
||||
${ticket[`Stage Name`]}
|
||||
</div>
|
||||
<div class="col-sm-3 text-center">
|
||||
|
||||
<span class="badge badge-${color} text-bg-${color}">${prioityName}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div></div> </a>`;
|
||||
}
|
||||
}
|
||||
Vendored
+453
@@ -0,0 +1,453 @@
|
||||
navINIT();
|
||||
|
||||
function navINIT() {
|
||||
if(!window.location.href.includes('orderconfirmation')&&!window.location.href.includes('/w/')){
|
||||
loadCart();
|
||||
}
|
||||
|
||||
function loadHelper(src = './dist/js/utils/helpers.js'){
|
||||
if ($(`script[src="${src}"]`).length > 0) {
|
||||
return new Promise((resolve) => resolve());
|
||||
}
|
||||
return new Promise(function (resolve, reject) {
|
||||
var s;
|
||||
s = document.createElement('script');
|
||||
s.src = src;
|
||||
s.onload = resolve;
|
||||
s.onerror = reject;
|
||||
document.head.appendChild(s);
|
||||
});
|
||||
}
|
||||
async function loadCart(){
|
||||
|
||||
if(!window.location.href.includes('services/paymentmethod.html')){
|
||||
let files = ['./dist/js/shoppingcart/addtocart.js'];
|
||||
await loadHelper();
|
||||
for(let i=0;i<files.length;i++){
|
||||
if ($(`script[src="${files[i]}"]`).length > 0) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
|
||||
await loadHelper(files[i])
|
||||
console.log("done");
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setLengthCart();
|
||||
//console.log("hello");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
let URLNAMENAV = window.location.href;
|
||||
const isTransparent = URLNAMENAV.includes('login')||URLNAMENAV.includes('orderconfirmation')|| URLNAMENAV.includes('services/paymentmethod.html');
|
||||
let nav_html = `
|
||||
<header class="header-area section-padding-1 transparent-bar" ${isTransparent ?'style="background:#0A1039"' :''}>
|
||||
<div class="header-large-device">
|
||||
<div class="header-bottom sticky-bar">
|
||||
<div class="container">
|
||||
<div class="header-bottom-flex">
|
||||
<div class="logo-menu-wrap d-flex">
|
||||
<div class="logo">
|
||||
<a href="../index.html">
|
||||
<img src="/dist/assets/imgs/anwi-logo-2.png" alt="logo" class="w-50">
|
||||
</a>
|
||||
</div>
|
||||
<div class="main-menu menu-lh-1 main-menu-padding-1">
|
||||
<nav>
|
||||
<ul class="mb-0 p-0">
|
||||
<li class="hover_tab_1"><a href="./storageproducts.html" class="satoshi_font">STORAGE</a>
|
||||
<ul class="py-3 px-3 rounded-bottom shadow">
|
||||
<li class="d-flex">
|
||||
<ul class="nav nav-pills flex-column w-200 border-end" id="experienceTab" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active text-dark" data-bs-toggle="tab" href="#ora3">ORA 3</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" data-bs-toggle="tab" href="#ora4">ORA 4</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav w-500">
|
||||
<li>
|
||||
<div class="tab-content">
|
||||
<div id="ora3" class="container tab-pane active">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="bg-gray-4 rounded-3 cursor-pointer">
|
||||
<img src="./dist/assets/imgs/Navbar/ora3_ram.png" alt="ora img" class=""/>
|
||||
<p class="fs-7 fw-600 mb-0 text-a-color text-center pb-1">Ora3 M.2 NVMe 512GB</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="bg-gray-4 rounded-3 cursor-pointer">
|
||||
<img src="./dist/assets/imgs/Navbar/ora3_ram.png" alt="ora img" class=""/>
|
||||
<p class="fs-7 fw-600 mb-0 text-a-color text-center pb-1">Ora3 M.2 NVMe 1TB</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="bg-gray-4 rounded-3 cursor-pointer">
|
||||
<img src="./dist/assets/imgs/Navbar/ora3_ram.png" alt="ora img" class=""/>
|
||||
<p class="fs-7 fw-600 mb-0 text-a-color text-center pb-1">Ora3 M.2 NVMe 2TB</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ora4" class="container tab-pane fade">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="bg-gray-4 rounded-3 cursor-pointer">
|
||||
<img src="./dist/assets/imgs/Navbar/ora3_ram.png" alt="ora img" class=""/>
|
||||
<p class="fs-7 fw-600 mb-0 text-a-color text-center pb-1">Ora4 M.2 NVMe 512GB</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="bg-gray-4 rounded-3 cursor-pointer">
|
||||
<img src="./dist/assets/imgs/Navbar/ora3_ram.png" alt="ora img" class=""/>
|
||||
<p class="fs-7 fw-600 mb-0 text-a-color text-center pb-1">Ora4 M.2 NVMe 1TB</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="bg-gray-4 rounded-3 cursor-pointer">
|
||||
<img src="./dist/assets/imgs/Navbar/ora3_ram.png" alt="ora img" class=""/>
|
||||
<p class="fs-7 fw-600 mb-0 text-a-color text-center pb-1">Ora4 M.2 NVMe 2TB</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="hover_tab_2"><a href="./ramproducts.html" class="satoshi_font">MEMORY</a>
|
||||
<ul class="py-3 px-3 rounded-bottom shadow">
|
||||
<li class="d-flex">
|
||||
<ul class="nav nav-pills flex-column w-200 border-end" id="experienceTab" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active text-dark" data-bs-toggle="tab" href="#laptop">Laptop</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" data-bs-toggle="tab" href="#desktop">Desktop</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav w-500">
|
||||
<li>
|
||||
<div class="tab-content">
|
||||
<div id="laptop" class="container tab-pane active">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="bg-gray-4 rounded-3 cursor-pointer">
|
||||
<img src="./dist/assets/imgs/Navbar/ora_ddr4_laptop.png" alt="ora img" class=""/>
|
||||
<p class="fs-7 fw-600 mb-0 text-a-color text-center pb-1">Ora 8GB DDR5</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="bg-gray-4 rounded-3 cursor-pointer">
|
||||
<img src="./dist/assets/imgs/Navbar/ora_ddr5_laptop.png" alt="ora img" class=""/>
|
||||
<p class="fs-7 fw-600 mb-0 text-a-color text-center pb-1">Ora 16GB DDR5</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 ">
|
||||
<div class="bg-gray-4 rounded-3 cursor-pointer">
|
||||
<img src="./dist/assets/imgs/Navbar/ora_ddr5_laptop.png" alt="ora img" class=""/>
|
||||
<p class="fs-7 fw-600 mb-0 text-a-color text-center pb-1">Ora 32GB DDR5</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="desktop" class="container tab-pane fade">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="bg-gray-4 rounded-3 cursor-pointer">
|
||||
<img src="./dist/assets/imgs/Navbar/ora_ddr4_desktop.png" alt="ora img" class=""/>
|
||||
<p class="fs-7 fw-600 mb-0 text-a-color text-center pb-1">Ora 8GB DDR4</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="bg-gray-4 rounded-3 cursor-pointer">
|
||||
<img src="./dist/assets/imgs/Navbar/ora_ddr4_desktop.png" alt="ora img" class=""/>
|
||||
<p class="fs-7 fw-600 mb-0 text-a-color text-center pb-1">Ora 16GB DDR4</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="bg-gray-4 rounded-3 cursor-pointer">
|
||||
<img src="./dist/assets/imgs/Navbar/ora_ddr4_desktop.png" alt="ora img" class=""/>
|
||||
<p class="fs-7 fw-600 mb-0 text-a-color text-center pb-1">Ora 32GB DDR4</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="./support.html" class="satoshi_font">SUPPORT</a></li>
|
||||
<li><a href="./press.html" class="satoshi_font">PRESS</a></li>
|
||||
<li><a href="./index1.html" class="satoshi_font">COMING SOON</a></li>
|
||||
<li><a href="./contact.html" class="satoshi_font">CONTACT</a></li>
|
||||
<li class="d-none"><a href="#" class="satoshi_font product_data" item_id="106633220000002">ACCESSORIES</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-action-wrap header-action-flex header-action-width header-action-mrg-1">
|
||||
<div class="same-style">
|
||||
<a href="/myaccount.html" class="my_avatar">
|
||||
|
||||
<svg style="width:20px;" viewBox="0 0 96 96" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true" class="icon" data-di-res-id="e576e1a9-2f4a9ed6" data-di-rand="1682677695656"><path fill="#fff" d="M48 50c17.346 0 32 14.221 32 31.054V89c0 2.757-2.243 5-5 5H21c-2.757 0-5-2.243-5-5v-7.946C16 64.221 30.654 50 48 50zm0 8c-12.785 0-24 10.773-24 23.054V86h48v-4.946C72 68.773 60.785 58 48 58zm-.002-56c12.133 0 22.003 9.87 22.003 22.001C70 36.131 60.13 46 47.998 46c-12.13 0-21.997-9.869-21.997-21.999C26 11.87 35.867 2 47.998 2zm0 8c-7.718 0-13.997 6.281-13.997 14.001C34 31.72 40.28 38 47.998 38 55.718 38 62 31.72 62 24.001 62 16.281 55.719 10 47.998 10z"></path></svg>
|
||||
</a>
|
||||
</div>
|
||||
<div class="same-style header-cart">
|
||||
<a class="cart-active1 position-relative" href="/shopping-cart.html">
|
||||
<svg style="width:20px;" viewBox="0 0 96 96" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true" class="icon" data-di-res-id="e576e1a9-90f52cd9" data-di-rand="1682677695656"><path fill="#fff" d="M72.848 70.25c6.075 0 11 4.925 11 11s-4.925 11-11 11-11-4.925-11-11 4.925-11 11-11zm-35 0c6.075 0 11 4.925 11 11s-4.925 11-11 11-11-4.925-11-11c0-6.074 4.926-11 11-11zm35 7a4 4 0 10.002 8.001 4 4 0 00-.002-8.001zm-35 0a4 4 0 100 8 4 4 0 000-8zM13.892 3.75c2.287 0 4.376 1.55 5.058 3.72l.064.22 2.97 11.187h68.128a4.727 4.727 0 014.661 5.786l-.048.2-9.559 36.291c-.583 2.216-2.618 3.842-4.894 3.944l-.228.005H30.06c-2.287 0-4.377-1.55-5.06-3.72l-.063-.219-13.124-49.413-10.7.006-.004-8 12.782-.007zm72.03 23.127H24.108l8.027 30.226H77.96l7.962-30.226z"></path></svg>
|
||||
|
||||
<span class="position-absolute cartnumcount d-none" >0</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-small-device header-small-ptb sticky-bar py-md-2 py-2 bg-white">
|
||||
<div class="container-fluid px-4">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-6 header-action-wrap">
|
||||
<div class="d-flex">
|
||||
<div class="same-style header-info">
|
||||
<button class="mobile-menu-button-active">
|
||||
<span class="info-width-1"></span>
|
||||
<span class="info-width-2"></span>
|
||||
<span class="info-width-3"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="mobile-logo mobile-logo-width ps-3">
|
||||
<a href="../index.html">
|
||||
<img alt="" src="/dist/assets/imgs/anwi-logo-1.png" class="w-50">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="header-action-wrap header-action-flex header-action-mrg-1">
|
||||
<div class="same-style">
|
||||
<a href="/myaccount.html" class="my_avatar"> <svg style="width:22px;" viewBox="0 0 96 96" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true" class="icon" data-di-res-id="e576e1a9-2f4a9ed6" data-di-rand="1682677695656"><path fill="#fff" d="M48 50c17.346 0 32 14.221 32 31.054V89c0 2.757-2.243 5-5 5H21c-2.757 0-5-2.243-5-5v-7.946C16 64.221 30.654 50 48 50zm0 8c-12.785 0-24 10.773-24 23.054V86h48v-4.946C72 68.773 60.785 58 48 58zm-.002-56c12.133 0 22.003 9.87 22.003 22.001C70 36.131 60.13 46 47.998 46c-12.13 0-21.997-9.869-21.997-21.999C26 11.87 35.867 2 47.998 2zm0 8c-7.718 0-13.997 6.281-13.997 14.001C34 31.72 40.28 38 47.998 38 55.718 38 62 31.72 62 24.001 62 16.281 55.719 10 47.998 10z"></path></svg></a>
|
||||
</div>
|
||||
<div class="same-style header-cart">
|
||||
<a class="cart-active1 position-relative" href="/shopping-cart.html"> <svg style="width:22px;" viewBox="0 0 96 96" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true" class="icon" data-di-res-id="e576e1a9-90f52cd9" data-di-rand="1682677695656"><path fill="#fff" d="M72.848 70.25c6.075 0 11 4.925 11 11s-4.925 11-11 11-11-4.925-11-11 4.925-11 11-11zm-35 0c6.075 0 11 4.925 11 11s-4.925 11-11 11-11-4.925-11-11c0-6.074 4.926-11 11-11zm35 7a4 4 0 10.002 8.001 4 4 0 00-.002-8.001zm-35 0a4 4 0 100 8 4 4 0 000-8zM13.892 3.75c2.287 0 4.376 1.55 5.058 3.72l.064.22 2.97 11.187h68.128a4.727 4.727 0 014.661 5.786l-.048.2-9.559 36.291c-.583 2.216-2.618 3.842-4.894 3.944l-.228.005H30.06c-2.287 0-4.377-1.55-5.06-3.72l-.063-.219-13.124-49.413-10.7.006-.004-8 12.782-.007zm72.03 23.127H24.108l8.027 30.226H77.96l7.962-30.226z"></path></svg>
|
||||
<span class="position-absolute cartnumcount d-none" style="top:-27%;right:-80%">0</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<!-- Mobile menu start -->
|
||||
<div class="mobile-menu-active clickalbe-sidebar-wrapper-style-1">
|
||||
<div class="clickalbe-sidebar-wrap">
|
||||
<div class="row pb-2 border-bottom">
|
||||
<div class="col-6">
|
||||
<div class="mobile-logo mobile-logo-width">
|
||||
<a href="../index.html">
|
||||
<img alt="" src="/dist/assets/imgs/anwi-logo-1.png" class="w-75">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 text-end pe-4">
|
||||
<a class="sidebar-close"><i class="fa-solid fa-xmark"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mobile-menu-content-area sidebar-content-100-percent pt-3">
|
||||
<div class="mobile-search d-none">
|
||||
<form class="search-form" action="#">
|
||||
<input type="text" placeholder="Search here…" class="satoshi_font">
|
||||
<button class="button-search"><i class="fa-solid fa-magnifying-glass"></i></button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="clickable-mainmenu-wrap clickable-mainmenu-style1">
|
||||
<nav>
|
||||
<ul class="pl-0">
|
||||
<li class=""><a href="./ramproducts.html" class="satoshi_font">RAM</a></li>
|
||||
<li class=""><a href="./storageproducts.html" class="satoshi_font">STORAGE</a></li>
|
||||
<li class=""><a href="./support.html" class="satoshi_font" >SUPPORT</a></li>
|
||||
<li class=""><a href="./press.html" class="satoshi_font">PRESS</a></li>
|
||||
<li class=""><a href="./index1.html" class="satoshi_font">COMING SOON</a></li>
|
||||
<li class=""><a href="./contact.html" class="satoshi_font">CONTACT</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="mobile-curr-lang-wrap d-none">
|
||||
<div class="single-mobile-curr-lang">
|
||||
<a class="mobile-language-active" href="#">Language <i class="icofont-simple-down"></i></a>
|
||||
<div class="lang-curr-dropdown lang-dropdown-active">
|
||||
<ul>
|
||||
<li><a href="#">English</a></li>
|
||||
<li><a href="#">Spanish</a></li>
|
||||
<li><a href="#">Hindi </a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="aside-contact-info d-none">
|
||||
<ul>
|
||||
<li><i class="icofont-clock-time"></i>Monday - Friday: 9:00 - 19:00</li>
|
||||
<li><i class="icofont-envelope"></i>Info@example.com</li>
|
||||
<li><i class="icofont-stock-mobile"></i>(+55) 254. 254. 254</li>
|
||||
<li><i class="icofont-home"></i>Helios Tower 75 Tam Trinh Hoang - Ha Noi - Viet Nam</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
$("#navbar-head").html(nav_html);
|
||||
let width = $(window).width();
|
||||
$(".menu-negative-mrg2,.menu-negative-mrg3,.menu-negative-mrg4").css("width", width);
|
||||
let ele_page = $("body").hasClass("product_pg");
|
||||
if (ele_page == true) {
|
||||
$(".header-area").removeClass("bg-white");
|
||||
$(".main-menu").find("nav ul li a").addClass("text-white");
|
||||
$(".header-bottom.sticky-bar").removeClass("sticky-bar");
|
||||
let src = `../dist/assets/imgs/anwi-logo-2.png`;
|
||||
$(".logo-menu-wrap").find("a img").attr("src", src);
|
||||
$(".main-body").find("iframe").attr("width", width);
|
||||
if (width <= 575 && width >= 390) {
|
||||
$(".main-body").find("iframe").attr({
|
||||
width: width,
|
||||
height: 236,
|
||||
})
|
||||
} else if (width <= 390 && width >= 270) {
|
||||
$(".main-body").find("iframe").attr({
|
||||
width: width,
|
||||
height: 210,
|
||||
});
|
||||
} else if (width <= 998 && width > 575) {
|
||||
$(".main-body").find("iframe").attr({
|
||||
width: width,
|
||||
height: 530,
|
||||
});
|
||||
} else if (width <= 2720 && width > 1920) {
|
||||
$(".main-body").find("iframe").attr({
|
||||
width: width,
|
||||
height: 1440,
|
||||
});
|
||||
} else {
|
||||
$(".main-body").find("iframe").attr({
|
||||
width: width,
|
||||
height: 860,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$("a.ram_data").click(function () {
|
||||
let item_id = $(this).attr("accessories_id");
|
||||
let loc_path = '/products.html'
|
||||
if (window.location.pathname.includes(loc_path)) {
|
||||
window.location.href = `?itemid=${item_id}`
|
||||
}
|
||||
else {
|
||||
window.location.href = `/products.html#itemid=${item_id}`;
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// $(".main-menu nav ul").find("li").each(function () {
|
||||
// var current = window.location.pathname;
|
||||
// var $this = $(this).find("a");
|
||||
// if (current != "/") {
|
||||
// if ($this.attr('href').indexOf(current) !== -1) {
|
||||
// $(this).addClass('active_nav');
|
||||
// }
|
||||
// }
|
||||
|
||||
// })
|
||||
|
||||
// destroy localstorage data
|
||||
let loc_path = '/productdetails.html';
|
||||
if (window.location.pathname.includes(loc_path) === false) {
|
||||
localStorage.removeItem("product_data");
|
||||
localStorage.removeItem("top_data")
|
||||
}
|
||||
let loc_path1 = '/productcatloguedetails.html';
|
||||
if (window.location.pathname.includes(loc_path1) === false) {
|
||||
localStorage.removeItem("product_catlogue_obj");
|
||||
}
|
||||
|
||||
//services pages links and sources
|
||||
|
||||
let $body_pg = $("body").hasClass("services_page");
|
||||
let $hm_pg = "../index.html";
|
||||
let $nav_img = "../dist/assets/imgs/anwi-logo-1.png";
|
||||
let $footer_img = "../dist/assets/imgs/anwi-logo-2.png";
|
||||
let $scrool_top_img = "../dist/assets/imgs/Home/rocket-footer.png";
|
||||
let $about_pg = $("body").hasClass("about_page");
|
||||
if($about_pg == true){
|
||||
debugger
|
||||
$(".main-menu").find("nav ul li a").addClass("text-dark");
|
||||
let img_src = `./dist/assets/imgs/anwi-logo-1.png`;
|
||||
$(".logo-menu-wrap").find("a img").attr("src",img_src);
|
||||
$(".header-bottom").addClass("sticky-bar stick");
|
||||
$("body.about_page").find(".header-large-device").find(".header-action-wrap").find(".same-style").find("svg").find("path").attr("fill","#000");
|
||||
}
|
||||
if ($body_pg == true) {
|
||||
$(".header-large-device").find(".logo-menu-wrap .logo").find("a").attr("href", $hm_pg);
|
||||
$(".header-large-device").find(".logo-menu-wrap .logo").find("a img").attr("src", $nav_img);
|
||||
$(".mobile-logo").find("a").attr("href", $hm_pg);
|
||||
$(".mobile-logo").find("a img").attr("src", $nav_img);
|
||||
$("body.services_page").find(".header-large-device").find(".header-action-wrap").find(".same-style").find("svg").find("path").attr("fill","#000");
|
||||
$(".main-menu").find("nav ul").find("li a").each(function () {
|
||||
$(this).addClass("text-dark")
|
||||
$(".header-bottom").addClass("sticky-bar stick");
|
||||
let $arc = $(this).attr("href");
|
||||
let $spcial_char = $arc.includes("./");
|
||||
if ($spcial_char === true) {
|
||||
let $refarence = `.${$arc}`
|
||||
$(this).attr("href", $refarence);
|
||||
}
|
||||
|
||||
});
|
||||
$(".same-style").find("a").each(function () {
|
||||
let $arc1 = $(this).attr("href");
|
||||
let $spcial_char1 = $arc1.includes("./");
|
||||
if ($spcial_char1 === true) {
|
||||
let $refarence1 = `.${$arc1}`
|
||||
$(this).attr("href", $refarence1);
|
||||
}
|
||||
})
|
||||
$(".tab-content").find("img").each(function(){
|
||||
let $img_src = $(this).attr("src");
|
||||
let $img_src1 = $img_src.includes("./");
|
||||
if ($img_src1 === true) {
|
||||
let $refarenceimg1 = `.${$img_src}`;
|
||||
$(this).attr("src", $refarenceimg1);
|
||||
}
|
||||
});
|
||||
$(".clickable-mainmenu-wrap").find("nav ul").find("li a").each(function () {
|
||||
let $arc_mbil = $(this).attr("href");
|
||||
let $spcial_char_mbil = $arc_mbil.includes("./");
|
||||
if ($spcial_char_mbil === true) {
|
||||
let $refarence_mbil = `.${$arc_mbil}`
|
||||
$(this).attr("href", $refarence_mbil);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setTimeout(()=>{
|
||||
if(width<=600){
|
||||
$('.same-style').find('svg path').attr('fill','#000')
|
||||
}
|
||||
},300)
|
||||
}
|
||||
Vendored
+943
@@ -0,0 +1,943 @@
|
||||
function startDetails() {
|
||||
// http://127.0.0.1:5502/productdetails.html?productId=106633230000024
|
||||
|
||||
if (window.location.search.split('=')[0] == '') {
|
||||
window.location.href = "/notfound.html";
|
||||
return;
|
||||
}
|
||||
let productId = window.location.hash.split('#')[1].split('=')[1];
|
||||
// console.log(productId);
|
||||
let itemtagscombinationRes = null;
|
||||
let labels = {};
|
||||
let isThereInLabel = {};
|
||||
let currentComb = null;
|
||||
|
||||
let colorId = null;
|
||||
|
||||
let group = {};
|
||||
|
||||
let loadingActions = {
|
||||
addLoader() {
|
||||
$('.loadingCall').removeClass('d-none');
|
||||
$('.mainContanierProduct').addClass('d-none');
|
||||
},
|
||||
removeLoader() {
|
||||
$('.loadingCall').addClass('d-none');
|
||||
$('.mainContanierProduct').removeClass('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
let currentClick = null;
|
||||
|
||||
if (productId) {
|
||||
swapSectionsVideo();
|
||||
loadingActions.addLoader();
|
||||
updateProductId(productId);
|
||||
getProductDetails(productId);
|
||||
appendSpecs(productId)
|
||||
} else {
|
||||
window.location.href = "/notfound.html"
|
||||
}
|
||||
|
||||
function updateProductId(val) {
|
||||
$('#productidtag').val(val);
|
||||
}
|
||||
|
||||
function updateItemId(val) {
|
||||
$('#itemidtag').val(val);
|
||||
}
|
||||
|
||||
let specification_wrap_action = {
|
||||
remove() {
|
||||
|
||||
$('.specification-wrap').addClass('d-none');
|
||||
},
|
||||
|
||||
add() {
|
||||
$('.specification-wrap').removeClass('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
let description_action = {
|
||||
addVal(value) {
|
||||
$('.description-wrap > p').html(value);
|
||||
},
|
||||
|
||||
removeVal(value) {
|
||||
$('.description-wrap > p').html('');
|
||||
}
|
||||
}
|
||||
|
||||
function getSpecsItemHTML({ name, des, itemid, id }) {
|
||||
let isMobile = $(window).width()<=600 ? '' : '';
|
||||
let addPaddM = $(window).width()<=600 ? 'py-2' : 'py-4';
|
||||
return `<div id="${id}" data-specitemid="${itemid}" >
|
||||
<div class="row border-bottom">
|
||||
<div class="col-sm-3 ${isMobile} font-weight-600 ${addPaddM} ">
|
||||
${name}
|
||||
</div>
|
||||
<div class="col-sm-9 py-2 d-flex align-items-center">
|
||||
${des}
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
// function getSpecsItemHTML({name,des,itemid,id}){
|
||||
// return ` <tr id="${id}" data-specitemid="${itemid}">
|
||||
// <td style="width:200px">${name}</td>
|
||||
// <td class="">${des}</td>
|
||||
// </tr>`;
|
||||
// }
|
||||
|
||||
async function appendSpecs(id) {
|
||||
let resData = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/itemspecifications/itemid/${id}`, true);
|
||||
|
||||
if (resData.isError) {
|
||||
$('.productdetailstabs').addClass('d-none');
|
||||
$('.specContainerleft').html('')
|
||||
$('.specContainerRight').html('')
|
||||
return;
|
||||
}
|
||||
$('.productdetailstabs ').removeClass('d-none');
|
||||
const res = resData.response;
|
||||
// console.log(JSON.parse(res.result));
|
||||
const data = JSON.parse(res.result);
|
||||
// console.log(data);
|
||||
let html = '';
|
||||
let leftHtml = '';
|
||||
let rightHtml = '';
|
||||
|
||||
if (data.length == 0) {
|
||||
$('.productdetailstabs ').addClass('d-none');
|
||||
$('.specContainerleft').html('')
|
||||
$('.specContainerRight').html('')
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const { specificationname, specificationitemid, itemid, description } = data[i];
|
||||
if ((i + 1) % 2 == 0) {
|
||||
rightHtml += getSpecsItemHTML({
|
||||
name: specificationname, id: specificationitemid, itemid, des: description
|
||||
})
|
||||
} else {
|
||||
leftHtml += getSpecsItemHTML({
|
||||
name: specificationname, id: specificationitemid, itemid, des: description
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$('.specContainerleft').html(leftHtml)
|
||||
$('.specContainerRight').html(rightHtml)
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getParentHTML(name, productid, id, isMain) {
|
||||
return `<div data-parentidgroup="${name?.replace(" ", '')}-parent" class="pb-2 groupingitems_search ${name?.replace(" ", '')}-parent">
|
||||
<h5 class="py-2 smallHeadingProductDetails">${name}</h5>
|
||||
<div class="d-flex gap-2 flex-lg-row flex-wrap ${id}container" data-tagid="${id}">
|
||||
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
function onClickHandler(e) {
|
||||
|
||||
$(e).parent().find('.borderselector').removeClass('borderselector');
|
||||
|
||||
$(e).addClass('borderselector')
|
||||
|
||||
}
|
||||
|
||||
function getChildHTML(tagid, name, isTrue,parentid) {
|
||||
|
||||
let blue = '#253746';
|
||||
let greenLight = '#5e7975';
|
||||
let brown = '#624839';
|
||||
let bgColor = '';
|
||||
if(name === 'Deep Sea Blue'){
|
||||
bgColor = blue;
|
||||
}else if(name == 'Desert Brown'){
|
||||
bgColor = brown;
|
||||
}else if(name == 'Eucalyptus Green'){
|
||||
bgColor = greenLight;
|
||||
}
|
||||
|
||||
if(colorId == parentid){
|
||||
return `
|
||||
<div data-type="${tagid}-${name}" data-tagiditem="${tagid}" class="specsmallcard optiontaganwi ${isTrue ? 'borderselector' : ''} colorselector card text-center small-font cursor-pointer ">
|
||||
<span style="
|
||||
height: 25px;
|
||||
border-radius: 5px;
|
||||
width:25px;
|
||||
background: ${bgColor} !important;
|
||||
pointer-events:none;
|
||||
|
||||
"></span>
|
||||
</div> `
|
||||
}
|
||||
return `
|
||||
<div data-type="${tagid}-${name}" data-tagiditem="${tagid}" class="specsmallcard optiontaganwi ${isTrue ? 'borderselector' : ''} card text-center small-font cursor-pointer p-3">
|
||||
${name}
|
||||
</div> `
|
||||
|
||||
|
||||
}
|
||||
|
||||
function addeventlisteners() {
|
||||
|
||||
$('.optiontaganwi').each(function (i, el) {
|
||||
$(el).click(function (e) {
|
||||
|
||||
$('#quantity').val(1);
|
||||
|
||||
$(e.target).parent().find('.borderselector').removeClass('borderselector');
|
||||
$(e.target).addClass('borderselector');
|
||||
|
||||
currentClick = e.target;
|
||||
;
|
||||
//searchComb();
|
||||
// getAllCombination();
|
||||
getandsetCombination();
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getandsetCombination(){
|
||||
|
||||
let keyOption = $(currentClick).data('tagiditem');
|
||||
$('.disabled-option-item').removeClass('disabled-option-item');
|
||||
let tagsNames = [];
|
||||
|
||||
|
||||
|
||||
let currOptionAvaIds = {};
|
||||
|
||||
$('.borderselector').each(function (i,e){
|
||||
let id = $(e).data('tagiditem');
|
||||
tagsNames.push(id);
|
||||
});
|
||||
|
||||
|
||||
for(let i=0;i<itemtagscombinationRes.length;i++){
|
||||
let tagItems = itemtagscombinationRes[i].tagids;;
|
||||
if(tagItems.includes(keyOption)){
|
||||
let splitArr = tagItems.split('|');
|
||||
for(let j=0;j<splitArr.length;j++){
|
||||
if(keyOption){
|
||||
currOptionAvaIds[splitArr[j]] = splitArr[j];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(currOptionAvaIds);
|
||||
//console.log(itemtagscombinationRes);
|
||||
let parentsArr = [];
|
||||
$('.optiontaganwi').each(function (i,e){
|
||||
|
||||
let currParent = $(e).parents('.groupingitems_search');
|
||||
|
||||
if(currParent.find(`[data-tagiditem="${keyOption}"]`).length==0){
|
||||
let currId = $(e).data('tagiditem');
|
||||
if(!currOptionAvaIds[currId]){
|
||||
if($(e).hasClass('borderselector')){
|
||||
parentsArr.push(currParent);
|
||||
$(e).removeClass('borderselector');
|
||||
}
|
||||
$(e).addClass('disabled-option-item');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for(let i=0;i<parentsArr.length;i++){
|
||||
let currParent = parentsArr[i];
|
||||
currParent.find('.optiontaganwi').each(function (j,e){
|
||||
let isTrue = $(e).hasClass('disabled-option-item');
|
||||
if(!isTrue){
|
||||
$(e).addClass('borderselector');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// $('.optiontaganwi').addClass('disabled-option-item');
|
||||
let parentId = $(currentClick).parents('.groupingitems_search');
|
||||
let parentData = $(parentId).data('parentidgroup');
|
||||
let parentArr = [];
|
||||
$('.groupingitems_search').each(function (i,e){
|
||||
const curParentId = $(e).data('parentidgroup');
|
||||
if(parentData != curParentId){
|
||||
let obj = {
|
||||
name:$(e).find('.smallHeadingProductDetails').html(),
|
||||
arr:[]
|
||||
}
|
||||
$(e).find('.optiontaganwi').each(function (j,evt){
|
||||
let id = $(evt).data('tagiditem');
|
||||
obj.arr.push(id);
|
||||
});
|
||||
parentArr.push(obj);
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
// console.log(parentArr);
|
||||
|
||||
let arrone = parentArr[0].arr;
|
||||
let arrtwo = [];
|
||||
if(parentArr.length>1){
|
||||
arrtwo = parentArr[1]?.arr;
|
||||
}
|
||||
|
||||
let currId = keyOption;
|
||||
let ids = [];
|
||||
for(let i=0;i<arrone.length;i++){
|
||||
//let currEl = [currId,arrone[i]];
|
||||
let currEl = ``
|
||||
for(let j=0;j<arrtwo.length;j++){
|
||||
currEl = `${currId}|${arrone[i]}|${arrtwo[j]}`;
|
||||
|
||||
ids.push(currEl);
|
||||
currEl = '';
|
||||
}
|
||||
|
||||
}
|
||||
console.log(ids,'ids');
|
||||
let findObj = [];
|
||||
debugger
|
||||
for(let i=0;i<ids.length;i++){
|
||||
|
||||
let curId = ids[i]
|
||||
for(let j=0;j<itemtagscombinationRes.length;j++){
|
||||
const currItem = itemtagscombinationRes[j].tagids.split('|');
|
||||
let isTrue = true;
|
||||
for(let k=0;k<currItem.length;k++){
|
||||
if(!curId.includes(currItem[k])){
|
||||
isTrue = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(isTrue){
|
||||
findObj.push(itemtagscombinationRes[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//console.log(findObj);
|
||||
|
||||
$('.optiontaganwi').addClass('disabled-option-item');
|
||||
|
||||
debugger;
|
||||
for(let i=0;i<findObj.length;i++){
|
||||
|
||||
let item = findObj[i].tagids.split('|');
|
||||
for(let j=0;j<item.length;j++){
|
||||
$(`[data-tagiditem=${item[j]}]`).removeClass('disabled-option-item');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(parentId).find('.optiontaganwi').each(function (i,e){
|
||||
$(e).removeClass('disabled-option-item')
|
||||
});
|
||||
|
||||
|
||||
for(let i=0;i<itemtagscombinationRes.length;i++){
|
||||
let currIds = itemtagscombinationRes[i].tagids;
|
||||
let isTrue = true;
|
||||
let isPro = false;
|
||||
|
||||
for(let j=0;j<tagsNames.length;j++){
|
||||
if(tagsNames.join().includes('106631360000128')&&(tagsNames.join().includes('106631360000132')||tagsNames.join().includes('106631360000133'))){
|
||||
isPro = true;
|
||||
}
|
||||
if(!currIds.includes(tagsNames[j])){
|
||||
isTrue = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(isTrue){
|
||||
const { quantity } = itemtagscombinationRes[i];
|
||||
if (true) {
|
||||
currentComb = itemtagscombinationRes[i];
|
||||
|
||||
updateDetailsByObj(itemtagscombinationRes[i]);
|
||||
|
||||
if(isPro){
|
||||
$(`[data-tagiditem="106631360000089"]`).addClass(' disabled-option-item')
|
||||
$(`[data-tagiditem="106631360000088"]`).addClass(' disabled-option-item')
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
let name = itemtagscombinationRes[i].itemname.split('-')[0];
|
||||
$('#addtocart').addClass('disabled');
|
||||
let itemsName = name;
|
||||
$('.borderselector').each(function (i, e) {
|
||||
itemsName += ` ${$(e).html().trim()}`;
|
||||
});
|
||||
|
||||
updateItemId(null);
|
||||
|
||||
let defaultImg = itemtagscombinationRes[i].itemimageurl ? imgServerNameBuild(itemtagscombinationRes[i].itemimageurl) : `./dist/assets/imgs/nophoto.png`;
|
||||
|
||||
$('.productDetailsMain > img').attr('src', defaultImg);
|
||||
|
||||
specification_wrap_action.remove();
|
||||
$('#skudetailitem').val(-1)
|
||||
$('.productname').html(itemsName)
|
||||
|
||||
|
||||
$('.msgErrorDetailsItem').removeClass('d-none');
|
||||
$('.des_productdes').html('');
|
||||
$('.price').html('');
|
||||
}
|
||||
|
||||
initAddToCart()
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// return;
|
||||
|
||||
|
||||
|
||||
|
||||
return;
|
||||
let commonTags = [];
|
||||
// $('.optiontaganwi').addClass('disabled-option-item')
|
||||
|
||||
for(let i=0;i<tagsNames.length;i++){
|
||||
let currtagName = tagsNames[i];
|
||||
let arr = currtagItemCom(currtagName);
|
||||
commonTags.push(arr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
console.log(commonTags);
|
||||
|
||||
// for(let i=0;i<commonTags.length;i++){
|
||||
// let currObj = commonTags[i];
|
||||
// for(let item in currObj){
|
||||
// console.log($(`[data-tagiditem="${item}"]`));
|
||||
// $(`[data-tagiditem="${item}"]`).removeClass('disabled-option-item')
|
||||
// }
|
||||
// }
|
||||
|
||||
let finalAns = {};
|
||||
let arra = [];
|
||||
for(let i=0;i<commonTags.length;i++){
|
||||
let currObj = commonTags[i];
|
||||
for(let item in currObj){
|
||||
let isTrue = true;
|
||||
for(let j=0;j<commonTags.length;j++){
|
||||
if(j!=i){
|
||||
let currComb = commonTags[j];
|
||||
if(!currComb[item]){
|
||||
isTrue = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isTrue){
|
||||
arra.push(currObj[item])
|
||||
finalAns[currObj[item]] = currObj[item];
|
||||
$(`[data-tagiditem="${item}"]`).removeClass('disabled-option-item')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(arra);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// for(let i=0;i<itemtagscombinationRes.length;i++){
|
||||
// let tagItems = itemtagscombinationRes[i].tagids;;
|
||||
// if(tagItems.includes(keyOption)){
|
||||
// let splitArr = tagItems.split('|');
|
||||
// for(let j=0;j<splitArr.length;j++){
|
||||
// commonTags[splitArr[j]] = splitArr[j];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// for(let i=0;i<currOptionAvaIds.length;i++){
|
||||
// let currId = currOptionAvaIds[i];
|
||||
// if(parentId.find(currId).length === 0){
|
||||
// console.log(currId);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
function currtagItemCom(keyOption){
|
||||
debugger;
|
||||
let arr = [];
|
||||
let commonTags = {};
|
||||
for(let i=0;i<itemtagscombinationRes.length;i++){
|
||||
let tagItems = itemtagscombinationRes[i].tagids;;
|
||||
if(tagItems.includes(keyOption)){
|
||||
let splitArr = tagItems.split('|');
|
||||
for(let j=0;j<splitArr.length;j++){
|
||||
if(!commonTags[splitArr[j]]){
|
||||
commonTags[splitArr[j]] = {
|
||||
keyOption,
|
||||
data:itemtagscombinationRes[i]
|
||||
};
|
||||
arr.push(splitArr[j]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return commonTags;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function updateDetailsByObj(obj) {
|
||||
$('.productname').html(obj.itemname);
|
||||
$('.titleproductnav').html(obj.itemname);
|
||||
let [currencySymbol, amount] = getCurrencySymbol(obj?.pricelist||0);
|
||||
|
||||
let commingSoonText = window.location.href.toLowerCase().includes('zeno')||window.location.href.toLowerCase().includes('fyro')
|
||||
$('.price').html(obj.pricelist ? `<span class="font-w600">${currencySymbol}${amount}</span>${commingSoonText?'<span class="mx-1 badge bg-gradient-violet text-a-color">Coming Soon</span>':''}` : 'coming soon');
|
||||
$('.price').attr('data-price',obj.pricelist);
|
||||
appendSpecs(obj.itemid)
|
||||
$('#skudetailitem').val(obj.sku)
|
||||
$('.des_productdes').html(obj.itemdescription);
|
||||
$('#addtocart').attr('data-qty', obj.quantity);
|
||||
|
||||
|
||||
let defaultImg = obj.itemimageurl ? imgServerNameBuild(obj.itemimageurl) : `./dist/assets/imgs/nophoto.png`;
|
||||
// console.log(obj.itemimageurl, 'obj.itemimageurlobj.itemimageurlobj.itemimageurl');
|
||||
debugger;
|
||||
let productId = window.location.hash.split('#')[1]?.split('=')[1];
|
||||
let itemId = window.location.hash.split('#')[2]?.split('=')[1];
|
||||
history.replaceState(undefined, undefined, `#productId=${productId}#itemid=${obj.itemid}`)
|
||||
$('.productDetailsMain > img').attr('src', defaultImg).attr('loading','lazy');
|
||||
|
||||
updateItemId(obj.itemid);
|
||||
|
||||
//console.log(obj,'objobjobj');
|
||||
if (!obj.pricelist || !obj.quantity) {
|
||||
$('.buynow').attr('disabled', true);
|
||||
$('#addtocart').attr('disabled', true);
|
||||
} else {
|
||||
$('.buynow').attr('disabled', false);
|
||||
$('#addtocart').attr('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
function searchComb() {
|
||||
let valuesSelected = [];
|
||||
$('.optiontaganwi').removeClass('disabled-option-item')
|
||||
|
||||
$('#addtocart').removeClass('disabled');
|
||||
$('.msgErrorDetailsItem').addClass('d-none');
|
||||
$('.borderselector,border_selector').each(function (i, el) {
|
||||
// console.log($(el).html())
|
||||
let val = $(el).data('tagiditem');
|
||||
valuesSelected.push(val);
|
||||
});
|
||||
|
||||
let labelRecord = {};
|
||||
|
||||
for (let label in labels) {
|
||||
labelRecord[label] = false;
|
||||
}
|
||||
|
||||
specification_wrap_action.add();
|
||||
|
||||
let unFiler = null;
|
||||
for (let i = 0; i < itemtagscombinationRes.length; i++) {
|
||||
const currItem = itemtagscombinationRes[i];
|
||||
const { tagids } = currItem;
|
||||
|
||||
|
||||
let isTrue = true;
|
||||
let labelFilter = labelRecord;
|
||||
|
||||
for (let i = 0; i < valuesSelected.length; i++) {
|
||||
|
||||
if (!tagids.includes(valuesSelected[i])) {
|
||||
isTrue = false
|
||||
|
||||
unFiler = labelFilter;
|
||||
break;
|
||||
}
|
||||
labelFilter[group[valuesSelected[i]]] = true;
|
||||
}
|
||||
|
||||
if (isTrue) {
|
||||
// console.log(itemtagscombinationRes[i], 'itemtagscombinationRes[i]');
|
||||
const { quantity } = itemtagscombinationRes[i];
|
||||
if (quantity >= $('#quantity').val() && quantity >= 1) {
|
||||
currentComb = itemtagscombinationRes[i];
|
||||
// $('.productname').html(itemtagscombinationRes[i].itemname)
|
||||
// $('.price').html(itemtagscombinationRes[i].pricelist);
|
||||
// location.hash = itemtagscombinationRes[i].itemname.trim();
|
||||
// appendSpecs(itemtagscombinationRes[i].itemid)
|
||||
// history.replaceState(null, null, `#itemid=${itemtagscombinationRes[i].itemid}#${itemtagscombinationRes[i].itemname.trim()}`);
|
||||
|
||||
// $('#skudetailitem').val(itemtagscombinationRes[i].sku)
|
||||
// $('.des_productdes').html(itemtagscombinationRes[i].itemdescription);
|
||||
updateDetailsByObj(itemtagscombinationRes[i]);
|
||||
} else {
|
||||
|
||||
let name = itemtagscombinationRes[i].itemname.split('-')[0];
|
||||
$('#addtocart').addClass('disabled');
|
||||
let itemsName = name;
|
||||
$('.borderselector').each(function (i, e) {
|
||||
itemsName += ` ${$(e).html().trim()}`;
|
||||
});
|
||||
|
||||
updateItemId(null);
|
||||
|
||||
let defaultImg = itemtagscombinationRes[i].itemimageurl ? imgServerNameBuild(itemtagscombinationRes[i].itemimageurl) : `./dist/assets/imgs/nophoto.png`;
|
||||
// console.log(itemtagscombinationRes[i].itemimageurl, 'obj.itemimageurlobj.itemimageurlobj.itemimageurl');
|
||||
|
||||
$('.productDetailsMain > img').attr('src', defaultImg);
|
||||
|
||||
specification_wrap_action.remove();
|
||||
$('#skudetailitem').val(-1)
|
||||
$('.productname').html(itemsName)
|
||||
// history.replaceState(null, null, `#`);
|
||||
|
||||
$('.msgErrorDetailsItem').removeClass('d-none');
|
||||
$('.des_productdes').html('');
|
||||
$('.price').html('');
|
||||
}
|
||||
|
||||
initAddToCart()
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
alert("j");
|
||||
|
||||
let name = itemtagscombinationRes[0].itemname.split('-')[0];
|
||||
let itemsName = name;
|
||||
$('.borderselector').each(function (i, e) {
|
||||
itemsName += `- ${$(e).html().trim()}`;
|
||||
})
|
||||
specification_wrap_action.remove();
|
||||
$('.productname').html(itemsName)
|
||||
$('#skudetailitem').val(-1)
|
||||
$('.price').html('');
|
||||
$('#addtocart').addClass('disabled');
|
||||
$('.msgErrorDetailsItem').removeClass('d-none');
|
||||
|
||||
initAddToCart()
|
||||
}
|
||||
|
||||
function getAllCombination() {
|
||||
debugger;
|
||||
const currClickAttr = $(currentClick).html().trim();
|
||||
const optionId = $(currentClick).data('tagiditem');
|
||||
|
||||
let curr = $(currentClick).parents('.groupingitems_search').data('parentidgroup');
|
||||
$('.groupingitems_search').each(function (i, e) {
|
||||
const id = $(e).data('parentidgroup');
|
||||
if (id != curr) {
|
||||
$(e).find('.optiontaganwi').addClass('disabled-option-item');
|
||||
$(e).find('.borderselector').removeClass('borderselector');
|
||||
}
|
||||
});
|
||||
|
||||
let ansArr = [];
|
||||
let index = 0;
|
||||
let comb = null;
|
||||
for(let i=0;i<itemtagscombinationRes.length;i++){
|
||||
|
||||
let currIds = itemtagscombinationRes[i].tagids;
|
||||
|
||||
if(currIds.includes(optionId)){
|
||||
currIds = currIds.split('|');
|
||||
|
||||
for(let j=0;j<currIds.length;j++){
|
||||
debugger;
|
||||
if(index==0 &&optionId != currIds[j] ) {
|
||||
$(`[data-tagiditem="${currIds[j]}"]`).addClass('borderselector')
|
||||
comb = itemtagscombinationRes[i];
|
||||
index++;
|
||||
}
|
||||
$(`[data-tagiditem="${currIds[j]}"]`).removeClass('disabled-option-item');
|
||||
|
||||
// $().parents('[data-tagid]').find()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// console.log(comb,'comb tag');
|
||||
|
||||
updateDetailsByObj(comb);
|
||||
|
||||
let currentItem = comb.tagids.split('|');
|
||||
|
||||
for(let i=0;i<currentItem.length;i++){
|
||||
$(`[data-tagiditem="${currentItem[i]}"]`).removeClass('disabled-option-item').addClass('borderselector');
|
||||
}
|
||||
|
||||
// history.replaceState(null, null, `#${comb.itemname}`);
|
||||
// window.location.href = `#${comb.itemname}`
|
||||
console.log(itemtagscombinationRes,'gobal');
|
||||
return;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
async function getProductDetails(id) {
|
||||
|
||||
|
||||
debugger;
|
||||
|
||||
let resData = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/productattributelist/productid/${id}`, true);
|
||||
|
||||
|
||||
|
||||
if (resData.isError) {
|
||||
loadingActions.removeLoader();
|
||||
alert(resData.errorMsg.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if(resData.response.result == '[]' || !resData.response.result){
|
||||
$('.barbgnav').removeClass('d-none')
|
||||
loadingActions.removeLoader();
|
||||
toasterHelper("Something Went Wrong")
|
||||
return;
|
||||
}
|
||||
|
||||
let res = resData.response;
|
||||
|
||||
|
||||
res = JSON.parse(res.result);
|
||||
// console.log(res,'resDataresDataresDataresDataresData');
|
||||
// console.log(res, 'productattributelist');
|
||||
|
||||
if (!res) {
|
||||
loadingActions.removeLoader();
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
let html = '';
|
||||
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
const currItem = res[i];
|
||||
// parenttagid means under what label
|
||||
// tag id means it know unquie id
|
||||
const { parentattribute, parenttagid, tagid, attribute, productid } = currItem;
|
||||
|
||||
if (labels[parentattribute]) {
|
||||
labels[parentattribute].items.push({
|
||||
attribute,
|
||||
tagid: tagid
|
||||
});
|
||||
} else {
|
||||
labels[parentattribute] = {
|
||||
id: parenttagid,
|
||||
items: [{
|
||||
attribute,
|
||||
tagid: tagid
|
||||
}]
|
||||
};
|
||||
|
||||
if(parentattribute.toLowerCase() === 'colour'){
|
||||
colorId = parenttagid;
|
||||
}
|
||||
html += getParentHTML(parentattribute, productid, parenttagid, i == 0);
|
||||
}
|
||||
|
||||
}
|
||||
$('#spec-container-details').html(html);
|
||||
|
||||
|
||||
console.log(labels,'labels');
|
||||
|
||||
let childIds = [];
|
||||
|
||||
for (let item in labels) {
|
||||
let { id, items } = labels[item];
|
||||
// $(`[data-tagid=${id}]`)
|
||||
let html = '';
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const { attribute, tagid } = items[i]
|
||||
childIds.push(tagid);
|
||||
group[attribute] = item;
|
||||
// console.log(attribute,colorId,"s");
|
||||
html += getChildHTML(tagid, attribute, i == 0,id);
|
||||
// console.log(attribute,"attributeattributeattributeattribute");
|
||||
}
|
||||
debugger;
|
||||
$(`[data-tagid="${id}"]`).html(html);
|
||||
}
|
||||
itemtagscombinationRes = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/getitemwithoutbranch/productid/${id}`, true);
|
||||
itemtagscombinationRes = JSON.parse(itemtagscombinationRes.response.result);
|
||||
console.log(itemtagscombinationRes, "conductt");
|
||||
|
||||
let itemidSearch = window.location.hash.split('#')[2]?.split('=')[1];
|
||||
|
||||
if(!itemidSearch){
|
||||
itemidSearch = itemtagscombinationRes[0].itemid
|
||||
}
|
||||
|
||||
let valuesSelected = [];
|
||||
|
||||
$('.borderselector').each(function (i, el) {
|
||||
|
||||
let val = $(el).html();
|
||||
valuesSelected.push(val.trim());
|
||||
});
|
||||
debugger;
|
||||
// let searchParams = window.location.search.split("&");
|
||||
// let skuId = window.location.hash.split('#')[2].split('=')[1];
|
||||
// skuId = skuId.split('=')[1]
|
||||
let isGo = true;
|
||||
for (let i = 0; i < itemtagscombinationRes.length; i++) {
|
||||
const currItem = itemtagscombinationRes[i];
|
||||
|
||||
const { tagnames, sku, itemid } = currItem;
|
||||
|
||||
isThereInLabel[tagnames] = itemtagscombinationRes[i];
|
||||
let isTrue = true;
|
||||
if (isGo) {
|
||||
// for(let i=0;i<valuesSelected.length;i++){
|
||||
// if(!tagnames.includes(valuesSelected[i])){
|
||||
// isTrue = false
|
||||
// }
|
||||
// }
|
||||
if (itemidSearch != itemid) {
|
||||
isTrue = false
|
||||
}
|
||||
// if (i != 0) {
|
||||
// isTrue = false
|
||||
// }
|
||||
if (isTrue) {
|
||||
|
||||
// console.log(itemtagscombinationRes[i], 'itemtagscombinationRes[i]');
|
||||
|
||||
|
||||
currentComb = itemtagscombinationRes[i];
|
||||
|
||||
|
||||
updateDetailsByObj(itemtagscombinationRes[i]);
|
||||
|
||||
|
||||
|
||||
isGo = false;
|
||||
let { tagnames, tagids, pricelist } = itemtagscombinationRes[i];
|
||||
tagids = tagids.split('|');
|
||||
tagnames = tagnames.split('|');
|
||||
$('.optiontaganwi').removeClass('borderselector');
|
||||
|
||||
for (let i = 0; i < tagids.length; i++) {
|
||||
|
||||
$(`[data-tagiditem="${tagids[i]}"]`).addClass('borderselector');
|
||||
}
|
||||
|
||||
break;
|
||||
// tagiditem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isGo && itemtagscombinationRes.length != 0) {
|
||||
|
||||
// console.log(itemtagscombinationRes[0]);
|
||||
let { tagnames, tagids, pricelist } = itemtagscombinationRes[0];
|
||||
tagids = tagids.split('|');
|
||||
tagnames = tagnames.split('|');
|
||||
$('.optiontaganwi').removeClass('borderselector');
|
||||
currentComb = itemtagscombinationRes[0];
|
||||
// updateItemId(itemtagscombinationRes[0].itemid);
|
||||
|
||||
for (let i = 0; i < tagids.length; i++) {
|
||||
|
||||
$(`[data-type="${tagids[i]}-${tagnames[i]}"]`).addClass('borderselector');
|
||||
// $(`[data-type="${tagids[i]}-Eucalyptus Green"]`).removeClass('borderselector');
|
||||
// $(`[data-type="${tagids[i]}-Desert Brown"]`).removeClass('borderselector');
|
||||
// $(`[data-type="${tagids[i]}-Deep Sea Blue"]`).removeClass('borderselector');
|
||||
}
|
||||
|
||||
// $('.price').html(pricelist);
|
||||
// $('.des_productdes').html(itemtagscombinationRes[0].itemdescription);
|
||||
// appendSpecs(itemtagscombinationRes[0].itemid);
|
||||
|
||||
updateDetailsByObj(itemtagscombinationRes[0]);
|
||||
//console.log(childIds);
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//getAllCombination()
|
||||
|
||||
|
||||
|
||||
// for(let i=0;i<itemtagscombinationRes.length;i++){
|
||||
// const {tagnames} = itemtagscombinationRes[i];
|
||||
|
||||
// }
|
||||
|
||||
$('#spec-container-details').children().find('.specsmallcard').removeClass('specsmallcard');
|
||||
|
||||
|
||||
|
||||
//getting the first borderselector in first $('.groupingitems_search')[0]
|
||||
|
||||
let firstParentGroup = $('.groupingitems_search')[0];
|
||||
debugger;
|
||||
let optionId = $(firstParentGroup).find('.borderselector').data('tagiditem');
|
||||
|
||||
currentClick = $(firstParentGroup).find('.borderselector')
|
||||
getandsetCombination();
|
||||
addeventlisteners();
|
||||
loadingActions.removeLoader();
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
startDetails();
|
||||
|
||||
+606
@@ -0,0 +1,606 @@
|
||||
function startDetails() {
|
||||
// http://127.0.0.1:5502/productdetails.html?productId=106633230000024
|
||||
if (window.location.search.split('=')[0] == '') {
|
||||
window.location.href = "/notfound.html";
|
||||
return;
|
||||
}
|
||||
let productId = window.location.href.split('=')[1].split('&')[0].split('#')[0];
|
||||
console.log(productId);
|
||||
let itemtagscombinationRes = null;
|
||||
let labels = {};
|
||||
let isThereInLabel = {};
|
||||
let currentComb = null;
|
||||
|
||||
let group = {};
|
||||
|
||||
let loadingActions = {
|
||||
addLoader() {
|
||||
$('.loadingCall').removeClass('d-none');
|
||||
$('.mainContanierProduct').addClass('d-none');
|
||||
},
|
||||
removeLoader() {
|
||||
$('.loadingCall').addClass('d-none');
|
||||
$('.mainContanierProduct').removeClass('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
let currentClick = null;
|
||||
|
||||
if (productId) {
|
||||
loadingActions.addLoader();
|
||||
updateProductId(productId);
|
||||
getProductDetails(productId);
|
||||
appendSpecs(productId)
|
||||
} else {
|
||||
window.location.href = "/notfound.html"
|
||||
}
|
||||
|
||||
function updateProductId(val) {
|
||||
$('#productidtag').val(val);
|
||||
}
|
||||
|
||||
function updateItemId(val) {
|
||||
$('#itemidtag').val(val);
|
||||
}
|
||||
|
||||
let specification_wrap_action = {
|
||||
remove() {
|
||||
|
||||
$('.specification-wrap').addClass('d-none');
|
||||
},
|
||||
|
||||
add() {
|
||||
$('.specification-wrap').removeClass('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
let description_action = {
|
||||
addVal(value) {
|
||||
$('.description-wrap > p').html(value);
|
||||
},
|
||||
|
||||
removeVal(value) {
|
||||
$('.description-wrap > p').html('');
|
||||
}
|
||||
}
|
||||
|
||||
function getSpecsItemHTML({ name, des, itemid, id }) {
|
||||
let isMobile = $(window).width()<=600 ? '' : '';
|
||||
let addPaddM = $(window).width()<=600 ? 'py-2' : 'py-4';
|
||||
return `<div id="${id}" data-specitemid="${itemid}" >
|
||||
<div class="row border-bottom">
|
||||
<div class="col-sm-3 ${isMobile} font-weight-600 ${addPaddM} ">
|
||||
${name}
|
||||
</div>
|
||||
<div class="col-sm-9 py-2 d-flex align-items-center">
|
||||
${des}
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
return `<div id="${id}" data-specitemid="${itemid}" class="">
|
||||
<div class="row border-bottom">
|
||||
<div class="col-sm-6 bg-gray-3 py-2">
|
||||
${name}
|
||||
</div>
|
||||
<div class="col-sm-6 py-2">
|
||||
${des}
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
}
|
||||
// function getSpecsItemHTML({name,des,itemid,id}){
|
||||
// return ` <tr id="${id}" data-specitemid="${itemid}">
|
||||
// <td style="width:200px">${name}</td>
|
||||
// <td class="">${des}</td>
|
||||
// </tr>`;
|
||||
// }
|
||||
|
||||
async function appendSpecs(id) {
|
||||
let resData = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/itemspecifications/itemid/${id}`, true);
|
||||
|
||||
if (resData.isError) {
|
||||
$('.productdetailstabs').addClass('d-none');
|
||||
$('.specContainerleft').html('')
|
||||
$('.specContainerRight').html('')
|
||||
return;
|
||||
}
|
||||
$('.productdetailstabs ').removeClass('d-none');
|
||||
const res = resData.response;
|
||||
console.log(JSON.parse(res.result));
|
||||
const data = JSON.parse(res.result);
|
||||
console.log(data);
|
||||
let html = '';
|
||||
let leftHtml = '';
|
||||
let rightHtml = '';
|
||||
|
||||
if (data.length == 0) {
|
||||
$('.productdetailstabs ').addClass('d-none');
|
||||
$('.specContainerleft').html('')
|
||||
$('.specContainerRight').html('')
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const { specificationname, specificationitemid, itemid, description } = data[i];
|
||||
if ((i + 1) % 2 == 0) {
|
||||
rightHtml += getSpecsItemHTML({
|
||||
name: specificationname, id: specificationitemid, itemid, des: description
|
||||
})
|
||||
} else {
|
||||
leftHtml += getSpecsItemHTML({
|
||||
name: specificationname, id: specificationitemid, itemid, des: description
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$('.specContainerleft').html(leftHtml)
|
||||
$('.specContainerRight').html(rightHtml)
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getParentHTML(name, productid, id, isMain) {
|
||||
return `<div data-parentidgroup="${name?.replace(" ", '')}-parent" class="pb-2 groupingitems_search ${name?.replace(" ", '')}-parent">
|
||||
<h5 class="py-2 smallHeadingProductDetails">${name}</h5>
|
||||
<div class="d-flex gap-2 flex-lg-row flex-wrap ${id}container" data-tagid="${id}">
|
||||
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
function onClickHandler(e) {
|
||||
|
||||
$(e).parent().find('.borderselector').removeClass('borderselector');
|
||||
|
||||
$(e).addClass('borderselector')
|
||||
|
||||
}
|
||||
|
||||
function getChildHTML(tagid, name, isTrue) {
|
||||
|
||||
|
||||
return `
|
||||
<div data-type="${tagid}-${name}" data-tagiditem="${tagid}" class="specsmallcard optiontaganwi ${isTrue ? 'borderselector' : ''} card text-center small-font cursor-pointer p-3">
|
||||
${name}
|
||||
</div> `
|
||||
|
||||
|
||||
}
|
||||
|
||||
function addeventlisteners() {
|
||||
|
||||
$('.optiontaganwi').each(function (i, el) {
|
||||
$(el).click(function (e) {
|
||||
debugger;
|
||||
$('#quantity').val(1);
|
||||
|
||||
$(e.target).parent().find('.borderselector').removeClass('borderselector');
|
||||
$(e.target).addClass('borderselector');
|
||||
searchComb();
|
||||
currentClick = e.target;
|
||||
getAllCombination();
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function updateDetailsByObj(obj) {
|
||||
$('.productname').html(obj.itemname)
|
||||
let [currencySymbol, amount] = getCurrencySymbol(obj?.pricelist||0);
|
||||
|
||||
$('.price').html(obj.pricelist ?`${currencySymbol}${amount}'`:'');
|
||||
$('.price').attr('data-price',obj.pricelist);
|
||||
appendSpecs(obj.itemid)
|
||||
$('#skudetailitem').val(obj.sku)
|
||||
$('.des_productdes').html(obj.itemdescription);
|
||||
$('#addtocart').attr('data-qty', obj.quantity);
|
||||
|
||||
debugger;
|
||||
let defaultImg = obj.itemimageurl ? imgServerNameBuild(obj.itemimageurl) : `./dist/assets/imgs/nophoto.png`;
|
||||
console.log(obj.itemimageurl, 'obj.itemimageurlobj.itemimageurlobj.itemimageurl');
|
||||
|
||||
$('.productDetailsMain > img').attr('src', defaultImg);
|
||||
|
||||
updateItemId(obj.itemid);
|
||||
|
||||
|
||||
if (!obj.pricelist) {
|
||||
$('.buynow').attr('disabled', true);
|
||||
$('#addtocart').attr('disabled', true);
|
||||
} else {
|
||||
$('.buynow').attr('disabled', false);
|
||||
$('#addtocart').attr('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
function searchComb() {
|
||||
let valuesSelected = [];
|
||||
$('.optiontaganwi').removeClass('disabled-option-item')
|
||||
|
||||
$('#addtocart').removeClass('disabled');
|
||||
$('.msgErrorDetailsItem').addClass('d-none');
|
||||
$('.borderselector,border_selector').each(function (i, el) {
|
||||
console.log($(el).html())
|
||||
let val = $(el).data('tagiditem');
|
||||
valuesSelected.push(val);
|
||||
});
|
||||
|
||||
let labelRecord = {};
|
||||
|
||||
for (let label in labels) {
|
||||
labelRecord[label] = false;
|
||||
}
|
||||
|
||||
console.log(labelRecord);
|
||||
specification_wrap_action.add();
|
||||
console.log(group);
|
||||
let unFiler = null;
|
||||
for (let i = 0; i < itemtagscombinationRes.length; i++) {
|
||||
const currItem = itemtagscombinationRes[i];
|
||||
const { tagids } = currItem;
|
||||
|
||||
|
||||
let isTrue = true;
|
||||
let labelFilter = labelRecord;
|
||||
|
||||
for (let i = 0; i < valuesSelected.length; i++) {
|
||||
|
||||
if (!tagids.includes(valuesSelected[i])) {
|
||||
isTrue = false
|
||||
|
||||
unFiler = labelFilter;
|
||||
break;
|
||||
}
|
||||
labelFilter[group[valuesSelected[i]]] = true;
|
||||
}
|
||||
|
||||
if (isTrue) {
|
||||
console.log(itemtagscombinationRes[i], 'itemtagscombinationRes[i]');
|
||||
const { quantity } = itemtagscombinationRes[i];
|
||||
if (quantity >= $('#quantity').val() && quantity >= 1) {
|
||||
currentComb = itemtagscombinationRes[i];
|
||||
// $('.productname').html(itemtagscombinationRes[i].itemname)
|
||||
// $('.price').html(itemtagscombinationRes[i].pricelist);
|
||||
// location.hash = itemtagscombinationRes[i].itemname.trim();
|
||||
// appendSpecs(itemtagscombinationRes[i].itemid)
|
||||
history.replaceState(null, null, `#itemid=${itemtagscombinationRes[i].itemid}#${itemtagscombinationRes[i].itemname.trim()}`);
|
||||
|
||||
// $('#skudetailitem').val(itemtagscombinationRes[i].sku)
|
||||
// $('.des_productdes').html(itemtagscombinationRes[i].itemdescription);
|
||||
updateDetailsByObj(itemtagscombinationRes[i]);
|
||||
} else {
|
||||
|
||||
let name = itemtagscombinationRes[i].itemname.split('-')[0];
|
||||
$('#addtocart').addClass('disabled');
|
||||
let itemsName = name;
|
||||
$('.borderselector').each(function (i, e) {
|
||||
itemsName += ` ${$(e).html().trim()}`;
|
||||
});
|
||||
|
||||
updateItemId(null);
|
||||
|
||||
let defaultImg = itemtagscombinationRes[i].itemimageurl ? imgServerNameBuild(itemtagscombinationRes[i].itemimageurl) : `./dist/assets/imgs/nophoto.png`;
|
||||
console.log(itemtagscombinationRes[i].itemimageurl, 'obj.itemimageurlobj.itemimageurlobj.itemimageurl');
|
||||
|
||||
$('.productDetailsMain > img').attr('src', defaultImg);
|
||||
|
||||
specification_wrap_action.remove();
|
||||
$('#skudetailitem').val(-1)
|
||||
$('.productname').html(itemsName)
|
||||
history.replaceState(null, null, `#`);
|
||||
|
||||
$('.msgErrorDetailsItem').removeClass('d-none');
|
||||
$('.des_productdes').html('');
|
||||
$('.price').html('');
|
||||
}
|
||||
|
||||
initAddToCart()
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
alert("j");
|
||||
let name = itemtagscombinationRes[0].itemname.split('-')[0];
|
||||
let itemsName = name;
|
||||
$('.borderselector').each(function (i, e) {
|
||||
itemsName += `- ${$(e).html().trim()}`;
|
||||
})
|
||||
specification_wrap_action.remove();
|
||||
$('.productname').html(itemsName)
|
||||
$('#skudetailitem').val(-1)
|
||||
$('.price').html('');
|
||||
$('#addtocart').addClass('disabled');
|
||||
$('.msgErrorDetailsItem').removeClass('d-none');
|
||||
|
||||
initAddToCart()
|
||||
}
|
||||
|
||||
function getAllCombination() {
|
||||
debugger;
|
||||
const currClickAttr = $(currentClick).html().trim();
|
||||
|
||||
let isThere = [];
|
||||
for (let item in isThereInLabel) {
|
||||
let { tagnames } = isThereInLabel[item];
|
||||
if (tagnames.includes(currClickAttr)) {
|
||||
isThere.push(isThereInLabel[item])
|
||||
}
|
||||
}
|
||||
|
||||
if (!isThere.length) {
|
||||
let curr = $(currentClick).parents('.groupingitems_search').data('parentidgroup');
|
||||
$('.groupingitems_search').each(function (i, e) {
|
||||
const id = $(e).data('parentidgroup');
|
||||
if (id != curr) {
|
||||
$(e).find('.optiontaganwi').addClass('disabled-option-item');
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
let selected = [];
|
||||
$('.borderselector').each(function (i, e) {
|
||||
selected.push($(e).html().trim())
|
||||
});
|
||||
|
||||
// console.log(selected);
|
||||
// console.log(isThere);
|
||||
|
||||
let ishashObj = {};
|
||||
|
||||
for (let i = 0; i < isThere.length; i++) {
|
||||
let { tagnames, tagids } = isThere[i];
|
||||
tagnames = tagnames.split('|');
|
||||
tagids = tagids.split('|');
|
||||
|
||||
for (let j = 0; j < tagnames.length; j++) {
|
||||
if (!ishashObj[tagnames[j]]) {
|
||||
ishashObj[tagnames[j]] = tagids[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log(ishashObj);
|
||||
|
||||
// for(let i=0;i<itemtagscombinationRes.length;i++){
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function getProductDetails(id) {
|
||||
|
||||
|
||||
debugger;
|
||||
|
||||
let resData = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/productattributelist/productid/${id}`, true);
|
||||
|
||||
if (resData.isError) {
|
||||
loadingActions.removeLoader();
|
||||
alert(resData.errorMsg.message);
|
||||
return;
|
||||
}
|
||||
|
||||
let res = resData.response;
|
||||
|
||||
res = JSON.parse(res.result);
|
||||
console.log(res, 'productattributelist');
|
||||
|
||||
if (!res) {
|
||||
loadingActions.removeLoader();
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
let html = '';
|
||||
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
const currItem = res[i];
|
||||
// parenttagid means under what label
|
||||
// tag id means it know unquie id
|
||||
const { parentattribute, parenttagid, tagid, attribute, productid } = currItem;
|
||||
|
||||
if (labels[parentattribute]) {
|
||||
labels[parentattribute].items.push({
|
||||
attribute,
|
||||
tagid: tagid
|
||||
});
|
||||
} else {
|
||||
labels[parentattribute] = {
|
||||
id: parenttagid,
|
||||
items: [{
|
||||
attribute,
|
||||
tagid: tagid
|
||||
}]
|
||||
};
|
||||
html += getParentHTML(parentattribute, productid, parenttagid, i == 0);
|
||||
}
|
||||
|
||||
}
|
||||
$('#spec-container-details').html(html);
|
||||
|
||||
|
||||
// console.log(labels,'labels');
|
||||
|
||||
let childIds = [];
|
||||
|
||||
for (let item in labels) {
|
||||
let { id, items } = labels[item];
|
||||
// $(`[data-tagid=${id}]`)
|
||||
let html = '';
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const { attribute, tagid } = items[i]
|
||||
childIds.push(tagid);
|
||||
group[attribute] = item;
|
||||
html += getChildHTML(tagid, attribute, i == 0);
|
||||
}
|
||||
$(`[data-tagid="${id}"]`).html(html);
|
||||
}
|
||||
itemtagscombinationRes = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/getitemwithoutbranch/productid/${id}`, true);
|
||||
itemtagscombinationRes = JSON.parse(itemtagscombinationRes.response.result);
|
||||
console.log(itemtagscombinationRes, "conductt");
|
||||
|
||||
let valuesSelected = [];
|
||||
|
||||
$('.borderselector').each(function (i, el) {
|
||||
|
||||
let val = $(el).html();
|
||||
valuesSelected.push(val.trim());
|
||||
});
|
||||
|
||||
let searchParams = window.location.search.split("&");
|
||||
let skuId = window.location.hash.split('#')[1].split('=')[1];
|
||||
// skuId = skuId.split('=')[1]
|
||||
let isGo = true;
|
||||
for (let i = 0; i < itemtagscombinationRes.length; i++) {
|
||||
const currItem = itemtagscombinationRes[i];
|
||||
|
||||
const { tagnames, sku, itemid } = currItem;
|
||||
|
||||
isThereInLabel[tagnames] = itemtagscombinationRes[i];
|
||||
let isTrue = true;
|
||||
if (isGo) {
|
||||
// for(let i=0;i<valuesSelected.length;i++){
|
||||
// if(!tagnames.includes(valuesSelected[i])){
|
||||
// isTrue = false
|
||||
// }
|
||||
// }
|
||||
if (i != 0) {
|
||||
isTrue = false
|
||||
}
|
||||
if (isTrue) {
|
||||
|
||||
console.log(itemtagscombinationRes[i], 'itemtagscombinationRes[i]');
|
||||
|
||||
|
||||
currentComb = itemtagscombinationRes[i];
|
||||
|
||||
|
||||
updateDetailsByObj(itemtagscombinationRes[i]);
|
||||
|
||||
|
||||
|
||||
isGo = false;
|
||||
let { tagnames, tagids, pricelist } = itemtagscombinationRes[i];
|
||||
tagids = tagids.split('|');
|
||||
tagnames = tagnames.split('|');
|
||||
$('.optiontaganwi').removeClass('borderselector');
|
||||
|
||||
for (let i = 0; i < tagids.length; i++) {
|
||||
|
||||
$(`[data-tagiditem="${tagids[i]}"]`).addClass('borderselector');
|
||||
}
|
||||
// tagiditem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isGo && itemtagscombinationRes.length != 0) {
|
||||
|
||||
console.log(itemtagscombinationRes[0]);
|
||||
let { tagnames, tagids, pricelist } = itemtagscombinationRes[0];
|
||||
tagids = tagids.split('|');
|
||||
tagnames = tagnames.split('|');
|
||||
$('.optiontaganwi').removeClass('borderselector');
|
||||
currentComb = itemtagscombinationRes[0];
|
||||
// updateItemId(itemtagscombinationRes[0].itemid);
|
||||
|
||||
for (let i = 0; i < tagids.length; i++) {
|
||||
|
||||
$(`[data-type="${tagids[i]}-${tagnames[i]}"]`).addClass('borderselector');
|
||||
// $(`[data-type="${tagids[i]}-Eucalyptus Green"]`).removeClass('borderselector');
|
||||
// $(`[data-type="${tagids[i]}-Desert Brown"]`).removeClass('borderselector');
|
||||
// $(`[data-type="${tagids[i]}-Deep Sea Blue"]`).removeClass('borderselector');
|
||||
}
|
||||
|
||||
// $('.price').html(pricelist);
|
||||
// $('.des_productdes').html(itemtagscombinationRes[0].itemdescription);
|
||||
// appendSpecs(itemtagscombinationRes[0].itemid);
|
||||
|
||||
updateDetailsByObj(itemtagscombinationRes[0]);
|
||||
//console.log(childIds);
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
//getAllCombination()
|
||||
|
||||
|
||||
|
||||
// for(let i=0;i<itemtagscombinationRes.length;i++){
|
||||
// const {tagnames} = itemtagscombinationRes[i];
|
||||
|
||||
// }
|
||||
|
||||
$('#spec-container-details').children().find('.specsmallcard').removeClass('specsmallcard');
|
||||
|
||||
addeventlisteners();
|
||||
loadingActions.removeLoader();
|
||||
return;
|
||||
// let resTwo = await postStatAPIService(`${SERVERNAME}/apis/v4/bizgaze/integrations/products/itemtagscombination/productid/${id}`);
|
||||
|
||||
|
||||
//let html = '';
|
||||
let attributesObj = {};
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
const { parentattribute, tagid, productid } = res[i];
|
||||
// let attributes = await postStatAPIService(`${SERVERNAME}/apis/v4/bizgaze/integrations/products/productattributelist/parenttagid/${tagid}`);
|
||||
// attributesObj[tagid] = JSON.parse(attributes.data.result);
|
||||
// console.log(attributes.data.result,tagid);
|
||||
html += getParentHTML(parentattribute, productid, tagid, i == 0);
|
||||
}
|
||||
|
||||
$('#spec-container-details').html(html);
|
||||
|
||||
|
||||
// let attributes = await postStatAPIService(`${SERVERNAME}/apis/v4/bizgaze/integrations/products/productattributelist/parenttagid/${tagid}`);
|
||||
return;
|
||||
for (let attr in attributesObj) {
|
||||
const arr = attributesObj[attr];
|
||||
|
||||
let html = '';
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const { attribute, tagid } = arr[i];
|
||||
html += getChildHTML(tagid, attribute, i == 0);
|
||||
}
|
||||
|
||||
|
||||
$(`[data-tagid="${attr}"]`).html(html);
|
||||
|
||||
|
||||
}
|
||||
|
||||
let defaultValues = await postStatAPIService(`${SERVERNAME}/apis/v4/bizgaze/integrations/products/sellableitemlist/productid/${id}`);
|
||||
defaultValues = JSON.parse(defaultValues.data.result);
|
||||
let { itemname, price } = defaultValues[0];
|
||||
$('.productname').html(itemname);
|
||||
$('.price').html(price)
|
||||
|
||||
$('#spec-container-details').children().slice(1).find('.specsmallcard').removeClass('specsmallcard');
|
||||
|
||||
|
||||
|
||||
|
||||
// getQuantityById(id)
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
startDetails();
|
||||
|
||||
+650
@@ -0,0 +1,650 @@
|
||||
function startDetails() {
|
||||
// http://127.0.0.1:5502/productdetails.html?productId=106633230000024
|
||||
if (window.location.search.split('=')[0] == '') {
|
||||
window.location.href = "/notfound.html";
|
||||
return;
|
||||
}
|
||||
let productId = window.location.href.split('=')[1].split('&')[0].split('#')[0];
|
||||
console.log(productId);
|
||||
let itemtagscombinationRes = null;
|
||||
let labels = {};
|
||||
let isThereInLabel = {};
|
||||
let currentComb = null;
|
||||
|
||||
let group = {};
|
||||
|
||||
let loadingActions = {
|
||||
addLoader() {
|
||||
$('.loadingCall').removeClass('d-none');
|
||||
$('.mainContanierProduct').addClass('d-none');
|
||||
},
|
||||
removeLoader() {
|
||||
$('.loadingCall').addClass('d-none');
|
||||
$('.mainContanierProduct').removeClass('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
let currentClick = null;
|
||||
|
||||
if (productId) {
|
||||
loadingActions.addLoader();
|
||||
updateProductId(productId);
|
||||
getProductDetails(productId);
|
||||
appendSpecs(productId)
|
||||
} else {
|
||||
window.location.href = "/notfound.html"
|
||||
}
|
||||
|
||||
function updateProductId(val) {
|
||||
$('#productidtag').val(val);
|
||||
}
|
||||
|
||||
function updateItemId(val) {
|
||||
$('#itemidtag').val(val);
|
||||
}
|
||||
|
||||
let specification_wrap_action = {
|
||||
remove() {
|
||||
|
||||
$('.specification-wrap').addClass('d-none');
|
||||
},
|
||||
|
||||
add() {
|
||||
$('.specification-wrap').removeClass('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
let description_action = {
|
||||
addVal(value) {
|
||||
$('.description-wrap > p').html(value);
|
||||
},
|
||||
|
||||
removeVal(value) {
|
||||
$('.description-wrap > p').html('');
|
||||
}
|
||||
}
|
||||
|
||||
function getSpecsItemHTML({ name, des, itemid, id }) {
|
||||
return `<div id="${id}" data-specitemid="${itemid}" class="">
|
||||
<div class="row border-bottom">
|
||||
<div class="col-sm-6 bg-gray-3 py-2">
|
||||
${name}
|
||||
</div>
|
||||
<div class="col-sm-6 py-2">
|
||||
${des}
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
return ` <tr id="${id}" data-specitemid="${itemid}">
|
||||
<td style="width:200px">${name}</td>
|
||||
<td class="">${des}</td>
|
||||
</tr>`;
|
||||
}
|
||||
// function getSpecsItemHTML({name,des,itemid,id}){
|
||||
// return ` <tr id="${id}" data-specitemid="${itemid}">
|
||||
// <td style="width:200px">${name}</td>
|
||||
// <td class="">${des}</td>
|
||||
// </tr>`;
|
||||
// }
|
||||
|
||||
async function appendSpecs(id) {
|
||||
let resData = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/itemspecifications/itemid/${id}`, true);
|
||||
|
||||
if (resData.isError) {
|
||||
$('.productdetailstabs').addClass('d-none');
|
||||
$('.specContainerleft').html('')
|
||||
$('.specContainerRight').html('')
|
||||
return;
|
||||
}
|
||||
$('.productdetailstabs ').removeClass('d-none');
|
||||
const res = resData.response;
|
||||
console.log(JSON.parse(res.result));
|
||||
const data = JSON.parse(res.result);
|
||||
console.log(data);
|
||||
let html = '';
|
||||
let leftHtml = '';
|
||||
let rightHtml = '';
|
||||
|
||||
if (data.length == 0) {
|
||||
$('.productdetailstabs ').addClass('d-none');
|
||||
$('.specContainerleft').html('')
|
||||
$('.specContainerRight').html('')
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const { specificationname, specificationitemid, itemid, description } = data[i];
|
||||
if ((i + 1) % 2 == 0) {
|
||||
rightHtml += getSpecsItemHTML({
|
||||
name: specificationname, id: specificationitemid, itemid, des: description
|
||||
})
|
||||
} else {
|
||||
leftHtml += getSpecsItemHTML({
|
||||
name: specificationname, id: specificationitemid, itemid, des: description
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$('.specContainerleft').html(leftHtml)
|
||||
$('.specContainerRight').html(rightHtml)
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getParentHTML(name, productid, id, isMain) {
|
||||
return `<div class="pb-2 $${name?.replace(" ", '')}-parent">
|
||||
<h5 class="py-2 smallHeadingProductDetails">${name}</h5>
|
||||
<div class="d-flex gap-2 flex-lg-row flex-wrap ${id}container" data-tagid="${id}">
|
||||
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
function onClickHandler(e) {
|
||||
|
||||
$(e).parent().find('.borderselector').removeClass('borderselector');
|
||||
|
||||
$(e).addClass('borderselector')
|
||||
|
||||
}
|
||||
|
||||
function getChildHTML(tagid, name, isTrue) {
|
||||
|
||||
let item_color_1 = `#5e7975`;
|
||||
let item_color_2 = `#624839`;
|
||||
let item_color_3 = `#253746`;
|
||||
if(name == "Eucalyptus Green"){
|
||||
|
||||
return `<p item_color=${item_color_1} data-type="${tagid}-${name}" data-tagiditem="${tagid}" class="optiontaganwi_color specsmallcard optiontaganwi fs-7 cursor-pointer text-white rounded mb-0 me-1 py-2 px-3" ${item_color_1 ? `style="background-color:${item_color_1}"`:''}><span class="${isTrue ? 'border-bottom color' : 'color'}">${name}</span></p>`;
|
||||
|
||||
}else if(name == "Desert Brown"){
|
||||
|
||||
return `<p item_color=${item_color_2} data-type="${tagid}-${name}" data-tagiditem="${tagid}" class="optiontaganwi_color specsmallcard optiontaganwi mb-0 fs-7 cursor-pointer me-1 rounded text-white py-2 px-3" ${item_color_2 ? `style="background-color:${item_color_2}"`:''}><span class="${isTrue ? 'border-bottom color' : 'color'}">${name}</span></p>`;
|
||||
|
||||
}else if(name == "Deep Sea Blue"){
|
||||
|
||||
return `<p item_color=${item_color_3} data-type="${tagid}-${name}" data-tagiditem="${tagid}" class="optiontaganwi_color specsmallcard optiontaganwi mb-0 fs-7 text-white cursor-pointer rounded py-2 px-3 " ${item_color_3 ? `style="background-color:${item_color_3}"`:''}><span class="${isTrue ? 'border-bottom color' : 'color'}">${name}</span></p>`;
|
||||
}
|
||||
else{
|
||||
return `
|
||||
<div data-type="${tagid}-${name}" data-tagiditem="${tagid}" class="specsmallcard optiontaganwi ${isTrue ? 'borderselector' : ''} card text-center small-font cursor-pointer p-3">
|
||||
${name}
|
||||
</div> `
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function addeventlisteners() {
|
||||
|
||||
$('.optiontaganwi').each(function (i, el) {
|
||||
$(el).click(function (e) {
|
||||
$('#quantity').val(1);
|
||||
debugger;
|
||||
let ele_col = $(e.target).hasClass("color");
|
||||
let ele_col1 = $(e.target).hasClass("optiontaganwi_color");
|
||||
if(ele_col === true){
|
||||
$(e.target).parent().find("span.color").removeClass('border-bottom');
|
||||
$(e.target).parent().addClass("border_selector");
|
||||
$(e.target).addClass("border-bottom");
|
||||
$(e.target).parent().find("span.border-bottom").removeClass("border-bottom text-dark");
|
||||
$(e.target).addClass("border_selector");
|
||||
$(e.target).find("span.color").addClass("border-bottom text-dark");
|
||||
$(e.target).parent().find('.borderselector').removeClass('borderselector');
|
||||
// $(e.target).addClass('borderselector');
|
||||
searchComb();
|
||||
currentClick = e.target;
|
||||
}else if(ele_col1 === true){
|
||||
$(e.target).parent().find("span.text-dark").removeClass("text-dark border-bottom");
|
||||
$(e.target).addClass("border_selector");
|
||||
$(e.target).find("span.color").addClass("text-dark");
|
||||
$(e.target).parent().find('.borderselector').removeClass('borderselector');
|
||||
$(e.target).addClass('borderselector');
|
||||
searchComb();
|
||||
currentClick = e.target;
|
||||
}else{
|
||||
$(e.target).parent().find('.borderselector').removeClass('borderselector');
|
||||
$(e.target).addClass('borderselector');
|
||||
searchComb();
|
||||
currentClick = e.target;
|
||||
}
|
||||
|
||||
searchComb();
|
||||
currentClick = e.target;
|
||||
// getAllCombination();
|
||||
})
|
||||
});
|
||||
// $('.optiontaganwi_color span.color').each(function (i, el) {
|
||||
// $(el).click(function (e) {
|
||||
// $('#quantity').val(1);
|
||||
// $(e.target).parent().find("span.border-bottom").removeClass("border-bottom");
|
||||
// $(e.target).addClass("border-bottom");
|
||||
// searchComb();
|
||||
// currentClick = e.target;
|
||||
// // getAllCombination();
|
||||
// })
|
||||
// });
|
||||
}
|
||||
|
||||
// function getChildHTML(tagid,name,isTrue){
|
||||
// return `
|
||||
// <div data-type="${tagid}-${name}" data-tagiditem="${tagid}" class="specsmallcard optiontaganwi ${isTrue?'borderselector':''} card small-font cursor-pointer p-3">
|
||||
// ${name}
|
||||
// </div>
|
||||
// `
|
||||
// }
|
||||
|
||||
// function addeventlisteners(){
|
||||
|
||||
// $('.optiontaganwi').each(function (i,el){
|
||||
// $(el).click(function (e){
|
||||
// $('#quantity').val(1)
|
||||
// $(e.target).parent().find('.borderselector').removeClass('borderselector');
|
||||
// $(e.target).addClass('borderselector')
|
||||
// searchComb();
|
||||
// currentClick = e.target;
|
||||
// // getAllCombination();
|
||||
// })
|
||||
// });
|
||||
// }
|
||||
|
||||
function updateDetailsByObj(obj) {
|
||||
$('.productname').html(obj.itemname)
|
||||
$('.price').html(obj.pricelist?obj.pricelist:'coming soon');
|
||||
appendSpecs(obj.itemid)
|
||||
$('#skudetailitem').val(obj.sku)
|
||||
$('.des_productdes').html(obj.itemdescription);
|
||||
$('#addtocart').attr('data-qty', obj.quantity);
|
||||
|
||||
|
||||
let defaultImg = obj.itemimageurl ? imgServerNameBuild(obj.itemimageurl) : `./dist/assets/imgs/nophoto.png`;
|
||||
console.log(obj.itemimageurl, 'obj.itemimageurlobj.itemimageurlobj.itemimageurl');
|
||||
|
||||
$('.productDetailsMain > img').attr('src', defaultImg);
|
||||
|
||||
updateItemId(obj.itemid);
|
||||
|
||||
|
||||
if(!obj.pricelist){
|
||||
$('.buynow').attr('disabled',true);
|
||||
$('#addtocart').attr('disabled',true);
|
||||
}else{
|
||||
$('.buynow').attr('disabled',false);
|
||||
$('#addtocart').attr('disabled',false);
|
||||
}
|
||||
}
|
||||
|
||||
function searchComb() {
|
||||
let valuesSelected = [];
|
||||
|
||||
|
||||
$('#addtocart').removeClass('disabled');
|
||||
$('.msgErrorDetailsItem').addClass('d-none');
|
||||
$('.borderselector,border_selector').each(function (i, el) {
|
||||
console.log($(el).html())
|
||||
let val = $(el).html();
|
||||
valuesSelected.push(val.trim());
|
||||
});
|
||||
|
||||
let labelRecord = {};
|
||||
|
||||
for (let label in labels) {
|
||||
labelRecord[label] = false;
|
||||
}
|
||||
|
||||
console.log(labelRecord);
|
||||
specification_wrap_action.add();
|
||||
console.log(group);
|
||||
let unFiler = null;
|
||||
for (let i = 0; i < itemtagscombinationRes.length; i++) {
|
||||
const currItem = itemtagscombinationRes[i];
|
||||
const { tagnames } = currItem;
|
||||
|
||||
|
||||
let isTrue = true;
|
||||
let labelFilter = labelRecord;
|
||||
|
||||
for (let i = 0; i < valuesSelected.length; i++) {
|
||||
|
||||
if (!tagnames.includes(valuesSelected[i])) {
|
||||
isTrue = false
|
||||
|
||||
unFiler = labelFilter;
|
||||
break;
|
||||
}
|
||||
labelFilter[group[valuesSelected[i]]] = true;
|
||||
}
|
||||
|
||||
if (isTrue) {
|
||||
console.log(itemtagscombinationRes[i], 'itemtagscombinationRes[i]');
|
||||
const { quantity } = itemtagscombinationRes[i];
|
||||
if (quantity >= $('#quantity').val() && quantity >= 1) {
|
||||
currentComb = itemtagscombinationRes[i];
|
||||
// $('.productname').html(itemtagscombinationRes[i].itemname)
|
||||
// $('.price').html(itemtagscombinationRes[i].pricelist);
|
||||
// location.hash = itemtagscombinationRes[i].itemname.trim();
|
||||
// appendSpecs(itemtagscombinationRes[i].itemid)
|
||||
history.replaceState(null, null, `#itemid=${itemtagscombinationRes[i].itemid}#${itemtagscombinationRes[i].itemname.trim()}`);
|
||||
|
||||
// $('#skudetailitem').val(itemtagscombinationRes[i].sku)
|
||||
// $('.des_productdes').html(itemtagscombinationRes[i].itemdescription);
|
||||
updateDetailsByObj(itemtagscombinationRes[i]);
|
||||
} else {
|
||||
|
||||
let name = itemtagscombinationRes[i].itemname.split('-')[0];
|
||||
$('#addtocart').addClass('disabled');
|
||||
let itemsName = name;
|
||||
$('.borderselector').each(function (i, e) {
|
||||
itemsName += ` ${$(e).html().trim()}`;
|
||||
});
|
||||
|
||||
updateItemId(null);
|
||||
|
||||
specification_wrap_action.remove();
|
||||
$('#skudetailitem').val(-1)
|
||||
$('.productname').html(itemsName)
|
||||
history.replaceState(null, null, `#`);
|
||||
|
||||
$('.msgErrorDetailsItem').removeClass('d-none');
|
||||
$('.des_productdes').html('');
|
||||
$('.price').html('');
|
||||
}
|
||||
|
||||
initAddToCart()
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let name = itemtagscombinationRes[0].itemname.split('-')[0];
|
||||
let itemsName = name;
|
||||
$('.borderselector').each(function (i, e) {
|
||||
itemsName += `- ${$(e).html().trim()}`;
|
||||
})
|
||||
specification_wrap_action.remove();
|
||||
$('.productname').html(itemsName)
|
||||
$('#skudetailitem').val(-1)
|
||||
$('.price').html('');
|
||||
$('#addtocart').addClass('disabled');
|
||||
$('.msgErrorDetailsItem').removeClass('d-none');
|
||||
|
||||
initAddToCart()
|
||||
}
|
||||
|
||||
function getAllCombination() {
|
||||
const currClickAttr = $(currentClick).html().trim();
|
||||
|
||||
let isThere = [];
|
||||
for (let item in isThereInLabel) {
|
||||
let { tagnames } = isThereInLabel[item];
|
||||
if (tagnames.includes(currClickAttr)) {
|
||||
isThere.push(isThereInLabel[item])
|
||||
}
|
||||
}
|
||||
let selected = [];
|
||||
$('.borderselector').each(function (i, e) {
|
||||
selected.push($(e).html().trim())
|
||||
});
|
||||
|
||||
// console.log(selected);
|
||||
// console.log(isThere);
|
||||
|
||||
let ishashObj = {};
|
||||
|
||||
for (let i = 0; i < isThere.length; i++) {
|
||||
let { tagnames, tagids } = isThere[i];
|
||||
tagnames = tagnames.split('|');
|
||||
tagids = tagids.split('|');
|
||||
|
||||
for (let j = 0; j < tagnames.length; j++) {
|
||||
if (!ishashObj[tagnames[j]]) {
|
||||
ishashObj[tagnames[j]] = tagids[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(ishashObj);
|
||||
|
||||
// for(let i=0;i<itemtagscombinationRes.length;i++){
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function getProductDetails(id) {
|
||||
|
||||
|
||||
|
||||
// let res = await getStatAPIService(`${SERVERNAME}/apis/v4/bizgaze/integrations/products/productattributelist/productid/${id}`);
|
||||
|
||||
let resData = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/productattributelist/productid/${id}`, true);
|
||||
|
||||
if (resData.isError) {
|
||||
loadingActions.removeLoader();
|
||||
alert(resData.errorMsg.message);
|
||||
return;
|
||||
}
|
||||
|
||||
let res = resData.response;
|
||||
|
||||
res = JSON.parse(res.result);
|
||||
console.log(res, 'productattributelist');
|
||||
|
||||
if (!res) {
|
||||
loadingActions.removeLoader();
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
let html = '';
|
||||
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
const currItem = res[i];
|
||||
// parenttagid means under what label
|
||||
// tag id means it know unquie id
|
||||
const { parentattribute, parenttagid, tagid, attribute, productid } = currItem;
|
||||
|
||||
if (labels[parentattribute]) {
|
||||
labels[parentattribute].items.push({
|
||||
attribute,
|
||||
tagid: tagid
|
||||
});
|
||||
} else {
|
||||
labels[parentattribute] = {
|
||||
id: parenttagid,
|
||||
items: [{
|
||||
attribute,
|
||||
tagid: tagid
|
||||
}]
|
||||
};
|
||||
html += getParentHTML(parentattribute, productid, parenttagid, i == 0);
|
||||
}
|
||||
|
||||
}
|
||||
$('#spec-container-details').html(html);
|
||||
|
||||
|
||||
// console.log(labels,'labels');
|
||||
|
||||
let childIds = [];
|
||||
|
||||
for (let item in labels) {
|
||||
let { id, items } = labels[item];
|
||||
// $(`[data-tagid=${id}]`)
|
||||
let html = '';
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const { attribute, tagid } = items[i]
|
||||
childIds.push(tagid);
|
||||
group[attribute] = item;
|
||||
html += getChildHTML(tagid, attribute, i == 0);
|
||||
}
|
||||
$(`[data-tagid="${id}"]`).html(html);
|
||||
}
|
||||
itemtagscombinationRes = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/getitemwithoutbranch/productid/${id}`, true);
|
||||
itemtagscombinationRes = JSON.parse(itemtagscombinationRes.response.result);
|
||||
console.log(itemtagscombinationRes, "conductt");
|
||||
|
||||
let valuesSelected = [];
|
||||
|
||||
$('.borderselector').each(function (i, el) {
|
||||
|
||||
let val = $(el).html();
|
||||
valuesSelected.push(val.trim());
|
||||
});
|
||||
|
||||
let searchParams = window.location.search.split("&");
|
||||
let skuId = window.location.hash.split('#')[1].split('=')[1];
|
||||
// skuId = skuId.split('=')[1]
|
||||
let isGo = true;
|
||||
for (let i = 0; i < itemtagscombinationRes.length; i++) {
|
||||
const currItem = itemtagscombinationRes[i];
|
||||
|
||||
const { tagnames, sku, itemid } = currItem;
|
||||
|
||||
isThereInLabel[tagnames] = itemtagscombinationRes[i];
|
||||
let isTrue = true;
|
||||
if (isGo) {
|
||||
// for(let i=0;i<valuesSelected.length;i++){
|
||||
// if(!tagnames.includes(valuesSelected[i])){
|
||||
// isTrue = false
|
||||
// }
|
||||
// }
|
||||
if (skuId != itemid) {
|
||||
isTrue = false
|
||||
}
|
||||
if (isTrue) {
|
||||
|
||||
console.log(itemtagscombinationRes[i], 'itemtagscombinationRes[i]');
|
||||
|
||||
|
||||
currentComb = itemtagscombinationRes[i];
|
||||
// location.hash = itemtagscombinationRes[i].itemname.trim();
|
||||
|
||||
// $('.productname').html(itemtagscombinationRes[i].itemname);
|
||||
// $('#skudetailitem').val(itemtagscombinationRes[i].sku)
|
||||
// $('.price').html(itemtagscombinationRes[i].pricelist)
|
||||
|
||||
// appendSpecs(itemtagscombinationRes[i].itemid);
|
||||
// $('.des_productdes').html(itemtagscombinationRes[i].itemdescription);
|
||||
|
||||
updateDetailsByObj(itemtagscombinationRes[i]);
|
||||
|
||||
|
||||
|
||||
isGo = false;
|
||||
let { tagnames, tagids, pricelist } = itemtagscombinationRes[i];
|
||||
tagids = tagids.split('|');
|
||||
tagnames = tagnames.split('|');
|
||||
$('.optiontaganwi').removeClass('borderselector');
|
||||
|
||||
for (let i = 0; i < tagids.length; i++) {
|
||||
|
||||
$(`[data-tagiditem="${tagids[i]}"]`).addClass('borderselector');
|
||||
}
|
||||
// tagiditem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isGo && itemtagscombinationRes.length != 0) {
|
||||
|
||||
console.log(itemtagscombinationRes[0]);
|
||||
let { tagnames, tagids, pricelist } = itemtagscombinationRes[0];
|
||||
tagids = tagids.split('|');
|
||||
tagnames = tagnames.split('|');
|
||||
$('.optiontaganwi').removeClass('borderselector');
|
||||
currentComb = itemtagscombinationRes[0];
|
||||
// updateItemId(itemtagscombinationRes[0].itemid);
|
||||
|
||||
for (let i = 0; i < tagids.length; i++) {
|
||||
|
||||
$(`[data-type="${tagids[i]}-${tagnames[i]}"]`).addClass('borderselector');
|
||||
$(`[data-type="${tagids[i]}-Eucalyptus Green"]`).removeClass('borderselector');
|
||||
$(`[data-type="${tagids[i]}-Desert Brown"]`).removeClass('borderselector');
|
||||
$(`[data-type="${tagids[i]}-Deep Sea Blue"]`).removeClass('borderselector');
|
||||
}
|
||||
|
||||
// $('.price').html(pricelist);
|
||||
// $('.des_productdes').html(itemtagscombinationRes[0].itemdescription);
|
||||
// appendSpecs(itemtagscombinationRes[0].itemid);
|
||||
|
||||
updateDetailsByObj(itemtagscombinationRes[0]);
|
||||
//console.log(childIds);
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
//getAllCombination(valuesSelected)
|
||||
|
||||
|
||||
|
||||
// for(let i=0;i<itemtagscombinationRes.length;i++){
|
||||
// const {tagnames} = itemtagscombinationRes[i];
|
||||
|
||||
// }
|
||||
|
||||
$('#spec-container-details').children().find('.specsmallcard').removeClass('specsmallcard');
|
||||
|
||||
addeventlisteners();
|
||||
loadingActions.removeLoader();
|
||||
return;
|
||||
// let resTwo = await postStatAPIService(`${SERVERNAME}/apis/v4/bizgaze/integrations/products/itemtagscombination/productid/${id}`);
|
||||
|
||||
|
||||
//let html = '';
|
||||
let attributesObj = {};
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
const { parentattribute, tagid, productid } = res[i];
|
||||
// let attributes = await postStatAPIService(`${SERVERNAME}/apis/v4/bizgaze/integrations/products/productattributelist/parenttagid/${tagid}`);
|
||||
// attributesObj[tagid] = JSON.parse(attributes.data.result);
|
||||
// console.log(attributes.data.result,tagid);
|
||||
html += getParentHTML(parentattribute, productid, tagid, i == 0);
|
||||
}
|
||||
|
||||
$('#spec-container-details').html(html);
|
||||
|
||||
|
||||
// let attributes = await postStatAPIService(`${SERVERNAME}/apis/v4/bizgaze/integrations/products/productattributelist/parenttagid/${tagid}`);
|
||||
return;
|
||||
for (let attr in attributesObj) {
|
||||
const arr = attributesObj[attr];
|
||||
|
||||
let html = '';
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const { attribute, tagid } = arr[i];
|
||||
html += getChildHTML(tagid, attribute, i == 0);
|
||||
}
|
||||
|
||||
|
||||
$(`[data-tagid="${attr}"]`).html(html);
|
||||
|
||||
|
||||
}
|
||||
|
||||
let defaultValues = await postStatAPIService(`${SERVERNAME}/apis/v4/bizgaze/integrations/products/sellableitemlist/productid/${id}`);
|
||||
defaultValues = JSON.parse(defaultValues.data.result);
|
||||
let { itemname, price } = defaultValues[0];
|
||||
$('.productname').html(itemname);
|
||||
$('.price').html(price)
|
||||
|
||||
$('#spec-container-details').children().slice(1).find('.specsmallcard').removeClass('specsmallcard');
|
||||
|
||||
|
||||
|
||||
|
||||
// getQuantityById(id)
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
startDetails();
|
||||
|
||||
Vendored
+188
@@ -0,0 +1,188 @@
|
||||
function initAcc(){
|
||||
INIT();
|
||||
async function INIT(){
|
||||
const productsIds = await getProductIds(['SSD ORA',"RAM ORA"]);
|
||||
appendWithIds(productsIds);
|
||||
}
|
||||
|
||||
async function appendWithIds(productsIds){
|
||||
let html = '';
|
||||
for(let i=0;i<productsIds.length;i++){
|
||||
let productId = productsIds[i];
|
||||
let res = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/itemtagscombination/productid/${productId}`,true);
|
||||
|
||||
if(res.isError){
|
||||
alert("something went wrong");
|
||||
return;
|
||||
}
|
||||
|
||||
res = JSON.parse(res.response.result);
|
||||
console.log(res);
|
||||
|
||||
|
||||
for(let j=0;j<res.length;j++){
|
||||
html += getRamCardHTML(res[j]);
|
||||
}
|
||||
}
|
||||
|
||||
$('.product_card_section').html(html)
|
||||
}
|
||||
|
||||
async function getProductIds(productsIdReqArr){
|
||||
let resData = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/getallproducts`,true);
|
||||
|
||||
if(resData.isError){
|
||||
alert("Something went wrong");
|
||||
return;
|
||||
}
|
||||
|
||||
resData = JSON.parse(resData.response.result);
|
||||
|
||||
let productsIds = [];
|
||||
|
||||
for(let i=0;i<resData.length;i++){
|
||||
let curr = resData[i];
|
||||
let productname = curr.productname;
|
||||
if(productsIdReqArr.includes(productname)){
|
||||
productsIds.push(curr.productid)
|
||||
}
|
||||
}
|
||||
console.log(productsIds);
|
||||
|
||||
console.log(resData);
|
||||
return productsIds;
|
||||
|
||||
}
|
||||
|
||||
function getRamCardHTML({itemname,pricelist,itemid,sku,itemimageurl,productid}){
|
||||
let img = itemimageurl ? imgServerNameBuild(itemimageurl) : './dist/assets/imgs/nophoto.png'
|
||||
let tags = itemname.split('-');
|
||||
let ramTech = tags[tags.length-2];
|
||||
let gb = tags[tags.length-1];
|
||||
const [currencySymbol,amount] = getCurrencySymbol(pricelist);
|
||||
let priceAmt = `${currencySymbol} ${amount}`;
|
||||
|
||||
let detailPageName;
|
||||
let addSearch = '?';
|
||||
if (window.location.href.includes('laptops')) {
|
||||
detailPageName = 'laptopdetails';
|
||||
let name = itemname.toLowerCase().includes('zeno') ? 'Zeno' : 'Fyro';
|
||||
addSearch = `?${name}`;
|
||||
} else {
|
||||
detailPageName = 'productdetails';
|
||||
};
|
||||
|
||||
debugger;
|
||||
return `<div class="col-lg-4 col-md-6 mb-4 col-md-6 ram_card cursor-pointer">
|
||||
<div class="card border bg-gray-3 rounded-3 p-1 h-100">
|
||||
|
||||
<a href="/${detailPageName}.html${addSearch}productId=${productid}#itemid=${itemid}" class=""><img src="${img}" alt="${itemname}" class="w-100 h-100 p-5"></a>
|
||||
<div class="card-body">
|
||||
<a href="/${detailPageName}.html${addSearch}productId=${productid}#itemid=${itemid}" class="">
|
||||
<h5 class="card-title satoshi_font mb-0 px-2 text-center font-weight-600">${itemname}</h5>
|
||||
</a>
|
||||
</div>
|
||||
<hr>
|
||||
<ul class="border-0 d-flex h-100 justify-content-between px-md-3 px-4 list-group-flush p-0 text-secondary" style="list-style: none;">
|
||||
<li class="border-0 py-0">
|
||||
<span class="satoshi_font"> <h6>${gb}</h6> <h6>${ramTech}</h6></span>
|
||||
</li>
|
||||
<li class="border-0 py-0">
|
||||
<span class="satoshi_font"><h6>${pricelist?priceAmt:'Comming Soon'}</h6></span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="card-body text-center">
|
||||
<a href="/${detailPageName}.html?productId=${productid}#itemid=${itemid}" class="btn bg-white font-1-2 px-5 w-100">Details
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>`
|
||||
|
||||
return `<div class="col-lg-4 col-md-6 mb-4 col-md-6 ram_card cursor-pointer">
|
||||
<div class="card border bg-gray-3 rounded-3 p-1 h-100">
|
||||
|
||||
<a href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}" class=""><img src="${img}" alt="${itemname}" class="w-100 h-100"></a>
|
||||
<div class="card-body">
|
||||
<a href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}" class="">
|
||||
<h5 class="card-title satoshi_font mb-0 px-2 text-center font-weight-600">${itemname}</h5>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="border-0 d-flex h-100 justify-content-between px-md-3 px-4 list-group-flush p-0 text-secondary" style="list-style: none;">
|
||||
<li class="border-0 py-0">
|
||||
<span class="satoshi_font"> <h6>${gb}</h6> <h6>${ramTech}</h6></span>
|
||||
</li>
|
||||
<li class="border-0 py-0">
|
||||
<span class="satoshi_font"><h6>${priceAmt}</h6></span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="card-body text-center">
|
||||
<a href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}" class="btn bg-white font-1-2 px-5 w-100">Details
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
//abhi anna design
|
||||
return `
|
||||
|
||||
<!--desktop--->
|
||||
<div class="col-sm-4 p-3">
|
||||
<div class="product_card_3 shadow ram_card">
|
||||
<div class="card-item-header">
|
||||
<div class="card-header-sub-3"><a class=" py-md-1" href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}">
|
||||
<img src="${img}" class="w-100 h-100"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-item-body">
|
||||
<h3 cclass="mb-2"> <a href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}" class="" > ${itemname} </a></h3>
|
||||
<hr>
|
||||
<h6>${gb}</h6> <h6>${ramTech}</h6><h6>${priceAmt}</h6>
|
||||
<div class="py-2 card_product_footer">
|
||||
<button data-sku="${sku}" data-itemid="${itemid}" class="w-100 border-0 ramcard bg-transparent satoshi_font ram_btn" data_name="ORA 8GB DDR4 3200MHz Desktop RAM " data_version="DDR4" data_device="Desktop" data_gb="8GB" data_price="2900">Details </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
return `<div class="col-lg-3 col-md-6 ram_card">
|
||||
<div class="card shadow border-0 p-1 h-100">
|
||||
<a href="#">
|
||||
<img src="../dist/assets/imgs/Navbar/ora_ddr5_laptop.png" class="card-img-top" alt="...">
|
||||
</a>
|
||||
<div class="card-body">
|
||||
<a href="#" class="text-decoration-none text-dark">
|
||||
<h5 class="card-title satoshi_font mb-0">
|
||||
${itemname}
|
||||
</h5>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item border-0 py-0">
|
||||
<span class="satoshi_font">${gb} ${ramTech}</span>
|
||||
</li>
|
||||
<li class="list-group-item border-0 py-0">
|
||||
<span class="satoshi_font">3200 Mhz</span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="card-body d-none">
|
||||
<button class="btn--md btn-primary w-100 card-link">
|
||||
<span class="cost currency-symbol">₹</span><span class="cost product-price satoshi_font">${pricelist}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-body text-center">
|
||||
<div data-sku="${sku}" data-itemid="${itemid}" class="bg-black ramcard btn font-1-2 px-5 text-white w-100 satoshi_font" data_des="Upgrade your laptop with DDR4 Laptop
|
||||
Memory, oering 3200 MHz speed in 8, 16,
|
||||
and 32 GB capacities. Experience enhanced
|
||||
thermal performance, increased longevity,
|
||||
and superior performance with our
|
||||
innovative graphene sticker technology." data_name="ORA 8GB DDR4 3200MHz Laptop RAM ">Details
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`
|
||||
}
|
||||
}
|
||||
|
||||
initAcc();
|
||||
Vendored
+316
@@ -0,0 +1,316 @@
|
||||
function ramProductsInit(){
|
||||
let RAM_ID = '';
|
||||
|
||||
async function init(){
|
||||
let id
|
||||
if(location.search==''&&(location.href.includes('laptops')||location.href.includes('allinones'))){
|
||||
id = await getallproductsFun();
|
||||
}else{
|
||||
id = await getProductIdService();
|
||||
}
|
||||
getRamData(id)
|
||||
}
|
||||
|
||||
async function getProductsIds(nameArr){
|
||||
let resData = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/getallproducts`,true);
|
||||
if(resData.isError){
|
||||
toasterHelper("error","Something went wrong!")
|
||||
return;
|
||||
}
|
||||
|
||||
let res = resData.response;
|
||||
|
||||
res = JSON.parse(res.result);
|
||||
let ids = [];
|
||||
|
||||
for(let i=0;i<nameArr.length;i++){
|
||||
const currName = nameArr[i];
|
||||
let id = res.find((item)=>{
|
||||
if(currName === item.productname){
|
||||
return item.productid;
|
||||
}
|
||||
})
|
||||
if(id){
|
||||
ids.push(id);
|
||||
}
|
||||
}
|
||||
|
||||
return ids;
|
||||
|
||||
}
|
||||
|
||||
async function getallproductsFun(){
|
||||
let laptopStr = ['FYRO Flagship','Zeno Dualbook','Zeno Sleekbook'];
|
||||
let allInOnesStr = ['AIO Zeno','AIO Fyro'];
|
||||
|
||||
|
||||
|
||||
let name = window.location.href;
|
||||
|
||||
name = name.includes('laptops') ?laptopStr : allInOnesStr;
|
||||
|
||||
const ids = await getProductsIds(name);
|
||||
|
||||
console.log(ids);
|
||||
|
||||
return ids;
|
||||
|
||||
}
|
||||
|
||||
function getProductIdService(){
|
||||
return new Promise(async (reslove,reject)=>{
|
||||
|
||||
let resData =await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/getallproducts`,true);
|
||||
if(resData.isError){
|
||||
alert(resData.errorMsg.message);
|
||||
return;
|
||||
}
|
||||
|
||||
let res = resData.response;
|
||||
|
||||
res = JSON.parse(res.result);
|
||||
|
||||
console.log(res);
|
||||
|
||||
let searchName = window.location.search.split('?')[1];
|
||||
let urlPathName = window.location.pathname;
|
||||
let searchTerm = '';
|
||||
if(urlPathName.includes('ram')){
|
||||
searchTerm = "RAM ORA";
|
||||
}else if(urlPathName.includes('storage')){
|
||||
searchTerm = `SSD ORA`;
|
||||
}else{
|
||||
searchTerm = searchName.replaceAll('%20',' ');
|
||||
}
|
||||
let resultItem = [];
|
||||
|
||||
if(searchTerm.toLowerCase() === 'zeno'){
|
||||
for(let i=0;i<res.length;i++){
|
||||
if(res[i].productname.includes("Zeno Sleekbook")||res[i].productname.includes("Zeno Dualbook")){
|
||||
resultItem.push( res[i])
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return reslove(resultItem)
|
||||
}else if(searchTerm.toLowerCase() === 'fyro'){
|
||||
for(let i=0;i<res.length;i++){
|
||||
if(res[i].productname.includes("FYRO Flagship")){
|
||||
resultItem.push( res[i]);
|
||||
return reslove(resultItem)
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for(let i=0;i<res.length;i++){
|
||||
if(res[i].productname.includes(searchTerm)){
|
||||
resultItem.push( res[i])
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return reslove(resultItem)
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
async function getRamData(ids){
|
||||
let resData;
|
||||
let res
|
||||
let data = [];
|
||||
let windowSearch = window.location.href;
|
||||
for(let i=0;i<ids.length;i++){
|
||||
let id = ids[i].productid;
|
||||
if (windowSearch.includes('laptops')||windowSearch.includes('allinones')) {
|
||||
resData = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/Bizgaze/integrations/products/getitemwithoutbranch/productid/${id}`, true);
|
||||
}
|
||||
else {
|
||||
resData = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/itemtagscombination/productid/${id}`, true);
|
||||
}
|
||||
if(resData.isError){
|
||||
alert(resData.errorMsg.message);
|
||||
return;
|
||||
}
|
||||
|
||||
res = resData.response;
|
||||
|
||||
res = JSON.parse(res.result);
|
||||
data = [...data,...res];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
console.log(data);
|
||||
let html = '';
|
||||
|
||||
for(let i=0;i<data.length;i++){
|
||||
if(data[i].itemname.includes('AIO Fyro - 32')) continue;
|
||||
html += getRamCardHTML(data[i]);
|
||||
}
|
||||
|
||||
$('.product_card_section').html(html);
|
||||
|
||||
if(window.location.href.includes("?AIO%20Fyro")){
|
||||
$(".processor_name").text("i7 / i9");
|
||||
$('.product_card_section div.ram_card').addClass("d-none");
|
||||
$('.product_card_section div.ram_card:nth-child(1)').removeClass("d-none");
|
||||
}
|
||||
if(window.location.href.includes("?AIO%20Zeno")){
|
||||
$('.product_card_section div.ram_card').addClass("d-none");
|
||||
$('.product_card_section div.ram_card:nth-child(14)').removeClass("d-none");
|
||||
$('.product_card_section div.ram_card:nth-child(15)').removeClass("d-none");
|
||||
}
|
||||
// $('.ramcard').click(function(e){
|
||||
|
||||
// let sku = $(e.target).data('itemid');
|
||||
// let itemid = $(e.target).data('itemid');
|
||||
|
||||
// window.location.href = `/productdetails.html?productId=${RAM_ID}#itemid=${itemid}`
|
||||
|
||||
// })
|
||||
}
|
||||
|
||||
function getRamCardHTML({itemname,pricelist,itemid,sku,itemimageurl,productid}){
|
||||
let img = itemimageurl ? imgServerNameBuild(itemimageurl) : './dist/assets/imgs/nophoto.png'
|
||||
let tags = itemname.split('-');
|
||||
let ramTech = tags[tags.length-2];
|
||||
let gb = tags[tags.length-1];
|
||||
const [currencySymbol,amount] = getCurrencySymbol(pricelist);
|
||||
let priceAmt = `${currencySymbol} ${amount}`;
|
||||
|
||||
let detailPageName;
|
||||
debugger;
|
||||
let addSearch = '';
|
||||
if (window.location.href.includes('laptops')||window.location.href.includes('allinones')) {
|
||||
detailPageName = 'laptopdetails';
|
||||
let name = itemname.toLowerCase().includes('zeno') ? 'Zeno' : 'Fyro';
|
||||
addSearch = `?${name}`;
|
||||
} else {
|
||||
// detailPageName = 'productdetails';
|
||||
detailPageName = 'laptopdetails';
|
||||
};
|
||||
return `<div class="col-lg-4 col-md-6 mb-4 col-md-6 ram_card cursor-pointer">
|
||||
<div class="card border bg-gray-3 rounded-3 p-1 h-100">
|
||||
|
||||
<a href="/${detailPageName}.html${addSearch}#productId=${productid}#itemid=${itemid}" class=""><img loading="lazy" src="${img}" alt="${itemname}" class="w-100 h-100 p-5"></a>
|
||||
<div class="card-body">
|
||||
<a href="/${detailPageName}.html${addSearch}#productId=${productid}#itemid=${itemid}" class="">
|
||||
<h5 class="card-title satoshi_font mb-0 px-2 text-center font-weight-600">${itemname}</h5>
|
||||
</a>
|
||||
</div>
|
||||
<hr>
|
||||
<ul class="border-0 d-flex h-100 justify-content-between px-md-3 px-4 list-group-flush p-0 text-secondary" style="list-style: none;">
|
||||
<li class="mb-0 processor_name">i3 / 15 / i7</li>
|
||||
</ul>
|
||||
<ul class="border-0 d-flex h-100 justify-content-between px-md-3 px-4 list-group-flush p-0 text-secondary" style="list-style: none;">
|
||||
<li class="border-0 py-0">
|
||||
<span class="satoshi_font">
|
||||
<h6>${gb}</h6>
|
||||
<h6 class="d-none">${ramTech}</h6>
|
||||
</span>
|
||||
</li>
|
||||
<li class="border-0 py-0">
|
||||
<span class="satoshi_font"><h6>${pricelist?priceAmt:'Comming Soon'}</h6></span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="card-body text-center">
|
||||
<a href="/${detailPageName}.html${addSearch}#productId=${productid}#itemid=${itemid}" class="btn bg-white font-1-2 px-5 w-100">Details
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>`
|
||||
|
||||
return `<div class="col-lg-4 col-md-6 mb-4 col-md-6 ram_card cursor-pointer">
|
||||
<div class="card border bg-gray-3 rounded-3 p-1 h-100">
|
||||
|
||||
<a href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}" class=""><img src="${img}" alt="${itemname}" class="w-100 h-100"></a>
|
||||
<div class="card-body">
|
||||
<a href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}" class="">
|
||||
<h5 class="card-title satoshi_font mb-0 px-2 text-center font-weight-600">${itemname}</h5>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="border-0 d-flex h-100 justify-content-between px-md-3 px-4 list-group-flush p-0 text-secondary" style="list-style: none;">
|
||||
<li class="border-0 py-0">
|
||||
<span class="satoshi_font"> <h6>${gb}</h6> <h6>${ramTech}</h6></span>
|
||||
</li>
|
||||
<li class="border-0 py-0">
|
||||
<span class="satoshi_font"><h6>${priceAmt}</h6></span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="card-body text-center">
|
||||
<a href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}" class="btn bg-white font-1-2 px-5 w-100">Details
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
//abhi anna design
|
||||
return `
|
||||
|
||||
<!--desktop--->
|
||||
<div class="col-sm-4 p-3">
|
||||
<div class="product_card_3 shadow ram_card">
|
||||
<div class="card-item-header">
|
||||
<div class="card-header-sub-3"><a class=" py-md-1" href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}">
|
||||
<img src="${img}" class="w-100 h-100"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-item-body">
|
||||
<h3 cclass="mb-2"> <a href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}" class="" > ${itemname} </a></h3>
|
||||
<hr>
|
||||
<h6>${gb}</h6> <h6>${ramTech}</h6><h6>${priceAmt}</h6>
|
||||
<div class="py-2 card_product_footer">
|
||||
<button data-sku="${sku}" data-itemid="${itemid}" class="w-100 border-0 ramcard bg-transparent satoshi_font ram_btn" data_name="ORA 8GB DDR4 3200MHz Desktop RAM " data_version="DDR4" data_device="Desktop" data_gb="8GB" data_price="2900">Details </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
return `<div class="col-lg-3 col-md-6 ram_card">
|
||||
<div class="card shadow border-0 p-1 h-100">
|
||||
<a href="#">
|
||||
<img src="../dist/assets/imgs/Navbar/ora_ddr5_laptop.png" class="card-img-top" alt="...">
|
||||
</a>
|
||||
<div class="card-body">
|
||||
<a href="#" class="text-decoration-none text-dark">
|
||||
<h5 class="card-title satoshi_font mb-0">
|
||||
${itemname}
|
||||
</h5>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item border-0 py-0">
|
||||
<span class="satoshi_font">${gb} ${ramTech}</span>
|
||||
</li>
|
||||
<li class="list-group-item border-0 py-0">
|
||||
<span class="satoshi_font">3200 Mhz</span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="card-body d-none">
|
||||
<button class="btn--md btn-primary w-100 card-link">
|
||||
<span class="cost currency-symbol">₹</span><span class="cost product-price satoshi_font">${pricelist}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-body text-center">
|
||||
<div data-sku="${sku}" data-itemid="${itemid}" class="bg-black ramcard btn font-1-2 px-5 text-white w-100 satoshi_font" data_des="Upgrade your laptop with DDR4 Laptop
|
||||
Memory, oering 3200 MHz speed in 8, 16,
|
||||
and 32 GB capacities. Experience enhanced
|
||||
thermal performance, increased longevity,
|
||||
and superior performance with our
|
||||
innovative graphene sticker technology." data_name="ORA 8GB DDR4 3200MHz Laptop RAM ">Details
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
ramProductsInit();
|
||||
Vendored
+419
@@ -0,0 +1,419 @@
|
||||
function ramProductsInit(){
|
||||
let RAM_ID = '';
|
||||
|
||||
async function init(){
|
||||
let id
|
||||
if(location.search==''&&(location.href.includes('laptops')||location.href.includes('allinones'))){
|
||||
id = await getallproductsFun();
|
||||
}else{
|
||||
id = await getProductIdService();
|
||||
}
|
||||
getRamData(id)
|
||||
}
|
||||
|
||||
async function getProductsIds(nameArr){
|
||||
let resData = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/getallproducts`,true);
|
||||
if(resData.isError){
|
||||
toasterHelper("error","Something went wrong!")
|
||||
return;
|
||||
}
|
||||
|
||||
let res = resData.response;
|
||||
|
||||
res = JSON.parse(res.result);
|
||||
let ids = [];
|
||||
|
||||
for(let i=0;i<nameArr.length;i++){
|
||||
const currName = nameArr[i];
|
||||
let id = res.find((item)=>{
|
||||
if(currName === item.productname){
|
||||
return item.productid;
|
||||
}
|
||||
})
|
||||
if(id){
|
||||
ids.push(id);
|
||||
}
|
||||
}
|
||||
|
||||
return ids;
|
||||
|
||||
}
|
||||
|
||||
async function getallproductsFun(){
|
||||
let laptopStr = ['FYRO Flagship','Zeno Dualbook','Zeno Sleekbook'];
|
||||
let allInOnesStr = ['AIO Zeno','AIO Fyro'];
|
||||
|
||||
|
||||
|
||||
let name = window.location.href;
|
||||
|
||||
name = name.includes('laptops') ?laptopStr : allInOnesStr;
|
||||
|
||||
const ids = await getProductsIds(name);
|
||||
|
||||
console.log(ids);
|
||||
|
||||
return ids;
|
||||
|
||||
}
|
||||
|
||||
function getProductIdService(){
|
||||
return new Promise(async (reslove,reject)=>{
|
||||
|
||||
let resData =await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/getallproducts`,true);
|
||||
if(resData.isError){
|
||||
alert(resData.errorMsg.message);
|
||||
return;
|
||||
}
|
||||
|
||||
let res = resData.response;
|
||||
|
||||
res = JSON.parse(res.result);
|
||||
|
||||
// console.log(res);
|
||||
|
||||
let searchName = window.location.search.split('?')[1];
|
||||
let urlPathName = window.location.pathname;
|
||||
let searchTerm = '';
|
||||
if(urlPathName.includes('ram')){
|
||||
searchTerm = "RAM ORA";
|
||||
}else if(urlPathName.includes('storage')){
|
||||
searchTerm = `SSD ORA`;
|
||||
}else{
|
||||
searchTerm = searchName.replaceAll('%20',' ');
|
||||
}
|
||||
let resultItem = [];
|
||||
|
||||
if(searchTerm.toLowerCase() === 'zeno'){
|
||||
for(let i=0;i<res.length;i++){
|
||||
if(res[i].productname.includes("Zeno Sleekbook")||res[i].productname.includes("Zeno Dualbook")){
|
||||
resultItem.push( res[i])
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return reslove(resultItem)
|
||||
}else if(searchTerm.toLowerCase() === 'fyro'){
|
||||
for(let i=0;i<res.length;i++){
|
||||
if(res[i].productname.includes("FYRO Flagship")){
|
||||
resultItem.push(res[i]);
|
||||
return reslove(resultItem)
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for(let i=0;i<res.length;i++){
|
||||
if(res[i].productname.includes(searchTerm)){
|
||||
resultItem.push(res[i])
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return reslove(resultItem)
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
async function getRamData(ids){
|
||||
let resData;
|
||||
let res
|
||||
let data = [];
|
||||
let windowSearch = window.location.href;
|
||||
for(let i=0;i<ids.length;i++){
|
||||
let id = ids[i].productid;
|
||||
if (windowSearch.includes('laptops')||windowSearch.includes('allinones')) {
|
||||
resData = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/Bizgaze/integrations/products/getitemwithoutbranch/productid/${id}`, true);
|
||||
}
|
||||
else {
|
||||
resData = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/itemtagscombination/productid/${id}`, true);
|
||||
}
|
||||
if(resData.isError){
|
||||
alert(resData.errorMsg.message);
|
||||
return;
|
||||
}
|
||||
|
||||
res = resData.response;
|
||||
|
||||
res = JSON.parse(res.result);
|
||||
data = [...data,...res];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
console.log(data);
|
||||
let html = '';
|
||||
|
||||
for(let i=0;i<data.length;i++){
|
||||
console.log(data[i].tagids);
|
||||
let tags_id = data[i].tagids;
|
||||
let tags_filter = tags_id.includes("106631360000087");
|
||||
let tags_filter_2 = tags_id.includes("106631360000088");
|
||||
let tags_filter_3 = tags_id.includes("106631360000089");
|
||||
|
||||
if(tags_filter == false && tags_filter_2 == false && tags_filter_3 == false){
|
||||
if(data[i].itemname.includes('AIO Fyro - 32')) continue;
|
||||
html += getRamCardHTML(data[i]);
|
||||
}
|
||||
else{
|
||||
let data_name = tags_id.includes("106631360000087");
|
||||
let name_id = data[i].tagids.includes("106631360000087");
|
||||
if(data_name === true && name_id === true){
|
||||
for(let j=0;j<data.length;j++){
|
||||
if(j==0){
|
||||
if(data[j].itemname.includes('AIO Fyro - 32')) continue;
|
||||
html += getRamCardHTML(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
$('.product_card_section').html(html);
|
||||
if(window.location.href.includes("?Zeno")){
|
||||
$('.product_card_section div.ram_card:nth-child(1)').addClass("d-none");
|
||||
$('.product_card_section div.ram_card:nth-child(6)').addClass("d-none");
|
||||
}
|
||||
if(window.location.href.includes("?FYRO")){
|
||||
$('.product_card_section div.ram_card:nth-child(3)').addClass("d-none");
|
||||
$('.product_card_section div.ram_card:nth-child(7)').addClass("d-none");
|
||||
$('.product_card_section div.ram_card:nth-child(8)').addClass("d-none");
|
||||
}
|
||||
// $('.ramcard').click(function(e){
|
||||
|
||||
// let sku = $(e.target).data('itemid');
|
||||
// let itemid = $(e.target).data('itemid');
|
||||
|
||||
// window.location.href = `/productdetails.html?productId=${RAM_ID}#itemid=${itemid}`
|
||||
|
||||
// })
|
||||
}
|
||||
|
||||
function getRamCardHTML({itemname,pricelist,itemid,sku,itemimageurl,productid,tagnames}){
|
||||
let img = itemimageurl ? imgServerNameBuild(itemimageurl) : './dist/assets/imgs/nophoto.png'
|
||||
let tags = itemname.split('-');
|
||||
let ramTech = tags[tags.length-2];
|
||||
let tag_name = tagnames.split('|');
|
||||
|
||||
let gb = tags[tags.length-1];
|
||||
const [currencySymbol,amount] = getCurrencySymbol(pricelist);
|
||||
let priceAmt = `${currencySymbol} ${amount}`;
|
||||
|
||||
let detailPageName;
|
||||
let addSearch = '';
|
||||
if (window.location.href.includes('laptops')) {
|
||||
detailPageName = 'laptopdetails';
|
||||
let name = itemname.toLowerCase().includes('zeno') ? 'Zeno' : 'Fyro';
|
||||
addSearch = `?${name}`;
|
||||
} else {
|
||||
detailPageName = 'productdetails';
|
||||
|
||||
};
|
||||
|
||||
let color_name = tag_name[tag_name.length-1].trim();
|
||||
let processor_name1 = tagnames.includes("i7");
|
||||
let processor_name2 = tagnames.includes("i5");
|
||||
let processor_name3 = tagnames.includes("i3");
|
||||
let dul_core = itemname.includes("Zeno Dualbook");
|
||||
|
||||
|
||||
let processor;
|
||||
if( processor_name1 === true){
|
||||
if(dul_core === true){
|
||||
processor = `i7`
|
||||
}else{
|
||||
processor = `i5 / i7`
|
||||
}
|
||||
|
||||
}else if( processor_name2 === true){
|
||||
if(dul_core === true){
|
||||
processor = `i7`
|
||||
}else{
|
||||
processor = `i5 / i7`
|
||||
}
|
||||
}else if( processor_name3 === true){
|
||||
processor = `i3`
|
||||
}
|
||||
else if(itemname.includes("I7") || itemname.includes("i7")){
|
||||
let fyro_data_2 = itemname.includes("RTX 4060");
|
||||
if(fyro_data_2 === true){
|
||||
processor = `i5 / i7 / i9`
|
||||
}else{
|
||||
processor = `i5 / i7`
|
||||
}
|
||||
|
||||
}else if(itemname.includes("I9") || itemname.includes("i9")){
|
||||
let fyro_data_1 = itemname.includes("RTX 4050");
|
||||
let fyro_data_2 = itemname.includes("RTX 4060");
|
||||
if(fyro_data_1 === true || fyro_data_2 === true){
|
||||
processor = `i5 / i7 / i9`
|
||||
}else{
|
||||
processor = `i9`
|
||||
}
|
||||
|
||||
}else if(itemname.includes("I5") || itemname.includes("i5")){
|
||||
let fyro_data = itemname.includes("RTX 4060");
|
||||
if(fyro_data === true){
|
||||
processor = `i5 / i7 / i9`
|
||||
}
|
||||
else{
|
||||
processor = `i5 / i7 / i9`
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
let item_color_1;
|
||||
let item_color_2;
|
||||
let item_color_3;
|
||||
let item_color_4;
|
||||
if(color_name == "Eucalyptus Green" || color_name == "Desert Brown"){
|
||||
item_color_1 = `#5e7975`;
|
||||
item_color_2 = `#624839`;
|
||||
item_color_3 = `#253746`;
|
||||
}else if( color_name == "Deep Sea Blue"){
|
||||
item_color_1 = `#5e7975`;
|
||||
item_color_2 = `#624839`;
|
||||
item_color_3 = `#253746`;
|
||||
}
|
||||
else{
|
||||
if(color_name.length <=14){
|
||||
item_color_4 = ``;
|
||||
}else{
|
||||
item_color_4 = `#0d0a08`;
|
||||
}
|
||||
}
|
||||
debugger;
|
||||
return `<div class="col-lg-4 col-md-6 mb-4 col-md-6 ram_card cursor-pointer">
|
||||
<div class="card border bg-gray-3 rounded-3 p-1 h-100">
|
||||
|
||||
<a href="/${detailPageName}.html${addSearch}#productId=${productid}#itemid=${itemid}" class="">
|
||||
<img src="${img}" alt="${itemname}" class="p-5" style="width:350px;height:300px"></a>
|
||||
<div class="card-body">
|
||||
<a href="/${detailPageName}.html${addSearch}#productId=${productid}#itemid=${itemid}" class="">
|
||||
<h5 class="card-title satoshi_font mb-0 px-2 text-center font-weight-600">${itemname}</h5>
|
||||
</a>
|
||||
</div>
|
||||
<hr>
|
||||
<ul class="border-0 mb-0 d-flex h-100 justify-content-between px-md-3 px-4 list-group-flush p-0 text-secondary" style="list-style: none;">
|
||||
<li class="processor_name"><img src="../dist/assets/imgs/processor.svg" class="w-20p pe-1"/><span class="pt-1">${processor?processor:""}</span></li>
|
||||
<li class="d-flex justify-content-between">
|
||||
<p item_color=${item_color_1} class="colors mb-0 me-1" ${item_color_1?`style="width:18px;height:18px;border-radius:0%;background-color:${item_color_1}"`:''}></p>
|
||||
<p item_color=${item_color_2} class="mb-0 me-1" ${item_color_2?`style="width:18px;height:18px;border-radius:0%;background-color:${item_color_2}"`:''}></p>
|
||||
<p item_color=${item_color_3} class="mb-0" ${item_color_3?`style="width:18px;height:18px;border-radius:0%;background-color:${item_color_3}"`:''}></p>
|
||||
<p item_color=${item_color_4} class="mb-0" ${item_color_4?`style="width:18px;height:18px;border-radius:0%;background-color:${item_color_4}"`:''}></p>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="border-0 d-flex h-100 justify-content-between px-md-3 px-4 list-group-flush p-0 text-secondary" style="list-style: none;">
|
||||
|
||||
<li class="border-0 py-0">
|
||||
<span class="satoshi_font">
|
||||
<h6><img src="../dist/assets/imgs/laptop-icon.png" class="w-20p pe-1"/>${gb}</h6>
|
||||
</span>
|
||||
</li>
|
||||
<li class="border-0 py-0">
|
||||
<span class="satoshi_font"><h6>${pricelist?priceAmt:'Comming Soon'}</h6></span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="card-body text-center">
|
||||
<a href="/${detailPageName}.html${addSearch}#productId=${productid}#itemid=${itemid}" class="btn bg-white font-1-2 px-5 w-100">Details
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
|
||||
|
||||
return `<div class="col-lg-4 col-md-6 mb-4 col-md-6 ram_card cursor-pointer">
|
||||
<div class="card border bg-gray-3 rounded-3 p-1 h-100">
|
||||
|
||||
<a href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}" class=""><img src="${img}" alt="${itemname}" class="w-100 h-100"></a>
|
||||
<div class="card-body">
|
||||
<a href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}" class="">
|
||||
<h5 class="card-title satoshi_font mb-0 px-2 text-center font-weight-600">${itemname}</h5>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="border-0 d-flex h-100 justify-content-between px-md-3 px-4 list-group-flush p-0 text-secondary" style="list-style: none;">
|
||||
<li class="border-0 py-0">
|
||||
<span class="satoshi_font"> <h6>${gb}</h6> <h6>${ramTech}</h6></span>
|
||||
</li>
|
||||
<li class="border-0 py-0">
|
||||
<span class="satoshi_font"><h6>${priceAmt}</h6></span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="card-body text-center">
|
||||
<a href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}" class="btn bg-white font-1-2 px-5 w-100">Details
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
//abhi anna design
|
||||
return `
|
||||
|
||||
<!--desktop--->
|
||||
<div class="col-sm-4 p-3">
|
||||
<div class="product_card_3 shadow ram_card">
|
||||
<div class="card-item-header">
|
||||
<div class="card-header-sub-3"><a class=" py-md-1" href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}">
|
||||
<img src="${img}" class="w-100 h-100"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-item-body">
|
||||
<h3 cclass="mb-2"> <a href="/productdetails.html?productId=${RAM_ID}#itemid=${itemid}" class="" > ${itemname} </a></h3>
|
||||
<hr>
|
||||
<h6>${gb}</h6> <h6>${ramTech}</h6><h6>${priceAmt}</h6>
|
||||
<div class="py-2 card_product_footer">
|
||||
<button data-sku="${sku}" data-itemid="${itemid}" class="w-100 border-0 ramcard bg-transparent satoshi_font ram_btn" data_name="ORA 8GB DDR4 3200MHz Desktop RAM " data_version="DDR4" data_device="Desktop" data_gb="8GB" data_price="2900">Details </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
return `<div class="col-lg-3 col-md-6 ram_card">
|
||||
<div class="card shadow border-0 p-1 h-100">
|
||||
<a href="#">
|
||||
<img src="../dist/assets/imgs/Navbar/ora_ddr5_laptop.png" class="card-img-top" alt="...">
|
||||
</a>
|
||||
<div class="card-body">
|
||||
<a href="#" class="text-decoration-none text-dark">
|
||||
<h5 class="card-title satoshi_font mb-0">
|
||||
${itemname}
|
||||
</h5>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item border-0 py-0">
|
||||
<span class="satoshi_font">${gb} ${ramTech}</span>
|
||||
</li>
|
||||
<li class="list-group-item border-0 py-0">
|
||||
<span class="satoshi_font">3200 Mhz</span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="card-body d-none">
|
||||
<button class="btn--md btn-primary w-100 card-link">
|
||||
<span class="cost currency-symbol">₹</span><span class="cost product-price satoshi_font">${pricelist}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-body text-center">
|
||||
<div data-sku="${sku}" data-itemid="${itemid}" class="bg-black ramcard btn font-1-2 px-5 text-white w-100 satoshi_font" data_des="Upgrade your laptop with DDR4 Laptop
|
||||
Memory, oering 3200 MHz speed in 8, 16,
|
||||
and 32 GB capacities. Experience enhanced
|
||||
thermal performance, increased longevity,
|
||||
and superior performance with our
|
||||
innovative graphene sticker technology." data_name="ORA 8GB DDR4 3200MHz Laptop RAM ">Details
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
ramProductsInit();
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
function supportTicketNoInit(){
|
||||
let ticketId = null;
|
||||
|
||||
INIT();
|
||||
|
||||
function INIT(){
|
||||
ticketId = window.location.search.split("=")[1];
|
||||
getTicketData(ticketId);
|
||||
}
|
||||
|
||||
async function getTicketData(id){
|
||||
let res = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/anwisystems/integrations/products/getticketdetails/ticketno/${id}`);
|
||||
|
||||
if(res.isError){
|
||||
toasterHelper("error",res.errorMsg,`toast-top-right`);
|
||||
return;
|
||||
}
|
||||
|
||||
res = JSON.parse(res.response.result)[0];
|
||||
|
||||
$('.description_support').html(res['Description']);
|
||||
$('.ticketidsupport').html(res['ticketno']);
|
||||
$('.raiseddate').html(res['Raised Date']);
|
||||
|
||||
console.log(res);
|
||||
}
|
||||
}
|
||||
|
||||
supportTicketNoInit();
|
||||
Reference in New Issue
Block a user