Everyday English Grammar & Composition (Class 5) - লেকচার পাবলিকেশন | বইবাজার.কম (2022)

Proceed To Order

`); } else if(subUrl == 'gift'){ itemDesign.append(`

Place order

`); } else if(subUrl == 'order' && payUrl == 'payment/order'){ /*itemDesign.append(`

Select Pay

`);*/ itemDesign.append(`

My Orders

`); } else if(subUrl == 'order' && isLogedin == 'true'){ itemDesign.append(`

Place Order

`); } else if(subUrl == 'order'){ itemDesign.append(`

Next

`); } else if(cartItemCoun == 0 || cartItemCoun == undefined){ /*itemDesign.append(`

Contact us
Chat now?

`);*/ itemDesign.append(`

আমাদের ক্যাম্পেইন সমূহ

`); } else{ itemDesign.append(`

Proceed

`); } $("#bkash-payment-btn").click(function() { $(".dynamicButton").remove(); if(subUrl == 'order' && payUrl == 'payment/order'){ itemDesign.append(`

Pay now

`); } }); $("#nagad-payment-btn").click(function() { $(".dynamicButton").remove(); if(subUrl == 'order' && payUrl == 'payment/order'){ itemDesign.append(`

Pay now

`); } }); $("#card-payment-btn").click(function() { $(".dynamicButton").remove(); if(subUrl == 'order' && payUrl == 'payment/order'){ itemDesign.append(`

Pay now

`); } }); ///Mobile Payment //Nagad Pay function nagadMobilePay(){ $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }); if (subTotal >= freeDeliveryAmount) { onlineDeliveryCharge = 50; onlinePayable = parseInt(subTotal, 10) + parseInt(onlineDeliveryCharge, 10) + parseInt(wrappingCharge, 10) - parseInt(discount, 10); } if(freeOnlineOrderDelivery){ onlineDeliveryCharge = 50; onlinePayable = parseInt(subTotal, 10) + parseInt(onlineDeliveryCharge, 10) + parseInt(wrappingCharge, 10) - parseInt(discount, 10); } if (token != undefined) { //Logged In $("img#loader").css("display", "block"); let deliveyAddress = $("#deliveryAddress").val(); deliveyAddress = JSON.parse(deliveyAddress); let orderNo = $("#orderNo").val(); var nagadData = { amount: onlinePayable - (walletAmount || 0), order_id: orderNo, name: deliveyAddress.contact_name, email: "info@boibazar.com", address: deliveyAddress.address, district: deliveyAddress.district, thana: deliveyAddress.thana, phone_number: deliveyAddress.phone_number } // Guest $.ajax({ type: "POST", url: orderNagadAPI, headers: { token: token }, data: nagadData, dataType: "json", success: function(sslRes) { $("img#loader").css("display", "none"); localStorage.clear(); location.replace(sslRes); }, error: function(data) { //console.log("er"+data); } }); } else { // Guest let deliveyAddress = $("#deliveryAddress").val(); deliveyAddress = JSON.parse(deliveyAddress); let orderNo = $("#orderNo").val(); let nagadData = { amount: onlinePayable - (walletAmount || 0), order_id: orderNo, name: deliveyAddress.contact_name, email: "info@boibazar.com", address: deliveyAddress.address, district: deliveyAddress.district, thana: deliveyAddress.thana, phone_number: deliveyAddress.phone_number } $("img#loader").css("display", "block"); // Guest and card delivery $.ajax({ type: "POST", url: orderNagadAPI, headers: { token: token }, data: nagadData, dataType: 'json', success: function(sslRes) { $("img#loader").css("display", "none"); localStorage.clear(); //Promo PUT location.replace(sslRes); // window.location.href = sslRes.GatewayPageURL; }, error: function(data) { $("img#loader").css("display", "none"); $.toast.success("Order is unsuccessful"); location.reload(); // console.log(data); } }); } } //end nagad pay //bkash payment // function bkashPaymentMethod() { // console.log('bo'+bkash_order_no); // if(freeOnlineOrderDelivery){ // onlineDeliveryCharge = 0; // onlinePayable = // parseInt(subTotal, 10) + // parseInt(onlineDeliveryCharge, 10) + // parseInt(wrappingCharge, 10) - // parseInt(discount, 10); // } // var createResponseData; // var bkashInvoiceNo = "bkash-" + new Date().getTime(); // var paymentID = ""; // bKash.init({ // paymentMode: "checkout", // paymentRequest: { // amount: onlinePayable - (walletAmount || 0), // intent: "sale" // }, // createRequest: function(request) { // $("img#loader").css("display", "block"); // $.ajax({ // type: "POST", // url: grantTokenAPI, // headers: { // amount: onlinePayable - (walletAmount || 0), // merchantInvoiceNumber: bkashInvoiceNo, // "Content-Type": "application/json" // }, // dataType: "json", // data: JSON.stringify(request), // success: function(data) { // $("img#loader").css("display", "none"); // if (data && data.paymentID != null) { // bkashInvoiceNo = data.merchantInvoiceNumber; // paymentID = data.paymentID; // bKash.create().onSuccess(data); // } else { // bKash.create().onError(); //run clean up code // } // createResponseData = data; // }, // error: function() { // console.log("error"); // bKash.create().onError(); // } // }); // }, // executeRequestOnAuthorization: function() { // //CALL YOUR BACKEND'S EXECUTE METHOD HERE // $.ajax({ // type: "GET", // url: bkashExecuteAPI + "/" + createResponseData.paymentID, // headers: { // "Content-Type": "application/json" // }, // success: function(executeResponse) { // let executeResponseBody = JSON.parse(executeResponse); // let fullCollection = false; // //Check Bkash Payment // if (executeResponseBody && executeResponseBody.paymentID != null) { // var transStatus = ''; // var transMsg = ''; // var isPaid = false; // if (executeResponseBody.transactionStatus == "Completed") { // transStatus = "VALID"; // transMsg = 'Payment has been successful'; // isPaid = true; // fullCollection = true; // } // var paymentInfo = { // "tran_id": executeResponseBody.merchantInvoiceNumber, // "status": transStatus, // "message": transMsg, // "val_id": executeResponseBody.paymentID, // "card_type": "BKASH-BKash", // "store_amount": executeResponseBody.amount, // "bank_tran_id": executeResponseBody.trxID, // "tran_date": new Date(), // "currency": executeResponseBody.currency, // "card_issuer": "BKash Mobile Banking", // "card_brand": "MOBILEBANKING", // "card_issuer_country": "Bangladesh", // "currency_amount": executeResponseBody.amount // } // var payment_collection = { // "is_full_collected": fullCollection, // "total_paid": executeResponseBody.amount, // "carrier_cost": onlineDeliveryCharge, // "due_amount": 0, // "transaction_cost": (1.5 * (executeResponseBody.amount / 100)), // "collection_info": [{ // "collected_amount": executeResponseBody.amount, // "collected_at": new Date(), // "transaction_cost": (1.5 * (executeResponseBody.amount / 100)), // "gateway_ref": "5ae54e80d055af76056b5aa9", // }], // "tax_amount": 0 // } // if (token != undefined) { // //Logged In // $.ajax({ // type: "PUT", // url: orderAPI, // headers: { // order_no: bkash_order_no, // token: token // }, // data: { // bkash_invoice_no: bkashInvoiceNo, // bkash_payment_id: executeResponseBody.paymentID, // is_paid: isPaid, // payment_information: paymentInfo, // payment_collection: payment_collection // }, // dataType: "JSON", // success: function(data) { // // Payment Successful Logged In // // $("#paymentDiv").load( document.URL + " #paymentpop"); // $("#bKashFrameWrapper").remove(); // $("img#loader").css("display", "none"); // if (data.status != 404) { // confirmOrderModal.style.display = "block"; // document.getElementById("specificOrderId").innerHTML = data.data.order_no; // document.getElementById("specificSubtotal").innerHTML = subTotal; // document.getElementById("specificDeliveryCharge").innerHTML = onlineDeliveryCharge; // document.getElementById("specificDiscount").innerHTML = discount; // document.getElementById("specificWrap").innerHTML = wrappingCharge; // document.getElementById("specificWallet").innerHTML = walletAmount; // document.getElementById("specificPayable").innerHTML = onlinePayable; // document.getElementById("specificOrderMsg").innerHTML = 'Thank You, your order has been Successful'; // document.getElementById("specificPaymentMsg").innerHTML = 'Your Payment has been Successful as well'; // document.getElementById("specificDeliveryAddress").innerHTML = data.data.delivery_address.address + ", " + data.data.delivery_address.thana + ", " + data.data.delivery_address.district; // } else { // $.toast.danger(data.message); // } // }, // error: function(data) { // $("img#loader").css("display", "none"); // if (data.status != 404) { // confirmOrderModal.style.display = "block"; // document.getElementById("specificOrderId").innerHTML = data.data.order_no; // document.getElementById("specificSubtotal").innerHTML = subTotal; // document.getElementById("specificDeliveryCharge").innerHTML = deliveryCharge; // document.getElementById("specificDiscount").innerHTML = discount; // document.getElementById("specificWrap").innerHTML = wrappingCharge; // document.getElementById("specificWallet").innerHTML = walletAmount; // document.getElementById("specificPayable").innerHTML = payableAmount; // document.getElementById("specificOrderMsg").innerHTML = 'Thank You, your order has been Successful'; // document.getElementById("specificPaymentMsg").innerHTML = 'But, Your Payment is Failed'; // $("#goToList").css("display", "block"); // document.getElementById("specificDeliveryAddress").innerHTML = data.data.delivery_address.address + ", " + data.data.delivery_address.thana + ", " + data.data.delivery_address.district; // } else { // $.toast.danger(data.message); // } // } // }); // } else { // // Guest // $.ajax({ // type: "PUT", // url: guestOrderAPI, // headers: { // order_no: bkash_order_no // }, // data: { // bkash_invoice_no: bkashInvoiceNo, // bkash_payment_id: executeResponseBody.paymentID, // is_paid: isPaid, // payment_information: paymentInfo, // payment_collection: payment_collection // }, // dataType: "JSON", // success: function(data) { // $("#bKashFrameWrapper").remove(); // // Payment Successful // $("img#loader").css("display", "none"); // if (data.status != 404) { // confirmOrderModal.style.display = "block"; // document.getElementById("specificOrderId").innerHTML = data.data.order_no; // document.getElementById("specificSubtotal").innerHTML = subTotal; // document.getElementById("specificDeliveryCharge").innerHTML = onlineDeliveryCharge; // document.getElementById("specificDiscount").innerHTML = discount; // document.getElementById("specificWrap").innerHTML = wrappingCharge; // document.getElementById("specificWallet").innerHTML = walletAmount; // document.getElementById("specificPayable").innerHTML = onlinePayable; // document.getElementById("specificOrderMsg").innerHTML = 'Thank You, your order has been Successful'; // document.getElementById("specificPaymentMsg").innerHTML = 'Your Payment has been Successful as well'; // document.getElementById("specificDeliveryAddress").innerHTML = data.data.delivery_address.address + ", " + data.data.delivery_address.thana + ", " + data.data.delivery_address.district; // } else { // $.toast.danger(data.message); // } // }, // error: function(data) { // $("img#loader").css("display", "none"); // if (data.status != 404) { // confirmOrderModal.style.display = "block"; // document.getElementById("specificOrderId").innerHTML = data.data.order_no; // document.getElementById("specificSubtotal").innerHTML = subTotal; // document.getElementById("specificDeliveryCharge").innerHTML = deliveryCharge; // document.getElementById("specificDiscount").innerHTML = discount; // document.getElementById("specificWrap").innerHTML = wrappingCharge; // document.getElementById("specificWallet").innerHTML = walletAmount; // document.getElementById("specificPayable").innerHTML = payableAmount; // document.getElementById("specificOrderMsg").innerHTML = 'Thank You, your order has been Successful'; // document.getElementById("specificPaymentMsg").innerHTML = 'But, Your Payment is Failed'; // $("#goToList").css("display", "block"); // document.getElementById("specificDeliveryAddress").innerHTML = data.data.delivery_address.address + ", " + data.data.delivery_address.thana + ", " + data.data.delivery_address.district; // } else { // $.toast.danger(data.message); // } // } // }); // } // } else { // //alert("[ERROR] data : " + JSON.stringify(executeResponse.body)); // if (token != undefined) { // //Logged In // $.ajax({ // type: "PUT", // url: orderAPI, // headers: { // order_no: bkash_order_no, // token: token // }, // data: { // bkash_invoice_no: executeResponseBody.errorCode, // bkash_payment_id: "failedBkash" // }, // dataType: "JSON", // success: function(data) { // $("img#loader").css("display", "none"); // if (data.status != 404) { // confirmOrderModal.style.display = "block"; // document.getElementById("specificOrderId").innerHTML = bkash_order_no; // document.getElementById("specificSubtotal").innerHTML = subTotal; // document.getElementById("specificDeliveryCharge").innerHTML = deliveryCharge; // document.getElementById("specificDiscount").innerHTML = discount; // document.getElementById("specificWrap").innerHTML = wrappingCharge; // document.getElementById("specificWallet").innerHTML = walletAmount; // document.getElementById("specificPayable").innerHTML = payableAmount; // document.getElementById("specificOrderMsg").innerHTML = 'Thank You, your order has been Successful'; // document.getElementById("specificPaymentMsg").innerHTML = 'But, Your Payment Failed due to ' + executeResponseBody.errorMessage + ''; // $("#goToList").css("display", "block"); // // document.getElementById("specificDeliveryAddress").innerHTML = data.data.delivery_address.address + ", " + data.data.delivery_address.thana + ", " + data.data.delivery_address.district; // } else { // $.toast.danger(data.message); // } // }, // error: function(data) { // // console.log(data) // if (data.status != 404) { // confirmOrderModal.style.display = "block"; // document.getElementById("specificOrderId").innerHTML = bkash_order_no; // document.getElementById("specificSubtotal").innerHTML = subTotal; // document.getElementById("specificDeliveryCharge").innerHTML = deliveryCharge; // document.getElementById("specificDiscount").innerHTML = discount; // document.getElementById("specificWrap").innerHTML = wrappingCharge; // document.getElementById("specificWallet").innerHTML = walletAmount; // document.getElementById("specificPayable").innerHTML = payableAmount; // document.getElementById("specificOrderMsg").innerHTML = 'Thank You, your order has been Successful'; // document.getElementById("specificPaymentMsg").innerHTML = 'But, Your Payment Failed due to ' + executeResponseBody.errorMessage + ''; // $("#goToList").css("display", "block"); // // document.getElementById("specificDeliveryAddress").innerHTML = data.data.delivery_address.address + ", " + data.data.delivery_address.thana + ", " + data.data.delivery_address.district; // } else { // $.toast.danger(data.message); // } // } // }); // } else { // // Guest // $.ajax({ // type: "POST", // url: guestOrderAPI, // headers: { // order_no: bkash_order_no // }, // data: { // bkash_invoice_no: executeResponseBody.errorCode, // bkash_payment_id: "failedBkash" // }, // dataType: "JSON", // success: function(data) { // if (data.status != 404) { // confirmModal.style.display = "none"; // confirmOrderModal.style.display = "block"; // document.getElementById("specificOrderId").innerHTML = data.data.order_no; // document.getElementById("specificSubtotal").innerHTML = subTotal; // document.getElementById("specificDeliveryCharge").innerHTML = deliveryCharge; // document.getElementById("specificDiscount").innerHTML = discount; // document.getElementById("specificWrap").innerHTML = wrappingCharge; // document.getElementById("specificWallet").innerHTML = walletAmount; // document.getElementById("specificPayable").innerHTML = payableAmount; // document.getElementById("specificOrderMsg").innerHTML = 'Thank You, your order has been Successful'; // document.getElementById("specificPaymentMsg").innerHTML = 'But, Your Payment Failed due to ' + executeResponseBody.errorMessage + ''; // $("#goToList").css("display", "block"); // document.getElementById("specificDeliveryAddress").innerHTML = data.data.delivery_address.address + ", " + data.data.delivery_address.thana + ", " + data.data.delivery_address.district; // } else { // $.toast.danger(data.message); // } // }, // error: function(data) { // if (data.status != 404) { // confirmModal.style.display = "none"; // confirmOrderModal.style.display = "block"; // document.getElementById("specificOrderId").innerHTML = data.data.order_no; // document.getElementById("specificSubtotal").innerHTML = subTotal; // document.getElementById("specificDeliveryCharge").innerHTML = deliveryCharge; // document.getElementById("specificDiscount").innerHTML = discount; // document.getElementById("specificWrap").innerHTML = wrappingCharge; // document.getElementById("specificWallet").innerHTML = walletAmount; // document.getElementById("specificPayable").innerHTML = payableAmount; // document.getElementById("specificOrderMsg").innerHTML = 'Thank You, your order has been Successful'; // document.getElementById("specificPaymentMsg").innerHTML = 'But, Your Payment Failed due to ' + executeResponseBody.errorMessage + ''; // $("#goToList").css("display", "block"); // document.getElementById("specificDeliveryAddress").innerHTML = data.data.delivery_address.address + ", " + data.data.delivery_address.thana + ", " + data.data.delivery_address.district; // } else { // $.toast.danger(data.message); // } // } // }); // } // bKash.execute().onError(); //run clean up code // } // }, // error: function(result) { // $("img#loader").css("display", "none"); // console.log("error"); // // console.log(result) // } // }); // } // }); // } // function deskbkashPayment(){ // bkash_order_no = $("#orderNo").val(); // console.log(bkash_order_no); // if (!count_bkash) { // bkashPaymentMethod(); // count_bkash++; // } // else{ // if (bkash_order_no) { // //confirmModal.style.display = "block"; // bkashPaymentMethod(); // } else { // alert("ERROR"); // location.reload(); // } // } // } //end bkash payment //Card Pay function cardMobilePay(){ onlineDeliveryCharge = deliveryCharge; onlinePayable = parseInt(subTotal, 10) + parseInt(onlineDeliveryCharge, 10) + parseInt(wrappingCharge, 10) - // parseInt(walletAmount, 10) - parseInt(discount, 10); var checkCardConfirm = confirm("Confirm with Card Payment?"); if (checkCardConfirm) { if (token != undefined) { //Logged In $("img#loader").css("display", "block"); let deliveyAddress = $("#deliveryAddress").val(); deliveyAddress = JSON.parse(deliveyAddress); let orderNo = $("#orderNo").val(); //console.log(deliveyAddress.contact_name); $.ajax({ type: "POST", url: orderSSLAPI, headers: { cart_id: cid, token: token }, data: { amount: onlinePayable - (walletAmount || 0), order_id: orderNo, name: deliveyAddress.contact_name, email: "info@boibazar.com", address: deliveyAddress.address, district: deliveyAddress.district, thana: deliveyAddress.thana, phone_number: deliveyAddress.phone_number }, dataType: "JSON", success: function(sslRes) { $("img#loader").css("display", "none"); localStorage.clear(); if (sslRes && sslRes.status == "SUCCESS") { window.location.href = sslRes.GatewayPageURL; } }, error: function(data) { // console.log(data); } }); } else { // Guest $("img#loader").css("display", "block"); let deliveyAddress = $("#deliveryAddress").val(); let orderNo = $("#orderNo").val(); // Guest and card delivery $.ajax({ type: "POST", url: orderSSLAPI, headers: { cart_id: cid, token: token }, data: { amount: onlinePayable - (walletAmount || 0), order_id: orderNo, name: deliveyAddress.contact_name, email: "info@boibazar.com", address: deliveyAddress.address, district: deliveyAddress.district, thana: deliveyAddress.thana, phone_number: deliveyAddress.phone_number }, dataType: "JSON", success: function(sslRes) { $("img#loader").css("display", "none"); localStorage.clear(); if (sslRes && sslRes.status == "SUCCESS") { //Promo PUT window.location.href = sslRes.GatewayPageURL; } }, error: function(data) { $("img#loader").css("display", "none"); $.toast.success("Order is unsuccessful"); location.reload(); // console.log(data); } }); } } } //end Card pay //end mobile payment //order place function placeOrderCodMobile(){ var CartId = $("#cartId").val(); localStorage.setItem("presentCart", CartId); // Put the object into storage var AddressId = $("#shippingId").val(); localStorage.setItem("presentAddress", AddressId); var checkCodConfirm = confirm("Confirm Order?"); if (checkCodConfirm) { if (token != undefined) { //Logged In $("img#loader").css("display", "block"); $.ajax({ type: "POST", url: orderAPI, headers: { cart_id: cid, token: token }, data: { delivery_address: delivery_address, cart_id: localStorage.getItem("presentCart"), address_id: localStorage.getItem("presentAddress"), wrapping_charge: wrappingCharge, wallet_amount: walletAmount, wallet_id: walletId, delivery_charge: deliveryCharge, discount: discount, promo_id: promoId, referral_code: referralCode, payable_amount: payableAmount, total_book: totalBook, total_price: subTotal, bkash_invoice_no: '' }, dataType: "JSON", success: function(data) { $("img#loader").css("display", "none"); if (data.status != 404) { delete_cookie('cbvc'); let win_location = String(window.location); let final_location = win_location.replace('shipping', 'payment') window.location.href = final_location + '?sl=' + data.data.order_no; //window.location.href = "https://www.boibazar.com/payment/order?sl=" + data.data.order_no; } else { $.toast.danger(data.message); //location.reload(); } }, error: function(data) { $("img#loader").css("display", "none"); $.toast.danger("Something went wrong!"); location.reload(); } }); } else { // Guest $.ajax({ type: "POST", url: guestOrderAPI, headers: { cart_id: cid }, data: { delivery_address: delivery_address, wrapping_charge: wrappingCharge, delivery_charge: deliveryCharge, discount: discount, payable_amount: payableAmount, total_book: totalBook, total_price: subTotal, bkash_invoice_no: '' }, dataType: "JSON", success: function(data) { $("img#loader").css("display", "none"); if (data.status != 404) { // confirmOrderModal.style.display = "block"; // // document.getElementById("payment-body").css("display", "none"); // // document.getElementById("confirmation-body").css("display", "block"); // // document.getElementById("payment-header").css("display", "none"); // // document.getElementById("confirmation-header").css("display", "block"); // document.getElementById("specificOrderId").innerHTML = data.data.order_no; // document.getElementById("specificSubtotal").innerHTML = subTotal; // document.getElementById("specificDeliveryCharge").innerHTML = deliveryCharge; // document.getElementById("specificDiscount").innerHTML = discount; // document.getElementById("specificWrap").innerHTML = wrappingCharge; // document.getElementById("specificWallet").innerHTML = walletAmount; // document.getElementById("specificPayable").innerHTML = payableAmount; // document.getElementById("specificOrderMsg").innerHTML = 'Thank You, your order has been Successful'; // document.getElementById("specificDeliveryAddress").innerHTML = data.data.delivery_address.address + ", " + data.data.delivery_address.thana + ", " + data.data.delivery_address.district; delete_cookie('cbvc'); //window.location.href = "https://www.boibazar.com/payment/order?sl=" + data.data.order_no; let win_location = String(window.location); let final_location = win_location.replace('shipping', 'payment') window.location.href = final_location + '?sl=' + data.data.order_no; } else { $.toast.danger(data.message); location.reload(); } }, error: function(data) { $("img#loader").css("display", "none"); $.toast.success("Something Went Wrong!"); location.reload(); } }); } } } //mobile order shipping function mobileNextBtnShipping(){ if ($('#mobile-no-input').val()) { guestDetails.phone_number = $('#mobile-no-input').val(); $.ajax({ type: "GET", url: userCheckAPI + guestDetails.phone_number, dataType: "JSON", success: function(user) { if (user.success) { $("#info-span").text("PLEASE ENTER YOUR PASSWORD"); $("#info-h3").text("PASSWORD"); $('#mobile-no-input').val(null); $("#mobile-no-input").fadeOut("slow"); $("#password-input").fadeIn("slow"); $("#forgetPasswordBlock").fadeIn("slow"); } else { $("#info-span").text("CREATE AN ACCOUNT"); $("#info-h3").text("NEW ACCOUNT CREATION"); $('#mobile-no-input').val(null); $("#mobile-no-input").fadeOut("slow"); $("#ca-div-input").fadeIn("slow"); } }, error: function(data) { alert("SOMETHING WENT WORNG") } }); $("#err_all_info").fadeOut("slow"); } else if ($('#password-input').val()) { guestDetails.password = $('#password-input').val(); $.ajax({ type: "POST", url: signInAPI, data: { username: guestDetails.phone_number, password: guestDetails.password }, dataType: "JSON", success: function(data) { if (data.token != undefined) { document.cookie = "token=" + data.token + "; path=/"; document.cookie = "loginName=" + data.first_name + "; path=/"; document.cookie = "sub_id=" + data._id + "; path=/"; window.location = window.location.href; } else if (data.status_code == 419) { $("#validity_check").text(data.message); } else if (data.message == "Invalid password length.") { $("#validity_check").text(data.message); } else { $("#validity_check").fadeOut("slow"); $("#info-span").text("CREATE AN ACCOUNT"); $("#info-h3").text("NEW ACCOUNT CREATION"); $('#password-input').val(null); $("#password-input").fadeOut("slow"); $("#ca-div-input").fadeIn("slow"); } }, error: function(data) { console.log(data); } }); $("#err_all_info").fadeOut("slow"); } else if ($('#ca-name-input').val() && $(".myselect option:selected").text() != "SELECT YOUR DISTRICT" && $("#thana option:selected").text() != "Select Thana" && $("textarea#receiver-address-input").val()) { var district = $(".myselect option:selected").text(); var thana = $("#thana option:selected").text(); var address = $("textarea#receiver-address-input").val(); var carrierId = $("#carrierId").val(); var is_primary = true; guestDetails.contact_name = $('#ca-name-input').val(); guestDetails.email = $('#ca-email-input').val(); guestDetails.password_signup = $('#password-input-signup').val(); guestDetails.district = district; guestDetails.thana = thana; guestDetails.address = address; guestDetails.carrier_id = carrierId; guestDetails.is_primary = is_primary; localStorage.setItem("tempAddress", JSON.stringify(guestDetails)); $.ajax({ type: 'POST', url: signUpAPI, data: { email: guestDetails.email, phone_number: guestDetails.phone_number, first_name: guestDetails.contact_name, is_enabled: true, password: guestDetails.password_signup, provider: 'local_phone', repeatPassword: guestDetails.password_signup, username: guestDetails.phone_number }, dataType: 'JSON', success: function(data) { if (data.user) { $.ajax({ type: "POST", url: shippingAPI, headers: { token: data.token }, data: { address: guestDetails.address, contact_name: guestDetails.contact_name, district: guestDetails.district, is_primary: guestDetails.is_primary, phone_number: guestDetails.phone_number, thana: guestDetails.thana, carrier_id: guestDetails.carrierId, sender_name: guestDetails.contact_name, sender_mobile: guestDetails.phone_number }, dataType: "JSON", success: function(dataShipping) { var CartId = document.getElementById("cartId").value; localStorage.setItem("presentCart", CartId); localStorage.setItem("presentAddress", dataShipping._id); userData = data.user; $('#ca-name-input').val(null); $("#ca-div-input").fadeOut("slow"); $("#pin-check").fadeIn("slow"); }, error: function(data) {} }) } else { // let win_location = String(window.location); // let final_location = win_location.replace('shipping', 'payment') // window.location = final_location; } }, error: function(data) { } }) $("#err_all_info").fadeOut("slow"); } else if ($("#pin-check").val()) { var verifyCode = $("#pin-check").val(); $.ajax({ type: 'POST', url: phoneVerifyAPI, data: { user: { verification_code: verifyCode, username: userData.username, first_name: userData.first_name } }, dataType: 'JSON', success: function(data) { if (data.success) { document.cookie = "token=" + data.token + "; path=/"; document.cookie = "loginName=" + data.first_name + "; path=/"; document.cookie = "sub_id=" + data._id + "; path=/"; // let win_location = String(window.location); // let final_location = win_location.replace('shipping', 'payment') // window.location = final_location; window.location.reload(); //placeOrderCod(); } else { // let win_location = String(window.location); // let final_location = win_location.replace('shipping', 'payment') // window.location = final_location; window.location.reload(); //placeOrderCod(); } }, error: function(data) { console.log(data); } }); $("#err_all_info").fadeOut("slow"); } else { $("#err_all_info").fadeIn("slow"); } } //mobile send as gift shipping $("#shippingMobile").click(function() { var contact_name = $("#contact_name").val(); var district = $(".myselect option:selected").text(); var thana = $("#thana option:selected").text(); var address = $("textarea#address").val(); var phone_number = $("#mobile_no").val(); var is_primary = true; var alter_phone = $("#alternate_mobile_no").val(); var token = getCookie("token"); var carrierId = $("#carrierId").val(); var payment_type = $("#paymentType").val(); var senderName = ''; var senderMobile = ''; if ($("#sender_name")) { var senderName = $("#sender_name").val(); } if ($("#sender_mobile_no")) { var senderMobile = $("#sender_mobile_no").val(); } if ( (contact_name != "" && district != "" && thana != "" && address != "" && (phone_number != "" && phone_number.length == 11)) && ((payment_type == 'gift' && senderName != "" && senderMobile != "") || payment_type == 'order') ) { var tempAddress = { contact_name: contact_name, district: district, thana: thana, address: address, phone_number: phone_number, alter_phone: alter_phone, is_primary: is_primary, carrier_id: carrierId, sender_name: senderName, sender_mobile: senderMobile }; // var domain = window.location.host; if (token) { $.ajax({ type: "POST", url: shippingAPI, headers: { token: token }, data: { address: address, contact_name: contact_name, district: district, is_primary: is_primary, phone_number: phone_number, thana: thana, carrier_id: carrierId, sender_name: senderName, sender_mobile: senderMobile }, dataType: "JSON", success: function(data) { var CartId = document.getElementById("cartId").value; localStorage.setItem("presentCart", CartId); localStorage.setItem("presentAddress", data._id); delivery_address = tempAddress; placeOrderCodMobile(); // let win_location = String(window.location); // let final_location = win_location.replace('shipping', 'payment') // window.location = final_location; //placeOrderCod(); }, error: function(data) {} }); } else { localStorage.setItem("tempAddress", JSON.stringify(tempAddress)); delivery_address = tempAddress; placeOrderCodMobile(); // let win_location = String(window.location); // let final_location = win_location.replace('shipping', 'payment') // window.location = final_location; // window.location.replace("/payment/" + payment_type); window.location.reload(); } // window.location.replace("/payment"); } else { if (payment_type == 'gift') { if (senderName == "") { $("#err_sender_name").html("Sender Name Field is required !"); } else { $("#err_sender_name").html(""); } if (senderMobile == "") { $("#err_sender_phone_number").html("Sender's Number Field is required !"); } else { $("#err_sender_phone_number").html(""); } } if (contact_name == "") { $("#err_contact_name").html("Contact Name Field is required !"); } else { $("#err_contact_name").html(""); } if (district == "Select District") { $("#err_district").html("District Field is required !"); } else { $("#err_district").html(""); } if (thana == "Select Thana") { $("#err_thana").html("Thana Field is required !"); } else { $("#err_thana").html(""); } if (address == "") { $("#err_address").html("Address Field is required !"); } else { $("#err_address").html(""); } if ( phone_number == "" || phone_number.length != 11 ) { $("#err_phone_number").html("Please enter a valid phone number !"); } else { $("#err_phone_number").html(""); } //href="https://www.boibazar.com/payment" } }); $("#shippingLogged").click(function() { var CartId = document.getElementById("cartId").value; localStorage.setItem("presentCart", CartId); // Put the object into storage var AddressId = document.getElementById("shippingId").value; localStorage.setItem("presentAddress", AddressId); // localStorage.setItem("tempAddress", JSON.stringify(tempAddress)); }); // function delete_cookie(name) { // document.cookie = name + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; // }

Top Articles

You might also like

Latest Posts

Article information

Author: Moshe Kshlerin

Last Updated: 11/18/2022

Views: 5882

Rating: 4.7 / 5 (77 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Moshe Kshlerin

Birthday: 1994-01-25

Address: Suite 609 315 Lupita Unions, Ronnieburgh, MI 62697

Phone: +2424755286529

Job: District Education Designer

Hobby: Yoga, Gunsmithing, Singing, 3D printing, Nordic skating, Soapmaking, Juggling

Introduction: My name is Moshe Kshlerin, I am a gleaming, attractive, outstanding, pleasant, delightful, outstanding, famous person who loves writing and wants to share my knowledge and understanding with you.