This commit is contained in:
2024-03-15 16:26:27 +05:30
incheckning 381106cbe5
1046 ändrade filer med 285998 tillägg och 0 borttagningar
+366
Visa fil
@@ -0,0 +1,366 @@
async function addressDetails() {
debugger;
// const user_addr_num =$("#Profile_Phone_num").val();
getbillinginfoBind();
let addr_phone = $('#phonenumber');
let addr_addrline = $('#addressdes');
let addr_zip = $('#zipcode');
let stateArr = [];
function getCustomDropDownHTML({ cityid, cityname, countryid }) {
return ` <div class="bg-white stateoption px-2 border-bottom py-2 cursor-pointer" data-name="${cityname}" data-value="${cityid}">${cityname}</div>`;
}
function renderCustomStateDropdown(stateList) {
let html = ``;
debugger;;
let maxLen = stateList.length > 10 ? 10 : stateList.length
for (let i = 0; i < maxLen; i++) {
let currItem = stateList[i];
html += getCustomDropDownHTML(currItem);
}
$('.stateBox').html(html);
$('.stateoption').off().click(function (e) {
debugger;
const name = $(e.target).data('name');
const id = $(e.target).data('value');
$('#state').val(name);
$('#state').attr('data-id', id);
})
}
function loadDropdownStateEvents() {
$('#state').off().focus(function () {
$('.stateBox').removeClass('d-none');
$(document).off('click').click(closeDrop);
})
$(document).off().click(closeDrop);
function closeDrop(e) {
let id = $(e.target).hasClass('stateoption');
if ($(e.target).attr('id') === 'state') return;
if (id) {
$('.stateBox').addClass('d-none');
$(document).off();
} else {
$('.stateBox').addClass('d-none');
$(document).off();
}
}
$('#state').keyup(debounce(function (event) {
onChangeState(event)
}));
}
function getbillinginfoBind() {
return new Promise(async (resolve, reject) => {
let cookieRes = COOKIE_HELPER_ACTIONS.getCookie();
const { errorMsg, isError, response } =
await API_SERVICES_ACTIONS.getAPIService(
`apis/v4/bizgaze/integrations/anwiauth/getbillinginfo/contactid/${cookieRes.userId}`
);
let res = JSON.parse(response.result);
res = res[res.length - 1];
addr_phone.val(res?.phonenumber);
$('#Profile_User_name').val(res?.organizationname)
$('#Profile_Phone_num').val(res?.phonenumber)
let Profileusername = $('#Profile_User_name').val()
let Profileuserphone = $('#Profile_Phone_num').val()
$('.overview_user_name').html(Profileusername);
$('.overview_user_phone').html(Profileuserphone);
if (res?.cityid == "0") {
$(".profile_Address").html(
`<div class=User_address><button class="btn btn-outline-primary create_address" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-circle" viewBox="0 0 16 16"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/><path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"/></svg> ADD NEW ADDRESS</button></div>`
);
$(".address_edit").hide();
$(".create_address").on("click", function () {
$(this).hide();
$('.saveaddress').hide()
$(".addresslist").show();
$(".Createaddress").show();
getCountryStateCurrency();
});
$('.Createaddress').on('click', async function () {
if (addr_zip.val() == "" || addr_addrline.val() == "") {
// toastr.error('Required Feilds are Empty!');
// if(addr_phone.val() == '' || addr_phone.val().length <10){
// addr_phone.addClass("is-invalid");
// }
// else{
// addr_phone.removeClass("is-invalid");
// }
if (addr_zip.val() == '' || addr_zip.val().length < 6) {
addr_zip.addClass("is-invalid");
}
else {
addr_zip.removeClass("is-invalid");
}
if (addr_addrline.val() == '') {
addr_addrline.addClass("is-invalid");
} else {
addr_addrline.removeClass("is-invalid");
}
}
else {
$(".addresslist").hide();
$(".profile_Address").show();
$(".address_edit").show();
$(".address_edit_cancel").hide();
await createBillingForm()
await getbillinginfoBind();
}
})
} else {
$(".profile_Address").html(
`<div class=User_address><address><p><strong class="">${res?.organizationname}</strong><p>${res?.addressline},${res?.cityname},${res?.zipcode}<p>Mobile: ${res?.phonenumber}</address></div>`
);
$('#state').val(res?.cityname)
$('#state').attr('data-id',res?.cityid);
$('#zipcode').val(res?.zipcode);
$('#addressdes').val(res?.addressline);
}
resolve();
});
} debugger
$(".address_edit").on("click", function () {
$(this).hide();
$(".profile_Address").hide();
$(".addresslist").show();
$(".address_edit_cancel").show();
getCountryStateCurrency();
getbillinginfoBind()
});
$(".address_edit_cancel").on("click", function () {
$(this).hide();
$(".addresslist").hide();
$(".profile_Address").show();
$(".address_edit").show();
});
$(".saveaddress")
.off("click")
.click(async function () {
if (addr_zip.val() == "" || addr_addrline.val() == "") {
// toastr.error('Required Feilds are Empty!');
// if(addr_phone.val() == '' || addr_phone.val().length <10){
// addr_phone.addClass("is-invalid");
// }
// else{
// addr_phone.removeClass("is-invalid");
// }
if (addr_zip.val() == '' || addr_zip.val().length < 6) {
addr_zip.addClass("is-invalid");
}
else {
addr_zip.removeClass("is-invalid");
}
if (addr_addrline.val() == '') {
addr_addrline.addClass("is-invalid");
} else {
addr_addrline.removeClass("is-invalid");
}
}
else {
$(".addresslist").hide();
$(".profile_Address").show();
$(".address_edit").show();
$(".address_edit_cancel").hide();
$('.spinner-border').removeClass('d-none')
$('.saveaddress').find('span').addClass('d-none')
await AddresssaveForm();
$('.spinner-border').addClass('d-none')
$('.saveaddress').find('span').removeClass('d-none')
await getbillinginfoBind();
}
});
function onChangeState(e){
let userItem = e.target.value.toLowerCase();
let limit = 10;
let results = [];
let maxLen = stateArr.length > 10 ? 10 :stateArr.length;
for(let i=0;i<stateArr.length;i++){
let currItem = stateArr[i];
let stateName = currItem.cityname.toLowerCase();
if(stateName.includes(userItem)){
results.push(currItem);
if(results.length>=10) break;
}
}
$('.stateBox').removeClass('d-none');
renderCustomStateDropdown(results);
loadDropdownStateEvents();
}
async function getCountryStateCurrency() {
const countryRes = await API_SERVICES_ACTIONS.getAPIService(
"apis/v4/bizgaze/integrations/anwiauth/getcountry"
);
if (countryRes.isError) {
alert("something went wrong");
return;
}
let countryData = JSON.parse(countryRes.response.result);
for (let i = 0; i < countryData.length; i++) {
if (countryData[i].countryname.toLowerCase() === "india") {
countryID = countryData[i].countryid;
countrynameData = countryData[i].countryname;
break;
}
}
const stateRes = await API_SERVICES_ACTIONS.getAPIService(
`apis/v4/bizgaze/integrations/anwiauth/getcities/countryid/${countryID}`
);
if (stateRes.isError) {
alert("something went wrong");
console.log(stateRes, "state");
return;
}
let stateData = JSON.parse(stateRes.response.result);
console.log(stateData, "state");
stateArr = stateData;
renderCustomStateDropdown(stateArr);
loadDropdownStateEvents();
const currencyRes = await API_SERVICES_ACTIONS.getAPIService(
"apis/v4/bizgaze/integrations/anwiauth/getcurrencies"
);
if (currencyRes.isError) {
alert("something went wrong");
console.log(currencyRes);
return;
}
let currencyData = JSON.parse(currencyRes.response.result);
console.log(currencyData, "currencyDatacurrencyDatacurrencyData");
for (let i = 0; i < currencyData.length; i++) {
const curr = currencyData[i];
if (curr.currencyname.toLowerCase().includes("india")) {
currencyid = curr.currencyid;
}
}
}
async function getCountryId() {
const countryRes = await API_SERVICES_ACTIONS.getAPIService(
"apis/v4/bizgaze/integrations/anwiauth/getcountry"
);
if (countryRes.isError) {
alert("something went wrong");
console.log(countryRes);
return;
}
let ctyId = 0;
let countryData = JSON.parse(countryRes.response.result);
console.log(countryData);
for (let i = 0; i < countryData.length; i++) {
if (countryData[i].countryname.toLowerCase() === "india") {
countryId = countryData[i].countryid;
ctyId = countryId;
countrynameData = countryData[i].countryname;
break;
}
}
return ctyId;
}
function createBillingForm() {
debugger;
return new Promise(async (resolve, reject) => {
let cookieRes = COOKIE_HELPER_ACTIONS.getCookie();
let { userId, name } = cookieRes;
const ctyId = await getCountryId();
let stateId = parseInt($("#state").val());
let payload = {
cityid: stateId,
CityName: $(`[data-id="${stateId}"`).html(),
addressline1: $("#addressdes").val(),
OrganizationType: 2,
organizationname: name,
//"OrganizationId":,
ContactName: name,
ContactId: userId,
countryname: "india",
countryid: ctyId,
statename: $(`[data-id="${stateId}"`).html(),
phonenumber: $("#phonenumber").val(),
OrganizationId: userId,
currencyid: 2,
taxno: "0",
BillingInfoExists: false,
lobid: 0,
lobname: "IT Products",
gstindetailid: 0,
zipcode: $("#zipcode").val(),
};
const res = await API_SERVICES_ACTIONS.postAPIService(
"apis/v4/bizgaze/crm/address/savebillinginfo",
payload
);
// http://localhost:3088/apis/v4/bizgaze/crm/address/savebillinginfo
console.log(res);
resolve();
});
}
async function AddresssaveForm() {
debugger;
let cookieRes = COOKIE_HELPER_ACTIONS.getCookie();
let { userId, name } = cookieRes;
const { errorMsg, isError, response } =
await API_SERVICES_ACTIONS.getAPIService(
`apis/v4/bizgaze/integrations/anwiauth/getbillinginfo/contactid/${cookieRes.userId}`
);
let resAnwi = JSON.parse(response.result);
console.log(resAnwi, "befores");
resAnwi = resAnwi[resAnwi.length - 1];
let stateId = parseInt($("#state").data('id'));
let payload = {
...resAnwi,
phonenumber: $("#phonenumber").val(),
addressline1: $("#addressdes").val(),
zipcode: $("#zipcode").val(),
cityid: stateId,
CityName: $('#state').val(),
cityname: $('#state').val(),
};
console.log(payload, "addresssaave");
//
const res = await API_SERVICES_ACTIONS.postAPIService(
"apis/v4/bizgaze/crm/address/savebillinginfo",
payload
);
return new Promise((reslove, reject) => {
reslove(res);
});
}
}
+9
Visa fil
@@ -0,0 +1,9 @@
function initmyaccount(){
$('.my_account_page').removeClass('d-none')
myProfile();
bindOrderDetails();
wattantyFunction();
addressDetails()
}
checkValidAuth(initmyaccount,'./login.html')
+158
Visa fil
@@ -0,0 +1,158 @@
function myProfile() {
debugger
getbillinginfoBind()
async function getbillinginfoBind(){
let cookieRes = COOKIE_HELPER_ACTIONS.getCookie();
console.log(cookieRes);
const { errorMsg, isError, response } = await API_SERVICES_ACTIONS.getAPIService(
`apis/v4/bizgaze/integrations/anwiauth/getbillinginfo/contactid/${cookieRes.userId}`
);
let res = JSON.parse(response.result);
debugger;
console.log(res);
res = res[res.length - 1];
$('#Profile_User_name').val(res?.organizationname)
$('#Profile_Phone_num').val(res?.phonenumber)
let Profileusername =$('#Profile_User_name').val()
let Profileuserphone=$('#Profile_Phone_num').val()
$('.overview_user_name').html(Profileusername);
$('.overview_user_phone').html(Profileuserphone);
$(".profile_Address").html(`<div class=User_address><address><p><strong>${res?.organizationname}</strong><p>${res?.addressline},${res?.cityname}<br>${res?.statename},${res?.zipcode}<p>Mobile: ${res?.phonenumber}</address></div>`
);
}
let countryId = null;
$(".profile_edit").on("click", function () {
$(this).hide();
// $('.profile_save_btn,.profile_edit_cancel').removeClass('d-none')
$(".profile_save_btn,.profile_edit_cancel,.profile_info_label").show();
$(".profile_info").removeAttr("disabled").removeClass("cursor-notvalid");
});
$(".profile_edit_cancel").on("click", function () {
$(this).hide();
$(".profile_save_btn,.profile_info_label").hide();
$('#Profile_User_name').val('');
$('#Profile_Phone_num').val('');
getbillinginfoBind();
$(".profile_edit").show();
$(".profile_info").attr("disabled", "disabled").addClass("cursor-notvalid");
});
$(".pass_edit").on("click", function () {
$(this).hide();
$(".update_profile_pass,.pass_edit_cancel").show();
$(".profile_info_pass")
.removeAttr("disabled")
.removeClass("cursor-notvalid");
});
$(".pass_edit_cancel").on("click", function () {
$('#Profile_User_current_pass').val('');
$('#Profile_User_confirm_pass').val('');
$('#Profile_User_new_pass').val('');
$('#Profile_User_current_pass,#Profile_User_new_pass,#Profile_User_confirm_pass').removeClass('is-invalid')
// $('#Profile_User_new_pass').val().removeClass('is-invalid')
// $('#Profile_User_confirm_pass').val().removeClass('is-invalid')
$(this).hide();
$(".update_profile_pass").hide();
$(".pass_edit").show();
$(".profile_info_pass")
.attr("disabled", "disabled")
.addClass("cursor-notvalid");
});
$(".update_profile_pass").on("click", async function () {
let userEmail = window.localStorage.getItem("Useremail");
console.log(userEmail);
let port = SERVERNAME;
// let port = "http://localhost:3088";
let url = `${port}/account/getuserbyphoneormail/${userEmail}/${userEmail}`;
const config = {
url,
method: "get",
};
debugger;
let response = await axios(config);
let usernameId = response.data.result.userName;
let UserNewpassword = $("#Profile_User_new_pass");
let usercurrentPass = $("#Profile_User_current_pass");
let userConfirmpass = $("#Profile_User_confirm_pass");
if (usercurrentPass.val() != "") {
$(usercurrentPass).removeClass("is-invalid");
if (UserNewpassword.val() && userConfirmpass.val() != "") {
if (UserNewpassword.val() == userConfirmpass.val()) {
console.log(usernameId);
const UpdatePassPayload = {
username: usernameId,
password: UserNewpassword.val(),
oldpassword: usercurrentPass.val(),
};
const update_passres = await postAPIService(
`hyperfusion/HypersfusionUpdatePassword`,
UpdatePassPayload
);
console.log(update_passres);
if (update_passres.data.errors != null) {
$(".profilepass_feedbackres")
.html(`<div class="alert alert-danger error_msg " role="alert" style="font-size: 12px;"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.2646 3.41366C11.7212 3.15681 12.2788 3.15681 12.7354 3.41366L19.2354 7.06991C19.7077 7.33558 20 7.83536 20 8.37727V15.6227C20 16.1646 19.7077 16.6644 19.2354 16.9301L12.7354 20.5863C12.2788 20.8432 11.7212 20.8432 11.2646 20.5863L4.76461 16.9301C4.29229 16.6644 4 16.1646 4 15.6227V8.37727C4 7.83536 4.29229 7.33559 4.76461 7.06991L11.2646 3.41366Z" fill="#FF3A2E"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M11 7.4C11 7.17909 11.1791 7 11.4 7H12.6C12.8209 7 13 7.17909 13 7.4V12.6C13 12.8209 12.8209 13 12.6 13H11.4C11.1791 13 11 12.8209 11 12.6V7.4Z" fill="white"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M11 16C11 15.4477 11.4477 15 12 15C12.5523 15 13 15.4477 13 16C13 16.5523 12.5523 17 12 17C11.4477 17 11 16.5523 11 16Z" fill="white"></path></svg>
<span class="error_msg_res">${update_passres.data.message}</a></span>
</div>`);
$(userConfirmpass).addClass("is-invalid");
$(UserNewpassword).removeClass("is-invalid");
$(userConfirmpass).removeClass("is-invalid");
} else {
$(".profilepass_feedbackres")
.html(`<div class="alert alert-success success_msg" role="alert" style="font-size: 12px;"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check" viewBox="0 0 16 16">
<path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425a.267.267 0 0 1 .02-.022z"/>
</svg>
<span class="success_msg_res">${update_passres.data.message}</a></span>
</div>`);
usercurrentPass.val("");
UserNewpassword.val("");
userConfirmpass.val("");
}
} else {
$(UserNewpassword).addClass("is-invalid");
$(userConfirmpass).addClass("is-invalid");
return;
}
} else {
$(UserNewpassword).addClass("is-invalid");
$(userConfirmpass).addClass("is-invalid");
return;
}
} else {
$(usercurrentPass).addClass("is-invalid");
return;
}
});
$('.profile_save_btn').on('click',async function(){
await ProfilesaveForm();
$('.profile_edit_cancel').trigger('click')
})
async function ProfilesaveForm() {
debugger
let cookieRes = COOKIE_HELPER_ACTIONS.getCookie();
let { userId, name } = cookieRes;
const { errorMsg, isError, response } =
await API_SERVICES_ACTIONS.getAPIService(
`apis/v4/bizgaze/integrations/anwiauth/getbillinginfo/contactid/${cookieRes.userId}`
);
let resAnwi = JSON.parse(response.result);
console.log(resAnwi, "previous profilesave");
resAnwi = resAnwi[resAnwi.length - 1];
let payload = {
...resAnwi,
organizationname: $("#Profile_User_name").val(),
phonenumber: $("#Profile_Phone_num").val(),
};
console.log(payload, "profilesave");
//
const res = await API_SERVICES_ACTIONS.postAPIService(
"apis/v4/bizgaze/crm/address/savebillinginfo",
payload
);
return new Promise((reslove, reject) => {
reslove(res);
getbillinginfoBind();
});
}
}
+158
Visa fil
@@ -0,0 +1,158 @@
function wattantyFunction(){
debugger
let order_card = `<div class=warranty_product><div class="py-3 warranty_productform"><div class=mb-3><label class=form-label for=Add_serial_number_inp>Enter Your Serial Number</label><input class=form-control id=Add_serial_number_inp required><label class="form-label text-danger d-none error_serial_num" for=Add_serial_number_inp >Serial Number Not Found</label></div><div class=mb-3><label class=form-label for=Add_phonenumber_inp>Enter Your Phone Number</label> <input class=form-control id=Add_phonenumber_inp required><label class="text-danger d-none form-label error_phonenumber" for=Add_phonenumber_inp>Enter Valid Phone Number</label></div><div class=mb-3><label class=form-label for=Add_contactname_inp>Enter Your Contactname</label> <input class=form-control id=Add_contactname_inp required></div><div class="serial_submit text-end"><button class="btn btn-dark warranty_serialNumber_submit" type="button">Submit</button></div></div></div>`;
$(".user_orders").append(order_card);
$('.add_serialNum').click(function () {
$('.warranty_productform').removeClass('d-none');
$(this).addClass('d-none');
});
$('.warranty_serialNumber_submit').click(async function () {
let serial_no_inp = $('#Add_serial_number_inp').val();
let phonenumber_inp = $('#Add_phonenumber_inp').val();
let contactname_inp = $('#Add_contactname_inp').val();
if(serial_no_inp && phonenumber_inp !=''){
$('.error_serial_num').addClass('d-none');
$('.error_phonenumber').addClass('d-none');
$('#Add_serial_number_inp').removeClass('border-danger')
$('#Add_phonenumber_inp').removeClass('border-danger');
let port = SERVERNAME;
debugger
let url = `${port}/apis/v4/Bizgaze/integrations/products/warrantyservice/serialno/${serial_no_inp}`;
console.log(url);
// const STAT = `05b2f2ca510344968c65e1ebf49a5595`
const config = {
url,
method: "get",
headers: {
Authorization: `stat ${STAT}`,
},
};
let response = await axios(config);
debugger
console.log(response)
let product_res = response.data.result
if (product_res != null) {
let warrenty_res = JSON.parse(product_res);
let new_arr = [warrenty_res];
$.each(new_arr, function (key, value) {
console.log(value)
if (response.data.result == '[]') {
// Command: toastr["error"]("Serial number not found !")
// toasterOpts();
// $('#Add_serial_number_inp').addClass('border-danger');
// $('.error_serial_num').removeClass('d-none')
$(".user_Warranty_details").html(`<div class="Serial_numb_notfound text-danger text-center"><h2>Serial Number Not Found !</h2>`);
// $('.warranty_productform').addClass('d-none');
// $('.add_serialNum').removeClass('d-none');
return;
}
else {
const warrantyEnabled = value[0].warrantyenabled;
if (warrantyEnabled == false) {
let phonenumber_updated = Number(phonenumber_inp)
$('.user_Warranty_details').removeClass('d-none')
// let strDate = new Date(value[0].purchasedate).toISOString().slice(0, 10);
let Warrentypayload =
{
"sku": value[0].sku,
"serialno": serial_no_inp,
"phonenumber": phonenumber_updated,
"contactname": contactname_inp,
"warrantyfromdate": value[0].purchasedate
}
warrentyService(Warrentypayload);
}
else {
// let warrantySerialnumber =$('.serial_no_warrantynumber').text()
let warrenty_date =value[0].warrantytodate
let userwarrenty_product = `<div class="border-3 border-start my-3 order-cards ps-4 rounded-0" id='order-cards'> <div class="col-md-12 "><b>Warranty For :</b> ${value[0].itemname}</div><div class="row align-items-center"> <div class=col-md-12> <div class="col-md-6 my-2"><span>Serail NO :</span> <span class="fs-9 text-secondary serial_no_warrantynumber">${value[0].serialno}</span> </div><div class="col-md-6 my-2"><span> Warrenty Expiry Date :</span> <span class=" fs-9 text-secondary rounded-2 warrenty_date">${value[0].warrantytodate}</span> </div><div class="my-2 col-md-6"><span> Warranty Start Date :</span> <span class="fs-9 text-secondary purchase_date">${value[0].warrantyfromdate}</span> </div><div class="col-md-6 my-2"> <span> Warranty Status : </span><span class="bg-success btn fs-9 is_warranty_enable py-0 text-white"> ${value[0].warrantyenabled}</span> </div></div></div></div>`;
let is_warranty_enable=value[0].warrantyenabled
debugger
$(".user_Warranty_details").html(userwarrenty_product);
if(is_warranty_enable == true){
$('.is_warranty_enable').text('Activated')
}
else{
$('.is_warranty_enable').text('Not Activated')
}
if(warrenty_date == "" ){
$('.warrenty_date').addClass('d-none')
}
else{
$('.warrenty_date').removeClass('d-none')
}
$('#Add_serial_number_inp').addClass('border-success')
$('.error_serial_num').addClass('d-none')
// $('.warranty_productform').addClass('d-none');
$('.add_serialNum').removeClass('d-none');
//Command: toastr["success"]("Warranty already enabled !")
}
}
})
}
}
else{
if(serial_no_inp == ''){
$('#Add_serial_number_inp').addClass('border-danger')
$('.error_serial_num').removeClass('d-none')
}
else if(phonenumber_inp == ''){
$('#Add_phonenumber_inp').addClass('border-danger');
$('.error_phonenumber').removeClass('d-none');
}
}
})
async function warrentyService(Warrentypayload) {
// let d = new Date();
// // let strDate = d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate();
// let strDate = new Date().toISOString().slice(0, 10)
// console.log(strDate)
debugger
const res = await postAPIServiceWarranty(`apis/v4/bizgaze/transact/items/savewarrantyasync`, Warrentypayload);
debugger
console.log(res)
if (res.data.status == 2) {
// $('.warranty_productform').addClass('d-none');
// $('.add_serialNum').removeClass('d-none');
// Command: toastr["warning"](res.data.message)
// toasterOpts();
$(".user_Warranty_details").html(`<div class="text-warning text-center"><h2>No Serial number found / Product not Delivered</h2>`);
}
else if(res.data.status == '0'){
// $('.warranty_productform').addClass('d-none');
// $('.add_serialNum').removeClass('d-none');
// Command: toastr["success"](res.data.message);
// toasterOpts();
$(".user_Warranty_details").html(`<div class="text-danger text-center"><h2>${res.data.message}</h2>`);
}
}
// 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"
// }
// }
}
+134
Visa fil
@@ -0,0 +1,134 @@
async function bindOrderDetails() {
let user_number = $('.User_phoneum').text();
// validatesession()
debugger
let cookieRes = COOKIE_HELPER_ACTIONS.getCookie();
let { userId } = cookieRes;
//let userId = '106631380000048';
debugger;
console.log(cookieRes);
let port = SERVERNAME;
// let port = "http://localhost:3088";
let url = `${port}/apis/v4/Bizgaze/integrations/products/salesorderdetailsbyorgid/organizationid/${userId}`;
// /apis/v4/bizgaze/integrations/products/salesorderdetailsbyorgid/phonenumber/
// https://anwi.bizgaze.app/apis/v4/Bizgaze/integrations/products/salesorderdetailsbyorgid/organizationid/{organizationid}
const config = {
url,
method: "get",
headers: {
'Authorization': `stat ${STAT} `,
'Content-Type': 'application/json'
}
};
debugger
let res = await axios(config);
if (res.data.result == '[]' || res.data.result === null) {
$(".user_order_details").append(`<div><h6 class="text-center">No orders Found</h6></div>`);
return;
}
const orderDetailsres = JSON.parse(res.data.result);
console.log(orderDetailsres);
let new_arrr = orderDetailsres;
console.log(new_arrr);
$(".user_order_details").html(``)
console.log('hello')
let user_order_details = ``;
let order_itemTotal = '';
let order_netTotal = '';
let order_quantity = '';
let order_taxAmount = '';
for (let i = 0; i < new_arrr.length; i++) {
let current = new_arrr[i]
let updatedCurent_total = current.nettotal.toLocaleString()
order_itemTotal = current.itemtotal;
order_netTotal = current.nettotal;
order_quantity = current.Quantity;
order_taxAmount = current.taxamount;
user_order_details += `<a href="" class="order_details_main_container">
<div class="border-3 mb-3 card">
<div class="text-dark card-body px-0 pt-0">
<div class="d-none">
<span class="order_itemTotal">${order_itemTotal}</span>
<span class="order_netTotal">${order_netTotal}</span>
<span class="order_tax">${order_taxAmount}</span>
<span class="order_qty">${order_quantity}</span>
</div>
<div class="bg-gray-4 p-2 m-0 border-bottom">
<p class="m-0 fw-600 text-secondary">ORDER NO: <span class="text-blue fs-9 serial_no ">${current.OrderNo}</span>
</p>
</div>
<div class="bg-gray-4 p-2 row g-0">
<div class="col-md-6 ">
<div class="d-flex justify-content-between align-items-center">
<div>
<p class="mb-1">ORDER PLACED</p>
<p class="mb-1 fw-500 order_date">${current.OrderDate}</p>
</div>
<div>
<p class="mb-1"> TOTAL</p>
<p class="mb-1 fw-500 Current_netTotal"> ₹${updatedCurent_total}</p>
</div>
<div>
<p class="mb-1">Delivered TO </p>
<p class="mb-1 fw-500">${current.OrganizationName}</p>
</div>
</div>
</div>
<div class="col-md-4 ms-auto">
<div class="d-flex justify-content-between">
<p class="mb-1 text-info fw-500"> View order details </p>
<p class="mb-0 text-info fw-500">Invoice</p>
</div>
</div>
</div>
<div class="border-0 card rounded-0 order-cards py-3">
<div class="d-flex flex-wrap px-2 align-items-center text-center">
<div class="col-md-3">
<img src="https://appassets.bizgaze.app/${current.imageurl}" class="img-fluid w-75 order_item_name" />
</div>
<div class="col-md-9">
<div class="row align-items-center">
<div class="col-md-8">
<div class="order_item_name">${current.itemname}</div>
</div>
<div class="col-md-4">
<button type="button" class="btn btn-sm rounded order_details_btn bg-gradient-anwi-outline py-0 mb-3" onClick="event.preventDefault();">Track Package</button>
<button type="button" class="btn btn-sm btn-light rounded order_details_btn py-0 mb-3 shadow-sm" onClick="event.preventDefault();">Cancel Item</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</a>`;
}
$(".user_order_details").append(user_order_details);
$('.order_details_main_container').click(function () {
let current_serial_no = $(this).find('.serial_no').text();
// window.localStorage.setItem('orderDate',current_order_date);
// window.localStorage.setItem('orderSerialno',current_serial_no);
// window.localStorage.setItem('Userphonenumber',user_number);
$(this).attr('href', `./orderdetails.html#${current_serial_no}`)
})
}
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"
}
}