301 Moved Permanently means that the requested resource has been permanently moved to a new URL. All future requests should use the new address.
The browser will automatically redirect the user to the new address, and search engines will update their indexes.
200 OK is a standard successful HTTP server response. It means that the client’s request (e.g., from a browser) was successfully processed, and the server is delivering the requested data.
The user receives content without errors, and the page or application functions properly. If Code 200 is accompanied by data, the browser or program processes and displays it to the user.
GET / HTTP/1.1 Host: subs2.com Accept: */* User-Agent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head id="Head1"> <script src="js/GoogleTagManager.js?v=d" type="text/javascript"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-64692915-4"></script> <script type="text/javascript" src="https://web.squarecdn.com/v1/square.js"></script> <script src="https://cdn.polyfill.io/v3/polyfill.min.js"></script> <script type="text/javascript" src="https://checkout.clover.com/sdk.js"></script> <script> window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag('js', new Date()); gtag('config', 'UA-64692915-4'); </script> <link rel="icon" type="image/png" href="images/Favicon.png" /><meta name="viewport" content="width=device-width, initial-scale=1" /><meta name="robots" content="NOODP,NOYDIR" /><link href="/bundles/commonCss?v=k5hQRdkT_Hs_iPGvEbQha5vkLyrgNxXeB1gu-veatFM1" rel="stylesheet"/> <link href="/bundles/orders/Css?v=kH7kWUHWTZ1VXHQ-84s9H9aEik8BW7pIzxUVPu6ACPY1" rel="stylesheet"/> <script src="/bundles/orders/JS?v=xnlvxl5zH7NexsUa0s10ON3b4KWjOtD-M7R2zc8Bxpk1"></script> <script type="text/javascript"> var _siteRoot = 'Default.aspx', _root = 'Default.aspx'; </script> <link rel="stylesheet" href="css/colorpicker.css" type="text/css" /> <script src="js/vanilla-picker.js"></script> <script src="js/pickermain.js"></script> <style type="text/css"> .pickupdropdownstyles11{width:100px;} .removeshadow{box-shadow:none !important;} .lbldescriptiontitle { text-align: left; color: black; font-size: 18px; font-weight: 500; font-family: Franklin Gothic; } .menuitemname { color: #6c6c6c; text-align: center; font-size: 20px; width: 96%; font-weight: 600; margin: 0 auto; padding: 10px; } .itemnamest{height:auto;} .itemdesc{height:auto;} .itemnametxt { text-overflow: ellipsis; white-space: nowrap; height: 30px !important; margin: 0 auto; width: 100%; display:block !important; } .category-title{width:98%;margin:0 auto;overflow:auto;} .category-titletxt{float:left;} .backcategory-titletxt{float:right;margin-top:15px;} .previewframe { width: 100%; border: none; height: 100%; } .smartphone { position: relative; width: 400px; height: 630px; margin: auto; border: 16px rgb(208, 208, 208) solid; border-top-width: 60px; border-bottom-width: 60px; border-radius: 36px; margin-top:15px; margin-bottom:15px; } .smartphone .content { width: 400px; height: 630px; background: white; } .webview { height: 50px; margin-top: 30px; background-color: white; text-align:center; display:none; } .wrappercs{display:block !important;} .mobilewebview { height: 50px; margin-top: 30px; background-color: white; text-align:center; display:block; } .desktopview { width: 50px; height: 30px; object-fit: contain; border-right: 1px solid black; padding: 0 20px; cursor: pointer; margin-top: 10px; } .mobileview { width: 50px; height: 30px; object-fit: contain; padding-left: 20px; cursor: pointer; margin-top: 10px; } .viewalldiv { width: 96%; margin: 0 auto; text-align: right; padding-top: 25px; padding-bottom:5px; overflow:auto; } .viewtxtbtn { border: none; font-size: 20px; text-decoration-line: underline; /*color: blue;*/ text-align: right; } .subitemsdiv{width:100%;overflow:auto;} .allitemimage { width: 100%; /*border-radius: 10px;*/ height: 300px; border:1px solid; object-fit:contain; cursor:pointer; } .mncatlft:hover{ color:transparent; } .Categorytitle{ text-align:center; overflow:auto; font-size:30px !important; font-weight:bold; padding:20px 0px; } .addcategoryloadingimage { position: absolute; width: 85%; margin:0 auto; } .addcategoryloadingimage1{width: 85%;} .itemsbtndiv{ padding:10px 15px; border:none; border-radius:10px; background-color:red; color:white; cursor:pointer; font-size:16px; } .allcatdivs input{ padding:10px 15px; border:none; border-radius:10px; background-color:red; color:white; cursor:pointer; font-size:16px; } .textsdiv{margin-right:25px;line-height:1.5;padding-bottom:15px;} .eachcategory{width:25%;float:left;margin:10px 0px;} .eachsubcategoryitems{width:25%;float:left;} .eachsubcategoryrow{width:100%;overflow:auto;} .eachcatrow{overflow:auto;} .catname { text-align: center; font-size: 30px !important; font-weight: 600; color: black; padding:20px 0px; } .subcatname { text-align: left; font-size: 20px; color: black; /* margin-left: 70px; */ padding: 10px 0px 10px 10px; width: 99%; overflow: auto; margin: 15px 0px; } .subcatcdes{ text-align: left; font-size: 12px; color: black; padding: 5px 0px 5px 0px; overflow: auto; word-break:break-word; } .subsubcatname { text-align: left; font-size: 20px; color: black; margin-left: 200px; padding: 10px 0; } .line-clamp { word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; height:auto; } .itemimgdiv{text-align:center;border-radius:10px;margin:15px 25px 15px 0;height:300px;} .flowoptbtns { cursor: pointer; width: auto; padding: 10px; background-color: lightgray; color: white; border-radius: 10px; } .flowbuttons{width:70% !important;margin-bottom:10px;} .Choicetdimg { float: left !important; margin-right: 10px; } .choiceimage{width:50px;margin-left:10px;margin-top:-5px;} /*.yurcrt::-webkit-scrollbar { -webkit-appearance: none; }*/ .yurcrt{ width:99%; height:420px; } .pnlpromoimg { text-align: center; width: 100%; margin-bottom: 15px; margin-top: 15px; } .pnlpromoimg img { text-align: center; width: 100%; height: 150px; object-fit: contain; } .signinstrht{margin-top:6px;} #lblitemimage{object-fit:contain;} .Collapseimg{cursor:pointer;} .previewtdtitle td { width: 100%; float: right; } .PreviewOptionTabletr { width: 100%; display: inline-table; } #PreviewOptionTable { width: 75%; margin: 0 auto; border: 2px solid darkgray; padding: 10px; } .dropdowncstable tr { width: 50%; float: left; } .mncatlft{box-shadow:0 0 0 3px #e5e5e5;} .itemflowcolumns { text-align: center; display: none; width: 96%; overflow: auto; margin: 0 auto; /*margin-bottom: 20px;*/ } .itemflowqty { width: 126px; height: 46px; border-radius: 5px; text-align: center; margin: 0 auto; } .itemflowitemname{margin-top:20px;} .itemflowitemname, .itemflowprice { font-size: 24px; color: black; font-weight: 100; } .itemflowcolumnslft { overflow: auto; width: 50%; float: left; text-align: center; display: none; } .itemflowcolumnsrgt { overflow: auto; width: 50%; float: left; text-align: center; margin: 0 auto; } .ddlOption { -webkit-appearance: none; border-radius: 5px; padding: 0 25px 0 5px; background-image: url(/images/dropdownarrow.png); background-repeat: no-repeat; background-size: 15px 20px; height: 35px !important; background-position: right; } .ddlChildOption { -webkit-appearance: none; border-radius: 5px; padding: 0 25px 0 5px; background-image: url(/images/dropdownarrow.png); background-repeat: no-repeat; background-size: 15px 20px; height: 35px !important; background-position: right; } .backoptionsloader{text-align:center;display:none;} .backtooptions { float: left; font-size: 35px; margin-left: 10px; cursor: pointer; display: none; width: 3%; } .itemmainleft { width: 90%; } .btncomboloaderdiv{float:left;width:36%;} .comboloadrdloader{float:left;height:25px;} .btnmakeitcombo{float:left;width:auto;} .PreviewOptionTable table{width:100%;} .previewOptions { width: 98%; margin: 0 auto; padding: 5px 10px; text-align: right; margin-bottom: 8px; } .reviewtxtquantity { text-align: center; font-size: 20px; color: black; float:left; } .itemnamecss { text-align: center; font-size: 20px; color: black; float: right; } .previewtitle {font-size: 20px; font-weight: 600; color: black;} .previewtdtitle {font-size: 14px; font-weight: 600; color: black;} #itminfonew tbody{display:inline-table;width:100%;} .yourordersteststyles tr td {line-height:1; } .cartheight{max-height:initial;} .crtordbtn {text-align:center;} .placeorder { margin-left: 0;font-size:27px !important; } .placeorderloaderdiv{display:none;height:80px;} .placerdloader{margin-top:10px;} .placeorderspan{width:200px;text-align:center;} .checkoutloaderdiv{display:none;} .checkrdloader{margin-top:10px;} .loadrdloader{vertical-align:bottom} #btnloader { padding: 12px 50px; } .passwordlabels { width: 25px; margin-left: -25px; vertical-align: middle; cursor: pointer; position: absolute; margin-top: 6px; } .userregistrer_formtext1Error{margin-bottom:10px;} #imgpwd{margin-top:6px;} .btnloaderdiv{float:right;margin-top:13px;display:none;} .ordfsht .finishorder{width: 170px; padding: 0 10px;} #CloverPanel iframe { height: 35px !important; } .clover-footer { display: none; } .contentdescrdiv { width: 90%; height: 250px; position: relative; background-color: #fff; height: 270px; margin: 20px; text-align: center; } .contmenubar { width: 35px; height: 4px; margin: 5px 0; transition: .4s; } .itemstyle{overflow:hidden;} .laodpages { overflow: auto; width: 100%; margin: 0 auto; height: auto; padding:5px 0; } .loadpagemain{float:left;width:90%;} .contentmenudiv{float:right;width:7%;cursor:pointer;margin-top:10px} .pagename { font-size: 18px; font-weight: 600;padding: 5px 20px; border-bottom: 1px solid rgba(254,0,0,0.2196078431372549);cursor:pointer; } .hmlgin #lblEmail{float:left;margin-right:0px;} .hmusimg{margin-top:2px} .showuserimage1{margin-right:0px} .dineintable tr td{padding-bottom:10px;font-size:17px;} .itembackborderdinein { background-color: white; border-bottom: 2px solid gray; } .dineintable{margin:0 auto} #txtdinefname{width:200px;height:30px} #txtdineemail{width:200px;height:30px} #txtdinephn{width:200px;height:30px} #txtdinetable{width:200px;height:30px} #txtdinelname{width:200px;height:30px} .dineintable tr{width:100%;margin:0 auto;} .dineintabletd{float:left;width:30%;text-align:left;} #modaldelivery{height:auto;} .deliveryHeading{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;} .Advanceclass{font-size:20px;color:#898989;font-weight:500} .icbsignin h1{width:96%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:26px} #userpopup-behind{left:523px} .customwebtop{margin-top:-25px;zoom:90%;-moz-transform:scale(0.8)} body{overflow-x:hidden;background:0} #wrapper{display:none} .fcontainer{display:none} .popupdisplay{display:none} .popupdisplay2{display:none} #tblUserDrivers input[type="checkbox"]{opacity:0;position:absolute;display:none} #tblDrivers input[type="checkbox"]{opacity:0;position:absolute;display:none} #tblUserDrivers input[type="checkbox"]+label{background:url(images/checkboxnormal_blue.png) left center no-repeat;padding-left:20px;background-size:18px 18px} #tblDrivers input[type="checkbox"]+label{background:url(images/checkboxnormal_blue.png) left center no-repeat;padding-left:20px;background-size:18px 18px} #tblUserDrivers input[type="checkbox"]:checked+label{background:url(images/checkboxchecked_blue.png) left center no-repeat;padding-left:20px;background-size:18px 18px} #tblDrivers input[type="checkbox"]:checked+label{background:url(images/checkboxchecked_blue.png) left center no-repeat;padding-left:20px;background-size:18px 18px} #OptionTable input[type="radio"]{opacity:0;position:absolute} #OptionTable input[type="radio"],#OptionTable input[type="checkbox"]{display:none} #OptionTable input[type="radio"]+label{background:url(/images/radiounchecked.png) left center no-repeat;padding-left:25px;background-size:18px 18px;display:block} #OptionTable input[type="radio"]:checked+label{background:url(/images/radiochecked.png) left center no-repeat;padding-left:25px;background-size:18px 18px} #OptionTable input[type="checkbox"]{opacity:0;position:absolute} #OptionTable input[type="checkbox"]+label{background:url(/images/chkunchecked.png) left center no-repeat;padding-left:25px;background-size:18px 18px;display:block} #OptionTable input[type="checkbox"]:checked+label{background:url(/images/chkchecked.png) left center no-repeat;padding-left:25px;background-size:18px 18px} #ui-datepicker-div{z-index:2000} .tooltipDemo{width:30px;height:30px} .tooltipDemo2{width:30px;height:30px} .Choicetext{height:70px;width:300px;border:1px solid #b9bcbe;box-shadow:0 1px 3px rgba(0,0,0,0.2) inset} .tooltipDemo21{width:30px;height:30px} .divminheight{overflow:auto;height:auto} .divhead{padding-top:34px} .divhead1{padding-top:5px} div.fileinputs{border-style:solid;border-color:inherit;position:relative;border-width:.1em;width:215px;top:1px;left:-1px} div.fakefile{position:absolute;top:0;left:0;z-index:1} input.Catfile{position:relative;text-align:right;-moz-opacity:0;filter:alpha(opacity:0);opacity:0;z-index:2;height:240px;width:212px;top:0;left:0} input.Catfile:hover{cursor:pointer} .imagecenter{padding:10px} .rating_filled{background-image:url(Images/RatingOver.png)} .rating_empty{background-image:url(Images/RatingNormal.png)} .rating_filled1{background-image:url(Images/RatingOver.png)} .rating_empty1{background-image:url(Images/RatingNormal.png)} .reviewtest:hover{text-decoration:underline} #btnBusiness{background-image:url(/images/edit_survey.png);background-size:18px 18px;background-repeat:no-repeat;background-position:5px 5px;border:0;background-color:#c33b2d;color:white;padding:5px 10px;border-radius:2px;cursor:pointer} .ChoicesQuantity{width:50px;height:20px;border:1px solid #b9bcbe;border-radius:2px;padding-left:5px;color:#787878;vertical-align:middle;box-shadow:0 1px 3px rgba(0,0,0,0.2) inset} textarea{resize:none} .hmsign:hover{background-color:white} .footsealcate{width:30%;display:none} .crosssellitemspanelopen {width: 780px;left:22%; } .divitems {width: 100%;text-align: center;} .bstimeslider2 {height: 270px; } #viewContainer2 {height: 90%;} .proitemdiv {width: 218px; margin-left: 12px;} .imgscroll{width:150px;} .itemname{text-align:center;} .itempri{text-align:center;} .addbutton{text-align:center;} .tablebtn{margin: 0;width: auto;cursor: pointer;padding: 5px 10px;} .instructdata {margin-top: 8px;font-size: 14px;color: black;text-align: center;} .welbackright{padding-right:0;} .orderemorgimg{width:100px;} .Menuoptionname{width:50%;float:left;} .Choicetd1{padding-bottom: 8px;Height: 1px;width:23%;text-align: left;border-top: none;border-right: none;} .Choicetd2{Padding-Bottom: 8px;Height: 1px;Width: 33%;text-align: left;border-top: none;border-right: none} /*.optionname{font-size: 14px;color: darkgrey;font-weight:bold;width:50%;float:left;}*/ .optionname {font-size: 14px;color: darkgrey;font-weight: bold;width: 50%;display:inline-block;/*float: left;*//*padding-left: 44px;*/} .Choicetd{width: 61%;padding-left:30px;} .itemdescriptionstyles{width:710px;} .itemdescriptionstyles{padding-left:45px;} .optionrow{background-color: rgb(255, 255, 255);} .pricesize{margin-left: 30px;} .Optiontd {width: 50%;text-align: left;border-bottom: none;border-top: none;height: 30px;/*background-color: #dfe1e0;*/padding: 0 10px;border-bottom:none;} .Choicetd {Padding-Bottom: 8px;Height: 1px;Width:100%;text-align: left;border-top: none;border-right: none;padding-left: 15px;padding-top: 10px;} .msselection {Padding-Bottom: 8px;Height: 1px;Width: 100%;text-align: left;border-top: none;border-right: none;padding-left: 20px;font-weight: bold;} .itemclose {cursor: pointer;background: #9d9d9d;color: white;border-radius: 50%;font-size: 18px;border: none;padding: 5px 10px;float: right;margin-right: 18px;width: 75%;} .videotext {border-radius: 40px;font-size: 20px;} /*.itemqtyamt {height: 40px;}*/ .txtinstructions {height: 35px;width: 91%;font-size: 16px;background-color: #ffffff;text-align: left;padding-top: 10px;padding-left: 30px;border: 2px solid #eeeded;color: darkgrey;border-radius: 5px;} .selecttop {color: grey;padding-left: 28px;font-size: 18px;font-weight: bold;} .OptionTable {overflow: auto;color: rgb(108, 108, 108);font-size: 18px;} #tblOrderTypes { table-layout:fixed; word-break:break-all; } .emptycarttext{ margin: 0 auto; padding: 20px; font-size: 16px; width: 90%; } .couponsdivstyles { width: 100%; height: 65px; line-height: 60px; color: #6c6c6c; font-size: 25px; background-color: #d0d0d0; } .coupontitile { width: 90%; text-align: center; padding-top: 3px; font-size: 1.5em; float: left; font-weight: 600; } .hoursdivstyles { width: 100%; height: 65px; line-height: 60px; color: #6c6c6c; font-size: 25px; background-color: #d0d0d0; } .hourstitile { width: 90%; text-align: center; padding-top: 3px; font-size: 1.5em; float: left; font-weight: 600; } .temlogoleft { width: 55px; position: absolute; right: calc(100% - 73%); margin-top: 4px; z-index: 900; color: red; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; font-size: 11px; } .promcartcharity{position:relative;} .ordqntytxt{font-weight:600;width:32px;} .ordfsht .finishorder{width: 170px; padding: 0 10px;} .signinpanel{position:relative} .CompanyRegistrepnl{position:relative;z-index:1000} .UserDeliveryPanel{position:relative;z-index:1000} .OrderprocessingPanel { position: relative; z-index: 1000 } .munchiesAmount {padding-top: 0px;} .mnupp { width: 0; border-width: 0px 8.5px 8.5px; border-color: transparent transparent #d8d8d8; border-style: dashed dashed solid; top: 39px; right: 0px; z-index: 2000; opacity: 1; position: absolute; } .menupopup { position: absolute; width: 14rem; top: 45px; right: 0px; background: #ccc; z-index: 10; opacity: 1; box-shadow: rgb(28 28 28 / 15%) 0px 2px 8px; transform: translateY(5px); transition: transform 0.25s ease 0s, opacity 0.25s ease 0s; overflow: hidden; } .opt-menu { border-bottom: 1px solid #fff; padding: 12px 0px; } .deleteitems{position:absolute;right:22px;top:12px} .itemsearchicon{position:absolute;top:20px;right:15px} .opt-menu a { text-decoration: none; color: #000; padding: 5px 0px 5px 40px; } .hmhdrt1 ul { margin: 0; padding: 0; display: -webkit-box; display: -ms-flexbox; display: -webkit-flex; display: flex; list-style: none; align-items: center; float:right; } .hmhdrt1 ul li { list-style-type: none; } .hmhdrt1{padding:14px 0px} .hmheaderleft{padding:9px 0} #menupopup ul li a:hover { color: white; text-decoration: none; } #menupopup div a:hover { color: #fff; text-decoration: none; } .opt-menu:hover { background-color: #E00000; color: white; cursor: pointer; } .hmheadersub{padding:0px 0px} .myaccount{padding:5px 55px 5px 40px !important;background-position:5px 0px} .myaccount:hover{background-position:5px 0px} .vieworders{padding:5px 66px 5px 40px !important;background-position:5px 0px} .vieworders:hover{background-position:5px 0px} .trackorder{padding:5px 28px 5px 40px !important;background-position:5px 0px} .trackorder:hover{background-position:5px 0px} .favoriter{padding:5px 55px 5px 40px !important;background-position:5px 0px} .favoriter:hover{background-position:5px 0px} .bookedtables{padding:5px 33px 5px 40px !important;background-position:5px 0px} .bookedtables:hover{background-position:5px 0px} .lnkbtnSignOut{padding:5px 82px 5px 40px !important;background-position:5px 0px} .lnkbtnSignOut:hover{background-position:5px 0px} #imgarrow{margin-top:3px} .hmlgimg{height:52px !important;object-fit:contain} .hmhdlt{padding-top:18px;} /*Right panel*/ .hmrtpnl { background: rgba(0,0,0,0.4); width: 100%; position: fixed; top: 0; z-index: 200; right: -100%; transition: all 50ms ease-in; height: 100%; } .hmrtpnlmdl { background-color: #fff; color: #5d5d5d; width: 280px; position: absolute; right: 0; height: 100%; overflow-x: hidden; overflow-y: scroll; transition: all 300ms ease-in; padding-top: 25px; margin: 0 -300px 0 0; z-index: 200; } .hmrtclmn { float: right; cursor: pointer; margin-right: 10px; } .hmrtclmn img { width: 35px; } .hmrtpnltxt { font-size: 16px; width: 100%; padding: 30px 0; } .hmrtpnltxt h2 { font-size: 20px; padding-left: 10%; margin: 0; margin-bottom: 10px; margin-top: 10px; } /*Vehicle styles*/ .vehiclediv{ width: 550px; left: 25%; border: 0 none; border-radius: 10px 10px 0px 0px; position: absolute; z-index: 1000; top: 200px; background-color: #fff; } .ttldiv { width: 100%; border-radius: 7px 7px 0 0; min-height: 60px; background-color: darkred; } .hdttltext{ float: left; color: #fff; font-size: 20px; width: 80%; margin-left: 10px; margin: 18px; text-align: center; } .titletxt{ overflow: hidden; white-space: nowrap; text-overflow: ellipsis; word-wrap: break-word; width: 100%; display: inline-block; } .closevehiclediv{ float: right; margin: 10px; margin-top: 22px; } .vehiclepnlclosebtn{ width: 60px; padding: 8px 12px; font-size: 14px; font-weight: bold; color: #fff; background-color: darkred; border: 3px solid #fff; border-radius: 50%; cursor: pointer; } .imgvehicletype{width:50px;height:50px} #tblvehicletype tr{ font-size: 14px; color: darkgrey; font-weight: bold; width: 100%; display: inline-block; } #tblvehicletype tr td{ padding-bottom: 8px; height: 1px; width: 60%; text-align: left; border-top: none; border-right: none; padding-left: 15px; padding-top: 10px; } #tblvehicleclr tr{ font-size: 14px; color: darkgrey; font-weight: bold; width: 100%; display: inline-block; } #tblvehicleclr tr td{ padding-bottom: 8px; height: 1px; width: 60%; text-align: left; border-top: none; border-right: none; padding-left: 15px; padding-top: 10px; } #tblvehicletype{margin:auto;width:55%} #tblvehicletype input[type="radio"] { opacity: 0; position: absolute; } #tblvehicletype input[type="radio"]:checked+label { background: url(/images/radiochecked.png) left center no-repeat; padding-left: 25px; background-size: 18px 18px; } #tblvehicletype input[type="radio"]+label { background: url(/images/rbtnormal.png) left center no-repeat; padding-left: 20px; background-size: 18px 18px; display: block; } #tblvehicleclr{margin:auto;width:30%} #tblvehicleclr input[type="radio"] { opacity: 0; position: absolute; } #tblvehicleclr input[type="radio"]:checked+label { background: url(/images/radiochecked.png) left center no-repeat; padding-left: 25px; background-size: 18px 18px; } #tblvehicleclr input[type="radio"]+label { background: url(/images/rbtnormal.png) left center no-repeat; padding-left: 20px; background-size: 18px 18px; display: block; } .othervehicletype{ width: 100px; padding: 8px 10px !important; border: 1px solid #ccc; border-radius: 5px; display:none; } .containers{ background: red; background-image: conic-gradient(orange,pink,red, yellow, green, blue, black,grey,gold,silver,cyan); border-radius: 50%; width: 50px; height: 50px; margin-left: 10px; /* position: absolute; */ z-index: 999; margin-bottom: 0px; } .ddlvhicleimg{width:50px;height:50px;} .dropdown-content { display: none; position: absolute; background-color: #f9f9f9; min-width: 250px; box-shadow: 0px 8px 16px 0px rgb(0 0 0 / 20%); padding: 2px 16px; z-index: 1; height: auto; max-height: 200px; overflow-y: auto; overflow-x: hidden; width:85%; } .tblAllVehicleDetails{width:100%;} .tblAllVehicleDetails tr td { padding: 5px 0px; } .ddlcntnrvhcldiv{ display:flex; } .ddlvhcleclrdiv{ width: 30px; height: 30px; border-radius: 50%; background-color: #c0c0c0; border: 1px solid #ccc; margin-left: 3px; } .subcntnrvhcldiv{ text-align: center; line-height: 1.5; } .rdovhcltype{ opacity: 0; position: absolute; } .divvehicletype{ padding: 18px 0px; width: 100px; word-break: break-all; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } .allsubcatitems{display:none;} .mncatcncl{width:170px;} #divslctvhcldtls:after { content: "▼"; font-size: 0.8rem; pointer-events: none; /* ▼ click triggers dropdown */ position: absolute; right: 0.2rem; top: 0.3rem; z-index: 1; margin:8px 5px; } .vehicledetlsdiv{position:relative} .divvehicle{ max-height: 550px; overflow-y: auto; } .popup.popup_right{top: 38px; right: 0% !important; left: -247px;} .picker_wrapper.popup .picker_arrow::before{width:0px !important} /* Slideshow container */ .slideshow-container { max-width: 100%; position: relative; margin: auto; } .slideshow-container img {vertical-align: middle;} /* Next & previous buttons */ .prevImage, .nextImage { cursor: pointer; position: absolute; top: 50%; width: auto; padding: 16px; margin-top: -22px; color: white; font-weight: bold; font-size: 18px; transition: 0.6s ease; border-radius: 0 3px 3px 0; user-select: none; text-decoration:none; } /* Position the "next button" to the right */ .nextImage { right: 0; border-radius: 3px 0 0 3px; background-color:#ccc; } .prevImage{background-color:#ccc;} /* On hover, add a black background color with a little bit see-through */ .prevImage:hover, .nextImage:hover { background-color: rgba(0,0,0,0.8); text-decoration:none; } .fadeImage { animation-name: fade; animation-duration: 1.5s; width:45px; height:45px; margin:5px auto; border:1px solid #ccc; cursor:pointer; border-radius:5px; } .bg-show{ border:2px solid #007185; } .divscroll{ height: 320px; overflow: hidden auto; max-height: 320px; } /* width */ .divscroll::-webkit-scrollbar { width: 5px; } /* Track */ .divscroll::-webkit-scrollbar-track { background: #f1f1f1; } /* Handle */ .divscroll::-webkit-scrollbar-thumb { background: #888; } /* Handle on hover */ .divscroll::-webkit-scrollbar-thumb:hover { background: #555; } .item-sub-image { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-position: center; background-size: contain; background-repeat: no-repeat; -webkit-transition: -webkit-transform .5s ease-out; transition: -webkit-transform .5s ease-out; transition: transform .5s ease-out; transition: transform .5s ease-out,-webkit-transform .5s ease-out; cursor:zoom-in; } @keyframes fadeImage { from {opacity: .4} to {opacity: 1} } .share-sub-div{ opacity: 1; transform: translateY(5px); transition: transform 0.25s ease 0s, opacity 0.25s ease 0s; overflow: hidden; cursor:pointer; display:flex; align-items:center; justify-content: end; width: 90%; margin: 0 auto; } .sharesvg{width:20px;height:16px} .spnsvgicon{display:flex;align-items:center;font-weight:600;font-size:18px;color:#6c6c6c} .spnsvgicon:hover{color:blue !important} .spnsvgicon:hover .sharesvgpath{fill:blue !important} .shareiconsdiv{ position: absolute; width: 48px; top: 50px; right: 0px; background: #fff; z-index: 10; opacity: 1; box-shadow: rgb(28 28 28 / 15%) 0px 2px 8px; transform: translateY(5px); transition: transform 0.25s ease 0s, opacity 0.25s ease 0s; overflow: hidden; } .shareiconsdiv ul{list-style:none;padding:5px} .shareiconsdiv ul li{padding:5px 0px} .highlight{display:block!important} .sharepanelmaindiv{top:228px !important;} .mncatnewpopupsub .yourordersteststyles{font-family:'Fjalla One', sans-serif;} .guuesttotal12{font-size:18px;font-weight:600} .mncatnewpopupsub .guuesttotal2 {height:25px;} .mncatnewpopupsub .cartrst {font-size:18px;font-weight:600;font-family:'Fjalla One', sans-serif;} .mncatnewpopupsub .urscart {padding-bottom:8px} .mncatnewpopupsub .notefordelivery {padding:0px 14px} .mncatnewpopupsub .signinoptdiv {font-family:'Fjalla One', sans-serif;} .register_lable{padding:0px;} .mncatnewpopupsub .register_lable {padding:0px 10px} .payment{line-height:30px} .ocstylesaggree{text-align:center;} .addmcls{height:auto;} .hidcart{line-height:initial;margin:10px 0px} .userstyleguest{width:76%} .welback{font-size:18px;font-weight:600} .welbackleft { padding-right: 0px; } .loginradiusfbstyles{font-size:20px} .signinst{ height: 50px; line-height: 50px; } .gmaildiv{ width: 284px; border: 2px solid #ccc; border-radius: 5px; margin: 10px auto; } .gmaildiv a{ display: flex; align-items: center; text-decoration: none; padding: 2px 5px; } .crtaccntbtnnew{ background-color: #fff !important; border: none; width: auto !important; border-bottom: 1px solid; border-radius: 0; font-size:16px; color:gray; } .forgtpwdlnk{ font-size: 16px; color: gray; text-align: center; vertical-align: middle; cursor: pointer; border-bottom: 1px solid; font-family:'Franklin Gothic' ! important; } #txtEmail,#txtPwd{width:260px;} /* On smaller screens, decrease text size */ @media only screen and (max-width: 300px) { .prevImage, .nextImage {font-size: 11px} } @media only screen and (min-width:768px) and (max-width:980px) { .hmhdrt1 { float: right; padding-top: 14px; width: 60%; } .hmheaderleft{padding-top:14px;} .businessaddress { font-size: 10px; text-overflow: ellipsis; margin-top: 10px; overflow: hidden; white-space: nowrap; width: 100px; } #lbllogotext{font-size:22px !important;} .pagename { width: 30%; } .eachsubcategoryrow { overflow: hidden; } .contentdescrdiv { height: auto; } .crosssellitemspanelopen { left: 2%; width:96%; } .backrestlist div p { min-width: 14%; } .backrestlist { font-size: 14px; } .productmanagement_formtext1 { color: #898989; } .emptycarttext { width: 220px; } .urscart { width: 100%; } .signinclose { width: 70%; } .itemdescriptionstyles { width: 610px; } #imgpwd{margin-top:8px;} .itemimgdiv{margin:0 auto} #trSearch{width:100%} .allitemimage{width:300px} .subcatname { width: 96% } .eachcategory { width: 48%; float: left; } .eachsubcategoryitems { width: 100%; float: initial; /* display: grid; */ } .itemimgdiv { margin: 0 auto; } .catname { font-size: 26px !important; } .menu { width: 90% !important; } .itemsearchicon{right:0} } @media only screen and ( max-width: 767px) { .businessaddress { float: none; margin-right: 0; text-align: center; } #txtEmail,#txtPwd{width:260px;} .hmhdrt1 ul { float: none; } .image-columdiv { width: 18% !important } .divscroll { height: 200px } .previewoderwidth { margin-top: -60px; } .itemflowqty { width: 87px; } .signinstrht { margin-top: 0px; } .closeitemdiv { position: absolute; width: 100%; text-align: right; margin-top: 15px; } .closeitempnl { margin-right: 10px; font-size: 30px; cursor: pointer; background-color: white; border: 1px solid white; border-radius: 20px; padding: 5px 10px; } .icbsignin h1{ padding-top:5px; } .txtinstructionscs { margin-bottom: 100px; } .itemnamecs { text-align: center; padding: 10px 0; font-size: 18px; font-weight: 600; } .pnlpromoimg img { text-align: center; width: 100%; height: 150px; object-fit: contain; } .shell1 { margin-top: 50px; } .hidcart { padding: 6px 0px; } .newsignmbl .userstyleguest { width: 255px } .welbackright { margin-top: 250px; } .icbsignin { min-height: 650px } #imgpwd { margin-top: 16px; } #btnloader { padding: 10px 30px; } .tbldeliveryhrs tr td { display: table-cell; } .itemsearchicon { float: unset; } .contmenubar { width: 30px; height: 4px; margin: 4px 0; transition: .4s; } .helptip:hover:after { width: 250px; height: 115px; margin-top: -125px; } .contentdescrdiv { height: auto; } .deleteitems { position: absolute; right: 4px; top: 48px } .itemsearchicon { position: absolute; top: 50px; right: 15px } .optionname { font-size: 14px; width: 100%; float: none; } .Choicetd { width: 33%; padding-left: 30px; } .itemdescriptionstyles { width: 100%; } .dineintable tr td { font-size: 14px; } .dineintable { width: 65%; margin: 0 auto } #tblbuttons { margin-top: 45px; } .emptycarttext { width: 95%; padding: 0; } .coupontitile { width: 90% } /*.itemqtyamt{width: 85px;}*/ .txtinstructions { height: 40px; font-size: 14px; padding-left: 28px; width: 86%; } .selecttop { font-size: 16px; } .itemunit .negativeqnty { height: 26px; margin-top: 4px; } .optionrow { width: 100%; border-radius: 5px; margin-top: 5px; font-size: 18px; } .ordqntymnlt { width: auto !important; } #btnaddtocart { font-size: 18px; height: 47px; } .signinclose { width: 35px; padding-top:5px; } .itmfxht { height: auto; max-height: none; } .itemdescriptionstyles { padding-left: 0px; } .signinpanel { position: inherit } .UserDeliveryPanel { position: inherit } .CompanyRegistrepnl { position: inherit } .OrderprocessingPanel { position: inherit } .vehiclediv { width: 98%; left: 1%; margin: 0; } .hdttltext { width: 70% } #divvehicledtls { width: 89%; } .popup.popup_right { top: 38px; right: 0% !important; left: -247px; } .picker_wrapper.popup .picker_arrow::before { width: 0px !important } #imgpwd { margin-top: 16px; } .crosssellitemspanelopen { left: 0 } .pickupdropdownstyles11 { margin-left: 0px } #ddlhr { margin-left: 21%; } .couponimg { width: 70px; } .hmmenu { position: absolute; right: 43px; } .hmrtpnlmdl { width: 280px; } .hmcrt { /*position: absolute;*/ right: 0px; margin-top: 10px !important; } .menupopup { left: 12px } .eachsubcategoryitems { width: 100%; float: initial; /*display:grid*/ } .itemimgdiv { margin: 0 auto } .allitemimage { width: 300px } .subcatname { width: 96% } .eachcategory { width: 100%; float: initial; } .subcatcdes { padding: 5px 0px 5px 2px; } .Categorytitle { font-size: 26px !important; } .catname { font-size: 26px !important; } .sharepanelmaindiv { top: 428px !important; width: 93% !important; } .share-sub-div { right: 30px } .fblogindiv{ margin-top: 238px !important; } .gmaildiv { width:226px; position: absolute; margin-top: 220px; left: 17%; } .loginradiusfbstyles{ width:70%; } .createstyles { margin-top: 154px !important; } .itemsearcherror{ width:88%; } .scrollcart { display: none; } } @media only screen and ( max-width: 475px){ .ordqntymnlt{ width:auto; } .ordqntymnlt1{ width:auto; display:inline-grid; float:none; } .ordqnty{ width:87px; } .ordqntylt{ font-size:20px; } .ordqntytxt{ width:20px !important; font-weight:600; font-size:16px !important; margin:4px; margin-top:8px; } .ordqntyrt{font-size:20px;} .munprice{font-size:18px;} #btnaddtocart{font-size:15px;width:100%} .vehiclediv { width: 98%; left: 1%; margin: 0; } .hdttltext{width:70%} .popup.popup_right { top: 38px; right: 0% !important; left: -247px; } .picker_wrapper.popup .picker_arrow::before{width:0px !important} #divvehicledtls{width:89%;} .share-sub-div{right:10px} } @media only screen and (min-width: 650px) and (max-width: 720px){ .gmaildiv { left: 29% !important; } .itemsearcherror { width: 94%; } .itemsearch { width: 94%; } } @media only screen and (min-width: 734px) and (max-width: 767px){ .gmaildiv { left: 31% !important; } .itemsearcherror { width: 94%; } .itemsearch { width: 94%; } } @media only screen and (min-width:981px) and (max-width:1024px) { .crosssellitemspanelopen{left:12%} } </style> <meta property="og:title" content="Hoagies Cafe | Orangeburg | Order Online" /><meta property="og:description" content="Hoagies Cafe – Locally owned and operated since 1978. Orangeburg's original sub shop. Often imitated but never duplicated. Subs and Salads - Orangeburg, SC Now available through the Hoagies Cafe App" /><meta property="og:type" content="Website" /><meta property="og:url" content="https://www.munchem.com/HOAGIESCafe" /><meta property="og:image" content="https://www.ecloudbiz.com/Services/DATA/18ea9422-0e63-4513-bef5-393191b54868/AppDetailsImages/18ea9422-0e63-4513-bef5-393191b54868AppIcon.jpg" /><meta property="og:image:secure_url" content="https://www.ecloudbiz.com/Services/DATA/18ea9422-0e63-4513-bef5-393191b54868/AppDetailsImages/18ea9422-0e63-4513-bef5-393191b54868AppIcon.jpg" /><meta property="og:image:width" content="500" /><meta property="og:image:height" content="500" /><meta property="twitter:card" content="summary" /><meta property="twitter:title" content="Hoagies Cafe | Orangeburg | Order Online" /><meta property="twitter:description" content="Hoagies Cafe – Locally owned and operated since 1978. Orangeburg's original sub shop. Often imitated but never duplicated. Subs and Salads - Orangeburg, SC Now available through the Hoagies Cafe App" /><meta property="twitter:type" content="Website" /><meta property="twitter:image" content="https://www.ecloudbiz.com/Services/DATA/18ea9422-0e63-4513-bef5-393191b54868/AppDetailsImages/18ea9422-0e63-4513-bef5-393191b54868AppIcon.jpg" /><title> Hoagies Cafe | Orangeburg | Order Online </title><meta name="description" content="Hoagies Cafe – Locally owned and operated since 1978. Orangeburg's original sub shop. Often imitated but never duplicated. Subs and Salads - Orangeburg, SC Now available through the Hoagies Cafe App" /><meta name="keywords" content="Hoagies Cafe American, Coffee and Tea, Deli, Gyro, Hoagies, Low Carb, Salads, Sandwiches, Subs" /></head> <body onclick="clicked=true;"> <link href="/css/GroupOrdering.css?ver=82202445&buildver=1.0.1" rel="stylesheet" /> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W9KRKZZ" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> <form name="form1" method="post" action="./HOAGIESCafe" onsubmit="javascript:return WebForm_OnSubmit();" id="form1"> <div> <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /> <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNjMxNDM0NTMxDxYEHgNBSWQoKVhTeXN0ZW0uR3VpZCwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5JDE4ZWE5NDIyLTBlNjMtNDUxMy1iZWY1LTM5MzE5MWI1NDg2OB4DTElkKCsEJGQ1YjliMTRmLWRkMGEtNDJlNy04Y2Q5LWFlMWEyZGY5MjQ3MBYEZg9kFgRmDxUCJmh0dHBzOi8vd2ViLnNxdWFyZWNkbi5jb20vdjEvc3F1YXJlLmpzImh0dHBzOi8vY2hlY2tvdXQuY2xvdmVyLmNvbS9zZGsuanNkAgQPFQNjPGxpbmsgaHJlZj0iL2J1bmRsZXMvY29tbW9uQ3NzP3Y9azVoUVJka1RfSHNfaVBHdkViUWhhNXZrTHlyZ054WGVCMWd1LXZlYXRGTTEiIHJlbD0ic3R5bGVzaGVldCIvPg0KZDxsaW5rIGhyZWY9Ii9idW5kbGVzL29yZGVycy9Dc3M/dj1rSDdrV1VIV1RaMVZYSFEtODRzOUg5YUVpazhCVzdwSXp4VVZQdTZBQ1BZMSIgcmVsPSJzdHlsZXNoZWV0Ii8+DQpbPHNjcmlwdCBzcmM9Ii9idW5kbGVzL29yZGVycy9KUz92PXhubHZ4bDV6SDdOZXhzVWEwczEwT04zYjRLV2pPdEQtTTdSMnpjOEJ4cGsxIj48L3NjcmlwdD4NCmQCAQ9kFlQCEQ8PFgIeBFRleHQFBWZhbHNlZGQCEg8PFgIfAgUFZmFsc2VkZAITDw8WAh8CBQR0cnVlZGQCFA8PFgIfAgUFZmFsc2VkZAIVDw8WAh8CBQpPcmFuZ2VidXJnZGQCFg8PFgIfAgUMSG9hZ2llcyBDYWZlZGQCFw8WAh4EaHJlZgUkaHR0cHM6Ly93d3cubXVuY2hlbS5jb20vL0hPQUdJRVNDYWZlZAIZDw8WAh8CBTUxODk5IFNUIE1BVFRIRVdTIFJELCBPcmFuZ2VidXJnLCBTb3V0aCBDYXJvbGluYSAyOTExOGRkAhwPDxYCHwIFCDEwIEhvdXJzZGQCHQ8PFgIfAgUBJGRkAiEPDxYCHwIFBUZhbHNlZGQCIg8PFgIfAmVkZAIjDw8WAh8CBQo4MDM1MzY5NzIwZGQCJg8PFgIfAmVkZAIrDw8WAh8CBQVUcnVlL2RkAi0PFgIeCWlubmVyaHRtbAUFRmFsc2VkAnQPDxYCHwIFBlBpY2tVcGRkAnwPDxYCHwIFATBkZAJ9Dw8WAh8CBQEwZGQCfg8PFgIfAgUIJCBBbW91bnRkZAKDAQ8PFgIfAgUEQm90aGRkAoUBDw8WAh8CBRU1LzE0LzIwMjUgMTA6MTk6MzUgUE1kZAKMAQ8PFgIfAgUOLTE4MDAwLjAwMDAwMDBkZAKNAQ8PFgIfAgUMMzYwMC4wMDAwMDAwZGQCjgEPDxYCHwIFB0tleUluZm9kZAKRAQ8PFgIfAgW4AUxvY2FsbHkgb3duZWQgYW5kIG9wZXJhdGVkIHNpbmNlIDE5NzguIE9yYW5nZWJ1cmcncyBvcmlnaW5hbCBzdWIgc2hvcC4gT2Z0ZW4gaW1pdGF0ZWQgYnV0IG5ldmVyIGR1cGxpY2F0ZWQuIFN1YnMgYW5kIFNhbGFkcyAtIE9yYW5nZWJ1cmcsIFNDIE5vdyBhdmFpbGFibGUgdGhyb3VnaCAgdGhlIEhvYWdpZXMgQ2FmZSBBcHBkZAKTAQ8PFgIfAgUKT3JhbmdlYnVyZ2RkApQBDw8WAh8CBQUyOTExOGRkApsBDw8WBB4NQWx0ZXJuYXRlVGV4dAUZSG9hZ2llcyBDYWZlIE9yZGVyIE9ubGluZR4ISW1hZ2VVcmwFjQFodHRwczovL3d3dy5lY2xvdWRiaXouY29tL1NlcnZpY2VzL0RBVEEvMThlYTk0MjItMGU2My00NTEzLWJlZjUtMzkzMTkxYjU0ODY4L0FwcERldGFpbHNJbWFnZXMvMThlYTk0MjItMGU2My00NTEzLWJlZjUtMzkzMTkxYjU0ODY4QXBwSWNvbi5qcGdkZAKcAQ8PFgIfAgVRQW1lcmljYW4sIENvZmZlZSBhbmQgVGVhLCBEZWxpLCBHeXJvLCBIb2FnaWVzLCBMb3cgQ2FyYiwgU2FsYWRzLCBTYW5kd2ljaGVzLCBTdWJzZGQCqwEPDxYCHwIFDVVuaXRlZCBTdGF0ZXNkZAKvAQ8WAh8EBRlIb2FnaWVzIENhZmUgLSBPcmFuZ2VidXJnZAK7AQ8WAh4HVmlzaWJsZWdkAr8BD2QWAgIFDxYCHgVzdHlsZQUMZGlzcGxheTpub25lZALNAQ9kFgJmDxYCHgpDYWxsYmFja0lEBQdSYXRpbmcxZALRAQ9kFgJmDxYCHwkFFURlbGl2ZXJ5U2VydmljZVJhdGluZ2QC7QEPDxYCHwIFDEhvYWdpZXMgQ2FmZWRkAvABDw8WAh8CZWRkAvcBDw8WAh8CBQxQaWNrIFVwIE9ubHlkZAL4AQ8PFgIfAmRkZAL6AQ8PFgIfAgUMQ2xvc2VkIHVudGlsZGQC+wEPDxYCHwIFHUhvdXJzIE9wZW4gOiAxMTowMCBBTS03OjAwIFBNZGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFggFCWNoa0RndWVzdAUJQ2hreWVzY2hrBQdjaGtjYXJkBRVjaGtsc3RvcmQkY2hrbHN0b3JkXzAFFWNoa2xzdG9yZCRjaGtsc3RvcmRfMQUVY2hrbHN0b3JkJGNoa2xzdG9yZF8yBRVjaGtsc3RvcmQkY2hrbHN0b3JkXzMFFWNoa2xzdG9yZCRjaGtsc3RvcmRfM3DOXbRHg1nfpuXQNzm7HFGvB2I9" /> </div> <script type="text/javascript"> //<![CDATA[ var theForm = document.forms['form1']; if (!theForm) { theForm = document.form1; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]> </script> <script src="/WebResource.axd?d=e92Q_BYS81GRHClt37eccKEMQxNnGH_rBiEFDcCjB6nM-Va343_degBgqMVWWhNv03_KPXbWyy-ZKuJV-1o3ul-q_aQ1&t=638568460745067788" type="text/javascript"></script> <script type = 'text/javascript'> window.onload=function(){alert('Restaurant is not available for ordering'); window.location.href ='Default.aspx';};</script> <script src="/ScriptResource.axd?d=z5H6A0ExFliNFcfQKmSbBJU58JhLAv8j7ClOZZ3M9utfNczT_RlxqR5cgodkHVvboTBvvr3NSoIbKal4G-Vg047GD0L2b-bScUrtEh0l_trzPrG0cQgGqOpTp7__we01hRlNMW3RZmLwzT2qQdA_yKq7Jnk1&t=7266186d" type="text/javascript"></script> <script src="/ScriptResource.axd?d=5zsryxxwLfiwSdf24LkwxaPDp9xDaTZ0RBvaQl9s4IEEkMTcOx71OrwvOhJiiulAndwdFgHsACR20txMBaHzR04j3GcAxmdlyHCGN5CqS9DTFXBL0PkZ_zhpJGln0KqSdRwOFVg4jxdcu54YlGlZdFUxI9CBbcCTYA4Z4Ddcp30mu_5V0&t=ffffffffc820c398" type="text/javascript"></script> <script src="/ScriptResource.axd?d=SYkdZsVaCk_MX9VvYhdyj3V4FTykGAjLT_gop1QhtDDJIdq1OOlLlREf8WSq76rv5q4v3gYB6fYVBTjgpHTYOx0aNyTX0aN2xa1e5U3-zy-fp-S9BzZisXwwm4DY_UiXeFVoX6MDzSnI72iJfTi-96gg0ubppPaA7HS03AGm7LkDx_Qc0&t=ffffffffc820c398" type="text/javascript"></script> <script src="/ScriptResource.axd?d=yVCMAV8Yrmun-vouWfWyfJi3kVPzd7O5lJOIk98OUaocd48mCfYGz-yRHP0Qk-E9YZvmwCT10vzkCP0029877CFzSWniHhCh3xhIyiF6aHhlfQnpi-qCjNPdtRO9CZT_V7oTZ16WmDctVnGO7nrmzgcUITY1&t=ffffffff9b7d03cf" type="text/javascript"></script> <script src="/ScriptResource.axd?d=s7Gt8UwGUg40ofnvzn6s30nrRQqTuD5c4pOwm2Nogghi_JZnsE5ML8B0CIZiqcKPwKtO1PcrrhEKPUuxuGMnN0rsAVRiCGgGB6cnrNaKLK64fUnMBOxxFSH9Q0Ze3K0t3Bv_pyEvrSvIMaoEQBgi2bby6gkQWg-g78K1caJPsOH31USL0&t=ffffffff9b7d03cf" type="text/javascript"></script> <script src="/ScriptResource.axd?d=-RaMs_hiXcifztfiYHoxiiUL_gN3QmLYtopAJHJSbLiHikrQ--s3oYLjyf6wgf-f-p5ojVEubZYGBAw2VoHQtXLuAfs13KtS3Z5XfTJzhBerkGETxHm9QIgkxALoWQFoUXxveInrMwlzTMx2ZC0OmRq8pzruOo_qS4SPi3gV8RPEdQVhxjZEOYDHBa_KqXPmlk9T-g2&t=ffffffff9b7d03cf" type="text/javascript"></script> <script src="/ScriptResource.axd?d=I0ZC7MGKSXhDxrevUX1A3mZC4BgrDBkjeAdeIeuOCg08FvRBdNktbubKJT2NcoLE253nKyvcxn0ygdMebHKbYHtwD2LlXOH7G6HxfBy0TUnM5tIH6yujYY8jXIZ8RNOAs19tmi47alH14woSw-XQdiSCDKaUNGIMkeNJPvZBqfXuWV8i0&t=ffffffff9b7d03cf" type="text/javascript"></script> <script src="/ScriptResource.axd?d=zmniRFcQt0OgRAg-qOLaP-1pwHseQJvdRAHG9BUMwGYc_qSJiPfBElSCWiwNQvokkGjIi_M39bnoqQ4pD_GdDFaTKldNdLLxXBTrS0Y_ksTfR7YnVM5JAlDxpDHiXAveQ4QddrDFVKaG4_f83zkj9Hewy8uvoynueJI1GdVFbBMunsSf0&t=ffffffff9b7d03cf" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ function WebForm_OnSubmit() { null;if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false; return true; } //]]> </script> <div> <input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="7EE84940" /> <input type="hidden" name="__SCROLLPOSITIONX" id="__SCROLLPOSITIONX" value="0" /> <input type="hidden" name="__SCROLLPOSITIONY" id="__SCROLLPOSITIONY" value="0" /> </div> <input type="hidden" name="lblAccessToken" id="lblAccessToken" /> <input type="hidden" name="lblguestodrbtn" id="lblguestodrbtn" value="True" /> <input type="hidden" name="lblMenuoptions" id="lblMenuoptions" /> <label id="lblCatering" style="display:none;"></label> <label id="promoimageexist" style="display:none;"></label> <label id="lblitemflowtype" style="display:none;"></label> <label id="lblAllowcart" style="display:none;"></label> <label id="lbldineintip" style="display:none;"></label> <label id="lblitemimagesrc" style="display:none;"></label> <label id="lblDefaultTipAmount" style="display:none;"></label> <label id="LimitTimestoASAP" style="display:none;"></label> <label id="lblEnableSignIn" style="display:none;"></label> <label id="lblRequiredEmail" style="display:none;"></label> <label id="lblRequiredPhone" style="display:none;"></label> <label id="lblRequiredName" style="display:none;"></label> <label id="lblRequiredLName" style="display:none;"></label> <label id="lblRequiredTableNo" style="display:none;"></label> <label id="lblusertype" style="display:none"></label> <label id="usertype" style="display:none"></label> <label id="lblbogovalidation" style="display:none"></label> <label id="lblallcattoallcat" style="display:none"></label> <label id="lblallcattoany" style="display:none"></label> <label id="lblanytoallcat" style="display:none"></label> <label id="lblbogocategoryid" style="display:none"></label> <label id="lblcategoryid" style="display:none"></label> <label id="lblbuyitemname" style="display:none"></label> <label id="lblgetitemname" style="display:none"></label> <label id="lblbuyitemid" style="display:none"></label> <label id="lblgetitemid" style="display:none"></label> <label id="lblAllowinstore" style="display:none"></label> <label id="lblCustomizedcash" style="display:none"></label> <label id="txtCustomizedcash" style="display:none"></label> <label id="lblbogoaddeditemid" style="display:none"></label> <label id="lblbogobuyitemname" style="display:none"></label> <label id="lblbogogetitemname" style="display:none"></label> <label id="lblVehicleDetails" style="display:none"></label> <label id="lblofferforcategoryid" style="display:none"></label> <span id="lblodelivery" style="display:none">false</span> <span id="lblcdelivery" style="display:none">false</span> <span id="lblopickup" style="display:none">true</span> <span id="lblcpickup" style="display:none">false</span> <label id="CrossSellPanelStatus" style="display:none;"></label><label id="GetCrossSellPanelStatus" style="display:none;"></label><span id="lbllocationname" style="display:none;">Orangeburg</span><span id="lblAppName" style="display:none;">Hoagies Cafe</span> <div id="wrapper" class="wrappercs" style="display:none;"> <div class="hmshell"> <div id="hmheader" class="hmheader" style="padding-top:0px"> <div class="hmheadersub container align-items-center" style="overflow:inherit"> <div class="hmheaderleft"> <div><a href="https://www.munchem.com//HOAGIESCafe" id="imglogohref"><img id="imglogo" class="hmlgimg" style="display:none; height:66px" /><span id="lbllogotext"></span> </a></div> </div> <div class="hmhdrt1"> <ul> <li><div class="hmlgin"> <label id="bntSignin" class="signin bntSignin hmsign" onclick="signinpanelopen('')" style="cursor:pointer;display:block;">Login / Sign Up</label> <label id="lblEmail" class="popupdisplay1 bg-danger rounded-circle" style="padding:5px 12px;font-weight:600;font-size:26px" onclick="subpanelopen()"></label> <img alt="User Image" id="userimage" class="hmusimg showuserimage1 popupdisplay1" src="images/photonotavailablepng.png" onclick="subpanelopen()" /> <div style="display:inline-block;position:relative;"><img id="imgarrow" src="/images/arrowdown.png" alt="Arrow" class="userdown popupdisplay1" /> <div id="mnupopup" class="mnupopup" style="display:none"> <div class="mnupp"></div> <div class="menupopup" id="menupopup" > <div class="opt-menu"><a href="MyProfile.aspx" class="myaccount">My Account</a></div> <div class="opt-menu"><a href="UserOrders.aspx" class="vieworders">My Orders</a></div> <div class="opt-menu"><a href="MyAppointments.aspx" class="bookedtables">My Reservations</a></div> <div class="opt-menu"><a href="Favorites.aspx" class="favoriter"> My Favorites</a></div> <div class="opt-menu"><a href="/TrackMyOrder.aspx" class="trackorder">Track My Order</a></div> <div class="opt-menu" onclick="SignOutOrder()"><a class="lnkbtnSignOut"><label style="cursor:pointer" class="" id="lnkbtnSignOut1">Sign out</label></a></div> </div> </div></div> </div></li> <li> </li> </ul> <p class="businessaddress"><span id="restaddr" class="appsclo">1899 ST MATTHEWS RD, Orangeburg, South Carolina 29118</span></p> </div> </div> </div> </div> <div class="shell"><span id="pickupdays" style="display:none"></span><span id="deliverydays" style="display:none"></span><span id="ordersupto" style="display:none">10 Hours</span> <span id="lblCurrency" style="display:none;">$</span><label id="popupsscroll" class="popupsscroll" style="display:none;"></label> <span id="lblscrolltop" style="display:none"></span><span id="lblscroll" style="display:none"></span> <span id="lblMainCategoryId" style="display:none"></span> <span id="lblcardconviencefee" style="display:none;">False</span> <span id="RestPhno" style="display:none"></span><span id="ContactNumber1" style="display:none">8035369720</span><span id="lblContactEmail" style="display:none"></span> <span id="lbldeliveryOrdernote" style="display:none"></span><span id="lblpickupOrdernote" style="display:none"></span> <input type="hidden" name="lblMenuTheme" id="lblMenuTheme" /><input type="hidden" name="lblMenuType" id="lblMenuType" /><input type="hidden" name="lblImageOrientation" id="lblImageOrientation" /> <label id="finishorderblb" style="display:none"></label><label id="Userfirstorderlbl" style="display:none"></label> <label id="lblmeligi" style="display:none"></label><label id="lblMyDrivers" style="display:none"></label><label id="lbldouplicate" style="display:none"></label><label id="lblcheckinmobile" style="display:none"></label><label id="lblbeforeorderafterorder" style="display:none"></label> <span id="lbldeliveryItemId" style="display:none"></span> <label id="BogoEditItem" style="display:none"></label><span id="lbliteminst" style="display:none">True/</span> </div> </div> <script type="text/javascript"> //<![CDATA[ Sys.WebForms.PageRequestManager._initialize('ScriptManager1', 'form1', [], [], [], 90, ''); //]]> </script> <div id="popuppanel" style="background-color:white" class="popupdisplay popupdisplay2"> <div id="userpopup-behind" class="userpopup-behindleft" ></div> <div id="userpopup" style="margin-left:78px;" > <div class="masterpopup masterpopupleft"><div class="popupdiv1"><div class="popupright" id="popup"> <ul> <li class="addclassmaster"> <a href="MyProfile.aspx" class="myaccount">My Account</a> </li> <li class="addclassmaster"><a href="UserOrders.aspx" class="vieworders">My Orders</a> </li> <li class="addclassmaster"> <a href="MyAppointments.aspx" class="bookedtables">My Reservations</a></li> <li class="addclassmaster"> <a href="Favorites.aspx" class="favoriter">My Favorites</a></li> <li class="addclassmaster"><a href="../TrackMyOrder.aspx" class="trackorder">Track My Order</a></li> <li class="addclassmaster"><a class="lnkbtnSignOut" onclick="SignOutOrder();">SignOut</a> </li></ul> </div></div></div></div> </div> <div class="orderalert"> <div class="alert-behind"></div> <div class="alertmain"><div class="alertsub"><label id="lblordalert"></label><div class=""><input type="button" value="OK" class="alertmnbtn" onclick="CloseAlertError()" /></div></div></div> <label id="lblIsPublished" style="display:none;">False</label> </div> <div class="ordererror"><div class="alert-behind"></div><div class="errormain"><div class="errorsub" id="lblorderror"></div></div></div> <div class="ordersuccess"><div class="successsub" id="lblordsucc"></div></div> <div id="CompanyRegistrepnl" class="CompanyRegistrepnl"><div id="modal-behind" class="companymodal"></div> <div id="modalregister" class="signinAdjustpanel"> <div class="signincontenet"> <div class="formtd_provider"> <div class="Homesignin icbsignin1" > <h1 align="center" class="useracc">Create An Account </h1><div> <img id="Img1" alt="Close" src="/images/IconCloseWindow.png" align="right" class="CompanyRegistreclose" onclick="CompanyRegisterClose()" style="cursor:pointer"/></div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr><td colspan="2" height="0px"></td></tr> <tr style="text-align:center"><td colspan="2"><label id="regerror" style="color:red;font-size:12px"></label><p class="samplep" style="display:none"></p></td></tr> <tr><td colspan="2" class="email_lableerrore" ><span id="lblStatus" class="error_message" style="color:Red;"></span> </td> </tr> <tr> <td class="createrightdiv"> <table class="createrightdiv"> <tr> <td colspan="2"> <div class="createwelback">The Coolest Thing You'll Do All Day</div> <div class="createwelback1">Creating an account lets you reorder, save and review restaurants.</div> </td></tr> <tr><td height="43px"><input name="txtFirstName" type="text" maxlength="50" id="txtFirstName" class="userregistrer_formtext1 tooltip" alt="" onfocusout="RegisterRemoveValidation(this);" placeholder="First Name" /> </td><td height="43px"><input name="txtLastName" type="text" maxlength="50" id="txtLastName" class="userregistrer_formtext1 tooltip" onfocusout="RegisterRemoveValidation(this);" placeholder="Last Name" /></td></tr> <tr><td height="43px"><input name="txtUserEmail" type="text" maxlength="110" id="txtUserEmail" class="userregistrer_formtext1 tooltip" onfocusout="RegisterRemoveValidation(this);" placeholder="Email" onchange="Trim(this)" /> </td><td height="43px"> <input name="txtPhonenumber" type="text" maxlength="13" id="txtPhonenumber" class="userregistrer_formtext1 tooltip" onfocusout="RegisterRemoveValidation(this);" placeholder="Phone Number" /></td> <td width="30px"> <div class="createaccountloader" id="Div5"><caption class="createaccountloader"><img alt="loading" src="images/OrderLoader.gif" ></img></caption></div></td></tr> <tr><td height="43px"><input name="txtPassword" type="password" maxlength="25" id="txtPassword" class="userregistrer_formtext1 pass1 tooltip" onfocusout="RegisterRemoveValidation(this);" placeholder="Password" /><img id="imgshowpwd" class="passwordlabels" src="/images/hidepassword.png" alt="show password" /></td><td height="43px"><input name="txtconformpsw" type="password" maxlength="25" id="txtconformpsw" class="userregistrer_formtext1 pass1 tooltip" onfocusout="RegisterRemoveValidation(this);" placeholder="Confirm Password" /><img id="imgconfirmpwd" class="passwordlabels" src="../images/hidepassword.png" alt="show password" /></td></tr> <tr> <td><select name="ddlusercountry" id="ddlusercountry" class="userregistrer_formtext1"> </select> <label id="lblusercountry" class="lblusercountry" style="color:red;font-size:14px;display:none;"></label> </td> <td style="display: block;"> <select name="ddlhearabout" id="ddlhearabout" class="userregistrer_formtext1 tooltip" onchange="Createhearabout();" onfocusout="RegisterRemoveValidation(this);"> <option value="How did you hear about us?">How did you hear about us?</option> <option value="Direct Mail">Direct Mail</option> <option value="Magazine/Ad">Magazine/Ad</option> <option value="Restaurant (Sign/Material/Menu)">Restaurant (Sign/Material/Menu)</option> <option value="Facebook/Social Media">Facebook/Social Media</option> <option value="Search Engine">Search Engine</option> <option value="Radio/TV">Radio/TV</option> <option value="Billboard">Billboard</option> <option value="Driver">Driver</option> <option value="Hotel VIP">Hotel VIP</option> <option value="Other">Other</option> </select> </td> </tr> <tr> <td></td> <td align="center"><input name="txtdrivername" type="text" maxlength="50" id="txtdrivername" placeholder="Name" Class="userregistrer_formtext1 tooltip" onfocusout="RegisterRemoveValidation(this);" onkeypress="return (event.charCode > 64 && event.charCode < 91) || (event.charCode > 96 && event.charCode < 123)" /> <textarea name="txtother" rows="2" cols="20" id="txtother" class="userregistrer_formtext1 tooltip " placeholder="Other" onfocusout="RegisterRemoveValidation(this);" onkeyDown="checkTextAreaMaxLength(this,event,'92');" style="width:300px;height:45px;"> </textarea> <input name="txtconname" type="text" maxlength="500" id="txtconname" class="userregistrer_formtext1 tooltip " placeholder="Referral Name" onfocusout="RegisterRemoveValidation(this);" /> </td> </tr> <tr><td colspan="2" class="lblactivate"><div class="activediv"><span id="lblactivate">Send confirmation code via:</span> <input class="msgcheck" id="msgcheck" type="checkbox" value="Text" name="Text" checked="true" style="width: 15px;height: 15px;"/> Text<input class="msgcheck1" id="msgcheck1" type="checkbox" value="Email" name="Email" checked="true" style="width: 15px;height: 15px;margin-left:10px"/> Email</div></td></tr> <tr><td colspan="2" class="creatlbl">By Creating an account, you agree to <a href="TermsofUse.aspx" target="_blank" style="color:#184da0">MunchEm's Conditions of Use</a> and <a href="PrivacyPolicy.aspx" target="_blank" style="color:#184da0">Privacy</a> Notice.</td></tr> <tr><td colspan="2"><input id="btnsubmit" type="button" class="crateaccbtn SignInButtonimg loginradiusfbstyles" value="Create Account" onclick="Registervalidation();" /><br /> <span class="allreadyacount">Already have an account? <a style="text-decoration:underline;color:gray;cursor:pointer;" onclick="signinpanelopen1();"> Sign In </a> </span></td></tr> <tr><td><label id="lblchkmsg" class="lblchkmsg" style="color:red;font-size:15px;display:none;padding-top:10px"></label></td></tr> </table> </td> </tr> </table> </div></div></div></div> </div> <div id="RegErrorPopup" class="RegErrorPopup" style="position: fixed; width: 100%; height:100%; top: 0; left: 0;display:none; background-color: rgba(0,0,0,0.7); padding-top: 0px; padding-left: -300px; z-index: 30004;"> <div id="Div44" class="CreateAccountconfirm"> <div> <img alt="close" src="images/productmanagementclosebut.png" onclick="Regclose();" class="signinclose" style="cursor:pointer;float: right;width: 10%;"/></div> <table align="center" style="vertical-align:middle; width:350px; text-align: center; font-size: 14px; color: black;"> <tr><td style="height:40px"> </td> </tr><tr><td colspan="2" align="center"><p class="regerrormsg"></p></td></tr> <tr><td><input type="button" value="Yes" id="confirmyes" class="confirmbtn" onclick="Sendforgetpwd();" /></td><td><input type="button" value="No" id="confirmno1" class="confirmbtn" onclick="ConfirmNo()"/></td></tr> </table> </div> </div> <div id="Activatepanel" class="Activatepanel " style="display:none"><div id="modal-behind"></div><div id="Activatemodal" class="signinAdjustpanel"> <div class="activateshell"><div class="icbsignin orderpgactivatepnl" style="width:100%"> <div class="signinst"><div class="signinstleft"><h1 align="center">Activate Your Account </h1> </div><div class="signinstrht"> <img alt="close" src="images/IconCloseWindow.png" onclick="ActivatePanelClose();" class="signinclose" style="cursor:pointer;"/></div></div> <div id="panelactivate"> <table width="100%" border="0" cellspacing="0" cellpadding="0" summary="User Login form" class="activatetable"> <tr> <td> <div id="divphnact"> <p>You're almost there!</p> <p>Check Your Texts For a Confirmation Code</p> <p>Complete your registration by entering<br /> the code below:</p> <div><span id="lblermsg1" class="error_message error_message1"></span><div class="activateloader" id="actdiv"> <img alt="loading" src="images/OrderLoader.gif"/></div></div> <div class="imgtxt"><div class="txtdiv"><input name="txtcode" type="text" maxlength="4" id="txtcode" class="txtwidth" placeholder="Activation Code" /><span id="RequiredFieldValidator11" style="color:Red;font-size:Large;visibility:hidden;">*</span></div> <div class="activatebtn"><input type="button" id="imgbtnactivate" onclick="ConformActivation()" class="activateimage1 activateimg" value="Activate" /></div></div> </div> <div id="divemlact"> <p>confirm by clicking the link in the<br /> email we sent you!</p> <p>If you activated by email sign in below:</p> <div class="signindiv"><input type="button" id="btnsignin" class="signiinnewbtn" value="Sign In" onclick="opensigninpanel()" /></div> </div> <div class="Activateresend"><label id="lnkresendtext" onclick="ResendText();" style="cursor:pointer"></label><br /> <label id="lnkresendmail" onclick="ResendEmail();" style="cursor:pointer"></label><span id="lblvalue" style="display:none"></span><span id="lblmsgcount" style="display:none"></span></div> </td></tr> </table> </div></div></div></div></div> <div id="OrderprocessingPanel" style="display:none" class="OrderprocessingPanel"> <div id="modal-behind" class="guestdeliverymodal"></div> <div id="modalsubmission" class="guestmdoal OrderprocessingPanelAdj"> <div class="gpickuporderstyles"><div class="Orderprocessingtitile"> Order Processing</div></div> <div class="Orderprocessingstyle"><img style="width:150px" src="images/MunchEm.png" alt="MunchEm"/><br /><br />Processing your order.<br /><br /> <img alt="loading" src="images/OrderLoader.gif" /> <p style="color:red">please wait...</p></div></div></div> <div id="UserDeliveryPanel" style="display:none;" class="UserDeliveryPanel"> <div id="modal-behind"></div> <div id="modalsubmission" class="guestmdoal UserDeliveryAdjustPanel"> <div class="gpickuporderstyles"> <div class="guestpicktitile deliveryHeading">Delivery Order Submission</div> <div><img src="images/IconCloseWindow.png" id="UserDeliveryOrderClose" alt="close" class="popclosebtn" onclick="UserDeliveryPanelclose()" /></div> </div> <div class="yourcarttablestyles"> <div class="yurcrt"> <div class="yourcartstylesnew"> <div> <table class="Confirminfo"> <tr><td class="login_lable" style="text-align:left;font-size: 14px;padding-top:5px;cursor:default" ><div class="UserDeliveryScheduletime"> <table> <tr><td colspan="2"><p class="submissionnotes"></p></td></tr> <tr><td style="text-align:left;font-size: 12px;color:red;" colspan="2"><label id="lblUserDeliveryError"></label></td></tr> <tr><td><input name="txtdeliverydate" type="text" maxlength="10" readonly="readonly" id="txtdeliverydate" class="productmanagement_formtext1 datepicker pickupdatewidth" oncopy="return false;" onpaste="return false;" onchange="return DateChanged();" onfocusout="RemoveValidation(this);" /> <script type="text/javascript"> function checkDate(sender, args) { var toDate = new Date(); toDate.setMinutes(0); toDate.setSeconds(0); toDate.setHours(0); toDate.setMilliseconds(0); if (sender._selectedDate < toDate) { $("#lblorderror").text("You can't select day earlier than today!"); $(".ordererror").show().delay(3000).fadeOut(); sender._selectedDate = toDate; //set the date back to the current date sender._textbox.set_Value(sender._selectedDate.format(sender._format)) } } </script> <div class="categoryright" style="cursor:default;"><i class="datepickerarrow arrowsize arrow downArrow"></i></div> </td> <td><select id="ddlhr" class="ddlhr pickupdropdownstyles11" onchange='return TimeChanged(this.value);'></select></td> </tr> <tr><td colspan="2"><p class="Estimate" style="font-size: 13px;color: green;padding-top: 11px;margin: 0px;"></p></td></tr> </table> </div></td> </tr> <tr class="GuestPart"> <td><table style="width:100%"><tr> <td><input name="txtguestdeliveryname" type="text" maxlength="50" id="txtguestdeliveryname" class="productmanagement_formtext1 rcount" Placeholder="Name" onfocusout="RemoveValidation(this);" /> </td> </tr> <tr><td><input name="txtguestdeliveryemail" type="text" maxlength="110" id="txtguestdeliveryemail" class="productmanagement_formtext1 rcount" Placeholder="Email" onfocusout="RemoveValidation(this);" /></td> </tr> </table></td></tr> <tr class="DeliveryType"><td><table style="width:100%"> <tr><td><input type="text" id="txtline1" maxlength="50" class="productmanagement_formtext1" disabled="disabled" onfocusout="RemoveValidation(this);" /></td></tr> <tr><td><input type="text" id="txtline2" maxlength="50" class="productmanagement_formtext1" disabled="disabled" placeholder="Line2" /></td></tr> <tr><td><input type="text" id="txtulandmark" class="productmanagement_formtext1 clsdoorno" disabled="disabled" placeholder="LandMark" /></td></tr> <tr><td><input type="text" id="txtcity" maxlength="50" class="productmanagement_formtext1" onfocusout="RemoveValidation(this);" disabled="disabled"/> </td></tr> <tr><td><input type="text" id="txtstate" maxlength="50" class="productmanagement_formtext1" disabled="disabled"/></td></tr> <tr><td><input name="txtZip" type="text" maxlength="7" id="txtZip" disabled="disabled" class="productmanagement_formtext1" Placeholder="Zip" /> </td></tr> <tr><td><span>Please</span><span style="cursor:pointer;color:blue" onclick="DChangelink();"> Click here</span> to change your address</td></tr></table></td></tr> <tr><td><input name="txtmobilenumber" type="text" maxlength="13" id="txtmobilenumber" class="productmanagement_formtext1 rcount" placeholder="PhoneNumber" onfocusout="RemoveValidation(this);" /><label id="uppphval" style="display:none">Valid</label> </td></tr> <tr class="checkinsettings" style="display:none"> <td> <table style="width:100%" > <tr> <td style="width:140px;text-align:justify;"> <label class="lblcustomerinfo Advanceclass" style="word-break:break-all;font-size:16px;" id="lblcustomerinfo" ></label>: </td></tr> <tr><td> <input type="text" id="txtcustomerinfo" class="productmanagement_formtext1" style="width:91%;margin-top:2px;" maxlength="100" onkeyup="LimtCharactersLength(this,100,'lblcount');"/> <div id="countdiv" style="display:none"><label style="float:right;margin-right:8px">(<label id="lblcount">0</label>/100)</label></div> </td> </tr> </table> </td> </tr> <tr class="screenAdvnacedSettings" style="display:none"><td> <table style="width:98%" > <tr><td style="width:140px;text-align:justify;" colspan="2"><label class="screenlblpickuptext Advanceclass" style="word-break:break-all;font-size:16px;" id="screenlblpickuptext"></label>: </td> </tr> <tr> <td colspan="2"><input name="screentxtAdvancedlbl" type="text" maxlength="6" id="screentxtAdvancedlbl" class="productmanagement_formtext1" style="width:91%;margin-top:2px;" /> </td> </tr> <tr></tr> <tr><td colspan="2"><label id="screenlblAdvinst"></label></td></tr> </table></td></tr> <tr class="screenddlAdvnacedSettings" style="display:none"><td> <table style="width:98%" > <tr><td style="text-align:justify;" colspan="2"> <label class="screenlblpickuptext Advanceclass" style="word-break:break-all;font-size:16px;"></label>: </td></tr> <tr><td colspan="2"><select id="screenddldropdownoptions" class="AdvancedOptions pickupdropdownstyles11" style="width:98%;color:#898989"></select> </td> </tr> <tr></tr> </table> </td></tr> <tr class="screenCustomAdvnacedSettings" style="display:none"><td> <table style="width:98%" > <tr><td style="text-align:justify;" colspan="2"><label class="screenlblpickuptext Advanceclass" style="word-break:break-all;font-size:16px;"></label>: </td></tr> <tr><td colspan="2"><input name="screentxtCustomerOrderDe" type="text" maxlength="100" id="screentxtCustomerOrderDe" class="productmanagement_formtext1" placehoder="Screen Number" onkeyup="LimtCharactersLength(this,100,'lblcount2');" style="width:91%;margin-top:2px;" /> <div id="screencountdiv1" style="display:none;"><label style="float:right;margin-right:8px">(<label id="lblcount2">0</label>/100)</label></div> </td></tr> <tr><td colspan="2"></td></tr> </table></td></tr> <tr class="AdvnacedSettings" style="display:none"><td> <table style="width:100%" > <tr><td style="width:140px;text-align:justify;"><label class="lblpickuptext Advanceclass" style="word-break:break-all;font-size:16px;"></label>: </td></tr> <tr><td><input name="txtAdvancedlbl" type="text" maxlength="6" id="txtAdvancedlbl" class="productmanagement_formtext1" style="width:91%;margin-top:2px;" /> </td></tr> <tr><td colspan="2"><label id="lblAdvinst"></label></td></tr> </table></td></tr> <tr class="CustomAdvnacedSettings" style="display:none"><td> <table style="width:100%" > <tr><td style="width:140px;text-align:justify;"><label class="lblpickuptext Advanceclass" style="word-break:break-all;font-size:16px;"></label>: </td></tr> <tr><td><input name="txtCustomerOrderDe" type="text" maxlength="100" id="txtCustomerOrderDe" class="productmanagement_formtext1" placehoder="Car Make/Model/Color" onkeyup="LimtCharactersLength(this,100,'lblcount1');" style="width:91%;margin-top:2px;" /> <div id="countdiv1" style="display:none;"><label style="float:right;margin-right:8px">(<label id="lblcount1">0</label>/100)</label></div> </td></tr> <tr><td colspan="2"></td></tr> </table></td></tr> <tr><td></td></tr> <tr class="ddlAdvnacedSettings" style="display:none"><td> <table style="width:100%" > <tr><td style="text-align:justify;" colspan="2"> <label class="lblpickuptext Advanceclass" style="word-break:break-all;font-size:16px;" ></label>: </td> </tr> <tr><td colspan="2"><select id="ddldropdownoptions" class="AdvancedOptions pickupdropdownstyles11" style="width:96%;color:#898989"></select> </td></tr> </table> </td></tr> </table> </div> <div class="advancedineinsettings" style="display:none"> <div style="width:140px;text-align:justify;"><label style="word-break:break-all;font-size:16px;">Table Id</label>: </div> <div><input name="dineintableid" type="text" maxlength="5" id="dineintableid" class="productmanagement_formtext1 rcount" placehoder="Table Id" style="margin-top:2px;" /> </div> </div> <div class="vehicledetlsdiv" style="display:none"> <label>Vehicle Details</label> <div><label id="lbladdvehicledtls" style="display:none;color:blue" onclick="OpenVehiclepnl()">+ Add Vehicle Details</label></div> <select id="ddlVehicleDetails" class="pickupdropdownstyles11" style="width:98%;color:#898989;display:none;"></select> <div style="width:94%;height:auto;display:block;border:2px solid #ccc;border-radius:5px;position:relative;" id="divvehicledtls" onclick="SelectVehicleDetails()"> <div id="divslctvhcldtls" style="padding:10px;">--Select Vehicle Details--</div> </div> <div id="vechicledivcontainer" style="" class="dropdown-content content1"> <table id="tblAllVehicleDetails" class="tblAllVehicleDetails"></table> </div> <div><label id="lbladdanothervehicledtls" style="display:none;color:blue" onclick="OpenVehiclepnl()">+ Use another vehicle</label></div> </div> <div> <table style="width:100%"> <tr><td><textarea name="instructions" rows="5" cols="20" id="instructions" class="productmanagement_formtextbox" placeholder="Order Instructions" onkeydown="return BlockingHtml(this,event);"> </textarea></td></tr> <tr><td ><span id="lblinstructcout" class="instructdata" style="display:none;"></span></td></tr> <tr style="display:none"><td style="color: red;font-size: 13px;"> Do you want to place this order for your guest? <input name="chkDguest" type="checkbox" id="chkDguest" value="Guest" onchange="CheckUserGuest();" class="userchkbox" /></td></tr> <tr style="display:none" class="userguest"><td><table > <tr><td> <input name="txtDGName" type="text" maxlength="50" id="txtDGName" class="productmanagement_formtext1" Placeholder="Guest Name" onfocusout="RemoveValidation(this);" /> </td></tr> <tr><td><input name="txtDGEmail" type="text" maxlength="110" id="txtDGEmail" class="productmanagement_formtext1" Placeholder="Guest Email" onfocusout="RemoveValidation(this);" /></td></tr> <tr><td><input name="txtDGPhno" type="text" maxlength="13" id="txtDGPhno" class="productmanagement_formtext1" placeholder="Guest Phone Number" onfocusout="RemoveValidation(this);" /> </td></tr> </table></td></tr> <tr><td><div style="margin-top:10px;color:black;line-height:18px;font-weight: 600;"><p class="creditcardinfopara">* You may be asked to present credit card identification during the delivery.</p><p class="deliveryestpara">* Please note delivery time is an estimate only. Driver may contact you if there is a delay. So please ensure your phone is reachable.</p></div></td></tr> </table> </div> </div> <div class="yourstylesright1"> <table> <tr><td class="yourcartstyles">Your Cart <img id="imgdelcart" src="images/Cartimg.png" alt="Cart Image" style="border-width:0px;" /> </td></tr> <tr><td><table width="95%" style=" color:Black; border-color:White;Font-Size:14px;"><tr><td style="width:60%" align="left">Item Name</td><td style="width:20%;text-align:center;" align="left">Qty</td><td style="width:15%" align="center">Price</td></tr></table> <table id="TableDeliveryCart" width="95%" style="color:gray;overflow:scroll;"></table></td></tr> <tr><td><div class="justtip"><p class="papaltip">Would you like to add a tip? </p> <input type="text" id="txttip" class="promocodetext1 promostyles" onchange="userTip1(this.value)" maxlength="6" placeholder="0.00" onkeyup="AllowNumberForTip(this)" /> <input type="button" id="fifteen" class="bnttip" value="15%" onclick="userTip(this.value)" /><input type="button" id="eighteen" class="bnttip" value="18%" onclick="userTip(this.value)" /> <input type="button" id="twenty" class="bnttip" value="20%" onclick="userTip(this.value)" /> </div></td></tr> <tr><td class="register_lable" style="width:40%"><table class=" guuesttotal121"><tr><td>Subtotal</td><td style="text-align:right;width: 50%;"><label id="lblsubtotaldelivery" ></label></td></tr></table></td></tr> <tr> <td class="register_lable" style="width:40%"> <table class="guuesttotal121 discountCheckout" style="display:none;"><tr><td> <label id="udpt" class="promovisible" style="display:none;"></label><label id="CouponType" style="display:none;"></label> </td> <td class="pricespadding" style="padding-right:0px"><label id="udpv" class="promovisible" style="display:none;text-align:right;color:red;" ></label></td> </tr></table></td></tr> <tr><td class="register_lable" id="tdTaxdelivery" style="width:40%;"><table class="guuesttotal121"><tr><td><span class="Typetax"></span></td><td style="text-align:right;width: 50%;"><label id="lblTaxdelivery"></label></td></tr></table></td></tr> <tr class="CVFexist" style="display:none"><td class="register_lable" style="width:40%;"><table class="guuesttotal2"><tr><td>Convenience Fee</td><td class="pricespadding"><label id="lblbconvenience1"></label></td> </tr></table></td></tr> <tr><td class="register_lable lbluserdelivery" style="width:40%;"><table class="guuesttotal121"><tr><td><span class="Chtext"> Delivery</span> </td><td style="text-align:right;width: 50%;"><label id="lbluserdelivery"></label></td></tr></table></td></tr> <tr><td class="register_lable" style="width:40%;"><table class="guuesttotal121 ToggleMileageCharge"><tr><td>Mileage Charge </td><td style="text-align:right;width: 50%;"><label id="lblUserMileageCharge"></label></td></tr></table> </td></tr> <tr><td class="register_lable" style="width:40%;"><table class="guuesttotal121 tipEnable" ><tr><td>Tip</td><td style="text-align:right;width: 50%;height: 26px;"><label id="WTip"></label></td></tr></table></td></tr> <tr><td class="register_lable" style="width:40%;"><table class="guuesttotal121"><tr><td>Total</td><td style="text-align:right;width: 50%;"><label id="lblTotaldelivery"></label></td></tr></table></td></tr> <tr><td class="notefordelivery" style="padding-top:2%;">Note: *Any delivery fee charged is not a tip for the delivery driver. Please tip your driver for excellent service.</td></tr> <tr><td class="TextNotes" style="padding-top:2%;"></td></tr> <tr><td><table id="tblUserDrivers"></table></td></tr> <tr><td><div class="userdeliveryloader" id="Div9" style="display:none;position:absolute;z-index:2000;margin-left:20%" > <img alt="loading" src="images/OrderLoader.gif"/></div> <table style="width:100%"><tr><td><label class="payment">Payment</label></td></tr> <tr><td><label style="display:none" id="bntConfOrder" class="paymentst"><input type="radio" id="bntConfOrder1" value="Pay with Cash" onclick="UDSelection();" name="userpickcash" /> <span class="CODtext">Pay with Cash</span></label></td></tr> <tr><td><label style="display:none" id="mbntConfOrder" class="paymentst"><input type="radio" id="mbntConfOrder1" value="Pay with Cash" onclick="UDSelection();" name="userpickcash" /> <span class="CODtext1">Pay with Cash</span></label></td></tr> <tr class="fdButton5" style="display:none" id="fdButtonpay1" ><td> <label class="paymentst"> <input type="radio" value="Credit Card" class="fdButton5" id="fdButtonpay" onclick="UDSelection();" name="userpickcash" /> <span class="pamericancc"> Credit Card</span></label></td></tr> <tr class="debitpnl" style="display:none"><td><table style="width:100%"> <tr><td><input name="txtcardname" type="text" maxlength="19" id="txtcardname" class="txtcardstyles" placeholder="Card Holder First Name" onfocusout="RemoveValidation(this);" /> </td></tr> <tr ><td> <input name="txtClastname" type="text" maxlength="19" id="txtClastname" class="txtcardstyles" placeholder="Card Holder Last Name" onfocusout="RemoveValidation(this);" /> </td></tr> <tr><td> <div id="CardConnectform" style="display:none" > <div> <table> <tbody> <tr> <td> <iframe id="tokenframe" name="tokenframe" frameborder="0" scrolling="no" width="200" height="130"></iframe> <input type="hidden" name="mytoken" id="mytoken" /> </td></tr></tbody> </table> </div> </div></td></tr> <tr class="NormalForm"><td><input name="txtcardno" type="text" maxlength="19" id="txtcardno" class="txtcardstyles" placeholder="Card Number" onfocusout="RemoveValidation(this);" /> </td></tr> <tr class="NormalForm"><td><img src="images/Credit-cards1.png" alt="credit cards" class="crdimg" style="margin-top:8px" /></td></tr> <tr ><td> <table style="text-align:left"> <tr class="NormalForm"><td colspan="2" class="fdfont">Expiration Date</td> <td class="fdfont"> Security Code </td></tr> <tr class="NormalForm"><td style="width: 90px;"> <select class="bindmonths mmddl" id="ddlBindMonth" ></select></td> <td><select class="bindyears mmddlyear" id="ddlBindYear"></select></td><td> <input name="txtCVV" type="text" maxlength="4" id="txtCVV" class="txtcvvstyles" onfocusout="RemoveValidation(this);" placeholder="CVV" style="width:50px;" /> </td></tr> <tr><td colspan="3" class="fdfont " style="color:black;padding-top: 10px;"><div class="billing"> <span class="BillingText">Is Billing Address same as Delivery Address?</span><br><span class="chkcard" Name="BillingAddress"><input id="Chkyeschk" type="checkbox" name="Chkyeschk" checked="checked" onclick="UnCheckedBillingAddress(this);" /><label for="Chkyeschk"> Yes</label></span> <span class="chkcard" Name="BillingAddress"><input id="chkcard" type="checkbox" name="chkcard" onclick="CheckedBillingAddress(this);" /><label for="chkcard"> NO</label></span></div></td></tr> <tr> <td colspan="3" class="Billingaddress" style="display:none"> <table style="width:100%"> <tr><td><input name="txtcLine1" type="text" id="txtcLine1" class="txtcardstyles " placeholder="Billing Address Line1" onfocusout="RemoveValidation(this);" /></td></tr> <tr><td><input name="txtcline2" type="text" id="txtcline2" class="txtcardstyles" placeholder="Billing Address Line2" /> </td></tr> <tr><td><input name="txtcCity" type="text" id="txtcCity" class="txtcardstyles" placeholder="Billing Address City" onfocusout="RemoveValidation(this);" /> </td> <td class="helptip"><img src="images/Help.png" style="margin-left:18px" alt="Help" /></td> </tr> <tr><td colspan="2"><input name="txtCState" type="text" id="txtCState" class="txtcvvstyles" placeholder="Billing Address State" onfocusout="RemoveValidation(this);" style="width:140px; margin-top: 10px;" /> <input name="txtBZC" type="text" maxlength="6" id="txtBZC" class="txtcvvstyles" onfocusout="RemoveValidation(this);" placeholder="Billing Zip Code" style="width:80px; margin-top: 10px;" /> </td></tr></table> </td></tr> <tr><td></td><td ><label class="error-message" style="color:red"></label></td></tr> </table></td> </tr></table></td></tr> <tr id="BtnSquare" style="display:none"><td> <label class="paymentst"><input type="radio" value="Credit Card" id="btnUDSquare" onclick="UDSelection();" name="userpickcash" /><span class="Squaretext"> Credit Card</span></label></td></tr> <tr><td><div id="SquarePanel" style="display:none;" > <div id="card-container"></div> <button id="card-button" type="button" style="display:none">Pay</button> </div></td></tr> <tr><td> <div id="CloverPanel" style="display: none;"> <div class="form-row top-row"> <div id="card-number" class="field card-number"></div> <div class="input-errors" id="card-number-errors" role="alert"></div> </div> <div class="form-row"> <div id="card-date" class="field third-width"></div> <div class="input-errors" id="card-date-errors" role="alert"> </div> <div class="form-row"> <div id="card-cvv" class="field third-width"></div> <div class="input-errors" id="card-cvv-errors" role="alert"></div> </div> <div class="form-row"> <div id="card-postal-code" class="field third-width"></div> <div class="input-errors" id="card-postal-code-errors" role="alert"> </div> </div> </div> </div> </td></tr> <tr><td> <label class="paymentst" style="display:none;" id="Instamojo"> <input type="radio" value="Instamojo" id="Instamojo1" onclick="UDSelection();" name="userpickcash" /> <span class="PayPaltext">Pay Online</span></label></td></tr> <tr><td><label style="display:none" id="btndeliveryromotions" class="btnusingpromotion paymentst"><input type="radio" id="btndeliveryromotions1" value=" Confirm and Submit Order" onclick="UDSelection();" name="userpickcash" /> Confirm and Submit Order</label></td></tr> <tr><td><label style="display:none" id="btndeiverymunchies" class="btnpaywithmunchies paymentst"><input type="radio" id="btndeiverymunchies1" value="Pay with Munchies" onclick="UDSelection();" name="userpickcash" /> <label id="lblLoyaltyText" style="cursor:pointer"></label></label></td></tr> <tr class="paypalmsg" style="display:none"><td> <p class="ocstylesaggree">When you click 'Place Order Now' you'll be taken to Instamojo site. </p></td></tr> <tr><td><div style="margin-top:5%;"><p style="color:black;text-align:center;display:none;" id="munchiespoints" >You will earn <label id="lblmunchiespoints" style="color:green!important" ></label> with this order! </p> <p class="munchiesAmount"></p></div></td></tr> <tr><td><label id="charitylbl1" class="charitytest"></label></td></tr> </table> </td> </tr> </table> </div> </div> <div class="crtordbtn placeorderloaderdiv"><span class="placeorder placeorderspan"><img alt="loader" src="images/loadernew1.gif" class="placerdloader" /></span></div> <div class="crtordbtn placeorderbtndiv"><p class="errormsg " style="color:red"></p><input type="button" value="Place Order Now!" class="placeorder" onclick="userdeliveryvalidation();" /><p class="ocstylesaggree">By clicking this button, your order will be placed. </p> </div> </div> </div> </div> <label id="txtRangeFrom" style="display:none"></label><label id="txtRangeTo" style="display:none"></label> <span id="lblUrl" style="display:none"></span> <label id="lblBogoSubCatId" style="display:none"></label> <label id="lblBogoSubSubId" style="display:none"></label> <label id="lblBogoGetItemType" style="display:none"></label> <label id="lblBogoId" style="display:none"></label> <label id="lblBogoItemId" style="display:none"></label><label id="lblBogoType" style="display:none"></label><label id="lblBogoOfferQ" style="display:none"></label> <span id="Deliverytxt" style="display:none;"></span><span id="Pickuptext" style="display:none;">PickUp</span> <span id="checkdelivery" style="display:none;"></span><span id="deliveryavailabul" style="display:none;"></span> <label id="UserId" style="display:none"></label><label id="lbldchange" style="display:none"></label><label id="lblpickuptext" style="display:none"></label><label id="lblCloverPayment" style="display:none"></label> <label id="lblPaymentType" style="display:none"></label><label id="PaymentAppId" style="display:none"></label><label id="lblSquareLocationId" style="display:none"></label><label id="charitylbl" style="display:none"></label> <label id="CCBaseURL" style="display:none"></label> <label id="lblShipping" style="display:none"></label><label id="lbTypeRequired" style="display:none"></label> <label id="lblShipMinAmt" style="display:none"></label><label id="TotalWeight" style="display:none;"></label> <span id="Conveniencelbl" style="display:none">0</span> <span id="Commissionlbl" style="display:none">0</span> <span id="lblConvType" style="display:none">$ Amount</span> <label id="Promotioncodeid" style="display:none"></label><label id="lblRequireuseraccount" style="display:none"></label><label id="EmailID" style="display:none"></label> <label id="AdvancedOption" style="display:none"></label><label id="lblindication" style="display:none"></label><label id="screenlblindication" style="display:none"></label> <span id="lblcwurl" style="display:none;"></span> <span id="lblcwurl1" style="display:none;"></span> <label id="lblPhoneno" style="display:none"></label><label id="FirstName" style="display:none"></label><label id="Paytype" style="display:none"></label> <label id="LastName" style="display:none"></label><label id="TipValue" style="display:none"></label> <label id="AdrValue" style="display:none">Existing</label> <label id="lblfinishcount" style="display:none">0</label> <label id="lblselecteddriver" style="display:none"></label> <label id="lblDisplayTimeSelection" style="display:none"></label> <label id="lbldeliveryareapromotioncheck" style="display:none"></label> <label id="lblNavigationBar" style="display:none"></label> <label id="lblreducedtime" style="display:none"></label> <label class="lblasap" id="lblasaphr" style="display:none"></label> <label id="VALID" style="display:none">0</label> <span id="lblAwardType" style="display:none"></span> <label id="Firstorder" style="display:none"></label> <label id="lblshowquantity" style="display:none"></label> <span id="AwardPoint" style="display:none"></span><span id="lbloffers" style="display:none">Both</span> <span id="lblValueOfPoint" style="display:none"></span> <div class="shell1"> <div id="responsiveview"><div class="content" id="iframecontent"></div></div> </div> <div class="shell1 orderswidth" style="margin-bottom:10px" > <div class="userregistration_contnet"> <div class="m-slider Event1" > <div class="ordshell" style="overflow:inherit"> <input type="text" id="radiotext" style="display:none" /><label id="PriceVal" style="display:none;"></label><label id="choiceselect" style="display:none;" ></label> <label id="lblItemType" style="display:none;"></label><label id="EditItemNum" style="display:none;" ></label> <label id="lblcommontime" style="display:none;" ></label><label id="lblOrderDate"style="display:none;" ></label><label id="lblOpenPanel" style="display:none;" ></label> <span id="AppLocationTime" style="display:none">5/14/2025 10:19:35 PM</span> <span id="lblolddate" style="display:none"></span> <span id="lblmarkupfee" style="display:none"></span> <div class="oderwidth"> <div class="previewoderwidth"> <div class="ordersdiv"> <input name="lblAppId1" type="text" value="18ea9422-0e63-4513-bef5-393191b54868" id="lblAppId1" style="display:none" /><input name="lblLId" type="text" value="d5b9b14f-dd0a-42e7-8cd9-ae1a2df92470" id="lblLId" style="display:none" /> <input name="lblCId" type="text" value="8c866e08-80b8-4af7-8d39-4b48b6347811" id="lblCId" style="display:none" /><input name="lbltimezonename" type="text" value="Eastern Daylight Time" id="lbltimezonename" style="display:none" /> <span id="lblrawoffset" style="display:none">-18000.0000000</span> <span id="lbldataoffset" style="display:none">3600.0000000</span> <span id="lblurlnametype" style="display:none">KeyInfo</span> <span id="lbldineinpayonline" style="display:none"></span> <span id="lbldineinenable" style="display:none"></span> <span id="appdescr" style="display:none">Locally owned and operated since 1978. Orangeburg's original sub shop. Often imitated but never duplicated. Subs and Salads - Orangeburg, SC Now available through the Hoagies Cafe App</span> <span id="onlinepayment" style="display:none"></span> <label id="lblItemId" style="display:none;"></label><label id="lblItemNoTax" style="display:none;">false</label> <label id="lblCustomTax" style="display:none;"></label> <label id="lblTaxLabel" style="display:none;"></label> <span id="lblqCity" style="display:none;">Orangeburg</span> <span id="lblzip12" class="appwaycls" style="display:none;">29118</span> <span id="lblholidaymsg" style="display:none;"></span> <span id="lblholidaymsgfromtime" style="display:none;"></span> <span id="lblholidaymsgtotime" style="display:none;"></span> </div> <div class="orderdivr"> <table id="tblbuttons" style="width:100%;"> <tr><td><div style="float:right"><table><tr> <td id="tdReview" class="menubuttons" style="display:none;"><input type="button" id="btnaddreview" class="btnaddreview" value="Write a review" onclick="AddUsersReview()" /></td> <td id="tdFavoriteUs" class="menubuttons" style="display:none;"><input type="button" id="btnfavorite" class="btnfavorite" value="Favorite Us" onclick="addfavorite()" /></td> <td id="tdShare" class="menubuttons" style="display:none;"><input type="button" id="btnshare" class="btnshare" value="Share" onclick="OpenSharePanel()" /></td> <td id="tdGroupOrder" class="menubuttons" style="display:none;"> <input type="button" class="grouporderbtn" id="grouporderbtn" value="Group Order" onclick="StartGroupOrder();" /></td> <td id="orderCatering" class="menubuttons" style="display:none;"> <input type="button" class="orderCatering" value="Catering" onclick="StartCateringOrder();" /></td> <td id="editbusine" style="display:none;"><input id="btnBusiness" type="button" class="editbusiness" value=" Edit Business" style="" onclick="GetAppInfo();" /></td> <td class="menubuttons" style="display:none;" id="reservetablebutton"></td> </tr> </table></div></td></tr> <tr><td ><div class="ordertblrt"><div class="Reservationloader1 reserverloder" ><img alt="loading" src="images/ReservationLoader.gif"/></div> </div> </td></tr> </table> <div class="RestaurantHGB" style="display:none"> <img id="Logo" class="appl" src="https://www.ecloudbiz.com/Services/DATA/18ea9422-0e63-4513-bef5-393191b54868/AppDetailsImages/18ea9422-0e63-4513-bef5-393191b54868AppIcon.jpg" alt="Hoagies Cafe Order Online" style="border-width:0px;display:none" /><span id="cusinetypeslbl" style="display:none">American, Coffee and Tea, Deli, Gyro, Hoagies, Low Carb, Salads, Sandwiches, Subs</span> </div> </div> <div class="CustomBG" style="overflow:auto;"> <div class="backrestlist"> <div class="loadpagemain"> <p class="backrestlistP5"><span id="lblShowZones" class="reviewtest" onclick="GetDeliveryZones()" style="cursor:pointer;"></span></p> <p class="backrestlistP5"></p> <p class="backrestlistP5 backrestlistP6" id="lblbogodisplay"><span id="lblbogooffers" class="reviewtest" onclick="SpecialsData()" style="cursor:pointer">Offers</span><span id="lblspecialcount"></span><label id="lblcheckbogo" style="display:none;"></label></p> <p class="backrestlistP5" id="lblwebsitedisplay" style="display:none"><span id="lblwebsitehead" class="reviewtest" style="cursor:pointer"><a id="websitelink" target="_blank" style="color:inherit">Web Site</a></span></p> <p class="backrestlistP6"><span id="lblcoupons" class="lblcoupons apprevie" onclick="GetApprovedCoupons()" style="cursor:pointer">Coupons</span></p> <p class="backrestlistP6"><span id="lblhours" class="lblhours apprevie" onclick="GetAllTimePeriods()" style="cursor:pointer">Hours</span></p> </div> <div class="contentmenudiv" onclick="GetActiveTiles()"> <div class="contmenubar"></div> <div class="contmenubar"></div> <div class="contmenubar"></div> </div> </div> <div id="menupanel" class="hmrtpnl"> <div class="hmrtpnlmdl" id="hmrtsub"> <div id="pnlclose" class="hmrtclmn"><img id="imgclosemenu" src="/images/close.png" alt="Close" /></div> <div class="hmrtpnltxt"> <div style="width:100%;"><h2>Overview</h2> <div class="Sideoptiondiv" > <div class="backrestlistP2 pagename" id="TogglePhotos"><span><span id="lblPhotos" class="reviewtest" onclick="GetPhotos()" style="cursor:pointer;float:left;">Photos</span></span> </div> <div class="backrestlistP3 pagename"><span id="lblFavorite" class="reviewtest" onclick="FavoritesData()" style="cursor:pointer">Favorites</span><span id="lblfavouratecount"></span></div> <div class="backrestlistP4 pagename"><span id="lnkaddreviews" class="reviewtest apprevie" onclick="Addreview()" style="cursor:pointer">Reviews</span><span id="lblreviewcxount"></span></div> <div class ="laodpages" id="tilescontent"></div> </div> </div> </div> </div> </div> <div class="Ordersmain"> <div class="oderwidth3"> <div id="TabbedPanels" class="TabbedPanelsfororder TabbedPanelsheight"> <div class="TabbedPanelsContentGroup" > <div class="menusrtb" style="display:none"> <div id="trSearch" style="position:relative"><input name="txtItemSearch" type="text" maxlength="50" id="txtItemSearch" class="itemsearch itemsearchtxt" placeholder="Item Name" /> <img id="btnsearchrestaurant" alt="Search" src="/images/SearchRestaurant.png" class="itemsearchicon " onclick="ItemNameSearch();" /><img onclick="DeleteItemSearch();" src="images/DeleteMenuItem.png" alt=" Delete Item Search" class="deleteitems" id="deleteitems" style="display:none" /> </div> </div> <div class="pnlpromoimg" style="display:none;"><img alt="Promo Image" id="lblpromoimage" /></div> <div style="float:right;margin-right:35px"><table class="mobileresheader"><tr><td><label class="CartDisplay" onclick="CartDisplay()">Check Out</label><span id="lblitemcount" class="itemcount" onclick="CartDisplay()">0</span></td></tr></table></div> <div id="cartmaxht" class="TabbedPanelsContent"> <span id="lblCountry" style="display:none">United States</span> <div class="orderdivw"> <div> <span id="lblMsg" class="error_message error_message1"></span> <div class="itemfilterdiv"> <div style="text-align:center;"><span id="nosettingslbl" style="color:#666FA1;font-size:18px;"></span></div><div style="text-align:center"><label id="Reasontoclose" style="color:red;font-size:18px;"></label></div> <table class="itemfiltertable"> <tr id="trAdditionalFilters" style="display:none"> <td id="tdPopular" class="foodcaterpry"><input id="chkPopular" class="chkPopular chkp" type="checkbox" onclick=" GetPopular();" /> <img alt="Popular" src="images/ItemQualitiesSmallPopular.png" class="itemsimg" /> Popular</td> <td id="tdSpicy" class="foodcaterpry"><input id="chkSpicy" class="chkSpicy ckspicy" type="checkbox" onclick="GetPopular();"/><img alt="Spicy" src="images/ItemQualitiesSmallSpicy.png" class="itemsimg" /> Spicy </td> <td id="tdRaw" class="foodcaterpry"><input id="chkRaw" class="chkRaw chrawm" type="checkbox" onclick=" GetPopular();"/><img alt="Raw" src="images/ItemQualitiesSmallRaw.png" class="itemsimg" />Raw </td> <td id="tdGlutenFree" class="foodcaterpry"><input id="chkGlutenFree" class="chkGlutenFree chrawm" type="checkbox" onclick=" GetPopular();" /><img alt="Gluten Free" src="images/ItemQualitiesSmallGlutenFree.png" class="itemsimg" />Gluten Free</td> <td id="tdVegetarian" class="foodcaterpry"><input id="chkVegetarian" class="chkVegetarian chrawm" type="checkbox" onclick=" GetPopular();" /><img alt="Vegetarian" src="images/ItemQualitiesSmallVegetarian.png" class="itemsimg" />Vegetarian </td> </tr> </table> <div class="addcategoryloadingimage catloader" id="addcategoryloadingimage"><img alt="loading" src="images/loadernew.gif"/></div> <div class="addcategoryloadingimage1 catloader" id="Div3" style="display:none;"><img alt="loading" src="images/loadernew.gif"/></div> <div style="text-align:center"><label id="lblsrhmsg" style="color:red"></label></div> <div class="menu" id="Itemstable"></div> </div> </div> </div> <div onclick="MobileBackmenu()" class="hidcart backarrow addmcls">Add More Items</div> <div class="startgright"><img alt="Loding..." src="images/loadernew1.gif" class="startorder" style="display:none;margin-left: 12%;margin-top: 7px;position: absolute;" /></div> <div id="signinpanel" style="z-index: 1003;" class="signinpanel" > <div id="signmodal-behind" class="signinmodal"></div> <div id="modalsignin" class="signinAdjustpanel2" > <div class="signinshell"> <div class="icbsignin" > <div class="signinst"><div class="signinstleft"><h1> <label id="lblsigntex" class="lblsigntex">Hoagies Cafe - Orangeburg</label> </h1> </div><div class="signinstrht"> <img alt="close" src="images/IconCloseWindow.png" id="signinclose" class="signinclose" onclick="closesignin()" /></div></div> <table width="100%" border="0" cellspacing="0" cellpadding="0" summary="User Login form" class="signintbl newsignmbl"> <tr><td> <input name="btngust" type="button" id="btngust" class="orderguestbtn userstyleguest" onclick="GuestLogin()" value="ORDER AS A GUEST" /> </td></tr> <tr><td height="5px"></td> </tr> <tr><td class="welback welbackleft" style="text-align:center"><span id="spnwelback" style="font-size:18px;font-weight:600;color:#000">OR</span></td> <td class="welback welbackright" style="font-size:18px;font-weight:600;color:#000"> OTHER OPTIONS</td> </tr> <tr><td ><input name="txtEmail" type="text" maxlength="110" id="txtEmail" tabindex="1" class="userlogin_formtext1" placeholder="Email or Phone Number" onchange="Trim(this)" /> <span id="lbluseremail" class="registererror loginemail">Enter Email</span> </td> <td> <div class="gmaildiv gmaildiv1"> <a id="lnkGmaillnk" href="javascript:__doPostBack('lnkGmaillnk','')"> <div style="width:34px;height:34px;background:url(/images/g-normal.png);background-repeat:no-repeat;background-size:100% 100% !important"></div> <div style="font-size:18px;padding-left:8px;color:#808080">Continue with Google</div> </a> </div> <input name="lnkbtnaccount1" type="button" id="lnkbtnaccount1" value="Create an Account" class="createstyles crtaccntbtnnew loginradiusfbstyles" onclick="registrationopen()" style="display:none" /> </td> </tr> <tr> <td height="40"><input name="txtPwd" type="password" maxlength="50" id="txtPwd" tabindex="2" title="PassWord" class="userlogin_formtext1" placeholder="Password" /><img id="imgpwd" class="passwordlabels" src="/images/hidepassword.png" alt="show password" /> <span id="lbluserpwd" class="registererror loginemail">Enter Password</span> </td> <td> <div class="gmaildiv fblogindiv"> <a id="lnkFacebook" href="javascript:__doPostBack('lnkFacebook','')"> <div style="width:34px;height:34px;background:url(/images/facebook-icons.png);background-repeat:no-repeat;background-size:100% 100% !important"></div> <div style="font-size:18px;padding-left:8px;color:#808080">Continue with facebook</div> </a> </div> </td> </tr> <tr><td class="errorht"><span id="lblMsg12" class="error_message lblMsg12"></span></td> <td class="welback2"> </td></tr> <tr><td><input id="imgbtnSignIn" style="font-weight:500" type="button" class="signinimg SignInButtonimg loginradiusfbstyles" value="Sign In" onclick="UserLoginval();" /><br /> <span id="lblforgot" class="forgtpwdlnk" onclick="ForgetPassword()">Forgot Password</span> </td> <td><input name="lnkbtnaccount" type="button" id="lnkbtnaccount" value="Create an Account" class="createstyles crtaccntbtnnew loginradiusfbstyles" onclick="registrationopen()" /> </td> </tr> <tr id="Poweredby"> <td></td> <td><div style="color:#000;font-size:16px">Powered By <a style="color:#000" href="https://www.munchem.com/" target="_blank"><img id="imge" src="images/orderemred.png" alt="Favourite" class="orderemorgimg"/></a></div></td> </tr> <tr><td></td><div class="signinloader" id="Div6"><caption class="signinloader"><img alt="loading" src="images/OrderLoader.gif" /></caption></div></tr> </table></div> </div> </div> </div> <div id="ShippingConfPanel" class="ShippingConfPanel" style="display:none"> <div id="modal-behind" class="deliverymodal"></div> <div id="modaldelivery" style="height: 205px;top:100px" > <div class="deliverydiv"> <div class="itembackborder" style="text-align:center"> <span class="lblitemnamestyles"><span id="Label1" class="wiilldeliver">Shipping Confirmation</span></span><span style="float:right"><img src="images/IconCloseWindow.png" id="Img6" alt="close" class="signinclose closebuttonPickUpstyle" onclick="ShippingClose();" /></span></div> <div><table ><tr><td class="Shippingtxt"> Your location is too far for a driver to deliver. Our driver can ship these items to you. Would you like to proceed?</td></tr> <tr><td ><input type="button" value="Yes" onclick="DeliveryAvailable('Shipping', 'Item');" class="Shippingbtn" /> <input type="button" value="No" onclick="ShippingClose();" class="ShippingbtnNO" /></td></tr> </table></div> </div> </div> </div> <div id="deliveryvalidationpanel" class="deliveryvalidationpanel"> <div id="modal-behind" class="deliverymodal"></div> <div id="modaldelivery" style="z-index:999" class="incrheight1"> <div class="itembackborder" style="text-align:center"><span class="lblitemnamestyles"> <span id="lbl10" class="wiilldeliver">Select Your Order Type</span></span><span style="float:right"> <img src="images/IconCloseWindow.png" id="btnclosedeliveryvalidati" alt="close" class="signinclose closebuttonPickUpstyle" onclick="CloseDeliverycheck();" /></span> </div> <div><div id="divdeliveryavmsg" style="display:none"><span id="lbldeliveryerrmsg"></span></div> <div style="padding:10px"> <table class="delmarg"> <tr><td> <select id="ddlOrderType" class="ddlOrderType" onchange="ChangeOrderType();"></select></td></tr> <tr class="deliverycheck" style="display:none"><td><table><tr><td class="divsavedaddressheight"> <select id="ddlsavedaddress" class="ddlmultiplecontacts saveaddr ddlsavedaddress" onchange="GetSelectedAddress()" ></select> </td></tr> <tr><td> <input name="txtaddress" type="text" id="txtaddress" onfocus="geolocate()" class="deliverysearch delsrh srhdel" placeholder="Address Line1" onfocusout="RemoveValidation(this);" /> <span><img alt="currentlocation" src="images/location.png" class="currentloc1" onclick="GetCurrentLocation()"/></span> </td></tr> <tr class="clsdoorno" style="display:none"><td> <input name="txtDoorNO" type="text" id="txtDoorNO" class="deliverysearch" placeholder="Door No" /></td></tr> <tr class="clsdoorno" style="display:none"><td> <input name="txtLandmark" type="text" id="txtLandmark" class="deliverysearch" placeholder="Land Mark" /></td></tr> <tr><td><input name="txtvalidationcity" type="text" id="txtvalidationcity" class="deliverysearch1" placeholder="City" onfocusout="RemoveValidation(this);" /> <input name="txtvalidationstate" type="text" id="txtvalidationstate" class="deliverysearch1" placeholder="State" onfocusout="RemoveValidation(this);" /> <input name="txtvalidationzip" type="text" maxlength="6" id="txtvalidationzip" class="deliverysearch12" placeholder="Zip" /> <img alt="loader" src="images/loadernew1.gif" class="rdloader" style="display:none;margin-left:42%;margin-top: -23px;" /> </td></tr> <tr><td><input type="button" id="btndeliveyicheck" class="checkdelivery " onclick="DeliveryAddressCheckValidation()" value="Check" style="display:block;" /></td></tr> <tr><td class="signtxt"><p class="acessaddress"><a style="color:#595959;text-decoration:none;padding-left:0px; border-bottom-width: 1px;border-bottom-style: solid;" class="signin" ><span id="signinlabel" onclick="Signinlabel()">Sign In</span></a> to access Saved Addresses</p></td></tr> </table></td></tr> <tr class="shippingcheck" style="display:none"><td><table style="width:100%;margin:0 auto"><tr><td><input type="text" id="txtshpaddress" class="ShpDeliverySearch" placeholder="Address" /><img alt="currentlocation" src="images/location.png" class="currentloc11" onclick="GetCurrentLocation()"/> </td></tr> <tr><td><select id="ddlshpcountry" class="ShpDeliverySearch" style="width:80%;height:40px;" onchange="BindShippingStates('','','','');" ><option>Select Country</option></select><img alt="loader" src="images/loadernew1.gif" class="shploader" style="display:none" /></td></tr> <tr><td><select id="ddlshpState" class="ShpDeliverySearch" style="width:80%;height:40px;"><option>Select State</option></select> </td></tr> <tr><td><input name="txtshpcity" id="txtshpcity" type="text" class="ShpDeliverySearch" placeholder="City" style="width:56%;" /> <input name="txtshpzip" maxlength="6" id="txtshpzip" type="text" class="ShpDeliverySearch" placeholder="Zip" style="width:13%" /> </td></tr> <tr><td><input type="button" value="Check" class="checkdelivery checkdeliverymrg" onclick="CheckShippingDetails()" style="width:200px;display:inline" /></td></tr></table></td></tr> </table> </div></div> </div> </div> </div> <div id="pnlgrouporder" class="pnlgrouporder" style="display:none;"> <div id="modal-behind" class="grouporrdmodal"></div> <div id="modalsubmission" class="guestmdoal guestmdoal1"> <div class="gpickuporderstyles"> <div class="guestpicktitile">Create A Group Order</div> <div><img src="images/IconCloseWindow.png" alt="Close" id="grorderClose" class="grorderClose popclosebtn" onclick="grouporderClose()" /></div> </div> <div class="groupodiv"> <table class="tblgrorder"> <tr><td><p class="Psucess" style="font-size: 14px;color: red;text-align: center;"></p></td></tr> <tr><td class="tdgrorder">To start your group order, share the link below: </td></tr> <tr><td> <input type="text" id="txtShUrl" readonly="readonly" class="txtgrordertext" /></td></tr> <tr><td class="tdgrorder">Or, alert your group via text or email by entering addresses here:</td></tr> <tr><td><div id="txtemailorphno" class="tagging-js" data-tags-input-name="taggone"></div></td></tr> <tr><td class="tdgrorder">Add a message (optional):</td></tr> <tr><td> <textarea name="txtmessage" rows="2" cols="20" id="txtmessage" placeholder="Hey guys, MunchEm is about to make our lunch a lot easier. Just click on this link, check the menu, and pick what you want. It's that simple. Bon apetit!" class="txtgrorder"> </textarea> </td></tr> <tr><td><img src="images/loadernew1.gif" class="startorder1" style="display:none;margin-left: 39%;margin-top: -42px;position: absolute;" alt="Loading" /></td></tr> <tr><td><input type="button" value="Send Link" onclick="grouporvalidation();" class="finishorder " style="margin-left:32%" /></td></tr> </table> </div> </div> </div> <div id="pnlgrouporderconfirm" class="pnlgroupconfirmorder" style="display:none;"> <div id="modal-behind" class="grouporrdmodal"style="z-index:830000;" ></div> <div id="modalsubmission" class="guestmdoal guestmdoal1" style="z-index:830000;" > <div class="gpickuporderstyles"> <div class="guestpicktitile">Confirm</div> <div><img src="images/IconCloseWindow.png" alt="Close" id="grorderconfirmClose" class="grorderClose popclosebtn" onclick="grouporderconfirmClose()" /></div> </div> <div class="groupodiv"> <table class="tblgrorder"> <tr><td><p class="Psucess" style="font-size: 14px;color: red;text-align: center;"></p></td></tr> <tr><td class="tdgrorder">Successfully sent request to your group, Would you like to add more to your group? </td></tr> <tr><td> <input type="button" value="Yes" onclick="grouporderconfirmClose();" class="getdealbtn" style="margin-left:32%"> <input type="button" value="No" onclick="grouporderClose();" class="getdealbtn" style="margin-left:3%" /></td></tr> </table> </div> </div> </div> <div id="SharedUrlsPanel" style="display:none" > <div id="modal-behind"></div> <div id="modalGrouporder" style="min-height:28px;" > <div > <div class="gitemborder" style="text-align:center"> <span class="gotitile" > Group Order </span> <span style="float:right"> <img src="/images/IconCloseWindow.png" id="Img9" alt="SharedUrlClose" onclick="SharedUrlClose1();" style="cursor:pointer;width:85%" /></span> </div> <div class="sharedusersdiv"> <table style="width:100%;text-align:center"> <tr><td><p class="successmsg" style="color:red;text-align:center"></p></td></tr> <tr class="hidestorder"><td><input name="txtShUsername" type="text" id="txtShUsername" placeholder="Name" class="txtsharedusers" onfocusout="RemoveValidation(this);" onkeypress="return (event.charCode > 64 && event.charCode < 91) || (event.charCode > 96 && event.charCode < 123) || (event.charCode == 32)" onchange="Trim(this)" /> </td></tr> <tr style="display:none"><td> <input name="txtShUrl1" type="text" id="txtShUrl1" placeholder="Share Link" readonly="readonly" class="txtsharedusers" /></td></tr> <tr style="display:none" class="hidestorder"><td style="font-size:14px;color:black;">Or</td></tr> <tr style="display:none"><td style="padding-top: 8px;"><span class="lblactivate">Share Link By: </span> <select id="ddlsharedtype" class="sharellink" onchange="ShareTypeChange()"><option selected="selected">Email</option><option>Phone</option></select></td></tr> <tr style="display:none"><td style="height: 65px;"><input name="txtshEmail" type="text" id="txtshEmail" placeholder="Share Link by Email" class="txtsharedusers1" onfocusout="RemoveValidation(this);" /><input type="button" value="Send" class="btnsharedusers" onclick="SendLinkValidation()" /></td></tr> <tr ><td><img src="/images/loadernew.gif" style="display:none; margin-left:40%;position:absolute;margin-top:-3%" class="sendloader" alt="shared" /></td></tr> <tr style="display:none" class="hidestorder"><td style="font-size:14px;height:30px"><a id="lblshowhelp" style="text-decoration:underline">Help</a></td></tr> <tr style="display:none" class="hidestorder helptext" style="display:none;text-align:left;"><td style="padding-bottom:10px;">Start sharing the link provided to your friends/colleagues and you’re the administrator of the order. Please Share the link to invite others to join your cart by using Email or SMS. Split the check among your guests or treat everyone. Pay with Credit Card, Paypal. Click to Start group Order. </td></tr> <tr class="hidestorder"><td class="tdstrgrpord" ><input type="button" value="Start Your Order" class="btnsharedusers" onclick="StartOrderValidation()" /> </td></tr> </table> </div> </div> </div></div> <div id="grouplaceorderalert" class="grouplaceorderalert" style="display:none"> <div id="modal-behind" class="deliverymodal" style="z-index:1000"></div> <div id="modaldelivery" style="height: 205px;top:100px" > <div class="deliverydiv"> <div class="itembackborder" style="text-align:center;background-color:red;"> <span class="lblitemnamestyles" style="color:white"><span id="Label2" class="wiilldeliver">Note</span></span><span style="float:right"><img src="images/close.png" id="Img11" alt="close" class="signinclose closebuttonPickUpstyle" style="background-color:white;border-radius:20px;" onclick="PlaceorderClose();" /></span></div> <div><table style="margin:0 auto;"><tr><td class="Shippingtxt"> Still someone is editing the cart. Would you like to place an order?</td></tr> <tr><td ><input type="button" value="Yes" onclick="YesPlaceOrder();" class="Shippingbtn" /> <input type="button" value="No" onclick="NODontPlaceOrder();" class="ShippingbtnNO" /></td></tr> </table></div> </div> </div> </div> <div id="grouplaceorderplaced" class="grouplaceorderplaced" style="display:none"> <div id="modal-behind" class="deliverymodal" style="z-index:1000"></div> <div id="modaldelivery" style="height: 205px;top:100px" > <div class="deliverydiv"> <div class="itembackborder" style="text-align:center;background-color:red;"> <span class="lblitemnamestyles" style="color:white"><span id="Label4" class="wiilldeliver">Note</span></span><span style="float:right"><img src="images/close.png" id="Img12" alt="close" class="signinclose closebuttonPickUpstyle" style="background-color:white;border-radius:20px;" onclick="AlreadyOrderPlaced();" /></span></div> <div><table style="margin:0 auto;"><tr><td class="Shippingtxt"> Sorry this order has been placed. You can't add items to cart.</td></tr> <tr><td ><input type="button" value="Ok" onclick="AlreadyOrderPlaced();" class="Shippingbtn" /></td></tr> </table></div> </div> </div> </div> <div id="PnlMembersJoining" style="display:none" > <div id="modal-behind"></div> <div id="modalGrouporder" style="min-height: 250px;"> <div> <div class="gitemborder" style="text-align:center"> <span class="gotitile" > Group Order </span> <span style="float:right"> <img src="/images/IconCloseWindow.png" id="Img10" onclick="SharedUrlClose();" style="cursor:pointer;width:85%" alt="Icon Close" /></span> </div> <div class="sharedusersdiv"> <table style="width:100%;text-align:center"> <tr><td class="joiningtext">Joining <span id="lblGAdmin"></span> Shared Cart</td></tr> <tr><td><p class="successmsg1" style="color:red;text-align:center"></p></td></tr> <tr><td><input name="txtmembername" type="text" id="txtmembername" placeholder="Name" class="txtsharedusers" onfocusout="RemoveValidation(this);" maxlength="40" onkeypress="return (event.charCode > 64 && event.charCode < 91) || (event.charCode > 96 && event.charCode < 123 || event.charCode == 32)" /> </td></tr> <tr><td><img src="/images/loadernew.gif" style="display:none; margin-left:40%;position:absolute;margin-top:-3%" class="sendloaderm" alt="shared" /></td></tr> <tr><td class="grporderaddmember" style=""><input type="button" value="Start Your Order" class="btnsharedusers" onclick="StartMemberValidation()" /> </td></tr> </table> </div> </div> </div></div> <div id="forgetpasswordpnl" style="display:none"> <div id="modal-behind" class="forgetmodal"></div> <div id="forgotmodal"><div class="forgotpass_popuptitle">Forgot Password<img id="ImageButton" src="images/IconCloseWindow.png" alt="productmanagement closebutton " title="closebutton" class="btnclose2" align="right" onclick="forgetpasswordclose()"/></div> <div class="forgotpass_popupcontnet"> <div id="pnlPop"> <table width="100%" summary="User forget password" cellpadding="0" cellspacing="0" > <tr><td style="height:20px;"><div class="forgetloader" id="Div15"><img alt="loading" src="images/OrderLoader.gif"/></div></td> </tr> <tr><td width="30%" align="right" style="color: hsl(0, 0%, 0%); font-size:18px;">Email Id :</td><td align="left"><input name="txtEId" type="text" maxlength="110" id="txtEId" class="login_formtext" placeholder="Email or PhoneNumber" style="height:30px;width:200px;" /><span id="RequiredFieldValidator5" style="color:Red;visibility:hidden;"></span></td></tr> <tr><td align="center" colspan="2" ><span id="Forgetlbl" style=" color:red"></span></td></tr> <tr><td align="center" colspan="2" style="padding-top: 10px;"><input type="button" id="imgbtnPwdSubmit" class="submit1btn" onclick="forgetpasswordValidation(); return false;" value="Submit" /></td></tr> </table> </div></div></div> </div> <div id="DeliveryZonesDisplay" style="display:none" class="DeliveryZonesDisplay" > <div id="modal-behind" class="deliveryzonemodal"></div> <div id="modalsubmission" class="guestmdoal"> <div class="gpickuporderstyles"><div class="guestpicktitile">Delivery Zones</div><div><img src="images/IconCloseWindow.png" id="DeliveryZoneClose" alt="Close" class="popclosebtn" onclick="CloseDeliveryZone()" /></div></div> <div style="width:100%;overflow:auto;padding:10px 0"><iframe id="ifmDeliveryZones" width="98%" height="400px" style="border:0"></iframe></div></div></div> <div id="RecipeDisplay" style="display:none" class="RecipeDisplay" > <div id="modal-behind" class="deliveryzonemodal"></div> <div id="modalsubmission" class="guestmdoal RecipeAdjustPanel" style="z-index:2000" > <div class="gpickuporderstyles"><div class="guestpicktitile">Recipe</div><div><img src="images/IconCloseWindow.png" id="RecipeClose" alt="Close" class="popclosebtn" onclick="CloseRecipe()" /></div></div> <iframe id="ifmRecipe" width="98%" height="400px" style="border:0"></iframe></div></div> <div id="PhotosDisplay" style="display:none" class="PhotosDisplay" > <div id="modal-behind" class="photosmodal"></div> <div id="photosmodal" class="guestmdoal"> <div class="gpickuporderstyles"><div class="guestpicktitile">Photos</div><div><img src="images/IconCloseWindow.png" id="PhotosClose" alt="Close" class="popclosebtn" onclick="ClosePhotosPanel()" /></div></div> <div class="PictureGallery" id="UploadedImageGallery" style="border-color:#afadad;border:0.2em;margin-right:20px;margin-bottom:20px;width:100%;padding:10px;" > </div> </div></div> <div id="Addreviewspanel" style="display:none;z-index:99472" class="Addreviewspanel" > <div id="modal-behind"></div> <div id="addreviewmodal" class="guestmdoal"> <div class="gpickuporderstyles"><div class="guestpicktitile1">Add Review</div><div><img src="images/IconCloseWindow.png" id="Img2" alt="Close" class="popclosebtn" onclick="AddreviewClose()" /></div></div> <div class="yourcarttablestyles yourcartborder" style="border:none"> <div style="width:100%;text-align:center;overflow:auto"><label id="lblerrorreview" class="lblerrorreview" style="font-size:14px;color:red;display:none;"></label></div> <div class="yourcartstylesnew" style="width:100%"><div id="Rating1" class="reviewimg"> <input type="hidden" name="Rating1_RatingExtender_ClientState" id="Rating1_RatingExtender_ClientState" /><a href="javascript:void(0)" id="Rating1_A" title="0" style="text-decoration:none"><span id="Rating1_Star_1" class="rating_star rating_empty" style="float:left;"> </span><span id="Rating1_Star_2" class="rating_star rating_empty" style="float:left;"> </span><span id="Rating1_Star_3" class="rating_star rating_empty" style="float:left;"> </span><span id="Rating1_Star_4" class="rating_star rating_empty" style="float:left;"> </span><span id="Rating1_Star_5" class="rating_star rating_empty" style="float:left;"> </span></a> </div> </div> <div style="width:100%"><div class="ReviewLoader"> <img alt="Loader" src="images/loadernew.gif"/></div> <textarea name="txtreviewadd" rows="2" cols="20" id="txtreviewadd" class="task_formtextarea2" placeholder="Type Review Here"> </textarea></div> <div style="width:100%;text-align: center;padding: 32px 0px 10px 20px;" id="ReviewUserImages"></div> <div style="width:100%;text-align: center;padding: 32px 0px 10px 20px;"><input type="file" id="reviewupload" class="reviewupload" multiple="" /></div> <div class="savebtn"><input type="button" id="btnsubmitreview" class="savereviewbtn" onclick="SubmitReview()" value="Save Review" /></div> </div></div></div> <div id="PnlDeliveryService" style="display:none;z-index:99472" class="PnlDeliveryService" > <div id="modal-behind"></div> <div id="addreviewmodal" class="guestmdoal"> <div class="gpickuporderstyles"><div class="guestpicktitile1">Add Rating</div><div><img src="images/IconCloseWindow.png" id="Img2" alt="Close" class="popclosebtn" onclick="AddreviewClose()" /></div></div> <div class="yourcarttablestyles yourcartborder" style="border:none"> <div style="width:100%;text-align:center;"><label id="lblDeliveryServiceerrorreview" class="lblDeliveryServiceerrorreview" style="font-size:14px;color:red;display:none;"></label></div> <div class="yourcartstylesnew" style="width:100%"><div id="DeliveryServiceRating" class="reviewimg1"> <input type="hidden" name="DeliveryServiceRating_RatingExtender_ClientState" id="DeliveryServiceRating_RatingExtender_ClientState" /><a href="javascript:void(0)" id="DeliveryServiceRating_A" title="0" style="text-decoration:none"><span id="DeliveryServiceRating_Star_1" class="rating_star1 rating_empty1" style="float:left;"> </span><span id="DeliveryServiceRating_Star_2" class="rating_star1 rating_empty1" style="float:left;"> </span><span id="DeliveryServiceRating_Star_3" class="rating_star1 rating_empty1" style="float:left;"> </span><span id="DeliveryServiceRating_Star_4" class="rating_star1 rating_empty1" style="float:left;"> </span><span id="DeliveryServiceRating_Star_5" class="rating_star1 rating_empty1" style="float:left;"> </span></a> </div></div> <div style="width:100%"><div class="ReviewLoader"> <img alt="Loader" src="images/loadernew.gif"/></div> <textarea name="txtDeliveryServiceReview" rows="2" cols="20" id="txtDeliveryServiceReview" class="task_formtextarea2" placeholder="Type Review Here"> </textarea> </div> <div class="savebtn"><input type="button" id="btndeliveryservice" class="savereviewbtn" onclick="SubmitDeliveryServiceReview()" value="Save Review" /> </div></div></div></div> <div id="ViewReviews" style="display:none" class="ViewReviews"> <div id="modal-behind" class="viewreviewmodal"></div> <div id="viewremodal" class="guestmdoal"> <div class="gpickuporderstyles"><div class="guestpicktitile">Reviews</div><div><img src="images/IconCloseWindow.png" alt="Close" id="Img3" class="popclosebtn" onclick="viewreviewClose()" /></div></div> <div class="yourcarttablestyles yourcartgrnd"> <div style="width:100%;text-align:center;padding-top:10px;"><label id="lblsuccess" class="lblsuccess" style="font-size:14px;color:red;display:none;"></label></div> <div class="reviewsleft" style="height:450px;"><div class="ReviewsLoader" style="display:none;"><img alt="loading" src="images/loadernew1.gif"/></div> <table id="reviewstable" class="reviewstable" ></table></div> </div></div></div> <div id="ViewFavorites" style="display:none" class="ViewFavorites"> <div id="modal-behind" class="viewreviewmodal"></div> <div id="viewremodal" class="guestmdoal"> <div class="gpickuporderstyles"><div class="guestpicktitile">Favorites</div><div><img src="images/IconCloseWindow.png" alt="Close" id="Img3" class="popclosebtn" onclick="ViewFavoritesClose()" /></div></div> <div class="yourcarttablestyles yourcartgrnd"> <div style="width:100%;text-align:center;padding-top:10px;"><label id="Label3" class="lblsuccess" style="font-size:14px;color:red;display:none;"></label></div> <div class="reviewsleft" style="height:450px;"><div class="ReviewsLoader" style="display:none;"><img alt="loading" src="images/loadernew1.gif"/></div> <table id="FavoritesTable" class="FavoritesTable" style="width:100%" ></table></div> <div style="text-align:center;padding:20px 0px 20px 0px;"> </div></div></div></div> <div id="ViewDeliveryServiceReviews" style="display:none" class="ViewDeliveryServiceReviews" > <div id="modal-behind" class="viewreviewmodal"></div> <div id="viewremodal" class="guestmdoal"> <div class="gpickuporderstyles"><div class="guestpicktitile">Reviews</div><div><img src="images/IconCloseWindow.png" alt="Close" id="Img3" class="popclosebtn" onclick="viewreviewClose()" /></div></div> <div class="yourcarttablestyles yourcartgrnd"> <div style="width:100%;text-align:center;padding-top:10px;"><label id="lblDeliveryServicesuccess" class="lblDeliveryServicesuccess" style="font-size:14px;color:red;display:none;"></label> <label id="lblDeliveryServiceId" style="font-size:14px;display:none;"></label></div> <div class="reviewsleft" style="height:450px;"><div class="ReviewsLoader" style="display:none;"><img alt="loading" src="images/loadernew1.gif"/></div> <table id="tblDeliveryServiceReviews" class="reviewstable" ></table></div> <div style="text-align:center;padding:20px 0px 20px 0px;"><input type="button" value="Add a Review" onclick="AddDeliveryServiceReview()" id="Img4" class="reviewbtn" /><label id="Label5" style="display:none;"></label></div> </div></div></div> <div id="pnluserverify" class="pnluserverify" style="display:none"> <div id="modal-behind"></div> <div id="modal" style="background-color: white;height: 275px;top: 212px;" class="adjustpnluserverify"> <div class="editediv"><span class="texttype">User Verification</span> <img align="right" style="cursor:pointer" src="images/productmanagementclosebut.png" onclick="Closepnluserverify();" alt="Close"/></div> <div style="margin-top:30px"><table style="width:100%;text-align:center;color:black;font-size:16px"> <tr><td colspan="4" style="height:40px"><label id="emailmsg2" style="color:red;font-size:12px;"></label></td></tr> <tr><td width="30%" >Email: </td><td style="text-align:left;height:40px;"><label id="luemail"></label> </td><td style="text-align:right"> <label id="luebtn" class="verifybtn"></label></td><td width="16%"></td></tr> <tr><td >Phone:</td><td style="text-align:left"> <label id="luphno"></label></td><td style="text-align:right"> <label id="luphbtn" class="verifybtn"></label></td><td></td></tr> <tr><td style="height:40px" colspan="3"> <img alt="loading" class="loader2" src="images/OrderLoader.gif" style="display:none;margin-left: 230px;" ></img></td><td></td></tr> </table></div></div></div> <div class="pnlphverif" id="pnlphverif" style="display:none"> <div id="modal-behind"></div> <div id="modal" style="background-color: white;height: 275px;top: 212px;" class="adjustpnlphverif"> <div class="editediv"><span class="texttype">Phone Number Verification</span><img align="right" style="cursor:pointer" src="images/productmanagementclosebut.png" onclick="Closepnlphverif();" alt="Close"/></div> <div style="margin-top:30px"><table style="width:100%"> <tr><td height="40px"><label id="lblphnomsg" style="color:red"></label></td></tr> <tr><td><input type="text" id="txtphvcode" class="productmanagement_formtext1" placeholder="Enter Code" /></td></tr> <tr><td height="40px"><a onclick="SendConfemail();">Resend Code</a></td></tr> <tr><td><input type="button" onclick="Phnoverifyvalidation();" class="OTPButton" value="Submit" /></td></tr> <tr><td height="20px"></td></tr></table> </div></div></div> <div id="DriverReviews" style="display:none" class="DriverReviews"> <div id="modal-behind" class="viewreviewmodal"></div> <div id="viewremodal" class="guestmdoal" style="position:fixed !important"> <div class="gpickuporderstyles"><div class="guestpicktitile">Reviews</div><div><img src="images/IconCloseWindow.png" alt="Close" id="Img5" class="popclosebtn" onclick="ViewDriverReviewClose()" /></div></div> <div class="yourcarttablestyles yourcartgrnd"> <table style="margin:0px auto;padding:15px 0px;"> <tr><td><img id="imgdriverimage" alt="DriverImage" /></td> <td><table style="font-size:16px;color:black;"> <tr><td>Driver Name :</td><td><label id="lbldrivername"></label></td></tr> <tr><td>No.Of Deliveries :</td><td><label id="lbldriverycount"></label></td></tr> <tr><td>Avg.Delivery Time :</td><td><label id="lbldriveryaverage"></label> </td></tr> </table> </td></tr></table> <div style="text-align:center;"><label id="lblnoreviewmsg" style="display:none;color:red;font-size:14px;" ></label></div> <div class="Driverreviewsleft" style="height:auto;"><div class="DriverReviewloader" style="display:none;"><img alt="loading" src="images/loadernew1.gif"/></div> <table id="DriverReviewTable" class="DriverReviewTable" style="width:100%;padding:0px 15px;" ></table></div> </div></div></div> <div id="couponpnl" style="display:none"> <div id="modal-behind" class="Couponaddmodal"></div> <div id="viewremodal" class="guestmdoal"> <div id="viewremodal"> <div class="coupnhd">Submit a coupon and save!<span class="coupnx"><img id="imgclosecoupon" src="images/IconCloseWindow.png" alt="Close" /></span></div> <div class="coupnmn"> <div><input name="txtcupnrst" type="text" id="txtcupnrst" disabled="disabled" class="coupnfrmt" style="background-color:White;" /></div> <div><input name="txtcuptitle" type="text" maxlength="50" id="txtcuptitle" class="coupnfrmt" /> <input type="hidden" name="TextBoxWatermarkExtender3_ClientState" id="TextBoxWatermarkExtender3_ClientState" /> <span id="RequiredFieldValidator4" style="color:Red;font-size:16px;visibility:hidden;">*</span> </div> <div><input name="txtcupnlink" type="text" maxlength="15" id="txtcupnlink" class="coupnfrmt" /> <input type="hidden" name="txtwatermark_ClientState" id="txtwatermark_ClientState" /> <span id="RequiredFieldValidator3" style="color:Red;font-size:16px;visibility:hidden;">*</span> </div> <div><textarea name="txtcupnother" rows="2" cols="20" id="txtcupnother" class="coupnfrmt" style="padding:5px 10px"> </textarea> <input type="hidden" name="TextBoxWatermarkExtender1_ClientState" id="TextBoxWatermarkExtender1_ClientState" /> </div> <div style="overflow:auto;text-align:left"> <div class="coupndislt"><p>Expiration Date</p><input name="txtcupndate" type="text" value="05/21/2025" maxlength="10" id="txtcupndate" class="coupnfrmt datepicker" autocomplete="off" placeholder="Expiration Date" style="width:86%;" /></div> <div class="coupndislt"><p>Expiry Time</p><select name="ddlfromtimes1" id="ddlfromtimes1" class="coupnfrmt" style="width:100%;"> </select></div> </div> <div style="overflow:auto;text-align:left"> <div class="coupndislt"><p>Discount Type</p><select name="ddlcupndistype" id="ddlcupndistype" class="coupnfrmt"> </select></div> <div class="coupndislt"><p>Discount</p><input name="txtcupndst" type="text" maxlength="3" id="txtcupndst" class="coupnfrmt" /></div> </div> <p style="color:#000000">* Your Coupon will not appear in our website or app until this information has been verified by Munchem. Coupon can be automatically applied once approved using the coupon code.</p> <div style="text-align:center;margin-top:30px;"><input type="button" id="submitcoupon" value="Submit Coupon" class="coupnsubmt" onclick="AddNewCoupon()" style="cursor:pointer" /> </div> </div> </div> </div> </div> <div id="ActivateMobileconfirm" style="display:none" class="ActivateMobileconfirm" > <div id="modal-behind" class="viewreviewmodal"></div> <div id="viewremodal" class="guestmdoal" style="position:fixed !important"> <div class="gpickuporderstyles"><div class="guestpicktitile">Activate Your Account</div><div><img src="images/IconCloseWindow.png" alt="Close" id="Img56" class="popclosebtn" onclick="CloseMobActivate()" /></div></div> <div><table width="100%" border="0" cellspacing="0" cellpadding="0" summary="User Login form" class="activatetable"> <tr><td><div><label id="lblmoberrmsg" style="font-size:11px;display:none;" class="error_message"></label></div> <p>You're almost there!</p><p>Check Your Texts For a Confirmation Code</p> <div class="activatemobileloader" id="actmobdiv" style="display:none"><img alt="loading" src="images/OrderLoader.gif"/></div> <div class="imgtxt"><div class="txtdiv"><input name="txtmobactivate" type="text" maxlength="6" id="txtmobactivate" class="txtwidth" placeholder="Activation Code" /> <span id="RequiredFieldValidator8" style="color:Red;font-size:Large;visibility:hidden;">*</span> </div> <div><input type="button" id="imgbtnmobactivate" onclick="ConformMobActivation()" class="activateimage1 activateimg" value="Activate" /></div></div> <p >If not received the code, please confirm your phone number</p> <div class="imgtxt"> <div class="txtdiv"><input name="txtactivatemobileno" type="text" maxlength="13" id="txtactivatemobileno" class="txtwidth" placeholder="Enter Mobile Number" /> <span id="RequiredFieldValidator9" style="color:Red;font-size:Large;visibility:hidden;">*</span> </div> <div><input type="button" id="imgmobconfnumber" value="Save" class="save1btn" onclick="UpdateUserMobileNumber()" /></div> </div> </td></tr> </table></div></div></div> <div id="pnlMoreMunchies" style="display:none" class="pnlMoreMunchies"> <div id="modal-behind" class="viewreviewmodal"></div> <div id="viewremodal" class="guestmdoal pnlMoreMunchiesadjst"> <div class="gpickuporderstyles"><div class="guestpicktitile">How To Earn Munchies</div><div><img src="images/IconCloseWindow.png" alt="Close" id="Img31" class="popclosebtn" onclick="viewMunchiesClose()" /></div></div> <div class="yourcarttablestyles yourcartgrnd"> <div class="reviewsleft" style="height:auto"> <div id="ViewMunchies"></div></div></div></div></div> <div id="ViewSpecials" style="display:none" class="ViewSpecials"> <div id="modal-behind" class="viewreviewmodal"></div> <div id="viewremodal" class="guestmdoal"> <div class="gpickuporderstyles"><div class="guestpicktitile">Offers</div><div><img src="images/IconCloseWindow.png" alt="Close" id="Img3" class="popclosebtn" onclick="viewspecialClose()" /></div></div> <div class="yourcarttablestyles yourcartgrnd"> <div class="reviewsleft" style="height:auto"><div id="bogooffers"></div></div></div></div></div> <div id="ShowSpecials" style="display:none" class="ShowSpecials"> <div id="modal-behind" class="viewreviewmodal" ></div> <div id="viewremodal" class="guestmdoal ShowSpecialsadjust"> <div class="gpickuporderstyles"><div class="guestpicktitile">Add Offers</div><div><img src="images/IconCloseWindow.png" alt="Close" id="Img3" class="popclosebtn" onclick="ShowSpecialsClose()" /></div></div> <div class="yourcarttablestyles yourcartgrnd"> <div class="reviewsleft" style="height:auto"> <div class="divitems">You have multiple offers. Please choose any one</div> <div id="ShowBogos"></div></div></div></div></div> </div></div> <div id="scrollcart" class="scrollcart" style="display:none"> <div class="sharegorder" id="sharegorder" style="display:none"> <input type="button" value="Share Your Order" class="Grdsharebtn btnsharedusers" onclick="Shareorderval();"/> </div> <table id="tblServices"></table> <div class="carright" style="display:none"> <div class="urscart"> <div class="urordertext" style="color:black;background-color:#E0E0E0;">Your Cart <span class="cartsave SaveCart" id="" onclick="SaveCart()" title="Save My Cart"></span> <div class="hmcrt hmcrt1"><img alt="cart" src="/images/Cart1.png" id="btncrt" class="hmcrtimg" /><span id="lblcartcount" class="hmcrtcnt" style="margin-left: -22px;">0</span><input type="hidden" name="lblcartcounthf" id="lblcartcounthf" /><span id="lblcrtamount" style="display:none">0</span></div> <img src="/images/Refresh.png" style="margin-top:-6px;margin-right:10px;display:none;" class="urefresh" onclick="GetAllItems();" title="Refresh your cart" alt="Get all items" /></div> <div class="cartrst"><span id="lblrestaurant">Hoagies Cafe</span></div> <div class="Emptycart" style="display:none"> <div style="text-align:center;"> <img alt="Cart" style="width: 170px;margin: 10px auto;" src="images/cart%20image.png"/> <p class="emptycarttext">choose an item from the menu to get started</p> </div></div> <div class="cartitems" style="display:none"> <div class="cartheight"> <div class="cartnews"> <table width="100%" id="itminfonew" class="displayonitem cartitemh"><tr><td style="width:50%" align="left">Item Name</td><td style="width:10%" align="right">Price</td></tr></table> <div class="addcategoryloadingimage2" id="Div28" style="display:none;" ><img src="images/loadernew.gif" alt="Loader"/></div><table id="tblCart" class="menucart"></table></div> <div id="tblOthersCart" width="100%" style="color:gray;overflow:auto;"> </div> <div class="userdeliveryloader2" id="userdeliveryloader2" style="display:none;position:absolute;z-index:2000;margin-left:20%" > <img alt="loading" src="images/loadernew.gif"/></div> <table class="yourordersteststyles" style="width:100%;display:none;"> <tr><td><div class="userdeliveryloader1" id="userdeliveryloader1" style="display:none;position:absolute;z-index:2000;margin-left:9%;margin-top:10px"><img alt="loading" src="images/loadernew.gif"/></div> </td></tr> <tr><td><label id="cartpromomsg" class="promcartuser"></label></td></tr> <tr><td><span><label id="cartpromomsg1" class="charitytest"></label><img " src="images/DeleteCartItem.png" width="20px" class ="charitytest promcartcharity" onclick="DeleteDeal()" alt="Delete Cart Item" /></span></td> </tr> <tr><td class="register_lable" style="width:40%;"><table class="guuesttotal"><tr><td>Subtotal</td><td class="pricespadding"><label id="lblAlltotalprice" ></label></td></tr></table></td></tr> <tr><td class="register_lable" style="width:40%"><table class="guuesttotal12"><tr><td> <div class="promovisible" style="display:none"><label id="promotitle" class="guuesttotal2"></label> <img alt="Delete CartItem " src="images/DeleteCartItem.png" style="width:14px;cursor:pointer;vertical-align: middle;" onclick="DeleteDeal()" /> </div></td> <td class="pricespadding"><label id="Promoprice" class="promovisible guuesttotal2" style="display:none;text-align:right;color:red;" ></label></td></tr> <tr><td><label class="promovisible guuesttotal2" id="lblPromoprice" style="display:none;text-align:left;color:green;font-size:15px !important"></label></td> </tr></table> </td></tr> <tr class="taxpadding"><td class="register_lable" id="tdregister" style="width:40%;height:25px;"><table class="guuesttotal2"><tr><td><span class="Typetax"></span> </td><td class="pricespadding"><label id="lbltaxes" style="display:none"></label><label id="lbltaxConven"></label></td> </tr></table></td></tr> <tr class="CVFexist" style="display:none"><td class="register_lable" style="width:40%;height:25px;"><table class="guuesttotal2"><tr><td>Convenience Fee</td><td class="pricespadding"><label id="lblbconvenience"></label></td></tr></table></td></tr> <tr><td class="register_lable" style="width:40%"><table class="guuesttotal12"> <tr><td> <span id="lbldelivaryfeetextlbl" style="display:none;">Delivery *</span></td> <td class="pricespadding" style="border: 0px;"><label id="lbldelivaryfee" style="display:none;" ></label><label id="lbldiscountdeliveryfee" style="display:none"></label></td></tr> </table></td></tr> <tr><td class="register_lable" style="width:40%"><table class="guuesttotal12"><tr ><td> <span id="lblMileageChargelbl" style="display:none;">Mileage Charge</span> </td> <td class="pricespadding" style="border: 0px;"><label id="lblMileageCharge" style="display:none;"></label></td></tr></table></td></tr> <tr><td><table id="tblDrivers"></table></td></tr> <tr><td class="register_lable" style="width:40%;"><table class="guuesttotal2" style="border-top:1px solid #E0E0E0"><tr><td>Total </td><td class="pricespadding"><label id="lbltotalamount" ></label><label id="lblamnt" style="display:none"></label></td></tr></table></td></tr> <tr><td class="notefordelivery" style="display:none;height:40px;">Note: *Any delivery fee charged is not a tip for the delivery driver. Please tip your driver for excellent service.</td></tr> <tr><td class="mncatcent" style="padding:0 10px"><span id="SubmissionNotes" style="font-size: 13px;line-height: 16px;text-align: left;color: black; "></span></td></tr> <tr id="trPromo" style="display:inline-block;"><td valign="top" class="mncatcent"><input type="text" id="Promocodetxt" class="promocodetext" placeholder="Enter Promo/Coupon Code" maxlength="80" /><input type="button" value="Get Deal" onclick="CheckDeal()" class="getdealbtn" /></td></tr> <tr><td><div><p id="idloginoints" class="pointsdisplytxt" style="display:none"> <span style="color:blue;cursor:pointer" onclick="signinpanelopen('Points')" >Login</span> to see available <span id="lblRewardType"></span> </p> <div id="idorderwithpoints" style="display:none;font-size: 16px;"> <p style="color:black;text-align:center" id="earnpoints" >Earn <label id="lblearnedpoints" style="color:green!important" ></label> with this order! </p> <p style="color:black;text-align:center" id="displayuserpoints"> You have <label id="lblpoinsyoucanyern" style="color:green!important" ></label></p> </div> <div class="ViewMoreMunchies" style="display:none"><p style="color:black;text-align:center;"><a onclick="ViewMoreMunchies()" >Click Here</a> to view earn Munchies/Points.</p></div> <div class="ViewUserMunchies" style="display:none"><p style="color:black;text-align:center;"><a href="ViewMunchies.aspx" target="_blank" > View Munchies/Points</a></p></div> </div> </td></tr> <tr><td style="background-color:#E0E0E0;"> <label id='lblPickupname' style="display:none"></label> <label id='lblDineInname' style="display:none"></label> <table id="tblOrderTypes"></table> </td></tr> <tr><td><div class="errormsg1" style="color:red"></div></td></tr> <tr class="ShippingSpeeds" style="display:none"><td style="padding:0 10px"><div class="speedclass" style="padding:10px 0px">Choose a Delivery Speed: </div> <div><label id="SpeedId" style="display:none"></label><table id="divSpeeds" class="speedclass"></table></div></td></tr> </table> </div> <div class="ordfsht checkbtndiv"><input type="button" id="bntfnshedord" class="mobilefinish finishorder" onclick=" LoadCrossSellItems()" value="Check Out" /><input type="button" value="Cancel" class="mncatcncl" onclick="CloseCart()" /></div> <div class="Membervisible" style="display:none;text-align:center;"><input type="button" id="btnFinishedAddingofItems" class="finishorder font-face" onclick="FinishedAddingofItems('Finished')" value="Done" /></div> <div class="ordfsht checkoutloaderdiv"><span id="btncheckoutloader" class="loaderfinishorder finishorder" ><img alt="loader" src="images/loadernew1.gif" class="checkrdloader" /></span></div> <div class="checkout mblcheckbtndiv" onclick="LoadCrossSellItems()">Check Out</div> </div> <div class="signinoptdiv"><span class="signinoptdiv-sign" onclick="registrationopen();">Sign-Up</span><span class="signinoptdiv-sign" onclick="signinpanelopen('');">Sign-In</span></div> <div class="signin-accountdiv" style="display:none;"><div class="myaccoundiv"><div class="lblmyaccbtn" id="lblmyaccbtn" onclick="GotoMyAccount();">My Account</div></div></div> </div></div></div> <div class="couponrt"> <div id="divdeliServicesRight">Please select items to compare<br /> delivery service options</div> <div class="dlvservices" style="display:none;"> <div id="divDeliveryServices" style="text-align: center;font-size: 15px;font-weight: bold;color: black;">Compare Prices<br/> Non-affiliated Delivery Services</div> <table id="tblDeliveryServices" style="width:100%"></table> <div style="color:black;">* Don't see your local delivery service. <a href="Default.aspx" >Click Here</a> to add it.<br/>* Estimated pricing only to help users with our available data.<br />Users is advised to use the site for accurate pricing.</div> </div> </div> </div> </div> <div id="grditemspanel" class="grditemspanel"> <div class="griditemsmodal"> <div class="griditemscroll"> <div class="itemmain"><span class="backtooptions" onclick="BacktoOptions();" style="display: block;">←</span><span class="itemmainleft"><label id="lblitemmesg" class="lblitemmesg"></label></span><span class="itemmainright" onclick="CloseOptions();">X</span></div> <div> <div style="position:relative"> <div class="closeitemdiv" style="display:none"><span class="closeitempnl" onclick="CloseOptions();">X</span></div> <div class="menuitemname lblitemmesg" style="display:none;"></div> <div class='shareItem' style="position:relative"><div class="share-sub-div"><span class="spnsvgicon" id="shareicon-btn"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" class="sharesvg"><path d="M14.78 5.883L9.032 0v3.362C3.284 4.202.822 8.404 0 12.606 2.053 9.666 4.927 8.32 9.032 8.32v3.446l5.748-5.883z" class="sharesvgpath" fill="#6c6c6c" fill-rule="evenodd"></path></svg><span style="margin-left: 5px;">Share</span></span></div> <div class="shareiconsdiv" style="display:none"> <ul> <li><div id="fbimage"><img src="/images/FFacebook1.png" style="width:40px;height:40px" /></div></li> <li><div id="twitterimg"><img src="/images/FTwitter1.png" style="width:40px;height:40px" /></div></li> <li><div id="googleplusimg" style="background-color:#ee0000;padding:8px;border-radius:50%"><img src="/images/gplus.png" style="width:30px;height:20px" /></div></li> <li><div id="cpyurl" style="background-color:#fff;padding:0px;border-radius:50%" onclick="copytoclipboard()"><img src="/images/PaperbagLogo.png" id="copyItemUrl" style="width:40px;height:40px" /></div></li> </ul> </div> </div> <div id="displayMultipleImages" style="display:none;width:100%;margin-top:15px"></div> <img id="ItemImageDisplay" alt="Item image" class="itemimageshow" style="display:none" /> <div class="itemnamecs" style="display:none"><label id="lblitemmesg" class="lblitemmesg"></label></div> <div style="width:95%;margin:0 auto"><div class="lbldescriptiontitle" style="display:none;">Description:</div><label id="lbldescription" class="lbldescription"></label></div></div> <div> <table class="nutritiontable"> <tr ><td><img src="images/RoundPlus.png" alt="Plus" style="cursor:pointer;vertical-align: middle;width: 18px;" id="imgvisible1" onclick="Nvisible()" /> Nutritional Information</td></tr> <tr><td> <table class="nutritiontable1" style="display:none"> <tr><td>Calories</td><td><span class="Nutrition" id="txtCalories" /></td></tr> <tr><td>Calories From Fat </td><td><span " class="Nutrition" id="txtCfat" /></td></tr> <tr><td>Total Fat (g)</td><td><span class="Nutrition" id="txtTotalFat" /></td></tr> <tr><td>Saturated Fat (g)</td><td><span class="Nutrition" id="txtSaturatedFat" /></td></tr> <tr><td>Trans Fat (g)</td><td><span class="Nutrition" id="txtTransFat" /></td></tr> <tr><td>Cholestrol (mg)</td><td><span class="Nutrition" id="txtCholestrol" /></td></tr> <tr><td>Sodium (mg)</td><td><span class="Nutrition" id="txtSodium" /></td></tr> <tr><td>Total Carbohydrates (g) </td><td><span class="Nutrition" id="txtCarbohydrates" /></td></tr> <tr><td>Dietary Fiber (g)</td><td><span class="Nutrition" id="txtFiber" /></td></tr> <tr><td style="width:90%">Sugars (g)</td><td><span class="Nutrition" id="txtSugars" /></td></tr> <tr><td>Protein (g)</td><td><span class="Nutrition" id="txtProtein" /></td></tr> <tr><td colspan="2"><table style="width:100%" id="tblOthernutr"></table></td></tr></table> </td></tr> </table> </div> <div align="center" class="divhead" id="divhead"> <div class="divminheight" id="divminheight"> <div id="divVariations" style="color:gray;text-align: left;width:95%"></div> <div class="backoptionsloader" id="backoptionsloader"><img alt="loading" src="images/loadernew.gif"/></div> <div class="itemflowcolumns" id="itemflowcolumns"> <div class="itemflowcolumnslft"><img id="lblitemimage" alt="Item Image" /></div> <div class="itemflowcolumnsrgt"> <div class="itemflowitemname" id="itemflowitemname" style="font-weight:700;"></div> <div class="itemflowprice" id="itemflowprice"></div> <div class="itemflowqty" id="itemflowqty"></div> </div> </div> <table id="OptionTable" width="95%" class="OptionTable"></table> <table id="PreviewOptionTable" width="95%" class="OptionTable"></table> <div><a id="btnVideoURL1" target="_blank" style="display:none"> <input type="button" id="btnVideoURL" class="btnVideoURL Munchembtn" value="See Video" /></a> <input type="button" style="display:none" class="btnRecipe Munchembtn" value="See Recipe" onclick="ShowRecipe(this);" /> </div> </div> </div> </div> <div class="divhead1" align="center"> <div style="width:100%;"><div><textarea id="txtinstructions" spellcheck="true" onpaste="return false" onkeydown="return BlockingHtml(this,event);" class="txtinstructions" rows="2" cols="2" placeholder="Item Instructions(additional charges may apply)" ></textarea></div> <div class="instrutioncount1" align="center"><label id="flowoptbtnerror" style="color:red;font-size:15px;"></label></div> <div class="instrutioncount"><span id="lblitemintcount" style="display:none;"></span> </div> <div class="pricetext"><div style="margin-bottom:15px;"><label id="additemserror" style="color:red;font-size:15px;"></label></div> <div style="float:left;width:36%" class="makeitcombodiv"><input type="button" id="btnmakeitcombo" class="ordadditem btnmakeitcombo" onclick="ValidatingOptionsCheck()" value="Add to Cart" style="display:block;float:left" /></div> <div class="btncomboloaderdiv" style="display:none;"><span id="btnloader" class="ordadditem btnaddtocart comboloadrdloader"><img alt="loader" src="images/loadernew1.gif" class="loadrdloader" /></span></div> <div class="ordqntymnlt" id="tdordqntymnlt"> <div class="ordqnty itemqtyamt" id="tditempriceqty"><div style="float:left"><span onclick="RemoveQuantity()" class="ordqntylt">-</span></div><div style="float:left"><input type="text" id="txtquantity" class="ordqntytxt qtycart" readonly="readonly" /></div><div style="float:left"><span class="ordqntyrt" onclick="AddQuantity()">+</span></div></div> <label id="lblunit" style="display: inline-block;margin-top: 10px;margin-left: 5px;font-size: 25px;color:black;"class="munprice"></label> <div class="orditunit" id="tdunitPrice" style="display:none;"> <div class="itemutx" id="lblunitprice"></div> <div class="ordqnty"><span onclick="RemoveUnitQuantity()" class="ordqntylt1">-</span> <input type="text" id="txtunitquantity" class="ordqntytxt qtycart" readonly="readonly" /><span onclick="AddUnitQuantity()" class="ordqntyrt1">+</span></div> </div> </div> <div class="ordqntymnlt1"><label id="lbldisplayItemPrice" class="munprice"></label></div> <div style="float:right" class="addtocartdiv"><input type="button" id="btnaddtocart" class="ordadditem btnaddtocart" onclick="ValidatingOptionsCheck()" value="Add to Cart" style="display:block;" /></div> <div class="btnloaderdiv"><span id="btnloader" class="ordadditem btnaddtocart"><img alt="loader" src="images/loadernew1.gif" class="loadrdloader" /></span></div> </div> </div> <script type="text/javascript"> var IsShiftDown = false; function BlockingHtml(Sender, e) { var key = e.which ? e.which : e.keyCode; if (key == 16) { IsShiftDown = true; } else if ((IsShiftDown == true) && ((key == 188) || (key == 190)) && ((key == 44) || (key == 46))) { return false; } } </script> </div> </div></div></div> </div></div> </div></div> </div> </div> <div id="UserNameReqpnl" style="z-index: 1003;display:none" class="UserNameReqpnl"> <div id="signmodal-behind"></div> <div id="namesignin" class="signinAdjustpanel"> <div class="signinst "><span class="nameh1"> Enter Your Details</span><span style="float:right"><img id="signinclose" src="/images/IconCloseWindow.png" alt="Panel close" class="signinclose" onclick="CloseRegPanel()"/></span></div> <table style="width:100%"> <tr><td style="height:20px;"></td></tr> <tr><td style="height:50px"><input type="text" id="txtfPhnoreq" placeholder="Phone Number" maxlength="15" class="userlogin_formtext1" onkeypress='return isNumber(event,this)' /></td></tr> <tr><td style="height:50px"><input type="text" id="txtfnamereq" placeholder="First Name" maxlength="50" class="userlogin_formtext1" onkeypress="return (event.charCode > 64 && event.charCode < 91) || (event.charCode > 96 && event.charCode < 123) || (event.charCode == 32)" onchange="Trim(this)"/></td></tr> <tr><td style="height:50px"><input type="text" id="txtlnamereq" placeholder="Last Name" maxlength="50" class="userlogin_formtext1" onkeypress="return (event.charCode > 64 && event.charCode < 91) || (event.charCode > 96 && event.charCode < 123) || (event.charCode == 32)" onchange="Trim(this)" /></td></tr> <tr><td style="height:50px"><input type="text" id="txtemailreq" placeholder="Email Address" class="userlogin_formtext1" style="display:none" /></td></tr> <tr><td> <p class="error-message pmsgreq" style="color:red"></p><img src="images/loadernew.gif" class="namereqloader" style="display:none;margin-left:48%" alt="Loader" /></td></tr> <tr><td><input type="button" value="Save" style="font-size:20px;padding:5px;cursor:pointer" onclick="namereqvalidation();" /></td></tr> <tr><td style="height:20px;"></td></tr> </table> </div></div> </div> <div id="crosssellitemspanel" style="display:none"> <div id="modal-behind"></div> <div class="crosssellitemspanelopen"> <div class="itembackborder"><span class="lblitemnamestyles"><label class="wiilldeliver">May We Suggest</label></span><span style="float:right"> <img src="images/IconCloseWindow.png" id="Img7" alt="close" class="signinclose closebuttonPickUpstyle" onclick="CloseCrossSell();" /></span></div> <div class="divitems" id="divitems">Customers who ordered <b><label id="lbltaxname"></label></b> have also added the following to their cart</div> <div id="crosssellitems" class="bstimeslider2"></div> </div></div> <div id="contenttilespanel" style="display:none"> <div id="modal-behind"></div> <div class="crosssellitemspanelopen contentilespanelopen"> <div class="itembackborder" style="background-color:red"><span class="lblitemnamestyles"><label class="wiilldeliver" id="contenttileshead" style="color:white"></label></span><span style="float:right"> <input name="Img8" type="button" id="Img8" alt="close" class="signinclose closebuttonPickUpstyle" style="cursor:pointer;border:2px solid #fff;background-color:red;color:#fff;border-radius:50%;font-size:20px;font-weight:bold;width:35px;height:35px;margin-right:3px;outline:none" value="X" onclick="CloseContentTiles();" /></span></div> <div id="contenttilesdescrp" class="contentdescrdiv"></div> </div></div> <label id="Taxes" style="display:none;"></label><label id="Taxeslabel" style="display:none;"></label><label id="lblTotalPrices" style="display:none;"></label> <label id="lblTotalPriceforPromos" style="display:none;"></label><label id="lblorderfail" style="display:none;"></label> <div id="reservationPanel" style="display:none;" class="reservationPanel"> <div id="modal-behind" class="reservemodal"></div> <div id="modal" style="top:160px; width:775px;height: 250px;left: 56%;position:absolute;"> <div class="Reservationloader" style="display:none;margin-left: 191px;margin-top: 94px;position: absolute;z-index: 1000;" ><img src="images/ReservationLoader.gif" alt="Loading"/></div> <div class="picturegalerydiv"> <div style="float:left;"><img src="images/Reservationimg.png" style="padding-left: 10px;padding-top: 5px;" alt="Reservation"/></div><p class="viewloyaltytext " style="margin-top: 10px;font-size:20px;"> Make Your Free Reservation</p> <div style="float:right;margin-top: 28px;"> <img id="Image14" onclick="closepanelViewReservations();" src="images/IconCloseWindow.png" style="margin-top: -24px;width: 25px;height: 25px;margin-right: 10px;cursor: pointer;" alt="Close" /></div> </div> <div style="width:56%;background-color:#dfebf7;height:216px"> <div style="position: absolute;text-align: center;width: 55%;margin-top:30px;"> <table style="margin-left: 117px;"> <tr align="left"><td height="25px" ><select id="ddlweek" class="ddlweek" style="width: 207px;height: 22px;" onchange="LoadAllottedSeats()" ></select></td></tr> <tr align="left"><td height="45px"><select id="ddlguest" class="ddlguest" style="width: 207px;height: 22px;" onchange="LoadTimings()" ></select></td></tr> <tr align="left"><td height="25px"><select id="ddltimes" class="ddltimes" style="width: 207px;height: 22px;" ></select></td></tr> <tr><td height="20px"></td></tr> <tr><td><img style="cursor:pointer;" id="makereservationsbtn" src="images/MakeFreeReservations.png" onmouseover="this.src='images/MakeFreeReservations1.png';" onmouseout="this.src='images/MakeFreeReservations.png'" onclick="BookTable();" alt="Make Free Reservations" /></td></tr> </table> </div></div></div></div> <div id="divcoupons" style="display:none" class="divcoupons" > <div id="modal-behind" class="coupons"></div> <div id="modalsubmission" class="guestmdoal"> <div class="couponsdivstyles"><div class="coupontitile">Coupons</div><div><img src="images/IconCloseWindow.png" id="couponsClose" alt="Close" class="popclosebtn" onclick="closecouponsdiv()" /></div></div> <div style="width:80%;overflow:auto;padding:10px;margin:0 auto;"> <div id="restcoupons" class="restcoupons" style="display:none;"><span id="couponsdisplay"></span></div> <div class="CouponDic" id="missingcoupon"> <div class="searchhead">Missing a coupon ? <img id="imglist" class="rstprtimg" src="images/addlistfilled.png" alt="Add List Filling" style="border-width:0px;" /></div> <div class="recentbus">Please add a missing coupon, every coupon is added is subject to approval by authorized restaurant owner or MunchEm administrator before you can apply the coupon.</div> <div style="text-align:center"><input type="button" id="btnaddcoupon" value="Add Coupon" class="recsrchbtn" onclick="Couponadd();" /></div> </div> </div> </div> </div> <div id="divhours" style="display:none" class="divhours" > <div id="modal-behind" class="hours"></div> <div id="modalsubmission" class="guestmdoal"> <div class="hoursdivstyles"><div class="hourstitile">Hours</div><div><img src="/images/IconCloseWindow.png" id="hoursClose" alt="Close" class="popclosebtn" onclick="closehoursdiv()" /></div></div> <div class="hoursmain"> <div class="hourssub"><p><label id="lblholiday" style="display:none;"></label></p> <p><span id="lblpreorder" style="color: white;background-color: violet;padding: 2px 4px;font-size: 14px;display:none;"></span></p> <p><span id="lblPickup" class="Pickupcheck">Pick Up Only</span></p> <p><span id="lbldelivary" class="delivarycheck"></span></p> <p><span id="lblfoodpreptime" class="delivarycheck"></span></p> <p><span id="OpenorClose" style="font-weight: bold;display:none;float:left">Closed until</span></p> <p> <span id="lblallHours">Hours Open : 11:00 AM-7:00 PM</span><img src="/images/SortDown.png" id="imgrsthrs" alt="Delivery Hours" onclick="RestaurantHours();" style="width: 20px;vertical-align: middle;margin: 0 5px;cursor:pointer" /></p> </div> <div> <table id="restauranthours" class="tbldeliveryhrs"></table> <table id="deliveryhours" class="tbldeliveryhrs"> </table> </div> </div> </div> </div> <div id="LoadingPanel" style="display:none;"><div id="modal" style="top: 150px;width: 70%;height: 550px;left: 56%;"><div style="margin-left:70px;position: absolute;z-index: 1000;" ><img src="images/ReservationLoader.gif" alt="Loading"/></div></div></div> <div id="viewreservationspanel" style="display:none;" class="viewreservationspanel"> <div id="modal-behind" ></div> <div id="modal" style="top: 150px;width: 70%;height: 350px;left: 56%;"> <div class="picturegalerydiv"> <div><img src="images/TAbleReservationswhite.png" alt="Table Reservation" style="padding-left: 10px;padding-top: 5px;display:none"/></div> <p class="viewloyaltytext " style="margin-left: 165px;margin-top: 5px;}">Reservation</p> <div style="float:right;"><img id="Image1" alt="Close Reservation" onclick="closepanelViewReservations1();" src="images/Redclose.png" style="width: 25px;height: 25px;margin-right: 10px;cursor: pointer;" /></div> </div> <div style="width:56%;background-color:#dfebf7;height:300px"> <div style="position: absolute;text-align: center;width: 55%;margin-top: 20px;"> <div style="float:left;margin-left:30px;color:black;font-size: 17px;">YOUR RESERVATION IS SET!</div> <table style="margin-top: 23px;width:100%;color:black;text-align: left;margin-left: 32px;"> <tr><td></td><td></td></tr> <tr height="25px" style="font-size:13px"><td width="20%">Restaurant</td><td><label id="restaurantlbl" class="restaurantlbl"></label><label id="lblTableId" class="lblTableId" style="display:none;"></label></td></tr> <tr height="25px" style="font-size:13px"><td>Address</td><td><label id="addresslbl" class="addresslbl" ></label></td></tr> <tr height="25px" style="font-size:13px"><td>Date</td><td><label id="datelbl" class="datelbl" ></label></td></tr> <tr height="25px" style="font-size:13px"><td>Time</td><td><label id="timelbl" class="timelbl"></label></td></tr> <tr height="25px" style="font-size:13px"><td># of Guests</td><td><label id="guestlbl" class="guestlbl"></label></td></tr> <tr height="25px" style="font-size:13px" id="checkPhone"><td colspan="2">If you need to cancel, please call <label id="phnolbl" class="phnolbl"></label></td></tr> </table></div></div></div></div> <div id="dineinsettingspanel" class="sharepanel" style="display:none"> <div id="modal-behind"></div> <div id="modaldelivery" style="width:350px;"> <div class="itembackborder itembackborderdinein"><span class="lblitemnamestyles" style="font-size: 34px;width:100%;">Enter your Details<span></span></span> </div> <div style="margin: 0 auto;text-align: center;padding: 10px 0;background-color:#eae5e5"> <table class="dineintable" cellpadding="0" cellspacing="0" > <tr class="dineinfnamerow rowcount" style="display:none"><td><input name="txtdinefname" type="text" maxlength="50" id="txtdinefname" class="login_formtext" placeholder="First Name" /></td></tr> <tr class="dineinlnamerow rowcount" style="display:none"><td><input name="txtdinelname" type="text" maxlength="50" id="txtdinelname" class="login_formtext" placeholder="Last Name" /></td></tr> <tr class="dineinemailrow rowcount" style="display:none"><td><input name="txtdineemail" type="text" maxlength="110" id="txtdineemail" class="login_formtext" placeholder="Email Id" /></td></tr> <span id="lbldineinemail" style=" color:red;font-size: 14px;margin-top: 5px;"></span> <tr class="dineinphnrow rowcount" style="display:none"><td><input name="txtdinephn" type="text" maxlength="10" id="txtdinephn" class="login_formtext" placeholder="Phone Number" /></td></tr> <span id="lbldineinphn" style=" color:red;font-size: 14px;margin-top: 5px;"></span> <tr class="dineintablerow rowcount" style="display:none"><td><input name="txtdinetable" type="text" maxlength="5" id="txtdinetable" class="login_formtext" placeholder="Table Number" /></td></tr> <tr><td align="center" colspan="2" style="padding-top:10px;"><input name="dineinbtn" type="button" id="dineinbtn" style="border-radius: 25px;" class="submit1btn" value="Continue to View Menu" onclick="SubmitDineinValidations();" /></td> </tr> <tr><td align="center" colspan="2" style="padding-top:10px;"><input name="dineskipbtn" type="button" id="dineskipbtn" style="display:none;border-radius:5px;background-color:white;color:gray;" class="submit1btn" value="Skip>>>" onclick="SkipDineInSettings();" /></td> </tr> </table> </div></div></div> <div class="fcontainer"> <div class="hmheadersub" style="padding:5px 0"> <div class="footersocial footersocialipad"> <div class="smicondiv smicondivsocial"> <a id="smfacebook1" class="smfacebook" target="_blank" style="display:none"><img src="Images/FFacebook.png" alt="Facebook" class="smicon" /></a> <a id="smtwitter1" class="smtwitter" target="_blank" style="display:none"><img src="images/FTwitter.png" alt="Twitter" class="smicon" /></a> <a id="sminstagran1" class="sminstagran" target="_blank" style="display:none"><img src="images/FInstagram.png" alt="Instagram" class="smicon" /></a> <a id="smyoutube1" class="smyoutube" target="_blank" style="display:none"><img src="images/FYouTube.png" alt="You Tube" class="smicon" /></a> <a id="smlinkedin1" class="smlinkedin" target="_blank" style="display:none"><img src="images/FLinkedin.png" alt="Linkedin" class="smicon"/></a> </div> <div class="footseal footsealcate"><span id="siteseal"><script async type="text/javascript" src="https://seal.godaddy.com/getSeal?sealID=hYfHc3eEEFHrgkbGqOLYDcQNQKZaqxK5FwEr7RmhN5cITNwINdzesy50Rw8x"></script></span></div> </div> <div class="divtandp divtandpipad"> <div class="featdiv"><a class="cssterms" href="https://www.munchem.com/TermsofUse.aspx" target="_blank">Terms of Use</a></div> <div class="featdiv"><a class="cssprivacy cssterms" href="https://www.munchem.com/PrivacyPolicy.aspx" target="_blank">Privacy & Policy</a></div> </div> <div class="footerrt1"> <div class="footerptxt">Powered by</div><a href="https://www.munchem.com/" target="_blank"><img src="images/orderemred.png" alt="Munchem " style="width: 30%;" /></a> </div> </div> </div> <div class="rstubibehind" style="height:260%"> <div class="rstubimodal"> <div class="Homesignin icbsignin1" style="height:750px; margin-top:22px;"> <div class="rstubimn"><span class="rstubicls">X</span> <h1 align="center" class="updacc" style="width: 790px;margin-left: -15px;">Update Business Information</h1> <p style="text-align:center;margin-top:10px">All suggested changes need approval from MunchEm.</p> <div><span id="lblmsg20" style="color:Red;"></span></div> <div style="margin-left:38px;"> <div class="rstubifnt">Is this your business?<input type="radio" id="r1" name="rate" value="No" checked="checked" />No<input type="radio" id="r2" name="rate" value="Yes" />Yes</div> <table><tr class="rstubifnt"><td>Business Name</td><td>Address 1</td></tr> <tr><td><input name="txtupdatebusnsname" type="text" id="txtupdatebusnsname" class="userregistrer_formtext1 tooltip loginradiusfbstyles" /> <span id="lblrestname" style="color:Red;font-size:18px;"></span> <span id="rq1" style="color:Red;visibility:hidden;">*</span> </td> <td><input name="txtaddr1" type="text" id="txtaddr1" class="userregistrer_formtext1 tooltip loginradiusfbstyles" /> <span id="rq2" style="color:Red;visibility:hidden;">*</span> </td></tr> <tr class="rstubifnt"><td>Address 2</td><td>Country</td></tr> <tr><td><input name="txtaddr2" type="text" id="txtaddr2" class="userregistrer_formtext1 tooltip loginradiusfbstyles" /></td><td> <select name="ddlcountry" id="ddlcountry" class="userregistrer_formtext1 tooltip loginradiusfbstyles" onchange="CountryChange()" style="width:304px;"> </select> <span id="lblcountry2" style="color:Red;font-size:18px;"></span>'</td></tr> <tr class="rstubifnt"><td>State</td><td>City</td></tr> <tr><td><select name="ddlState1" id="ddlState1" class="userregistrer_formtext1 tooltip loginradiusfbstyles" onchange="GetCities1()" style="width:304px;"> </select> <span id="lblstate" style="color:Red;font-size:18px;"></span> </td><td><select name="ddlcity1" id="ddlcity1" class="userregistrer_formtext1 tooltip loginradiusfbstyles" style="width:304px;"> </select> <span id="lblcity" style="color:Red;font-size:18px;"></span></td></tr> <tr class="rstubifnt"><td>Zip</td><td>Phone</td></tr> <tr><td><input name="txtzip1" type="text" id="txtzip1" class="userregistrer_formtext1 tooltip loginradiusfbstyles" /> </td><td><input name="txtphone" type="text" maxlength="13" id="txtphone" class="userregistrer_formtext1 tooltip loginradiusfbstyles" onkeypress="return isNumber(event)" /> </td></tr> <tr class="rstubifnt"><td>Web Address</td><td>Your Email</td></tr> <tr><td><input name="txtwebaddre" type="text" id="txtwebaddre" class="userregistrer_formtext1 tooltip loginradiusfbstyles" /> </td><td><input name="txtAppemail" type="text" id="txtAppemail" class="userregistrer_formtext1 tooltip loginradiusfbstyles" onchange="Trim(this)" /> <span id="lblyouremail" style="color:Red;font-size:18px;"></span> <span id="RegularExpressionValidator4" class="error_message" style="color:Red;visibility:hidden;">Enter Valid Email</span> </td></tr> <tr class="rstubifnt"><td>Please provide additional context to help us verify this change :<span style="color: #a6a6a6;">Optional</span><br /></td><td>I like to receive orders from MunchEm</td></tr> <tr><td><textarea name="txtcntxt" rows="20" cols="50" id="txtcntxt" class="userregistrer_formtext1 tooltip loginradiusfbstyles" style="width:304px;height:100px"> </textarea></td> <td><table id="chklstord" class="rstubichk" border="0" style="font-size:14px"> <tr> <td><input id="chklstord_0" type="checkbox" name="chklstord$chklstord_0" /><label for="chklstord_0">Pickup</label></td><td><input id="chklstord_1" type="checkbox" name="chklstord$chklstord_1" /><label for="chklstord_1">Delivery</label></td> </tr><tr> <td><input id="chklstord_2" type="checkbox" name="chklstord$chklstord_2" /><label for="chklstord_2">Table Reservations</label></td><td><input id="chklstord_3" type="checkbox" name="chklstord$chklstord_3" /><label for="chklstord_3">Shipping</label></td> </tr> </table> </td></tr> <tr><td colspan="2"><input id="btnaddrsubmit" title="Submit" type="button" onclick="Registervalidation1()" class="placeorder" name="Submit" value="Submit" style="margin-left: 274px;margin-top: 10px;" /></td></tr> </table> </div> </div> </div> </div> </div> <div id="addVehicle" class="AddVehicle" style="display:none"> <div id="modal-behind"></div> <div class="vehiclediv"> <div class="ttldiv" id="alrtttldiv" style=""> <div class="hdttltext" style=""> <label class="titletxt alerttxt" id="alerttxt">Add Vehicle</label> </div> <div class="closevehiclediv" style=""> <span class="vehiclepnlclosebtn" onclick="CloseVehiclePnl()">X</span> </div> </div> <div class="divvehicle"> <div style="padding:5px;color:#ccc">Help us identify your vehicle</div> <div style="padding:5px;text-align:center">Select your Vehicle Type</div> <div> <table id="tblvehicletype"> <tr> <td> <input type="radio" id="CAR" value="CAR" name="vehicletype" onclick="VehicleType(this)"/> <label title="CAR" class="vehicleimg" for="CAR" style="cursor:pointer"> <img class="imgvehicletype" alt="CAR" id="vehicleCAR" src="/images/CAR.png" /> </label> </td> <td> <input type="radio" id="SUV" value="SUV" name="vehicletype" onclick="VehicleType(this)"/> <label title="SUV" class="vehicleimg" for="SUV" style="cursor:pointer"> <img class="imgvehicletype" alt="SUV" id="vehicleSUV" src="/images/SUV.png" /> </label> </td> <td> <input type="radio" id="TRUCK" value="TRUCK" name="vehicletype" onclick="VehicleType(this)"/> <label title="TRUCK" class="vehicleimg" for="TRUCK" style="cursor:pointer"> <img class="imgvehicletype" alt="TRUCK" id="vehicleTRUCK" src="/images/TRUCK.png" /> </label> </td> </tr> <tr> <td> <input type="radio" id="VAN" value="VAN" name="vehicletype" onclick="VehicleType(this)"/> <label title="VAN" class="vehicleimg" for="VAN" style="cursor:pointer"> <img class="imgvehicletype" alt="VAN" id="vehicleVAN" src="/images/VAN.png" /> </label> </td> <td> <input type="radio" id="BIKE" value="BIKE" name="vehicletype" onclick="VehicleType(this)"/> <label title="BIKE" class="vehicleimg" for="BIKE" style="cursor:pointer"> <img class="imgvehicletype" alt="BIKE" id="vehicleBIKE" src="/images/BIKE.png" /> </label> </td> <td> <input type="radio" id="SEMI" value="SEMI" name="vehicletype" onclick="VehicleType(this)"/> <label title="SEMI" class="vehicleimg" for="SEMI" style="cursor:pointer"> <img class="imgvehicletype" alt="SEMI" id="vehicleSEMI" src="/images/SEMI.png" /> </label> </td> </tr> <tr> <td style="width:50%"> <input type="radio" id="Other" value="Other" name="vehicletype" onclick="VehicleType(this)"/> <label title="Other" class="vehicleimg" for="Other" style="cursor:pointer"> Other </label> </td> <td colspan="2"> <input type="text" class="othervehicletype" id="othervehicletype" placeholder="Other" style="width:150px;" maxlength="20" /> </td> </tr> </table> </div> <div style="text-align:center;padding:5px">Select it's color</div> <div> <table id="tblvehicleclr"> <tr> <td> <input type="radio" id="white" value="white" title="#ffffff" name="vehicleclr" onclick="VehicleColorType(this)"/> <label title="white" class="vehicleimg" for="white" style="cursor:pointer"> <div style="width:50px;height:50px;border-radius:50%;background-color:#fff;border:1px solid #ccc;margin-left:10px;"></div> </label> <div style="text-align:center;margin:5px;">White</div> </td> <td> <input type="radio" id="silver" value="silver" title="#c0c0c0" name="vehicleclr" onclick="VehicleColorType(this)"/> <label title="silver" class="vehicleimg" for="silver" style="cursor:pointer"> <div style="width:50px;height:50px;border-radius:50%;background-color:#c0c0c0;border:1px solid #ccc;margin-left:10px"></div> </label> <div style="text-align:center;margin:5px;">Silver</div> </td> <td> <input type="radio" id="black" value="black" title="#000000" name="vehicleclr" onclick="VehicleColorType(this)"/> <label title="black" class="vehicleimg" for="black" style="cursor:pointer"> <div style="width:50px;height:50px;border-radius:50%;background-color:#000;border:1px solid #ccc;margin-left:10px"></div> </label> <div style="text-align:center;margin:5px;">Black</div> </td> </tr> <tr> <td> <input type="radio" id="red" value="red" title="#ff0000" name="vehicleclr" onclick="VehicleColorType(this)"/> <label title="red" class="vehicleimg" for="red" style="cursor:pointer"> <div style="width:50px;height:50px;border-radius:50%;background-color:red;border:1px solid #ccc;margin-left:10px"></div> </label> <div style="text-align:center;margin:5px;">Red</div> </td> <td> <input type="radio" id="blue" value="blue" title="#0000ff" name="vehicleclr" onclick="VehicleColorType(this)"/> <label title="blue" class="vehicleimg" for="blue" style="cursor:pointer"> <div style="width:50px;height:50px;border-radius:50%;background-color:blue;border:1px solid #ccc;margin-left:10px"></div> </label> <div style="text-align:center;margin:5px;">Blue</div> </td> <td> <input type="radio" id="green" value="green" title="#008000" name="vehicleclr" onclick="VehicleColorType(this)"/> <label title="green" class="vehicleimg" for="green" style="cursor:pointer"> <div style="width:50px;height:50px;border-radius:50%;background-color:green;border:1px solid #ccc;margin-left:10px"></div> </label> <div style="text-align:center;margin:5px;">Green</div> </td> </tr> <tr> <td> <input type="radio" id="gold" value="gold" title="#ffd700" name="vehicleclr" onclick="VehicleColorType(this)"/> <label title="gold" class="vehicleimg" for="gold" style="cursor:pointer"> <div style="width:50px;height:50px;border-radius:50%;background-color:gold;border:1px solid #ccc;margin-left:10px"></div> </label> <div style="text-align:center;margin:5px;">Gold</div> </td> <td> <input type="radio" id="orange" value="orange" title="#ffa500" name="vehicleclr" onclick="VehicleColorType(this)"/> <label title="orange" class="vehicleimg" for="orange" style="cursor:pointer"> <div style="width:50px;height:50px;border-radius:50%;background-color:orange;border:1px solid #ccc;margin-left:10px"></div> </label> <div style="text-align:center;margin:5px;">Orange</div> </td> <td> <input type="radio" id="yellow" value="yellow" title="#ffff00" name="vehicleclr" onclick="VehicleColorType(this)"/> <label title="yellow" class="vehicleimg" for="yellow" style="cursor:pointer"> <div style="width:50px;height:50px;border-radius:50%;background-color:yellow;border:1px solid #ccc;margin-left:10px"></div> </label> <div style="text-align:center;margin:5px;">Yellow</div> </td> </tr> <tr> <td> <input type="radio" id="gray" value="gray" title="#808080" name="vehicleclr" onclick="VehicleColorType(this)"/> <label title="gray" class="vehicleimg" for="gray" style="cursor:pointer"> <div style="width:50px;height:50px;border-radius:50%;background-color:gray;border:1px solid #ccc;margin-left:10px"></div> </label> <div style="text-align:center;margin:5px;">Gray</div> </td> <td> <input type="radio" id="brown" value="brown" title="#a52a2a" name="vehicleclr" onclick="VehicleColorType(this)"/> <label title="brown" class="vehicleimg" for="brown" style="cursor:pointer"> <div style="width:50px;height:50px;border-radius:50%;background-color:brown;border:1px solid #ccc;margin-left:10px"></div> </label> <div>Brown</div> </td> <td> <input type="hidden" name="hdnvechicleclrpikr" id="hdnvechicleclrpikr" /> <input type="radio" id="OtherColorType" value="Other" title="Other" name="vehicleclr" onclick="VehicleColorType(this)"/> <label title="Other" class="vehicleimg" for="OtherColorType" style="cursor:pointer"> <div id="vechicleclrpikr" class="containers basic2"> <div id="vechicleclrpikrSelector" style="background-color:red;"></div> </div> </label> <div style="text-align:center;margin:5px;">Other</div> </td> </tr> </table> </div> <div style="text-align:center;padding:20px 10px"> <label id="lblvehicleclrerr" style="display:none;color:red;"></label> </div> <div style="text-align:center;padding:20px 10px" class="savevehicledetaills"> <input type="button" id="AddVehicleDetails" value="Save" class="btnaddreview" onclick="AddVehicle()" /> </div> <div class="savevehicledtlldr" style="text-align:center;padding:20px 10px;display:none"> <span class="placeorder AddVehicleDetailsldr"><img alt="loader" src="images/loadernew1.gif" class="placerdloader" /></span> </div> </div> </div> </div> <div id="sharepanel" class="sharepanel" style="display:none"> <div id="modal-behind"></div> <div id="modaldelivery" class="sharepanelmaindiv"> <div class="itembackborder"><span class="lblitemnamestyles" style="font-size: 34px;">Share<span></span></span> <span style="float:right"><img src="images/IconCloseWindow.png" id="shareclose" alt="close" class="signinclose closebuttonPickUpstyle" style="width:30px;margin-right:10px" onclick="Closesharepanel();" /></span> </div> <div style="width: 95%;margin: 0 auto;text-align: center;padding: 10px 0;"> <p style="font-size: 16px;color: #333;">Share it on your social network to get the word out!<br /><span id="lblsharemsg"></span></p> <div> <div id="fb-root"></div> <script>(function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.9"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <style> .fb_iframe_widget span { width: 73px !important; height: 28px !important; } .fb_iframe_widget iframe { visibility: visible !important; width: 73px !important; height: 28px !important; } </style> <a id="facebooklnk" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;" class="facebook-share-button" data-show-count="false" data-size="large" target="_blank" ><img alt="Facebbok" src="images/facebook-share-button-icon.png" style="height:28px" /></a> <a id="tweet" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;" class="twitter-share-button" data-show-count="false" data-size="large" target="_blank" ><img alt="Tweet" src="images/twittershare.png" style="height:28px" /></a> <a style="display:none" id="sharelink" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;"><img src="images/googleshare.png" alt="Share on Google+" style="height:30px;border-radius:10px" /></a> </div> <div id="divsharelnk1" style="display:flex;align-items:center;justify-content:center"><input name="txtshareurl" type="text" id="txtshareurl" style="width: 75%;height: 40px;font-size: 14px;border-radius: 3px;text-align: left;border: 1px solid #999;padding-left: 10px;margin:10px 0" /><div id="cpyurl2" style="margin-left:8px;cursor:pointer" onclick="copytoclipboard1()"><input type="button" value="Copy URL" id="btncopyURL1" style="padding:15px 8px;border:none;cursor:pointer;border-radius:5px" /></div></div> <div id="divsharelnk2" style="display:none"><input name="txtshareItemurl" type="text" id="txtshareItemurl" style="width: 75%;height: 40px;font-size: 14px;border-radius: 3px;text-align: left;border: 1px solid #999;padding-left: 10px;margin:10px 0" /><div id="cpyurl1" style="cursor:pointer;margin-left:8px" onclick="copytoclipboard()"><input type="button" value="Copy URL" id="btncopyURL" style="padding:15px 8px;border:none;cursor:pointer;border-radius:5px" /></div></div> <script type="text/javascript"> $(document).ready(function () { document.getElementById('txtshareurl').value = document.URL; var twwtlnk = document.getElementById('tweet'); //or grab it by tagname etc twwtlnk.href = "https://twitter.com/share?url="+ document.URL; var fblnk = document.getElementById('facebooklnk'); fblnk.href = "https://www.facebook.com/sharer.php?u="+ document.URL; var a = document.getElementById('sharelink'); a.href = "https://plus.google.com/share?url=" + document.URL; //fb_share.href = 'http://www.facebook.com/share.php?u=' + encodeURIComponent(location.href); }); </script> </div></div></div> <script type="text/javascript"> function LimtCharacters(txtMsg, CharLength) { chars = txtMsg.value.length; if (chars > CharLength) { txtMsg.value = txtMsg.value.substring(0, CharLength); } } </script> <script type="text/javascript"> var DeliveryServicesCount = 0; function BindInfo() { SessionLogin(); var UrlName = '/HOAGIESCafe'; var PathUrl = window.location.pathname.split("/"); if (UrlName != "" && UrlName != null) { $("#lblUrl").text(UrlName); } else { var path = "/"+PathUrl[1]; $("#lblUrl").text(path); } var allcookies = document.cookie; var LocationId = document.getElementById('lblLId').value; cookiearray = allcookies.split(';'); for (var i = 0; i < cookiearray.length; i++) { if (cookiearray[i].split('=')[1] != undefined) { if (cookiearray[i].split('=')[0] == "UserName") { document.getElementById('txtEmail').value = cookiearray[i].split('=')[1]; } } } //GetDeliveryServicesCount(); //Checkdeliveryzoneslink(); if (document.getElementById("lblPaymentType").innerHTML == "clover") { $("#txtinstructions").attr('maxlength', '254'); $("#instructions").attr('maxlength', '254'); } else { $("#txtinstructions").attr('maxlength', '300'); $("#instructions").attr('maxlength', '300'); } var x = $('.tooltip').jBox('Tooltip', { trigger: 'focus', animation: { open: '', close: 'flip' }, position: { x: 'left', y: 'center' }, outside: 'x' }); $('.tooltip').blur(function () { x.close(); }); $('.tooltip').focus(function () { x.close(); textboxfocus(this); }); function textboxfocus(input) { $(input).removeClass("userregistrer_formtext1Error"); $(input).addClass("userregistrer_formtext1"); var id = input.id; if (input.value != "") { if (id == "txtFirstName") { var nameexp = /^[A-Za-z0-9.!@#$%^&*()_ ]{2,50}$/; if (input.value.length < 50) { if (input.value.match(nameexp)) { x.close(); } else { $("#" + id).attr("alt", "First Name must be more than 2 characters"); x.open(); } } else { $("#" + id).attr("alt", "First Name must not be more than 50 characters"); x.open(); } } else if (id == "txtLastName") { if (input.value.length > 50) { $("#" + id).attr("alt", "Last Name must not be more than 50 characters"); x.open(); } else { x.close(); } } else if (id == "txtUserEmail") { var emailExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i; if (input.value.match(emailExp)) { x.close(); } else { $("#" + id).attr("alt", "Enter valid Email"); x.open(); } } else if (id == "txtPhonenumber") { var numberexp = /^\d{10}$/; if (input.value.length >= 10) { var Number = input.value; var phone = input.value; if (~Number.indexOf('+') || ~Number.indexOf("+1") || ~Number.indexOf("+91")) { if (~Number.indexOf('+91')) { phone = Number.replace('+91', ""); } else if (~Number.indexOf('+1')) { phone = Number.replace('+1', ""); } else { phone = Number.replace('+', ""); } } if (phone.match(numberexp)) { x.close(); } else { $("#" + id).attr("alt", "Enter valid PhoneNumber"); x.open(); } } else { $("#" + id).attr("alt", "Enter valid PhoneNumber"); x.open(); } } else if (id == "txtPassword") { var pwdexp = /^[A-Za-z0-9!@#$%^'&*()_ ]{5,50}$/; $("#imgshowpwd").removeAttr("style"); $("#imgshowpwd").attr("style", "margin-top:6px;"); if (input.value.length >= 5) { if (input.value.match(pwdexp)) { x.close(); } } else { $("#" + id).attr("alt", "Password must be 5 characters"); x.open(); } } else if (id == "txtconformpsw") { $("#imgconfirmpwd").removeAttr("style"); $("#imgconfirmpwd").attr("style", "margin-top:6px;"); if (input.value == $("#txtPassword").val()) { x.close(); } else { $("#" + id).attr("alt", "Confirm password does not match"); x.open(); } } } else { if (id == "txtFirstName") { if ($("#" + id).attr('alt') != undefined || $(".samplep").text() == "firstfocus") { $("#" + id).attr("alt", "Enter your First Name"); x.open(); } else { $("#" + id).attr("alt", "Enter your First Name"); } } else if (id == "txtLastName") { if ($("#" + id).attr('alt') != undefined || $(".samplep").text() == "firstfocus") { $("#" + id).attr("alt", "Enter your Last Name"); x.open(); } else if ($(".samplep").text() == "firstfocus") { $("#" + id).attr("alt", "Enter your Last Name"); x.open(); } else { $("#" + id).attr("alt", "Enter your Last Name"); } } else if (id == "txtUserEmail") { if ($("#" + id).attr('alt') != undefined || $(".samplep").text() == "firstfocus") { $("#" + id).attr("alt", "Enter your Email"); x.open(); } else { $("#" + id).attr("alt", "Enter your Email"); } } else if (id == "txtPassword") { $("#imgshowpwd").removeAttr("style"); $("#imgshowpwd").attr("style", "margin-top:6px;"); if ($("#" + id).attr('alt') != undefined || $(".samplep").text() == "firstfocus") { $("#" + id).attr("alt", "Enter your Password"); x.open(); } else { $("#" + id).attr("alt", "Enter your Password"); } } else if (id == "txtconformpsw") { $("#imgconfirmpwd").removeAttr("style"); $("#imgconfirmpwd").attr("style", "margin-top:6px;"); if ($("#" + id).attr('alt') != undefined || $(".samplep").text() == "firstfocus") { $("#" + id).attr("alt", "Enter Confirm Password"); x.open(); } else { $("#" + id).attr("alt", "Enter your Password"); } } else if (id == "txtPhonenumber") { if ($("#" + id).attr('alt') != undefined || $(".samplep").text() == "firstfocus") { $("#" + id).attr("alt", "Enter your Phone Number"); x.open(); } else { $("#" + id).attr("alt", "Enter your Phone Number"); } } } } if (localStorage.getItem("OrderSelectionType") == null || localStorage.getItem("OrderSelectionType") == "") { localStorage.setItem("OrderSelectionType", "Delivery"); } if (localStorage.getItem("OrderSelectionType") == "Delivery") { GetNextAvailableDeliveryTime(); } localStorage.removeItem("parentUrl"); var QueryString = getQueryStrings(); var GroupOrder = QueryString["GroupOrder"]; if (GroupOrder != null) { setInterval("BindItems()", 200); } localStorage.setItem("CustomerCountry", document.getElementById('lblCountry').innerHTML); if (window.location !== window.parent.location) { BlockHeader(); } } function Createhearabout() { if ($("#ddlhearabout option:selected").text() == "Driver") { $('#txtothern').removeClass(".signupddlerror").addClass(".signupddl"); $('#txtconame').removeClass(".signupddlerror").addClass(".signupddl"); $('#txtother').css("display", "none"); $('#txtconname').css("display", "none"); $('#txtdrivername').css("display", "block"); } else if ($("#ddlhearabout option:selected").text() == "Other") { $('#txtdrivername').removeClass(".signupddlerror").addClass(".signupddl"); $('#txtconname').removeClass(".signupddlerror").addClass(".signupddl"); $('#txtdrivername').css("display", "none"); $('#txtconname').css("display", "none"); $('#txtother').css("display", "block"); } else if ($("#ddlhearabout option:selected").text() == "Hotel VIP") { $('#txtdrivername').removeClass(".signupddlerror").addClass(".signupddl"); $('#txtothern').removeClass(".signupddlerror").addClass(".signupddl"); $('#txtdrivername').css("display", "none"); $('#txtother').css("display", "none"); $('#txtconname').css("display", "block"); } else { $('#txtdrivername').css("display", "none"); $('#txtother').css("display", "none"); $('#txtconname').css("display", "none"); } } $(".popupdisplay1").click(function (e) { $(".mnupopup").css("display", "block"); e.preventDefault(); e.stopPropagation(); }); $(document).click(function (e) { if (!$(e.target).is('.popupdisplay1')) { $('.mnupopup').css("display", "none"); } }); function RegisterRemoveValidation(input) { var id = input.id; if (input.value != "") { if (id == "txtFirstName") { var nameexp = /^[A-Za-z0-9.!@#$%^&*()_ ]{2,50}$/; if (input.value.match(nameexp)) { $("#" + id).removeClass("userregistrer_formtext1Error"); $("#" + id).addClass("userregistrer_formtext1"); } else { $("#" + id).removeClass("userregistrer_formtext1"); $("#" + id).addClass("userregistrer_formtext1Error"); } } else if (id == "txtLastName") { if (input.value.length > 50) { $("#" + id).attr("alt", "Last Name must not be more than 50 characters"); $("#" + id).removeClass("userregistrer_formtext1"); $("#" + id).addClass("userregistrer_formtext1Error"); } else { $("#" + id).removeClass("userregistrer_formtext1Error"); $("#" + id).addClass("userregistrer_formtext1"); } } else if (id == "txtUserEmail") { var emailExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i; if (input.value.match(emailExp)) { $("#" + id).removeClass("userregistrer_formtext1Error"); $("#" + id).addClass("userregistrer_formtext1"); } else { $("#" + id).removeClass("userregistrer_formtext1"); $("#" + id).addClass("userregistrer_formtext1Error"); } } else if (id == "txtPhonenumber") { var numberexp = /^\d{10}$/; //10 Digit Number Validation /^\d{3}-?\d{3}-?\d{4}$/ if (input.value.length >= 10) { if (input.value.match(numberexp)) { $("#" + id).removeClass("userregistrer_formtext1Error"); $("#" + id).addClass("userregistrer_formtext1"); } } else { $("#" + id).removeClass("userregistrer_formtext1"); $("#" + id).addClass("userregistrer_formtext1Error"); } } else if (id == "txtPassword") { var pwdexp = /^[A-Za-z0-9!@#$%'^&*()_ ]{5,50}$/; if (input.value.length >= 5) { if (input.value.match(pwdexp)) { $("#" + id).removeClass("userregistrer_formtext1Error"); $("#" + id).addClass("userregistrer_formtext1"); $("#imgshowpwd").removeAttr("style"); $("#imgshowpwd").attr("style", "margin-top:6px;"); } } else { $("#" + id).removeClass("userregistrer_formtext1"); $("#" + id).addClass("userregistrer_formtext1Error"); $("#imgshowpwd").removeAttr("style"); $("#imgshowpwd").attr("style", "margin-left:-52px;margin-top:6px;"); } } else if (id == "txtconformpsw") { if (input.value == $("#txtPassword").val()) { $("#" + id).removeClass("userregistrer_formtext1Error"); $("#" + id).addClass("userregistrer_formtext1"); $("#imgconfirmpwd").removeAttr("style"); $("#imgconfirmpwd").attr("style", "margin-top:6px;"); } else { $("#" + id).removeClass("userregistrer_formtext1"); $("#" + id).addClass("userregistrer_formtext1Error"); $("#imgconfirmpwd").removeAttr("style"); $("#imgconfirmpwd").attr("style", "margin-left:-52px;margin-top:6px;"); } } else if (id == "ddlusercountry") { if (input.value != "-Select Country-") { $("#" + id).removeClass("userregistrer_formtext1Error"); $("#" + id).addClass("userregistrer_formtext1"); } else { $("#" + id).removeClass("userregistrer_formtext1"); $("#" + id).addClass("userregistrer_formtext1Error"); } } else if (id == "ddlhearabout") { if (input.value == "How did you hear about us?") { $("#" + id).removeClass("userregistrer_formtext1"); $("#" + id).addClass("userregistrer_formtext1Error"); } else { $("#" + id).removeClass("userregistrer_formtext1Error"); $("#" + id).addClass("userregistrer_formtext1"); } } else if (id == "txtdrivername") { if (input.value.length > 50) { $("#" + id).attr("alt", "Last Name must not be more than 50 characters"); $("#" + id).removeClass("userregistrer_formtext1"); $("#" + id).addClass("userregistrer_formtext1Error"); } else { $("#" + id).removeClass("userregistrer_formtext1Error"); $("#" + id).addClass("userregistrer_formtext1"); } } else if (id == "txtother") { if (input.value.length > 500) { $("#" + id).attr("alt", "Last Name must not be more than 500 characters"); $("#" + id).removeClass("userregistrer_formtext1"); $("#" + id).addClass("userregistrer_formtext1Error"); } else { $("#" + id).removeClass("userregistrer_formtext1Error"); $("#" + id).addClass("userregistrer_formtext1"); } } } else { $("#" + id).addClass("userregistrer_formtext1Error"); if (id == "txtPassword") { $("#imgshowpwd").removeAttr("style"); $("#imgshowpwd").attr("style", "margin-left:-52px;margin-top:6px;"); } else if (id == "txtconformpsw") { $("#imgconfirmpwd").removeAttr("style"); $("#imgconfirmpwd").attr("style", "margin-left:-52px;margin-top:6px;"); } } } </script> <script type="text/javascript" language="javascript"> function GetDeliveryServicesCount() { $.ajax({ type: "POST", url: "Orders.aspx/GetDeliveryServicesCount", data: "{'LocId': '" + document.getElementById('lblLId').value + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d > 0) { DeliveryServicesCount = msg.d; } } }); } function Checkdeliveryzoneslink() { $.ajax({ type: "POST", url: "Orders.aspx/CheckDeliveryZonesselect", data: "{'LocationId': '" + document.getElementById('lblLId').value + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "" && msg.d != null) { if (msg.d == "Accept") { $("#lblShowZones").css("display", "block"); document.getElementById("lblShowZones").innerHTML = "Delivery Zones"; } else { $("#lblShowZones").css("display", "none"); document.getElementById("lblShowZones").innerHTML = ""; } } } }); } $("#lblLoyaltyText").click(function () { $("#btndeiverymunchies1").prop("checked", true); UDSelection(); //$("#btndeiverymunchies1").click(); }); $(".datepickerarrow").click(function () { if ($(this).hasClass("active")) { $(".datepickerarrow").removeClass("active"); $('#txtdeliverydate').datepicker('hide'); } else { $(".datepickerarrow").removeClass("active"); $('#txtdeliverydate').datepicker('show'); $(this).addClass("active"); } }); function MobileCArt() { if (window.innerWidth < 767) { if (document.getElementById("lblcwurl").innerHTML == "") { $('#wrapper').attr('style', 'display:block;'); $('.ordfooter').css('display', 'block;'); } } } function MobileCartDelete() { if (window.innerWidth < 767) $('.CartDisplay').css("display", "block"); } function LimtCharacters(txtMsg, CharLength, indicator) { chars = txtMsg.value.length; document.getElementById(indicator).innerHTML = CharLength - chars; if (chars > CharLength) { txtMsg.value = txtMsg.value.substring(0, CharLength); } } function gettotalprice() { var d = 0; var ddlvariation = $(".ddlVariation"); if (ddlvariation.length > 0) { if (ddlvariation[0].options[ddlvariation[0].selectedIndex].text != "Select Variation") { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { d = (+Variations[J].Price + +d); } } } } } var all = document.getElementsByTagName("input"); if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (i = 0; i < all.length; i++) { if (all[i].type == "radio") { var count = all[i].name.match("Choiceradio"); if (count != null) { if (count.length > 0) { if (all[i].checked == true) { var Quantity = 0; var U = 0; if (document.getElementById("Quantity" + all[i].id) != null) { Quantity = document.getElementById("Quantity" + all[i].id).value; U++; } if (document.getElementById("ddlQuantity" + all[i].id) != null) { Quantity = +Quantity + +parseInt(document.getElementById("ddlQuantity" + all[i].id).value); U++; } if (U == 0) Quantity = 1; var a = Quantity * all[i].value; var Charge = ""; var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Choices != undefined && OptionsCheck[J].Choices != "undefined") { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (all[i].id == OptionsCheck[J].Choices[C].Id) { if (all[i].className.indexOf("Validate") >= 0){ if (OptionsCheck[J].Chargable == false) Charge = "No Charge"; } else { Charge = "No Charge"; } } } } } } if (Charge != "No Charge") d = (+d + +a); } } } } } } else { for (i = 0; i < all.length; i++) { if (all[i].type == "radio") { var count = all[i].name.match("Choiceradio"); if (count != null) { if (count.length > 0) { if (all[i].checked == true) { var Quantity = 0; var U = 0; if (document.getElementById("Quantity" + all[i].id) != null) { Quantity = document.getElementById("Quantity" + all[i].id).value; U++; } if (document.getElementById("ddlQuantity" + all[i].id) != null) { Quantity = +Quantity + +parseInt(document.getElementById("ddlQuantity" + all[i].id).value); U++; } if (U == 0) Quantity = 1; var a = Quantity * all[i].value; var Charge = ""; var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Choices != undefined && OptionsCheck[J].Choices != "undefined") { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (all[i].id == OptionsCheck[J].Choices[C].Id) { if (OptionsCheck[J].Chargable == false) Charge = "No Charge"; } } } } } if (Charge != "No Charge") d = (+d + +a); } } } } } } if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (i = 0; i < all.length; i++) { if (all[i].type == "checkbox") { var count = all[i].name.match("Choiceradio"); if (count != null) { if (count.length > 0) { if (all[i].checked == true) { var Quantity = 0; var U = 0; if (document.getElementById("Quantity" + all[i].id) != null) { Quantity = document.getElementById("Quantity" + all[i].id).value; U++; } if (document.getElementById("ddlQuantity" + all[i].id) != null) { Quantity = +Quantity + +parseInt(document.getElementById("ddlQuantity" + all[i].id).value); U++; } if (U == 0) Quantity = 1; var priceval = Quantity * all[i].value; var Charge = ""; var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Choices != undefined && OptionsCheck[J].Choices != "undefined") { var K = 0; for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (all[i].id == OptionsCheck[J].Choices[C].Id) { if (all[i].className.indexOf("Validate") >= 0){ K++; if (OptionsCheck[J].Chargable == false) Charge = "No Charge"; if (OptionsCheck[J].Choices[C].FreeOptions == "Yes") Charge = "No Charge"; } else { Charge = "No Charge"; } } } if (K == 0) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (OptionsCheck[J].Choices[C].ChildOptions != undefined) { for (var M = 0; M < OptionsCheck[J].Choices[C].ChildOptions.length; M++) { for (var U = 0; U < OptionsCheck[J].Choices[C].ChildOptions[M].Choices.length; U++) { var GetChoiceId = OptionsCheck[J].Choices[C].Id + "" + OptionsCheck[J].Choices[C].ChildOptions[M].Choices[U].Id; if (GetChoiceId == all[i].id) { if (all[i].className.indexOf("Validate") >= 0){ if (OptionsCheck[J].Choices[C].ChildOptions[M].Choices[U].FreeOptions == "Yes") Charge = "No Charge"; } else { Charge = "No Charge"; } } } } } } } } } } if (Charge != "No Charge") d = (+priceval + +d); } } } } } } else { for (i = 0; i < all.length; i++) { if (all[i].type == "checkbox") { var count = all[i].name.match("Choiceradio"); if (count != null) { if (count.length > 0) { if (all[i].checked == true) { var Quantity = 0; var U = 0; if (document.getElementById("Quantity" + all[i].id) != null) { Quantity = document.getElementById("Quantity" + all[i].id).value; U++; } if (document.getElementById("ddlQuantity" + all[i].id) != null) { Quantity = +Quantity + +parseInt(document.getElementById("ddlQuantity" + all[i].id).value); U++; } if (U == 0) Quantity = 1; var priceval = Quantity * all[i].value; var Charge = ""; var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Choices != undefined && OptionsCheck[J].Choices != "undefined") { var K = 0; for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (all[i].id == OptionsCheck[J].Choices[C].Id) { K++; if (OptionsCheck[J].Chargable == false) Charge = "No Charge"; if (OptionsCheck[J].Choices[C].FreeOptions == "Yes") Charge = "No Charge"; } } if (K == 0) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (OptionsCheck[J].Choices[C].ChildOptions != undefined) { for (var M = 0; M < OptionsCheck[J].Choices[C].ChildOptions.length; M++) { for (var U = 0; U < OptionsCheck[J].Choices[C].ChildOptions[M].Choices.length; U++) { var GetChoiceId = OptionsCheck[J].Choices[C].Id + "" + OptionsCheck[J].Choices[C].ChildOptions[M].Choices[U].Id; if (GetChoiceId == all[i].id) { if (OptionsCheck[J].Choices[C].ChildOptions[M].Choices[U].FreeOptions == "Yes") Charge = "No Charge"; } } } } } } } } } if (Charge != "No Charge") d = (+priceval + +d); } } } } } } var allselect = document.getElementsByTagName("select"); if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Type == "Dropdown" && OptionsCheck[J].Id == allselect[i].id) { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (ChoiceId == OptionsCheck[J].Choices[C].Id) { d = (+d + +OptionsCheck[J].Choices[C].Price); } } } } } } } } } } } else { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Type == "Dropdown" && OptionsCheck[J].Id == allselect[i].id) { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (ChoiceId == OptionsCheck[J].Choices[C].Id) { d = (+d + +OptionsCheck[J].Choices[C].Price); } } } } } } } } } } } if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlChildOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (OptionsCheck[J].Choices[C].Exist == true) { if (OptionsCheck[J].Choices[C].ChildOptions != undefined) { for (var L = 0; L < OptionsCheck[J].Choices[C].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[C].ChildOptions[L].Type == "Dropdown") { if ($("#" + OptionsCheck[J].Choices[C].ChildOptions[L].Id).hasClass("Validate")) { for (var U = 0; U < OptionsCheck[J].Choices[C].ChildOptions[L].Choices.length; U++) { if (ChoiceId == OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Id) { d = +OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } } } } } } else { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlChildOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (OptionsCheck[J].Choices[C].Exist == true) { if (OptionsCheck[J].Choices[C].ChildOptions != undefined) { for (var L = 0; L < OptionsCheck[J].Choices[C].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[C].ChildOptions[L].Type == "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[C].ChildOptions[L].Choices.length; U++) { if (ChoiceId == OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Id) { d = +OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } } } } } var count = all[i].name.match("Choiceradio"); d = +d + +document.getElementById("PriceVal").innerHTML; var Qty = document.getElementById('txtquantity').value; if (localStorage.getItem("priceType") == "Per Unit") { Qty = Qty * document.getElementById('txtunitquantity').value; } var totalprice = (Qty * d); document.getElementById("lbldisplayItemPrice").innerHTML = (document.getElementById("lblCurrency").innerHTML + totalprice.toFixed(2)); document.getElementById("itemflowprice").innerHTML = document.getElementById("lbldisplayItemPrice").innerHTML; } </script> <script type="text/javascript"> function closepanelViewReservations() { $("#reservationPanel").css("display", "none"); } function closepanelViewReservations1() { $("#viewreservationspanel").css("display", "none"); $("#reservationPanel").css("display", "none"); } function CheckShippingDetails() { var LocationId = document.getElementById('lblLId').value; var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var Country = ""; var State = ""; var City = ""; var Address = document.getElementById("txtshpaddress").value; var dcountry = document.getElementById("ddlshpcountry"); Country = dcountry.options[dcountry.selectedIndex].text; var ddlshpState = document.getElementById("ddlshpState"); if (ddlshpState.selectedIndex != -1) State = ddlshpState.options[ddlshpState.selectedIndex].text; City = $("#txtshpcity").val(); Zip = $("#txtshpzip").val(); if (Address != "" && Country != "Select Country" && Country != "" && City != "" && State != "" && State != "Select State") { $("#txtshpaddress").removeAttr("style"); $("#ddlshpcountry").css("border", ""); $("#ddlshpState").css("border", ""); $("#txtshpcity").css("border", ""); $.ajax({ type: "POST", url: "Orders.aspx/ValidateShippingAddress", data: "{'LId': '" + LocationId + "','Country':'" + Country + "','State':'" + State + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (localStorage.getItem("ShippingZoneId") != msg.d[0].ZoneId); document.getElementById("SpeedId").innerHTML = ""; BindShippingSpeeds(msg.d[0].ZoneId); localStorage.setItem("ShippingZoneId", msg.d[0].ZoneId); document.getElementById('checkdelivery').innerHTML = "Sucess"; var AddrArray = new Array(); var addr = new Object(); addr.Address = Address; addr.City = City; addr.State = State; addr.Zip = Zip; addr.Country = Country; AddrArray.push(addr); localStorage.removeItem("OrderType"); localStorage.removeItem("ShippingAddress"); localStorage.setItem("ShippingAddress", JSON.stringify(AddrArray)); localStorage.setItem("OrderType", "Shipping"); $(".deliveryvalidationpanel").css("display", "none"); document.getElementById("rbtShipping").checked = true; var itemslength = 0; var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { itemslength++; if (AddedItems.length > 0) { itemslength++; } } } var ItemId; if (itemslength == 0) { if (document.getElementById("lblItemId").innerHTML.split('//')[0] != "") { ItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; if (ItemId != null && ItemId != ""){ if (GroupId != null && GroupId != "" && GroupId != undefined) { LoadItemOptionsinGroupOrder(); } else { LoadItemOptions(); } } else { $(".checkoutloaderdiv").css("display","none"); $(".checkbtndiv").css("display","inline-block"); } } } else { $(".checkoutloaderdiv").css("display","none"); $(".checkbtndiv").css("display","inline-block"); } } } }); } else { if (Address == "") $("#txtshpaddress").css("border", "1px solid red"); else $("#txtshpaddress").removeAttr("style"); if (Country == "Select Country" || Country == "") $("#ddlshpcountry").css("border", "1px solid red"); else $("#ddlshpcountry").css("border", ""); if (State == "Select State" || State == "") { if (State == "") document.getElementById("ddlshpState").value = "Select State"; $("#ddlshpState").css("border", "1px solid red"); } else $("#ddlshpState").css("border", ""); if (City == "") $("#txtshpcity").css("border", "1px solid red"); else $("#txtshpcity").css("border", ""); } } function BindShippingSpeeds(ShippingZoneId) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; $.ajax({ type: "POST", url: "Orders.aspx/GetShippingSpeeds", data: "{'ShippingZoneId':'" + ShippingZoneId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { $(".ShippingSpeeds").fadeIn("fast") var tabledata = ""; for (var i = 0; i < msg.d.length; i++) { onClickAction = 'AddShippingSpeed("' + msg.d[i].id + '")'; var checkedAction = ""; if (i == 0) { if (document.getElementById("SpeedId").innerHTML == "") { document.getElementById("SpeedId").innerHTML = msg.d[i].id; checkedAction = "checked='checked'"; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } } else { if (document.getElementById("SpeedId").innerHTML == msg.d[i].id) { checkedAction = "checked='checked'"; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } } else checkedAction = ""; } } else { if (document.getElementById("SpeedId").innerHTML == msg.d[i].id) { checkedAction = "checked='checked'"; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } } else checkedAction = ""; } tabledata += "<tr><td><input type='radio' id='" + msg.d[i].id + "' " + checkedAction + " class='checkbox-circle' name='ShippingSpeeds' onclick='" + onClickAction + "' > <label for='" + msg.d[i].id + "'>" + msg.d[i].ChargeName + "(<label for='Days" + msg.d[i].id + "'>" + msg.d[i].days + "</label> Days)</label></input>"; tabledata += "<td style='text-align:right'>" + document.getElementById("lblCurrency").innerHTML + msg.d[i].price + "</td></tr>"; } document.getElementById("divSpeeds").innerHTML = tabledata; } else { $(".ShippingSpeeds").fadeOut("fast"); document.getElementById("SpeedId").innerHTML = ""; document.getElementById("divSpeeds").innerHTML = ""; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } } } }); } function AddShippingSpeed(SpeedId) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; document.getElementById("SpeedId").innerHTML = SpeedId; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } } function UpdateUserMobileNumber() { $("#lblmoberrmsg").css("display", "block"); document.getElementById("lblmoberrmsg").innerHTML = ""; var UId = document.getElementById("UserId").innerHTML; var Phonenumber = document.getElementById('txtactivatemobileno').value; var UserPhoneNumber = document.getElementById("lblPhoneno").innerHTML; $("#activatemobileloader").css("display", "block"); $.ajax({ type: "POST", url: "Orders.aspx/Updateconfirmphonenumber", data: "{'UserId':'" + UId + "','PhoneNumber':'" + Phonenumber + "','UserPhoneNumber':'" + UserPhoneNumber + "'}", dataType: "json", contentType: "application/json", success: function (msg) { $("#activatemobileloader").css("display", "none"); if (msg.d != "") { if (msg.d != "No Number") { if (msg.d == "Success") { $("#lblmoberrmsg").css("display", "block"); document.getElementById("lblmoberrmsg").innerHTML = "Mobile number updated. please check the mobile and enter the confirmation code to activate"; document.getElementById('txtactivatemobileno').value = ""; $("#lblmoberrmsg").delay(5000).fadeOut(100); } else { $("#lblmoberrmsg").css("display", "block"); document.getElementById("lblmoberrmsg").innerHTML = "Mobile number existed with us. please try with another mobile number"; $("#lblmoberrmsg").delay(5000).fadeOut(100); } } else { $("#lblmoberrmsg").css("display", "block"); document.getElementById("lblmoberrmsg").innerHTML = "Please enter a valid mobile number"; $("#lblmoberrmsg").delay(5000).fadeOut(100); } } } }); } function ConformMobActivation() { $("#lblmoberrmsg").css("display", "block"); document.getElementById("lblmoberrmsg").innerHTML = ""; var Email = document.getElementById("EmailID").innerHTML; var PhoneNumber = document.getElementById("lblPhoneno").innerHTML; var Code = document.getElementById('txtmobactivate').value; if (Code != null && Code != "") { $.ajax({ type: "POST", url: "orders.aspx/ActivateAccount", data: "{'Email': '" + "" + "', 'Code':'" + Code + "','SignedEmail': '" + Email + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "success") { $(".ActivateMobileconfirm").css("display", "none"); FinishOrder(); $('.placeorder').fadeIn("slow"); } else { document.getElementById("lblmoberrmsg").innerHTML = "Please enter correct code"; $("#lblmoberrmsg").css("display", "block"); $("#lblmoberrmsg").delay(5000).fadeOut(100); } } }); } else { document.getElementById("lblmoberrmsg").innerHTML = "Please enter valid code"; $("#lblmoberrmsg").css("display", "block"); $("#lblmoberrmsg").delay(5000).fadeOut(100); } } function AddQuantity() { var ItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; var ItemsData = localStorage.getItem("TotalItems"); var CheckItems = JSON.parse(ItemsData); if (CheckItems != null) { if (CheckItems.length > 0) { for (var i = 0; i < CheckItems.length; i++) { if (CheckItems[i].Id == ItemId) { if (AddedQuantity == 0) { AddedQuantity = Number(CheckItems[i].Quantity); } else { AddedQuantity = Number(AddedQuantity) + Number(CheckItems[i].Quantity); } } } } } var counter = parseInt(document.getElementById('txtquantity').value); if (AddedQuantity > 0) { counter = Number(counter) + Number(AddedQuantity); } var ItemAvailableQuantity = ""; if (document.getElementById("qty" + ItemId) != null) { ItemAvailableQuantity = document.getElementById("qty" + ItemId).innerHTML; } if (ItemAvailableQuantity == "NoQuantity" || ItemAvailableQuantity == "") { if (counter == 50) { var phone = ""; if (document.getElementById("lblCurrency").innerHTML == "$") phone = "407-996-6666"; else phone = "7207553232"; $("#lblorderror").text("If you want to order more than 50 quantity, you can call us at " + phone); $(".ordererror").show().delay(3000).fadeOut(); } else { var msg = +counter + +1; document.getElementById('txtquantity').value = msg; } gettotalprice(); } else { if (ItemAvailableQuantity < counter + 1) { $("#lblorderror").text("Item stock available only " + ItemAvailableQuantity + " left"); $(".ordererror").show().delay(3000).fadeOut(); } else { if (counter == 50) { var phone = ""; if (document.getElementById("lblCurrency").innerHTML == "$") phone = "407-996-6666"; else phone = "7207553232"; $("#lblorderror").text("If you want to order more than 50 quantity, you can call us at " + phone); $(".ordererror").show().delay(3000).fadeOut(); } else { var p = 0; var AddedQuantity = 0; var ItemsData = localStorage.getItem("TotalItems"); var CheckItems = JSON.parse(ItemsData); if (CheckItems != null) { if (CheckItems.length > 0) { for (var i = 0; i < CheckItems.length; i++) { if (CheckItems[i].Id == ItemId) { if (AddedQuantity == 0) { AddedQuantity = Number(CheckItems[i].Quantity); } else { AddedQuantity = Number(AddedQuantity) + Number(CheckItems[i].Quantity); } } } } else { p = 1; } } else { p = 1; } AddedQuantity = Number(AddedQuantity) + Number(counter + 1); if (AddedQuantity > 0) { if (AddedQuantity <= ItemAvailableQuantity) { p = 1; } } else { p = 1; } if (p == 1) { var msg = +counter + +1; document.getElementById('txtquantity').value = msg; gettotalprice(); } else { $("#lblorderror").text("Item stock limit exceeded"); $(".ordererror").show().delay(3000).fadeOut(); } } } } //if(document.getElementById('reviewtxtquantity').length>0){ var Quantity = parseInt(document.getElementById('txtquantity').value) +"X"; $('.reviewtxtquantity').text(Quantity); //} } $(document).on('keypress', '#txtcheckinMobileNumber', function (e) { var charCode = (e.which) ? e.which : e.keyCode if (charCode != 45 && (charCode != 46 || $(this).val().indexOf('.') != -1) && (charCode < 48 || charCode > 57)) return false; return true; }); function RemoveQuantity() { var counter = parseInt(document.getElementById('txtquantity').value); if (counter == 1) { $("#lblorderror").text("No more Quantity to remove"); $(".ordererror").show().delay(3000).fadeOut(); return false; } else { var msgs = counter - 1; document.getElementById('txtquantity').value = msgs; } // if(document.getElementById('reviewtxtquantity').length>0){ var Quantity = parseInt(document.getElementById('txtquantity').value)+"X"; $('.reviewtxtquantity').text(Quantity); //} gettotalprice(); } function AddUnitQuantity() { var counter = parseInt(document.getElementById('txtunitquantity').value); if (counter == 50) { } else { var msg = +counter + +1; document.getElementById('txtunitquantity').value = msg; } gettotalprice(); } function RemoveUnitQuantity() { var counter = parseInt(document.getElementById('txtunitquantity').value); if (counter == 1) { return false; } else { var msgs = counter - 1; document.getElementById('txtunitquantity').value = msgs; } gettotalprice(); } function setAttributes(el, attrs) { for (var key in attrs) { el.setAttribute(key, attrs[key]); } } function BindMonths(ExpiryMonth) { $(".bindmonths").empty(); var i = 1; for (i = 1; i < 13; i++) { if (i < 10) { $(".bindmonths").append($("<option></option>").val("0" + i).html("0" + i)); } else $(".bindmonths").append($("<option></option>").val(i).html(i)); } if (ExpiryMonth != "" && ExpiryMonth != undefined) $("#ddlBindMonth").val(ExpiryMonth); else { var d = new Date(); var n = d.getMonth(); var month = n + 1; if (month.toString().length == 1) month = "0" + month; $("#ddlBindMonth").val(month); } } function BindYears(ExpiryYear) { $(".bindyears").empty(); var d = new Date(); for (i = d.getFullYear(); i < 2070; i++) { $(".bindyears").append($("<option></option>").val(i).html(i)); } if (ExpiryYear != "" && ExpiryYear != undefined) $("#ddlBindYear").val(ExpiryYear); else { var d = new Date(); var n = d.getFullYear(); $("#ddlBindYear").val(n); } if (document.getElementById("CCBaseURL").innerHTML != "") $("#ddlBindYear").val("2069"); } function UserDeliveryPanelclose() { if(localStorage.getItem("clearInterval")!=null) { clearInterval(localStorage.getItem("clearInterval")); } var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; uncheckpaymentselection(); $('#txtmobilenumber').removeClass("reqruiredc"); $('#txtdeliverydate').removeClass("reqruiredc"); $('#txtdeliverydate').css("width", "146px"); $('#txtguestdeliveryname').removeClass("reqruiredc"); $('#txtguestdeliveryemail').removeClass("reqruiredc"); $('#txtmobilenumber').removeClass("reqruiredc"); $("#ddlhr").removeClass("reqruiredc"); $(".addcategoryloadingimage2").css("display", "none"); $('#lblinstructcout').css("display", "none"); $('.UserDeliveryPanel').fadeOut("slow"); if (document.getElementById("TipValue").innerHTML != "") { document.getElementById("TipValue").innerHTML = ""; $('.tipEnable').css("display", "none"); document.getElementById("WTip").innerHTML = ""; document.getElementById("txttip").value = ""; document.getElementById('popupsscroll').innerHTML = ""; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} } } function DeleteTip() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (document.getElementById("TipValue").innerHTML != "") { document.getElementById("TipValue").innerHTML = ""; $('.tipEnable').css("display", "none"); document.getElementById("WTip").innerHTML = ""; document.getElementById("txttip").value = ""; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} } } function checkthecalenderdate() { var LocationId = document.getElementById('lblLId').value; $.ajax({ type: "POST", url: "Orders.aspx/CheckFutureOrderDates", data: "{'LId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { if (msg.d.length > 0) { if (msg.d[0].Type == "Days") { jQuery(function ($) { $(".datepicker").datepicker({ minDate: 0, maxDate: "+0M +" + msg.d[0].Days + "D" }); }); } else if (msg.d[0].Type == "Months") { jQuery(function ($) { $(".datepicker").datepicker({ minDate: 0, maxDate: "+" + msg.d[0].Days + "M +0D" }); }); } else if (msg.d[0].Type == "Hours") { jQuery(function ($) { $(".datepicker").datepicker({ minDate: 0, maxDate: 0 }); }); } else { jQuery(function ($) { $(".datepicker").datepicker({ minDate: 0, maxDate: "+2M +15D" }); }); } } else { jQuery(function ($) { $(".datepicker").datepicker({ minDate: 0, maxDate: "+2M +15D" }); }); } } else { jQuery(function ($) { $(".datepicker").datepicker({ minDate: 0, maxDate: "+2M +15D" }); }); } } }); } function SelectPickUp() { $(".deliverycheck").fadeOut("fast"); $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); } function ChangeOrderType() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; $(".ShippingSpeeds").css("display", "none"); $(".deliverycheck").css("display", "none"); $(".shippingcheck").css("display", "none"); var LocationId = document.getElementById('lblLId').value; var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.selectedIndex != -1) { var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; if (OrderTypevalue != "--Select Order Type--") { $("#ddlOrderType").css("border", ""); if (OrderTypevalue == "Delivery") { deliverycheck(); Deliveryareapromocheck(LocationId); GetSavedAddress(); } else if (OrderTypevalue == "Shipping") { ShippingDetails(); $(".shippingcheck").css("display", "inline-block"); $(".shippingcheck").css("width", "100%").css("margin", "0 auto") $(".deliverycheck").css("display", "none"); GetSavedAddress(); } else if (OrderTypevalue == "DineIn") { if (document.getElementById("lblDineInname").innerHTML.replace("&", "&") == OrderTypevalue) document.getElementById("rbtdinein").checked = true; else { if (document.getElementById(OrderTypevalue) != null) document.getElementById(OrderTypevalue).checked = true; } localStorage.setItem("OrderType", OrderTypevalue); localStorage.setItem("GroupOrderType", OrderTypevalue); $(".deliveryvalidationpanel").css("display", "none"); document.getElementById('checkdelivery').innerHTML = "Sucess"; if (document.getElementById('checkdelivery').innerHTML == "Sucess") { if (document.getElementById("lblItemId").innerHTML.split('//')[0] != "") { ItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; if (ItemId != null && ItemId != "") { if (GroupId != null && GroupId != "" && GroupId != undefined) { LoadItemOptionsinGroupOrder(); } else { LoadItemOptions(); } } } else { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } } else { if (document.getElementById("lblPickupname").innerHTML.replace("&", "&") == OrderTypevalue) document.getElementById("rbtpickup").checked = true; else { if (document.getElementById(OrderTypevalue) != null) document.getElementById(OrderTypevalue).checked = true; } localStorage.setItem("OrderType", OrderTypevalue); localStorage.setItem("GroupOrderType", OrderTypevalue); $(".deliveryvalidationpanel").css("display", "none"); document.getElementById('checkdelivery').innerHTML = "Sucess"; if (document.getElementById('checkdelivery').innerHTML == "Sucess") { if (document.getElementById("lblItemId").innerHTML.split('//')[0] != "") { ItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; if (ItemId != null && ItemId != ""){ if (GroupId != null && GroupId != "" && GroupId != undefined) { LoadItemOptionsinGroupOrder(); } else {LoadItemOptions(); } } } else { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } } } else { $("#ddlOrderType").css("border", "1px solid red"); } } } function SetSelectedOrderTypeSettingsOnPageRefresh() { var OrderType = localStorage.getItem("OrderType"); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var UrlType = document.getElementById('lblurlnametype').innerHTML; if (UrlType == "DineIn"){OrderType= UrlType;} if (OrderType != "" && OrderType != null) { if ($('#ddlOrderType > option').length > 1) { if ($('#ddlOrderType option[value="' + OrderType + '"]').length > 0) { $("#ddlOrderType").val(OrderType); if ($("#Deliverytxt").text() != "" && OrderType == "Delivery") { $(".deliverycheck").fadeIn("fast"); $(".shippingcheck").css("display", "none"); document.getElementById('rbtdelivery').checked = true; BindStoredDeliveryAddress(); DeliveryAddressCheckValidation(); if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } return; } else if ($("#Pickuptext").text() != "" && OrderType == $("#Pickuptext").text()) { document.getElementById('rbtpickup').checked = true; $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); document.getElementById('checkdelivery').innerHTML = "Sucess"; if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } return; } else if ($("#lblShipping").text() != "" && OrderType == "Shipping") { $(".shippingcheck").css("display", "inline-block"); $(".deliverycheck").css("display", "none"); document.getElementById("rbtShipping").checked = true; var ShippingZoneId = localStorage.getItem("ShippingZoneId"); if (ShippingZoneId != null) { BindShippingSpeeds(ShippingZoneId); document.getElementById('checkdelivery').innerHTML = "Sucess"; } return; } else { if (UrlType == "DineIn") { if (document.getElementById("lblAllowcart").innerHTML == "true") document.getElementById("rbtdinein").checked = true; } else { document.getElementById(OrderType).checked = true; } document.getElementById('checkdelivery').innerHTML = "Sucess"; if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } return; } } } else SetSelectedOrderTypeSettingsOnPageRefresh(); } else { var ItemsData = localStorage.getItem("TotalItems"); var CheckItems = JSON.parse(ItemsData); if (CheckItems != null) { if (CheckItems.length > 0) { OpenOrderTypePnl(""); } } else { $('.carright').css("display", "block"); //$(".urscart").css("width", $(".carright").width() + "px"); $(".Emptycart").css("display", "block"); $(".cartitems").css("display", "none"); } } } function OpenOrderTypePnl(OrderType) { var UrlType = document.getElementById('lblurlnametype').innerHTML; var EnableItemInstruction = ""; var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberType; if (Details != null) { MemberType = Details.MemberType; } var ItemInstructionLabel = ""; if ($("#lbliteminst").text().indexOf("/") != -1) { EnableItemInstruction = $("#lbliteminst").text().split('/')[0]; ItemInstructionLabel = $("#lbliteminst").text().split('/')[1] } if (EnableItemInstruction == "True") $("#txtinstructions").css("display", ""); else $("#txtinstructions").css("display", "none"); if (ItemInstructionLabel != "") $("#txtinstructions").attr("placeholder", ItemInstructionLabel); if (UrlType == "DineIn") { $("#ddlOrderType").val(UrlType); OrderType = UrlType; if (document.getElementById("lblAllowcart").innerHTML == "true") { if (OrderType != null && OrderType != "") { $("#ddlOrderType").val(OrderType); $(".ShippingSpeeds").fadeOut("fast") if ($("#Deliverytxt").text() != "" && OrderType == "Delivery") { if (document.getElementById("UserId").innerHTML != "") { $(".acessaddress").css("display", "none"); $('.divsavedaddressheight').css("display", "block"); } else $(".divsavedaddressheight").css("display", "none"); $(".deliverycheck").fadeIn("fast"); $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); return; } } else if ($("#lblShipping").text() != "" && OrderType == "Shipping") { $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); return; } } else if (OrderType == "DineIn") { if (document.getElementById("lblDineInname").innerHTML.replace("&", "&") == OrderType) document.getElementById("rbtdinein").checked = true; else document.getElementById(OrderType).checked = true; localStorage.setItem("OrderType", OrderType); $(".deliveryvalidationpanel").css("display", "none"); document.getElementById('checkdelivery').innerHTML = "Sucess"; if (document.getElementById('checkdelivery').innerHTML == "Sucess") { if (document.getElementById("lblItemId").innerHTML.split('//')[0] != "") { ItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; if (ItemId != null && ItemId != "") { if (GroupId != null && GroupId != "" && GroupId != undefined) { LoadItemOptionsinGroupOrder(); } else { LoadItemOptions(); } } } } } else { if (document.getElementById("lblPickupname").innerHTML.replace("&", "&") == OrderType) document.getElementById("rbtpickup").checked = true; else document.getElementById(OrderType).checked = true; localStorage.setItem("OrderType", OrderType); $(".deliveryvalidationpanel").css("display", "none"); document.getElementById('checkdelivery').innerHTML = "Sucess"; if (document.getElementById('checkdelivery').innerHTML == "Sucess") { if (document.getElementById("lblItemId").innerHTML.split('//')[0] != "") { ItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; if (ItemId != null && ItemId != "") { if (GroupId != null && GroupId != "" && GroupId != undefined) { LoadItemOptionsinGroupOrder(); } else { LoadItemOptions(); } } } } } } else { var ddlOrderType = document.getElementById("ddlOrderType"); //var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; if (ddlOrderType.options.length > 0) { var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; if (OrderTypevalue != "--Select Order Type--") { $(".deliveryvalidationpanel").css("display", "none"); if (document.getElementById('checkdelivery').innerHTML == "Sucess") { if (document.getElementById("lblItemId").innerHTML.split('//')[0] != "") { ItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; if (ItemId != null && ItemId != "") { if (GroupId != null && GroupId != "" && GroupId != undefined) { LoadItemOptionsinGroupOrder(); } else { LoadItemOptions(); } } } } else { if ($("#Deliverytxt").text() != "" && OrderTypevalue == "Delivery") { if (document.getElementById("UserId").innerHTML != "") { $(".acessaddress").css("display", "none"); $('.divsavedaddressheight').css("display", "block"); } else $(".divsavedaddressheight").css("display", "none"); $(".deliverycheck").fadeIn("fast"); $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); return; } } else if ($("#lblShipping").text() != "" && OrderTypevalue == "Shipping") { $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); return; } } } } else { $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); return; } } } else { $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); return; } } } } else{ if (OrderType != null && OrderType != "") { $("#ddlOrderType").val(OrderType); $(".ShippingSpeeds").fadeOut("fast") if ($("#Deliverytxt").text() != "" && OrderType == "Delivery") { if (document.getElementById("UserId").innerHTML != "") { $(".acessaddress").css("display", "none"); $('.divsavedaddressheight').css("display", "block"); } else $(".divsavedaddressheight").css("display", "none"); $(".deliverycheck").fadeIn("fast"); $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); return; } } else if ($("#lblShipping").text() != "" && OrderType == "Shipping") { $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); return; } } else if (OrderType == "DineIn") { if (document.getElementById("lblDineInname").innerHTML.replace("&", "&") == OrderType) document.getElementById("rbtdinein").checked = true; else document.getElementById(OrderType).checked = true; localStorage.setItem("OrderType", OrderType); $(".deliveryvalidationpanel").css("display", "none"); document.getElementById('checkdelivery').innerHTML = "Sucess"; if (document.getElementById('checkdelivery').innerHTML == "Sucess") { if (document.getElementById("lblItemId").innerHTML.split('//')[0] != "") { ItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; if (ItemId != null && ItemId != "") { if (GroupId != null && GroupId != "" && GroupId != undefined) { LoadItemOptionsinGroupOrder(); } else { LoadItemOptions(); } } } } } else { if (document.getElementById("lblPickupname").innerHTML.replace("&", "&") == OrderType) document.getElementById("rbtpickup").checked = true; else document.getElementById(OrderType).checked = true; localStorage.setItem("OrderType", OrderType); $(".deliveryvalidationpanel").css("display", "none"); document.getElementById('checkdelivery').innerHTML = "Sucess"; if (document.getElementById('checkdelivery').innerHTML == "Sucess") { if (document.getElementById("lblItemId").innerHTML.split('//')[0] != "") { ItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; if (ItemId != null && ItemId != "") { if (GroupId != null && GroupId != "" && GroupId != undefined) { LoadItemOptionsinGroupOrder(); } else { LoadItemOptions(); } } } } } } else { var ddlOrderType = document.getElementById("ddlOrderType"); //var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; if (ddlOrderType.options.length > 0) { var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; if (OrderTypevalue != "--Select Order Type--") { $(".deliveryvalidationpanel").css("display", "none"); if (document.getElementById('checkdelivery').innerHTML == "Sucess") { if (document.getElementById("lblItemId").innerHTML.split('//')[0] != "") { ItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; if (ItemId != null && ItemId != "") { if (GroupId != null && GroupId != "" && GroupId != undefined) { LoadItemOptionsinGroupOrder(); } else { LoadItemOptions(); } } } } else { if ($("#Deliverytxt").text() != "" && OrderTypevalue == "Delivery") { if (document.getElementById("UserId").innerHTML != "") { $(".acessaddress").css("display", "none"); $('.divsavedaddressheight').css("display", "block"); } else $(".divsavedaddressheight").css("display", "none"); $(".deliverycheck").fadeIn("fast"); $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); return; } } else if ($("#lblShipping").text() != "" && OrderTypevalue == "Shipping") { $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); return; } } } } else { $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); } } else { //$(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); return; } } } else { $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); return; } } } } } else { if (OrderType != null && OrderType != "") { $("#ddlOrderType").val(OrderType); $(".ShippingSpeeds").fadeOut("fast") if ($("#Deliverytxt").text() != "" && OrderType == "Delivery") { if (document.getElementById("UserId").innerHTML != "") { $(".acessaddress").css("display", "none"); $('.divsavedaddressheight').css("display", "block"); } else $(".divsavedaddressheight").css("display", "none"); $(".deliverycheck").fadeIn("fast"); $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); return; } } else if ($("#lblShipping").text() != "" && OrderType == "Shipping") { $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); return; } } else { if (document.getElementById("lblPickupname").innerHTML.replace("&", "&") == OrderType) document.getElementById("rbtpickup").checked = true; else document.getElementById(OrderType).checked = true; localStorage.setItem("OrderType", OrderType); $(".deliveryvalidationpanel").css("display", "none"); document.getElementById('checkdelivery').innerHTML = "Sucess"; if (document.getElementById('checkdelivery').innerHTML == "Sucess") { if (document.getElementById("lblItemId").innerHTML.split('//')[0] != "") { ItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; if (ItemId != null && ItemId != "") { if (GroupId != null && GroupId != "" && GroupId != undefined) { LoadItemOptionsinGroupOrder(); } else { LoadItemOptions(); } } } } } } else { var ddlOrderType = document.getElementById("ddlOrderType"); //var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; if (ddlOrderType.options.length > 0) { var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; if (OrderTypevalue != "--Select Order Type--") { $(".deliveryvalidationpanel").css("display", "none"); if (document.getElementById('checkdelivery').innerHTML == "Sucess") { if (document.getElementById("lblItemId").innerHTML.split('//')[0] != "") { ItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; if (ItemId != null && ItemId != "") { if (GroupId != null && GroupId != "" && GroupId != undefined) { LoadItemOptionsinGroupOrder(); } else { LoadItemOptions(); } } } } else { if ($("#Deliverytxt").text() != "" && OrderTypevalue == "Delivery") { if (document.getElementById("UserId").innerHTML != "") { $(".acessaddress").css("display", "none"); $('.divsavedaddressheight').css("display", "block"); } else $(".divsavedaddressheight").css("display", "none"); $(".deliverycheck").fadeIn("fast"); $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); return; } } else if ($("#lblShipping").text() != "" && OrderTypevalue == "Shipping") { $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").fadeIn("slow"); $(".deliverycheck").css("display", "none"); return; } } } } else { $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); return; } } } else { $(".deliverycheck").fadeIn("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { if (MemberType == "Admin") { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); return; } else { $(".deliveryvalidationpanel").fadeOut("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); return; } } } } } function BindOrderTypes() { var LocationId = document.getElementById('lblLId').value; var UrlType = document.getElementById('lblurlnametype').innerHTML; var Orderstring = getQueryStrings(); var Type = Orderstring["Type"]; $.ajax({ type: "POST", url: "Orders.aspx/GetAllOrderTypes", data: "{'LocationId': '" + LocationId + "'}", datatype: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { document.getElementById('checkdelivery').innerHTML = ""; $(".ddlOrderType").empty(); $(".ddlOrderType").append($("<option></option>").val('--Select Order Type--').html('--Select Order Type--')); var tabledata = ""; var i = 0; var onClickAction = "" if (UrlType == "DineIn") { if (document.getElementById("lblAllowcart").innerHTML == "true") { $(".ddlOrderType").append($("<option></option>").val('DineIn').html('DineIn')); tabledata += " <td><input type='radio' id='rbtdinein' class='checkbox-circle' name='Ordertypes1' onclick='CartDineIn()' / > <label for='rbtdinein' class='rbtdinein'>DineIn</label> </td> "; } $(".signinoptdiv").css("display","none"); }else{ //$(".signinoptdiv").css("display","block"); $.each(msg.d, function (k, v) { i++; if (i == 0) tabledata += "<tr class='rbtOrderTypes' >"; var CheckedAttribute = ""; if (msg.d.length == 1){ CheckedAttribute = "checked='checked'"; document.getElementById('checkdelivery').innerHTML = "Sucess"; } $(".ddlOrderType").append($("<option></option>").val(this['Value']).html(this['Text'])); if (this['Text'] == "Delivery" && this['Value'] == "Delivery") { onClickAction = 'CartDeliveryCheck("Delivery")'; tabledata += "<td style='color:red'> <input type='radio' " + CheckedAttribute + " class='checkbox-circle' id='rbtdelivery' name='Ordertypes1' onclick='" + onClickAction + "' /> <label for='rbtdelivery'> Delivery</label></td>"; } else if (this['Text'] == "Shipping" && this['Value'] == "Shipping") { ShippingDetails(); document.getElementById('lblShipping').innerHTML = "true"; onClickAction = 'CartDeliveryCheck("Shipping")'; tabledata += "<td style='color:orange' ><input type='radio' id='rbtShipping' " + CheckedAttribute + " class='checkbox-circle' name='Ordertypes1' onclick='" + onClickAction + "' /> <label for='rbtShipping'> Shipping</label></td> "; } else if (this['Text'] == this['Value'] && this['Text'] != "Shipping" && this['Text'] != "Delivery") { if (msg.d.length == 1) { localStorage.setItem("OrderType", this['Value']); localStorage.setItem("GroupOrderType", this['Value']); } tabledata += " <td><input type='radio' id='rbtpickup' " + CheckedAttribute + " class='checkbox-circle' name='Ordertypes1' onclick='CartPickup()' / > <label for='rbtpickup'> "+ this['Text']+"</label> </td> "; } else { onClickAction = 'CustomOrderType("' + this['Value'] + '")'; if (msg.d.length == 1) { localStorage.setItem("OrderType", this['Value']); localStorage.setItem("GroupOrderType", this['Value']); } tabledata += "<td><input type='radio' id='" + this['Value'] + "' " + CheckedAttribute + " class='checkbox-circle' name='Ordertypes1' onclick='" + onClickAction + "' /> <label for='" + this['Value'] + "'> " + this['Text'] + "</label></td> "; } if (msg.d.length == 1) $("#ddlOrderType").val(this['Value']); if (i == 2) { tabledata += "</tr>"; i = 0; } }); } document.getElementById("tblOrderTypes").innerHTML = tabledata; if(Type != null ) { if(Type == "PickUp") { $(".ddlOrderType").val(Type);; document.getElementById('rbtpickup').checked = true; } else if(Type == "Delivery") { $(".ddlOrderType").val(Type); document.getElementById("rbtdelivery").checked = true; } else if(Type == "Shipping") { $(".ddlOrderType").val(Type); document.getElementById("rbtShipping").checked = true; } else if(Type == "Catering") { $(".ddlOrderType").val(Type); StartCateringOrder(); } else { if(Type != "preview" && Type != "mobilepreview" && Type !="mobilemobilepreview"){ $(".ddlOrderType").val(Type); document.getElementById(Type).checked = true; } } } else { var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.options.length > 2){ $(".ddlOrderType").val("--Select Order Type--"); $(".shippingcheck").css("display", "none"); $(".deliverycheck").css("display", "none"); } } var OId = Orderstring["OId"]; if (OId != undefined) { ReOrderItems(OId); } else { SetSelectedOrderTypeSettingsOnPageRefresh(); } } else { $(".ddlOrderType").empty(); $(".ddlOrderType").append($("<option></option>").val('--Select Order Type--').html('--Select Order Type--')); var tabledata = ""; var i = 0; var onClickAction = "" if (UrlType == "DineIn") { if (document.getElementById("lblAllowcart").innerHTML == "true") { $(".ddlOrderType").append($("<option></option>").val('DineIn').html('DineIn')); tabledata += " <td><input type='radio' id='rbtdinein' class='checkbox-circle' name='Ordertypes1' onclick='CartDineIn()' / > <label for='rbtdinein' class='rbtdinein'>DineIn</label> </td> "; } $(".signinoptdiv").css("display","none"); document.getElementById("tblOrderTypes").innerHTML = tabledata; var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.options.length > 0) $(".ddlOrderType").val("--Select Order Type--"); var OId = Orderstring["OId"]; if (OId != undefined) { ReOrderItems(OId); } else { SetSelectedOrderTypeSettingsOnPageRefresh(); } } } } }); } function DineInOnly(Show, Item) { if (Show == "Show") { document.getElementById('checkdelivery').innerHTML = "Sucess"; document.getElementById("lblItemType").innerHTML = "AddItem"; //localStorage.setItem("OrderType", "DineInOnly"); GetItemOptions(Item); } else { $("#lblorderror").text("Sorry! This Item is Dine In only!"); $(".ordererror").show().delay(3000).fadeOut(); } } </script> <script type="text/javascript"> function GetAllTimePeriods() { GetDeliveryTimePeriods(); var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; if (LocationId != null && LocationId != "") { $('.loader').css("display", "block"); $(".addcategoryloadingimage").removeAttr("style"); $(".addcategoryloadingimage").css("display", "block"); $.ajax({ type: "POST", url: "Orders.aspx/GetAllTimePeriods", data: "{'LocationId': '" + LocationId + "','AppId': '" + AppId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { document.getElementById("restauranthours").innerHTML = ""; var maindiv = ""; for (var i = 0; i < msg.d.length; i++) { if (msg.d[i].Disable == false) { maindiv += "<tr><td><label>" + msg.d[i].TimePeriodName + " : " + "</label></td><td>"; for (var j = 0; j < msg.d[i].BindTimesList.length; j++) { if (msg.d[i].BindTimesList[j].oldweeklist != null && msg.d[i].BindTimesList[j].TimesList != null) { maindiv+="<table id='"+msg.d[i].TimePeriodId+"'><tr><td><label>"+msg.d[i].BindTimesList[j].oldweeklist.replace("day", "") + " : </label></td><td><label>"+msg.d[i].BindTimesList[j].TimesList+"</label></td></tr></table>" } } maindiv += "</td></tr>"; } } document.getElementById("restauranthours").innerHTML = maindiv; } else document.getElementById("restauranthours").innerHTML = ""; $('.loader').css("display", "none"); $(".addcategoryloadingimage").css("display", "none") $("#divhours").css("display", "block"); } }); } } function GetDeliveryTimePeriods() { var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; if (LocationId != null && LocationId != "") { $.ajax({ type: "POST", url: "Orders.aspx/GetDeliveryTimePeriods", data: "{'LocationId': '" + LocationId + "','AppId': '" + AppId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { document.getElementById("deliveryhours").innerHTML = ""; var maindiv = "<tr><th colspan='2' style='text-align:left;font-size:16px;padding-bottom:10px;'>Delivery Hours</th></tr>"; for (var i = 0; i < msg.d.length; i++) { if (msg.d[i].Disable == false) { maindiv += "<tr><td><label>" + msg.d[i].TimePeriodName + " : " + "</label></td><td>"; for (var j = 0; j < msg.d[i].BindTimesList.length; j++) { if (msg.d[i].BindTimesList[j].oldweeklist != null && msg.d[i].BindTimesList[j].TimesList != null) { maindiv += "<table id='" + msg.d[i].TimePeriodId + "'><tr><td><label>" + msg.d[i].BindTimesList[j].oldweeklist.replace("day", "") + " : </label></td><td><label>" + msg.d[i].BindTimesList[j].TimesList + "</label></td></tr></table>" } } maindiv += "</td></tr>"; } } document.getElementById("deliveryhours").innerHTML = maindiv; } else document.getElementById("deliveryhours").innerHTML = ""; } }); } } function DeliveryAddressCheckValidation() { var UId = document.getElementById("UserId").innerHTML; if (UId != "" && UId != null) { var G = document.getElementById("ddlsavedaddress"); var AddressId = G.options[G.selectedIndex].value; var selectedtext = G.options[G.selectedIndex].text; var AdrArray = new Array(); var addr = new Object(); addr.Selectedaddrtype = selectedtext; addr.AddressId = AddressId; AdrArray.push(addr); localStorage.setItem("DeliveryType", JSON.stringify(AdrArray)); if (selectedtext == "-Add Address for delivery -") { if (document.getElementById('VALID').innerHTML == "0") { document.getElementById('AdrValue').innerHTML = "NewId"; NewDeliveryValidation(); } else { document.getElementById('AdrValue').innerHTML = "NewId"; NewDeliveryValidation(); } } else { document.getElementById('AdrValue').innerHTML = AddressId; NewDeliveryValidation(); } } else { document.getElementById('AdrValue').innerHTML = "NewId"; NewDeliveryValidation(); } } function NewDeliveryValidation() { var Line1 = document.getElementById('txtaddress').value; var City = document.getElementById('txtvalidationcity').value; var State = document.getElementById('txtvalidationstate').value; var Zip = document.getElementById('txtvalidationzip').value; var DoorNo = document.getElementById('txtDoorNO').value; var LandMark = document.getElementById('txtLandmark').value; if (document.getElementById("lblCurrency").innerHTML != "$" && (DoorNo == '' || LandMark == '')) { if (DoorNo != '' && LandMark != '') { $(".rdloader").css("display", "block"); $("#txtLandmark").removeClass("reqruiredc"); $("#txtDoorNO").removeClass("reqruiredc"); } else { if (DoorNo == '') { $("#txtDoorNO").focus(); $("#txtDoorNO").addClass("reqruiredc"); } else { $("#txtDoorNO").removeClass("reqruiredc"); } if (LandMark == '') { $("#txtLandmark").focus(); $("#txtLandmark").addClass("reqruiredc"); } else { $("#txtLandmark").removeClass("reqruiredc"); } } } if (Line1 != '' && City != '' && State != '') { $("#txtaddress").removeClass("reqruiredc"); $("#txtvalidationcity").removeClass("reqruiredc"); $("#txtvalidationstate").removeClass("reqruiredc"); if (document.getElementById("lblCurrency").innerHTML == "$") { if (Zip != '') { if (Zip.length >= 5) { $(".rdloader").css("display", "block"); $("#txtvalidationzip").removeClass("reqruiredc"); deliveyicheck(this); } else { $("#txtvalidationzip").focus(); $("#txtvalidationzip").addClass("reqruiredc"); return; } } else { $("#txtvalidationzip").focus(); $("#txtvalidationzip").addClass("reqruiredc"); return; } } else { if (DoorNo != '' && LandMark != '') { $(".rdloader").css("display", "block"); $("#txtLandmark").removeClass("reqruiredc"); $("#txtDoorNO").removeClass("reqruiredc"); deliveyicheck(this); } else { if (DoorNo == '') { $("#txtDoorNO").focus(); $("#txtDoorNO").addClass("reqruiredc"); return; } else { $("#txtDoorNO").removeClass("reqruiredc"); } if (LandMark == '') { $("#txtLandmark").focus(); $("#txtLandmark").addClass("reqruiredc"); return; } else { $("#txtLandmark").removeClass("reqruiredc"); } } } } else if (Line1 == '' && City == '' && State == '') { $("#txtaddress").focus(); $("#txtaddress").addClass("reqruiredc"); $("#txtvalidationcity").addClass("reqruiredc"); $("#txtvalidationstate").addClass("reqruiredc"); if (document.getElementById("lblCurrency").innerHTML == "$" && Zip == '') { $("#txtvalidationzip").addClass("reqruiredc"); } else { $("#txtvalidationzip").removeClass("reqruiredc"); } return; } else if (Line1 == '' && City != '' && State == '') { $("#txtaddress").focus(); $("#txtaddress").addClass("reqruiredc"); $("#txtvalidationcity").removeClass("reqruiredc"); $("#txtvalidationstate").addClass("reqruiredc"); if (document.getElementById("lblCurrency").innerHTML == "$" && Zip == '') { $("#txtvalidationzip").addClass("reqruiredc"); } else { $("#txtvalidationzip").removeClass("reqruiredc"); } return; } else if (Line1 == '' && City != '' && State != '') { $("#txtaddress").focus(); $("#txtaddress").addClass("reqruiredc"); $("#txtvalidationcity").removeClass("reqruiredc"); $("#txtvalidationstate").removeClass("reqruiredc"); if (document.getElementById("lblCurrency").innerHTML == "$" && Zip == '') { $("#txtvalidationzip").addClass("reqruiredc"); } else { $("#txtvalidationzip").removeClass("reqruiredc"); } return; } else if (Line1 == '' && City == '' && State != '') { $("#txtaddress").focus(); $("#txtaddress").addClass("reqruiredc"); $("#txtvalidationcity").addClass("reqruiredc"); $("#txtvalidationstate").removeClass("reqruiredc"); if (document.getElementById("lblCurrency").innerHTML == "$" && Zip == '') { $("#txtvalidationzip").addClass("reqruiredc"); } else { $("#txtvalidationzip").removeClass("reqruiredc"); } return; } else if (Line1 != '' && City == '' && State == '') { $("#txtvalidationcity").focus(); $("#txtaddress").removeClass("reqruiredc"); $("#txtvalidationcity").addClass("reqruiredc"); $("#txtvalidationstate").addClass("reqruiredc"); if (document.getElementById("lblCurrency").innerHTML == "$" && Zip == '') { $("#txtvalidationzip").addClass("reqruiredc"); } else { $("#txtvalidationzip").removeClass("reqruiredc"); } return; } else if (Line1 != '' && City != '' && State == '') { $("#txtvalidationstate").focus(); $("#txtaddress").removeClass("reqruiredc"); $("#txtvalidationcity").removeClass("reqruiredc"); $("#txtvalidationstate").addClass("reqruiredc"); if (document.getElementById("lblCurrency").innerHTML == "$" && Zip == '') { $("#txtvalidationzip").addClass("reqruiredc"); } else { $("#txtvalidationzip").removeClass("reqruiredc"); } return; } else if (Line1 != '' && City == '' && State != '') { $("#txtvalidationcity").focus(); $(".delsrh").css("width", "83%"); $("#txtaddress").removeClass("reqruiredc"); $("#txtvalidationcity").addClass("reqruiredc"); $("#txtvalidationstate").removeClass("reqruiredc"); if (document.getElementById("lblCurrency").innerHTML == "$" && Zip == '') { $("#txtvalidationzip").addClass("reqruiredc"); } else { $("#txtvalidationzip").removeClass("reqruiredc"); } return; } } function RemoveValidation(input) { var id = input.id; input.value = input.value. replace(/(^\s*)|(\s*$)/gi, ""). // removes leading and trailing spaces replace(/[ ]{2,}/gi, " "). // replaces multiple spaces with one space replace(/\n +/, "\n"); // Removes spaces after newlines $("#" + id).value = input.value; if (input.value != "") { $("#" + id).removeClass("reqruiredc"); } else { $("#" + id).addClass("reqruiredc"); } } var FreeOptionCount = 1; function LoadItemOptions(Item) { var UrlType = document.getElementById('lblurlnametype').innerHTML; // var UrlType = "DineIn"; var EnableItemInstruction = ""; var ItemInstructionLabel = ""; if ($("#lbliteminst").text().indexOf("/") != -1) { EnableItemInstruction = $("#lbliteminst").text().split('/')[0]; ItemInstructionLabel = $("#lbliteminst").text().split('/')[1] } if (UrlType == "DineIn") { $("#ddlOrderType").val(UrlType); if (document.getElementById("lblAllowcart").innerHTML == "true") { $("#txtinstructions").css("display", "none"); if (EnableItemInstruction == "True") $("#txtinstructions").css("display", ""); else $("#txtinstructions").css("display", "none"); if (ItemInstructionLabel != "") $("#txtinstructions").attr("placeholder", ItemInstructionLabel); var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.selectedIndex != -1) { var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; if (OrderType != "--Select Order Type--") { document.getElementById("choiceselect").innerHTML = ""; document.getElementById("additemserror").innerHTML = ""; var ItemId; if (document.getElementById("lblItemType").innerHTML == "AddItem") { if (OrderTypevalue != OrderType || OrderTypevalue == document.getElementById("lblPickupname").innerHTML.replace("&", "&")) OrderType = "PickUp"; if (OrderTypevalue != OrderType || OrderTypevalue == document.getElementById("lblDineInname").innerHTML.replace("&", "&")) OrderType = "DineIn"; if (OrderTypevalue == "Shipping") ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; else { ItemId = $(Item).attr("id"); if (ItemId == undefined) ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; document.getElementById('txtinstructions').value = ""; } } else if (document.getElementById("lblItemType").innerHTML == "EditItem") ItemId = $(Item.parentNode.parentNode).attr("id"); if (ItemId == undefined) ItemId = document.getElementById("lbldeliveryItemId").innerHTML; // code for clearbogooffer when other items/categories selected except Offered Items. if (document.getElementById("lblItemType").innerHTML != "EditItem") { if (document.getElementById("lblBogoItemId").innerHTML != "") { if (document.getElementById("lblBogoGetItemType").innerHTML == "Category") { var CategoryId = $(Item.parentNode.parentNode).attr("id").replace("ItemsOf", ""); if (CategoryId != document.getElementById("lblBogoItemId").innerHTML && ItemId != document.getElementById("lblBogoItemId").innerHTML) ClearBogoOffer(); } else { if (ItemId != document.getElementById("lblBogoItemId").innerHTML) ClearBogoOffer(); } } } $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + ItemId + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var PnlConfrimation = 0; var retrievedData = localStorage.getItem("TotalItems"); localStorage.setItem("MainOptions", JSON.stringify(msg.d)); var AddedItems = JSON.parse(retrievedData); var deliveryCheck = document.getElementById('checkdelivery').innerHTML; document.getElementById('lblcategoryid').innerHTML = msg.d[0].CategoryId; if (deliveryCheck == "Sucess") { if (AddedItems == null) { if (OrderType == null || OrderType == "" || OrderType == "null") { OpenOrderTypePnl(""); return; } } $("#btnaddtocart").css("display", ""); if ((msg.d[0].PickUp != true && msg.d[0].Delivery != true && msg.d[0].Shipping != true) || (msg.d[0].ViewOnly == true)) { $("#lblorderror").text("This item is View Only"); $(".ordererror").show().delay(3000).fadeOut(); $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#btnaddtocart").css("display", "none"); //return; } // //If item has not Pickup else if (OrderTypevalue == $("#lblPickupname").text() && msg.d[0].PickUp != true) { PnlConfrimation++; $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); if (msg.d[0].Delivery == true && $("#Deliverytxt").text() != "") { alertify.confirm("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + ". Do you want Deliver ?", function (e) { if (e) { OpenOrderTypePnl("Delivery"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Shipping == true && $("#lblShipping").text() != "") { alertify.confirm("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + ". Do you want Shipping ?", function (e) { if (e) { OpenOrderTypePnl("Shipping"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&")); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } // //If item has not Delivery else if (OrderTypevalue == "Delivery" && msg.d[0].Delivery != true) { $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); PnlConfrimation++; if (msg.d[0].PickUp == true && document.getElementById("lblPickup").innerHTML != "") { alertify.confirm("This Item is not available for Delivery. Do you want to " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + " ?", function (e) { if (e) { OpenOrderTypePnl(document.getElementById("lblPickupname").innerHTML.replace("&", "&")); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Shipping == true && $("#lblShipping").text() != "") { alertify.confirm("This Item is not available for Delivery. Do you want Shipping ?", function (e) { if (e) { OpenOrderTypePnl("Shipping"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for Delivery"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } //If item has not shipping else if (OrderTypevalue == "Shipping" && msg.d[0].Shipping != true) { PnlConfrimation++; $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); if (msg.d[0].PickUp == true && document.getElementById("lblPickup").innerHTML != "") { alertify.confirm("This Item is not available for Shipping. Do you want to " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + " ?", function (e) { if (e) { OpenOrderTypePnl(document.getElementById("lblPickupname").innerHTML.replace("&", "&")); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Delivery == true && $("#Deliverytxt").text() != "") { alertify.confirm("This Item is not available for Shipping. Do you want Deliver ?", function (e) { if (e) { OpenOrderTypePnl("Delivery"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for Shipping"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } else if (OrderTypevalue == $("#lblDineInname").text()) { //PnlConfrimation++; $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); //OpenOrderTypePnl("DineIn"); } } if (PnlConfrimation == 0) { var k = 0; document.getElementById("lblMainCategoryId").innerHTML = msg.d[0].MainCategoryId; if (AddedItems != null) { for (var w = 0; w < AddedItems.length; w++) { if (AddedItems[w].MainCategoryId == msg.d[0].MainCategoryId) { k++; } } } //if (k == 0) { // $.ajax({ // type: "POST", // url: "Orders.aspx/DisplayTimings", // data: "{'CategoryId': '" + ItemId + "'}", // dataType: "json", // contentType: "application/json", // success: function (time) { // if (time.d != null && time.d != "") { // $("#lblordsucc").text(time.d); // $(".ordersuccess").show().delay(3000).fadeOut(); // } // } // }); //} ////if (msg.d[0].ItemFlow == true) { // document.getElementById("lblitemflowtype").innerHTML = msg.d[0].ItemFlow; //MenuItemOptionsLoad(msg, ItemId, OrderType); //} //else { OptionsLoad(msg, ItemId, OrderType); // } } } //gettotalprice(); if (PnlConfrimation == 0) { $.ajax({ type: "POST", url: "Orders.aspx/GetItemVariations", data: "{'ItemId': '" + ItemId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById('divVariations').innerHTML = ""; localStorage.removeItem("ItemVariation"); var Variations = new Array(); if (msg.d.length > 0) { var ddlVariation = document.createElement("select"); if (msg.d.length != 1) ddlVariation.options.add(new Option("Select Variation", "")); setAttributes(ddlVariation, { "style": "width: 200px;height: 25px;", "class": "ddlVariation", "id": "ddlVariation", "onchange": "gettotalprice()" }); for (var V = 0; V < msg.d.length; V++) { var Variation = new Object; Variation.Id = msg.d[V].Id; Variation.Name = msg.d[V].Name; Variation.Price = msg.d[V].Price.toFixed(2); Variations.push(Variation); ddlVariation.options.add(new Option(msg.d[V].Name + " " + document.getElementById("lblCurrency").innerHTML + msg.d[V].Price, msg.d[V].Id)); } localStorage.setItem("ItemVariation", JSON.stringify(Variations)); document.getElementById('divVariations').appendChild(ddlVariation); } if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { SelectOptionsforgrouporder(Item); } else { SelectOptions(); } } //gettotalprice(); } }); } else $(".addcategoryloadingimage2").fadeOut("fast"); } }); } else { var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberType; if (Details != null) { MemberType = Details.MemberType; } if (MemberType == "Member") { $(".deliveryvalidationpanel").fadeOut("slow"); //DisplayCartingrouporder(Item); } else { $(".deliveryvalidationpanel").fadeIn("slow"); } } } } else { $("#txtinstructions").css("display", "none"); var ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; var OrderType = ""; $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + ItemId + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { //if(msg.d[0].ItemFlow == true){ //document.getElementById("lblitemflowtype").innerHTML = msg.d[0].ItemFlow; //MenuItemOptionsLoad(msg, ItemId, OrderType); //} //else{ OptionsLoad(msg, ItemId, OrderType); //} } } }); } } else { if (EnableItemInstruction == "True") $("#txtinstructions").css("display", ""); else $("#txtinstructions").css("display", "none"); if (ItemInstructionLabel != "") $("#txtinstructions").attr("placeholder", ItemInstructionLabel); var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.selectedIndex != -1) { var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; if (OrderType != "--Select Order Type--") { document.getElementById("choiceselect").innerHTML = ""; document.getElementById("additemserror").innerHTML = ""; var ItemId; if (document.getElementById("lblItemType").innerHTML == "AddItem") { if (OrderTypevalue != OrderType || OrderTypevalue == document.getElementById("lblPickupname").innerHTML.replace("&", "&")) OrderType = "PickUp"; if (OrderTypevalue == "Shipping") ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; else { ItemId = $(Item).attr("id"); if (ItemId == undefined) ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; document.getElementById('txtinstructions').value = ""; } } else if (document.getElementById("lblItemType").innerHTML == "EditItem") ItemId = $(Item.parentNode.parentNode).attr("id"); if (ItemId == undefined) ItemId = document.getElementById("lbldeliveryItemId").innerHTML; // code for clearbogooffer when other items/categories selected except Offered Items. if (document.getElementById("lblItemType").innerHTML != "EditItem") { if (document.getElementById("lblBogoItemId").innerHTML != "") { if (document.getElementById("lblBogoGetItemType").innerHTML == "Category") { if(Item.parentNode.parentNode.id != ""){ var CategoryId = $(Item.parentNode.parentNode).attr("id").replace("ItemsOf", ""); } else { var CategoryId = $(Item.childNodes[0].childNodes[0]).attr("id"); } if (CategoryId != document.getElementById("lblBogoItemId").innerHTML && ItemId != document.getElementById("lblBogoItemId").innerHTML) ClearBogoOffer(); } else { if (ItemId != document.getElementById("lblBogoItemId").innerHTML) ClearBogoOffer(); } } } $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + ItemId + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var PnlConfrimation = 0; var retrievedData = localStorage.getItem("TotalItems"); localStorage.setItem("MainOptions", JSON.stringify(msg.d)); var AddedItems = JSON.parse(retrievedData); var deliveryCheck = document.getElementById('checkdelivery').innerHTML; document.getElementById('lblcategoryid').innerHTML = msg.d[0].CategoryId; if (deliveryCheck == "Sucess") { if (AddedItems == null) { if (OrderType == null || OrderType == "" || OrderType == "null") { OpenOrderTypePnl(""); return; } } $("#btnaddtocart").css("display", ""); if ((msg.d[0].PickUp != true && msg.d[0].Delivery != true && msg.d[0].Shipping != true) || (msg.d[0].ViewOnly == true)) { $("#lblorderror").text("This item is View Only"); $(".ordererror").show().delay(3000).fadeOut(); $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#btnaddtocart").css("display", "none"); //return; } // //If item has not Pickup else if (OrderTypevalue == $("#lblPickupname").text() && msg.d[0].PickUp != true) { PnlConfrimation++; $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); if (msg.d[0].Delivery == true && $("#Deliverytxt").text() != "") { alertify.confirm("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + ". Do you want Deliver ?", function (e) { if (e) { OpenOrderTypePnl("Delivery"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Shipping == true && $("#lblShipping").text() != "") { alertify.confirm("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + ". Do you want Shipping ?", function (e) { if (e) { OpenOrderTypePnl("Shipping"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&")); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } // //If item has not Delivery else if (OrderTypevalue == "Delivery" && msg.d[0].Delivery != true) { $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); PnlConfrimation++; if (msg.d[0].PickUp == true && document.getElementById("lblPickup").innerHTML != "") { alertify.confirm("This Item is not available for Delivery. Do you want to " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + " ?", function (e) { if (e) { OpenOrderTypePnl(document.getElementById("lblPickupname").innerHTML.replace("&", "&")); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Shipping == true && $("#lblShipping").text() != "") { alertify.confirm("This Item is not available for Delivery. Do you want Shipping ?", function (e) { if (e) { OpenOrderTypePnl("Shipping"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for Delivery"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } //If item has not shipping else if (OrderTypevalue == "Shipping" && msg.d[0].Shipping != true) { PnlConfrimation++; $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); if (msg.d[0].PickUp == true && document.getElementById("lblPickup").innerHTML != "") { alertify.confirm("This Item is not available for Shipping. Do you want to " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + " ?", function (e) { if (e) { OpenOrderTypePnl(document.getElementById("lblPickupname").innerHTML.replace("&", "&")); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Delivery == true && $("#Deliverytxt").text() != "") { alertify.confirm("This Item is not available for Shipping. Do you want Deliver ?", function (e) { if (e) { OpenOrderTypePnl("Delivery"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for Shipping"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } } if (PnlConfrimation == 0) { var k = 0; document.getElementById("lblMainCategoryId").innerHTML = msg.d[0].MainCategoryId; if (AddedItems != null) { for (var w = 0; w < AddedItems.length; w++) { if (AddedItems[w].MainCategoryId == msg.d[0].MainCategoryId) { k++; } } } //if (k == 0) { // $.ajax({ // type: "POST", // url: "Orders.aspx/DisplayTimings", // data: "{'CategoryId': '" + ItemId + "'}", // dataType: "json", // contentType: "application/json", // success: function (time) { // if (time.d != null && time.d != "") { // $("#lblordsucc").text(time.d); // $(".ordersuccess").show().delay(3000).fadeOut(); // } // } // }); //} if (msg.d[0].ItemFlow == true) { document.getElementById("lblitemflowtype").innerHTML = msg.d[0].ItemFlow; MenuItemOptionsLoad(msg, ItemId, OrderType); } else { OptionsLoad(msg, ItemId, OrderType); } } } if (PnlConfrimation == 0) { $.ajax({ type: "POST", url: "Orders.aspx/GetItemVariations", data: "{'ItemId': '" + ItemId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById('divVariations').innerHTML = ""; localStorage.removeItem("ItemVariation"); var Variations = new Array(); if (msg.d.length > 0) { var ddlVariation = document.createElement("select"); if (msg.d.length != 1) ddlVariation.options.add(new Option("Select Variation", "")); setAttributes(ddlVariation, { "style": "width: 200px;height: 25px;", "class": "ddlVariation", "id": "ddlVariation", "onchange": "gettotalprice()" }); for (var V = 0; V < msg.d.length; V++) { var Variation = new Object; Variation.Id = msg.d[V].Id; Variation.Name = msg.d[V].Name; Variation.Price = msg.d[V].Price.toFixed(2); Variations.push(Variation); ddlVariation.options.add(new Option(msg.d[V].Name + " " + document.getElementById("lblCurrency").innerHTML + msg.d[V].Price, msg.d[V].Id)); } localStorage.setItem("ItemVariation", JSON.stringify(Variations)); document.getElementById('divVariations').appendChild(ddlVariation); } if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { SelectOptionsforgrouporder(Item); } else { SelectOptions(); } } //gettotalprice(); } }); } else $(".addcategoryloadingimage2").fadeOut("fast"); } }); } else { var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberType; if (Details != null) { MemberType = Details.MemberType; } if (MemberType == "Member") { $(".deliveryvalidationpanel").fadeOut("slow"); //DisplayCartingrouporder(Item); } else { $(".deliveryvalidationpanel").fadeIn("slow"); } } } } } function OptionsLoad(msg, ItemId, OrderType) { $(".backtooptions").css("display", "none"); $("#btnmakeitcombo").css("display","none"); $("#itemflowcolumns").css("display", "none"); $("#PreviewOptionTable").css("display", "none"); $(".btncomboloaderdiv").css("display","none"); $("#ItemImageDisplay").css("display","block"); $(".ordqntymnlt").css("width","46%"); if ($("#lblMenuTheme").val() == "New-Grid" || $("#lblMenuTheme").val() == "New-Grid-no-images") { $("#lblitemmesg").css("display", "none"); $(".menuitemname").css("display", "block"); $(".lbldescriptiontitle").css("display", "block"); $("#ItemImageDisplay").addClass('removeshadow'); } else { $(".lbldescriptiontitle").css("display", "none"); $("#ItemImageDisplay").removeClass('removeshadow'); } var AppId = document.getElementById('lblAppId1').value; if (AppId == "db56d720-4a50-4356-9ee8-41f3e78cf49c" || AppId == "3b9b8dea-9ddf-42de-98af-279352efec24") { $("#btnaddtocart").val("Add to bag"); } else { $("#btnaddtocart").val("Add to cart"); } $("#btnaddtocart").attr("onclick", "ValidatingOptionsCheck();"); document.getElementById("lblitemflowtype").innerHTML = false; var UrlType = document.getElementById('lblurlnametype').innerHTML; $(".lblitemmesg").text(msg.d[0].OptionName); localStorage.setItem("ItemAvailability", msg.d[0].Availability); document.getElementById("lblMainCategoryId").innerHTML = msg.d[0].MainCategoryId; if (msg.d[0].RecipeExist == true) { $(".btnRecipe").fadeIn("fast"); $(".btnRecipe").attr("id", ItemId); } else{ $(".btnRecipe").fadeOut("fast"); } if (msg.d[0].DescriptionOn == true) { $(".lbldescription").fadeIn("fast"); } else{ $(".lbldescription").fadeOut("fast"); } if (msg.d[0].ItemImage != null) { $("#ItemImageDisplay").removeAttr("style"); $("#ItemImageDisplay").attr("src", msg.d[0].ItemImage); $("#ItemImageDisplay").attr("style", "display:block;"); $(".itemdescriptionstyles").attr("style", "min-height: 170px;"); GetMultipleItemImages(ItemId); } else { $("#ItemImageDisplay").attr("src", ""); $("#ItemImageDisplay").attr("style", "display:none;"); $(".itemdescriptionstyles").attr("style", ""); if (msg.d[0].RecipeExist == true) { GetMultipleItemImages(ItemId); } } if (msg.d[0].Type != null && msg.d[0].Type != "null" && msg.d[0].Type != "\n") { $(".lbldescription").text(msg.d[0].Type); } else { $(".lbldescription").text(""); } if (msg.d[0].VideoLinkURL != null && msg.d[0].VideoLinkURL != "null" && msg.d[0].VideoLinkURL != "") { if (msg.d[0].RecipeOn == true) {$("#btnVideoURL1").fadeIn("fast");} else{ $("#btnVideoURL1").fadeOut("fast");} $("#btnVideoURL1").attr("href", msg.d[0].VideoLinkURL); } else { $("#btnVideoURL1").fadeOut("fast"); } document.getElementById("PriceVal").innerHTML = msg.d[0].Price; if (msg.d[0].PriceType == "Fixed" || msg.d[0].PriceType == "null" || msg.d[0].PriceType == null || msg.d[0].PriceType == "") { document.getElementById("lblunit").innerHTML = ""; //document.getElementById("tdunitPrice").style.display = ""; //document.getElementById("lblunitprice").innerHTML = "Price per " + msg.d[0].UnitType + ":" + document.getElementById("lblCurrency").innerHTML + msg.d[0].Price; } else { document.getElementById("lblunit").innerHTML = msg.d[0].UnitType; // document.getElementById("tdunitPrice").style.display = "none"; } $(".fcontainer").css("display", "block"); localStorage.setItem("priceType", msg.d[0].PriceType); localStorage.setItem("UnitType", msg.d[0].UnitType); document.getElementById("lbldisplayItemPrice").innerHTML = document.getElementById("lblCurrency").innerHTML + (msg.d[0].Price).toFixed(2); document.getElementById("lblItemId").innerHTML = ItemId + "//" + msg.d[0].OptionName + "//" + msg.d[0].CloverOptionId + "//" + msg.d[0].PosId + ""; document.getElementById("lblItemNoTax").innerHTML = msg.d[0].NoSalesTax; document.getElementById("lblCustomTax").innerHTML = msg.d[0].CustomTax; document.getElementById("lblTaxLabel").innerHTML = escape(msg.d[0].TaxLabel); var s = 0; document.getElementById('OptionTable').innerHTML = ""; var Options = new Array(); if (msg.d[0].ShippingItems.length > 0) { var tableOption = document.createElement("table"); tableOption.setAttribute("class", "optionrow"); tableOption.setAttribute("style", optionColor); for (var i = 0; i < msg.d[0].ShippingItems.length; i++) { if (i == 0) { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "class": "optionname", "style": "color:" + OptionTextColor, "id": "option" + msg.d[0].ShippingItems[i].Id }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "class": "Choicetd", "align": "left" }); var lblChoice = document.createElement("label"); lblChoice.innerHTML += "Weights"; setAttributes(lblChoice, { "style": "font-weight:bold;font-size:14px;" }); tdChoice.appendChild(lblChoice); trChoice.appendChild(tdChoice); tableOption.appendChild(trChoice); } var trChoice = document.createElement("tr"); setAttributes(trChoice, { "class": "optionname", "style": "color:" + OptionTextColor, "id": "option" + msg.d[0].ShippingItems[i].Id }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "class": "Choicetd", "align": "left" }); var lblChoice = document.createElement("label"); lblChoice.innerHTML += " " + msg.d[0].ShippingItems[i].Weight; lblChoice.innerHTML += " " + msg.d[0].ShippingItems[i].Measurement; setAttributes(lblChoice, { "title": msg.d[0].ShippingItems[i].Weight, "for": msg.d[0].ShippingItems[i].Id, "style": "cursor:pointer;" }); var Price = 0; if (msg.d[0].ShippingItems[i].Price != Price.toFixed(2)) { lblChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + msg.d[0].ShippingItems[i].Price.toFixed(2) + ")"; } if (UrlType != "DineIn") { var radio = document.createElement("input"); setAttributes(radio, { "type": "radio", "Name": "Choiceradio" + msg.d[0].ShippingItems[i].ItemId, "value": msg.d[0].ShippingItems[i].Price.toFixed(2), "id": msg.d[0].ShippingItems[i].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); document.getElementById('OptionTable').style.display = ""; tdChoice.appendChild(radio); } else { if (document.getElementById("lblAllowcart").innerHTML == "true") { var radio = document.createElement("input"); setAttributes(radio, { "type": "radio", "Name": "Choiceradio" + msg.d[0].ShippingItems[i].ItemId, "value": msg.d[0].ShippingItems[i].Price.toFixed(2), "id": msg.d[0].ShippingItems[i].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); document.getElementById('OptionTable').style.display = ""; tdChoice.appendChild(radio); } } tdChoice.appendChild(lblChoice); trChoice.appendChild(tdChoice); tableOption.appendChild(trChoice); document.getElementById('OptionTable').appendChild(tableOption); } } for (var i = 1; i < msg.d.length; i++) { if(msg.d[i].Type != "Flow Buttons"){ document.getElementById('OptionTable').style.display = "block"; document.getElementById('PreviewOptionTable').style.display = "none"; var tableOption = document.createElement("table"); tableOption.setAttribute("class", "optionrow"); tableOption.setAttribute("style", optionColor); var trOption = document.createElement("tr"); trOption.setAttribute("style", "font-weight:bold;"); var tdOption = document.createElement("td"); setAttributes(tdOption, { "class": "Optiontd", "colspan": "3" }); var lblOption = document.createElement("span"); lblOption.innerHTML += msg.d[i].OptionName; lblOption.setAttribute("id", "ItemOption" + msg.d[i].OptionId); var lblrequired = document.createElement("span"); tdOption.appendChild(lblOption); tdOption.appendChild(lblrequired); if (msg.d[i].Type == "CheckBoxes") { if (msg.d[i].MaxSize > 0) { if (msg.d[i].MaxSize != 100 && msg.d[i].MaxSize != msg.d[i].Choice.length) { var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "padding-left:5px;color:red;font-size: 14px;display:none;" + OptionTextColor, "id": "ItemOptionSelection" + msg.d[i].OptionId }); lblOptionSelection.innerHTML += "(Max Selection: " + msg.d[i].MaxSize + ")"; tdOption.appendChild(lblOptionSelection); lblrequired.innerHTML = "<span style='float:right;color:Green;'>Optional</span>"; } } if (msg.d[i].MinSize > 0) { if (msg.d[i].MinSize != 100 ) { if (document.getElementById("choiceselect").innerHTML == "") { document.getElementById("choiceselect").innerHTML = msg.d[i].OptionId; } else { document.getElementById("choiceselect").innerHTML = document.getElementById("choiceselect").innerHTML + "," + msg.d[i].OptionId } var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "padding-left:5px;color:red;font-size: 14px;" + OptionTextColor, "id": "ItemOptionSelectionMin" + msg.d[i].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "(Min Selection: " + msg.d[i].MinSize + ")"; tdOption.appendChild(lblOptionSelection); lblrequired.innerHTML = "<span style='float:right;color:red;'>Required</span>"; } } if (UrlType != "DineIn") { if (msg.d[i].FreeOptions > 0) { var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "color:red;padding-left:5px;font-size: 14px;", "id": "ItemOptionSelectionMin" + msg.d[i].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "Select " + msg.d[i].OptionName + " with no cost(you have " + msg.d[i].FreeOptions + " free options)"; tdOption.appendChild(lblOptionSelection); } } else { if (document.getElementById("lblAllowcart").innerHTML == "true") { if (msg.d[i].FreeOptions > 0) { var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "color:red;padding-left:5px;font-size: 14px;", "id": "ItemOptionSelectionMin" + msg.d[i].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "Select " + msg.d[i].OptionName + " with no cost(you have " + msg.d[i].FreeOptions + " free options)"; tdOption.appendChild(lblOptionSelection); } } } } trOption.appendChild(tdOption); tableOption.appendChild(trOption); if (msg.d[i].OptionQuantity == true) { var trQuantity = document.createElement("tr"); trQuantity.setAttribute("style", "font-weight:bold;"); var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Optiontd", "colspan": "3", "style":"padding:0 25px;height:auto;border:none"}); var lblQuantity = document.createElement("span"); lblQuantity.setAttribute("style", "font-size:14px;color:red"); lblQuantity.innerHTML += "Please select " + msg.d[i].QuantitySelection + " by quantity"; tdQuantity.appendChild(lblQuantity); trQuantity.appendChild(tdQuantity); tableOption.appendChild(trQuantity); } var option = new Object; option.Type = msg.d[i].Type; option.ItemId = ItemId; option.Id = msg.d[i].OptionId; option.MinSize = msg.d[i].MinSize; option.MaxSize = msg.d[i].MaxSize; option.FreeOptions = msg.d[i].FreeOptions; option.Name = msg.d[i].OptionName; option.OptionQuantity = msg.d[i].OptionQuantity; option.QuantitySelection = msg.d[i].QuantitySelection; option.Chargable = msg.d[i].Chargable; option.Collapse = msg.d[i].Collapse; option.DefaultOptionText = msg.d[i].DefaultOptionText; option.PosId = msg.d[i].PosId; option.Choices = new Array(); if (msg.d[i].Type == "Radio Buttons" || msg.d[i].Type == "CheckBoxes") { if (msg.d[i].FreeOptions > 0) { msg.d[i].Choice.sort(function (a, b) { return parseFloat(a.Price) - parseFloat(b.Price); }); } var AddRow = ""; for (L = 0; L < msg.d[i].Choice.length; L++) { var Choice = new Object; Choice.Id = msg.d[i].Choice[L].Id; Choice.Name = msg.d[i].Choice[L].ChoiceName; Choice.Notify = msg.d[i].Choice[L].Notify; Choice.DefaultVSOption = msg.d[i].Choice[L].DefaultVSOption; Choice.Price = msg.d[i].Choice[L].Price.toFixed(2); Choice.Exist = msg.d[i].Choice[L].Exist; Choice.FreeOptions = "No"; Choice.SelectionCount = 0; option.Choices.push(Choice); var trChoice = document.createElement("tr"); setAttributes(trChoice, { "class": "optionname","style":"color:"+ OptionTextColor, "id": msg.d[i].OptionId }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "class": "Choicetd", "align": "left" }); var lblChoice = document.createElement("label"); lblChoice.innerHTML += msg.d[i].Choice[L].ChoiceName; setAttributes(lblChoice, { "title": msg.d[i].Choice[L].ChoiceName, "for": msg.d[i].Choice[L].Id, "style": "cursor:pointer;" }); var choicelabel = "<label titel='"+msg.d[i].Choice[L].ChoiceName+"' for='"+msg.d[i].Choice[L].Id+"' style='cursor:pointer'>"+msg.d[i].Choice[L].ChoiceName+"</label>"; if (UrlType == "DineIn") { if (document.getElementById("lblAllowcart").innerHTML == "true") { // setAttributes(lblChoice, { "style": "background:none;" }); } else { setAttributes(lblChoice, { "style": "background:none;" }); } } var Price = 0; if (msg.d[i].Choice[L].Price != Price.toFixed(2)) { lblChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + msg.d[i].Choice[L].Price.toFixed(2) + ")"; choicelabel += "<label>"+document.getElementById("lblCurrency").innerHTML + msg.d[i].Choice[L].Price.toFixed(2)+"</label>"; } if (msg.d[i].Type == "Radio Buttons") { lblrequired.innerHTML ="<span style='float:right;color:red;'>Required</span>"; var radio = document.createElement("input"); if (msg.d[i].Choice[L].DefaultVSOption == true) { setAttributes(radio, { "type": "radio","class":"optionscheckedwithoutoptflow" ,"checked": "true","Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[L].Price.toFixed(2), "id": msg.d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(radio, { "type": "radio","class":"optionscheckedwithoutoptflow" , "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[L].Price.toFixed(2), "id": msg.d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } tdChoice.appendChild(radio); } if (msg.d[i].Type == "CheckBoxes") { if (lblrequired.innerHTML.indexOf("Required") != -1) { } else lblrequired.innerHTML ="<span style='float:right;color:green;'>Optional</span>"; var checkbox = document.createElement("input"); if (msg.d[i].Choice[L].DefaultVSOption == true) { setAttributes(checkbox, { "type": "checkbox","class":"optionscheckedwithoutoptflow" ,"checked": "true", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[L].Price.toFixed(2), "id": msg.d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(checkbox, { "type": "checkbox","class":"optionscheckedwithoutoptflow" , "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[L].Price.toFixed(2), "id": msg.d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } //optionsdiv += "<div><input type='checkbox' Name='Choiceradio" + msg.d[i].OptionId + "' value='" + msg.d[i].Choice[L].Price.toFixed(2) + "' id='" + msg.d[i].Choice[L].Id + "' "; if (msg.d[i].MaxSize > 0) { checkbox.setAttribute("onclick", "LimitOptionsSelection(this);"); } tdChoice.appendChild(checkbox); } if (msg.d[i].Type == "Radio Buttons" || msg.d[i].Type == "CheckBoxes") { if (msg.d[i].Choice[L].ChoiceImageURL != null && msg.d[i].Choice[L].ChoiceImageURL != "") { var lblChoiceimg = document.createElement("label"); setAttributes(lblChoiceimg, { "class": "Choicetdimg","title": msg.d[i].Choice[L].ChoiceName, "for": msg.d[i].Choice[L].Id, "style": "cursor:pointer;" }); lblChoiceimg.innerHTML = "<img class='choiceimage', alt='Choice Image', id='Choiceimg" + msg.d[i].Choice[L].Id + "', title='" + msg.d[i].Choice[L].ChoiceImageURL + "' , src='" + msg.d[i].Choice[L].ChoiceImageURL + "' />"; setAttributes(lblChoice, { "style": "float:left" }); tdChoice.appendChild(lblChoiceimg); } } tdChoice.appendChild(lblChoice); trChoice.appendChild(tdChoice); if (UrlType != "DineIn") { if (msg.d[i].OptionQuantity == true) { var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Choicetd", "align": "left" }); var txtQuantity = document.createElement("input"); setAttributes(txtQuantity, { "id": "Quantity" + msg.d[i].Choice[L].Id, "type": "text", "class": "ChoicesQuantity", "disabled": "disabled", "onchange": "gettotalprice()","MaxLength":"4"}); tdQuantity.appendChild(txtQuantity); trChoice.appendChild(tdQuantity); } if (msg.d[i].ChoicesQuantity == true) { if (msg.d[i].ChoicesSelection > 0) { var tdddlQuantity = document.createElement("td"); setAttributes(tdddlQuantity, { "class": "Choicetd", "align": "left" }); var ddlQuantity = document.createElement("select"); setAttributes(ddlQuantity, { "id": "ddlQuantity" + msg.d[i].Choice[L].Id, "style": "display:none;", "class": "ChoicesQuantity", "onchange": "gettotalprice()","MaxLength":"4" }); for (var Q = 1; Q <= msg.d[i].ChoicesSelection; Q++) { ddlQuantity.options.add(new Option(Q, Q)); } tdddlQuantity.appendChild(ddlQuantity); trChoice.appendChild(tdddlQuantity); } } } else { if (document.getElementById("lblAllowcart").innerHTML == "true") { if (msg.d[i].OptionQuantity == true) { var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Choicetd", "align": "left" }); var txtQuantity = document.createElement("input"); setAttributes(txtQuantity, { "id": "Quantity" + msg.d[i].Choice[L].Id, "type": "text", "class": "ChoicesQuantity", "disabled": "disabled", "onchange": "gettotalprice()", "MaxLength": "4" }); tdQuantity.appendChild(txtQuantity); trChoice.appendChild(tdQuantity); } if (msg.d[i].ChoicesQuantity == true) { if (msg.d[i].ChoicesSelection > 0) { var tdddlQuantity = document.createElement("td"); setAttributes(tdddlQuantity, { "class": "Choicetd", "align": "left" }); var ddlQuantity = document.createElement("select"); setAttributes(ddlQuantity, { "id": "ddlQuantity" + msg.d[i].Choice[L].Id, "style": "display:none;", "class": "ChoicesQuantity", "onchange": "gettotalprice()", "MaxLength": "4" }); for (var Q = 1; Q <= msg.d[i].ChoicesSelection; Q++) { ddlQuantity.options.add(new Option(Q, Q)); } tdddlQuantity.appendChild(ddlQuantity); trChoice.appendChild(tdddlQuantity); } } } } if (UrlType != "DineIn") { if (msg.d[i].FreeOptions > 0) { if (AddRow == "" && Choice.Price > 0) { var trChoiceFreeOptions = document.createElement("tr"); var tdChoiceFreeOptions = document.createElement("td"); var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "color:red;padding-left:5px;font-weight: bold;font-size: 14px;", "id": "ItemOptionSelectionMin" + msg.d[i].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "Select " + msg.d[i].OptionName + " for additional pricing"; tdChoiceFreeOptions.appendChild(lblOptionSelection); trChoiceFreeOptions.appendChild(tdChoiceFreeOptions); tableOption.appendChild(trChoiceFreeOptions); AddRow = "Exist"; } } } else { if (document.getElementById("lblAllowcart").innerHTML == "true") { if (msg.d[i].FreeOptions > 0) { if (AddRow == "" && Choice.Price > 0) { var trChoiceFreeOptions = document.createElement("tr"); var tdChoiceFreeOptions = document.createElement("td"); var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "color:red;padding-left:5px;font-weight: bold;font-size: 14px;", "id": "ItemOptionSelectionMin" + msg.d[i].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "Select " + msg.d[i].OptionName + " for additional pricing"; tdChoiceFreeOptions.appendChild(lblOptionSelection); trChoiceFreeOptions.appendChild(tdChoiceFreeOptions); tableOption.appendChild(trChoiceFreeOptions); AddRow = "Exist"; } } } } tableOption.appendChild(trChoice); if (msg.d[i].Choice[L].Exist == true) { var childExist = document.createElement("img"); setAttributes(childExist, { "src": "images/childExpand.png", "style": "width: 15px;vertical-align: top; margin-left: 4px;", "alt": "Expand" }); lblChoice.appendChild(childExist); var childExisttr = document.createElement("tr"); setAttributes(childExisttr, { "id": "childOption" + msg.d[i].Choice[L].Id }); tableOption.appendChild(childExisttr); } } Options.push(option); } else if (msg.d[i].Type == "Dropdown") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var ddlOption = document.createElement("select"); //ddlOption.options.add(new Option("Select One", "")); setAttributes(ddlOption, { "style": "width: auto;height: 25px;margin-top:10px;max-width:60%", "id": msg.d[i].OptionId, "class": "ddlOption Validate", "onchange": "gettotalprice()" }); for (var S = 0; S < msg.d[i].Choice.length; S++) { var Choice = new Object; Choice.Id = msg.d[i].Choice[S].Id; Choice.Name = msg.d[i].Choice[S].ChoiceName; Choice.Notify = msg.d[i].Choice[S].Notify; Choice.DefaultVSOption = msg.d[i].Choice[S].DefaultVSOption; Choice.Price = msg.d[i].Choice[S].Price.toFixed(2); Choice.Exist = msg.d[i].Choice[S].Exist; option.Choices.push(Choice); ddlOption.options.add(new Option(msg.d[i].Choice[S].ChoiceName + " " + document.getElementById("lblCurrency").innerHTML + msg.d[i].Choice[S].Price, msg.d[i].Choice[S].Id)); } tdChoice.appendChild(ddlOption); trChoice.appendChild(tdChoice); tableOption.appendChild(trChoice); Options.push(option); if (msg.d[i].Choice.length > 0) { lblrequired.innerHTML +="<span style='float:right;color:red;'>Required</span>"; } } if (UrlType != "DineIn") { if (msg.d[i].Type == "Multiline Textbox") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var textbox = document.createElement("textarea"); setAttributes(textbox, { "class": "Choicetext", "id": msg.d[i].OptionId }); tdChoice.appendChild(textbox); trChoice.appendChild(tdChoice); tableOption.appendChild(trChoice); Options.push(option); } } else { if (document.getElementById("lblAllowcart").innerHTML == "true") { if (msg.d[i].Type == "Multiline Textbox") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var textbox = document.createElement("textarea"); setAttributes(textbox, { "class": "Choicetext", "id": msg.d[i].OptionId }); tdChoice.appendChild(textbox); trChoice.appendChild(tdChoice); tableOption.appendChild(trChoice); Options.push(option); } } } document.getElementById('OptionTable').appendChild(tableOption); //$(".optionscheckedwithoutoptflow").each(function () { // if($(".optionscheckedwithoutoptflow").length > 0) // { // if($(this).attr("checked")) // { // var itemlist = $(this); // LimitOptionsSelection(itemlist[0]); // } // } // }); } } FreeOptionCount = 1; localStorage.setItem("OptionCheck", JSON.stringify(Options)); if (document.getElementById("lblItemType").innerHTML == "AddItem") { if (document.getElementById("lblBogoItemId").innerHTML != "") { document.getElementById('txtquantity').value = document.getElementById("lblBogoOfferQ").innerHTML; document.getElementById("lbldisplayItemPrice").innerHTML = document.getElementById("lblCurrency").innerHTML + (parseFloat(document.getElementById("PriceVal").innerHTML) * parseFloat(document.getElementById("lblBogoOfferQ").innerHTML)).toFixed(2); } else { document.getElementById('txtquantity').value = "1"; document.getElementById('txtunitquantity').value = "1"; } if (UrlType == "DineIn") { var rowCount = $('#OptionTable tr').length; if (document.getElementById('OptionTable').innerHTML != "") { $("body").addClass("fullpanel"); if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "none"); $(".fcontainer").css("display", "none"); $(".Ordersmain").css("display", "none"); $(".orderdivr").css("display", "none"); $(".griditemsmodal").css("background-color", "white"); $(".griditemscroll").css("width", "100%"); $(".grditemspanel").fadeIn("slow"); $(".itemimageshow").css("width", "100%"); $(".itemimageshow").css("height", "320px"); $(".itemimageshow").css("object-fit", "cover"); $("#txtinstructions").css("margin-bottom", "100px;"); $(".txtinstructions").addClass("txtinstructionscs"); $("#lblitemmesg").css("display", "none"); $(".itemmain").css("display", "none"); $(".itemnamecs").css("display", "block"); $(".closeitemdiv").css("display", "block"); } else { $(".grditemspanel").fadeIn("slow"); } } else { $(".grditemspanel").fadeIn("slow"); } $(".btnloaderdiv").css("display", "none"); if (document.getElementById("lblAllowcart").innerHTML == "true") { $(".addtocartdiv").css("display", "block"); } else { $(".addtocartdiv").css("display", "none"); } //$(".grditemspanel").fadeIn("slow", function () { // $("body").addClass("fullpanel"); //}); } else { if (document.getElementById("lblAllowcart").innerHTML == "true") { $(".addtocartdiv").css("display", "block"); } else { $(".addtocartdiv").css("display", "none"); } $("body").addClass("fullpanel"); if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "none"); $(".fcontainer").css("display", "none"); $(".Ordersmain").css("display", "none"); $(".orderdivr").css("display", "none"); $(".griditemsmodal").css("background-color", "white"); $(".griditemscroll").css("width", "100%"); $(".grditemspanel").fadeIn("slow"); $(".itemimageshow").css("width", "100%"); $(".itemimageshow").css("height", "320px"); $(".itemimageshow").css("object-fit", "cover"); $("#txtinstructions").css("margin-bottom", "100px;"); $(".txtinstructions").addClass("txtinstructionscs"); $("#lblitemmesg").css("display", "none"); $(".itemmain").css("display", "none"); $(".itemnamecs").css("display", "block"); $(".closeitemdiv").css("display", "block"); } else { $(".grditemspanel").fadeIn("slow"); } } else { $(".grditemspanel").fadeIn("slow"); } $(".btnloaderdiv").css("display", "none"); //} //else //{ //alert("Item haven't any options"); //} } } else { $("body").addClass("fullpanel"); if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "none"); $(".fcontainer").css("display", "none"); $(".Ordersmain").css("display", "none"); $(".orderdivr").css("display", "none"); $(".griditemsmodal").css("background-color", "white"); $(".griditemscroll").css("width", "100%"); $(".grditemspanel").fadeIn("slow"); $(".itemimageshow").css("width", "100%"); $(".itemimageshow").css("height", "320px"); $(".itemimageshow").css("object-fit", "cover"); $("#txtinstructions").css("margin-bottom", "100px;"); $(".txtinstructions").addClass("txtinstructionscs"); $("#lblitemmesg").css("display", "none"); $(".itemmain").css("display", "none"); $(".itemnamecs").css("display", "block"); $(".closeitemdiv").css("display", "block"); } else { $(".grditemspanel").fadeIn("slow"); } } else { $(".grditemspanel").fadeIn("slow"); } $(".btnloaderdiv").css("display", "none"); $(".addtocartdiv").css("display", "block"); } $(".addcategoryloadingimage1").css("display", "none"); } else if (document.getElementById("lblItemType").innerHTML == "EditItem") { document.getElementById('txtquantity').value = "1"; $(".addcategoryloadingimage1").css("display", "none"); $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage2").css("display", "none"); } $("#" + ItemId).css("opacity", "1"); gettotalprice(); if (document.getElementById("itemflowqty").innerHTML != "") { var Itempriceqty = "<img id='removeButton' alt = 'Remove' src = 'https://www.munchem.com/images/removeQuantity.png' onclick = 'RemoveQuantity()' style = 'float:left;cursor:pointer' class='Qutyimage' /> <input type='text' id='txtquantity' class='negativeqnty txtcount' readonly='readonly' value='" + document.getElementById('txtquantity').value + "' /> <img id='addButton' alt='Add' src='https://www.munchem.com/images/addQuantity.png' onclick='AddQuantity()' style='cursor:pointer' class='Qutyimage' />"; document.getElementById("tditempriceqty").innerHTML = Itempriceqty; document.getElementById('lbldisplayItemPrice').style.display = "block"; document.getElementById('tdordqntymnlt').style.display = "block"; document.getElementById("itemflowqty").innerHTML = ""; $(".qntysty").css("margin-top", "0"); } $(".qntysty").css("margin-top", "0"); if (document.getElementById('lblMenuoptions').value == "Column2") { $(".optionname").addClass("Menuoptionname"); } } function OrderHours() { GetCommonTime(); } function AddCrossSellItemtoCart(input) { var ItemId = input.id; $.ajax({ type: "POST", url: "Orders.aspx/GetItemDetails", data: "{'ItemId': '" + ItemId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var Item = new Object(); Item.ItemName = escape(msg.d[0].OptionName); Item.Id = ItemId; document.getElementById("lblItemNoTax").innerHTML = msg.d[0].NoSalesTax; Item.NoSalesTax = document.getElementById("lblItemNoTax").innerHTML; Item.CustomTax = msg.d[0].CustomTax; Item.TaxLabel = escape(msg.d[0].TaxLabel); Item.Instructions = ""; Item.Quantity = "1"; Item.Price = msg.d[0].Price; var OrderType = localStorage.getItem("OrderType"); Item.OrderType = OrderType; Item.LId = document.getElementById('lblLId').value; Item.AppName = escape(document.getElementById('lblAppName').innerHTML); document.getElementById('txtinstructions').value = ""; Item.Choices = new Array(); Item.Variations = new Array(); Item.AddedDate = new Date(); var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { var allItems = AddedItems.concat(Item); localStorage.setItem("TotalItems", JSON.stringify(allItems)); } else { var Items = new Array(); Items.push(Item); localStorage.setItem("TotalItems", JSON.stringify(Items)); } } else { var Items = new Array(); Items.push(Item); localStorage.setItem("TotalItems", JSON.stringify(Items)); } var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } } } }); } function slideright(l) { var btn = $("#right-button").attr("src"); if (btn == "images/bluebackarrow.png") { var view = $("#tslshow"); var move = $(".proitemdiv").width() + 10; var sliderLimit = -l; var currentPosition = parseInt(view.css("left")); if (currentPosition <= -170) { test--; if (currentPosition > 0 || currentPosition == -170) { $("#right-button").attr("src", "images/backarrow.png"); $("#right-button").attr("alt", "Back Arrow"); $("#right-button").css("display", "none"); } view.stop(false, true).animate({ left: "+=" + move }, { duration: 100 }) $("#left-button").css("display", "block"); $("#left-button").attr("src", "images/bluenextarrow.png"); $("#left-button").attr("alt", "Next Arrow"); } else { $("#right-button").attr("src", "images/backarrow.png"); $("#right-button").attr("alt", "Back Arrow"); $("#right-button").css("display", "none"); } } $("#right-button").css("display", "block"); } function slideleft(l) { var btn = $("#left-button").attr("src"); if (btn == "images/bluenextarrow.png") { $("#right-button").css("display", "block"); var view = $("#tslshow"); var move = $(".proitemdiv").width() + 10; var sliderLimit = -l; var currentPosition = parseInt(view.css("left")); var Count = $(".proitemdiv").length; if (Count > 50) { if (window.innerWidth < 480) { Count = Count - 1; } else if (window.innerWidth < 767) { Count = Count - 2; } else { Count = Count - 3; } } else { if (window.innerWidth < 480) { Count = Count - 1; } else if (window.innerWidth < 767) { Count = Count - 2; } else { Count = Count - 3; } } if (currentPosition >= sliderLimit) { test++; view.stop(false, true).animate({ left: "-=" + move }, { duration: 100 }) if (test < Count) { $("#right-button").attr("src", "images/bluebackarrow.png"); $("#right-button").attr("alt", "Back Arrow"); } else { $("#left-button").attr("src", "images/nextarrow.png"); $("#left-button").attr("alt", "Next Arrow"); $("#right-button").attr("src", "images/bluebackarrow.png"); $("#right-button").attr("alt", "Back Arrow"); } } else $("#left-button").attr("src", "images/nextarrow.png"); $("#left-button").attr("alt", "Next Arrow"); } $("#right-button").css("display", "block"); } var CrossSellPanelStatus = "";var test = 0; function LoadCrossSellItems() { document.getElementById("lblbuyitemname").innerHTML = ""; document.getElementById("lblgetitemname").innerHTML = ""; document.getElementById("lblBogoItemId").innerHTML=""; var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; GetCardSettings(); if (GroupId != null && GroupId != "" && GroupId != undefined) { $(".checkbtndiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "none"); } $(".checkoutloaderdiv").css("display", "inline-block"); FinishOrderValidationinGroupOrder(); } else { $(".checkbtndiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "none"); } $(".checkoutloaderdiv").css("display", "inline-block"); var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["demo"]; var LocationId = document.getElementById('lblLId').value; if (CustomWebsites == "demo") { FinishOrderValidation(); } else { CrossSellPanelStatus = $("#CrossSellPanelStatus").text(); var Locationid = document.getElementById('lblLId').value; var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { if (AddedItems.length > 0) { var LocalId = AddedItems[0].LId; if (Locationid == LocalId) { if (CrossSellPanelStatus == "") { document.getElementById("crosssellitems").innerHTML = ""; var CategoryIds = ""; if (AddedItems != null) { if (AddedItems.length > 0) { for (var c = 0; c < AddedItems.length; c++) { if (CategoryIds == "") CategoryIds = AddedItems[c].MainCategoryId + ","; else CategoryIds += AddedItems[c].MainCategoryId + ","; } CategoryIds = CategoryIds.slice(0, CategoryIds.lastIndexOf(",")); } } $.ajax({ type: "POST", url: "Orders.aspx/CrosssellItems", data: "{'CategoryIds': '" + CategoryIds + "','LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { $("#crosssellitems").removeAttr("style"); var maindiv = ""; var name = ""; test = 0; var widthcrosssell = 1; for (var i = 0; i < msg.d.length; i++) { widthcrosssell = widthcrosssell + msg.d[i].crossSellItem.length; if (name.indexOf(msg.d[i].Name + ",") >= 0) { } else { name += msg.d[i].Name + ","; } } var namelist = name.replace(/,$/g, ''); $("#divitems").css("display", "none"); var itemnamelist = namelist.replace("null","").replace(",null","").replace("null,",""); document.getElementById('lbltaxname').innerHTML = itemnamelist; var width1 = (widthcrosssell * 250); maindiv += "<div class='horizon-prev horizon-prev1'><img id='right-button' class='right-button' src='images/bluebackarrow.png' alt='pre' onclick='slideright(" + width1 + ")' style='display:none'></div>"; maindiv += "<div id='viewContainer2'><div class='tslshow2' id='tslshow' style='min-width:" + width1 + "px'>"; for (var C = 0; C < msg.d.length; C++) { for (var i = 0; i < msg.d[C].crossSellItem.length; i++) { maindiv += "<div class='proitemdiv'>"; if (msg.d[C].crossSellItem[i].ImageUrl != null && msg.d[C].crossSellItem[i].ImageUrl != "") maindiv += "<div style='text-align:center'><img class='imgscroll' src='" + msg.d[C].crossSellItem[i].ImageUrl + "' /></div>"; else maindiv += "<div style='text-align:center' class='imgscroll'></div>"; var price = msg.d[C].crossSellItem[i].Price; price = price.toFixed(2); maindiv += "<div id='lblitemname' class='itemname'>" + msg.d[C].crossSellItem[i].Name + "</div>"; maindiv += "<div class='itempri' id='lblitemprice'>" + document.getElementById("lblCurrency").innerHTML + price + "</div>"; maindiv += "<div class='addbutton' id='" + msg.d[C].crossSellItem[i].CategoryId + "'><input class='additem additembtn' style='"+ButtonColor+"' type='button' value='Add Item' id='" + msg.d[C].crossSellItem[i].ItemId + "' onclick='GetItemOptions(this);' /></div>"; maindiv += "<div style='display:none;'><label id='qty" + msg.d[C].crossSellItem[i].ItemId + "'>50</label><span> Items left</span></div>"; maindiv += "</div>"; } } maindiv += "</div></div>"; if (width1 > 550) maindiv += "<div class='horizon-next horizon-next1'><img id='left-button' class='left-button' style='cursor:pointer;width: 20%;' src='images/bluenextarrow.png' alt='Next arrow' onclick='slideleft(" + width1 + ")' /></div>"; else maindiv += "<div class='horizon-next horizon-next1'><img id='left-button' class='left-button' style='cursor:pointer;width: 20%;display:none' src='images/nextarrow.png' alt='pre' /></div>" document.getElementById("crosssellitems").innerHTML = maindiv; document.getElementById('GetCrossSellPanelStatus').innerHTML = "Trigger-InActive"; if (window.innerWidth > 767) $(".crosssellitemspanelopen").css("margin-top", $(document).scrollTop() - 100); CrossSellPanelStatus = $("#CrossSellPanelStatus").text(); if (CrossSellPanelStatus != "Closed") { $("#crosssellitemspanel").fadeIn("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } else { FinishOrderValidation(); } CrossSellPanelStatus = "Opened"; document.getElementById('CrossSellPanelStatus').innerHTML = "Opened"; } else { FinishOrderValidation(); } } }); } else { document.getElementById("crosssellitems").innerHTML = ""; var CategoryIds = ""; var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { if (AddedItems.length > 0) { for (var c = 0; c < AddedItems.length; c++) { if (CategoryIds == "") CategoryIds = AddedItems[c].MainCategoryId + ","; else CategoryIds += AddedItems[c].MainCategoryId + ","; } CategoryIds = CategoryIds.slice(0, CategoryIds.lastIndexOf(",")); } } $.ajax({ type: "POST", url: "Orders.aspx/MultipleCrosssellItems", data: "{'CategoryIds': '" + CategoryIds + "','LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { $("#crosssellitems").removeAttr("style"); var maindiv = ""; var name = ""; test = 0; var widthcrosssell = 1; for (var i = 0; i < msg.d.length; i++) { widthcrosssell = widthcrosssell + msg.d[i].crossSellItem.length; if (name.indexOf(msg.d[i].Name + ",") >= 0) { } else { name += msg.d[i].Name + ","; } } var namelist = name.replace(/,$/g, ''); $("#divitems").css("display", "none"); var itemnamelist = namelist.replace("null","").replace(",null","").replace("null,",""); document.getElementById('lbltaxname').innerHTML = itemnamelist; var width1 = (widthcrosssell * 250); maindiv += "<div class='horizon-prev horizon-prev1'><img id='right-button' class='right-button' src='images/bluebackarrow.png' alt='pre' onclick='slideright(" + width1 + ")' style='display:none'></div>"; maindiv += "<div id='viewContainer2'><div class='tslshow2' id='tslshow' style='min-width:" + width1 + "px'>"; for (var C = 0; C < msg.d.length; C++) { for (var i = 0; i < msg.d[C].crossSellItem.length; i++) { maindiv += "<div class='proitemdiv'>"; if (msg.d[C].crossSellItem[i].ImageUrl != null && msg.d[C].crossSellItem[i].ImageUrl != "") maindiv += "<div style='text-align:center'><img class='imgscroll' src='" + msg.d[C].crossSellItem[i].ImageUrl + "' /></div>"; else maindiv += "<div style='text-align:center' class='imgscroll'></div>"; var price = msg.d[C].crossSellItem[i].Price; price = price.toFixed(2); maindiv += "<div id='lblitemname' class='itemname'>" + msg.d[C].crossSellItem[i].Name + "</div>"; maindiv += "<div class='itempri' id='lblitemprice'>" + document.getElementById("lblCurrency").innerHTML + price + "</div>"; maindiv += "<div class='addbutton' id='" + msg.d[C].crossSellItem[i].CategoryId + "'><input class='additem additembtn' style='" + ButtonColor + "' type='button' value='Add Item' id='" + msg.d[C].crossSellItem[i].ItemId + "' onclick='GetItemOptions(this);' /></div>"; maindiv += "<div style='display:none;'><label id='qty" + msg.d[C].crossSellItem[i].ItemId + "'>50</label><span> Items left</span></div>"; maindiv += "</div>"; } } maindiv += "</div></div>"; if (width1 > 550) maindiv += "<div class='horizon-next horizon-next1'><img id='left-button' class='left-button' style='cursor:pointer;width: 20%;' src='images/bluenextarrow.png' alt='Next arrow' onclick='slideleft(" + width1 + ")' /></div>"; else maindiv += "<div class='horizon-next horizon-next1'><img id='left-button' class='left-button' style='cursor:pointer;width: 20%;display:none' src='images/nextarrow.png' alt='pre' /></div>" document.getElementById("crosssellitems").innerHTML = maindiv; //if (window.innerWidth > 767) // $(".crosssellitemspanelopen").css("margin-top", $(document).scrollTop() - 100); //CrossSellPanelStatus = $("#CrossSellPanelStatus").text(); // if (CrossSellPanelStatus != "Closed") { // $("#crosssellitemspanel").fadeIn("slow"); //} // else { FinishOrderValidation(); } // CrossSellPanelStatus = "Opened"; document.getElementById('GetCrossSellPanelStatus').innerHTML = "Trigger-InActive"; if (window.innerWidth > 767) $(".crosssellitemspanelopen").css("margin-top", $(document).scrollTop() - 100); CrossSellPanelStatus = $("#CrossSellPanelStatus").text(); if (CrossSellPanelStatus != "Closed") { $("#crosssellitemspanel").fadeIn("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } else { FinishOrderValidation(); } CrossSellPanelStatus = "Opened"; document.getElementById('CrossSellPanelStatus').innerHTML = "Opened"; } else { FinishOrderValidation(); } } }); // FinishOrderValidation(); } } else { $("#lblordalert").text("Something went wrong. please refresh the page and try to make an order"); $(".orderalert").fadeIn(); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } } } } } } function GetItemOptions(Item) { var Screenid = 1; localStorage.setItem("ScreenId", Screenid); localStorage.removeItem("CheckedOptions"); $("#displayMultipleImages").css("display","none"); document.getElementById("displayMultipleImages").innerHTML = ""; // UserMuncheiscount(); test = 0; $(".crosssellitemspanel").fadeOut("slow"); document.getElementById('crosssellitemspanel').style.display = "none"; var UrlType = document.getElementById('lblurlnametype').innerHTML; if (UrlType == "DineIn") { CallItemOptions(Item); } else { var ItemId = $(Item).attr("id"); var ItemAvailableQuantity = 0; if (document.getElementById("qty" + ItemId) != null) { ItemAvailableQuantity = document.getElementById("qty" + ItemId).innerHTML; } if (ItemAvailableQuantity == "NoQuantity" || ItemAvailableQuantity == "") { } else { var AddedCount = 0; var ItemsData = localStorage.getItem("TotalItems"); var CheckItems = JSON.parse(ItemsData); if (CheckItems != null) { if (CheckItems.length > 0) { for (var i = 0; i < CheckItems.length; i++) { if (CheckItems[i].Id == ItemId) { AddedCount = Number(AddedCount) + Number(CheckItems[i].Quantity); } } } } if (ItemAvailableQuantity <= AddedCount) { $("#lblorderror").text("Max stock of items added in your cart"); $(".ordererror").show().delay(3000).fadeOut(); } } var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); var retrievedData = localStorage.getItem("Page"); var Page = JSON.parse(retrievedData); if (Page != null) { if (Page.length > 0) { if (Page.toLowerCase() != sPage.toLowerCase()) { var ItemsData = localStorage.getItem("TotalItems"); var CheckItems = JSON.parse(ItemsData); if (CheckItems != null) { if (CheckItems.length > 0) { if(document.getElementById('lblAppName').innerHTML != unescape(CheckItems[0].AppName)){ alertify.set({ labels: { cancel: "Cancel", ok: "Ok" } }); alertify.confirm("Leaving " + unescape(CheckItems[0].AppName) + " will clear your cart. Are you sure you want to leave?", function (e) { if (e) { ClearLocalStorage(); window.location.href = sPath; } else window.location.href = sPath.replace(sPage, Page); }); } else CallItemOptions(Item); } else CallItemOptions(Item); } else CallItemOptions(Item); } else CallItemOptions(Item); } else CallItemOptions(Item); } else CallItemOptions(Item); } } function CallItemOptions(Item) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; document.getElementById("lblscroll").innerHTML = $(document).scrollTop(); document.getElementById("radiotext").value = ""; var ItemId = $(Item).attr("id"); document.getElementById("lblItemId").innerHTML = ItemId; document.getElementById("lbldeliveryItemId").innerHTML = ItemId; //start Item Nutritions calling $(".nutritiontable1").fadeOut("fast"); $(".nutritiontable").fadeOut("fast"); var p = 0; var ItemQuantity = document.getElementById("qty" + ItemId).innerHTML; if (ItemQuantity == "NoQuantity") { p = 1; } else { var AddedQuantity = 0; var ItemsData = localStorage.getItem("TotalItems"); var CheckItems = JSON.parse(ItemsData); if (CheckItems != null) { if (CheckItems.length > 0) { for (var i = 0; i < CheckItems.length; i++) { if (CheckItems[i].Id == ItemId) { if (AddedQuantity == 0) { AddedQuantity = Number(CheckItems[i].Quantity); } else { AddedQuantity = Number(AddedQuantity) + Number(CheckItems[i].Quantity); } } } if (AddedQuantity > 0) { if (AddedQuantity < ItemQuantity) { p = 1; } } else { p = 1; } } else { p = 1; } } else { p = 1; } } if (p == 1) { Ninvisible(); GetItemNutrition(ItemId); // LoadCrossSellItems(ItemId); //End Item Nutritions calling document.getElementById("lblItemType").innerHTML = "AddItem"; LoadImage(ItemId); var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != null) { if (retrievedData.length > 0) { document.getElementById('checkdelivery').innerHTML = "Sucess"; if (GroupId != null && GroupId != "" && GroupId != undefined) { LoadItemOptionsinGroupOrder(Item); } else { LoadItemOptions(Item); } } else CheckOrderTypePanelOPen(); } else // its use full for every time not showing delivery validation panel if (document.getElementById('checkdelivery').innerHTML != "Sucess") CheckOrderTypePanelOPen(); else { if (GroupId != null && GroupId != "" && GroupId != undefined) { LoadItemOptionsinGroupOrder(Item); } else { LoadItemOptions(Item); } } } else { $("#lblorderror").text("Item stock limit exceded"); $(".ordererror").show().delay(3000).fadeOut(); } } function CheckOrderTypePanelOPen() { var Sucess = document.getElementById('checkdelivery').innerHTML; var deliveryCheck = document.getElementById('deliveryavailabul').innerHTML; var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (deliveryCheck == "Yes") { if (Sucess != "Sucess") { if (("#tblCart").Length > 0) { //$(".grditemspanel").fadeIn("slow"); } else { OpenOrderTypePnl(""); //return; } } if (GroupId != null && GroupId != "" && GroupId != undefined) { //LoadItemOptionsinGroupOrder(); } else { LoadItemOptions(); } } else { if (document.getElementById("AdvancedOption").innerHTML == "" && $("#Pickuptext").text() != "") { document.getElementById('checkdelivery').innerHTML = "Sucess"; if (document.getElementById('rbtpickup') != null) document.getElementById('rbtpickup').checked = true; if (GroupId != null && GroupId != "" && GroupId != undefined) { LoadItemOptionsinGroupOrder(); } else { LoadItemOptions(); } } else { OpenOrderTypePnl(""); } } } function BindStoredDeliveryAddress() { var HomeSearchedAddress = ''; if (HomeSearchedAddress != "") { document.getElementById('txtaddress').value = HomeSearchedAddress.split('/')[0]; document.getElementById('txtvalidationcity').value = HomeSearchedAddress.split('/')[1]; document.getElementById('txtvalidationstate').value = HomeSearchedAddress.split('/')[2]; document.getElementById('txtvalidationzip').value = HomeSearchedAddress.split('/')[3]; document.getElementById("txtline1").value = HomeSearchedAddress.split('/')[0]; document.getElementById("txtcity").value = HomeSearchedAddress.split('/')[1]; document.getElementById("txtstate").value = HomeSearchedAddress.split('/')[2]; document.getElementById("txtZip").value = HomeSearchedAddress.split('/')[3]; } var PreviousData1 = localStorage.getItem("CheckedDeliveryAddress"); var Table1 = JSON.parse(PreviousData1); if (Table1 != null) { if (Table1.length > 0) { document.getElementById('txtaddress').value = Table1[0].Line1; document.getElementById('txtvalidationcity').value = Table1[0].City; document.getElementById('txtvalidationstate').value = Table1[0].State; document.getElementById('txtvalidationzip').value = Table1[0].Zip; if (Table1[0].DoorNo != undefined) { document.getElementById('txtDoorNO').value = Table1[0].DoorNo; } if (Table1[0].LandMark != undefined) { document.getElementById('txtLandmark').value = Table1[0].LandMark; } } } document.getElementById("txtline1").value = document.getElementById('txtaddress').value; document.getElementById("txtcity").value = document.getElementById('txtvalidationcity').value; document.getElementById("txtstate").value = document.getElementById('txtvalidationstate').value; document.getElementById("txtZip").value = document.getElementById('txtvalidationzip').value; document.getElementById("txtline2").value = document.getElementById('txtDoorNO').value; document.getElementById("txtulandmark").value = document.getElementById('txtLandmark').value; //DeliveryAddressCheckValidation(); } function containsNumber(str) { return /\d/.test(str); } function DoorDashEstimate(check, Item) { var Zip = ""; if (document.getElementById('txtvalidationzip').value != 'Zip') { Zip = document.getElementById('txtvalidationzip').value; } var numberexp = /^\d{10}$/; var phone = document.getElementById('txtmobilenumber').value; if (phone.match(numberexp)) { var CustomerContactNumber = phone; } else { var CustomerContactNumber = localStorage.getItem("BusinessContactNumber"); } var LocationId = document.getElementById('lblLId').value; var BusinessName = escape(document.getElementById('lblAppName').innerHTML); var DeliveryAddress = document.getElementById('txtaddress').value + ", " + document.getElementById('txtvalidationcity').value + ", " + document.getElementById('txtvalidationstate').value + ", " + Zip; var isvalid= containsNumber(document.getElementById('txtaddress').value); if(isvalid==true) { $.ajax({ type: "POST", url: "Orders.aspx/DoorDashPriceAndTimeEstimates", data: "{'LocationId': '" + LocationId + "','PickupAddress': '" + escape(localStorage.getItem("BusinessAddress")) + "','DeliveryAddress': '" + escape(DeliveryAddress) + "','PickupPhonenumber': '" + localStorage.getItem("BusinessContactNumber") + "','DeliveryPhonenumber': '" +CustomerContactNumber + "','Pickuptime': '" + "" + "','CustomerName': '" + "" + "','BusinessName': '" + BusinessName + "','Tip': '" + "" + "'}", contentType: "application/json", success: function (msg) { if (msg.d.quote_id != null) { localStorage.setItem("DoorDash", true); localStorage.removeItem("Zone"); var fee = msg.d.fee / 100; document.getElementById("lbldelivaryfee").innerHTML = "$" + fee; //document.getElementById("lbldelivaryfeetextlbl").style.display = "block"; //document.getElementById("lbldelivaryfeetextlbl").innerHTML = "Delivery"; //$('#lbldelivaryfee').fadeIn("slow"); var thirdpartydelivery = new Object(); thirdpartydelivery.quote_id = msg.d.quote_id; thirdpartydelivery.fee = fee; thirdpartydelivery.time = new Date(); thirdpartydelivery.time = thirdpartydelivery.time.setMinutes(thirdpartydelivery.time.getMinutes() + 4); localStorage.setItem("Thirdpartydelivery", JSON.stringify(thirdpartydelivery)); if (check == 1) DeliveryAvailable("Delivery", Item); else CheckDeal(); } else { localStorage.removeItem("DoorDash"); localStorage.removeItem("EnableDoorDash"); localStorage.removeItem("Thirdpartydelivery"); if (check == 1) DeliveryNotAvailable(msg.d); else CheckDeal(); } //$(".addcategoryloadingimage1").css("display", "none"); //$(".deliveryvalidationpanel").fadeOut("slow"); //document.getElementById('deliveryvalidationpanel').style.display = "none"; // setInterval(DoorDashEstimate, 300000); } }); } else { DeliveryNotAvailable("Enter valid address"); } } function deliveyicheck(Item) { //localStorage.removeItem("Zone"); var Zip = ""; if (document.getElementById('txtvalidationzip').value != 'Zip') { Zip = document.getElementById('txtvalidationzip').value; } var AppName = ""; var LocationName = ""; var LocationId = document.getElementById('lblLId').value; $.ajax({ type: "POST", url: "Orders.aspx/GetThirdPartyDeliverystatus", data: "{'LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == true) { localStorage.setItem("EnableDoorDash", true); DoorDashEstimate(1, Item); } else { localStorage.removeItem("EnableDoorDash"); localStorage.removeItem("DoorDash"); localStorage.removeItem("Thirdpartydelivery"); $.ajax({ type: "POST", url: "Orders.aspx/AppDetailsSelectByLocationId", data: "{'LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var AppName = msg.d[0].LocationAppName; var LocationName = msg.d[0].LocationName; } $.ajax({ type: "POST", url: "Orders.aspx/CheckDeliveryAvailability", data: "{'Line1': '" + escape(document.getElementById('txtaddress').value) + "','City': '" + escape(document.getElementById('txtvalidationcity').value) + "','State': '" + escape(document.getElementById('txtvalidationstate').value) + "','Zip': '" + Zip + "','lblLId': '" + document.getElementById('lblLId').value + "','CountryName' : '" + document.getElementById('lblCountry').innerHTML + "','AppName':'" + escape(AppName) + "','LName':'" + escape(LocationName) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["CustomWebsites"]; if (CustomWebsites != undefined) { msg.d = msg.d.replace("Use LiveChat or", ""); } $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } if (msg.d.indexOf("We are unable") < 0) { if (msg.d.indexOf("Out Of the Zone") >= 0) { GetDrivers("CurrentDay", "Drivers"); localStorage.setItem("Zone", "Out Of the Zone"); localStorage.setItem("Miles", msg.d.split("/")[0].replace("Out Of the Zone", "")); localStorage.setItem("TotalDistance", msg.d.split("/")[1]); } else if (msg.d.indexOf("Please check your add") >= 0) { $(".rdloader").css("display", "none"); $("#lblorderror").text(msg.d); $(".ordererror").show().delay(3000).fadeOut(); return; } else if (msg.d.indexOf("Your location is outside") >= 0) { $(".rdloader").css("display", "none"); $("#lblorderror").text(msg.d); $(".ordererror").show().delay(3000).fadeOut(); return; } else { GetDrivers("CurrentDay", "Drivers"); localStorage.setItem("Zone", msg.d); } localStorage.setItem("Zone", msg.d); DeliveryAvailable("Delivery", Item); } else { var errormessage = msg.d; if (msg.d.indexOf(" Km") == -1 && msg.d.indexOf(" mi") == -1) { errormessage = ""; } DeliveryNotAvailable(errormessage); return; //if (document.getElementById("lbTypeRequired").innerHTML == "Delivery") { // DeliveryNotAvailable(errormessage); // return; //} //else { // var ItemId; // if (document.getElementById("lblItemId").innerHTML.split('//')[0] != "") { // ItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; // } // if (ItemId != null && ItemId != "") { // $.ajax({ // type: "POST", // url: "Orders.aspx/GetItemDetails", // data: "{'ItemId': '" + ItemId + "'}", // dataType: "json", // contentType: "application/json", // success: function (msg) { // if (msg.d.length > 0) { // if (msg.d[0].Shipping == true && document.getElementById('lblShipping').innerHTML != "") { // if (document.getElementById("lblitemcount").innerHTML == "0") { // $(".deliveryvalidationpanel").fadeOut("slow"); // $(".deliverycheck").fadeOut("fast"); // $(".ShippingConfPanel").fadeIn("slow"); // $(".ShippingConfPanel").css("margin-top", $(document).scrollTop() - 0); // } // else { // DeliveryAvailable("Shipping", Item); // } // } // else { // DeliveryNotAvailable(errormessage); // } // } // } // }); // } // else { // DeliveryAvailable("Shipping", Item); // } //} } } }); } }); } } }); } function DeliveryAvailable(Type, Item) { // if we click on item the radio text is not radio localStorage.setItem("OrderType", Type); localStorage.setItem("GroupOrderType", Type); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var LOrderType = localStorage.getItem("OrderType"); $(".Chtext").text(Type); $("#ddlOrderType").val(Type); if (Type == "Shipping") document.getElementById("rbtShipping").checked = true; else document.getElementById("rbtdelivery").checked = true; if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow(); } else { BindItems(); } } var radio = document.getElementById("radiotext").value; if (radio != "radio") { if (document.getElementById("lbldchange").innerHTML == "OpenDpanel") { FinishOrderValidation(); OpeningOrderSubmitionPnl(); document.getElementById("lbldchange").innerHTML = ""; } var ItemId; if (document.getElementById("lblItemId").innerHTML.split('//')[0] != "") { ItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; } else { ItemId = document.getElementById("lbldeliveryItemId").innerHTML; } if (ItemId != null && ItemId != "") { $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + ItemId + "','OrderType': '" + LOrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var PnlConfrimation = 0; $("#btnaddtocart").css("display", ""); if ((msg.d[0].PickUp != true && msg.d[0].Delivery != true && msg.d[0].Shipping != true) || (msg.d[0].ViewOnly == true)) { $("#lblorderror").text("This item is View Only"); $(".ordererror").show().delay(3000).fadeOut(); $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#btnaddtocart").css("display", "none"); // return; } if (LOrderType == $("#lblPickupname").text() && msg.d[0].PickUp != true) { PnlConfrimation++; $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); if (msg.d[0].Delivery == true && $("#Deliverytxt").text() != "") { alertify.confirm("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + ". Do you want Deliver ?", function (e) { if (e) { OpenOrderTypePnl("Delivery"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Shipping == true && $("#lblShipping").text() != "") { alertify.confirm("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + ". Do you want Shipping ?", function (e) { if (e) { OpenOrderTypePnl("Shipping"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&")); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } else if (LOrderType == $("#lblDineInname").text()) { //PnlConfrimation++; $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); //OpenOrderTypePnl("DineIn"); } // //If item has not Delivery else if (LOrderType == "Delivery" && msg.d[0].Delivery != true) { $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); PnlConfrimation++; if (msg.d[0].PickUp == true && document.getElementById("lblPickup").innerHTML != "") { alertify.confirm("This Item is not available for Delivery. Do you want to " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + " ?", function (e) { if (e) { OpenOrderTypePnl(document.getElementById("lblPickupname").innerHTML.replace("&", "&")); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Shipping == true && $("#lblShipping").text() != "") { alertify.confirm("This Item is not available for Delivery. Do you want Shipping ?", function (e) { if (e) { OpenOrderTypePnl("Shipping"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for Delivery"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } //If item has not shipping else if (LOrderType == "Shipping" && msg.d[0].Shipping != true) { PnlConfrimation++; $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); if (msg.d[0].PickUp == true && document.getElementById("lblPickup").innerHTML != "") { alertify.confirm("This Item is not available for Shipping. Do you want to " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + " ?", function (e) { if (e) { OpenOrderTypePnl(document.getElementById("lblPickupname").innerHTML.replace("&", "&")); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Delivery == true && $("#Deliverytxt").text() != "") { alertify.confirm("This Item is not available for Shipping. Do you want Deliver ?", function (e) { if (e) { OpenOrderTypePnl("Delivery"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for Shipping"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } if (PnlConfrimation == 0) { document.getElementById("lblMainCategoryId").innerHTML = msg.d[0].MainCategoryId; if (msg.d[0].ItemFlow == true) { document.getElementById("lblitemflowtype").innerHTML = msg.d[0].ItemFlow; MenuItemOptionsLoad(msg, ItemId, LOrderType); } else { OptionsLoad(msg, ItemId, LOrderType); } } $.ajax({ type: "POST", url: "Orders.aspx/GetItemVariations", data: "{'ItemId': '" + ItemId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById('divVariations').innerHTML = ""; localStorage.removeItem("ItemVariation"); var Variations = new Array(); if (msg.d.length > 0) { var ddlVariation = document.createElement("select"); if (msg.d.length != 1) ddlVariation.options.add(new Option("Select Variation", "")); setAttributes(ddlVariation, { "style": "width: 200px;height: 25px;", "class": "ddlVariation", "id": "ddlVariation", "onchange": "gettotalprice()" }); for (var V = 0; V < msg.d.length; V++) { var Variation = new Object; Variation.Id = msg.d[V].Id; Variation.Name = msg.d[V].Name; Variation.Price = msg.d[V].Price.toFixed(2); Variations.push(Variation); ddlVariation.options.add(new Option(msg.d[V].Name + " " + document.getElementById("lblCurrency").innerHTML + msg.d[V].Price, msg.d[V].Id)); } localStorage.setItem("ItemVariation", JSON.stringify(Variations)); document.getElementById('divVariations').appendChild(ddlVariation); } gettotalprice(); } }); } } }); } else { $(".deliveryvalidationpanel").fadeOut("slow"); $('.signinloader').css("display", "none"); if (Type != "Shipping") { // BindOrderingPanel(); } } } else { if (document.getElementById("lbldchange").innerHTML == "OpenDpanel") { FinishOrderValidation(); OpeningOrderSubmitionPnl(); } } document.getElementById('checkdelivery').innerHTML = "Sucess"; $("#lblordsucc").text("Good news. We deliver to your location"); $(".ordersuccess").show().delay(3000).fadeOut(); var paymenttype = document.getElementById('onlinepayment').innerHTML; if (paymenttype == "Online Payment: No") { $(".bntSubmittip").css("display", "none"); } $(".deliveryvalidationpanel").fadeOut("slow"); $(".ShippingConfPanel").fadeOut("slow"); document.getElementById('deliveryvalidationpanel').style.display = "none"; if (document.getElementById("lblCurrency").innerHTML == "$") document.getElementById("txtulandmark").style.display = "none"; else document.getElementById("txtulandmark").style.display = ""; document.getElementById("txtline1").value = document.getElementById('txtaddress').value; document.getElementById("txtcity").value = document.getElementById('txtvalidationcity').value; document.getElementById("txtstate").value = document.getElementById('txtvalidationstate').value; document.getElementById("txtZip").value = document.getElementById('txtvalidationzip').value; document.getElementById("txtline2").value = document.getElementById('txtDoorNO').value; document.getElementById("txtulandmark").value = document.getElementById('txtLandmark').value; localStorage.removeItem("DeliveryDetails"); var AddrArray = new Array(); var addr = new Object(); addr.Line1 = document.getElementById('txtaddress').value; addr.City = document.getElementById('txtvalidationcity').value; addr.State = document.getElementById('txtvalidationstate').value; addr.Zip = document.getElementById('txtvalidationzip').value; addr.DoorNo = document.getElementById('txtDoorNO').value; addr.LandMark = document.getElementById('txtLandmark').value; AddrArray.push(addr); localStorage.setItem("DeliveryDetails", JSON.stringify(AddrArray)); localStorage.setItem("CheckedDeliveryAddress", JSON.stringify(AddrArray)); if (document.getElementById("lbldelivary").innerHTML == "Delivery Only") { StoringDeliveryAddress(); } if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } $(".rdloader").css("display", "none"); } function DeliveryNotAvailable(Errormsg) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (Errormsg == "") Errormsg = "We're sorry! We don't deliver to this address."; // localStorage.setItem("Zone", "00000000-0000-0000-0000-000000000000"); var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberType; if (Details != null) { MemberType = Details.MemberType; } if (MemberType == "Member") { $(".deliveryvalidationpanel").fadeOut("slow"); } else { $(".deliveryvalidationpanel").fadeIn("slow"); } $("#lblorderror").text(Errormsg); $(".ordererror").show().delay(3000).fadeOut(); if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} $(".rdloader").css("display", "none"); $(".ShippingConfPanel").fadeOut("slow"); } function GetDeliveryAddress() { var PreviousData = localStorage.getItem("DeliveryAddress"); var Table = JSON.parse(PreviousData); if (Table != null) { if (Table.length > 0) { document.getElementById('txtaddress').value = Table[0].Line1; if (Table[0].DoorNo != undefined) { document.getElementById('txtDoorNO').value = Table[0].DoorNo; document.getElementById("txtline2").value = Table[0].DoorNo; } if (Table[0].LandMark != undefined) { document.getElementById('txtulandmark').value = Table[0].LandMark; document.getElementById("txtLandmark").value = Table[0].LandMark; } document.getElementById('txtvalidationcity').value = Table[0].City; document.getElementById('txtvalidationstate').value = Table[0].State; document.getElementById('txtvalidationzip').value = Table[0].Zip; document.getElementById("txtline1").value = Table[0].Line1; document.getElementById("txtcity").value = Table[0].City; document.getElementById("txtstate").value = Table[0].State; document.getElementById("txtZip").value = Table[0].Zip; } } } function StoringDeliveryAddress() { var AdrArray = new Array(); var addr = new Object(); addr.Line1 = document.getElementById("txtline1").value; addr.City = document.getElementById("txtcity").value; addr.State = document.getElementById("txtstate").value; addr.DoorNo = document.getElementById("txtDoorNO").value; addr.LandMark = document.getElementById("txtLandmark").value; addr.Zip = document.getElementById("txtZip").value; AdrArray.push(addr); localStorage.setItem("DeliveryAddress", JSON.stringify(AdrArray)); } function LimitOptionsSelection(option) { var UrlType = document.getElementById('lblurlnametype').innerHTML; if (UrlType == "DineIn") { var ChoiceId = $(option).attr("id"); if (document.getElementById("lblAllowcart").innerHTML == "true") { var OptionId = $(option.parentNode.parentNode).attr("id"); var p = 0; $("input[name=" + option.name + "]:checked").each(function () { p++; }); var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == OptionId) { var l = OptionsCheck[J].MaxSize; var F = OptionsCheck[J].FreeOptions; if (l != "" && l != 0) { if (p > l) { $("#ItemOptionSelection" + option.name.replace("Choiceradio", "")).css("color", "red"); setTimeout(function () { $("#ItemOptionSelection" + option.name.replace("Choiceradio", "")).css("color", "grey") }, 2000); option.checked = false; } else { var forID = $("label[for='" + ChoiceId + "']"); if (forID != null) { if ($("label[for='" + ChoiceId + "']").hasClass("Choicetdimg")) { if ($(forID[1].childNodes[1]).attr("src") == "images/childExpand.png") { $(forID[1].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[1].childNodes[1]).attr("alt", "Collapse"); BindChildOptions(option); } else { if (document.getElementById('childOption' + ChoiceId) != null) { document.getElementById('childOption' + ChoiceId).innerHTML = ""; $(forID[1].childNodes[1]).attr("src", "images/childExpand.png"); $(forID[1].childNodes[1]).attr("alt", "Expand"); for (var OC = 0; OC < OptionsCheck.length; OC++) { if (OptionsCheck[OC].Id == OptionId) { for (var H = 0; H < OptionsCheck[OC].Choices.length; H++) { if (OptionsCheck[OC].Choices[H].Id == ChoiceId) { for (var Ch = 0; Ch < OptionsCheck[OC].Choices[H].ChildOptions.length; Ch++) { OptionsCheck[OC].Choices[H].ChildOptions.splice(Ch, 1); Ch--; } } } } } } } } else { if ($(forID[0].childNodes[1]).attr("src") == "images/childExpand.png") { $(forID[0].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[0].childNodes[1]).attr("alt", "Collapse"); BindChildOptions(option); } else { if (document.getElementById('childOption' + ChoiceId) != null) { document.getElementById('childOption' + ChoiceId).innerHTML = ""; $(forID[0].childNodes[1]).attr("src", "images/childExpand.png"); $(forID[0].childNodes[1]).attr("alt", "Expand"); for (var OC = 0; OC < OptionsCheck.length; OC++) { if (OptionsCheck[OC].Id == OptionId) { for (var H = 0; H < OptionsCheck[OC].Choices.length; H++) { if (OptionsCheck[OC].Choices[H].Id == ChoiceId) { for (var Ch = 0; Ch < OptionsCheck[OC].Choices[H].ChildOptions.length; Ch++) { OptionsCheck[OC].Choices[H].ChildOptions.splice(Ch, 1); Ch--; } } } } } } } } } $("#ItemOptionSelection" + option.name.replace("Choiceradio", "")).css("color", "grey"); } } ///FreeOptions if (OptionsCheck[J].FreeOptions > 0) { var Q = 0; for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (OptionsCheck[J].Choices[H].Price == 0) { if ($('#' + OptionsCheck[J].Choices[H].Id).is(':checked')) { Q++; } } } for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (OptionsCheck[J].Choices[H].Id == ChoiceId) { if (OptionsCheck[J].Choices[H].Price == 0) { if (F != 0) { if (Q <= F) { if ($('#' + ChoiceId).is(':checked')) { OptionsCheck[J].Choices[H].FreeOptions = "Yes"; OptionsCheck[J].Choices[H].SelectionCount = FreeOptionCount; FreeOptionCount++; } else { OptionsCheck[J].Choices[H].FreeOptions = "No"; OptionsCheck[J].Choices[H].SelectionCount = 0; } } else { option.checked = false; return; if ($('#' + ChoiceId).is(':checked')) { OptionsCheck[J].Choices[H].FreeOptions = "No"; OptionsCheck[J].Choices[H].SelectionCount = FreeOptionCount; FreeOptionCount++; } else { OptionsCheck[J].Choices[H].FreeOptions = "No"; OptionsCheck[J].Choices[H].SelectionCount = 0; } } } else { if ($('#' + ChoiceId).is(':checked')) { OptionsCheck[J].Choices[H].FreeOptions = "No"; OptionsCheck[J].Choices[H].SelectionCount = FreeOptionCount; FreeOptionCount++; } else { OptionsCheck[J].Choices[H].FreeOptions = "No"; OptionsCheck[J].Choices[H].SelectionCount = 0; } } } else { OptionsCheck[J].Choices[H].FreeOptions = "No"; OptionsCheck[J].Choices[H].SelectionCount = 0; } } } } ///FreeOptions } } ///FreeOptions if ($('#' + ChoiceId).is(':checked')) { } else { var T = 0; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == OptionId) { var F = OptionsCheck[J].FreeOptions; for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (OptionsCheck[J].Choices[H].FreeOptions == "Yes") { T++; } } F = F - T; for (var S = 0; S < F; S++) { var lowest = Number.POSITIVE_INFINITY; var selected = 0; var choosen = ""; for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (OptionsCheck[J].Choices[H].Id != ChoiceId) { if ($('#' + OptionsCheck[J].Choices[H].Id).is(':checked')) { if (OptionsCheck[J].Choices[H].SelectionCount != 0 && OptionsCheck[J].Choices[H].FreeOptions != "Yes") { tmp = OptionsCheck[J].Choices[H].SelectionCount; if (tmp < lowest) { lowest = tmp; selected = H; choosen = "Exist"; } } } } } if (choosen == "Exist") { OptionsCheck[J].Choices[selected].FreeOptions = "Yes"; } } } } } ///FreeOptions for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == OptionId) { for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id) != null) { if ($('#' + OptionsCheck[J].Choices[H].Id).is(':checked')) { $("#Quantity" + OptionsCheck[J].Choices[H].Id).removeAttr("disabled"); } else { $("#Quantity" + OptionsCheck[J].Choices[H].Id).attr("disabled", "disabled"); document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id).value = ""; document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id).style.border = "1px solid #b9bcbe"; } } } } } localStorage.setItem("OptionCheck", JSON.stringify(OptionsCheck)); if ($('#' + ChoiceId).is(':checked')) { if (document.getElementById("ddlQuantity" + ChoiceId) != null) { document.getElementById("ddlQuantity" + ChoiceId).style.display = ""; } } else { if (document.getElementById("ddlQuantity" + ChoiceId) != null) { document.getElementById("ddlQuantity" + ChoiceId).style.display = "none"; } } gettotalprice(); } else { var forID = $("label[for='" + ChoiceId + "']"); if (forID != null) { if ($("label[for='" + ChoiceId + "']").hasClass("Choicetdimg")) { if ($(forID[1].childNodes[1]).attr("src") == "images/childExpand.png") { $(forID[1].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[1].childNodes[1]).attr("alt", "Collapse"); BindChildOptions(option); } else { if (document.getElementById('childOption' + ChoiceId) != null) { document.getElementById('childOption' + ChoiceId).innerHTML = ""; $(forID[1].childNodes[1]).attr("src", "images/childExpand.png"); $(forID[1].childNodes[1]).attr("alt", "Expand"); } } } else { if ($(forID[0].childNodes[1]).attr("src") == "images/childExpand.png") { $(forID[0].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[0].childNodes[1]).attr("alt", "Collapse"); BindChildOptions(option); } else { if (document.getElementById('childOption' + ChoiceId) != null) { document.getElementById('childOption' + ChoiceId).innerHTML = ""; $(forID[0].childNodes[1]).attr("src", "images/childExpand.png"); $(forID[0].childNodes[1]).attr("alt", "Expand"); } } } } $("#ItemOptionSelection" + option.name.replace("Choiceradio", "")).css("color", "grey"); } } else { var ChoiceId = $(option).attr("id"); var OptionId = $(option.parentNode.parentNode).attr("id"); var p = 0; $("input[name=" + option.name + "]:checked").each(function () { p++; }); var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == OptionId) { var l = OptionsCheck[J].MaxSize; var F = OptionsCheck[J].FreeOptions; if (l != "" && l != 0) { if (p > l) { $("#ItemOptionSelection" + option.name.replace("Choiceradio", "")).css("color", "red"); setTimeout(function () { $("#ItemOptionSelection" + option.name.replace("Choiceradio", "")).css("color", "grey") }, 2000); option.checked = false; } else { var forID = $("label[for='" + ChoiceId + "']"); if (forID != null) { if ($("label[for='" + ChoiceId + "']").hasClass("Choicetdimg")) { if ($(forID[1].childNodes[1]).attr("src") == "images/childExpand.png") { $(forID[1].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[1].childNodes[1]).attr("alt", "Collapse"); BindChildOptions(option); } else { if (document.getElementById('childOption' + ChoiceId) != null) { document.getElementById('childOption' + ChoiceId).innerHTML = ""; $(forID[1].childNodes[1]).attr("src", "images/childExpand.png"); $(forID[1].childNodes[1]).attr("alt", "Expand"); for (var OC = 0; OC < OptionsCheck.length; OC++) { if (OptionsCheck[OC].Id == OptionId) { for (var H = 0; H < OptionsCheck[OC].Choices.length; H++) { if (OptionsCheck[OC].Choices[H].Id == ChoiceId) { for (var Ch = 0; Ch < OptionsCheck[OC].Choices[H].ChildOptions.length; Ch++) { OptionsCheck[OC].Choices[H].ChildOptions.splice(Ch, 1); Ch--; } } } } } } } } else{ if ($(forID[0].childNodes[1]).attr("src") == "images/childExpand.png") { $(forID[0].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[0].childNodes[1]).attr("alt", "Collapse"); BindChildOptions(option); } else { if (document.getElementById('childOption' + ChoiceId) != null) { document.getElementById('childOption' + ChoiceId).innerHTML = ""; $(forID[0].childNodes[1]).attr("src", "images/childExpand.png"); $(forID[0].childNodes[1]).attr("alt", "Expand"); for (var OC = 0; OC < OptionsCheck.length; OC++) { if (OptionsCheck[OC].Id == OptionId) { for (var H = 0; H < OptionsCheck[OC].Choices.length; H++) { if (OptionsCheck[OC].Choices[H].Id == ChoiceId) { for (var Ch = 0; Ch < OptionsCheck[OC].Choices[H].ChildOptions.length; Ch++) { OptionsCheck[OC].Choices[H].ChildOptions.splice(Ch, 1); Ch--; } } } } } } } } } $("#ItemOptionSelection" + option.name.replace("Choiceradio", "")).css("color", "grey"); } } ///FreeOptions if (OptionsCheck[J].FreeOptions > 0) { var Q = 0; for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (OptionsCheck[J].Choices[H].Price == 0) { if ($('#' + OptionsCheck[J].Choices[H].Id).is(':checked')) { Q++; } } } for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (OptionsCheck[J].Choices[H].Id == ChoiceId) { if (OptionsCheck[J].Choices[H].Price == 0) { if (F != 0) { if (Q <= F) { if ($('#' + ChoiceId).is(':checked')) { OptionsCheck[J].Choices[H].FreeOptions = "Yes"; OptionsCheck[J].Choices[H].SelectionCount = FreeOptionCount; FreeOptionCount++; } else { OptionsCheck[J].Choices[H].FreeOptions = "No"; OptionsCheck[J].Choices[H].SelectionCount = 0; } } else { option.checked = false; return; if ($('#' + ChoiceId).is(':checked')) { OptionsCheck[J].Choices[H].FreeOptions = "No"; OptionsCheck[J].Choices[H].SelectionCount = FreeOptionCount; FreeOptionCount++; } else { OptionsCheck[J].Choices[H].FreeOptions = "No"; OptionsCheck[J].Choices[H].SelectionCount = 0; } } } else { if ($('#' + ChoiceId).is(':checked')) { OptionsCheck[J].Choices[H].FreeOptions = "No"; OptionsCheck[J].Choices[H].SelectionCount = FreeOptionCount; FreeOptionCount++; } else { OptionsCheck[J].Choices[H].FreeOptions = "No"; OptionsCheck[J].Choices[H].SelectionCount = 0; } } } else { OptionsCheck[J].Choices[H].FreeOptions = "No"; OptionsCheck[J].Choices[H].SelectionCount = 0; } } } } ///FreeOptions } } ///FreeOptions if ($('#' + ChoiceId).is(':checked')) { } else { var T = 0; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == OptionId) { var F = OptionsCheck[J].FreeOptions; for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (OptionsCheck[J].Choices[H].FreeOptions == "Yes") { T++; } } F = F - T; for (var S = 0; S < F; S++) { var lowest = Number.POSITIVE_INFINITY; var selected = 0; var choosen = ""; for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (OptionsCheck[J].Choices[H].Id != ChoiceId) { if ($('#' + OptionsCheck[J].Choices[H].Id).is(':checked')) { if (OptionsCheck[J].Choices[H].SelectionCount != 0 && OptionsCheck[J].Choices[H].FreeOptions != "Yes") { tmp = OptionsCheck[J].Choices[H].SelectionCount; if (tmp < lowest) { lowest = tmp; selected = H; choosen = "Exist"; } } } } } if (choosen == "Exist") { OptionsCheck[J].Choices[selected].FreeOptions = "Yes"; } } } } } ///FreeOptions for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == OptionId) { for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id) != null) { if ($('#' + OptionsCheck[J].Choices[H].Id).is(':checked')) { $("#Quantity" + OptionsCheck[J].Choices[H].Id).removeAttr("disabled"); } else { $("#Quantity" + OptionsCheck[J].Choices[H].Id).attr("disabled", "disabled"); document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id).value = ""; document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id).style.border = "1px solid #b9bcbe"; } } } } } localStorage.setItem("OptionCheck", JSON.stringify(OptionsCheck)); if ($('#' + ChoiceId).is(':checked')) { if (document.getElementById("ddlQuantity" + ChoiceId) != null) { document.getElementById("ddlQuantity" + ChoiceId).style.display = ""; } } else { if (document.getElementById("ddlQuantity" + ChoiceId) != null) { document.getElementById("ddlQuantity" + ChoiceId).style.display = "none"; } } gettotalprice(); } } function LimitChildOptionsSelection(ChildOption) { var ChoiceId = $(ChildOption).attr("id"); var OptionId = $(ChildOption.parentNode.parentNode).attr("id"); var p = 0; $("input[name=" + ChildOption.name + "]:checked").each(function () { p++; }); var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var J = 0; J < OptionsCheck.length; J++) { for (var K = 0; K < OptionsCheck[J].Choices.length; K++) { if (OptionsCheck[J].Choices[K].ChildOptions != undefined) { for (var M = 0; M < OptionsCheck[J].Choices[K].ChildOptions.length; M++) { if (OptionsCheck[J].Choices[K].ChildOptions[M].Id == OptionId) { var l = OptionsCheck[J].Choices[K].ChildOptions[M].MaxSize; var F = OptionsCheck[J].Choices[K].ChildOptions[M].FreeOptions; if (l != "" && l != 0) { if (p > l) { $("#ItemOptionSelection" + ChildOption.name.replace("Choiceradio", "")).css("color", "red"); setTimeout(function () { $("#ItemOptionSelection" + ChildOption.name.replace("Choiceradio", "")).css("color", "grey") }, 2000); ChildOption.checked = false; } else { $("#ItemOptionSelection" + ChildOption.name.replace("Choiceradio", "")).css("color", "grey"); } } ///FreeOptions for (var U = 0; U < OptionsCheck[J].Choices[K].ChildOptions[M].Choices.length; U++) { var GetChoiceId = OptionsCheck[J].Choices[K].Id + "" + OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].Id; if (GetChoiceId == ChoiceId) { if (F != 0) { if (p <= F) { if ($('#' + ChoiceId).is(':checked')) { OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].FreeOptions = "Yes"; OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].SelectionCount = FreeOptionCount; FreeOptionCount++; } else { OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].FreeOptions = "No"; OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].SelectionCount = 0; } } else { if ($('#' + ChoiceId).is(':checked')) { OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].FreeOptions = "No"; OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].SelectionCount = FreeOptionCount; FreeOptionCount++; } else { OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].FreeOptions = "No"; OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].SelectionCount = 0; } } } else { if ($('#' + ChoiceId).is(':checked')) { OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].FreeOptions = "No"; OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].SelectionCount = FreeOptionCount; FreeOptionCount++; } else { OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].FreeOptions = "No"; OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].SelectionCount = 0; } } } } ///FreeOptions } } } } } ///FreeOptions if ($('#' + ChoiceId).is(':checked')) { } else { var T = 0; for (var J = 0; J < OptionsCheck.length; J++) { for (var K = 0; K < OptionsCheck[J].Choices.length; K++) { if (OptionsCheck[J].Choices[K].ChildOptions != undefined) { for (var M = 0; M < OptionsCheck[J].Choices[K].ChildOptions.length; M++) { if (OptionsCheck[J].Choices[K].ChildOptions[M].Id == OptionId) { var F = OptionsCheck[J].Choices[K].ChildOptions[M].FreeOptions; for (var H = 0; H < OptionsCheck[J].Choices[K].ChildOptions[M].Choices.length; H++) { if (OptionsCheck[J].Choices[K].ChildOptions[M].Choices[H].FreeOptions == "Yes") { T++; } } F = F - T; for (var S = 0; S < F; S++) { var lowest = Number.POSITIVE_INFINITY; var selected = 0; var choosen = ""; for (var U = 0; U < OptionsCheck[J].Choices[K].ChildOptions[M].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[K].Id + OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].Id).is(':checked')) { if (OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].SelectionCount != 0 && OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].FreeOptions != "Yes") { tmp = OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].SelectionCount; if (tmp < lowest) { lowest = tmp; selected = U; choosen = "Exist"; } } } } } if (choosen == "Exist") { OptionsCheck[J].Choices[K].ChildOptions[M].Choices[selected].FreeOptions = "Yes"; } } } } } } } localStorage.setItem("OptionCheck", JSON.stringify(OptionsCheck)); ///FreeOptions gettotalprice(); } function BindForParentRadio(OptionChoice) { document.getElementById("flowoptbtnerror").innerHTML=""; var ChoiceId = $(OptionChoice).attr("id"); var Screenid=$(OptionChoice).parent().attr("id"); var UrlType = document.getElementById('lblurlnametype').innerHTML; if (UrlType == "DineIn") { if (document.getElementById("lblAllowcart").innerHTML == "true") { var OptionId = $(OptionChoice.parentNode.parentNode).attr("id"); var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == OptionId) { for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id) != null) { $("#Quantity" + OptionsCheck[J].Choices[H].Id).attr("disabled", "disabled"); document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id).value = ""; document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id).style.border = "1px solid #b9bcbe"; } var childExisttr = document.getElementById("childOption" + OptionsCheck[J].Choices[H].Id); if (childExisttr != null) { document.getElementById("childOption" + OptionsCheck[J].Choices[H].Id).innerHTML = ""; } var forID = $("label[for='" + OptionsCheck[J].Choices[H].Id + "']"); if (forID != undefined) { if ($("label[for='" + OptionsCheck[J].Choices[H].Id + "']").hasClass("Choicetdimg")) { $(forID[1].childNodes[1]).attr("src", "images/childExpand.png"); $(forID[1].childNodes[1]).attr("alt", "Expand"); } else { $(forID[0].childNodes[1]).attr("src", "images/childExpand.png"); $(forID[0].childNodes[1]).attr("alt", "Expand"); } } if (OptionsCheck[J].Choices[H].ChildOptions != undefined) { for (var Ch = 0; OptionsCheck[J].Choices[H].ChildOptions.length; Ch++) { OptionsCheck[J].Choices[H].ChildOptions.splice(Ch, 1); Ch--; } } } } } if (document.getElementById("Quantity" + ChoiceId) != null) { $("#Quantity" + ChoiceId).removeAttr("disabled"); } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == OptionId) { for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id) != null) { if ($('#' + OptionsCheck[J].Choices[H].Id).is(':checked')) { $("#Quantity" + OptionsCheck[J].Choices[H].Id).removeAttr("disabled"); // document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[H].Id).style.display = ""; } else { $("#Quantity" + OptionsCheck[J].Choices[H].Id).attr("disabled", "disabled"); document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id).value = ""; // document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[H].Id).style.display = "none"; document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id).style.border = "1px solid #b9bcbe"; } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == OptionId) { for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[H].Id) != null) { document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[H].Id).style.display = "none"; } } } } if ($('#' + ChoiceId).is(':checked')) { if (document.getElementById("ddlQuantity" + ChoiceId) != null) { document.getElementById("ddlQuantity" + ChoiceId).style.display = ""; } } else { if (document.getElementById("ddlQuantity" + ChoiceId) != null) { document.getElementById("ddlQuantity" + ChoiceId).style.display = "none"; } } var forID = $("label[for='" + ChoiceId + "']"); if (forID != undefined) { if ($("label[for='" + ChoiceId + "']").hasClass("Choicetdimg")) { if ($(forID[1].childNodes[1]).attr("src") == "images/childExpand.png") { $(forID[1].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[1].childNodes[1]).attr("alt", "Collapse"); } } else { if ($(forID[0].childNodes[1]).attr("src") == "images/childExpand.png") { $(forID[0].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[0].childNodes[1]).attr("alt", "Collapse"); } } } BindChildOptions(OptionChoice, 100); gettotalprice(); $("#" + Screenid + " tr").each(function () { var RowId = $(this).attr('id'); if (RowId != "undefined" && RowId != undefined) { if ($(this).attr('id') == "childOption" + ChoiceId) { $("#" + RowId).css("display", "grid"); $(".pricetext").css("display", "block"); } else { $(this).css("display", "none"); } } else { $(this).css("display", "none"); } }); } else{ var forID = $("label[for='" + ChoiceId + "']"); if (forID != undefined) { if ($("label[for='" + ChoiceId + "']").hasClass("Choicetdimg")) { if ($(forID[1].childNodes[1]).attr("src") == "images/childExpand.png") { BindChildOptions(OptionChoice, 100); $(forID[1].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[1].childNodes[1]).attr("alt", "Collapse"); } else { var ChoiceId = $(OptionChoice).attr("id"); var OptionId = $(OptionChoice.parentNode.parentNode).attr("id"); if (document.getElementById("childOption" + ChoiceId) != null) { var childExisttr = document.getElementById("childOption" + ChoiceId); childExisttr.innerHTML = ""; } $(forID[1].childNodes[1]).attr("src", "images/childExpand.png"); $(forID[1].childNodes[1]).attr("alt", "Expand"); } } else { if ($(forID[0].childNodes[1]).attr("src") == "images/childExpand.png") { BindChildOptions(OptionChoice, 100); $(forID[0].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[0].childNodes[1]).attr("alt", "Collapse"); } else { var ChoiceId = $(OptionChoice).attr("id"); var OptionId = $(OptionChoice.parentNode.parentNode).attr("id"); if (document.getElementById("childOption" + ChoiceId) != null) { var childExisttr = document.getElementById("childOption" + ChoiceId); childExisttr.innerHTML = ""; } $(forID[0].childNodes[1]).attr("src", "images/childExpand.png"); $(forID[0].childNodes[1]).attr("alt", "Expand"); } } } } } else { var OptionId = $(OptionChoice.parentNode.parentNode).attr("id"); var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == OptionId) { for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id) != null) { $("#Quantity" + OptionsCheck[J].Choices[H].Id).attr("disabled", "disabled"); document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id).value = ""; document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id).style.border = "1px solid #b9bcbe"; } var childExisttr = document.getElementById("childOption" + OptionsCheck[J].Choices[H].Id); if (childExisttr != null) { document.getElementById("childOption" + OptionsCheck[J].Choices[H].Id).innerHTML = ""; } var forID = $("label[for='" + OptionsCheck[J].Choices[H].Id + "']"); if (forID != undefined) { if ($("label[for='" + OptionsCheck[J].Choices[H].Id + "']").hasClass("Choicetdimg")) { $(forID[1].childNodes[1]).attr("src", "images/childExpand.png"); $(forID[1].childNodes[1]).attr("alt", "Expand"); } else { $(forID[0].childNodes[1]).attr("src", "images/childExpand.png"); $(forID[0].childNodes[1]).attr("alt", "Expand"); } } if (OptionsCheck[J].Choices[H].ChildOptions != undefined) { for (var Ch = 0; OptionsCheck[J].Choices[H].ChildOptions.length; Ch++) { OptionsCheck[J].Choices[H].ChildOptions.splice(Ch, 1); Ch--; } } } } } if (document.getElementById("Quantity" + ChoiceId) != null) { $("#Quantity" + ChoiceId).removeAttr("disabled"); } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == OptionId) { for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id) != null) { if ($('#' + OptionsCheck[J].Choices[H].Id).is(':checked')) { $("#Quantity" + OptionsCheck[J].Choices[H].Id).removeAttr("disabled"); // document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[H].Id).style.display = ""; } else { $("#Quantity" + OptionsCheck[J].Choices[H].Id).attr("disabled", "disabled"); document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id).value = ""; // document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[H].Id).style.display = "none"; document.getElementById("Quantity" + OptionsCheck[J].Choices[H].Id).style.border = "1px solid #b9bcbe"; } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == OptionId) { for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[H].Id) != null) { document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[H].Id).style.display = "none"; } } } } if ($('#' + ChoiceId).is(':checked')) { if (document.getElementById("ddlQuantity" + ChoiceId) != null) { document.getElementById("ddlQuantity" + ChoiceId).style.display = ""; } } else { if (document.getElementById("ddlQuantity" + ChoiceId) != null) { document.getElementById("ddlQuantity" + ChoiceId).style.display = "none"; } } var forID = $("label[for='" + ChoiceId + "']"); if (forID != undefined) { if ($("label[for='" + ChoiceId + "']").hasClass("Choicetdimg")) { if ($(forID[1].childNodes[1]).attr("src") == "images/childExpand.png") { $(forID[1].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[1].childNodes[1]).attr("alt", "Collapse"); } } else { if ($(forID[0].childNodes[1]).attr("src") == "images/childExpand.png") { $(forID[0].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[0].childNodes[1]).attr("alt", "Collapse"); } } } BindChildOptions(OptionChoice, 100); gettotalprice(); $("#" + Screenid + " tr").each(function () { var RowId = $(this).attr('id'); if (RowId != "undefined" && RowId != undefined) { if ($(this).attr('id') == "childOption" + ChoiceId) { $("#" + RowId).css("display", "grid"); $(".pricetext").css("display", "block"); } else { $(this).css("display", "none"); } } else { $(this).css("display", "none"); } }); } } function BindChildOptions(Child, Itemcount) { if (document.getElementById("lblitemflowtype").innerHTML == "true") { OptionsFlowBindChildOptions(Child, Itemcount); } else { var ChoiceId = $(Child).attr("id"); var OptionId = $(Child.parentNode.parentNode).attr("id"); if (document.getElementById("childOption" + ChoiceId) != null) { var childExisttr = document.getElementById("childOption" + ChoiceId); $.ajax({ type: "POST", url: "Orders.aspx/GetChildOptions", data: "{'OptionId': '" + OptionId + "','ChoiceId': '" + ChoiceId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById("childOption" + ChoiceId).innerHTML = ""; if (msg.d.length > 0) { var childExisttd = document.createElement("td"); ///////////ChildOptions for (var H = 0; H < msg.d.length; H++) { var tableChildOption = document.createElement("table"); tableChildOption.setAttribute("class", "optionChildRow"); var trChildOption = document.createElement("tr"); trChildOption.setAttribute("style", "font-weight:bold;"); var tdChildOption = document.createElement("td"); setAttributes(tdChildOption, { "class": "Optiontd", "colspan": "3" }); var lblChildOption = document.createElement("span"); lblChildOption.innerHTML += msg.d[H].OptionName; lblChildOption.setAttribute("id", "ChildOption" + msg.d[H].OptionId); tdChildOption.appendChild(lblChildOption); if (msg.d[H].Type == "CheckBoxes") { if (msg.d[H].MaxSize > 0) { if (msg.d[H].MaxSize != 100 && msg.d[H].MaxSize != msg.d[H].Choice.length) { var lblChildOptionSelection = document.createElement("span"); setAttributes(lblChildOptionSelection, { "style": "padding-left:5px;color:red;display:none;" + OptionTextColor, "id": "ItemOptionSelection" + msg.d[H].OptionId }); lblChildOptionSelection.innerHTML += "(Max Selection: " + msg.d[H].MaxSize + ")"; tdChildOption.appendChild(lblChildOptionSelection); } } if (msg.d[H].MinSize > 0) { if (msg.d[H].MinSize != 100 && msg.d[H].MinSize != msg.d[H].Choice.length) { if (document.getElementById("choiceselect").innerHTML == "") { document.getElementById("choiceselect").innerHTML = msg.d[H].OptionId; } else { document.getElementById("choiceselect").innerHTML = document.getElementById("choiceselect").innerHTML + "," + msg.d[H].OptionId } var lblChildOptionSelection = document.createElement("span"); setAttributes(lblChildOptionSelection, { "style": "padding-left:5px;color:red;" + OptionTextColor, "id": "ItemOptionSelectionMin" + msg.d[H].OptionId, "class": "ItemOptionSelectionMin" }); lblChildOptionSelection.innerHTML += "(Min Selection: " + msg.d[H].MinSize + ")"; tdChildOption.appendChild(lblChildOptionSelection); } } } trChildOption.appendChild(tdChildOption); tableChildOption.appendChild(trChildOption); var ChildOption = new Object; ChildOption.Type = msg.d[H].Type; ChildOption.Id = msg.d[H].OptionId; ChildOption.MinSize = msg.d[H].MinSize; ChildOption.MaxSize = msg.d[H].MaxSize; ChildOption.FreeOptions = msg.d[H].FreeOptions; ChildOption.Name = msg.d[H].OptionName; ChildOption.DefaultOptionText = msg.d[H].DefaultOptionText; ChildOption.Choices = new Array(); if (msg.d[H].Type == "Radio Buttons" || msg.d[H].Type == "CheckBoxes") { for (G = 0; G < msg.d[H].Choice.length; G++) { var Choice = new Object; Choice.Id = msg.d[H].Choice[G].Id; Choice.Name = msg.d[H].Choice[G].ChoiceName; Choice.Notify = msg.d[H].Choice[G].Notify; Choice.DefaultVSOption = msg.d[H].Choice[G].DefaultVSOption; Choice.Price = msg.d[H].Choice[G].Price.toFixed(2); Choice.FreeOptions = "No"; Choice.SelectionCount = 0; ChildOption.Choices.push(Choice); var trChildChoice = document.createElement("tr"); setAttributes(trChildChoice, { "class": "optionname", "style": "color:" + OptionTextColor, "id": msg.d[H].OptionId }); var tdChildChoice = document.createElement("td"); setAttributes(tdChildChoice, { "class": "Choicetd", "align": "left" }); var lblChildChoice = document.createElement("label"); lblChildChoice.innerHTML += msg.d[H].Choice[G].ChoiceName; setAttributes(lblChildChoice, { "title": msg.d[H].Choice[G].ChoiceName, "for": ChoiceId + "" + msg.d[H].Choice[G].Id, "style": "cursor:pointer;" }); var Price = 0; if (msg.d[H].Choice[G].Price != Price.toFixed(2)) { lblChildChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + msg.d[H].Choice[G].Price.toFixed(2) + ")"; } var UrlType = document.getElementById('lblurlnametype').innerHTML; if (UrlType == "DineIn") { if (document.getElementById("lblAllowcart").innerHTML == "true") { //setAttributes(lblChildChoice, { "style": "background:none;" }); } else { setAttributes(lblChildChoice, { "style": "background:none;" }); } } if (msg.d[H].Type == "Radio Buttons") { if (tdChildOption.innerHTML.indexOf("Required") != -1) { } else tdChildOption.innerHTML += "<span style='float:right;color:red;'>Required</span>"; var childradio = document.createElement("input"); if (msg.d[H].Choice[G].DefaultVSOption == true) { setAttributes(childradio, { "type": "radio", "class": "Validate", "checked": "true", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); } else { setAttributes(childradio, { "type": "radio", "class": "Validate", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); } tdChildChoice.appendChild(childradio); } if (msg.d[H].Type == "CheckBoxes") { var childcheckbox = document.createElement("input"); if (msg.d[H].Choice[G].DefaultVSOption == true) { setAttributes(childcheckbox, { "type": "checkbox", "class": "Validate", "checked": "true", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); } else { setAttributes(childcheckbox, { "type": "checkbox", "class": "Validate", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); } if (msg.d[H].MaxSize > 0) { childcheckbox.setAttribute("onclick", "LimitChildOptionsSelection(this);"); } tdChildChoice.appendChild(childcheckbox); } if (msg.d[H].Type == "Radio Buttons" || msg.d[H].Type == "CheckBoxes") { if (msg.d[H].Choice[G].ChoiceImageURL != null && msg.d[H].Choice[G].ChoiceImageURL != "") { var lblChildChoiceimg = document.createElement("label"); setAttributes(lblChildChoiceimg, { "class": "Choicetdimg", "title": msg.d[H].Choice[G].ChoiceName, "for": ChoiceId + "" + msg.d[H].Choice[G].Id, "style": "cursor:pointer;" }); lblChildChoiceimg.innerHTML = "<img class='choiceimage', alt='Choice Image', id='Choiceimg" + msg.d[H].Choice[G].Id + "', title='" + msg.d[H].Choice[G].ChoiceImageURL + "' , src='" + msg.d[H].Choice[G].ChoiceImageURL + "' />"; setAttributes(lblChildChoice, { "style": "float:left" }); tdChildChoice.appendChild(lblChildChoiceimg); } } tdChildChoice.appendChild(lblChildChoice); trChildChoice.appendChild(tdChildChoice); tableChildOption.appendChild(trChildChoice); } } if (msg.d[H].Type == "Dropdown") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); setAttributes(trChoice, { "class": "dropdowncs" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var ddlOption = document.createElement("select"); setAttributes(ddlOption, { "style": "width: auto;height: 25px;margin-top:10px;max-width:60%", "id": msg.d[H].OptionId, "class": "ddlChildOption Validate", "onchange": "gettotalprice()" }); for (var S = 0; S < msg.d[H].Choice.length; S++) { var Choice = new Object; Choice.Id = msg.d[H].Choice[S].Id; Choice.Name = msg.d[H].Choice[S].ChoiceName; Choice.Notify = msg.d[H].Choice[S].Notify; Choice.DefaultVSOption = msg.d[H].Choice[S].DefaultVSOption; Choice.Price = msg.d[H].Choice[S].Price.toFixed(2); Choice.FreeOptions = "No"; Choice.SelectionCount = 0; ChildOption.Choices.push(Choice); ddlOption.options.add(new Option(msg.d[H].Choice[S].ChoiceName + " " + document.getElementById("lblCurrency").innerHTML + msg.d[H].Choice[S].Price, msg.d[H].Choice[S].Id)); } tdChoice.appendChild(ddlOption); trChoice.appendChild(tdChoice); tableChildOption.appendChild(trChoice); //Options.push(option); //if (msg.d[i].Choice.length > 0) { // lblrequired.innerHTML += "<span style='float:right;color:red;'>Required</span>"; //} } if (msg.d[H].Type == "Multiline Textbox") { var trChildChoice = document.createElement("tr"); setAttributes(trChildChoice, { "style": "font-weight:bold;" }); var tdChildChoice = document.createElement("td"); setAttributes(tdChildChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var childtextbox = document.createElement("textarea"); setAttributes(childtextbox, { "class": "Choicetext", "id": ChoiceId + msg.d[H].OptionId }); tdChildChoice.appendChild(childtextbox); trChildChoice.appendChild(tdChildChoice); tableChildOption.appendChild(trChildChoice); } childExisttd.appendChild(tableChildOption); var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == OptionId) { for (var D = 0; D < OptionsCheck[J].Choices.length; D++) { if (D == 0) { if (OptionsCheck[J].Choices[D].ChildOptions == undefined) { OptionsCheck[J].Choices[D].ChildOptions = new Array(); } } if (OptionsCheck[J].Choices[D].Id == ChoiceId) { if (OptionsCheck[J].Choices[D].ChildOptions == undefined) { OptionsCheck[J].Choices[D].ChildOptions = new Array(); } OptionsCheck[J].Choices[D].ChildOptions.push(ChildOption); localStorage.setItem("OptionCheck", JSON.stringify(OptionsCheck)); } } } } } } childExisttr.appendChild(childExisttd); gettotalprice(); } if (document.getElementById("lblItemType").innerHTML == "EditItem") { if (Itemcount != 100) { var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { for (var j = 0; j < AddedItems[Itemcount].Choices.length; j++) { if (AddedItems[Itemcount].Choices[j].Id == ChoiceId) { if (AddedItems[Itemcount].Choices[j].ChildChoices != undefined) { for (var k = 0; k < AddedItems[Itemcount].Choices[j].ChildChoices.length; k++) { if (AddedItems[Itemcount].Choices[j].ChildChoices[k].Id != "") { $('#' + AddedItems[Itemcount].Choices[j].Id + AddedItems[Itemcount].Choices[j].ChildChoices[k].Id).attr('checked', true); } else { document.getElementById(AddedItems[Itemcount].Choices[j].Id + "" + AddedItems[Itemcount].Choices[j].ChildChoices[k].OptionId).value = unescape(AddedItems[Itemcount].Choices[j].ChildChoices[k].ChoiceName); } } } } } } var forID = $("label[for='" + ChoiceId + "']"); if (forID != undefined) { if ($("label[for='" + ChoiceId + "']").hasClass("Choicetdimg")) { if ($(forID[1].childNodes[1]).attr("src") == "images/childExpand.png") { $(forID[1].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[1].childNodes[1]).attr("alt", "Collapse"); } } else { if ($(forID[0].childNodes[1]).attr("src") == "images/childExpand.png") { $(forID[0].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[0].childNodes[1]).attr("alt", "Collapse"); } } } } ///FreeOptions FreeOptionCount = 0; var highest = Number.NEGATIVE_INFINITY; var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var j = 0; j < AddedItems[Itemcount].Choices.length; j++) { if (AddedItems[Itemcount].Choices[j].ChildChoices != undefined) { for (var W = 0; W < AddedItems[Itemcount].Choices[j].ChildChoices.length; W++) { for (var J = 0; J < OptionsCheck.length; J++) { for (var K = 0; K < OptionsCheck[J].Choices.length; K++) { if (OptionsCheck[J].Choices[K].ChildOptions != undefined) { for (var M = 0; M < OptionsCheck[J].Choices[K].ChildOptions.length; M++) { if (OptionsCheck[J].Choices[K].ChildOptions[M].Id == AddedItems[Itemcount].Choices[j].ChildChoices[W].OptionId) { for (var U = 0; U < OptionsCheck[J].Choices[K].ChildOptions[M].Choices.length; U++) { if (OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].Id == AddedItems[Itemcount].Choices[j].ChildChoices[W].Id) { OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].FreeOptions = AddedItems[Itemcount].Choices[j].ChildChoices[W].FreeOptions; OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].SelectionCount = AddedItems[Itemcount].Choices[j].ChildChoices[W].SelectionCount; tmp = OptionsCheck[J].Choices[H].SelectionCount; if (tmp > highest) { highest = tmp; } } } } } } } } } } } if (highest = Number.NEGATIVE_INFINITY) { FreeOptionCount = highest; } localStorage.setItem("OptionCheck", JSON.stringify(OptionsCheck)); ///FreeOptions } } }); } } } function LimtCharactersLength(txtMsg, CharLength, indicator) { chars = txtMsg.value.length; if (indicator == "lblcount") { if(chars > 0) $("#countdiv").css("display","block"); else $("#countdiv").css("display","none"); } else { if(chars > 0) $("#countdiv1").css("display","block"); else $("#countdiv1").css("display","none"); } document.getElementById(indicator).innerHTML = chars; if (chars > CharLength) { txtMsg.value = txtMsg.value.substring(0, CharLength); } } function SelectOptions() { var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); var OrderType = localStorage.getItem("OrderType"); if (AddedItems != null) { var Itemcount = document.getElementById("EditItemNum").innerHTML.replace("EditItem", ""); document.getElementById('txtinstructions').value = unescape(AddedItems[Itemcount].Instructions); if (AddedItems[Itemcount].OrderType == OrderType) { document.getElementById("lbldisplayItemPrice").innerHTML = document.getElementById("lblCurrency").innerHTML + AddedItems[Itemcount].Price; document.getElementById('txtquantity').value = AddedItems[Itemcount].Quantity; if (AddedItems[Itemcount].PriceType == "Per Unit") document.getElementById('txtunitquantity').value = AddedItems[Itemcount].ItemUnitQty; else document.getElementById('txtunitquantity').value = 1; } for (var j = 0; j < AddedItems[Itemcount].Choices.length; j++) { if (AddedItems[Itemcount].Choices[j].Type != "Dropdown") { if (AddedItems[Itemcount].Choices[j].Id != "") { $('#' + AddedItems[Itemcount].Choices[j].Id).attr('checked', true); if (AddedItems[Itemcount].Choices[j].Quantity > 0) { if (document.getElementById("Quantity" + AddedItems[Itemcount].Choices[j].Id) != null) { document.getElementById("Quantity" + AddedItems[Itemcount].Choices[j].Id).value = AddedItems[Itemcount].Choices[j].Quantity; $("#Quantity" + AddedItems[Itemcount].Choices[j].Id).removeAttr("disabled"); } } if (AddedItems[Itemcount].Choices[j].ChoicesQuantity > 0) { if (document.getElementById("ddlQuantity" + AddedItems[Itemcount].Choices[j].Id) != null) { document.getElementById("ddlQuantity" + AddedItems[Itemcount].Choices[j].Id).style.display = ""; document.getElementById("ddlQuantity" + AddedItems[Itemcount].Choices[j].Id).value = AddedItems[Itemcount].Choices[j].ChoicesQuantity; } } if (document.getElementById(AddedItems[Itemcount].Choices[j].Id) != null) { var Children = document.getElementById(AddedItems[Itemcount].Choices[j].Id); BindChildOptions(Children, Itemcount); } } else { document.getElementById(AddedItems[Itemcount].Choices[j].OptionId).value = unescape(AddedItems[Itemcount].Choices[j].ChoiceName); } } else { $('#' + AddedItems[Itemcount].Choices[j].OptionId).val(AddedItems[Itemcount].Choices[j].Id); } } ///FreeOptions FreeOptionCount = 0; var highest = Number.NEGATIVE_INFINITY; var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var j = 0; j < AddedItems[Itemcount].Choices.length; j++) { if (AddedItems[Itemcount].Choices[j].Type == "CheckBoxes") { for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == AddedItems[Itemcount].Choices[j].OptionId) { for (var H = 0; H < OptionsCheck[J].Choices.length; H++) { if (OptionsCheck[J].Choices[H].Id == AddedItems[Itemcount].Choices[j].Id) { OptionsCheck[J].Choices[H].FreeOptions = AddedItems[Itemcount].Choices[j].FreeOptions; OptionsCheck[J].Choices[H].SelectionCount = AddedItems[Itemcount].Choices[j].SelectionCount; tmp = OptionsCheck[J].Choices[H].SelectionCount; if (tmp > highest) { highest = tmp; } } } } } } } if (highest = Number.NEGATIVE_INFINITY) { FreeOptionCount = highest; } localStorage.setItem("OptionCheck", JSON.stringify(OptionsCheck)); ///FreeOptions if (OrderType != "Shipping") { if (AddedItems[Itemcount].Variations.length > 0) { for (var v = 0; v < AddedItems[Itemcount].Variations.length; v++) { $('#ddlVariation').val(AddedItems[Itemcount].Variations[v].Id); } } } } else { $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage2").css("display", "none"); } $("body").addClass("fullpanel"); if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "none"); $(".fcontainer").css("display", "none"); $(".Ordersmain").css("display", "none"); $(".orderdivr").css("display", "none"); $(".griditemsmodal").css("background-color", "white"); $(".griditemscroll").css("width", "100%"); $(".grditemspanel").fadeIn("slow"); $(".itemimageshow").css("width", "100%"); $(".itemimageshow").css("height", "320px"); $(".itemimageshow").css("object-fit", "cover"); $("#txtinstructions").css("margin-bottom", "100px;"); $(".txtinstructions").addClass("txtinstructionscs"); $("#lblitemmesg").css("display", "none"); $(".itemmain").css("display", "none"); $(".itemnamecs").css("display", "block"); $(".closeitemdiv").css("display", "block"); } else { $(".grditemspanel").fadeIn("slow"); } } else { $(".grditemspanel").fadeIn("slow"); } $(".btnloaderdiv").css("display", "none"); $(".addtocartdiv").css("display", "block"); } </script> <script type="text/javascript"> function closesignin() { document.getElementById('lblOpenPanel').innerHTML = ""; $(".signinpanel").css("display", "none"); $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage2").css("display", "none"); //$(".signinpanel").css("position", "inherit"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } function CloseOptions() { if (document.getElementById("BogoEditItem").innerHTML == "BogoEditItem") { ValidatingOptionsCheck(); document.getElementById("BogoEditItem").innerHTML = ""; } document.getElementById("displayMultipleImages").innerHTML = ""; //$(".grditemspanel").fadeOut("slow", function () { // $("body").removeClass("fullpanel"); //}); $("body").removeClass("fullpanel"); if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "block"); $(".fcontainer").css("display", "block"); $(".Ordersmain").css("display", "block"); $(".orderdivr").css("display", "block"); $(".griditemscroll").css("width", "90%"); $(".grditemspanel").fadeOut("slow"); } else { $(".grditemspanel").fadeOut("slow"); } } else { $(".grditemspanel").fadeOut("slow"); } $(".sortdown").removeAttr("style"); $('#lblitemintcount').css("display", "none"); $(".userregistration_contnet").attr("style", "height:100%;"); document.getElementById('grditemspanel').style.display = "none"; $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } function CloseCrossSell() { document.getElementById('CrossSellPanelStatus').innerHTML = "Closed"; $(".crosssellitemspanel").fadeOut("slow"); document.getElementById('crosssellitemspanel').style.display = "none"; // FinishOrderValidation(); var isTrigger = document.getElementById('GetCrossSellPanelStatus').innerHTML; if (isTrigger == "TriggerActive") { document.getElementById('CrossSellPanelStatus').innerHTML = "Opened"; } else { FinishOrderValidation(); } test = 0; } function CloseDeliverycheck() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.selectedIndex != -1) { var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; if (OrderType != "--Select Order Type--") { $("#ddlOrderType").css("border", ""); document.getElementById("lbldchange").innerHTML = ""; $("#txtaddress").removeClass("reqruiredc"); $("#txtvalidationcity").removeClass("reqruiredc"); $("#txtvalidationstate").removeClass("reqruiredc"); $(".addcategoryloadingimage1").css("display", "none"); if (localStorage.getItem("OrderType") != null) { OrderType = localStorage.getItem("OrderType"); OrderTypevalue = OrderType; $("#ddlOrderType").val(OrderTypevalue) if (OrderTypevalue == "Shipping") { var ShippingAddress = localStorage.getItem("ShippingAddress"); if(ShippingAddress != null){ if (document.getElementById('rbtShipping') != null) document.getElementById('rbtShipping').checked = true; } else { $("#ddlOrderType").val('--Select Order Type--').trigger('change'); localStorage.removeItem("OrderType"); localStorage.removeItem("OrderSelectionType"); NoOrderTypeSelected(); return; } } else if (OrderTypevalue == "Delivery") { var CheckedDeliveryAddress = localStorage.getItem("CheckedDeliveryAddress"); if(CheckedDeliveryAddress != null){ if (document.getElementById('rbtdelivery') != null) document.getElementById('rbtdelivery').checked = true; } else { $("#ddlOrderType").val('--Select Order Type--').trigger('change'); localStorage.removeItem("OrderType"); localStorage.removeItem("OrderSelectionType"); NoOrderTypeSelected(); return; } } else if (document.getElementById("lblPickupname").innerHTML.replace("&", "&") == OrderTypevalue) { if (document.getElementById("rbtpickup") != null) document.getElementById("rbtpickup").checked = true; } else if (document.getElementById("lblDineInname").innerHTML.replace("&", "&") == OrderTypevalue) { if (document.getElementById("rbtdinein") != null) document.getElementById("rbtdinein").checked = true; } else if (document.getElementById(OrderTypevalue) != null) document.getElementById(OrderTypevalue).checked = true; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{ GetDeal(); if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } $(".deliveryvalidationpanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $("#bntfnshedord").css("display", "inline-block"); $(".checkbtndiv").css("display", "inline-block"); } else NoOrderTypeSelected(); } else NoOrderTypeSelected(); } else NoOrderTypeSelected(); } function NoOrderTypeSelected() { alertify.set({ labels: { cancel: "Cancel", ok: "Ok" } }); alertify.confirm("Are you sure you want to close?", function (e) { if (e) { $(".mncatnewpopupsub .checkbtndiv").css("display","inline-block"); $(".mncatnewpopupsub .checkoutloaderdiv").css("display","none"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } $(".deliveryvalidationpanel").fadeOut("slow"); document.getElementById("lblItemId").innerHTML = ""; //ClearLocalStorage(); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { //BindItems(); } } $(".addcategoryloadingimage1").css("display", "none"); return; } else { var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberType; if (Details != null) { MemberType = Details.MemberType; } if (MemberType == "Member") { $(".deliveryvalidationpanel").fadeOut("slow"); } else { $(".deliveryvalidationpanel").fadeIn("slow"); } } }); } function LoadImage(id) { var P = $("#" + id).position(); if (P.top > 380) $(".addcategoryloadingimage1").css("padding-top", (P.top - 180)).css("display", "block").css("position", "absolute").css("margin-left", "0"); else $(".addcategoryloadingimage1").css("padding-top", 8).css("display", "block").css("position", "absolute").css("margin-left", "0"); } function ValidatingOptionsCheck() { $(".addtocartdiv").css("display", "none"); $(".btnloaderdiv").css("display", "block"); var OrderType = localStorage.getItem("OrderType"); var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].ItemId == document.getElementById("lblItemId").innerHTML.split('//')[0]) { } else { var sPath = window.location.pathname; $("#lblordalert").text("Something went wrong"); $(".orderalert").fadeIn(); //$(".btnloaderdiv").delay(3000).fadeOut(); //$(".addtocartdiv").delay(3000).fadeIn(); window.location.href = sPath; } } var retrievedData = localStorage.getItem("TotalItems"); var ItemCount = 0; if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var Itemdetails = document.getElementById("lblItemId").innerHTML.split('//'); if (AddedItems != null) { if (AddedItems.length > 0) { if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Id = document.getElementById("EditItemNum").innerHTML.replace("EditItem", ""); for (var cou = 0; cou < AddedItems.length; cou++) { if (Id != cou) { if (AddedItems[cou].Id == Itemdetails[0]) { ItemCount = parseInt(AddedItems[cou].Quantity) + ItemCount; } } } } else { for (var cou = 0; cou < AddedItems.length; cou++) { if (AddedItems[cou].Id == Itemdetails[0]) { ItemCount = parseInt(AddedItems[cou].Quantity) + ItemCount; } } } } } } var Qu = parseInt(document.getElementById('txtquantity').value); ItemCount = ItemCount + Qu; if (ItemCount > parseInt(localStorage.getItem("ItemAvailability"))) { document.getElementById("additemserror").innerHTML = "Available only " + localStorage.getItem("ItemAvailability") + " item(s)"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } var ddlvariation = $(".ddlVariation"); if (ddlvariation.length > 0) { if (ddlvariation[0].options[ddlvariation[0].selectedIndex].text == "Select Variation") { document.getElementById("additemserror").innerHTML = "Choose Variation"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } //var StockAvailability = 0; //var SelectedItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; //if (document.getElementById("qty" + SelectedItemId) != null) { // var Itemstock = $("#qty" + SelectedItemId).attr("name"); // if (Itemstock != "No Quantity") { // StockAvailability = Number(Itemstock); // if (Qu > StockAvailability) { // document.getElementById("additemserror").innerHTML = StockAvailability + " Items available only"; // return; // } // } //} for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].MinSize; var Maxvalue = OptionsCheck[J].MaxSize; var H = 0; var B = 0; $("input[name='Choiceradio" + OptionsCheck[J].Id + "']:checked").each(function () { if (document.getElementById("ddlQuantity" + this.id) != null) { B++; H = +H + +document.getElementById("ddlQuantity" + this.id).value; } else if (document.getElementById("Quantity" + this.id) != null) { B++; H = +H + +document.getElementById("Quantity" + this.id).value; } else { H++; } }); var Minval = parseInt(Minvalue); var Maxval = parseInt(Maxvalue); if (H >= Minval && H<=Maxval ) { document.getElementById("additemserror").innerHTML = ""; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } } } } } } } else { if (B > 0 || Minval>0) { if (H < Minval && Minval!=0) { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } else if (H > Maxval && Maxval!=0) { document.getElementById("additemserror").innerHTML = "Please select only " + Maxvalue + " item(s) from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } $('#' + OptionsCheck[J].Id).val(); } } var B = 0; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].OptionQuantity == true) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "") { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #C22727"; document.getElementById("additemserror").innerHTML = "Please enter quantity "; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); B++; } else if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "0") { document.getElementById("additemserror").innerHTML = "Quantity should be greater than zero"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); B++; } else { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #b9bcbe"; } } } } } if (B > 0) { return; } for (var J = 0; J < OptionsCheck.length; J++) { var TotalQuantity = 0; if (OptionsCheck[J].OptionQuantity == true) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value != "") { var quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; TotalQuantity = +quantity + +TotalQuantity; } } } var SelectionQuantity = OptionsCheck[J].QuantitySelection; if (TotalQuantity == SelectionQuantity) { } else { document.getElementById("additemserror").innerHTML = "Quantity doesn't match"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } } var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { AddItemstoCartinGrouporder(OptionsCheck); } else { AddItemstoCart(OptionsCheck, ""); } } function EditOfferItem(GetId, OfferName, OfferType) { var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != null) { var AddedItems = JSON.parse(retrievedData); AddedItems[AddedItems.length - 2].OfferFor = GetId; AddedItems[AddedItems.length - 2].OfferIndexValues = AddedItems.length - 1; AddedItems[AddedItems.length - 2].OfferItemQuantity = 1; AddedItems[AddedItems.length - 2].OfferName = OfferName; AddedItems[AddedItems.length - 2].OfferType = OfferType; AddedItems[AddedItems.length - 2].OfferValue = AddedItems[AddedItems.length - 2].BasePrice; localStorage.setItem("TotalItems", JSON.stringify(AddedItems)); ClearBogoOffer(); } } function AddItemstoCart(OptionsCheck, IsBogo, GetId, OfferName, OfferType) { var OfferItemExist = 0; var Itemdetails = document.getElementById("lblItemId").innerHTML.split('//'); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; // Offered Items Edit if (document.getElementById('lblcheckbogo').innerHTML == "BOGO" && document.getElementById("lblItemType").innerHTML == "EditItem") { var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != null) { var AddedItems = JSON.parse(retrievedData); for (var j1 = 0; j1 < AddedItems.length; j1++) { if (AddedItems[j1].Id == Itemdetails[0] && AddedItems[j1].OfferName != null && document.getElementById("EditItemNum").innerHTML.replace("EditItem", "") == j1) { document.getElementById("lblBogoItemId").innerHTML = AddedItems[j1].GetId; document.getElementById("lblBogoType").innerHTML = AddedItems[j1].OfferType; document.getElementById("lblBogoGetItemType").innerHTML = AddedItems[j1].GetItemType; document.getElementById("lblBogoId").innerHTML = AddedItems[j1].BOGOId; var OfferName = AddedItems[j1].OfferName; OfferName = unescape(OfferName); if (OfferName.includes("All Categories")) { DefaultOfferExist(OptionsCheck, Itemdetails[0]); } else { OfferExist(OptionsCheck, Itemdetails[0]); } OfferItemExist++; return; } } } } //Offered Items Add if (document.getElementById("lblbogovalidation").innerHTML == "Allcategories to Allcategories Bogo offer applied" || document.getElementById("lblbogovalidation").innerHTML == "Allcategories to item Bogo offer applied" || document.getElementById("lblbogovalidation").innerHTML == "Category to Allcategories Bogo offer applied" || document.getElementById("lblbogovalidation").innerHTML == "Item to Allcategories Bogo offer applied" || document.getElementById("lblbogovalidation").innerHTML == "Allcategories to category Bogo offer applied") { if (document.getElementById('lblcheckbogo').innerHTML == "BOGO" && document.getElementById("lblItemType").innerHTML == "EditItem") { { CrossSellPanelStatus = ""; var OrderType = localStorage.getItem("OrderType"); document.getElementById("additemserror").innerHTML = ""; var Price = 0; var totalprice = 0; var CustomTax = 0; var TaxLabel = ""; var Itemdetails = document.getElementById("lblItemId").innerHTML.split('//'); if (OrderType != "Shipping") { var checkbogo = document.getElementById('lblcheckbogo').innerHTML; if (checkbogo == "BOGO") OrderType = "CheckOfferExistOnBuyId"; else OrderType = ""; } var SubcategoryId = "00000000-0000-0000-0000-000000000000"; var SubSubcategoryId = "00000000-0000-0000-0000-000000000000"; var ItemCategoryId = "00000000-0000-0000-0000-000000000000"; $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + Itemdetails[0] + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { Price = msg.d[0].Price; CustomTax = msg.d[0].CustomTax; TaxLabel = escape(msg.d[0].TaxLabel); SubcategoryId = msg.d[0].SubCategoryId; SubSubcategoryId = msg.d[0].SubSubCategoryId; ItemCategoryId = msg.d[0].ItemMainCategoryId; } var d = 0; ///Recalculating ItemPrice before adding to cart if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].ItemId == Itemdetails[0]) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if($("#"+OptionsCheck[J].Choices[F].Id).hasClass("Validate")){ var Q = 0; var price = OptionsCheck[J].Choices[F].Price; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = +Q + +document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } if (Q > 0) price = OptionsCheck[J].Choices[F].Price * Q if (OptionsCheck[J].Choices[F].FreeOptions != "Yes") { if (OptionsCheck[J].Chargable == true) { d = +price + +d; } } if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions != "Yes") { d = +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } else { var sPath = window.location.pathname; $("#lblordalert").text("Something went wrong"); $(".orderalert").fadeIn(); window.location.href = sPath; } } } else { for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].ItemId == Itemdetails[0]) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { var Q = 0; var price = OptionsCheck[J].Choices[F].Price; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = +Q + +document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } if (Q > 0) price = OptionsCheck[J].Choices[F].Price * Q if (OptionsCheck[J].Choices[F].FreeOptions != "Yes") { if (OptionsCheck[J].Chargable == true) { d = +price + +d; } } if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions != "Yes") { d = +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } else { var sPath = window.location.pathname; $("#lblordalert").text("Something went wrong"); $(".orderalert").fadeIn(); window.location.href = sPath; } } } var allselect = document.getElementsByTagName("select"); if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { if (OptionsCheck[J].Type == "Dropdown" && OptionsCheck[J].Id == allselect[i].id) { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (ChoiceId == OptionsCheck[J].Choices[C].Id) { d = (+d + +OptionsCheck[J].Choices[C].Price); } } } } } } } } } } } else { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { if (OptionsCheck[J].Type == "Dropdown" && OptionsCheck[J].Id == allselect[i].id) { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (ChoiceId == OptionsCheck[J].Choices[C].Id) { d = (+d + +OptionsCheck[J].Choices[C].Price); } } } } } } } } } } } if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlChildOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (OptionsCheck[J].Choices[C].Exist == true) { if (OptionsCheck[J].Choices[C].ChildOptions != undefined) { for (var L = 0; L < OptionsCheck[J].Choices[C].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[C].ChildOptions[L].Type == "Dropdown") { if ($("#" + OptionsCheck[J].Choices[C].ChildOptions[L].Id).hasClass("Validate")) { for (var U = 0; U < OptionsCheck[J].Choices[C].ChildOptions[L].Choices.length; U++) { if (ChoiceId == OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Id) { d = +OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } } } } } } else { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlChildOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (OptionsCheck[J].Choices[C].Exist == true) { if (OptionsCheck[J].Choices[C].ChildOptions != undefined) { for (var L = 0; L < OptionsCheck[J].Choices[C].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[C].ChildOptions[L].Type == "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[C].ChildOptions[L].Choices.length; U++) { if (ChoiceId == OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Id) { d = +OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } } } } } d = +d + +Price; var ddlvariation = $(".ddlVariation"); if (ddlvariation.length > 0) { if (ddlvariation[0].options[ddlvariation[0].selectedIndex].text != "Select Variation") { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { d = (+Variations[J].Price + +d); } } } } } // if (localStorage.getItem("OrderType") == "Shipping") { if (msg.d[0].ShippingItems.length > 0) { for (var i = 0; i < msg.d[0].ShippingItems.length; i++) { if ($('#' + msg.d[0].ShippingItems[i].Id).is(':checked')) { d = +d + +msg.d[0].ShippingItems[i].Price; } } } // } var Qty = document.getElementById('txtquantity').value; if (localStorage.getItem("priceType") == "Per Unit") { Qty = Qty * document.getElementById('txtunitquantity').value; } totalprice = (Qty * d); totalprice = totalprice.toFixed(2); if (totalprice != "0.00") { var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); localStorage.setItem("Page", JSON.stringify(sPage)); var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var Items = new Array(); var Item = new Object; if (AddedItems != null) { if (AddedItems.length > 0) { Item.ItemName = escape(Itemdetails[1]); Item.Id = Itemdetails[0]; Item.PosId = Itemdetails[3]; Item.NoSalesTax = document.getElementById('lblItemNoTax').innerHTML; Item.CustomTax = document.getElementById("lblCustomTax").innerHTML; Item.TaxLabel = document.getElementById("lblTaxLabel").innerHTML; Item.Instructions = escape(document.getElementById('txtinstructions').value); $("#Instructions").attr("placeholder", Item.Instructions); Item.Quantity = document.getElementById('txtquantity').value; if (localStorage.getItem("priceType") == "Per Unit") { Item.ItemUnitQty = document.getElementById('txtunitquantity').value; Item.PriceType = localStorage.getItem("priceType"); Item.UnitName = localStorage.getItem("UnitType"); } Item.Price = totalprice; var OrderType = localStorage.getItem("OrderType"); Item.OrderType = OrderType; Item.LId = document.getElementById('lblLId').value; Item.AppName = escape(document.getElementById('lblAppName').innerHTML); Item.MainCategoryId = document.getElementById("lblMainCategoryId").innerHTML; Item.ItemCategoryId = ItemCategoryId; Item.SubcategoryId = SubcategoryId; Item.SubSubCategoryId = SubSubcategoryId; document.getElementById('txtinstructions').value = ""; Item.Choices = new Array(); // if (localStorage.getItem("OrderType") == "Shipping") { for (var i = 0; i < msg.d[0].ShippingItems.length; i++) { if ($('#' + msg.d[0].ShippingItems[i].Id).is(':checked')) { var Choice = new Object; Choice.Id = msg.d[0].ShippingItems[i].Id; Choice.ItemId = msg.d[0].ShippingItems[i].ItemId; Choice.Measurement = msg.d[0].ShippingItems[i].Measurement; Choice.Price = msg.d[0].ShippingItems[i].Price; Choice.Weight = msg.d[0].ShippingItems[i].Weight; var Weight = 0; if (Choice.Measurement == "Oz") { Weight = +Weight + +(Choice.Weight * 0.0625); } else if (Choice.Measurement == "gm") { Weight = +Weight + +(Choice.Weight * 0.00220462); } else if (Choice.Measurement == "kg") { Weight = +Weight + +(Choice.Weight * 2.20462); } else if (Choice.Measurement == "tons") { Weight = +Weight + +(Choice.Weight * 2000); } else { Weight = +Weight + +Choice.Weight; } Weight = Weight * Item.Quantity; Weight = Weight.toFixed(2); Weight = Weight + " Pounds"; Choice.Conversation = Weight; Item.Choices.push(Choice); } } // } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Type != "Multiline Textbox" && OptionsCheck[J].Type != "Dropdown") { if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if ($('#' + OptionsCheck[J].Choices[F].Id).hasClass("Validate")) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } else { if ($('#' + OptionsCheck[J].Choices[F].Id).hasClass("Validate")) { if (OptionsCheck[J].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].DefaultVSOption == true) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].DefaultOptionText) + " : " + escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } } } } } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } else { if (OptionsCheck[J].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].DefaultVSOption == true) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } } } } } else if (OptionsCheck[J].Type == "Dropdown") { if ($("#" + OptionsCheck[J].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Id).val() != "") { var ChoiceId = $('#' + OptionsCheck[J].Id).val().split('/')[0]; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if (ChoiceId == OptionsCheck[J].Choices[F].Id) { var Choice = new Object; Choice.OptionId = OptionsCheck[J].Id Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.Id = OptionsCheck[J].Choices[F].Id Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = escape(OptionsCheck[J].Choices[F].Price); Choice.PosId = OptionsCheck[J].PosId; Choice.ChildChoices = new Array(); Item.Choices.push(Choice); } } } } } else { var Choice = new Object; Choice.Id = ""; Choice.OptionId = OptionsCheck[J].Id; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Notify = (OptionsCheck[J].Notify); Choice.DefaultVSOption = (OptionsCheck[J].DefaultVSOption); Choice.Type = OptionsCheck[J].Type; if (document.getElementById(Choice.OptionId).value != "") { Choice.ChoiceName = escape(document.getElementById(Choice.OptionId).value); Item.Choices.push(Choice); } } } Item.Variations = new Array(); if (ddlvariation.length > 0) { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { var Variation = new Object; Variation.Id = Variations[J].Id; Variation.Name = Variations[J].Name; Item.Variations.push(Variation); } } } } Item.CategoryId = msg.d[0].CategoryId; Item.AddedDate = new Date(); Item.BasePrice = parseFloat((document.getElementById("PriceVal").innerHTML) * (document.getElementById('txtquantity').value)).toFixed(2); Items.push(Item); //stroing categoryid,quantity and itemid in the CartAddedItemsList for the purpose of offer checking var allItems; var OldItemQuantity = ""; var EditedIndexValue = ""; if (document.getElementById("lblItemType").innerHTML == "AddItem") { allItems = AddedItems.concat(Items); localStorage.setItem("TotalItems", JSON.stringify(allItems)); setQuantitytoCart(); } else if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Id = document.getElementById("EditItemNum").innerHTML.replace("EditItem", ""); if (AddedItems != null) { if (parseInt(AddedItems[Id].Quantity) > parseInt(document.getElementById('txtquantity').value) && document.getElementById('lblcheckbogo').innerHTML == "BOGO") { OldItemQuantity = AddedItems[Id].Quantity; EditedIndexValue = Id; BoogOfferItemChanges(Id, msg.d[0].BOGOOffers);//methode should call if offer exist } AddedItems.splice(Id, 1, Item); localStorage.setItem("TotalItems", JSON.stringify(AddedItems)); } } //code for offer exists if (msg.d[0].BOGOOffers != null && msg.d[0].BOGOOffers != "" && IsBogo != "FromBOGO") { // OldItemQuantity,EditedIndexValue passed only for the edit item ConfirmBogoOffer(Itemdetails, msg.d[0].BOGOOffers, msg.d[0].CategoryId, Item.Quantity, OldItemQuantity, EditedIndexValue) } else { $(".displayonitem").css("display", "block"); if (localStorage.getItem("OrderType") == "DineInOnly") { // $(".yourordersteststyles").css("display", "none") } else { $(".yourordersteststyles").css("display", "inline-block"); } TimeIntervel(Item.Time, localStorage.getItem("TIntervel")); } } else AddFirstItem(Itemdetails, totalprice, msg.d[0].BOGOOffers, msg.d[0].CategoryId, msg.d[0].ShippingItems, CustomTax, TaxLabel, SubcategoryId, SubSubcategoryId, ItemCategoryId); } else AddFirstItem(Itemdetails, totalprice, msg.d[0].BOGOOffers, msg.d[0].CategoryId, msg.d[0].ShippingItems, CustomTax, TaxLabel, SubcategoryId, SubSubcategoryId, ItemCategoryId); } else AddFirstItem(Itemdetails, totalprice, msg.d[0].BOGOOffers, msg.d[0].CategoryId, msg.d[0].ShippingItems, CustomTax, TaxLabel, SubcategoryId, SubSubcategoryId, ItemCategoryId); if (IsBogo == "FromBOGO") { EditOfferItem(GetId, OfferName, OfferType); } $("body").removeClass("fullpanel"); var ItemId = Itemdetails[0]; var ItemName = Itemdetails[1]; if (document.getElementById("lblItemType").innerHTML != "EditItem") { GetCrossSellItems(ItemId, ItemName); } else { if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "block"); $(".fcontainer").css("display", "block"); $(".Ordersmain").css("display", "block"); $(".orderdivr").css("display", "block"); $(".griditemscroll").css("width", "90%"); document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".mblcheckbtndiv").css("display", "inline-block"); } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".checkbtndiv").css("display", "inline-block"); } } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } } } else { $("#lblorderror").text("This item is not selectable. Please choose other items."); $(".ordererror").show().delay(3000).fadeOut(); $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); } } }); } } else { if (document.getElementById("lblbuyitemname").innerHTML == "" && document.getElementById("lblgetitemname").innerHTML == "") { CrossSellPanelStatus = ""; var OrderType = localStorage.getItem("OrderType"); document.getElementById("additemserror").innerHTML = ""; var Price = 0; var totalprice = 0; var CustomTax = 0; var TaxLabel = ""; var Itemdetails = document.getElementById("lblItemId").innerHTML.split('//'); if (OrderType != "Shipping") { var checkbogo = document.getElementById('lblcheckbogo').innerHTML; if (checkbogo == "BOGO") OrderType = "CheckOfferExistOnBuyId"; else OrderType = ""; } var SubcategoryId = "00000000-0000-0000-0000-000000000000"; var SubSubcategoryId = "00000000-0000-0000-0000-000000000000"; var ItemCategoryId = "00000000-0000-0000-0000-000000000000"; $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + Itemdetails[0] + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { Price = msg.d[0].Price; CustomTax = msg.d[0].CustomTax; TaxLabel = escape(msg.d[0].TaxLabel); SubcategoryId = msg.d[0].SubCategoryId; SubSubcategoryId = msg.d[0].SubSubCategoryId; ItemCategoryId = msg.d[0].ItemMainCategoryId; } var d = 0; ///Recalculating ItemPrice before adding to cart if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].ItemId == Itemdetails[0]) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if($("#"+OptionsCheck[J].Choices[F].Id).hasClass("Validate")){ var Q = 0; var price = OptionsCheck[J].Choices[F].Price; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = +Q + +document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } if (Q > 0) price = OptionsCheck[J].Choices[F].Price * Q if (OptionsCheck[J].Choices[F].FreeOptions != "Yes") { if (OptionsCheck[J].Chargable == true) { d = +price + +d; } } if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions != "Yes") { d = +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } else { var sPath = window.location.pathname; $("#lblordalert").text("Something went wrong"); $(".orderalert").fadeIn(); window.location.href = sPath; } } } else { for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].ItemId == Itemdetails[0]) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { var Q = 0; var price = OptionsCheck[J].Choices[F].Price; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = +Q + +document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } if (Q > 0) price = OptionsCheck[J].Choices[F].Price * Q if (OptionsCheck[J].Choices[F].FreeOptions != "Yes") { if (OptionsCheck[J].Chargable == true) { d = +price + +d; } } if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions != "Yes") { d = +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } else { var sPath = window.location.pathname; $("#lblordalert").text("Something went wrong"); $(".orderalert").fadeIn(); window.location.href = sPath; } } } var allselect = document.getElementsByTagName("select"); if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { if (OptionsCheck[J].Type == "Dropdown" && OptionsCheck[J].Id == allselect[i].id) { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (ChoiceId == OptionsCheck[J].Choices[C].Id) { d = (+d + +OptionsCheck[J].Choices[C].Price); } } } } } } } } } } } else { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { if (OptionsCheck[J].Type == "Dropdown" && OptionsCheck[J].Id == allselect[i].id) { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (ChoiceId == OptionsCheck[J].Choices[C].Id) { d = (+d + +OptionsCheck[J].Choices[C].Price); } } } } } } } } } } } if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlChildOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (OptionsCheck[J].Choices[C].Exist == true) { if (OptionsCheck[J].Choices[C].ChildOptions != undefined) { for (var L = 0; L < OptionsCheck[J].Choices[C].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[C].ChildOptions[L].Type == "Dropdown") { if ($("#" + OptionsCheck[J].Choices[C].ChildOptions[L].Id).hasClass("Validate")) { for (var U = 0; U < OptionsCheck[J].Choices[C].ChildOptions[L].Choices.length; U++) { if (ChoiceId == OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Id) { d = +OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } } } } } } else { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlChildOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (OptionsCheck[J].Choices[C].Exist == true) { if (OptionsCheck[J].Choices[C].ChildOptions != undefined) { for (var L = 0; L < OptionsCheck[J].Choices[C].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[C].ChildOptions[L].Type == "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[C].ChildOptions[L].Choices.length; U++) { if (ChoiceId == OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Id) { d = +OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } } } } } d = +d + +Price; var ddlvariation = $(".ddlVariation"); if (ddlvariation.length > 0) { if (ddlvariation[0].options[ddlvariation[0].selectedIndex].text != "Select Variation") { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { d = (+Variations[J].Price + +d); } } } } } // if (localStorage.getItem("OrderType") == "Shipping") { if (msg.d[0].ShippingItems.length > 0) { for (var i = 0; i < msg.d[0].ShippingItems.length; i++) { if ($('#' + msg.d[0].ShippingItems[i].Id).is(':checked')) { d = +d + +msg.d[0].ShippingItems[i].Price; } } } // } var Qty = document.getElementById('txtquantity').value; if (localStorage.getItem("priceType") == "Per Unit") { Qty = Qty * document.getElementById('txtunitquantity').value; } totalprice = (Qty * d); totalprice = totalprice.toFixed(2); if (totalprice != "0.00") { var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); localStorage.setItem("Page", JSON.stringify(sPage)); var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var Items = new Array(); var Item = new Object; if (AddedItems != null) { if (AddedItems.length > 0) { Item.ItemName = escape(Itemdetails[1]); Item.Id = Itemdetails[0]; Item.PosId = Itemdetails[3]; Item.NoSalesTax = document.getElementById('lblItemNoTax').innerHTML; Item.CustomTax = document.getElementById("lblCustomTax").innerHTML; Item.TaxLabel = document.getElementById("lblTaxLabel").innerHTML; Item.Instructions = escape(document.getElementById('txtinstructions').value); $("#Instructions").attr("placeholder", Item.Instructions); Item.Quantity = document.getElementById('txtquantity').value; if (localStorage.getItem("priceType") == "Per Unit") { Item.ItemUnitQty = document.getElementById('txtunitquantity').value; Item.PriceType = localStorage.getItem("priceType"); Item.UnitName = localStorage.getItem("UnitType"); } Item.Price = totalprice; var OrderType = localStorage.getItem("OrderType"); Item.OrderType = OrderType; Item.LId = document.getElementById('lblLId').value; Item.AppName = escape(document.getElementById('lblAppName').innerHTML); Item.MainCategoryId = document.getElementById("lblMainCategoryId").innerHTML; Item.ItemCategoryId = ItemCategoryId; Item.SubcategoryId = SubcategoryId; Item.SubSubCategoryId = SubSubcategoryId; document.getElementById('txtinstructions').value = ""; Item.Choices = new Array(); // if (localStorage.getItem("OrderType") == "Shipping") { for (var i = 0; i < msg.d[0].ShippingItems.length; i++) { if ($('#' + msg.d[0].ShippingItems[i].Id).is(':checked')) { var Choice = new Object; Choice.Id = msg.d[0].ShippingItems[i].Id; Choice.ItemId = msg.d[0].ShippingItems[i].ItemId; Choice.Measurement = msg.d[0].ShippingItems[i].Measurement; Choice.Price = msg.d[0].ShippingItems[i].Price; Choice.Weight = msg.d[0].ShippingItems[i].Weight; var Weight = 0; if (Choice.Measurement == "Oz") { Weight = +Weight + +(Choice.Weight * 0.0625); } else if (Choice.Measurement == "gm") { Weight = +Weight + +(Choice.Weight * 0.00220462); } else if (Choice.Measurement == "kg") { Weight = +Weight + +(Choice.Weight * 2.20462); } else if (Choice.Measurement == "tons") { Weight = +Weight + +(Choice.Weight * 2000); } else { Weight = +Weight + +Choice.Weight; } Weight = Weight * Item.Quantity; Weight = Weight.toFixed(2); Weight = Weight + " Pounds"; Choice.Conversation = Weight; Item.Choices.push(Choice); } } // } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Type != "Multiline Textbox" && OptionsCheck[J].Type != "Dropdown") { if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if ($("#" + OptionsCheck[J].Choices[F].Id).hasClass("Validate")) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } else { if ($("#" + OptionsCheck[J].Choices[F].Id).hasClass("Validate")) { if (OptionsCheck[J].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].DefaultVSOption == true) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } } } } } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } else { if (OptionsCheck[J].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].DefaultVSOption == true) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } } } } } else if (OptionsCheck[J].Type == "Dropdown") { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Id).val() != "") { var ChoiceId = $('#' + OptionsCheck[J].Id).val().split('/')[0]; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if (ChoiceId == OptionsCheck[J].Choices[F].Id) { var Choice = new Object; Choice.OptionId = OptionsCheck[J].Id Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.Id = OptionsCheck[J].Choices[F].Id Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = escape(OptionsCheck[J].Choices[F].Price); Choice.PosId = OptionsCheck[J].PosId; Choice.ChildChoices = new Array(); Item.Choices.push(Choice); } } } } } else { var Choice = new Object; Choice.Id = ""; Choice.OptionId = OptionsCheck[J].Id; Choice.Notify = OptionsCheck[J].Notify; Choice.DefaultVSOption = OptionsCheck[J].DefaultVSOption; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; if (document.getElementById(Choice.OptionId).value != "") { Choice.ChoiceName = escape(document.getElementById(Choice.OptionId).value); Item.Choices.push(Choice); } } } Item.Variations = new Array(); if (ddlvariation.length > 0) { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { var Variation = new Object; Variation.Id = Variations[J].Id; Variation.Name = Variations[J].Name; Item.Variations.push(Variation); } } } } Item.CategoryId = msg.d[0].CategoryId; Item.AddedDate = new Date(); Item.BasePrice = parseFloat((document.getElementById("PriceVal").innerHTML) * (document.getElementById('txtquantity').value)).toFixed(2); Items.push(Item); //stroing categoryid,quantity and itemid in the CartAddedItemsList for the purpose of offer checking var allItems; var OldItemQuantity = ""; var EditedIndexValue = ""; if (document.getElementById("lblItemType").innerHTML == "AddItem") { allItems = AddedItems.concat(Items); localStorage.setItem("TotalItems", JSON.stringify(allItems)); setQuantitytoCart(); } else if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Id = document.getElementById("EditItemNum").innerHTML.replace("EditItem", ""); if (AddedItems != null) { if (parseInt(AddedItems[Id].Quantity) > parseInt(document.getElementById('txtquantity').value) && document.getElementById('lblcheckbogo').innerHTML == "BOGO") { OldItemQuantity = AddedItems[Id].Quantity; EditedIndexValue = Id; BoogOfferItemChanges(Id, msg.d[0].BOGOOffers);//methode should call if offer exist } AddedItems.splice(Id, 1, Item); localStorage.setItem("TotalItems", JSON.stringify(AddedItems)); } } //code for offer exists if (msg.d[0].BOGOOffers != null && msg.d[0].BOGOOffers != "" && IsBogo != "FromBOGO") { // OldItemQuantity,EditedIndexValue passed only for the edit item ConfirmBogoOffer(Itemdetails, msg.d[0].BOGOOffers, msg.d[0].CategoryId, Item.Quantity, OldItemQuantity, EditedIndexValue) } else { $(".displayonitem").css("display", "block"); if (localStorage.getItem("OrderType") == "DineInOnly") { // $(".yourordersteststyles").css("display", "none") } else { $(".yourordersteststyles").css("display", "inline-block"); } TimeIntervel(Item.Time, localStorage.getItem("TIntervel")); } } else AddFirstItem(Itemdetails, totalprice, msg.d[0].BOGOOffers, msg.d[0].CategoryId, msg.d[0].ShippingItems, CustomTax, TaxLabel, SubcategoryId, SubSubcategoryId, ItemCategoryId); } else AddFirstItem(Itemdetails, totalprice, msg.d[0].BOGOOffers, msg.d[0].CategoryId, msg.d[0].ShippingItems, CustomTax, TaxLabel, SubcategoryId, SubSubcategoryId, ItemCategoryId); } else AddFirstItem(Itemdetails, totalprice, msg.d[0].BOGOOffers, msg.d[0].CategoryId, msg.d[0].ShippingItems, CustomTax, TaxLabel, SubcategoryId, SubSubcategoryId, ItemCategoryId); if (IsBogo == "FromBOGO") { EditOfferItem(GetId, OfferName, OfferType); } $("body").removeClass("fullpanel"); var ItemId = Itemdetails[0]; var ItemName = Itemdetails[1]; if (document.getElementById("lblItemType").innerHTML != "EditItem") { GetCrossSellItems(ItemId, ItemName); } else { if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "block"); $(".fcontainer").css("display", "block"); $(".Ordersmain").css("display", "block"); $(".orderdivr").css("display", "block"); $(".griditemscroll").css("width", "90%"); document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".mblcheckbtndiv").css("display", "inline-block"); } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".checkbtndiv").css("display", "inline-block"); } } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } } } else { $("#lblorderror").text("This item is not selectable. Please choose other items."); $(".ordererror").show().delay(3000).fadeOut(); $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); } } }); } else { if (document.getElementById("lblbuyitemname").innerHTML == "All Categories" && $("#lblgetitemname").text().includes("Category")) { if (document.getElementById("lblbogocategoryid").innerHTML == document.getElementById("lblcategoryid").innerHTML) { DefaultOfferExist(OptionsCheck, Itemdetails[0]); document.getElementById("lblbogocategoryid").innerHTML = ""; document.getElementById("lblcategoryid").innerHTML = ""; document.getElementById("lblgetitemid").innerHTML = Itemdetails[0]; //document.getElementById("lblbogovalidation").innerHTML = "Offer applied only one time"; //document.getElementById("lblbogovalidation").innerHTML = ""; } else { CrossSellPanelStatus = ""; var OrderType = localStorage.getItem("OrderType"); document.getElementById("additemserror").innerHTML = ""; var Price = 0; var totalprice = 0; var CustomTax = 0; var TaxLabel = ""; var Itemdetails = document.getElementById("lblItemId").innerHTML.split('//'); if (OrderType != "Shipping") { var checkbogo = document.getElementById('lblcheckbogo').innerHTML; if (checkbogo == "BOGO") OrderType = "CheckOfferExistOnBuyId"; else OrderType = ""; } var SubcategoryId = "00000000-0000-0000-0000-000000000000"; var SubSubcategoryId = "00000000-0000-0000-0000-000000000000"; var ItemCategoryId = "00000000-0000-0000-0000-000000000000"; $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + Itemdetails[0] + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { Price = msg.d[0].Price; CustomTax = msg.d[0].CustomTax; TaxLabel = escape(msg.d[0].TaxLabel); SubcategoryId = msg.d[0].SubCategoryId; SubSubcategoryId = msg.d[0].SubSubCategoryId; ItemCategoryId = msg.d[0].ItemMainCategoryId; } var d = 0; ///Recalculating ItemPrice before adding to cart if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].ItemId == Itemdetails[0]) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if($("#"+OptionsCheck[J].Choices[F].Id).hasClass("Validate")){ var Q = 0; var price = OptionsCheck[J].Choices[F].Price; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = +Q + +document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } if (Q > 0) price = OptionsCheck[J].Choices[F].Price * Q if (OptionsCheck[J].Choices[F].FreeOptions != "Yes") { if (OptionsCheck[J].Chargable == true) { d = +price + +d; } } if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions != "Yes") { d = +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } else { var sPath = window.location.pathname; $("#lblordalert").text("Something went wrong"); $(".orderalert").fadeIn(); window.location.href = sPath; } } } else { for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].ItemId == Itemdetails[0]) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { var Q = 0; var price = OptionsCheck[J].Choices[F].Price; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = +Q + +document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } if (Q > 0) price = OptionsCheck[J].Choices[F].Price * Q if (OptionsCheck[J].Choices[F].FreeOptions != "Yes") { if (OptionsCheck[J].Chargable == true) { d = +price + +d; } } if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions != "Yes") { d = +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } else { var sPath = window.location.pathname; $("#lblordalert").text("Something went wrong"); $(".orderalert").fadeIn(); window.location.href = sPath; } } } var allselect = document.getElementsByTagName("select"); if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { if (OptionsCheck[J].Type == "Dropdown" && OptionsCheck[J].Id == allselect[i].id) { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (ChoiceId == OptionsCheck[J].Choices[C].Id) { d = (+d + +OptionsCheck[J].Choices[C].Price); } } } } } } } } } } } else { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { if (OptionsCheck[J].Type == "Dropdown" && OptionsCheck[J].Id == allselect[i].id) { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (ChoiceId == OptionsCheck[J].Choices[C].Id) { d = (+d + +OptionsCheck[J].Choices[C].Price); } } } } } } } } } } } if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlChildOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (OptionsCheck[J].Choices[C].Exist == true) { if (OptionsCheck[J].Choices[C].ChildOptions != undefined) { for (var L = 0; L < OptionsCheck[J].Choices[C].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[C].ChildOptions[L].Type == "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[C].ChildOptions[L].Choices.length; U++) { if (ChoiceId == OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Id) { d = +OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } } } } } else { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlChildOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (OptionsCheck[J].Choices[C].Exist == true) { if (OptionsCheck[J].Choices[C].ChildOptions != undefined) { for (var L = 0; L < OptionsCheck[J].Choices[C].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[C].ChildOptions[L].Type == "Dropdown") { if ($("#" + OptionsCheck[J].Choices[C].ChildOptions[L].Id).hasClass("Validate")) { for (var U = 0; U < OptionsCheck[J].Choices[C].ChildOptions[L].Choices.length; U++) { if (ChoiceId == OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Id) { d = +OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } } } } } } d = +d + +Price; var ddlvariation = $(".ddlVariation"); if (ddlvariation.length > 0) { if (ddlvariation[0].options[ddlvariation[0].selectedIndex].text != "Select Variation") { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { d = (+Variations[J].Price + +d); } } } } } // if (localStorage.getItem("OrderType") == "Shipping") { if (msg.d[0].ShippingItems.length > 0) { for (var i = 0; i < msg.d[0].ShippingItems.length; i++) { if ($('#' + msg.d[0].ShippingItems[i].Id).is(':checked')) { d = +d + +msg.d[0].ShippingItems[i].Price; } } } // } var Qty = document.getElementById('txtquantity').value; if (localStorage.getItem("priceType") == "Per Unit") { Qty = Qty * document.getElementById('txtunitquantity').value; } totalprice = (Qty * d); totalprice = totalprice.toFixed(2); if (totalprice != "0.00") { var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); localStorage.setItem("Page", JSON.stringify(sPage)); var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var Items = new Array(); var Item = new Object; if (AddedItems != null) { if (AddedItems.length > 0) { Item.ItemName = escape(Itemdetails[1]); Item.Id = Itemdetails[0]; Item.PosId = Itemdetails[3]; Item.NoSalesTax = document.getElementById('lblItemNoTax').innerHTML; Item.CustomTax = document.getElementById("lblCustomTax").innerHTML; Item.TaxLabel = document.getElementById("lblTaxLabel").innerHTML; Item.Instructions = escape(document.getElementById('txtinstructions').value); $("#Instructions").attr("placeholder", Item.Instructions); Item.Quantity = document.getElementById('txtquantity').value; if (localStorage.getItem("priceType") == "Per Unit") { Item.ItemUnitQty = document.getElementById('txtunitquantity').value; Item.PriceType = localStorage.getItem("priceType"); Item.UnitName = localStorage.getItem("UnitType"); } Item.Price = totalprice; var OrderType = localStorage.getItem("OrderType"); Item.OrderType = OrderType; Item.LId = document.getElementById('lblLId').value; Item.AppName = escape(document.getElementById('lblAppName').innerHTML); Item.MainCategoryId = document.getElementById("lblMainCategoryId").innerHTML; Item.ItemCategoryId = ItemCategoryId; Item.SubcategoryId = SubcategoryId; Item.SubSubCategoryId = SubSubcategoryId; document.getElementById('txtinstructions').value = ""; Item.Choices = new Array(); // if (localStorage.getItem("OrderType") == "Shipping") { for (var i = 0; i < msg.d[0].ShippingItems.length; i++) { if ($('#' + msg.d[0].ShippingItems[i].Id).is(':checked')) { var Choice = new Object; Choice.Id = msg.d[0].ShippingItems[i].Id; Choice.ItemId = msg.d[0].ShippingItems[i].ItemId; Choice.Measurement = msg.d[0].ShippingItems[i].Measurement; Choice.Price = msg.d[0].ShippingItems[i].Price; Choice.Weight = msg.d[0].ShippingItems[i].Weight; var Weight = 0; if (Choice.Measurement == "Oz") { Weight = +Weight + +(Choice.Weight * 0.0625); } else if (Choice.Measurement == "gm") { Weight = +Weight + +(Choice.Weight * 0.00220462); } else if (Choice.Measurement == "kg") { Weight = +Weight + +(Choice.Weight * 2.20462); } else if (Choice.Measurement == "tons") { Weight = +Weight + +(Choice.Weight * 2000); } else { Weight = +Weight + +Choice.Weight; } Weight = Weight * Item.Quantity; Weight = Weight.toFixed(2); Weight = Weight + " Pounds"; Choice.Conversation = Weight; Item.Choices.push(Choice); } } // } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Type != "Multiline Textbox" && OptionsCheck[J].Type != "Dropdown") { if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if ($('#' + OptionsCheck[J].Choices[F].Id).hasClass("Validate")) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if(OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes"){ if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } else { if ($('#' + OptionsCheck[J].Choices[F].Id).hasClass("Validate")) { if (OptionsCheck[J].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].DefaultVSOption == true) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].DefaultOptionText) + " : " + escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } } } } } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } else { if (OptionsCheck[J].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].DefaultVSOption == true) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].DefaultOptionText) + " : " + escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } } } } } else if (OptionsCheck[J].Type == "Dropdown") { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Id).val() != "") { var ChoiceId = $('#' + OptionsCheck[J].Id).val().split('/')[0]; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if (ChoiceId == OptionsCheck[J].Choices[F].Id) { var Choice = new Object; Choice.OptionId = OptionsCheck[J].Id Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = escape(OptionsCheck[J].Choices[F].Price); Choice.PosId = OptionsCheck[J].PosId; Choice.ChildChoices = new Array(); Item.Choices.push(Choice); } } } } } else { var Choice = new Object; Choice.Id = ""; Choice.OptionId = OptionsCheck[J].Id; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Notify = (OptionsCheck[J].Notify); Choice.DefaultVSOption = (OptionsCheck[J].DefaultVSOption); Choice.Type = OptionsCheck[J].Type; if (document.getElementById(Choice.OptionId).value != "") { Choice.ChoiceName = escape(document.getElementById(Choice.OptionId).value); Item.Choices.push(Choice); } } } Item.Variations = new Array(); if (ddlvariation.length > 0) { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { var Variation = new Object; Variation.Id = Variations[J].Id; Variation.Name = Variations[J].Name; Item.Variations.push(Variation); } } } } Item.CategoryId = msg.d[0].CategoryId; Item.AddedDate = new Date(); Item.BasePrice = parseFloat((document.getElementById("PriceVal").innerHTML) * (document.getElementById('txtquantity').value)).toFixed(2); Items.push(Item); //stroing categoryid,quantity and itemid in the CartAddedItemsList for the purpose of offer checking var allItems; var OldItemQuantity = ""; var EditedIndexValue = ""; if (document.getElementById("lblItemType").innerHTML == "AddItem") { allItems = AddedItems.concat(Items); localStorage.setItem("TotalItems", JSON.stringify(allItems)); setQuantitytoCart(); } else if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Id = document.getElementById("EditItemNum").innerHTML.replace("EditItem", ""); if (AddedItems != null) { if (parseInt(AddedItems[Id].Quantity) > parseInt(document.getElementById('txtquantity').value) && document.getElementById('lblcheckbogo').innerHTML == "BOGO") { OldItemQuantity = AddedItems[Id].Quantity; EditedIndexValue = Id; BoogOfferItemChanges(Id, msg.d[0].BOGOOffers);//methode should call if offer exist } AddedItems.splice(Id, 1, Item); localStorage.setItem("TotalItems", JSON.stringify(AddedItems)); } } //code for offer exists if (msg.d[0].BOGOOffers != null && msg.d[0].BOGOOffers != "" && IsBogo != "FromBOGO") { // OldItemQuantity,EditedIndexValue passed only for the edit item ConfirmBogoOffer(Itemdetails, msg.d[0].BOGOOffers, msg.d[0].CategoryId, Item.Quantity, OldItemQuantity, EditedIndexValue) } else { $(".displayonitem").css("display", "block"); if (localStorage.getItem("OrderType") == "DineInOnly") { // $(".yourordersteststyles").css("display", "none") } else { $(".yourordersteststyles").css("display", "inline-block"); } TimeIntervel(Item.Time, localStorage.getItem("TIntervel")); } } else AddFirstItem(Itemdetails, totalprice, msg.d[0].BOGOOffers, msg.d[0].CategoryId, msg.d[0].ShippingItems, CustomTax, TaxLabel, SubcategoryId, SubSubcategoryId, ItemCategoryId); } else AddFirstItem(Itemdetails, totalprice, msg.d[0].BOGOOffers, msg.d[0].CategoryId, msg.d[0].ShippingItems, CustomTax, TaxLabel, SubcategoryId, SubSubcategoryId, ItemCategoryId); } else AddFirstItem(Itemdetails, totalprice, msg.d[0].BOGOOffers, msg.d[0].CategoryId, msg.d[0].ShippingItems, CustomTax, TaxLabel, SubcategoryId, SubSubcategoryId, ItemCategoryId); if (IsBogo == "FromBOGO") { EditOfferItem(GetId, OfferName, OfferType); } $("body").removeClass("fullpanel"); var ItemId = Itemdetails[0]; var ItemName = Itemdetails[1]; if (document.getElementById("lblItemType").innerHTML != "EditItem") { GetCrossSellItems(ItemId, ItemName); } else { if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "block"); $(".fcontainer").css("display", "block"); $(".Ordersmain").css("display", "block"); $(".orderdivr").css("display", "block"); $(".griditemscroll").css("width", "90%"); document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".mblcheckbtndiv").css("display", "inline-block"); } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".checkbtndiv").css("display", "inline-block"); } } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } } } else { $("#lblorderror").text("This item is not selectable. Please choose other items."); $(".ordererror").show().delay(3000).fadeOut(); $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); } } }); document.getElementById("lblbuyitemname").innerHTML = ""; document.getElementById("lblgetitemname").innerHTML = ""; } } else { if (document.getElementById("lblbuyitemname").innerHTML != "All Categories" && document.getElementById("lblgetitemname").innerHTML != "All Categories") { OfferExist(OptionsCheck, Itemdetails[0], IsBogo); } else { DefaultOfferExist(OptionsCheck, Itemdetails[0]); //document.getElementById("lblbogovalidation").innerHTML = ""; // document.getElementById("lblbogovalidation").innerHTML = "Offer applied only one time"; document.getElementById("lblgetitemid").innerHTML = Itemdetails[0]; } } } } } else if (IsBogo != "FromBOGO" && document.getElementById("lblBogoItemId").innerHTML != "" && OfferItemExist == 0 && document.getElementById("lblItemType").innerHTML != "EditItem") { OfferExist(OptionsCheck, Itemdetails[0], IsBogo); } //Normal items add and edit else { CrossSellPanelStatus = ""; var OrderType = localStorage.getItem("OrderType"); document.getElementById("additemserror").innerHTML = ""; var Price = 0; var totalprice = 0; var CustomTax = 0; var TaxLabel = ""; var Itemdetails = document.getElementById("lblItemId").innerHTML.split('//'); if (OrderType != "Shipping") { var checkbogo = document.getElementById('lblcheckbogo').innerHTML; if (checkbogo == "BOGO") OrderType = "CheckOfferExistOnBuyId"; else OrderType = ""; } var SubcategoryId = "00000000-0000-0000-0000-000000000000"; var SubSubcategoryId = "00000000-0000-0000-0000-000000000000"; var ItemCategoryId = "00000000-0000-0000-0000-000000000000"; $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + Itemdetails[0] + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { Price = msg.d[0].Price; CustomTax = msg.d[0].CustomTax; TaxLabel = escape(msg.d[0].TaxLabel); SubcategoryId = msg.d[0].SubCategoryId; SubSubcategoryId = msg.d[0].SubSubCategoryId; ItemCategoryId = msg.d[0].ItemMainCategoryId; } var d = 0; ///Recalculating ItemPrice before adding to cart if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].ItemId == Itemdetails[0]) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if($("#"+OptionsCheck[J].Choices[F].Id).hasClass("Validate")){ var Q = 0; var price = OptionsCheck[J].Choices[F].Price; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = +Q + +document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } if (Q > 0) price = OptionsCheck[J].Choices[F].Price * Q if (OptionsCheck[J].Choices[F].FreeOptions != "Yes") { if (OptionsCheck[J].Chargable == true) { d = +price + +d; } } if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions != "Yes") { d = +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } else { var sPath = window.location.pathname; $("#lblordalert").text("Something went wrong"); $(".orderalert").fadeIn(); window.location.href = sPath; } } } else { for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].ItemId == Itemdetails[0]) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { var Q = 0; var price = OptionsCheck[J].Choices[F].Price; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Q = +Q + +document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } if (Q > 0) price = OptionsCheck[J].Choices[F].Price * Q if (OptionsCheck[J].Choices[F].FreeOptions != "Yes") { if (OptionsCheck[J].Chargable == true) { d = +price + +d; } } if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions != "Yes") { d = +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } else { var sPath = window.location.pathname; $("#lblordalert").text("Something went wrong"); $(".orderalert").fadeIn(); window.location.href = sPath; } } } var allselect = document.getElementsByTagName("select"); if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { if (OptionsCheck[J].Type == "Dropdown" && OptionsCheck[J].Id == allselect[i].id) { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (ChoiceId == OptionsCheck[J].Choices[C].Id) { d = (+d + +OptionsCheck[J].Choices[C].Price); } } } } } } } } } } } else {for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { if (OptionsCheck[J].Type == "Dropdown" && OptionsCheck[J].Id == allselect[i].id) { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (ChoiceId == OptionsCheck[J].Choices[C].Id) { d = (+d + +OptionsCheck[J].Choices[C].Price); } } } } } } } } } } } if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlChildOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (OptionsCheck[J].Choices[C].Exist == true) { if (OptionsCheck[J].Choices[C].ChildOptions != undefined) { for (var L = 0; L < OptionsCheck[J].Choices[C].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[C].ChildOptions[L].Type == "Dropdown") { if ($("#" + OptionsCheck[J].Choices[C].ChildOptions[L].Id).hasClass("Validate")) { for (var U = 0; U < OptionsCheck[J].Choices[C].ChildOptions[L].Choices.length; U++) { if (ChoiceId == OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Id) { d = +OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } } } } } } else { for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlChildOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (OptionsCheck[J].Choices[C].Exist == true) { if (OptionsCheck[J].Choices[C].ChildOptions != undefined) { for (var L = 0; L < OptionsCheck[J].Choices[C].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[C].ChildOptions[L].Type == "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[C].ChildOptions[L].Choices.length; U++) { if (ChoiceId == OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Id) { d = +OptionsCheck[J].Choices[C].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } } } } } d = +d + +Price; var ddlvariation = $(".ddlVariation"); if (ddlvariation.length > 0) { if (ddlvariation[0].options[ddlvariation[0].selectedIndex].text != "Select Variation") { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { d = (+Variations[J].Price + +d); } } } } } // if (localStorage.getItem("OrderType") == "Shipping") { if (msg.d[0].ShippingItems.length > 0) { for (var i = 0; i < msg.d[0].ShippingItems.length; i++) { if ($('#' + msg.d[0].ShippingItems[i].Id).is(':checked')) { d = +d + +msg.d[0].ShippingItems[i].Price; } } } // } var Qty = document.getElementById('txtquantity').value; if (localStorage.getItem("priceType") == "Per Unit") { Qty = Qty * document.getElementById('txtunitquantity').value; } totalprice = (Qty * d); totalprice = totalprice.toFixed(2); if (totalprice != "0.00") { var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); localStorage.setItem("Page", JSON.stringify(sPage)); var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var Items = new Array(); var Item = new Object; if (AddedItems != null) { if (AddedItems.length > 0) { Item.ItemName = escape(Itemdetails[1]); Item.Id = Itemdetails[0]; Item.PosId = Itemdetails[3]; Item.NoSalesTax = document.getElementById('lblItemNoTax').innerHTML; Item.CustomTax = document.getElementById("lblCustomTax").innerHTML; Item.TaxLabel = document.getElementById("lblTaxLabel").innerHTML; Item.Instructions = escape(document.getElementById('txtinstructions').value); $("#Instructions").attr("placeholder", Item.Instructions); Item.Quantity = document.getElementById('txtquantity').value; if (localStorage.getItem("priceType") == "Per Unit") { Item.ItemUnitQty = document.getElementById('txtunitquantity').value; Item.PriceType = localStorage.getItem("priceType"); Item.UnitName = localStorage.getItem("UnitType"); } Item.Price = totalprice; var OrderType = localStorage.getItem("OrderType"); Item.OrderType = OrderType; Item.LId = document.getElementById('lblLId').value; Item.AppName = escape(document.getElementById('lblAppName').innerHTML); Item.MainCategoryId = document.getElementById("lblMainCategoryId").innerHTML; Item.ItemCategoryId = ItemCategoryId; Item.SubcategoryId = SubcategoryId; Item.SubSubCategoryId = SubSubcategoryId; document.getElementById('txtinstructions').value = ""; Item.Choices = new Array(); // if (localStorage.getItem("OrderType") == "Shipping") { for (var i = 0; i < msg.d[0].ShippingItems.length; i++) { if ($('#' + msg.d[0].ShippingItems[i].Id).is(':checked')) { var Choice = new Object; Choice.Id = msg.d[0].ShippingItems[i].Id; Choice.ItemId = msg.d[0].ShippingItems[i].ItemId; Choice.Measurement = msg.d[0].ShippingItems[i].Measurement; Choice.Price = msg.d[0].ShippingItems[i].Price; Choice.Weight = msg.d[0].ShippingItems[i].Weight; var Weight = 0; if (Choice.Measurement == "Oz") { Weight = +Weight + +(Choice.Weight * 0.0625); } else if (Choice.Measurement == "gm") { Weight = +Weight + +(Choice.Weight * 0.00220462); } else if (Choice.Measurement == "kg") { Weight = +Weight + +(Choice.Weight * 2.20462); } else if (Choice.Measurement == "tons") { Weight = +Weight + +(Choice.Weight * 2000); } else { Weight = +Weight + +Choice.Weight; } Weight = Weight * Item.Quantity; Weight = Weight.toFixed(2); Weight = Weight + " Pounds"; Choice.Conversation = Weight; Item.Choices.push(Choice); } } // } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Type != "Multiline Textbox" && OptionsCheck[J].Type != "Dropdown") { if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if ($('#' + OptionsCheck[J].Choices[F].Id).hasClass("Validate")) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } else { if ($('#' + OptionsCheck[J].Choices[F].Id).hasClass("Validate")) { if (OptionsCheck[J].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].DefaultVSOption == true) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].DefaultOptionText) + " : " + escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + " : " + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } } } } } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + " : " + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } else { if (OptionsCheck[J].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].DefaultVSOption == true) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].DefaultOptionText) + " : " + escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + " : " + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } } } } } else if (OptionsCheck[J].Type == "Dropdown") { //var Choice = new Object; //Choice.OptionId = OptionsCheck[J].Id //Choice.OptionName = escape(OptionsCheck[J].Name); //Choice.Type = OptionsCheck[J].Type; if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Id).val() != "") { var ChoiceId = $('#' + OptionsCheck[J].Id).val().split('/')[0]; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if (ChoiceId == OptionsCheck[J].Choices[F].Id) { var Choice = new Object; Choice.OptionId = OptionsCheck[J].Id Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.Id = OptionsCheck[J].Choices[F].Id Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = escape(OptionsCheck[J].Choices[F].Price); Choice.PosId = OptionsCheck[J].PosId; Choice.ChildChoices = new Array(); Item.Choices.push(Choice); } } } } } else { var Choice = new Object; Choice.Id = ""; Choice.OptionId = OptionsCheck[J].Id; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Notify = (OptionsCheck[J].Notify); Choice.DefaultVSOption = (OptionsCheck[J].DefaultVSOption); Choice.Type = OptionsCheck[J].Type; if (document.getElementById(Choice.OptionId).value != "") { Choice.ChoiceName = escape(document.getElementById(Choice.OptionId).value); Item.Choices.push(Choice); } } } Item.Variations = new Array(); if (ddlvariation.length > 0) { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { var Variation = new Object; Variation.Id = Variations[J].Id; Variation.Name = Variations[J].Name; Item.Variations.push(Variation); } } } } Item.CategoryId = msg.d[0].CategoryId; Item.AddedDate = new Date(); Item.BasePrice = parseFloat((document.getElementById("PriceVal").innerHTML) * (document.getElementById('txtquantity').value)).toFixed(2); Items.push(Item); //stroing categoryid,quantity and itemid in the CartAddedItemsList for the purpose of offer checking var allItems; var OldItemQuantity = ""; var EditedIndexValue = ""; if (document.getElementById("lblItemType").innerHTML == "AddItem") { allItems = AddedItems.concat(Items); localStorage.setItem("TotalItems", JSON.stringify(allItems)); setQuantitytoCart(); } else if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Id = document.getElementById("EditItemNum").innerHTML.replace("EditItem", ""); if (AddedItems != null) { if (parseInt(AddedItems[Id].Quantity) > parseInt(document.getElementById('txtquantity').value) && document.getElementById('lblcheckbogo').innerHTML == "BOGO") { OldItemQuantity = AddedItems[Id].Quantity; EditedIndexValue = Id; BoogOfferItemChanges(Id, msg.d[0].BOGOOffers);//methode should call if offer exist } AddedItems.splice(Id, 1, Item); localStorage.setItem("TotalItems", JSON.stringify(AddedItems)); } } //code for offer exists if (msg.d[0].BOGOOffers != null && msg.d[0].BOGOOffers != "" && IsBogo != "FromBOGO") { // OldItemQuantity,EditedIndexValue passed only for the edit item ConfirmBogoOffer(Itemdetails, msg.d[0].BOGOOffers, msg.d[0].CategoryId, Item.Quantity, OldItemQuantity, EditedIndexValue) } else { $(".displayonitem").css("display", "block"); if (localStorage.getItem("OrderType") == "DineInOnly") { // $(".yourordersteststyles").css("display", "none") } else { $(".yourordersteststyles").css("display", "inline-block"); } TimeIntervel(Item.Time, localStorage.getItem("TIntervel")); } } else AddFirstItem(Itemdetails, totalprice, msg.d[0].BOGOOffers, msg.d[0].CategoryId, msg.d[0].ShippingItems, CustomTax, TaxLabel, SubcategoryId, SubSubcategoryId, ItemCategoryId); } else AddFirstItem(Itemdetails, totalprice, msg.d[0].BOGOOffers, msg.d[0].CategoryId, msg.d[0].ShippingItems, CustomTax, TaxLabel, SubcategoryId, SubSubcategoryId, ItemCategoryId); } else AddFirstItem(Itemdetails, totalprice, msg.d[0].BOGOOffers, msg.d[0].CategoryId, msg.d[0].ShippingItems, CustomTax, TaxLabel, SubcategoryId, SubSubcategoryId, ItemCategoryId); if (IsBogo == "FromBOGO") { EditOfferItem(GetId, OfferName, OfferType); } $("body").removeClass("fullpanel"); var ItemId = Itemdetails[0]; var ItemName = Itemdetails[1]; if (document.getElementById("lblItemType").innerHTML != "EditItem") { GetCrossSellItems(ItemId, ItemName); } else { if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "block"); $(".fcontainer").css("display", "block"); $(".Ordersmain").css("display", "block"); $(".orderdivr").css("display", "block"); $(".griditemscroll").css("width", "90%"); document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".mblcheckbtndiv").css("display", "inline-block"); } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".checkbtndiv").css("display", "inline-block"); } } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } } } else { $("#lblorderror").text("This item is not selectable. Please choose other items."); $(".ordererror").show().delay(3000).fadeOut(); $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); } } }); } } function GetCrossSellItems(ItemIds,ItemName) { $("#crosssellitemspanel").removeClass("Suggestionitemsexist"); test = 0; $.ajax({ type: "POST", url: "Orders.aspx/GetCrossSellItems", data: "{'ItemId': '" + ItemIds + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { $("#crosssellitems").removeAttr("style"); var maindiv = ""; var name = ""; var widthcrosssell = 1; for (var i = 0; i < msg.d.length; i++) { widthcrosssell = widthcrosssell + msg.d[i].crossSellItem.length; if (msg.d[i].TriggerType == 3) { if (name.indexOf(ItemName + ",") >= 0) { } else { name += ItemName + ","; } } else { if (name.indexOf(msg.d[i].Name + ",") >= 0) { } else { name += msg.d[i].Name + ","; } } } if (msg.d[0].crossSellItem.length == 0) { CrossSellPanelStatus = "Closed"; } var namelist = name.replace(/,$/g, ''); $("#divitems").css("display", "block"); var itemnamelist = namelist.replace("null","").replace(",null","").replace("null,",""); document.getElementById('lbltaxname').innerHTML = itemnamelist; var width1 = (widthcrosssell * 250); maindiv += "<div class='horizon-prev horizon-prev1'><img id='right-button' class='right-button' src='images/bluebackarrow.png' alt='pre' onclick='slideright(" + width1 + ")' style='display:none'></div>"; maindiv += "<div id='viewContainer2'><div class='tslshow2' id='tslshow' style='min-width:" + width1 + "px'>"; for (var C = 0; C < msg.d.length; C++) { for (var i = 0; i < msg.d[C].crossSellItem.length; i++) { maindiv += "<div class='proitemdiv'>"; if (msg.d[C].crossSellItem[i].ImageUrl != null && msg.d[C].crossSellItem[i].ImageUrl != "") maindiv += "<div style='text-align:center'><img class='imgscroll' src='" + msg.d[C].crossSellItem[i].ImageUrl + "' /></div>"; else maindiv += "<div style='text-align:center' class='imgscroll'></div>"; var price = msg.d[C].crossSellItem[i].Price; price = price.toFixed(2); maindiv += "<div id='lblitemname' class='itemname'>" + msg.d[C].crossSellItem[i].Name + "</div>"; maindiv += "<div class='itempri' id='lblitemprice'>" + document.getElementById("lblCurrency").innerHTML + price + "</div>"; maindiv += "<div class='addbutton' id='"+ msg.d[C].crossSellItem[i].CategoryId +"' ><input class='additem additembtn' style='"+ButtonColor+"' type='button' value='Add Item' id='" + msg.d[C].crossSellItem[i].ItemId + "' onclick='GetItemOptions(this);' /></div>"; maindiv += "<div style='display:none;'><label id='qty" + msg.d[C].crossSellItem[i].ItemId + "'>50</label><span> Items left</span></div>"; maindiv += "</div>"; } } maindiv += "</div></div>"; if (width1 > 550) maindiv += "<div class='horizon-next horizon-next1'><img id='left-button' class='left-button' style='cursor:pointer;width: 20%;' src='images/bluenextarrow.png' alt='Next arrow' onclick='slideleft(" + width1 + ")' /></div>"; else maindiv += "<div class='horizon-next horizon-next1'><img id='left-button' class='left-button' style='cursor:pointer;width: 20%;display:none' src='images/nextarrow.png' alt='pre' /></div>" document.getElementById("crosssellitems").innerHTML = maindiv; if (window.innerWidth > 767) $(".crosssellitemspanelopen").css("margin-top", $(document).scrollTop() - 100); CrossSellPanelStatus = $("#CrossSellPanelStatus").text(); $("body").removeClass("fullpanel"); if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "block"); $(".fcontainer").css("display", "block"); $(".Ordersmain").css("display", "block"); $(".orderdivr").css("display", "block"); $(".griditemscroll").css("width", "90%"); document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".mblcheckbtndiv").css("display", "inline-block"); } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".checkbtndiv").css("display", "inline-block"); } } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } if (CrossSellPanelStatus != "Closed") { if($("#ShowSpecials").css("display") == "none"){ $("#crosssellitemspanel").fadeIn("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } else { $("#crosssellitemspanel").addClass("Suggestionitemsexist"); } } //else { // FinishOrderValidation(); //} CrossSellPanelStatus = "Opened"; document.getElementById('CrossSellPanelStatus').innerHTML = "Opened"; document.getElementById('GetCrossSellPanelStatus').innerHTML = "TriggerActive"; } var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } $("body").removeClass("fullpanel"); if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "block"); $(".fcontainer").css("display", "block"); $(".Ordersmain").css("display", "block"); $(".orderdivr").css("display", "block"); $(".griditemscroll").css("width", "90%"); document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".mblcheckbtndiv").css("display", "inline-block"); } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".checkbtndiv").css("display", "inline-block"); } } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } //else { // FinishOrderValidation(); //} } }); } function BoogOfferItemChanges(EditItemIndexValue, IsBogoOfferExist) { //if any item is edited and quatity is less than before checking is offer exist or not , var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { if (AddedItems.length > 0) { for (var i = 0; i < AddedItems.length; i++) { if (AddedItems[i]['OfferIndexValues'] != null || AddedItems[i]['OfferIndexValues'] != undefined) { var indexArray = new Array(); indexArray = AddedItems[i].OfferIndexValues.toString().split(","); for (x = 0; x < indexArray.length; x++) { if (parseInt(EditItemIndexValue) == parseInt(indexArray[x])) {//if exist automatically descreasing the offer item changes automatically document.getElementById("BogoEditItem").innerHTML = "BogoEditItem";//should automatically change the offer if (IsBogoOfferExist == null)//if not showing offer alert msg then only we will open related offer item automatically $("#EditItem" + i).trigger("click"); } } } } } } } } function TimeIntervel(Item1, Item2) { $.ajax({ type: "POST", url: "Orders.aspx/SetTimeIntervel", data: "{'Time1': '" + Item1 + "','Time2': '" + Item2 + "'}", dataType: "json", contentType: "application/json", success: function (msg) { localStorage.setItem("TIntervel", msg.d); } }); } function AddFirstItem(Itemdetails, Price, BogoOffer, CategoryId, ShippingItems, CustomTax, TaxLabel, SubcategoryId, SubSubcategoryId, ItemCategoryId) { var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) OptionsCheck = JSON.parse(retrievedOptions); var Items = new Array(); var Item = new Object; Item.ItemName = escape(Itemdetails[1]); Item.Id = Itemdetails[0]; Item.PosId = Itemdetails[3]; Item.NoSalesTax = document.getElementById('lblItemNoTax').innerHTML; Item.CustomTax = document.getElementById("lblCustomTax").innerHTML; Item.TaxLabel = document.getElementById("lblTaxLabel").innerHTML; Item.Instructions = escape(document.getElementById('txtinstructions').value); $("#Instructions").attr("placeholder", Item.Instructions); Item.Quantity = document.getElementById('txtquantity').value; if (localStorage.getItem("priceType") == "Per Unit") { Item.ItemUnitQty = document.getElementById('txtunitquantity').value; Item.PriceType = localStorage.getItem("priceType"); Item.UnitName = localStorage.getItem("UnitType"); } Item.BasePrice = parseFloat((document.getElementById("PriceVal").innerHTML) * (document.getElementById('txtquantity').value)).toFixed(2); Item.Price = Price; var OrderType = localStorage.getItem("OrderType"); Item.OrderType = OrderType; Item.LId = document.getElementById('lblLId').value; Item.AppName = escape(document.getElementById('lblAppName').innerHTML); Item.MainCategoryId = document.getElementById("lblMainCategoryId").innerHTML; Item.ItemCategoryId = ItemCategoryId; Item.SubcategoryId = SubcategoryId; Item.SubSubCategoryId = SubSubcategoryId; document.getElementById('txtinstructions').value = ""; Item.Choices = new Array(); // if (localStorage.getItem("OrderType") == "Shipping") { if (ShippingItems != null) { for (var i = 0; i < ShippingItems.length; i++) { if ($('#' + ShippingItems[i].Id).is(':checked')) { var Choice = new Object; Choice.Id = ShippingItems[i].Id; Choice.ItemId = ShippingItems[i].ItemId; Choice.Measurement = ShippingItems[i].Measurement; Choice.Price = ShippingItems[i].Price; Choice.Weight = ShippingItems[i].Weight; var Weight = 0; if (Choice.Measurement == "Oz") { Weight = +Weight + +(Choice.Weight * 0.0625); } else if (Choice.Measurement == "gm") { Weight = +Weight + +(Choice.Weight * 0.00220462); } else if (Choice.Measurement == "kg") { Weight = +Weight + +(Choice.Weight * 2.20462); } else if (Choice.Measurement == "tons") { Weight = +Weight + +(Choice.Weight * 2000); } else { Weight = +Weight + +Choice.Weight; } Weight = Weight * Item.Quantity; Weight = Weight.toFixed(2); Weight = Weight + " Pounds"; Choice.Conversation = Weight; Item.Choices.push(Choice); } } } // } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Type != "Multiline Textbox" && OptionsCheck[J].Type != "Dropdown") { if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if ($('#' + OptionsCheck[J].Choices[F].Id).hasClass("Validate")) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } else { if ($('#' + OptionsCheck[J].Choices[F].Id).hasClass("Validate")) { if (OptionsCheck[J].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].DefaultVSOption == true) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.ChoiceName = escape(OptionsCheck[J].DefaultOptionText) + " : " + escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } } } } } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } else { if (OptionsCheck[J].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].DefaultVSOption == true) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.ChoiceName = escape(OptionsCheck[J].DefaultOptionText) + " : " + escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } } } } } else if (OptionsCheck[J].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Id).val() != "") { var ChoiceId = $('#' + OptionsCheck[J].Id).val().split('/')[0]; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if (ChoiceId == OptionsCheck[J].Choices[F].Id) { var Choice = new Object; Choice.OptionId = OptionsCheck[J].Id Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.PosId = OptionsCheck[J].PosId; Choice.ChildChoices = new Array(); Item.Choices.push(Choice); } } } } } else { var Choice = new Object; Choice.Id = ""; Choice.OptionId = OptionsCheck[J].Id; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Notify = (OptionsCheck[J].Notify); Choice.DefaultVSOption = (OptionsCheck[J].DefaultVSOption); Choice.Type = OptionsCheck[J].Type; if (document.getElementById(Choice.OptionId).value != "") { Choice.ChoiceName = escape(document.getElementById(Choice.OptionId).value); Item.Choices.push(Choice); } } } var ddlvariation = $(".ddlVariation"); Item.Variations = new Array(); if (ddlvariation.length > 0) { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { var Variation = new Object; Variation.Id = Variations[J].Id; Variation.Name = Variations[J].Name; Item.Variations.push(Variation); } } } } Item.CategoryId = CategoryId; Item.AddedDate = new Date(); Items.push(Item); localStorage.setItem("TotalItems", JSON.stringify(Items)); //stroing categoryid,quantity and itemid in the CartAddedItemsList for the purpose of offer checking if (BogoOffer != null && BogoOffer != "") ConfirmBogoOffer(Itemdetails[0], BogoOffer, CategoryId, Item.Quantity, "", ""); else { $(".displayonitem").css("display", "block"); if (localStorage.getItem("OrderType") == "DineInOnly") { // $(".yourordersteststyles").css("display", "none"); } else $(".yourordersteststyles").css("display", "inline-block"); localStorage.setItem("TIntervel", Item.Time); } } function ConfirmBogoOffer(ItemId, BogoOffer, CategoryId, Quantity, OldItemQuantity, EditIndexValue) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (ItemId[0].length != 1) { ItemId = ItemId[0]; } else { ItemId = ItemId; } $("body").removeClass("fullpanel"); if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "block"); $(".fcontainer").css("display", "block"); $(".Ordersmain").css("display", "block"); $(".orderdivr").css("display", "block"); $(".griditemscroll").css("width", "90%"); document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".mblcheckbtndiv").css("display", "inline-block"); } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".checkbtndiv").css("display", "inline-block"); } } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } if (BogoOffer.length == 1) { document.getElementById("lblbogobuyitemname").innerHTML = BogoOffer[0].BuyItemName; document.getElementById("lblbogogetitemname").innerHTML = BogoOffer[0].GetItemName; document.getElementById("lblofferforcategoryid").innerHTML = CategoryId; localStorage.removeItem("AddBogoItems"); if (BogoOffer[0].BuyItemName == "All Categories" && BogoOffer[0].GetItemName == "All Categories") { var BuyQuantity = 0; document.getElementById("lblbuyitemid").innerHTML = ItemId; var ItemId = ItemId; var offer = 0; var Offerexisted = 0; if (BogoOffer[0].Action == "Category") { var BuyQuantity = 0; // from CartAddedItemsList list we are getting total items belongs to the categoryid, if the buyquantity<= total items quantity goes to offer exist() var CartAddedItemsList = localStorage.getItem("TotalItems"); if (CartAddedItemsList != "undefined" && CartAddedItemsList != null) { var OfferedItems = JSON.parse(CartAddedItemsList); if (OfferedItems != null) { if (OfferedItems.length > 0) { for (var i = 0; i < OfferedItems.length; i++) { if (CategoryId == OfferedItems[i].CategoryId) { BuyQuantity += parseInt(OfferedItems[i].Quantity); } if (OfferedItems.length - 1 == i) { if (parseInt(BogoOffer[0].BuyQuantity) <= parseInt(BuyQuantity)) offer++; } } } } } } else { var ItemsCount = 0; var CartAddedItemsList = localStorage.getItem("TotalItems"); if (CartAddedItemsList != "undefined" && CartAddedItemsList != null) { var OfferedItems = JSON.parse(CartAddedItemsList); if (OfferedItems != null) { if (OfferedItems.length > 0) { for (var i = 0; i < OfferedItems.length; i++) { if (ItemId == OfferedItems[i].Id) { ItemsCount += parseInt(OfferedItems[i].Quantity); } if (OfferedItems.length - 1 == i) { if (parseInt(BogoOffer[0].BuyQuantity) <= parseInt(ItemsCount)) offer++; } } } } } } if (offer != 0) { var exists = 0; //if offer item exists in the cart, the below code for editing the item. var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var i = AddedItems.length; var ivalue = ""; while (i--) { //if (AddedItems[i] && AddedItems[i].hasOwnProperty('OfferFor') && (arguments.length > 2 && AddedItems[i]['OfferFor'].split("/")[0]=== BogoOffer[0].BuyId)) if (AddedItems[i] && AddedItems[i].hasOwnProperty('Offerappliedfor') && (arguments.length > 2 && AddedItems[i]['Offerappliedfor'] === "All Categories to All Categories")) exists++; ivalue = i; } } var OfferMsg = "Would you like to add this offer "; if (exists > 0) { OfferMsg = "Already this offer added to cart, Would you like to edit this offer "; Offerexisted++; } else{document.getElementById("lblallcattoallcat").innerHTML=""; document.getElementById("lblbogovalidation").innerHTML="";} if (BogoOffer[0].GetQuantity == "Custom %" || BogoOffer[0].GetQuantity == "Custom $") { if (BogoOffer[0].GetQuantity == "Custom %") OfferMsg += "Buy " + BogoOffer[0].BuyQuantity + " " + BogoOffer[0].BuyItemName + " Get " + BogoOffer[0].GetOffer + "% off on " + BogoOffer[0].GetItemName + "?"; else OfferMsg += "Buy " + BogoOffer[0].BuyQuantity + " " + BogoOffer[0].BuyItemName + " Get $" + BogoOffer[0].GetOffer.toFixed(2) + " off on " + BogoOffer[0].GetItemName + "?"; } else OfferMsg += "Buy " + BogoOffer[0].BuyQuantity + " " + BogoOffer[0].BuyItemName + " Get " + BogoOffer[0].GetQuantity + " " + BogoOffer[0].GetItemName + "?"; if (BogoOffer[0].CustomMessage != null && BogoOffer[0].CustomMessage != "") OfferMsg = BogoOffer[0].CustomMessage; if (confirm(OfferMsg)) { if (Offerexisted == 0) { if (document.getElementById("lblallcattoallcat").innerHTML != "Offer applied only one time") { if (document.getElementById("lblbogovalidation").innerHTML != "Allcategories to Allcategories Bogo offer applied") { document.getElementById("lblbuyitemname").innerHTML = BogoOffer[0].BuyItemName; document.getElementById("lblgetitemname").innerHTML = BogoOffer[0].GetItemName; document.getElementById("lblbogovalidation").innerHTML = "Allcategories to Allcategories Bogo offer applied"; document.getElementById("lblallcattoallcat").innerHTML = "Offer applied only one time"; localStorage.setItem("AddBogoItems", JSON.stringify(BogoOffer)); //DeleteExistedBogoOffers(ItemId); AddBogoOffer(ItemId, BogoOffer[0], CategoryId, Quantity); } } } else { alert(" This offer already added to the cart"); } } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } if (OldItemQuantity != "" && EditIndexValue != "") { if (parseInt(OldItemQuantity) > parseInt(Quantity) && document.getElementById('lblcheckbogo').innerHTML == "BOGO") { //DeleteExistedBogoOffers(ItemId); BoogOfferItemChanges(EditIndexValue, null); } } } } else { var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != null) { var AddedItems = JSON.parse(retrievedData); for (var j1 = 0; j1 < AddedItems.length; j1++) { DeleteOfferExist(BogoOffer[0].BuyId); } } if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } } if (Offerexisted != 0) { document.getElementById("lblbuyitemname").innerHTML = ""; document.getElementById("lblgetitemname").innerHTML = ""; } } else if (BogoOffer[0].BuyItemName != "All Categories" && BogoOffer[0].GetItemName == "All Categories") { // if(BogoOffer[0].BuyItemType=="Category"){ document.getElementById("lblbogocategoryid").innerHTML = BogoOffer[0].BuyId; // } var BuyQuantity = 0; var ItemId = ItemId; var offer = 0; var Offerexisted = 0; if (BogoOffer[0].Action == "Category") { var BuyQuantity = 0; // from CartAddedItemsList list we are getting total items belongs to the categoryid, if the buyquantity<= total items quantity goes to offer exist() var CartAddedItemsList = localStorage.getItem("TotalItems"); if (CartAddedItemsList != "undefined" && CartAddedItemsList != null) { var OfferedItems = JSON.parse(CartAddedItemsList); if (OfferedItems != null) { if (OfferedItems.length > 0) { for (var i = 0; i < OfferedItems.length; i++) { if (CategoryId == OfferedItems[i].CategoryId) { BuyQuantity += parseInt(OfferedItems[i].Quantity); } if (OfferedItems.length - 1 == i) { if (parseInt(BogoOffer[0].BuyQuantity) <= parseInt(BuyQuantity)) offer++; } } } } } } else { var ItemsCount = 0; var CartAddedItemsList = localStorage.getItem("TotalItems"); if (CartAddedItemsList != "undefined" && CartAddedItemsList != null) { var OfferedItems = JSON.parse(CartAddedItemsList); if (OfferedItems != null) { if (OfferedItems.length > 0) { for (var i = 0; i < OfferedItems.length; i++) { if (ItemId == OfferedItems[i].Id) { ItemsCount += parseInt(OfferedItems[i].Quantity); } if (OfferedItems.length - 1 == i) { if (parseInt(BogoOffer[0].BuyQuantity) <= parseInt(ItemsCount)) offer++; } } } } } } if (offer != 0) { var exists = 0; //if offer item exists in the cart, the below code for editing the item. var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var i = AddedItems.length; var ivalue = ""; while (i--) { if (AddedItems[i] && AddedItems[i].hasOwnProperty('OfferFor') && (arguments.length > 2 && AddedItems[i]['OfferFor'] === BogoOffer[0].BuyId)) exists++; ivalue = i; } } var OfferMsg = "Would you like to add this offer "; if (exists > 0) { OfferMsg = "Already this offer added to cart, Would you like to edit this offer "; Offerexisted++; } else{document.getElementById("lblanytoallcat").innerHTML="";document.getElementById("lblbogovalidation").innerHTML="";} if (BogoOffer[0].GetQuantity == "Custom %" || BogoOffer[0].GetQuantity == "Custom $") { if (BogoOffer[0].GetQuantity == "Custom %") OfferMsg += "Buy " + BogoOffer[0].BuyQuantity + " " + BogoOffer[0].BuyItemName + " Get " + BogoOffer[0].GetOffer + "% off on " + BogoOffer[0].GetItemName + "?"; else OfferMsg += "Buy " + BogoOffer[0].BuyQuantity + " " + BogoOffer[0].BuyItemName + " Get $" + BogoOffer[0].GetOffer.toFixed(2) + " off on " + BogoOffer[0].GetItemName + "?"; } else OfferMsg += "Buy " + BogoOffer[0].BuyQuantity + " " + BogoOffer[0].BuyItemName + " Get " + BogoOffer[0].GetQuantity + " " + BogoOffer[0].GetItemName + "?"; if (BogoOffer[0].CustomMessage != null && BogoOffer[0].CustomMessage != "") OfferMsg = BogoOffer[0].CustomMessage; if (confirm(OfferMsg)) { if (Offerexisted == 0) { if (!(BogoOffer[0].BuyItemName.includes("Category"))) { if (document.getElementById("lblanytoallcat").innerHTML != "Item to Allcategories Offer applied only one time") { if (document.getElementById("lblbogovalidation").innerHTML != "Item to Allcategories Bogo offer applied") { document.getElementById("lblbuyitemname").innerHTML = BogoOffer[0].BuyItemName; document.getElementById("lblgetitemname").innerHTML = BogoOffer[0].GetItemName; document.getElementById("lblbogovalidation").innerHTML = "Item to Allcategories Bogo offer applied"; document.getElementById("lblanytoallcat").innerHTML = "Item to Allcategories Offer applied only one time"; localStorage.setItem("AddBogoItems", JSON.stringify(BogoOffer)); //DeleteExistedBogoOffers(ItemId); AddBogoOffer(ItemId, BogoOffer[0], CategoryId, Quantity); } } } else { if (document.getElementById("lblanytoallcat").innerHTML != "Category to Allcategories Offer applied only one time") { if (document.getElementById("lblbogovalidation").innerHTML != "Category to Allcategories Bogo offer applied") { document.getElementById("lblbuyitemname").innerHTML = BogoOffer[0].BuyItemName; document.getElementById("lblgetitemname").innerHTML = BogoOffer[0].GetItemName; document.getElementById("lblbogovalidation").innerHTML = "Category to Allcategories Bogo offer applied"; document.getElementById("lblanytoallcat").innerHTML = "Category to Allcategories Offer applied only one time"; localStorage.setItem("AddBogoItems", JSON.stringify(BogoOffer)); //DeleteExistedBogoOffers(ItemId); AddBogoOffer(ItemId, BogoOffer[0], CategoryId, Quantity); } } } } else { alert(" This offer already added to the cart"); } } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } if (OldItemQuantity != "" && EditIndexValue != "") { if (parseInt(OldItemQuantity) > parseInt(Quantity) && document.getElementById('lblcheckbogo').innerHTML == "BOGO") { //DeleteExistedBogoOffers(ItemId); BoogOfferItemChanges(EditIndexValue, null); } } } } else { var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != null) { var AddedItems = JSON.parse(retrievedData); for (var j1 = 0; j1 < AddedItems.length; j1++) { DeleteOfferExist(BogoOffer[0].BuyId); } } if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } } if (Offerexisted != 0) { document.getElementById("lblbuyitemname").innerHTML = ""; document.getElementById("lblgetitemname").innerHTML = ""; } } else if (BogoOffer[0].BuyItemName == "All Categories" && BogoOffer[0].GetItemName != "All Categories") { if (BogoOffer[0].GetItemType == "Category") { document.getElementById("lblbogocategoryid").innerHTML = BogoOffer[0].GetId; } var BuyQuantity = 0; var CategoryOfferexisted = 0; var ItemOfferexisted = 0; var Offerexisted = 0; if (!(BogoOffer[0].GetItemName.includes("Category"))) { var offer = 0; if (BogoOffer[0].Action == "Category") { var BuyQuantity = 0; // from CartAddedItemsList list we are getting total items belongs to the categoryid, if the buyquantity<= total items quantity goes to offer exist() var CartAddedItemsList = localStorage.getItem("TotalItems"); if (CartAddedItemsList != "undefined" && CartAddedItemsList != null) { var OfferedItems = JSON.parse(CartAddedItemsList); if (OfferedItems != null) { if (OfferedItems.length > 0) { for (var i = 0; i < OfferedItems.length; i++) { if (CategoryId == OfferedItems[i].CategoryId) { BuyQuantity += parseInt(OfferedItems[i].Quantity); } if (OfferedItems.length - 1 == i) { if (parseInt(BogoOffer[0].BuyQuantity) <= parseInt(BuyQuantity)) offer++; } } } } } } else { var ItemsCount = 0; var CartAddedItemsList = localStorage.getItem("TotalItems"); if (CartAddedItemsList != "undefined" && CartAddedItemsList != null) { var OfferedItems = JSON.parse(CartAddedItemsList); if (OfferedItems != null) { if (OfferedItems.length > 0) { for (var i = 0; i < OfferedItems.length; i++) { if (ItemId == OfferedItems[i].Id) { ItemsCount += parseInt(OfferedItems[i].Quantity); } if (OfferedItems.length - 1 == i) { if (parseInt(BogoOffer[0].BuyQuantity) <= parseInt(ItemsCount)) offer++; } } } } } } if (offer != 0) { var exists = 0; //if offer item exists in the cart, the below code for editing the item. var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var i = AddedItems.length; var ivalue = ""; while (i--) { //if (AddedItems[i] && AddedItems[i].hasOwnProperty('OfferFor') && (arguments.length > 2 && AddedItems[i]['OfferFor'] === BogoOffer[0].BuyId)) //exists++; if (AddedItems[i] && AddedItems[i].hasOwnProperty('Offerappliedfor') && (arguments.length > 2 && AddedItems[i]['Offerappliedfor'] === "All Categories to Item")) ItemOfferexisted++; ivalue = i; } } var OfferMsg = "Would you like to add this offer "; if (ItemOfferexisted > 0) { OfferMsg = "Already this offer added to cart, Would you like to edit this offer "; //ItemOfferexisted++; } else{document.getElementById("lblallcattoany").innerHTML=""; document.getElementById("lblbogovalidation").innerHTML="";} if (BogoOffer[0].GetQuantity == "Custom %" || BogoOffer[0].GetQuantity == "Custom $") { if (BogoOffer[0].GetQuantity == "Custom %") OfferMsg += "Buy " + BogoOffer[0].BuyQuantity + " " + BogoOffer[0].BuyItemName + " Get " + BogoOffer[0].GetOffer + "% off on " + BogoOffer[0].GetItemName + "?"; else OfferMsg += "Buy " + BogoOffer[0].BuyQuantity + " " + BogoOffer[0].BuyItemName + " Get $" + BogoOffer[0].GetOffer.toFixed(2) + " off on " + BogoOffer[0].GetItemName + "?"; } else OfferMsg += "Buy " + BogoOffer[0].BuyQuantity + " " + BogoOffer[0].BuyItemName + " Get " + BogoOffer[0].GetQuantity + " " + BogoOffer[0].GetItemName + "?"; if (BogoOffer[0].CustomMessage != null && BogoOffer[0].CustomMessage != "") OfferMsg = BogoOffer[0].CustomMessage; if (confirm(OfferMsg)) { if (ItemOfferexisted == 0) { if (!(BogoOffer[0].GetItemName.includes("Category"))) { if (document.getElementById("lblallcattoany").innerHTML != "All categories to item Offer applied only one time") { if (document.getElementById("lblbogovalidation").innerHTML != "Allcategories to item Bogo offer applied") { document.getElementById("lblbuyitemname").innerHTML = BogoOffer[0].BuyItemName; document.getElementById("lblgetitemname").innerHTML = BogoOffer[0].GetItemName; document.getElementById("lblbogovalidation").innerHTML = "Allcategories to item Bogo offer applied"; document.getElementById("lblallcattoany").innerHTML = "All categories to item Offer applied only one time"; localStorage.setItem("AddBogoItems", JSON.stringify(BogoOffer)); // DeleteExistedBogoOffers(ItemId); AddBogoOffer(ItemId, BogoOffer[0], CategoryId, Quantity); } } } else { if (document.getElementById("lblallcattoany").innerHTML != "All categories to category Offer applied only one time") { if (document.getElementById("lblbogovalidation").innerHTML != "Allcategories to category Bogo offer applied") { document.getElementById("lblbuyitemname").innerHTML = BogoOffer[0].BuyItemName; document.getElementById("lblgetitemname").innerHTML = BogoOffer[0].GetItemName; document.getElementById("lblbogovalidation").innerHTML = "Allcategories to category Bogo offer applied"; document.getElementById("lblallcattoany").innerHTML = "All categories to category Offer applied only one time"; localStorage.setItem("AddBogoItems", JSON.stringify(BogoOffer)); //DeleteExistedBogoOffers(ItemId); AddBogoOffer(ItemId, BogoOffer[0], CategoryId, Quantity); } } } } else { alert(" This offer already added to the cart"); } } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } if (OldItemQuantity != "" && EditIndexValue != "") { if (parseInt(OldItemQuantity) > parseInt(Quantity) && document.getElementById('lblcheckbogo').innerHTML == "BOGO") { //DeleteExistedBogoOffers(ItemId); BoogOfferItemChanges(EditIndexValue, null); } } } } else { var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != null) { var AddedItems = JSON.parse(retrievedData); for (var j1 = 0; j1 < AddedItems.length; j1++) { DeleteOfferExist(BogoOffer[0].BuyId); } } if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } } if (ItemOfferexisted != 0 ) { document.getElementById("lblbuyitemname").innerHTML = ""; document.getElementById("lblgetitemname").innerHTML = ""; } } else { var ItemId = ItemId; var offer = 0; if (BogoOffer[0].Action == "Category") { var BuyQuantity = 0; // from CartAddedItemsList list we are getting total items belongs to the categoryid, if the buyquantity<= total items quantity goes to offer exist() var CartAddedItemsList = localStorage.getItem("TotalItems"); if (CartAddedItemsList != "undefined" && CartAddedItemsList != null) { var OfferedItems = JSON.parse(CartAddedItemsList); if (OfferedItems != null) { if (OfferedItems.length > 0) { for (var i = 0; i < OfferedItems.length; i++) { if (CategoryId == OfferedItems[i].CategoryId) { BuyQuantity += parseInt(OfferedItems[i].Quantity); } if (OfferedItems.length - 1 == i) { if (parseInt(BogoOffer[0].BuyQuantity) <= parseInt(BuyQuantity)) offer++; } } } } } } else { if (parseInt(BogoOffer[0].BuyQuantity) <= parseInt(Quantity)) offer++; } if (offer != 0) { var exists = 0; //if offer item exists in the cart, the below code for editing the item. var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var i = AddedItems.length; var ivalue = ""; while (i--) { //if (AddedItems[i] && AddedItems[i].hasOwnProperty('OfferFor') && (arguments.length > 2 && AddedItems[i]['OfferFor'] === BogoOffer[0].BuyId)) //exists++; if (AddedItems[i] && AddedItems[i].hasOwnProperty('Offerappliedfor') && (arguments.length > 2 && AddedItems[i]['Offerappliedfor'] === "All Categories to Category")) CategoryOfferexisted++; ivalue = i; } } var OfferMsg = "Would you like to add this offer "; if (CategoryOfferexisted > 0) { OfferMsg = "Already this offer added to cart, Would you like to edit this offer "; // CategoryOfferexisted++; } else{document.getElementById("lblallcattoany").innerHTML=""; document.getElementById("lblbogovalidation").innerHTML="";} if (BogoOffer[0].GetQuantity == "Custom %" || BogoOffer[0].GetQuantity == "Custom $") { if (BogoOffer[0].GetQuantity == "Custom %") OfferMsg += "Buy " + BogoOffer[0].BuyQuantity + " " + BogoOffer[0].BuyItemName + " Get " + BogoOffer[0].GetOffer + "% off on " + BogoOffer[0].GetItemName + "?"; else OfferMsg += "Buy " + BogoOffer[0].BuyQuantity + " " + BogoOffer[0].BuyItemName + " Get $" + BogoOffer[0].GetOffer.toFixed(2) + " off on " + BogoOffer[0].GetItemName + "?"; } else OfferMsg += "Buy " + BogoOffer[0].BuyQuantity + " " + BogoOffer[0].BuyItemName + " Get " + BogoOffer[0].GetQuantity + " " + BogoOffer[0].GetItemName + "?"; if (BogoOffer[0].CustomMessage != null && BogoOffer[0].CustomMessage != "") OfferMsg = BogoOffer[0].CustomMessage; if (confirm(OfferMsg)) { if (CategoryOfferexisted == 0) { if (!(BogoOffer[0].GetItemName.includes("Category"))) { if (document.getElementById("lblallcattoany").innerHTML != "All categories to item Offer applied only one time") { if (document.getElementById("lblbogovalidation").innerHTML != "Allcategories to item Bogo offer applied") { document.getElementById("lblbuyitemname").innerHTML = BogoOffer[0].BuyItemName; document.getElementById("lblgetitemname").innerHTML = BogoOffer[0].GetItemName; document.getElementById("lblbogovalidation").innerHTML = "Allcategories to item Bogo offer applied"; document.getElementById("lblallcattoany").innerHTML = "All categories to item Offer applied only one time"; localStorage.setItem("AddBogoItems", JSON.stringify(BogoOffer)); //DeleteExistedBogoOffers(ItemId); AddBogoOffer(ItemId, BogoOffer[0], CategoryId, Quantity); } } } else { if (document.getElementById("lblallcattoany").innerHTML != "All categories to category Offer applied only one time") { if (document.getElementById("lblbogovalidation").innerHTML != "Allcategories to category Bogo offer applied") { document.getElementById("lblbuyitemname").innerHTML = BogoOffer[0].BuyItemName; document.getElementById("lblgetitemname").innerHTML = BogoOffer[0].GetItemName; document.getElementById("lblbogovalidation").innerHTML = "Allcategories to category Bogo offer applied"; document.getElementById("lblallcattoany").innerHTML = "All categories to category Offer applied only one time"; localStorage.setItem("AddBogoItems", JSON.stringify(BogoOffer)); //DeleteExistedBogoOffers(ItemId); AddBogoOffer(ItemId, BogoOffer[0], CategoryId, Quantity); } } } } else { alert(" This offer already added to the cart"); } } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } if (OldItemQuantity != "" && EditIndexValue != "") { if (parseInt(OldItemQuantity) > parseInt(Quantity) && document.getElementById('lblcheckbogo').innerHTML == "BOGO") { //DeleteExistedBogoOffers(ItemId); BoogOfferItemChanges(EditIndexValue, null); } } } } else { var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != null) { var AddedItems = JSON.parse(retrievedData); for (var j1 = 0; j1 < AddedItems.length; j1++) { DeleteOfferExist(BogoOffer[0].BuyId); } } if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } } if (CategoryOfferexisted != 0) { document.getElementById("lblbuyitemname").innerHTML = ""; document.getElementById("lblgetitemname").innerHTML = ""; } } } else { var ItemId = ItemId; var offer = 0; var Offerexisted = 0; if (BogoOffer[0].Action == "Category") { var BuyQuantity = 0; // from CartAddedItemsList list we are getting total items belongs to the categoryid, if the buyquantity<= total items quantity goes to offer exist() var CartAddedItemsList = localStorage.getItem("TotalItems"); if (CartAddedItemsList != "undefined" && CartAddedItemsList != null) { var OfferedItems = JSON.parse(CartAddedItemsList); if (OfferedItems != null) { if (OfferedItems.length > 0) { for (var i = 0; i < OfferedItems.length; i++) { if (CategoryId == OfferedItems[i].CategoryId) { BuyQuantity += parseInt(OfferedItems[i].Quantity); } if (OfferedItems.length - 1 == i) { if (parseInt(BogoOffer[0].BuyQuantity) <= parseInt(BuyQuantity)) offer++; } } } } } } else { if (parseInt(BogoOffer[0].BuyQuantity) <= parseInt(Quantity)) offer++; } if (offer != 0) { var exists = 0; //if offer item exists in the cart, the below code for editing the item. var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var i = AddedItems.length; var ivalue = ""; while (i--) { if (AddedItems[i] && AddedItems[i].hasOwnProperty('OfferFor') && (arguments.length > 2 && AddedItems[i]['OfferFor'] === BogoOffer[0].BuyId)) { if(AddedItems[i]['GetId'] ==BogoOffer[0].GetId) { exists++; } } ivalue = i; } } var OfferMsg = "Would you like to add this offer "; if (exists > 0) { OfferMsg = "Already this offer added to cart, Would you like to edit this offer "; Offerexisted++; } if (BogoOffer[0].GetQuantity == "Custom %" || BogoOffer[0].GetQuantity == "Custom $") { if (BogoOffer[0].GetQuantity == "Custom %") OfferMsg += "Buy " + BogoOffer[0].BuyQuantity + " " + BogoOffer[0].BuyItemName + " Get " + BogoOffer[0].GetOffer + "% off on " + BogoOffer[0].GetItemName + "?"; else OfferMsg += "Buy " + BogoOffer[0].BuyQuantity + " " + BogoOffer[0].BuyItemName + " Get $" + BogoOffer[0].GetOffer.toFixed(2) + " off on " + BogoOffer[0].GetItemName + "?"; } else OfferMsg += "Buy " + BogoOffer[0].BuyQuantity + " " + BogoOffer[0].BuyItemName + " Get " + BogoOffer[0].GetQuantity + " " + BogoOffer[0].GetItemName + "?"; if (BogoOffer[0].CustomMessage != null && BogoOffer[0].CustomMessage != "") OfferMsg = BogoOffer[0].CustomMessage; if (confirm(OfferMsg)) { if (Offerexisted == 0) { //DeleteExistedBogoOffers(ItemId); AddBogoOffer(ItemId, BogoOffer[0], CategoryId, Quantity); } else { alert(" This offer already added to the cart"); } } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } if (OldItemQuantity != "" && EditIndexValue != "") { if (parseInt(OldItemQuantity) > parseInt(Quantity) && document.getElementById('lblcheckbogo').innerHTML == "BOGO") { //DeleteExistedBogoOffers(ItemId); BoogOfferItemChanges(EditIndexValue, null); } } } } else { var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != null) { var AddedItems = JSON.parse(retrievedData); for (var j1 = 0; j1 < AddedItems.length; j1++) { DeleteOfferExist(BogoOffer[0].BuyId); } } if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } } } } else { var FilterBOGO = new Array(); var CatergoryItemsCount = 0; var ItemsCount = 0; // from CartAddedItemsList list we are getting total items belongs to the categoryid, if the buyquantity<= total items quantity goes to offer exist() var CartAddedItemsList = localStorage.getItem("TotalItems"); if (CartAddedItemsList != "undefined" && CartAddedItemsList != null) { var OfferedItems = JSON.parse(CartAddedItemsList); if (OfferedItems != null) { if (OfferedItems.length > 0) { for (var i = 0; i < OfferedItems.length; i++) { if (CategoryId == OfferedItems[i].CategoryId) { CatergoryItemsCount += parseInt(OfferedItems[i].Quantity); } if (ItemId == OfferedItems[i].Id) { ItemsCount += parseInt(OfferedItems[i].Quantity); } } } } } for (var i = 0; i < BogoOffer.length; i++) { var offer = 0; if (BogoOffer[i].Action == "Category") { if (parseInt(BogoOffer[i].BuyQuantity) <= parseInt(CatergoryItemsCount)) FilterBOGO.push(BogoOffer[i]); } else { if (parseInt(BogoOffer[i].BuyQuantity) <= parseInt(ItemsCount)) FilterBOGO.push(BogoOffer[i]); } } if (FilterBOGO.length > 1) ShowBogoOffersList(ItemId, FilterBOGO, CategoryId, Quantity); else if (FilterBOGO.length == 1) { if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Id = document.getElementById("EditItemNum").innerHTML.replace("EditItem", ""); EditedIndexValue = Id; ConfirmBogoOffer(ItemId, FilterBOGO, CategoryId, Quantity, OldItemQuantity, EditIndexValue); } else { ConfirmBogoOffer(ItemId, FilterBOGO, CategoryId, Quantity, "", "") } } } } function DeleteExistedBogoOffers(ItemId) { if (document.getElementById("lblItemType").innerHTML == "EditItem") { var BogoItemId = ItemId; var BuyQuantity = 0; BogoItemId = BogoItemId.replace('"', "/"); var bogoaddeditems = localStorage.getItem("BogoItems"); if (bogoaddeditems != "undefined" && bogoaddeditems != null) { var bogoitems = JSON.parse(bogoaddeditems); if (bogoitems != null) { if (bogoitems.length > 0) { for (var i = 0; i < bogoitems.length; i++) { var BuyItemname = unescape(bogoitems[i].BuyItemName); var GetItemName = unescape(bogoitems[i].GetItemName); if (BuyItemname != "All Categories" && GetItemName != "All Categories") { if (bogoitems[i].Id == $(".BogoId" + BogoItemId).attr('id')) { BuyQuantity = bogoitems[i].BuyQuantity; } } else if (BuyItemname == "All Categories" && GetItemName == "All Categories") { if (bogoitems[i].Id == $(".BogoId" + BogoItemId).attr('id')) { BuyQuantity = bogoitems[i].BuyQuantity; } } else if (BuyItemname != "All Categories" && GetItemName == "All Categories") { if (bogoitems[i].Id == $(".BogoId" + BogoItemId).attr('id')) { BuyQuantity = bogoitems[i].BuyQuantity; } } else if (BuyItemname == "All Categories" && GetItemName != "All Categories") { if (bogoitems[i].Id == $(".BogoId" + BogoItemId).attr('id')) { BuyQuantity = bogoitems[i].BuyQuantity; } } } } } } if ($("#BogoId" + ItemId).length > 0) { var CartAddedItemsList = localStorage.getItem("TotalItems"); if (CartAddedItemsList != "undefined" && CartAddedItemsList != null) { var OfferedItems = JSON.parse(CartAddedItemsList); if (OfferedItems != null) { if (OfferedItems.length > 0) { for (var i = 0; i < OfferedItems.length; i++) { if (BogoItemId == OfferedItems[i].Id) { //if (BuyQuantity >= OfferedItems[i].Quantity) { var Itemcount1 = $(".BogoId" + BogoItemId).find("img").attr('id'); Itemcount1 = Itemcount1.replace("DeleteItem", ""); DeleteBogoItems($(".BogoId" + BogoItemId).attr('id'), Itemcount1); //} } } } } } } } } function ShowBogoOffersList(ItemId, BogoOffer, CategoryId, Quantity) { document.getElementById('ShowBogos').innerHTML = ""; if (BogoOffer.length > 0) { var bogoitems = ""; bogoitems += "<table style='width:80%;margin:0 auto;margin-top:20px'>"; var CatergoryItemsCount = 0; var ItemsCount = 0; // from CartAddedItemsList list we are getting total items belongs to the categoryid, if the buyquantity<= total items quantity goes to offer exist() var CartAddedItemsList = localStorage.getItem("TotalItems"); if (CartAddedItemsList != "undefined" && CartAddedItemsList != null) { var OfferedItems = JSON.parse(CartAddedItemsList); if (OfferedItems != null) { if (OfferedItems.length > 0) { for (var i = 0; i < OfferedItems.length; i++) { if (CategoryId == OfferedItems[i].CategoryId) { CatergoryItemsCount += parseInt(OfferedItems[i].Quantity); } if (ItemId == OfferedItems[i].Id) { ItemsCount += parseInt(OfferedItems[i].Quantity); } } } } } for (var i = 0; i < BogoOffer.length; i++) { var date = new Date(); var weekdays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var weekday = weekdays[date.getDay()]; if(BogoOffer[i].Availableweekdays.includes(weekday)){ var offer = 0; if (BogoOffer[i].Action == "Category") { if (parseInt(BogoOffer[i].BuyQuantity) <= parseInt(CatergoryItemsCount)) offer++; } else { if (parseInt(BogoOffer[i].BuyQuantity) <= parseInt(ItemsCount)) offer++; } if (offer != 0) { var BOGOId = BogoOffer[i].Id if (ItemId[0].length != 1) { var onClickAction = 'GetBogoOfferById("' + ItemId[0] + '", "' + BOGOId + '", "' + CategoryId + '", "' + Quantity + '","' + BogoOffer[i].GetId + '")'; } else { var onClickAction = 'GetBogoOfferById("' + ItemId + '", "' + BOGOId + '", "' + CategoryId + '", "' + Quantity + '","' + BogoOffer[i].GetId + '")'; } bogoitems += "<tr><td><div style='color:#13a7e2;font-size:16px;font-weight:bold'><label>" + BogoOffer[i].OfferName + "</label></div>"; if (BogoOffer[i].GetQuantity == "Custom %") bogoitems += "<div style='font-size:16px; margin-top: 10px;'><label>Buy " + BogoOffer[i].BuyQuantity + " <span style='color:red;'>" + BogoOffer[i].BuyItemName + "</span> Get " + BogoOffer[i].GetOffer + " % Off on <span style='color:red;'>" + BogoOffer[i].GetItemName + "</label></div>"; else if (BogoOffer[i].GetQuantity == "Custom $") bogoitems += "<div style='font-size:16px; margin-top: 10px;'><label>Buy " + BogoOffer[i].BuyQuantity + " <span style='color:red;'>" + BogoOffer[i].BuyItemName + "</span> Get $" + BogoOffer[i].GetOffer.toFixed(2) + " Off on <span style='color:red;'>" + BogoOffer[i].GetItemName + "</label></div>"; else bogoitems += "<div style='font-size:16px; margin-top: 10px;'><label>Buy " + BogoOffer[i].BuyQuantity + " <span style='color:red;'>" + BogoOffer[i].BuyItemName + "</span> Get " + BogoOffer[i].GetQuantity + " <span style='color:red;'>" + BogoOffer[i].GetItemName + "</label></div>"; bogoitems += "<div style='font-size:14px; margin-top: 10px;'><input type='button' class='BOGOadditem additem' value='Add Item' onclick='" + onClickAction + "' /></div></td></tr>"; bogoitems += "<tr><td style='font-size: 18px;text-align: center;padding-top: 6px;border-bottom: 1px solid #e6e3e3;padding-bottom: 5px;'>"; } } } } bogoitems += "</table>"; document.getElementById('ShowBogos').innerHTML += bogoitems; $(".BOGOadditem").attr("style", "width:45%;" + ButtonColor); // if ($("#lblbogovalidation").text() != "Bogo offer applied") { $('#ShowSpecials').css("display", "block"); // } if (BogoOffer.length == 1) { $('.divitems').css("display", "none"); } else { $('.divitems').css("display", "block"); } $(".ShowSpecialsadjust").css("margin-top", $(document).scrollTop() - 10); } function GetBogoOfferById(ItemId, BogoId, CategoryId, Quantity, Id) { document.getElementById("lblbogoaddeditemid").innerHTML = ItemId; var OfferMsg = ""; $('#ShowSpecials').css("display", "none"); $.ajax({ type: "POST", url: "Orders.aspx/GetAllBogoOffersById", data: "{'BogoId': '" + BogoId + "','Id': '" + Id + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var baseprice = 0; if (msg.d.length > 0) { //Bogo Offer message document.getElementById("lblbuyitemname").innerHTML = msg.d[0].BuyItemName; document.getElementById("lblgetitemname").innerHTML = msg.d[0].GetItemName; ConfirmBogoOffer(ItemId, msg.d, CategoryId, Quantity, "", ""); } if ($("#crosssellitemspanel").hasClass("Suggestionitemsexist")) { $("#crosssellitemspanel").fadeIn("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } } }); } function ShowSpecialsClose() { $('#ShowSpecials').css("display", "none"); if ($("#crosssellitemspanel").hasClass("Suggestionitemsexist")) { $("#crosssellitemspanel").fadeIn("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } ClearBogoOffer(); } function AddBogoOffer(Itemdetails, BogoOffer, CategoryId, Quantity) { document.getElementById("lblBogoItemId").innerHTML = BogoOffer.GetId; document.getElementById("lblBogoType").innerHTML = BogoOffer.Action; document.getElementById("lblBogoGetItemType").innerHTML = BogoOffer.GetItemType; document.getElementById("lblBogoId").innerHTML = BogoOffer.Id; if (BogoOffer.GetQuantity == "Custom %" || BogoOffer.GetQuantity == "Custom $") document.getElementById("lblBogoOfferQ").innerHTML = 1; else document.getElementById("lblBogoOfferQ").innerHTML = BogoOffer.GetQuantity; if (BogoOffer.GetCategoryId == "00000000-0000-0000-0000-000000000000" && BogoOffer.BuyItemName !="All Categories" && BogoOffer.GetItemName !="All Categories") {//Offer on Category if (document.getElementById(BogoOffer.GetId) != null) { if (document.getElementById(BogoOffer.GetId).getAttribute("onclick") == "BindCategoryItemsandSubCategories(this);") { $("#" + BogoOffer.GetId).trigger("click"); if ($("#lblMenuTheme").val() != "Grid" && $("#lblMenuTheme").val() != "Grid-no-images" && $("#lblMenuTheme").val() != "New-Grid" && $("#lblMenuTheme").val() != "New-Grid-no-images") if (document.getElementById("#" + BogoOffer.GetId) != null) $('html,body').animate({ scrollTop: $("#" + BogoOffer.GetId).offset().top }, 'slow'); else BindCategoryItemsandSubCategories(BogoOffer.GetId+"/"+BogoOffer.GetItemName.replace(" Category","")); } else if ($("#lblMenuTheme").val() != "Grid" && $("#lblMenuTheme").val() != "Grid-no-images" && $("#lblMenuTheme").val() != "New-Grid" && $("#lblMenuTheme").val() != "New-Grid-no-images") if (document.getElementById("#" + BogoOffer.GetId) != null) $('html,body').animate({ scrollTop: $("#" + BogoOffer.GetId).offset().top }, 'slow'); else BindCategoryItemsandSubCategories(BogoOffer.GetId+"/"+BogoOffer.GetItemName.replace(" Category","")); } else if ($("#lblMenuTheme").val() != "Grid" && $("#lblMenuTheme").val() != "Grid-no-images" && $("#lblMenuTheme").val() != "New-Grid" && $("#lblMenuTheme").val() != "New-Grid-no-images") if (document.getElementById("#" + BogoOffer.GetId) != null) $('html,body').animate({ scrollTop: $("#" + BogoOffer.GetId).offset().top }, 'slow'); else BindCategoryItemsandSubCategories(BogoOffer.GetId+"/"+BogoOffer.GetItemName.replace(" Category","")); } else if(BogoOffer.BuyItemName =="All Categories" && BogoOffer.GetItemName =="All Categories"){} else if(BogoOffer.BuyItemName !="All Categories" && BogoOffer.GetItemName =="All Categories"){} else { //Offer on Subcategory or subsub category or items if (document.getElementById(BogoOffer.GetCategoryId) != null) {//Check Category element exist or not if (document.getElementById(BogoOffer.GetCategoryId).getAttribute("onclick") == "BindCategoryItemsandSubCategories(this);") {// If exist is it opened or not $("#" + BogoOffer.GetCategoryId).trigger("click");// if not opened CheckIsOfferHasSubCategory(BogoOffer.GetSubCategoryId, BogoOffer.GetSubSubCategoryId, BogoOffer.GetId); } else CheckIsOfferHasSubCategory(BogoOffer.GetSubCategoryId, BogoOffer.GetSubSubCategoryId, BogoOffer.GetId); } else CheckIsOfferHasSubCategory(BogoOffer.GetSubCategoryId, BogoOffer.GetSubSubCategoryId, BogoOffer.GetId); } } function CheckIsOfferHasSubCategory(SubCategoryId, SubSubCategoryId, GetId) { if (SubCategoryId != "00000000-0000-0000-0000-000000000000") OpenSubCategoryId(SubCategoryId, SubSubCategoryId, GetId); else { //if ($("#lblMenuTheme").val() == "Grid") { // var bogodiv = "<div id='"+GetId+"'></div>"; // //bogodiv.setAttribute(); // GetItemOptions(bogodiv); //} //else { $("#" + GetId).trigger("click"); //} if ($("#lblMenuTheme").val() != "Grid" && $("#lblMenuTheme").val() != "Grid-no-images" && $("#lblMenuTheme").val() != "New-Grid" && $("#lblMenuTheme").val() != "New-Grid-no-images") if (document.getElementById("#" + GetId) != null) $('html,body').animate({ scrollTop: $('#' + GetId).offset().top }, 'slow'); } } function OpenSubCategoryId(SubCategoryId, SubSubCategoryId, GetId) { if (document.getElementById(SubCategoryId) != null) { if (document.getElementById(SubCategoryId).getAttribute("onclick") == "BindCategoryItemsandSubCategories(this);") { $("#" + SubCategoryId).trigger("click"); if (SubSubCategoryId != "00000000-0000-0000-0000-000000000000") OpenSubSubCategoryId(SubSubCategoryId, GetId); else { $("#" + GetId).trigger("click"); if ($("#lblMenuTheme").val() != "Grid" && $("#lblMenuTheme").val() != "Grid-no-images" && $("#lblMenuTheme").val() != "New-Grid" && $("#lblMenuTheme").val() != "New-Grid-no-images") $('html,body').animate({ scrollTop: $("#" + SubCategoryId).offset().top }, 'slow'); } } else { $("#" + GetId).trigger("click"); if ($("#lblMenuTheme").val() != "Grid" && $("#lblMenuTheme").val() != "Grid-no-images" && $("#lblMenuTheme").val() != "New-Grid" && $("#lblMenuTheme").val() != "New-Grid-no-images") $('html,body').animate({ scrollTop: $("#" + GetId).offset().top }, 'slow'); } } else { document.getElementById("lblBogoSubCatId").innerHTML = SubCategoryId; if (SubSubCategoryId != "00000000-0000-0000-0000-000000000000") document.getElementById("lblBogoSubSubId").innerHTML = SubSubCategoryId; } } function OpenSubSubCategoryId(SubSubCategoryId, GetId) { if (document.getElementById(SubSubCategoryId) != null) { if (document.getElementById(SubSubCategoryId).getAttribute("onclick") == "BindCategoryItemsandSubCategories(this);") $("#" + SubSubCategoryId).trigger("click"); else { $("#" + GetId).trigger("click"); if ($("#lblMenuTheme").val() != "Grid" && $("#lblMenuTheme").val() != "Grid-no-images" && $("#lblMenuTheme").val() != "New-Grid" && $("#lblMenuTheme").val() != "New-Grid-no-images") $('html,body').animate({ scrollTop: $("#" + GetId).offset().top }, 'slow'); } } else document.getElementById("lblBogoSubSubId").innerHTML = SubSubCategoryId; } function ClearBogoOffer() { document.getElementById("lblBogoItemId").innerHTML = ""; document.getElementById("lblBogoType").innerHTML = "" document.getElementById("lblBogoOfferQ").innerHTML = ""; document.getElementById("lblBogoGetItemType").innerHTML = "" document.getElementById("lblBogoId").innerHTML = ""; document.getElementById("lblBogoSubCatId").innerHTML = "" document.getElementById("lblBogoSubSubId").innerHTML = ""; } function OfferExist(OptionsCheck, ItemId) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var Bogoaddeditemid = document.getElementById("lblbogoaddeditemid").innerHTML; var OrderType = "CheckOfferExistOnGetId"; var Price = 0; var totalprice = 0; var CustomTax = 0; var TaxLabel = ""; var SubcategoryId = "00000000-0000-0000-0000-000000000000"; var SubSubcategoryId = "00000000-0000-0000-0000-000000000000"; var ItemCategoryId = "00000000-0000-0000-0000-000000000000"; if (document.getElementById("lblBogoGetItemType").innerHTML != "Category") ItemId = document.getElementById("lblBogoItemId").innerHTML; $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + ItemId + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var baseprice = 0; if (msg.d.length > 0) { if (msg.d.length > 0) { Price = msg.d[0].Price; baseprice = msg.d[0].Price; CustomTax = msg.d[0].CustomTax; TaxLabel = escape(msg.d[0].TaxLabel); SubcategoryId = msg.d[0].SubCategoryId; SubSubcategoryId = msg.d[0].SubSubCategoryId; ItemCategoryId = msg.d[0].ItemMainCategoryId; } var d = 0; ///Recalculating ItemPrice before adding to cart if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var J = 0; J < OptionsCheck.length; J++) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if($("#"+OptionsCheck[J].Choices[F].Id).hasClass("Validate")){ var price = OptionsCheck[J].Choices[F].Price; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { price = OptionsCheck[J].Choices[F].Price * document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { price = OptionsCheck[J].Choices[F].Price * document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } if (OptionsCheck[J].Choices[F].FreeOptions != "Yes") { if (OptionsCheck[J].Chargable == true) { d = +price + +d; } } if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions != "Yes") { d = +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } } else { for (var J = 0; J < OptionsCheck.length; J++) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { var price = OptionsCheck[J].Choices[F].Price; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { price = OptionsCheck[J].Choices[F].Price * document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { price = OptionsCheck[J].Choices[F].Price * document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } if (OptionsCheck[J].Choices[F].FreeOptions != "Yes") { if (OptionsCheck[J].Chargable == true) { d = +price + +d; } } if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions != "Yes") { d = +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } var allselect = document.getElementsByTagName("select"); for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { if (OptionsCheck[J].Type == "Dropdown" && OptionsCheck[J].Id == allselect[i].id) { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (ChoiceId == OptionsCheck[J].Choices[C].Id) { d = (+d + +OptionsCheck[J].Choices[C].Price); } } } } } } } } } } d = +d + +Price; var ddlvariation = $(".ddlVariation"); if (ddlvariation.length > 0) { if (ddlvariation[0].options[ddlvariation[0].selectedIndex].text != "Select Variation") { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { d = (+Variations[J].Price + +d); } } } } } totalprice = (document.getElementById('txtquantity').value * d); totalprice = totalprice.toFixed(2); if (totalprice != "0.00") { var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); localStorage.setItem("Page", JSON.stringify(sPage)); // var Itemdetails = document.getElementById("lblItemId").innerHTML.split('//'); var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { //$(".bntfnshedord").css("style", "display:inline-block"); var AddedItems = JSON.parse(retrievedData); var Items = new Array(); var BogoItems = new Array(); var Item = new Object; if (AddedItems != null) { Item.NoSalesTax = document.getElementById('lblItemNoTax').innerHTML; Item.CustomTax = document.getElementById("lblCustomTax").innerHTML; Item.TaxLabel = document.getElementById("lblTaxLabel").innerHTML; Item.Instructions = escape(document.getElementById('txtinstructions').value); $("#Instructions").attr("placeholder", Item.Instructions); Item.Quantity = document.getElementById('txtquantity').value; Item.Price = totalprice; var OrderType = localStorage.getItem("OrderType"); Item.OrderType = OrderType; Item.LId = document.getElementById('lblLId').value; Item.AppName = escape(document.getElementById('lblAppName').innerHTML); Item.ItemName = escape(msg.d[0].OptionName); Item.Id = ItemId; var OfferItemQuantity = 0; var GetItemQ = 0; for (var B = 0; B < msg.d[0].BOGOOffers.length; B++) { if (document.getElementById("lblBogoId").innerHTML == msg.d[0].BOGOOffers[B].Id) { Item.BuyQuantity = msg.d[0].BOGOOffers[B].BuyQuantity; Item.GetQuantity = msg.d[0].BOGOOffers[B].GetQuantity; Item.GetOffer = msg.d[0].BOGOOffers[B].GetOffer; Item.BuyItemName = escape(msg.d[0].BOGOOffers[B].BuyItemName); Item.CategoryId = msg.d[0].CategoryId; Item.GetId = msg.d[0].BOGOOffers[B].GetId; Item.OfferType = msg.d[0].BOGOOffers[B].Action; Item.GetItemType = msg.d[0].BOGOOffers[B].GetItemType; Item.BOGOId = msg.d[0].BOGOOffers[B].Id; BogoItems.push(Item); localStorage.setItem("BogoItems", JSON.stringify(BogoItems)); var CartAddedBuyItemsCount = 0; var AddedBOGOOfferCount = 0;//Count the number of added offer items by same bogo id var BuyItemsBasePrice = 0; // from CartAddedItemsList list we are getting total items belongs to the categoryid, if the buyquantity<= total items quantity goes to offer exist() var OfferIndexValues = ""; //for avoiding multiple offers, if already offer exist if (AddedItems != null) { if (AddedItems.length > 0) { for (var i = 0; i < AddedItems.length; i++) { if (msg.d[0].BOGOOffers[B].Action == "Category") { if (msg.d[0].BOGOOffers[B].BuyId == AddedItems[i].MainCategoryId && (AddedItems[i]['OfferFor'] === null || AddedItems[i]['OfferFor'] === undefined)) { // this conidtion for matching added items with this category CartAddedBuyItemsCount += parseInt(AddedItems[i].Quantity); BuyItemsBasePrice += parseFloat(AddedItems[i].BasePrice); if (OfferIndexValues == "") OfferIndexValues = i; else OfferIndexValues += "," + i; } else { if (Item.BOGOId != AddedItems[i].BOGOId && (msg.d[0].BOGOOffers[B].BuyId == AddedItems[i].Id || msg.d[0].BOGOOffers[B].BuyId == AddedItems[i].MainCategoryId)) { // this conition for matching bogo items which one has already offer if (AddedItems[i]['OfferIndexValues'] != null || AddedItems[i]['OfferIndexValues'] != undefined) { if (CartAddedBuyItemsCount > 0) CartAddedBuyItemsCount = CartAddedBuyItemsCount - parseInt(AddedItems[i].OfferItemQuantity); } } } } else { if ((msg.d[0].BOGOOffers[B].BuyId == AddedItems[i].Id || msg.d[0].BOGOOffers[B].BuyId == AddedItems[i].MainCategoryId) && (AddedItems[i]['OfferFor'] === null || AddedItems[i]['OfferFor'] === undefined)) { CartAddedBuyItemsCount += parseInt(AddedItems[i].Quantity); BuyItemsBasePrice += parseFloat(AddedItems[i].BasePrice); if (OfferIndexValues == "") OfferIndexValues = i; else OfferIndexValues += "," + i; } else { if (Item.BOGOId != AddedItems[i].BOGOId && (msg.d[0].BOGOOffers[B].BuyId == AddedItems[i].Id || msg.d[0].BOGOOffers[B].BuyId == AddedItems[i].MainCategoryId)) { if (AddedItems[i]['OfferIndexValues'] != null || AddedItems[i]['OfferIndexValues'] != undefined) { if (CartAddedBuyItemsCount > 0) CartAddedBuyItemsCount = CartAddedBuyItemsCount - parseInt(AddedItems[i].OfferItemQuantity); } } } } if (AddedItems[i].BOGOId != null) if (Item.BOGOId == AddedItems[i].BOGOId && AddedItems[i].Id != Item.Id)//For adding other offer items with same bogo id AddedBOGOOfferCount += parseInt(AddedItems[i].Quantity); } } } Item.OfferIndexValues = OfferIndexValues; if (CartAddedBuyItemsCount >= AddedBOGOOfferCount) CartAddedBuyItemsCount = CartAddedBuyItemsCount - AddedBOGOOfferCount;// subtracting other items count to same bogo id //Offer Item Quantity calculation if (msg.d[0].BOGOOffers[B].GetQuantity == "Custom %" || msg.d[0].BOGOOffers[B].GetQuantity == "Custom $") GetItemQ = 1; else GetItemQ = Item.GetQuantity; if (GetItemQ == parseInt(Item.BuyQuantity)) { // If get item and buy item quantity is equal if (CartAddedBuyItemsCount > parseInt(Item.Quantity)) OfferItemQuantity = Item.Quantity; else OfferItemQuantity = CartAddedBuyItemsCount; } else {//if buy item > or < get item quantity if (CartAddedBuyItemsCount >= parseInt(Item.BuyQuantity) && parseInt(Item.Quantity) >= GetItemQ) { OfferItemQuantity = parseInt(CartAddedBuyItemsCount / parseInt(Item.BuyQuantity)) * GetItemQ if (OfferItemQuantity >= parseInt(Item.Quantity)) { OfferItemQuantity = parseInt(parseInt(Item.Quantity) / GetItemQ) * GetItemQ; } } if(OfferItemQuantity == 0){ OfferItemQuantity = parseInt(Item.Quantity);} } var totalbaseprice = ((parseFloat(baseprice)) * document.getElementById('txtquantity').value).toFixed(2); if (msg.d[0].BOGOOffers[B].GetQuantity == "Custom %" || msg.d[0].BOGOOffers[B].GetQuantity == "Custom $") { if (msg.d[0].BOGOOffers[B].GetQuantity == "Custom %") { Item.OfferValue = ((parseFloat(OfferItemQuantity * baseprice) * parseFloat(msg.d[0].BOGOOffers[B].GetOffer)) / 100).toFixed(2); Item.OfferName = escape("Buy " + msg.d[0].BOGOOffers[B].BuyQuantity + " " + msg.d[0].BOGOOffers[B].BuyItemName + " Get " + msg.d[0].BOGOOffers[B].GetOffer + "% off on " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); } else { if (parseFloat(msg.d[0].BOGOOffers[B].GetOffer) > (parseFloat(baseprice))) Item.OfferValue = parseFloat(OfferItemQuantity * baseprice).toFixed(2); else Item.OfferValue = parseFloat(OfferItemQuantity * msg.d[0].BOGOOffers[B].GetOffer).toFixed(2); Item.OfferName = escape("Buy " + msg.d[0].BOGOOffers[B].BuyQuantity + " " + msg.d[0].BOGOOffers[B].BuyItemName + " Get $" + msg.d[0].BOGOOffers[B].GetOffer.toFixed(2) + " off on " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); } } else { Item.OfferName = escape("Buy " + msg.d[0].BOGOOffers[B].BuyQuantity + " " + msg.d[0].BOGOOffers[B].BuyItemName + " Get " + msg.d[0].BOGOOffers[B].GetQuantity + " " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); if (parseFloat(totalbaseprice) >= (parseFloat((OfferItemQuantity * baseprice)))) Item.OfferValue = (OfferItemQuantity * parseFloat(baseprice)).toFixed(2); else Item.OfferValue = totalbaseprice; } Item.OfferFor = msg.d[0].BOGOOffers[B].BuyId; Item.OfferItemQuantity = OfferItemQuantity; if (msg.d[0].BOGOOffers[B].IsPriceLess == true) { //validating is get item prices greater or not if (parseFloat(BuyItemsBasePrice) < (parseFloat((OfferItemQuantity * baseprice)))) { //if (Item.BuyQuantity == '1' && Item.GetQuantity == '1') { // if (GroupId != null && GroupId != "" && GroupId != undefined) { // AddItemstoCartinGrouporder(OptionsCheck); // } // else { // AddItemstoCart(OptionsCheck, "FromBOGO", Item.GetId, Item.OfferName, Item.OfferType); // } //} //else { alert("Sorry, the value of the item added with this Buy Category/Items price must be equal or lesser value"); $("body").removeClass("fullpanel"); document.getElementById("displayMultipleImages").innerHTML = ""; $("#grditemspanel").css("display", "none"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } //} return; } } } } Item.MainCategoryId = document.getElementById("lblMainCategoryId").innerHTML; Item.ItemCategoryId = ItemCategoryId; Item.SubcategoryId = SubcategoryId; Item.SubSubCategoryId = SubSubcategoryId; document.getElementById('txtinstructions').value = ""; Item.Choices = new Array(); for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Type != "Multiline Textbox" && OptionsCheck[J].Type != "Dropdown") { if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if ($('#' + OptionsCheck[J].Choices[F].Id).hasClass("Validate")) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } else { if ($('#' + OptionsCheck[J].Choices[F].Id).hasClass("Validate")) { if (OptionsCheck[J].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].DefaultVSOption == true) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } } } } } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } else { if (OptionsCheck[J].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].DefaultVSOption == true) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } } } } } else if (OptionsCheck[J].Type == "Dropdown") { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Id).val() != "") { var ChoiceId = $('#' + OptionsCheck[J].Id).val().split('/')[0]; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if (ChoiceId == OptionsCheck[J].Choices[F].Id) { var Choice = new Object; Choice.OptionId = OptionsCheck[J].Id Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Type = OptionsCheck[J].Type; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.PosId = OptionsCheck[J].PosId; Choice.ChildChoices = new Array(); Item.Choices.push(Choice); } } } } } else { var Choice = new Object; Choice.Id = ""; Choice.OptionId = OptionsCheck[J].Id; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Notify = (OptionsCheck[J].Notify); Choice.DefaultVSOption = (OptionsCheck[J].DefaultVSOption); Choice.Type = OptionsCheck[J].Type; if (document.getElementById(Choice.OptionId).value != "") { Choice.ChoiceName = escape(document.getElementById(Choice.OptionId).value); Item.Choices.push(Choice); } } } Item.Variations = new Array(); if (ddlvariation.length > 0) { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { var Variation = new Object; Variation.Id = Variations[J].Id; Variation.Name = Variations[J].Name; Item.Variations.push(Variation); } } } } Item.AddedDate = new Date(); Items.push(Item); var exists = 0; //if offer item exists in the cart, the below code for editing the item. var i = AddedItems.length; while (i--) { if (AddedItems[i].Id == Item.Id && AddedItems[i].BOGOId == Item.BOGOId && AddedItems[i].hasOwnProperty('OfferFor') && (arguments.length > 2 && AddedItems[i]['OfferFor'] === Item.OfferFor)) { exists++; AddedItems.splice(i, 1, Item); localStorage.setItem("TotalItems", JSON.stringify(AddedItems)); } } //if the item count increment , if the offer exists on itemid then we can add offer item below the incremented item id. the below code executed if (exists == 0) { var i = AddedItems.length; while (i--) { if (AddedItems[i] && AddedItems[i].hasOwnProperty('Id') && AddedItems[i].BOGOId == Item.BOGOId && (arguments.length > 2 && AddedItems[i]['Id'] === Item.OfferFor) && (AddedItems[i]['OfferFor'] === null || AddedItems[i]['OfferFor'] === undefined)) { exists++; //if itemid exists the list is splitting into 2 lists and concating with the new one at the middle of the both lists var p1 = AddedItems.slice(0, i + 1); var p2 = AddedItems.slice(i + 1); var allItems = p1.concat(Items, p2); localStorage.setItem("TotalItems", JSON.stringify(allItems)); setQuantitytoCart(); } } //if offer not existed then the offer is new one the below code executed if (exists == 0) { var allItems = AddedItems.concat(Items); localStorage.setItem("TotalItems", JSON.stringify(allItems)); setQuantitytoCart(); } } $(".displayonitem").css("display", "block"); if (localStorage.getItem("OrderType") == "DineInOnly") { // $(".yourordersteststyles").css("display", "none"); } else { $(".yourordersteststyles").css("display", "inline-block"); } if ((parseInt(GetItemQ) == parseInt(OfferItemQuantity)) && (parseInt(OfferItemQuantity) <= parseInt(Item.Quantity))) ClearBogoOffer(); } } if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } document.getElementById("lblbuyitemname").innerHTML = ""; document.getElementById("lblgetitemname").innerHTML = ""; $("body").removeClass("fullpanel"); if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "block"); $(".fcontainer").css("display", "block"); $(".Ordersmain").css("display", "block"); $(".orderdivr").css("display", "block"); $(".griditemscroll").css("width", "90%"); document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".mblcheckbtndiv").css("display", "inline-block"); } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".checkbtndiv").css("display", "inline-block"); } } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } } } } }); } function DefaultOfferExist(OptionsCheck, ItemId) { var Bogoaddeditemid = document.getElementById("lblbogoaddeditemid").innerHTML; var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var OrderType = "CheckOfferExistOnGetId"; var Price = 0; var totalprice = 0; var CustomTax = 0; var TaxLabel = ""; var SubcategoryId = "00000000-0000-0000-0000-000000000000"; var SubSubcategoryId = "00000000-0000-0000-0000-000000000000"; var ItemCategoryId = "00000000-0000-0000-0000-000000000000"; //if (document.getElementById("lblBogoGetItemType").innerHTML != "Category") // ItemId = document.getElementById("lblBogoItemId").innerHTML; $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + ItemId + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var baseprice = 0; if (msg.d.length > 0) { if (msg.d.length > 0) { Price = msg.d[0].Price; baseprice = msg.d[0].Price; CustomTax = msg.d[0].CustomTax; TaxLabel = escape(msg.d[0].TaxLabel); SubcategoryId = msg.d[0].SubCategoryId; SubSubcategoryId = msg.d[0].SubSubCategoryId; ItemCategoryId = msg.d[0].ItemMainCategoryId; } var d = 0; ///Recalculating ItemPrice before adding to cart if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var J = 0; J < OptionsCheck.length; J++) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if($("#"+OptionsCheck[J].Choices[F].Id).hasClass("Validate")){ var price = OptionsCheck[J].Choices[F].Price; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { price = OptionsCheck[J].Choices[F].Price * document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { price = OptionsCheck[J].Choices[F].Price * document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } if (OptionsCheck[J].Choices[F].FreeOptions != "Yes") { if (OptionsCheck[J].Chargable == true) { d = +price + +d; } } if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions != "Yes") { d = +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } } else { for (var J = 0; J < OptionsCheck.length; J++) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { var price = OptionsCheck[J].Choices[F].Price; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { price = OptionsCheck[J].Choices[F].Price * document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { price = OptionsCheck[J].Choices[F].Price * document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } if (OptionsCheck[J].Choices[F].FreeOptions != "Yes") { if (OptionsCheck[J].Chargable == true) { d = +price + +d; } } if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions != "Yes") { d = +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } } var allselect = document.getElementsByTagName("select"); for (var i = 0; i < allselect.length; i++) { var count = allselect[i].className.match("ddlOption"); if (count != null) { if (count.length > 0) { if (allselect[i].value != "") { var ChoiceId = allselect[i].value; for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Chargable == true) { if (OptionsCheck[J].Type == "Dropdown" && OptionsCheck[J].Id == allselect[i].id) { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { for (var C = 0; C < OptionsCheck[J].Choices.length; C++) { if (ChoiceId == OptionsCheck[J].Choices[C].Id) { d = (+d + +OptionsCheck[J].Choices[C].Price); } } } } } } } } } } d = +d + +Price; var ddlvariation = $(".ddlVariation"); if (ddlvariation.length > 0) { if (ddlvariation[0].options[ddlvariation[0].selectedIndex].text != "Select Variation") { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { d = (+Variations[J].Price + +d); } } } } } totalprice = (document.getElementById('txtquantity').value * d); totalprice = totalprice.toFixed(2); if (totalprice != "0.00") { var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); localStorage.setItem("Page", JSON.stringify(sPage)); // var Itemdetails = document.getElementById("lblItemId").innerHTML.split('//'); var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { //$(".bntfnshedord").css("style", "display:inline-block"); var AddedItems = JSON.parse(retrievedData); var Items = new Array(); var BogoItems = new Array(); var Item = new Object; if (AddedItems != null) { Item.NoSalesTax = document.getElementById('lblItemNoTax').innerHTML; Item.CustomTax = document.getElementById("lblCustomTax").innerHTML; Item.TaxLabel = document.getElementById("lblTaxLabel").innerHTML; Item.Instructions = escape(document.getElementById('txtinstructions').value); $("#Instructions").attr("placeholder", Item.Instructions); Item.Quantity = document.getElementById('txtquantity').value; Item.Price = totalprice; var OrderType = localStorage.getItem("OrderType"); Item.OrderType = OrderType; Item.LId = document.getElementById('lblLId').value; Item.AppName = escape(document.getElementById('lblAppName').innerHTML); Item.ItemName = escape(msg.d[0].OptionName); Item.Id = ItemId; var OfferItemQuantity = 0; var GetItemQ = 0; var addedBogoItems = localStorage.getItem("AddBogoItems"); if (addedBogoItems != "undefined" && addedBogoItems != null) { var bogoitems = JSON.parse(addedBogoItems); if (bogoitems != null) { if (bogoitems.length > 0) { for (var B = 0; B < bogoitems.length; B++) { if (document.getElementById("lblbogobuyitemname").innerHTML == "All Categories" && document.getElementById("lblbogogetitemname").innerHTML == "All Categories") { Item.BuyQuantity = bogoitems[B].BuyQuantity; Item.GetQuantity = bogoitems[B].GetQuantity; Item.GetOffer = bogoitems[B].GetOffer; Item.BuyItemName = escape(bogoitems[B].BuyItemName); Item.CategoryId = bogoitems[B].CategoryId; Item.GetId = bogoitems[B].GetId; Item.OfferType = bogoitems[B].Action; Item.GetItemType = bogoitems[B].GetItemType; Item.BOGOId = bogoitems[B].Id; Item.GetItemName = escape(bogoitems[B].GetItemName); BogoItems.push(Item); localStorage.setItem("BogoItems", JSON.stringify(BogoItems)); var CartAddedBuyItemsCount = 0; var AddedBOGOOfferCount = 0;//Count the number of added offer items by same bogo id var BuyItemsBasePrice = 0; // from CartAddedItemsList list we are getting total items belongs to the categoryid, if the buyquantity<= total items quantity goes to offer exist() var OfferIndexValues = ""; //for avoiding multiple offers, if already offer exist if (AddedItems != null) { if (AddedItems.length > 0) { for (var i = 0; i < AddedItems.length; i++) { if (bogoitems[B].Action == "Category") { if (bogoitems[B].BuyId == AddedItems[i].MainCategoryId && (AddedItems[i]['OfferFor'] === null || AddedItems[i]['OfferFor'] === undefined)) { // this conidtion for matching added items with this category CartAddedBuyItemsCount += parseInt(AddedItems[i].Quantity); BuyItemsBasePrice += parseFloat(AddedItems[i].BasePrice); if (OfferIndexValues == "") OfferIndexValues = i; else OfferIndexValues += "," + i; } else if (bogoitems[B].BuyId == "00000000-0000-0000-0000-000000000000" && bogoitems[B].BuyItemName == "All Categories" && bogoitems[B].GetItemName == "All Categories") { CartAddedBuyItemsCount += parseInt(AddedItems[i].Quantity); BuyItemsBasePrice += parseFloat(AddedItems[i].BasePrice); if (OfferIndexValues == "") OfferIndexValues = i; else OfferIndexValues += "," + i; } else { if (Item.BOGOId != AddedItems[i].BOGOId && (bogoitems[B].BuyId == AddedItems[i].Id || bogoitems[B].BuyId == AddedItems[i].MainCategoryId)) { // this conition for matching bogo items which one has already offer if (AddedItems[i]['OfferIndexValues'] != null || AddedItems[i]['OfferIndexValues'] != undefined) { if (CartAddedBuyItemsCount > 0) CartAddedBuyItemsCount = CartAddedBuyItemsCount - parseInt(AddedItems[i].OfferItemQuantity); } } } } else { if ((bogoitems[B].BuyId == AddedItems[i].Id || bogoitems[B].BuyId == AddedItems[i].MainCategoryId) && (AddedItems[i]['OfferFor'] === null || AddedItems[i]['OfferFor'] === undefined)) { CartAddedBuyItemsCount += parseInt(AddedItems[i].Quantity); BuyItemsBasePrice += parseFloat(AddedItems[i].BasePrice); if (OfferIndexValues == "") OfferIndexValues = i; else OfferIndexValues += "," + i; } else { if (Item.BOGOId != AddedItems[i].BOGOId && (bogoitems[B].BuyId == AddedItems[i].Id || bogoitems[B].BuyId == AddedItems[i].MainCategoryId)) { if (AddedItems[i]['OfferIndexValues'] != null || AddedItems[i]['OfferIndexValues'] != undefined) { if (CartAddedBuyItemsCount > 0) CartAddedBuyItemsCount = CartAddedBuyItemsCount - parseInt(AddedItems[i].OfferItemQuantity); } } } } if (AddedItems[i].BOGOId != null) if (Item.BOGOId == AddedItems[i].BOGOId && AddedItems[i].Id != Item.Id)//For adding other offer items with same bogo id AddedBOGOOfferCount += parseInt(AddedItems[i].Quantity); } } } Item.OfferIndexValues = OfferIndexValues; if (CartAddedBuyItemsCount >= AddedBOGOOfferCount) CartAddedBuyItemsCount = CartAddedBuyItemsCount - AddedBOGOOfferCount;// subtracting other items count to same bogo id //Offer Item Quantity calculation if (bogoitems[B].GetQuantity == "Custom %" || bogoitems[B].GetQuantity == "Custom $") GetItemQ = 1; else GetItemQ = Item.GetQuantity; if (GetItemQ == parseInt(Item.BuyQuantity)) { // If get item and buy item quantity is equal if (CartAddedBuyItemsCount > parseInt(Item.Quantity)) OfferItemQuantity = Item.Quantity; else OfferItemQuantity = CartAddedBuyItemsCount; } else {//if buy item > or < get item quantity if (CartAddedBuyItemsCount >= parseInt(Item.BuyQuantity) && parseInt(Item.Quantity) >= GetItemQ) { OfferItemQuantity = parseInt(CartAddedBuyItemsCount / parseInt(Item.BuyQuantity)) * GetItemQ if (OfferItemQuantity >= parseInt(Item.Quantity)) { OfferItemQuantity = parseInt(parseInt(Item.Quantity) / GetItemQ) * GetItemQ; } } if(OfferItemQuantity == 0){ OfferItemQuantity = parseInt(Item.Quantity);} else{ if (bogoitems[B].GetQuantity == "Custom %" || bogoitems[B].GetQuantity == "Custom $") {OfferItemQuantity = parseInt(CartAddedBuyItemsCount / parseInt(Item.BuyQuantity)) * GetItemQ;} } } if(OfferItemQuantity == 0){ OfferItemQuantity = parseInt(Item.Quantity);} var totalbaseprice = ((parseFloat(baseprice)) * document.getElementById('txtquantity').value).toFixed(2); if (bogoitems[B].GetQuantity == "Custom %" || bogoitems[B].GetQuantity == "Custom $") { if (bogoitems[B].GetQuantity == "Custom %") { Item.OfferValue = ((parseFloat(OfferItemQuantity * baseprice) * parseFloat(bogoitems[B].GetOffer)) / 100).toFixed(2); if( bogoitems[B].BuyItemName != "All Categories") {Item.OfferName = escape("Buy " + bogoitems[B].BuyQuantity + " " + bogoitems[B].BuyItemName + " Get " + bogoitems[B].GetOffer + "% off on " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid);} else{ Item.OfferName = escape("Buy " + bogoitems[B].BuyQuantity + " items from any category Get " + bogoitems[B].GetOffer + "% off on " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); } } else { if (parseFloat(bogoitems[B].GetOffer) > (parseFloat(baseprice))) Item.OfferValue = parseFloat(OfferItemQuantity * baseprice).toFixed(2); else Item.OfferValue = parseFloat(OfferItemQuantity * bogoitems[B].GetOffer).toFixed(2); if( bogoitems[B].BuyItemName != "All Categories") Item.OfferName = escape("Buy " + bogoitems[B].BuyQuantity + " " + bogoitems[B].BuyItemName + " Get $" + bogoitems[B].GetOffer.toFixed(2) + " off on " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); else Item.OfferName = escape("Buy " + bogoitems[B].BuyQuantity + " items from any category Get $" + bogoitems[B].GetOffer.toFixed(2) + " off on " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); } } else { if( bogoitems[B].BuyItemName != "All Categories") Item.OfferName = escape("Buy " + bogoitems[B].BuyQuantity + " " + bogoitems[B].BuyItemName + " Get " + bogoitems[B].GetQuantity + " " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); else Item.OfferName = escape("Buy " + bogoitems[B].BuyQuantity + " items from any category Get " + bogoitems[B].GetQuantity + " " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); if (parseFloat(totalbaseprice) >= (parseFloat((OfferItemQuantity * baseprice)))) Item.OfferValue = (OfferItemQuantity * parseFloat(baseprice)).toFixed(2); else Item.OfferValue = totalbaseprice; } if(bogoitems[B].BuyId=="00000000-0000-0000-0000-000000000000"){ Item.OfferFor = bogoitems[B].BuyId+"/"+document.getElementById("lblofferforcategoryid").innerHTML;} else Item.OfferFor = bogoitems[B].BuyId Item.Offerappliedfor="All Categories to All Categories"; Item.OfferItemQuantity = OfferItemQuantity; if (bogoitems[B].IsPriceLess == true) { //validating is get item prices greater or not if (parseFloat(BuyItemsBasePrice) < (parseFloat((OfferItemQuantity * baseprice)))) { //if (Item.BuyQuantity == '1' && Item.GetQuantity == '1') { // if (GroupId != null && GroupId != "" && GroupId != undefined) { // AddItemstoCartinGrouporder(OptionsCheck); // } // else { // AddItemstoCart(OptionsCheck, "FromBOGO", Item.GetId, Item.OfferName, Item.OfferType); // } //} //else { alert("Sorry, the value of the item added with this Buy Category/Items price must be equal or lesser value"); $("body").removeClass("fullpanel"); document.getElementById("displayMultipleImages").innerHTML = ""; $("#grditemspanel").css("display","none"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } // } return; } } } else if (document.getElementById("lblbogobuyitemname").innerHTML != "All Categories" && document.getElementById("lblbogogetitemname").innerHTML == "All Categories") { Item.BuyQuantity = bogoitems[B].BuyQuantity; Item.GetQuantity = bogoitems[B].GetQuantity; Item.GetOffer = bogoitems[B].GetOffer; Item.BuyItemName = escape(bogoitems[B].BuyItemName); Item.CategoryId = msg.d[0].CategoryId; Item.GetId = bogoitems[B].GetId; Item.OfferType = bogoitems[B].Action; Item.GetItemType = bogoitems[B].GetItemType; Item.BOGOId = bogoitems[B].Id; Item.GetItemName = escape(bogoitems[B].GetItemName); BogoItems.push(Item); localStorage.setItem("BogoItems", JSON.stringify(BogoItems)); var CartAddedBuyItemsCount = 0; var SameCartAddedBuyItemsCount = 0; var AddedBOGOOfferCount = 0;//Count the number of added offer items by same bogo id var BuyItemsBasePrice = 0; // from CartAddedItemsList list we are getting total items belongs to the categoryid, if the buyquantity<= total items quantity goes to offer exist() var OfferIndexValues = ""; //for avoiding multiple offers, if already offer exist if (AddedItems != null) { if (AddedItems.length > 0) { for (var i = 0; i < AddedItems.length; i++) { if (bogoitems[B].Action == "Category") { if (bogoitems[B].BuyId == AddedItems[i].MainCategoryId && (AddedItems[i]['OfferFor'] === null || AddedItems[i]['OfferFor'] === undefined)) { // this conidtion for matching added items with this category CartAddedBuyItemsCount += parseInt(AddedItems[i].Quantity); BuyItemsBasePrice += parseFloat(AddedItems[i].BasePrice); if (OfferIndexValues == "") OfferIndexValues = i; else OfferIndexValues += "," + i; } else if (bogoitems[B].BuyId != "00000000-0000-0000-0000-000000000000" && bogoitems[B].BuyItemName != "All Categories" && bogoitems[B].GetItemName == "All Categories") { CartAddedBuyItemsCount += parseInt(AddedItems[i].Quantity); BuyItemsBasePrice += parseFloat(AddedItems[i].BasePrice); if (OfferIndexValues == "") OfferIndexValues = i; else OfferIndexValues += "," + i; } else { if (Item.BOGOId != AddedItems[i].BOGOId && (bogoitems[B].BuyId == AddedItems[i].Id || bogoitems[B].BuyId == AddedItems[i].MainCategoryId)) { // this conition for matching bogo items which one has already offer if (AddedItems[i]['OfferIndexValues'] != null || AddedItems[i]['OfferIndexValues'] != undefined) { if (CartAddedBuyItemsCount > 0) CartAddedBuyItemsCount = CartAddedBuyItemsCount - parseInt(AddedItems[i].OfferItemQuantity); } } } if(bogoitems[B].BuyId == AddedItems[i].CategoryId) { SameCartAddedBuyItemsCount += parseInt(AddedItems[i].Quantity); } } else { if ((bogoitems[B].BuyId == AddedItems[i].Id || bogoitems[B].BuyId == AddedItems[i].MainCategoryId) && (AddedItems[i]['OfferFor'] === null || AddedItems[i]['OfferFor'] === undefined)) { CartAddedBuyItemsCount += parseInt(AddedItems[i].Quantity); BuyItemsBasePrice += parseFloat(AddedItems[i].BasePrice); if (OfferIndexValues == "") OfferIndexValues = i; else OfferIndexValues += "," + i; } else { if (Item.BOGOId != AddedItems[i].BOGOId && (bogoitems[B].BuyId == AddedItems[i].Id || bogoitems[B].BuyId == AddedItems[i].MainCategoryId)) { if (AddedItems[i]['OfferIndexValues'] != null || AddedItems[i]['OfferIndexValues'] != undefined) { if (CartAddedBuyItemsCount > 0) CartAddedBuyItemsCount = CartAddedBuyItemsCount - parseInt(AddedItems[i].OfferItemQuantity); } } } if(bogoitems[B].BuyId == AddedItems[i].CategoryId) { SameCartAddedBuyItemsCount += parseInt(AddedItems[i].Quantity); } } if (AddedItems[i].BOGOId != null) if (Item.BOGOId == AddedItems[i].BOGOId && AddedItems[i].Id != Item.Id)//For adding other offer items with same bogo id AddedBOGOOfferCount += parseInt(AddedItems[i].Quantity); } } } Item.OfferIndexValues = OfferIndexValues; if (CartAddedBuyItemsCount >= AddedBOGOOfferCount) CartAddedBuyItemsCount = CartAddedBuyItemsCount - AddedBOGOOfferCount;// subtracting other items count to same bogo id //Offer Item Quantity calculation if (bogoitems[B].GetQuantity == "Custom %" || bogoitems[B].GetQuantity == "Custom $") GetItemQ = 1; else GetItemQ = Item.GetQuantity; if (GetItemQ == parseInt(Item.BuyQuantity)) { // If get item and buy item quantity is equal if (CartAddedBuyItemsCount > parseInt(Item.Quantity)) OfferItemQuantity = Item.Quantity; else OfferItemQuantity = CartAddedBuyItemsCount; } else {//if buy item > or < get item quantity if (CartAddedBuyItemsCount >= parseInt(Item.BuyQuantity) && parseInt(Item.Quantity) >= GetItemQ) { OfferItemQuantity = parseInt(CartAddedBuyItemsCount / parseInt(Item.BuyQuantity)) * GetItemQ if (OfferItemQuantity >= parseInt(Item.Quantity)) { OfferItemQuantity = parseInt(parseInt(Item.Quantity) / GetItemQ) * GetItemQ; } } if(OfferItemQuantity == 0){ OfferItemQuantity = parseInt(Item.Quantity);} else{ if (bogoitems[B].GetQuantity == "Custom %" || bogoitems[B].GetQuantity == "Custom $") {OfferItemQuantity = parseInt(SameCartAddedBuyItemsCount / parseInt(Item.BuyQuantity)) * GetItemQ;} } } var totalbaseprice = ((parseFloat(baseprice)) * document.getElementById('txtquantity').value).toFixed(2); if (bogoitems[B].GetQuantity == "Custom %" || bogoitems[B].GetQuantity == "Custom $") { if (bogoitems[B].GetQuantity == "Custom %") { Item.OfferValue = ((parseFloat(OfferItemQuantity * baseprice) * parseFloat(bogoitems[B].GetOffer)) / 100).toFixed(2); Item.OfferName = escape("Buy " + bogoitems[B].BuyQuantity + " " + bogoitems[B].BuyItemName + " Get " + bogoitems[B].GetOffer + "% off on " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); } else { if (parseFloat(bogoitems[B].GetOffer) > (parseFloat(baseprice))) Item.OfferValue = parseFloat(OfferItemQuantity * baseprice).toFixed(2); else Item.OfferValue = parseFloat(OfferItemQuantity * bogoitems[B].GetOffer).toFixed(2); Item.OfferName = escape("Buy " + bogoitems[B].BuyQuantity + " " + bogoitems[B].BuyItemName + " Get $" + bogoitems[B].GetOffer.toFixed(2) + " off on " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); } } else { Item.OfferName = escape("Buy " + bogoitems[B].BuyQuantity + " " + bogoitems[B].BuyItemName + " Get " + bogoitems[B].GetQuantity + " " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); if (parseFloat(totalbaseprice) >= (parseFloat((OfferItemQuantity * baseprice)))) Item.OfferValue = (OfferItemQuantity * parseFloat(baseprice)).toFixed(2); else Item.OfferValue = totalbaseprice; } if(bogoitems[B].BuyId=="00000000-0000-0000-0000-000000000000") { Item.OfferFor = bogoitems[B].BuyId+"/"+document.getElementById("lblofferforcategoryid").innerHTML;} else Item.OfferFor = bogoitems[B].BuyId Item.OfferItemQuantity = OfferItemQuantity; if (bogoitems[B].IsPriceLess == true) { //validating is get item prices greater or not if (parseFloat(BuyItemsBasePrice) < (parseFloat((OfferItemQuantity * baseprice)))) { ////if (Item.BuyQuantity == '1' && Item.GetQuantity == '1') { //// if (GroupId != null && GroupId != "" && GroupId != undefined) { //// AddItemstoCartinGrouporder(OptionsCheck); //// } //// else { //// AddItemstoCart(OptionsCheck, "FromBOGO", Item.GetId, Item.OfferName, Item.OfferType); //// } ////} //else { alert("Sorry, the value of the item added with this Buy Category/Items price must be equal or lesser value"); $("body").removeClass("fullpanel"); document.getElementById("displayMultipleImages").innerHTML = ""; $("#grditemspanel").css("display","none"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } // } return; } } } else if (document.getElementById("lblbogobuyitemname").innerHTML == "All Categories" && document.getElementById("lblbogogetitemname").innerHTML != "All Categories") { Item.BuyQuantity = bogoitems[B].BuyQuantity; Item.GetQuantity = bogoitems[B].GetQuantity; Item.GetOffer = bogoitems[B].GetOffer; Item.BuyItemName = escape(bogoitems[B].BuyItemName); Item.CategoryId = msg.d[0].CategoryId; Item.GetId = bogoitems[B].GetId; Item.OfferType = bogoitems[B].Action; Item.GetItemType = bogoitems[B].GetItemType; Item.BOGOId = bogoitems[B].Id; Item.GetItemName = escape(bogoitems[B].GetItemName); BogoItems.push(Item); localStorage.setItem("BogoItems", JSON.stringify(BogoItems)); var CartAddedBuyItemsCount = 0; var AddedBOGOOfferCount = 0;//Count the number of added offer items by same bogo id var BuyItemsBasePrice = 0; // from CartAddedItemsList list we are getting total items belongs to the categoryid, if the buyquantity<= total items quantity goes to offer exist() var OfferIndexValues = ""; //for avoiding multiple offers, if already offer exist if (AddedItems != null) { if (AddedItems.length > 0) { for (var i = 0; i < AddedItems.length; i++) { if (bogoitems[B].Action == "Category") { if (bogoitems[B].BuyId == AddedItems[i].MainCategoryId && (AddedItems[i]['OfferFor'] === null || AddedItems[i]['OfferFor'] === undefined)) { // this conidtion for matching added items with this category CartAddedBuyItemsCount += parseInt(AddedItems[i].Quantity); BuyItemsBasePrice += parseFloat(AddedItems[i].BasePrice); if (OfferIndexValues == "") OfferIndexValues = i; else OfferIndexValues += "," + i; } else if (bogoitems[B].BuyId == "00000000-0000-0000-0000-000000000000" && bogoitems[B].BuyItemName == "All Categories" && bogoitems[B].GetItemName != "All Categories") { CartAddedBuyItemsCount += parseInt(AddedItems[i].Quantity); BuyItemsBasePrice += parseFloat(AddedItems[i].BasePrice); if (OfferIndexValues == "") OfferIndexValues = i; else OfferIndexValues += "," + i; } else { if (Item.BOGOId != AddedItems[i].BOGOId && (bogoitems[B].BuyId == AddedItems[i].Id || bogoitems[B].BuyId == AddedItems[i].MainCategoryId)) { // this conition for matching bogo items which one has already offer if (AddedItems[i]['OfferIndexValues'] != null || AddedItems[i]['OfferIndexValues'] != undefined) { if (CartAddedBuyItemsCount > 0) CartAddedBuyItemsCount = CartAddedBuyItemsCount - parseInt(AddedItems[i].OfferItemQuantity); } } } } else { if ((bogoitems[B].BuyId == AddedItems[i].Id || bogoitems[B].BuyId == AddedItems[i].MainCategoryId) && (AddedItems[i]['OfferFor'] === null || AddedItems[i]['OfferFor'] === undefined)) { CartAddedBuyItemsCount += parseInt(AddedItems[i].Quantity); BuyItemsBasePrice += parseFloat(AddedItems[i].BasePrice); if (OfferIndexValues == "") OfferIndexValues = i; else OfferIndexValues += "," + i; } else { if (Item.BOGOId != AddedItems[i].BOGOId && (bogoitems[B].BuyId == AddedItems[i].Id || bogoitems[B].BuyId == AddedItems[i].MainCategoryId)) { if (AddedItems[i]['OfferIndexValues'] != null || AddedItems[i]['OfferIndexValues'] != undefined) { if (CartAddedBuyItemsCount > 0) CartAddedBuyItemsCount = CartAddedBuyItemsCount - parseInt(AddedItems[i].OfferItemQuantity); } } } } if (AddedItems[i].BOGOId != null) if (Item.BOGOId == AddedItems[i].BOGOId && AddedItems[i].Id != Item.Id)//For adding other offer items with same bogo id AddedBOGOOfferCount += parseInt(AddedItems[i].Quantity); } } } Item.OfferIndexValues = OfferIndexValues; if (CartAddedBuyItemsCount >= AddedBOGOOfferCount) CartAddedBuyItemsCount = CartAddedBuyItemsCount - AddedBOGOOfferCount;// subtracting other items count to same bogo id //Offer Item Quantity calculation if (bogoitems[B].GetQuantity == "Custom %" || bogoitems[B].GetQuantity == "Custom $") GetItemQ = 1; else GetItemQ = Item.GetQuantity; if (GetItemQ == parseInt(Item.BuyQuantity)) { // If get item and buy item quantity is equal if (CartAddedBuyItemsCount > parseInt(Item.Quantity)) OfferItemQuantity = Item.Quantity; else OfferItemQuantity = CartAddedBuyItemsCount; } else {//if buy item > or < get item quantity if (CartAddedBuyItemsCount >= parseInt(Item.BuyQuantity) && parseInt(Item.Quantity) >= GetItemQ) { OfferItemQuantity = parseInt(CartAddedBuyItemsCount / parseInt(Item.BuyQuantity)) * GetItemQ if (OfferItemQuantity >= parseInt(Item.Quantity)) { OfferItemQuantity = parseInt(parseInt(Item.Quantity) / GetItemQ) * GetItemQ; } } if(OfferItemQuantity == 0){ OfferItemQuantity = parseInt(Item.Quantity);} else{ if (bogoitems[B].GetQuantity == "Custom %" || bogoitems[B].GetQuantity == "Custom $") {OfferItemQuantity = parseInt(CartAddedBuyItemsCount / parseInt(Item.BuyQuantity)) * GetItemQ;} } } var totalbaseprice = ((parseFloat(baseprice)) * document.getElementById('txtquantity').value).toFixed(2); if (bogoitems[B].GetQuantity == "Custom %" || bogoitems[B].GetQuantity == "Custom $") { if (bogoitems[B].GetQuantity == "Custom %") { Item.OfferValue = ((parseFloat(OfferItemQuantity * baseprice) * parseFloat(bogoitems[B].GetOffer)) / 100).toFixed(2); if( bogoitems[B].BuyItemName != "All Categories") Item.OfferName = escape("Buy " + bogoitems[B].BuyQuantity + " " + bogoitems[B].BuyItemName + " Get " + bogoitems[B].GetOffer + "% off on " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); else Item.OfferName = escape("Buy " + bogoitems[B].BuyQuantity + " items from any category Get " + bogoitems[B].GetOffer + "% off on " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); } else { if (parseFloat(bogoitems[B].GetOffer) > (parseFloat(baseprice))) Item.OfferValue = parseFloat(OfferItemQuantity * baseprice).toFixed(2); else Item.OfferValue = parseFloat(OfferItemQuantity * bogoitems[B].GetOffer).toFixed(2); if( bogoitems[B].BuyItemName != "All Categories") Item.OfferName = escape("Buy " + bogoitems[B].BuyQuantity + " " + bogoitems[B].BuyItemName + " Get $" + bogoitems[B].GetOffer.toFixed(2) + " off on " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); else Item.OfferName = escape("Buy " + bogoitems[B].BuyQuantity + " items from any category Get $" + bogoitems[B].GetOffer.toFixed(2) + " off on " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); } } else { if( bogoitems[B].BuyItemName != "All Categories") Item.OfferName = escape("Buy " + bogoitems[B].BuyQuantity + " " + bogoitems[B].BuyItemName + " Get " + bogoitems[B].GetQuantity + " " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); else Item.OfferName = escape("Buy " + bogoitems[B].BuyQuantity + " items from any category Get " + bogoitems[B].GetQuantity + " " + msg.d[0].OptionName + "/" + "BogoId" + Bogoaddeditemid); if (parseFloat(totalbaseprice) >= (parseFloat((OfferItemQuantity * baseprice)))) Item.OfferValue = (OfferItemQuantity * parseFloat(baseprice)).toFixed(2); else Item.OfferValue = totalbaseprice; } if(bogoitems[B].BuyId=="00000000-0000-0000-0000-000000000000") { Item.OfferFor = bogoitems[B].BuyId+"/"+document.getElementById("lblofferforcategoryid").innerHTML;} else Item.OfferFor = bogoitems[B].BuyId Item.Offerappliedfor="All Categories to "+Item.GetItemType; Item.OfferItemQuantity = OfferItemQuantity; if (bogoitems[B].IsPriceLess == true) { //validating is get item prices greater or not if (parseFloat(BuyItemsBasePrice) < (parseFloat((OfferItemQuantity * baseprice)))) { //if (Item.BuyQuantity == '1' && Item.GetQuantity == '1') { // if (GroupId != null && GroupId != "" && GroupId != undefined) { // AddItemstoCartinGrouporder(OptionsCheck); // } // else { // AddItemstoCart(OptionsCheck, "FromBOGO", Item.GetId, Item.OfferName, Item.OfferType); // } //} //else { alert("Sorry, the value of the item added with this Buy Category/Items price must be equal or lesser value"); $("body").removeClass("fullpanel"); document.getElementById("displayMultipleImages").innerHTML = ""; $("#grditemspanel").css("display","none"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } //} return; } } } } document.getElementById("lblofferforcategoryid").innerHTML = ""; } } } Item.MainCategoryId = document.getElementById("lblMainCategoryId").innerHTML; Item.ItemCategoryId = ItemCategoryId; Item.SubcategoryId = SubcategoryId; Item.SubSubCategoryId = SubSubcategoryId; document.getElementById('txtinstructions').value = ""; Item.Choices = new Array(); for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Type != "Multiline Textbox" && OptionsCheck[J].Type != "Dropdown") { if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if ($('#' + OptionsCheck[J].Choices[F].Id).hasClass("Validate")) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if(OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes"){ if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption); var textChoiceId = OptionsCheck[J].Choices[F].Id + "" + ChildChoice.OptionId; if (document.getElementById(textChoiceId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(textChoiceId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } Item.Choices.push(Choice); } } } } else { if ($('#' + OptionsCheck[J].Choices[F].Id).hasClass("Validate")) { if (OptionsCheck[J].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].DefaultVSOption == true) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Quantity = 0; Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption); var textChoiceId = OptionsCheck[J].Choices[F].Id + "" + ChildChoice.OptionId; if (document.getElementById(textChoiceId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(textChoiceId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } Item.Choices.push(Choice); } } } } } } } } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption); var textChoiceId = OptionsCheck[J].Choices[F].Id + "" + ChildChoice.OptionId; if (document.getElementById(textChoiceId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(textChoiceId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } else { if (OptionsCheck[J].Type == "CheckBoxes") { if (OptionsCheck[J].Choices[F].DefaultVSOption == true) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.PosId = OptionsCheck[J].PosId; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Type = OptionsCheck[J].Type; Choice.FreeOptions = OptionsCheck[J].Choices[F].FreeOptions; Choice.SelectionCount = OptionsCheck[J].Choices[F].SelectionCount; Choice.ChoiceName = escape(OptionsCheck[J].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.Quantity = 0; Choice.ChoicesQuantity = 0; if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.Quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; } if (document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id) != null) { Choice.ChoicesQuantity = document.getElementById("ddlQuantity" + OptionsCheck[J].Choices[F].Id).value; } Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } else { if(OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes"){ if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption == true) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText) + ":" + escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); ChildChoice.FreeOptions = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].FreeOptions; ChildChoice.SelectionCount = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].SelectionCount; Choice.ChildChoices.push(ChildChoice); } } } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].DefaultVSOption); var textChoiceId = OptionsCheck[J].Choices[F].Id + "" + ChildChoice.OptionId; if (document.getElementById(textChoiceId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(textChoiceId).value); Choice.ChildChoices.push(ChildChoice); } } else { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { var ChildChoiceId = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoiceId == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id; ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } } Item.Choices.push(Choice); } } } } } } else if (OptionsCheck[J].Type == "Dropdown") { if($("#"+OptionsCheck[J].Id).hasClass("Validate")) { if ($('#' + OptionsCheck[J].Id).val() != "") { var ChoiceId = $('#' + OptionsCheck[J].Id).val().split('/')[0]; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if (ChoiceId == OptionsCheck[J].Choices[F].Id) { var Choice = new Object; Choice.OptionId = OptionsCheck[J].Id Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Notify = (OptionsCheck[J].Notify); Choice.DefaultVSOption = (OptionsCheck[J].DefaultVSOption); Choice.Type = OptionsCheck[J].Type; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Price = OptionsCheck[J].Choices[F].Price; Choice.PosId = OptionsCheck[J].PosId; Choice.ChildChoices = new Array(); Item.Choices.push(Choice); } } } } } else { var Choice = new Object; Choice.Id = ""; Choice.OptionId = OptionsCheck[J].Id; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.Notify = (OptionsCheck[J].Notify); Choice.DefaultVSOption = (OptionsCheck[J].DefaultVSOption); Choice.Type = OptionsCheck[J].Type; if (document.getElementById(Choice.OptionId).value != "") { Choice.ChoiceName = escape(document.getElementById(Choice.OptionId).value); Item.Choices.push(Choice); } } } Item.Variations = new Array(); if (ddlvariation.length > 0) { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { var Variation = new Object; Variation.Id = Variations[J].Id; Variation.Name = Variations[J].Name; Item.Variations.push(Variation); } } } } Item.AddedDate = new Date(); Items.push(Item); var exists = 0; //if offer item exists in the cart, the below code for editing the item. var i = AddedItems.length; while (i--) { if (AddedItems[i].Id == Item.Id && AddedItems[i].BOGOId == Item.BOGOId && AddedItems[i].hasOwnProperty('OfferFor') && (arguments.length > 2 && AddedItems[i]['OfferFor'] === Item.OfferFor)) { exists++; AddedItems.splice(i, 1, Item); localStorage.setItem("TotalItems", JSON.stringify(AddedItems)); } } //if the item count increment , if the offer exists on itemid then we can add offer item below the incremented item id. the below code executed if (exists == 0) { var i = AddedItems.length; while (i--) { if (AddedItems[i] && AddedItems[i].hasOwnProperty('Id') && AddedItems[i].BOGOId == Item.BOGOId && (arguments.length > 2 && AddedItems[i]['Id'] === Item.OfferFor) && (AddedItems[i]['OfferFor'] === null || AddedItems[i]['OfferFor'] === undefined)) { exists++; //if itemid exists the list is splitting into 2 lists and concating with the new one at the middle of the both lists var p1 = AddedItems.slice(0, i + 1); var p2 = AddedItems.slice(i + 1); var allItems = p1.concat(Items, p2); localStorage.setItem("TotalItems", JSON.stringify(allItems)); setQuantitytoCart(); } } //if offer not existed then the offer is new one the below code executed if (exists == 0) { var allItems = AddedItems.concat(Items); localStorage.setItem("TotalItems", JSON.stringify(allItems)); setQuantitytoCart(); } } $(".displayonitem").css("display", "block"); if (localStorage.getItem("OrderType") == "DineInOnly") { // $(".yourordersteststyles").css("display", "none"); } else { $(".yourordersteststyles").css("display", "inline-block"); } if ((parseInt(GetItemQ) == parseInt(OfferItemQuantity)) && (parseInt(OfferItemQuantity) <= parseInt(Item.Quantity))) ClearBogoOffer(); } } if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } document.getElementById("lblbuyitemname").innerHTML = ""; document.getElementById("lblgetitemname").innerHTML = ""; $("body").removeClass("fullpanel"); if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "block"); $(".fcontainer").css("display", "block"); $(".Ordersmain").css("display", "block"); $(".orderdivr").css("display", "block"); $(".griditemscroll").css("width", "90%"); document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".mblcheckbtndiv").css("display", "inline-block"); } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".checkbtndiv").css("display", "inline-block"); } } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } } } } }); } function DeleteOfferExist(ItemId, Action,Itemcount,categoryId) { //if we add or edit item based on the buy quantity it will delete, if offer exists. var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { var i = AddedItems.length; while (i--) { if (AddedItems[i] && AddedItems[i].hasOwnProperty('OfferFor') && AddedItems[i]['OfferFor'] == categoryId) { AddedItems.splice(i, 1); localStorage.setItem("TotalItems", JSON.stringify(AddedItems));//Delete bogo offer if offer exist base on category if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } return; } else if (AddedItems[i] && AddedItems[i].hasOwnProperty('OfferFor') && AddedItems[i]['OfferFor'] == ItemId) { AddedItems.splice(i, 1); localStorage.setItem("TotalItems", JSON.stringify(AddedItems));//Delete bogo offer if offer exist base on item if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } return; } else if (AddedItems[i] && AddedItems[i].hasOwnProperty('OfferFor') && AddedItems[i]['OfferFor'] == "00000000-0000-0000-0000-000000000000/"+categoryId) { AddedItems.splice(i, 1); localStorage.setItem("TotalItems", JSON.stringify(AddedItems));//Delete bogo offer if offer exist base on all categories if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } return; } } } } } </script> <script type="text/javascript"> function setQuantitytoCart() { var Quantity = 0; var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { if (AddedItems.length > 0) { for (var g = 0; g < AddedItems.length; g++) { Quantity = +Quantity + +AddedItems[g].Quantity; if (Quantity > 1) { if (g == AddedItems.length - 1) { document.getElementById("lblitemcount").innerHTML = Quantity; document.getElementById("lblcartcounthf").Value = Quantity; $(".ordcartcount").text(Quantity); document.getElementById("lblcartcount").innerHTML = Quantity; $.ajax({ type: "POST", url: "Orders.aspx/SetSession", data: "{'Value': '" + Quantity + "'}", dataType: "json", contentType: "application/json", success: function (msg) { $("#couponsdisplay").css("display", "block"); $('.carright').css("display", "block"); //$(".urscart").css("width", $(".carright").width() + "px"); $(".Emptycart").css("display", "none"); $(".cartitems").css("display", "block"); } }); } } else { document.getElementById("lblcartcount").innerHTML = Quantity; } } } else { document.getElementById("lblcartcounthf").Value = "0"; $(".ordcartcount").text("0"); document.getElementById("lblcartcount").innerHTML = "0"; //$(".hmcrt1").css("display", "none"); //$(".carright").css({ "margin-top": "0px" }); $.ajax({ type: "POST", url: "Orders.aspx/SetSession", data: "{'Value': '" + Quantity + "'}", dataType: "json", contentType: "application/json", success: function (msg) { $("#couponsdisplay").css("display", ""); $('.carright').css("display", "block"); //$(".urscart").css("width", $(".carright").width() + "px"); $(".Emptycart").css("display", "block"); $(".cartitems").css("display", "none"); } }); } } } function BindItems() { var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; document.getElementById('tblCart').innerHTML = ""; if (AddedItems != null) { var itemnew = ""; for (var g = 0; g < AddedItems.length; g++) { if (AddedItems[g].LId == document.getElementById('lblLId').value) { var itmvaritaions = ""; var itmoptions = ""; var itmtotal = ""; var itminstru = ""; var trItem = document.createElement("tr"); if (AddedItems[g].OfferName != null) { setAttributes(trItem, { "style": "color:#333333;", "class": unescape(AddedItems[g].OfferName.split("/")[1]), "align": "center", "id": AddedItems[g].Id, }); } else { setAttributes(trItem, { "style": "color:#333333;", "align": "center", "id": AddedItems[g].Id, }); } var tdItem = document.createElement("td"); setAttributes(tdItem, { "class": "Order_contnet1", "width": "50%", "id": AddedItems[g].ItemCategoryId, }); var lblItem = document.createElement("span"); setAttributes(lblItem, { "style": "cursor:pointer;", "onclick": "EditItemOptions(this);", "id": "EditItem" + g, "class": "CartItem" }); var UnitType = ""; if (AddedItems[g].PriceType == "Per Unit") { UnitType = " (" + AddedItems[g].ItemUnitQty + " " + AddedItems[g].UnitName + ")"; } if (AddedItems[g].NoSalesTax == "true" || AddedItems[g].CustomTax == "0") lblItem.innerHTML += AddedItems[g].Quantity + UnitType + " " + unescape(AddedItems[g].ItemName) + " (No Tax)"; else lblItem.innerHTML += AddedItems[g].Quantity + UnitType + " " + unescape(AddedItems[g].ItemName) + " (" + unescape(AddedItems[g].TaxLabel) + ": " + AddedItems[g].CustomTax + "%)"; var DeleteItem = document.createElement("img"); setAttributes(DeleteItem, { "src": "images/DeleteCartItem.png", "class": "DeleteBogoItem" + AddedItems[g].Id, "onclick": "DeleteItem(this);", "alt": "DeleteItem" + AddedItems[g].Id, "id": "DeleteItem" + g, "style": "padding-left:6px;cursor:pointer;vertical-align: middle;width: 12px;" }); tdItem.appendChild(lblItem); tdItem.appendChild(DeleteItem); var OrderType = localStorage.getItem("OrderType"); if (AddedItems[g].Variations != null) { if (AddedItems[g].Variations.length > 0) { for (var v = 0; v < AddedItems[g].Variations.length; v++) { var brvariation = document.createElement("br"); tdItem.appendChild(brvariation); var lblVariations = document.createElement("span"); lblVariations.innerHTML = AddedItems[g].Variations[v].Name; tdItem.appendChild(lblVariations); itmvaritaions = AddedItems[g].Variations[v].Name; } } } if (AddedItems[g].Choices != null) { if (AddedItems[g].Choices.length > 0) { var br = document.createElement("br"); tdItem.appendChild(br); var lblOptions = document.createElement("span"); setAttributes(lblOptions, { "style": "font-size:10px;", }); for (var d = 0; d < AddedItems[g].Choices.length; d++) { if(d > 0){ if(lblOptions.innerHTML.indexOf("<br> ",lblOptions.innerHTML.length-34) == -1) lblOptions.innerHTML += "<br> "; } else { lblOptions.innerHTML = " "; } if (AddedItems[g].Choices[d].Notify == true) { if (AddedItems[g].Choices[d].ChoiceName != undefined) { var ChoicesQuantity = AddedItems[g].Choices[d].ChoicesQuantity; var Quantity = AddedItems[g].Choices[d].Quantity; if (Quantity == "0" || Quantity == undefined) Quantity = ""; if (d == 0) lblOptions.innerHTML += unescape(Quantity + " " + AddedItems[g].Choices[d].ChoiceName); else lblOptions.innerHTML += unescape(Quantity + " " + AddedItems[g].Choices[d].ChoiceName); if (ChoicesQuantity == "0" || ChoicesQuantity == undefined) ChoicesQuantity = ""; lblOptions.innerHTML += " " + ChoicesQuantity + "<br> "; var OptionId = ""; if (AddedItems[g].Choices[d].ChildChoices != undefined) { for (var W = 0; W < AddedItems[g].Choices[d].ChildChoices.length; W++) { if (AddedItems[g].Choices[d].ChildChoices[W].Notify == true) { if (AddedItems[g].Choices[d].ChildChoices[W].OptionId != OptionId) { if(lblOptions.innerHTML.indexOf("<br> ",lblOptions.innerHTML.length-34) == -1){ lblOptions.innerHTML += "<br> " + unescape(AddedItems[g].Choices[d].ChildChoices[W].ChoiceName); }else{ lblOptions.innerHTML += " " + unescape(AddedItems[g].Choices[d].ChildChoices[W].ChoiceName); } } else{ lblOptions.innerHTML += "<br> " + unescape(AddedItems[g].Choices[d].ChildChoices[W].ChoiceName); } OptionId = AddedItems[g].Choices[d].ChildChoices[W].OptionId; } } } } else { if (AddedItems[g].Choices[d].Measurement != undefined) { if (AddedItems[g].Choices[d].Measurement != "Lbs") lblOptions.innerHTML += unescape(AddedItems[g].Choices[d].Weight * AddedItems[g].Quantity + " " + AddedItems[g].Choices[d].Measurement) + " (" + AddedItems[g].Choices[d].Conversation + ")" + "<br> "; else lblOptions.innerHTML += unescape(AddedItems[g].Choices[d].Weight * AddedItems[g].Quantity + " " + AddedItems[g].Choices[d].Measurement) + "<br> "; } } tdItem.appendChild(lblOptions); itmoptions = lblOptions.innerHTML; } } } } if (AddedItems[g].OfferName != null) { var br = document.createElement("br"); tdItem.appendChild(br); var OfferName = document.createElement("span"); setAttributes(OfferName, { "style": "color:red;", "id": unescape(AddedItems[g].OfferName.split("/")[1]) }); OfferName.innerHTML += unescape(AddedItems[g].OfferName.split("/")[0]); tdItem.appendChild(OfferName); } if (AddedItems[g].Instructions != "") { var br = document.createElement("br"); tdItem.appendChild(br); var lblInstructions = document.createElement("span"); setAttributes(lblInstructions, { "style": "font-size:10.5px;", }); lblInstructions.innerHTML += "Instructions: " + unescape(AddedItems[g].Instructions); tdItem.appendChild(lblInstructions); if (AddedItems[g].Instructions != "Order instruction, suggestions") itminstru = "Instructions: " + unescape(AddedItems[g].Instructions); } trItem.appendChild(tdItem); var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Order_contnet1", "style": "text-align:center;vertical-align:baseline;", "width": "10%" }); var lblQuantity = document.createElement("span"); lblQuantity.innerHTML += AddedItems[g].Quantity; var tdPrice = document.createElement("td"); setAttributes(tdPrice, { "class": "Order_contnet1", "style": "text-align:right;vertical-align:baseline;", "width": "10%" }); var lblPrice = document.createElement("span"); lblPrice.innerHTML += document.getElementById("lblCurrency").innerHTML + AddedItems[g].Price; //document.getElementById("lblAlltotalprice").innerHTML = document.getElementById("lblCurrency").innerHTML + AddedItems[g].Price; tdPrice.appendChild(lblPrice); if (AddedItems[g].Choices != null) { if (AddedItems[g].Choices.length > 0) { var br = document.createElement("br"); tdItem.appendChild(br); var lblOptions = document.createElement("span"); setAttributes(lblOptions, { "style": "font-size:10px;", }); for (var d = 0; d < AddedItems[g].Choices.length; d++) { if(lblOptions.innerHTML.indexOf("<br>",lblOptions.innerHTML.length-4) == -1) lblOptions.innerHTML += "<br>"; if (AddedItems[g].Choices[d].Notify == true) { if (AddedItems[g].Choices[d].ChoiceName != undefined) { var ChoicesQuantity = AddedItems[g].Choices[d].ChoicesQuantity; var Quantity = AddedItems[g].Choices[d].Quantity; if (Quantity == "0" || Quantity == undefined) Quantity = ""; if (d == 0) lblOptions.innerHTML += document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].Price; else lblOptions.innerHTML += document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].Price; lblOptions.innerHTML += "<br>"; var OptionId = ""; if (AddedItems[g].Choices[d].ChildChoices != undefined) { for (var W = 0; W < AddedItems[g].Choices[d].ChildChoices.length; W++) { if (AddedItems[g].Choices[d].ChildChoices[W].Notify == true) { if (AddedItems[g].Choices[d].ChildChoices[W].OptionId != OptionId) { if(lblOptions.innerHTML.indexOf("<br>",lblOptions.innerHTML.length-4) == -1){ lblOptions.innerHTML += "<br>" + document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].ChildChoices[W].Price; }else{ lblOptions.innerHTML += document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].ChildChoices[W].Price; } //lblOptions.innerHTML += "<br>" + document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].ChildChoices[W].Price; } else{ lblOptions.innerHTML += "<br>" + document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].ChildChoices[W].Price; } OptionId = AddedItems[g].Choices[d].ChildChoices[W].OptionId; } } } } tdPrice.appendChild(lblOptions); } } } } itmtotal = lblPrice.innerHTML; document.getElementById("lbltotalamount").innerHTML = itmtotal; if (AddedItems[g].OfferName != null) { var br = document.createElement("br"); tdPrice.appendChild(br); var OfferValue = document.createElement("span"); setAttributes(OfferValue, { "style": "color:red;", "id": unescape(AddedItems[g].OfferName.split("/")[1]) }); OfferValue.innerHTML += document.getElementById("lblCurrency").innerHTML + AddedItems[g].OfferValue; tdPrice.appendChild(OfferValue); } if ($("#lblMenuTheme").val() != "Grid" && $("#lblMenuTheme").val() != "Grid-no-images" && $("#lblMenuTheme").val() != "New-Grid" && $("#lblMenuTheme").val() != "New-Grid-no-images") { trItem.appendChild(tdPrice); document.getElementById('tblCart').appendChild(trItem); } else { itemnew += "<tr id='" + AddedItems[g].Id + "'><td style='padding-left:14px'><span class='mncatfnt'>"; if (AddedItems[g].NoSalesTax == "true" || AddedItems[g].CustomTax == "0") itemnew += unescape(AddedItems[g].ItemName) + " (No Tax)</span>"; else itemnew += unescape(AddedItems[g].ItemName) + " (" + unescape(AddedItems[g].TaxLabel) + ": " + AddedItems[g].CustomTax + "%)</span>"; if (itmvaritaions != "") itemnew += "<div>" + itmvaritaions + "</div>"; if (itmoptions != "") itemnew += "<div>" + itmoptions + "</div>"; if (itminstru != "") itemnew += "<div style='font-size:12px'>" + itminstru + "</div>"; itemnew += "</td><td class='mncatwdth' style='padding-left:14px'>" + AddedItems[g].Quantity + UnitType + "</td><td class='mncatwdth1'>" + itmtotal + "</td>"; itemnew += "<td class='mncatwdth'><img src='images/EGreen.png' id='EditItem" + g + "' onclick='EditItemOptions(this)' style='margin-right:10px' /><img src='images/DeleteCartItem.png' alt='DeleteItem" + AddedItems[g].Id + "' id='DeleteItem" + g + "', onclick='DeleteItem(this)' /></td>"; itemnew += "</tr>"; if (AddedItems[g].OfferName != null) { itemnew += "<tr style='color:red'><td colspan='2'>" + unescape(AddedItems[g].OfferName) + "</td><td>" + document.getElementById("lblCurrency").innerHTML + AddedItems[g].OfferValue + "</td><td></td></tr>"; } if (g == AddedItems.length - 1) { document.getElementById('tblCart').innerHTML = itemnew; document.getElementById('itminfonew').innerHTML = ""; $("#itminfonew").removeClass("cartitemh"); document.getElementById('tblCart').innerHTML = "<tr><td style='padding-left:14px'>ITEM</td><td class='mncatwdth'>QTY</td><td>Price</td><td class='mncatwdth'>Edit</td></tr>" + itemnew; } } $(".displayonitem").css("display", "block"); if (localStorage.getItem("OrderType") == "DineInOnly") { // $(".yourordersteststyles").css("display", "none"); } else $(".yourordersteststyles").css("display", "inline-block"); } else { AddedItems.splice(g, 1); g--; } } localStorage["TotalItems"] = JSON.stringify(AddedItems); if (AddedItems.length == 0) { $(".displayonitem").css("display", "none"); localStorage.removeItem("TIntervel"); } if (AddedItems.length > 0) { if (DeliveryServicesCount > 0 && DeliveryService == "Show") { GetDeliveryServices(); } else { document.getElementById('tblDeliveryServices').innerHTML = ""; $(".dlvservices").css("display", "none"); $("#divdeliServicesRight").css("display", "none"); } $('.carright').css("display", "block"); //$(".urscart").css("width", $(".carright").width() + "px"); $(".Emptycart").css("display", "none"); $(".cartitems").css("display", "block"); var paymenttype = document.getElementById('onlinepayment').innerHTML; if (paymenttype == "Online Payment: No") { $(".promocodetext").css("display", "none"); $(".getdealbtn").css("display", "none"); $(".getdealbtn").fadeOut("slow"); $(".bntSubmittip").css("display", "none"); } var OrderType = localStorage.getItem("OrderType"); if (OrderType == "Delivery" || OrderType == "Shipping") { var UId = document.getElementById("UserId").innerHTML; if (UId != "" && UId != null) GetSavedAddress(); } } else { document.getElementById('tblDeliveryServices').innerHTML = ""; $(".dlvservices").css("display", "none"); if (DeliveryServicesCount > 0 && DeliveryService == "Show") { $("#divdeliServicesRight").css("display", "block"); } else { $("#divdeliServicesRight").css("display", "none"); } if ($("#lblMenuTheme").val() == "Grid" || $("#lblMenuTheme").val() == "Grid-no-images" || $("#lblMenuTheme").val() == "New-Grid" || $("#lblMenuTheme").val() == "New-Grid-no-images") { $(".scrollcart").removeClass("mncatnewpopup"); $(".carright").removeClass("mncatnewpopupsub"); $(".scrollcart").css("display", "none"); $("body").removeAttr("style"); $("body").attr("style",PageBackgroundColor); } else { $(".scrollcart").css("display", "block"); $('.carright').css("display", "block"); //$(".urscart").css("width", $(".carright").width() + "px"); $(".Emptycart").css("display", "block"); $(".cartitems").css("display", "none"); } } setQuantitytoCart(); } else { $('.carright').css("display", "block"); //$(".urscart").css("width", $(".carright").width() + "px"); $(".Emptycart").css("display", "block"); $(".cartitems").css("display", "none"); if ($("#lblMenuTheme").val() == "Grid" || $("#lblMenuTheme").val() == "Grid-no-images" || $("#lblMenuTheme").val() == "New-Grid" || $("#lblMenuTheme").val() == "New-Grid-no-images") { $(".scrollcart").removeClass("mncatnewpopup"); $(".carright").removeClass("mncatnewpopupsub"); $(".scrollcart").css("display", "none"); $("body").removeAttr("style"); $("body").attr("style",PageBackgroundColor); } else { $(".scrollcart").css("display", "block"); } document.getElementById("lblitemcount").innerHTML = "0"; document.getElementById("lblcartcount").innerText = "0"; var clength = "0"; $.ajax({ type: "POST", url: "Orders.aspx/SetSession", data: "{'Value': '" + clength + "'}", dataType: "json", contentType: "application/json", success: function (msg) { } }); } //if (window.innerWidth > 767) { // if ($("#lblMenuTheme").val() != "Grid") { // var scrollposition = $(window).scrollTop(); // var cartheight = $(".carright").css("height"); // var cartheight1 = $(".carright").height(); // var carttop = scrollposition - cartheight1; // if (carttop < 0) // carttop = 0; // else // carttop = carttop + 150; // if (window.location !== window.parent.location) { // //$(".carright").css({ "margin-top": "0px" }); // } // else { // if (carttop != 0) // $(".carright").css({ "margin-top": (carttop) + "px" }); // } // //$(".carright").css({ "margin-top": ($(window).scrollTop() / 2) + "px" }); // } // } SetOrderType(); if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } MobileCArt(); } function ClearItems() { var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); var retrievedData = localStorage.getItem("Page"); var Page = JSON.parse(retrievedData); if (Page != null) { if (Page.length > 0) { if (Page.toLowerCase() != sPage.toLowerCase()) { var ItemsData = localStorage.getItem("TotalItems"); var CheckItems = JSON.parse(ItemsData); if (CheckItems != null) { if (CheckItems.length > 0) { if(document.getElementById('lblAppName').innerHTML != unescape(CheckItems[0].AppName)){ alertify.set({ labels: { cancel: "Cancel", ok: "Ok" } }); var alrtmsg = ""; if (CheckItems[0].AppName != undefined) alrtmsg = "Leaving " + unescape(CheckItems[0].AppName) + " will clear your cart. Are you sure you want to leave?"; else alrtmsg = "Items added to another restaurant. Are you sure you want to clear your cart?"; alertify.confirm(alrtmsg, function (e) { if (e) { ClearLocalStorage(); BindOrderTypes(); } else window.location.href = sPath.replace(sPage, Page); }); } else ShowAddedItems(); } else ClearLocalStorage(); } else ShowAddedItems(); } else ShowAddedItems(); } else { var Orderstring = getQueryStrings(); var OId = Orderstring["OId"]; if (OId == undefined) { ClearLocalStorage(); } } } else { $('.carright').css("display", "block"); //$(".urscart").css("width", $(".carright").width() + "px"); $(".Emptycart").css("display", "block"); $(".cartitems").css("display", "none"); } } function ClearLocalStorage() { localStorage.removeItem("TotalItems"); localStorage.removeItem("EntityDisabled"); localStorage.removeItem("DeliveryAddress"); localStorage.removeItem("TIntervel"); localStorage.removeItem("OrderType"); localStorage.removeItem("DeliveryDetails"); localStorage.removeItem("DeliveryType"); document.getElementById("lblcartcounthf").Value = "0"; document.getElementById("lblcartcount").innerHTML = "0"; $(".ordcartcount").text("0"); //$(".hmcrt1").css("display", "none"); // BindOrderTypes(); } function ShowAddedItems() { var OrderType = localStorage.getItem("OrderType"); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } } function EditItemOptions(ItemOption) { var ItemId = $(ItemOption.parentNode.parentNode).attr("id"); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; //start Item Nutritions calling $(".nutritiontable1").fadeOut("fast"); $(".nutritiontable").fadeOut("fast"); Ninvisible(); GetItemNutrition(ItemId); //End Item Nutritions calling document.getElementById("lblorderfail").innerHTML = ""; var Id = $(ItemOption).attr("id"); document.getElementById("EditItemNum").innerHTML = Id; LoadEditItemImage(); document.getElementById('OptionTable').innerHTML = ""; document.getElementById("lblItemType").innerHTML = "EditItem"; if (GroupId != null && GroupId != "" && GroupId != undefined) { LoadItemOptionsinGroupOrder(ItemOption); } else {LoadItemOptions(ItemOption); } } function DeleteItem(Item) { alertify.set({ labels: { ok: "Yes", cancel: "No" } }); alertify.confirm("Do you want to delete this item?", function (e) { if (e) { CrossSellPanelStatus = ""; document.getElementById("lblorderfail").innerHTML = ""; LoadEditItemImage(); var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); var Itemcount = ($(Item).attr("id")).replace("DeleteItem", ""); var ItemId = ($(Item).attr("alt")).replace("DeleteItem", ""); var categoryId = ($(Item).closest('td').attr('id')); var bogoappliedrow = ($(Item).closest('tr').attr('class')); if (AddedItems != null) { if (bogoappliedrow == "undefined" || bogoappliedrow == undefined) { DeleteOfferdIdfromCart(ItemId, "Item", Itemcount, categoryId);//If we delete the item,if any offer exists on category the changes will be affected } removeByAttrOfferFor(AddedItems, 'OfferFor', ItemId);//if we delete the item, if any offer exists on this item retrievedData = localStorage.getItem("TotalItems"); AddedItems = JSON.parse(retrievedData); AddedItems = JSON.parse(retrievedData); if (AddedItems.length == Itemcount) AddedItems.splice(Itemcount - 1, 1); else if (AddedItems.length > Itemcount) AddedItems.splice(Itemcount, 1); localStorage["TotalItems"] = JSON.stringify(AddedItems); if (AddedItems.length == 0) { ClearBogoOffer(); document.getElementById("lblbogovalidation").innerHTML = ""; document.getElementById("lblallcattoallcat").innerHTML = ""; document.getElementById("lblallcattoany").innerHTML = ""; document.getElementById("lblanytoallcat").innerHTML = ""; localStorage.removeItem("BogoItems"); $(".Emptycart").css("display", "block"); $(".cartitems").css("display", "none"); } } var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } MobileCartDelete(); ReBindCartTiming(); setQuantitytoCart(); } else { } }); } function DeleteOfferdIdfromCart(ItemId, Action,Itemcount,categoryId) { //getting the categoryid from itemid DeleteOfferExist(ItemId, Action,Itemcount,categoryId) } function DeleteItemAfterBogoDelete(ItemId){ CrossSellPanelStatus = ""; document.getElementById("lblorderfail").innerHTML = ""; LoadEditItemImage(); var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); var Itemcount = $(".DeleteBogoItem" + ItemId).attr('id').replace("DeleteItem", ""); Itemcount = Itemcount.replace("DeleteItem", ""); //var Itemcount = Itemcount1; if (AddedItems != null) { var ItemId = ItemId; // DeleteOfferdIdfromCart(ItemId, "Item",Itemcount);//If we delete the item,if any offer exists on category the changes will be affected removeByAttrOfferFor(AddedItems, 'OfferFor', ItemId);//if we delete the item, if any offer exists on this item if (AddedItems.length >= Itemcount) AddedItems.splice(Itemcount, 1); localStorage["TotalItems"] = JSON.stringify(AddedItems); if (AddedItems.length == 0) { ClearBogoOffer(); document.getElementById("lblbogovalidation").innerHTML = ""; document.getElementById("lblallcattoallcat").innerHTML = ""; document.getElementById("lblallcattoany").innerHTML = ""; document.getElementById("lblanytoallcat").innerHTML = ""; localStorage.removeItem("BogoItems"); } } var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } MobileCartDelete(); ReBindCartTiming(); setQuantitytoCart(); } function DeleteBogoItems(Item,Itemcount1) { CrossSellPanelStatus = ""; document.getElementById("lblorderfail").innerHTML = ""; LoadEditItemImage(); var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); // var Itemcount = $(".DeleteBogoItem" + Item).attr('id'); var Itemcount = Itemcount1; if (AddedItems != null) { var ItemId = Item; DeleteOfferdIdfromCart(ItemId, "Item",Itemcount);//If we delete the item,if any offer exists on category the changes will be affected removeByAttrOfferFor(AddedItems, 'OfferFor', ItemId);//if we delete the item, if any offer exists on this item if (AddedItems.length >= Itemcount) AddedItems.splice(Itemcount, 1); localStorage["TotalItems"] = JSON.stringify(AddedItems); if (AddedItems.length == 0) { ClearBogoOffer(); document.getElementById("lblbogovalidation").innerHTML = ""; document.getElementById("lblallcattoallcat").innerHTML = ""; document.getElementById("lblallcattoany").innerHTML = ""; document.getElementById("lblanytoallcat").innerHTML = ""; localStorage.removeItem("BogoItems"); } } var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } MobileCartDelete(); ReBindCartTiming(); setQuantitytoCart(); } //this function should be usefull to delete the arraylist based on itemid i.e the name of the feild in array var removeByAttr = function (arr, attr, value) { var i = arr.length; while (i--) { if (arr[i] && arr[i].hasOwnProperty(attr) && (arguments.length > 2 && arr[i][attr] === value) && (arr[i]['OfferFor'] === null || arr[i]['OfferFor'] === undefined)) { arr.splice(i, 1); } } return arr; } var removeByAttrOfferFor = function (arr, attr, value) { var i = arr.length; while (i--) { if (arr[i] && arr[i].hasOwnProperty(attr) && arr[i][attr] === value) { arr.splice(i, 1); } } return arr; } function ReBindCartTiming() { var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null){ $.ajax({ type: "POST", url: "Orders.aspx/ReBindCartTiming", data: "{'Data': '" + localStorage.getItem("TotalItems") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == null) { var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems == null) { localStorage.removeItem("TIntervel"); } else if ((AddedItems.length == 0)) { localStorage.removeItem("TIntervel"); } } else { localStorage.setItem("TIntervel", msg.d); } } }); } else { localStorage.removeItem("TIntervel"); } } function LoadEditItemImage() { $("#tblCart").css('opacity', '0.2'); var height = $("#tblCart").css('height'); $(".addcategoryloadingimage2").css("margin-top", ((height.replace("px", "")) / 2) - 10).css("position", "absolute").css("left", "76%").css("display", "block"); } function CheckOrderTypeSettings(OrderType, OrderTypevalue) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var LocationId = document.getElementById('lblLId').value; var UrlType = document.getElementById('lblurlnametype').innerHTML; if (OrderTypevalue == OrderType && OrderType == "Shipping") { $(".providerdiv").css("display", "none"); $(".justtip").css("display", "none"); $(".notefordelivery").css("display", "none"); $(".deliveryHeading").text("Shipping Order Submission"); $(".DeliveryType").fadeIn("fast"); // End Delivery to shipping changes $('.BtnSquare').css("display", "none"); $('.btnStripe').css("display", "none"); $('#bntConfOrder').css("display", "none"); $('#mbntConfOrder').css("display", "none"); if (document.getElementById("lblCurrency").innerHTML != "₹") { if (document.getElementById("lblPaymentType").innerHTML == "square") { $('#BtnSquare').fadeIn("slow"); $('.btnpaywithmunchies').css("display", "none"); $('#fdButtonpay1').css("display", "none"); $('#Instamojo').css("display", "none"); } else { $('#fdButtonpay1').fadeIn("slow"); $('#Instamojo').css("display", "none"); $('#BtnSquare').css("display", "none"); } } else { $('#fdButtonpay1').fadeOut("slow");// user c/d delivery $('#Instamojo').fadeIn("slow"); } document.getElementById("lbldchange").innerHTML = ""; if (document.getElementById("SubmissionNotes").innerHTML != "") { $('.submissionnotes').text("Note: " + document.getElementById("SubmissionNotes").innerHTML); } LoadEditItemImage(); var UId = document.getElementById("UserId").innerHTML; if (UId != "") { AddItemstoPanel(); document.getElementById('btngust').style.display = "none"; $(".btnpaywithmunchies").fadeOut("slow"); $('.btnpaywithmunchies').css("display", "none"); $("#spnwelback").css("display", "none"); } else { document.getElementById('btngust').style.display = "none"; $("#spnwelback").css("display", "none"); $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 0); if (document.getElementById("lblRequireuseraccount").innerHTML == "true") { if (document.getElementById("promotitle").innerHTML != ""){ $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); } } if (document.getElementById("lbldchange").innerHTML == "OpenDpanel") $(".signinpanel").fadeOut("slow"); else { $(".signinpanel").fadeIn("slow"); return; } $("#signinpanel").find("input[type=text],input[type=password]").val(''); $(".registererror").css("display", "none"); $("#signinpanel").find("input[type=text],input[type=password]").removeClass("userlogin_formtext1Error").addClass("userlogin_formtext1"); document.getElementById('lblMsg12').innerHTML = ""; } BindOrderingPanel(OrderType, OrderTypevalue); } else { if (OrderTypevalue == "Delivery") { var Zone = localStorage.getItem("Zone"); var Thirdpartydelivery = localStorage.getItem("Thirdpartydelivery"); var LocationId = document.getElementById('lblLId').value; if (Zone != null) { $.ajax({ type: "POST", url: "Orders.aspx/ZoneDetailsByZoneId", data: "{'Zone': '" + Zone + "','LocationId': '" + LocationId + "','OrderType': ''}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0].MinimumOrder != null && msg.d[0].MinimumOrder != "") { var Price = 0; var Min = 0; var P = 0; var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { for (var w = 0; w < AddedItems.length; w++) { P = +P + +AddedItems[w].Price; } } Price = parseFloat(P); var M = msg.d[0].MinimumOrder; Min = parseFloat(M); if (Price >= Min) { BindOrderingPanel(OrderType, OrderTypevalue); } else { if (msg.d[0].appName != "Out Of the Zone") { $("#lblorderror").text("We require subtotal amount of " + document.getElementById("lblCurrency").innerHTML + msg.d[0].MinimumOrder); $(".ordererror").show().delay(3000).fadeOut(); $(".checkoutloaderdiv").delay(3000).fadeOut(); if (window.innerWidth < 767) { $(".mblcheckbtndiv").delay(3000).fadeIn(); } else { $(".checkbtndiv").delay(3000).fadeIn(); } return; } else { $("#lblorderror").text("We require subtotal amount of " + document.getElementById("lblCurrency").innerHTML + msg.d[0].MinimumOrder + " or more for out of zone orders"); $(".ordererror").show().delay(3000).fadeOut(); $(".checkoutloaderdiv").delay(3000).fadeOut(); if (window.innerWidth < 767) { $(".mblcheckbtndiv").delay(3000).fadeIn(); } else { $(".checkbtndiv").delay(3000).fadeIn(); } return; } } } else BindOrderingPanel(OrderType, OrderTypevalue); } } }); } else if (Thirdpartydelivery!=null) { BindOrderingPanel(OrderType, OrderTypevalue); } } $.ajax({ type: "POST", url: "orders.aspx/getOrderTypeSettings", data: "{'LocationId': '" + LocationId + "','OrderType':'" + escape(OrderType) + "','CustomOrderId':'" + escape(OrderTypevalue) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0].AllowTip == true){ if (msg.d[0].DefaultTipAmount != null){ if (msg.d[0].DefaultTipAmount != "") { document.getElementById("lblDefaultTipAmount").innerHTML = msg.d[0].DefaultTipAmount; } else { document.getElementById("lblDefaultTipAmount").innerHTML = ""; } } else { document.getElementById("lblDefaultTipAmount").innerHTML = ""; } } else{ document.getElementById("lblDefaultTipAmount").innerHTML = ""; } if (msg.d[0].DefaultTipAmount != null){ if (msg.d[0].LimitTimestoASAP != null) { if (msg.d[0].LimitTimestoASAP != false) { document.getElementById("LimitTimestoASAP").innerHTML = msg.d[0].LimitTimestoASAP; } else { document.getElementById("LimitTimestoASAP").innerHTML = "false"; } } else { document.getElementById("LimitTimestoASAP").innerHTML = "false"; } } else { document.getElementById("LimitTimestoASAP").innerHTML = "false"; } if (OrderTypevalue != "Delivery") { var PickUpminamount = msg.d[0].OrderMinAmount; if (PickUpminamount != "" && PickUpminamount != null) { var Price = 0; var Min = 0; var P = 0; var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { for (var w = 0; w < AddedItems.length; w++) { P = +P + +AddedItems[w].Price; } } Price = parseFloat(P); var M = PickUpminamount; Min = parseFloat(M); if (Price >= Min) { BindOrderingPanel(OrderType, OrderTypevalue); } else { $("#lblorderror").text("We require subtotal amount of " + document.getElementById("lblCurrency").innerHTML + PickUpminamount); $(".ordererror").show().delay(3000).fadeOut(); $(".checkoutloaderdiv").delay(3000).fadeOut(); if (window.innerWidth < 767) { $(".mblcheckbtndiv").delay(3000).fadeIn(); } else { $(".checkbtndiv").delay(3000).fadeIn(); } return; } } else BindOrderingPanel(OrderType, OrderTypevalue); } document.getElementById("finishorderblb").innerHTML = "finishorder"; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} $(".providerdiv").css("display", "none"); $(".deliveryHeading").text(OrderType + " Order Submission"); $('.BtnSquare').css("display", "none"); $('.btnStripe').css("display", "none"); document.getElementById("lbldouplicate").innerHTML = ""; if (msg.d[0].AllowInstore == true) { if (msg.d[0].CustomizeWord != "" && msg.d[0].CustomizeWord != null) $('.CODtext').text(msg.d[0].CustomizeWord); else { if (document.getElementById("lblCurrency").innerHTML == "₹") $('.CODtext').text("Cash On Delivery"); else $('.CODtext').text("Pay With Cash"); } if (document.getElementById("lblCurrency").innerHTML == "₹") { if (document.getElementById("Promoprice").innerHTML == "") { if (UrlType == "DineIn" && OrderType == "DineIn") { $('#bntConfOrder').css("display", "none"); } else { $('#bntConfOrder').fadeIn("slow"); } } else $('#bntConfOrder').css("display", "none"); } else { if (UrlType == "DineIn" && OrderType == "DineIn") { $('#bntConfOrder').css("display", "none"); } else { $('#bntConfOrder').fadeIn("slow"); } } if (msg.d[0].Customizedcash == true) { if (msg.d[0].CustomizedCashAs != "" && msg.d[0].CustomizedCashAs != null) $('.CODtext1').text(msg.d[0].CustomizedCashAs); else { if (document.getElementById("lblCurrency").innerHTML == "₹") $('.CODtext1').text("Cash On Delivery"); else $('.CODtext1').text("Pay With Cash"); } if (document.getElementById("lblCurrency").innerHTML == "₹") { if (document.getElementById("Promoprice").innerHTML == "") { if (UrlType == "DineIn" && OrderType == "DineIn") { $('#mbntConfOrder').css("display", "none"); } else { $('#mbntConfOrder').fadeIn("slow"); } } else $('#mbntConfOrder').css("display", "none"); } else { if (UrlType == "DineIn" && OrderType == "DineIn") { $('#mbntConfOrder').css("display", "none"); } else { $('#mbntConfOrder').fadeIn("slow"); } } } else{$('#mbntConfOrder').css("display", "none");} } else { $('#bntConfOrder').css("display", "none"); } $('.NormalForm').css("display", ""); if (msg.d[0].AllowOnline == true) { if (document.getElementById("lblCurrency").innerHTML != "₹") { if (document.getElementById("CCBaseURL").innerHTML != "") { $('#fdButtonpay1').fadeIn("slow"); $("#CardConnectform").css("display", "block"); $('.NormalForm').css("display", "none"); $('#Instamojo').css("display", "none"); $('#BtnSquare').css("display", "none"); } else if (document.getElementById("lblCloverPayment").innerHTML == "true") { $('#fdButtonpay1').fadeIn("slow"); $('.CardConnectform').fadeOut("slow"); $('.NormalForm').css("display", "block"); $('#Instamojo').css("display", "none"); $('#BtnSquare').css("display", "none"); $('#BtnCardConnect').css("display", "none"); } else if (document.getElementById("lblPaymentType").innerHTML == "square") { $('#BtnSquare').fadeIn("slow"); $('.btnpaywithmunchies').css("display", "none"); $('#fdButtonpay1').css("display", "none"); $('#Instamojo').css("display", "none"); $('#BtnCardConnect').css("display", "none"); } else $('#fdButtonpay1').fadeIn("slow");// user c/d delivery } if (document.getElementById("lblCurrency").innerHTML == "₹") { $('#Instamojo').fadeIn("slow"); $('#fdButtonpay1').css("display", "none"); } } else { $('#fdButtonpay1').css("display", "none"); $('#Instamojo').css("display", "none"); $('#BtnSquare').css("display", "none"); $('.CardConnectform').fadeOut("slow"); $('.NormalForm').css("display", "none"); $('#BtnCardConnect').css("display", "none"); } if (UrlType == "DineIn") { if (document.getElementById("lbldineintip").innerHTML == "true") $(".justtip").fadeIn("fast"); else $('.justtip').css("display", "none"); } else { if (msg.d[0].AllowTip == true){ $(".justtip").fadeIn("fast"); } else{ $('.justtip').css("display", "none"); } } if (msg.d[0].TextNotes != "") { $('.TextNotes').text(msg.d[0].TextNotes) $('.TextNotes').fadeIn("fast"); } else { $('.TextNotes').text("") $('.TextNotes').css("display", "none"); } var UId = document.getElementById("UserId").innerHTML; var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["CustomWebsites"]; if (CustomWebsites == undefined) { if (UId != "") { if (document.getElementById("lblPaymentType").innerHTML == "square") { $('.btnpaywithmunchies').css("display", "none"); $('.munchiesAmount').css("display", "none"); } else { var Atype = document.getElementById("lblAwardType").innerHTML; if (Atype == "Munchies" || Atype == "Points") { $('.btnpaywithmunchies').fadeIn("slow"); } else { $('.btnpaywithmunchies').css("display", "none"); $('.btnpaywithmunchies').fadeOut("slow"); } } } } else { $('.btnpaywithmunchies').css("display", "none"); $('.munchiesAmount').css("display", "none"); } if (document.getElementById("Promoprice").innerHTML != "") { if (document.getElementById("lblCurrency").innerHTML != "$") { $('#bntConfOrder').css("display", "none"); $('#mbntConfOrder').css("display", "none"); } $('.btnpaywithmunchies').css("display", "none"); } } else { $('#fdButtonpay1').css("display", "none"); $('#Instamojo').css("display", "none"); $('#BtnSquare').css("display", "none"); } } }); } } function FinishOrderValidation() { checkthecalenderdate(); var UrlType = document.getElementById('lblurlnametype').innerHTML; var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.selectedIndex != -1) { var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; if (OrderType != "--Select Order Type--") FinishOrder(); else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".deliveryvalidationpanel").css("margin-top", $(document).scrollTop() - 0); } } else { $(".deliveryvalidationpanel").fadeIn("slow"); $(".deliveryvalidationpanel").css("margin-top", $(document).scrollTop() - 0); } } function FinishOrder() { $(".CustomAdvnacedSettings").fadeOut("fast"); $(".ddlAdvnacedSettings").fadeOut("fast"); $(".screenAdvnacedSettings").fadeOut("fast"); $(".AdvnacedSettings").fadeOut("fast"); $(".advancedineinsettings").fadeOut("fast"); $(".checkinsettings").css("display","none"); var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; document.getElementById("tblUserDrivers").innerHTML = ""; var ItemsData = localStorage.getItem("TotalItems"); var CheckItems = JSON.parse(ItemsData); if (CheckItems != null) { if (CheckItems.length > 0) { uncheckpaymentselection(); GetCardBillingInfo(); if (CheckItems[0].LId != null && CheckItems[0].LId != "00000000-0000-0000-0000-000000000000" && CheckItems[0].LId != "undefined") { if (CheckItems[0].LId == document.getElementById('lblLId').value) { } else { $("#lblorderror").text("Sorry you are trying to place an order with multiple restaurants. Once refresh the page and try again"); $(".ordererror").show().delay(3000).fadeOut(); $(".checkoutloaderdiv").delay(3000).fadeOut(); if (window.innerWidth < 767) { $(".mblcheckbtndiv").delay(3000).fadeIn(); } else { $(".checkbtndiv").delay(3000).fadeIn(); } return; } } $('.debitpnl').fadeOut("slow"); document.getElementById("lblorderfail").innerHTML = ""; var UId = document.getElementById("UserId").innerHTML; if (UId != "") { document.getElementById("txtcardname").value = document.getElementById("FirstName").innerHTML; document.getElementById("txtClastname").value = document.getElementById("LastName").innerHTML; GetUserDetails(); } if (OrderTypevalue == "Delivery") { var ZoneId = localStorage.getItem("Zone"); if (ZoneId == "00000000-0000-0000-0000-000000000000") { $("#lblorderror").text("We're sorry! We don't deliver to this address."); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblorderfail").innerHTML = ""; $('.userdeliveryloader').css("display", "none"); $(".checkoutloaderdiv").delay(3000).fadeOut(); if (window.innerWidth < 767) { $(".mblcheckbtndiv").delay(3000).fadeIn(); } else { $(".checkbtndiv").delay(3000).fadeIn(); } return; } if ((document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value != "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value != "") || (document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value != "" && document.getElementById("txtvalidationstate").value != "") || (document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value != "") ) { deliverycheck(); return; } document.getElementById('VALID').innerHTML = "1"; if (document.getElementById('AdrValue').innerHTML == "NewId") { GetSavedAddress(); } } else if (OrderTypevalue == "Shipping") { document.getElementById("finishorderblb").innerHTML = "finishorder"; var ShippingZoneId = localStorage.getItem("ShippingZoneId"); if (ShippingZoneId != null) { var Country = ""; var State = ""; var City = ""; var Address = document.getElementById("txtshpaddress").value; var dcountry = document.getElementById("ddlshpcountry"); Country = dcountry.options[dcountry.selectedIndex].text; var ddlshpState = document.getElementById("ddlshpState"); State = ddlshpState.options[ddlshpState.selectedIndex].text; City = $("#txtshpcity").val(); Zip = $("#txtshpzip").val(); if (Address != "" && Country != "Select Country" && State != "" && City != "") { document.getElementById("txtline1").value = Address; document.getElementById("txtcity").value = City; document.getElementById("txtstate").value = State; document.getElementById("txtZip").value = Zip; } else { WanttoShipping(); return; } } else { WanttoShipping(); return; } } else { if (OrderType != OrderTypevalue || OrderType== "DineIn") { GetCustomOrderTypeSettings(); } else { document.getElementById("AdvancedOption").innerHTML = ""; document.getElementById("lblEnableSignIn").innerHTML = ""; } } var vOrderType = OrderType; if (OrderTypevalue != "Shipping" && OrderTypevalue != "Delivery") { vOrderType = "PickUp"; $(".deliveryestpara").css("display", "none"); $(".creditcardinfopara").css("display", "none"); } else { $(".deliveryestpara").css("display", "block"); $(".creditcardinfopara").css("display", "block"); } var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); var arr = new Array(); if (AddedItems != null) { for (var S = 0; S < AddedItems.length; S++) { arr[S] = { Id: AddedItems[S].Id } } } $.ajax({ type: "POST", url: "Orders.aspx/CheckItemsAvailability", data: "{'retrievedData': '" + JSON.stringify(arr) + "','Type': '" + vOrderType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var Itemdetails = msg.d[4].Ids.split(';'); var n = 0; if (Itemdetails.length > 0) { for (var I = 0; I < Itemdetails.length; I++) { var details = Itemdetails[I].split(','); var cou = 0; for (var C = 0; C < CheckItems.length; C++) { if (details[0] == CheckItems[C].Id) { cou = cou + parseInt(CheckItems[C].Quantity); } } if (parseInt(cou) > parseInt(details[1])) { n++; var Available = $("#tblCart").find("tr#" + details[0]); var Available1 = Available.find("td span.CartItem"); Available1.css("color", "red"); } } } if (n > 0) { $("#lblorderror").text("Some of the items in your cart are not available, You can proceed by decreasing the quantity"); $(".ordererror").show().delay(3000).fadeOut(); $(".checkoutloaderdiv").delay(3000).fadeOut(); if (window.innerWidth < 767) { $(".mblcheckbtndiv").delay(3000).fadeIn(); } else { $(".checkbtndiv").delay(3000).fadeIn(); } return; } if (msg.d[0].Ids != "" || msg.d[1].Ids != "" || msg.d[2].Ids != "" || msg.d[3].Ids != "") { if (msg.d[0].Ids != "") { var CheckedID = msg.d[0].Ids.split(','); for (var K = 0; K < CheckedID.length; K++) { var Available = $("#tblCart").find("tr#" + CheckedID[K]); var Available1 = Available.find("td span.CartItem"); Available1.css("color", "red"); } $("#lblorderror").text("Some of the items in your cart are not available"); $(".ordererror").show().delay(3000).fadeOut(); $(".checkoutloaderdiv").delay(3000).fadeOut(); if (window.innerWidth < 767) { $(".mblcheckbtndiv").delay(3000).fadeIn(); } else { $(".checkbtndiv").delay(3000).fadeIn(); } return; } else if (msg.d[1].Ids != "") { var CheckedID = msg.d[1].Ids.split(','); for (var K = 0; K < CheckedID.length; K++) { var Available = $("#tblCart").find("tr#" + CheckedID[K]); var Available1 = Available.find("td span.CartItem"); Available1.css("color", "red"); } $("#lblorderror").text("Some of the items in your cart are inactive"); $(".ordererror").show().delay(3000).fadeOut(); $(".checkoutloaderdiv").delay(3000).fadeOut(); if (window.innerWidth < 767) { $(".mblcheckbtndiv").delay(3000).fadeIn(); } else { $(".checkbtndiv").delay(3000).fadeIn(); } return; } else if (msg.d[2].Ids != "") { var CheckedID = msg.d[2].Ids.split(','); for (var K = 0; K < CheckedID.length; K++) { var Available = $("#tblCart").find("tr#" + CheckedID[K]); var Available1 = Available.find("td span.CartItem"); Available1.css("color", "red"); } $("#lblorderror").text("Items in your cart with red color are not available for " + OrderType); $(".ordererror").show().delay(3000).fadeOut(); $(".checkoutloaderdiv").delay(3000).fadeOut(); if (window.innerWidth < 767) { $(".mblcheckbtndiv").delay(3000).fadeIn(); } else { $(".checkbtndiv").delay(3000).fadeIn(); } return; } if (msg.d[3].Ids != "") { var CheckedID = msg.d[3].Ids.split(','); CheckOrderTypeSettings(OrderType, OrderTypevalue); } } //else if (msg.d[5].Ids != "") //{ // var Orderstring = getQueryStrings(); // var OId = Orderstring["OId"]; // if (OId != undefined) { // $("#lblorderror").text("Your reorder is not working because of menu changes. Try placing a new order again"); // $(".ordererror").show().delay(3000).fadeOut(); // return; // } // else { // $("#lblorderror").text("Your items are not available now because of menu changes. Try placing a new order again"); // $(".ordererror").show().delay(3000).fadeOut(); // return; // } //} else { CheckOrderTypeSettings(OrderType, OrderTypevalue); } } }); } } } function BindOrderingPanel(OrderType, OrderTypevalue) { AddItemstoPanel(); if (document.getElementById("SubmissionNotes").innerHTML != "") $('.submissionnotes').text("Note: " + document.getElementById("SubmissionNotes").innerHTML); LoadEditItemImage(); var UrlType = document.getElementById('lblurlnametype').innerHTML; var UId = document.getElementById("UserId").innerHTML; if (UId != "") { if (document.getElementById("promotitle").innerHTML != "") { if (document.getElementById("lblCurrency").innerHTML != "$"){ $('#bntConfOrder').css("display", "none"); $('#mbntConfOrder').css("display", "none"); } $('#Button6').css("display", "none"); } OrderHours(); } else { var guestorder = document.getElementById('lblguestodrbtn').value; if (document.getElementById('popupsscroll').innerHTML == "over") $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 500); else $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 0); if (document.getElementById("lblRequireuseraccount").innerHTML == "true") { if (document.getElementById("promotitle").innerHTML != ""){ $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); }else{ $(".userstyleguest").css("display", "block"); $("#spnwelback").css("display", "block"); } } else if (guestorder == "False") { document.getElementById('btngust').style.display = "none"; $("#spnwelback").css("display", "none"); } else { $(".userstyleguest").css("display", "block");$("#spnwelback").css("display", "block"); } var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["demo"]; if (CustomWebsites == "demo") { GuestLogin(); } else { if (document.getElementById("lbldchange").innerHTML == "OpenDpanel") { $(".signinpanel").fadeOut("slow"); document.getElementById("lbldchange").innerHTML = ""; } else { if(OrderTypevalue != OrderType){ GetCustomOrderSettings(); } else if (UrlType == "DineIn" && OrderType == "DineIn") { GuestLogin(); } else { $(".signinpanel").fadeIn("slow"); } // $("#btngust").css("display", "none"); } } $("#signinpanel").find("input[type=text],input[type=password]").val(''); $(".registererror").css("display", "none"); $("#signinpanel").find("input[type=text],input[type=password]").removeClass("userlogin_formtext1Error").addClass("userlogin_formtext1"); document.getElementById('lblMsg12').innerHTML = ""; if (OrderTypevalue == "Shipping"){ document.getElementById('btngust').style.display = "none"; $("#spnwelback").css("display", "none"); } } } function GetCustomOrderSettings() { var UrlType = document.getElementById('lblurlnametype').innerHTML; var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; if (OrderTypevalue != OrderType) { $.ajax({ type: "POST", url: "Orders.aspx/GetCustomOrderTypeSettings", data: "{'Id': '" + OrderTypevalue + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if(msg.d[0].EnableSignIn == true){ GuestLogin(); }else { $(".signinpanel").fadeIn("slow"); } }else { $(".signinpanel").fadeIn("slow"); } } }); } } function RestaurantPointDetails() { $.ajax({ type: "POST", url: "Orders.aspx/RestaurantPointDetails", data: "{'LocationId': '" + document.getElementById('lblLId').value + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { var Action = msg.d; if (Action != "") { document.getElementById("lblAwardType").innerHTML = Action; document.getElementById("lblRewardType").innerHTML = Action; if (document.getElementById("UserId").innerHTML == "") { //$(".ViewMoreMunchies").fadeIn("slow"); $("#idloginoints").fadeIn("slow"); } UserMuncheiscount(); } else document.getElementById('lblLoyaltyText').innerText = ""; } //$("#idorderwithpoints").css("display", "block"); $("#idloginoints").fadeOut("slow"); } }); } function MunchiesInfoforuser(TotalAmount) { $.ajax({ type: "POST", url: "Orders.aspx/SessionLogin", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { document.getElementById("UserId").innerHTML = msg.d[0].UserId; $.ajax({ type: "POST", url: "Orders.aspx/RestaurantPointDetails", data: "{'LocationId': '" + document.getElementById('lblLId').value + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { var Action = msg.d; if (Action != "") { document.getElementById("lblAwardType").innerHTML = Action; if (document.getElementById("UserId").innerHTML == "") { //$(".ViewMoreMunchies").fadeIn("slow"); $("#idloginoints").fadeIn("slow"); } else { $.ajax({ type: "POST", url: "Orders.aspx/GetAwardPoints", data: "{'LocationId': '" + document.getElementById('lblLId').value + "','UserId': '" + document.getElementById("UserId").innerHTML + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null || msg.d != "") { if (msg.d.Action != null || msg.d.Action != "") { var AwardPoints = msg.d.PercentageOfOrder; var Worth = msg.d.Worth; if (AwardPoints == "") { $("#earnpoints").css("display", "none"); } if (document.getElementById("lblAwardType").innerHTML != "") { $("#idorderwithpoints").fadeIn("slow"); $("#idloginoints").fadeOut("slow"); if (document.getElementById("lblAwardType").innerHTML == "Points") { document.getElementById("AwardPoint").innerHTML = AwardPoints; document.getElementById("lblValueOfPoint").innerHTML = Worth; document.getElementById('btndeiverymunchies1').value = "Pay with Points"; document.getElementById('lblLoyaltyText').innerText = "Pay with Points"; } else { document.getElementById("AwardPoint").innerHTML = AwardPoints; document.getElementById("lblValueOfPoint").innerHTML = Worth; document.getElementById('btndeiverymunchies1').value = "Pay with "+ document.getElementById("lblAwardType").innerHTML; document.getElementById('lblLoyaltyText').innerText = "Pay with " + document.getElementById("lblAwardType").innerHTML; } var TotalAwards = 0; if(Worth=="Dollar") TotalAwards = ((TotalAmount * AwardPoints) / 100); else TotalAwards = (TotalAmount * AwardPoints); var Ta = TotalAwards.toFixed(2); document.getElementById("lblearnedpoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; var munchiespoint = Ta + " " + document.getElementById("lblAwardType").innerHTML; if (munchiespoint != "") { $("#munchiespoints").css("display", "block"); document.getElementById("lblmunchiespoints").innerHTML = munchiespoint; } else { $("#munchiespoints").css("display", "none"); } } $.ajax({ type: "POST", url: "Orders.aspx/UserMunchiesOrPoints", data: "{'AppId': '" + document.getElementById('lblAppId1').value + "','UserId': '" + document.getElementById("UserId").innerHTML + "','Action': '" + Action + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "0") { $('.munchiesAmount').css("display", "block"); var totalmunchies = parseFloat(msg.d) / 100; var indiamunchies =msg.d.toFixed(2); document.getElementById("lblpoinsyoucanyern").innerHTML = indiamunchies.replace(".00","") + " " + Action; var TotalPrice = 0; TotalPrice = document.getElementById("lblTotaldelivery").innerHTML; TotalPrice = TotalPrice.replace(document.getElementById("lblCurrency").innerHTML, ""); if (document.getElementById("lblCurrency").innerHTML == "₹") { if (parseFloat(TotalPrice) <= parseFloat(indiamunchies)) { $('.munchiesAmount').text("You have: " + msg.d + " " + Action); document.getElementById("lblmeligi").innerHTML = "Yes"; } else { $('.munchiesAmount').text("You only have: " + msg.d + " " + Action); document.getElementById("lblmeligi").innerHTML = "No"; } } else { if (parseFloat(TotalPrice) < parseFloat(totalmunchies)) { $('.munchiesAmount').text("You have: " + msg.d + " " + Action); document.getElementById("lblmeligi").innerHTML = "Yes"; } else { $('.munchiesAmount').text("You only have: " + msg.d + " " + Action); document.getElementById("lblmeligi").innerHTML = "No"; } } var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["CustomWebsites"]; if (CustomWebsites == undefined) { } else { $('.munchiesAmount').css("display", "none"); } if (document.getElementById("lblPaymentType").innerHTML == "square") { $('.munchiesAmount').css("display", "none"); } } else { if (msg.d > 0) { document.getElementById("lblpoinsyoucanyern").innerHTML = msg.d.toFixed(2) + " " + Action; $('.munchiesAmount').css("display", "block"); $('.munchiesAmount').text("You only have: " + msg.d + " " + Action); } else { $("#displayuserpoints").css("display", "none"); $('#lblpoinsyoucanyern').css("display", "none"); $('.munchiesAmount').css("display", "none"); } document.getElementById("lblmeligi").innerHTML = "No"; var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["CustomWebsites"]; if (CustomWebsites == undefined) { if (document.getElementById("lblPaymentType").innerHTML == "square") { $('.btnpaywithmunchies').css("display", "none"); $('.munchiesAmount').css("display", "none"); } else { $('.btnpaywithmunchies').fadeIn("slow"); } } else { $('.btnpaywithmunchies').css("display", "none"); $('.munchiesAmount').css("display", "none"); } } if (document.getElementById("promotitle").innerHTML == "") { } else { $('.btnpaywithmunchies').css("display", "none"); } } }); } } } }); } } else { document.getElementById('lblLoyaltyText').innerText = ""; } } //$("#idorderwithpoints").css("display", "block"); $("#idloginoints").fadeOut("slow"); } }); } else { var AppId = document.getElementById('lblAppId1').value; $.ajax({ type: "POST", url: "Orders.aspx/GetFeatures", data: "", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { for (var i = 0; i < msg.d.length; i++) { if (msg.d[i].FeatureToMerchantsList.length > 0) { for (var k = 0; k < msg.d[i].FeatureToMerchantsList.length; k++) { if (msg.d[i].FeatureToMerchantsList[k].AppId != "00000000-0000-0000-0000-000000000000") { if (AppId == msg.d[i].FeatureToMerchantsList[k].AppId) { if (msg.d[i].FeatureName == "LOYALTY") { $("#idloginoints").fadeIn("slow"); } } } else { if (msg.d[i].FeatureName == "LOYALTY") { $("#idloginoints").fadeIn("slow"); } } } } } } } }); } } }); } function UserMuncheiscount() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var UId = document.getElementById("UserId").innerHTML; var Action = document.getElementById("lblAwardType").innerHTML; if (UId != "" && Action != "") { $.ajax({ type: "POST", url: "Orders.aspx/GetAwardPoints", data: "{'LocationId': '" + document.getElementById('lblLId').value + "','UserId': '" + UId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null || msg.d != "") { if (msg.d.Action != null || msg.d.Action != "") { var AwardPoints = msg.d.PercentageOfOrder; localStorage.setItem("PointsWorth", msg.d.Worth); if (AwardPoints == "") { $("#earnpoints").css("display", "none"); } if (document.getElementById("lblAwardType").innerHTML != "") { $("#idorderwithpoints").fadeIn("slow"); $("#idloginoints").fadeOut("slow"); //$(".ViewUserMunchies").fadeIn("slow"); //$(".ViewMoreMunchies").fadeOut("slow"); if (document.getElementById("lblAwardType").innerHTML == "Points") { document.getElementById("AwardPoint").innerHTML = AwardPoints; document.getElementById("lblValueOfPoint").innerHTML = msg.d.Worth; document.getElementById('btndeiverymunchies1').value = "Pay with Points"; document.getElementById('lblLoyaltyText').innerText = "Pay with Points"; } else { document.getElementById("AwardPoint").innerHTML = AwardPoints; document.getElementById("lblValueOfPoint").innerHTML = msg.d.Worth; document.getElementById('btndeiverymunchies1').value = "Pay with "+document.getElementById("lblAwardType").innerHTML; document.getElementById('lblLoyaltyText').innerText = "Pay with "+document.getElementById("lblAwardType").innerHTML; } if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } $.ajax({ type: "POST", url: "Orders.aspx/UserMunchiesOrPoints", data: "{'AppId': '" + document.getElementById('lblAppId1').value + "','UserId': '" + UId + "','Action': '" + Action + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "0") { $('.munchiesAmount').css("display", "block"); var totalmunchies = parseFloat(msg.d) / 100; var indiamunchies =msg.d.toFixed(2); document.getElementById("lblpoinsyoucanyern").innerHTML = indiamunchies.replace(".00","") + " " + Action; var TotalPrice = 0; TotalPrice = document.getElementById("lblTotaldelivery").innerHTML; TotalPrice = TotalPrice.replace(document.getElementById("lblCurrency").innerHTML, ""); if (document.getElementById("lblCurrency").innerHTML == "₹") { if (parseFloat(TotalPrice) <= parseFloat(indiamunchies)) { $('.munchiesAmount').text("You have: " + msg.d + " " + Action); document.getElementById("lblmeligi").innerHTML = "Yes"; } else { $('.munchiesAmount').text("You only have: " + msg.d + " " + Action); document.getElementById("lblmeligi").innerHTML = "No"; } } else { if (parseFloat(TotalPrice) < parseFloat(totalmunchies)) { $('.munchiesAmount').text("You have: " + msg.d + " " + Action); document.getElementById("lblmeligi").innerHTML = "Yes"; } else { $('.munchiesAmount').text("You only have: " + msg.d + " " + Action); document.getElementById("lblmeligi").innerHTML = "No"; } } var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["CustomWebsites"]; if (CustomWebsites == undefined) { } else { $('.munchiesAmount').css("display", "none"); } if (document.getElementById("lblPaymentType").innerHTML == "square") { $('.munchiesAmount').css("display", "none"); } } else { if (msg.d > 0) { document.getElementById("lblpoinsyoucanyern").innerHTML = msg.d.toFixed(2) + " " + Action; $('.munchiesAmount').css("display", "block"); $('.munchiesAmount').text("You only have: " + msg.d + " " + Action); } else { $("#displayuserpoints").css("display", "none"); $('#lblpoinsyoucanyern').css("display", "none"); $('.munchiesAmount').css("display", "none"); } document.getElementById("lblmeligi").innerHTML = "No"; var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["CustomWebsites"]; if (CustomWebsites == undefined) { if (document.getElementById("lblPaymentType").innerHTML == "square") { $('.btnpaywithmunchies').css("display", "none"); $('.munchiesAmount').css("display", "none"); } else { $('.btnpaywithmunchies').fadeIn("slow"); } } else { $('.btnpaywithmunchies').css("display", "none"); $('.munchiesAmount').css("display", "none"); } } if (document.getElementById("promotitle").innerHTML == "") { } else { $('.btnpaywithmunchies').css("display", "none"); } } }); } } } else { document.getElementById('btndeiverymunchies1').value = ""; document.getElementById('lblLoyaltyText').innerText = ""; $('.btnpaywithmunchies').css("display", "none"); $('.munchiesAmount').css("display", "none"); $('.munchiesAmount').text("You only have: 0 Munchies"); document.getElementById("lblmeligi").innerHTML = "No"; var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["CustomWebsites"]; if (CustomWebsites == undefined) { if (document.getElementById("lblPaymentType").innerHTML == "square") { $('.btnpaywithmunchies').css("display", "none"); $('.munchiesAmount').css("display", "none"); } } else { $('.btnpaywithmunchies').css("display", "none"); $('.munchiesAmount').css("display", "none"); } if (document.getElementById("promotitle").innerHTML == "") { } else { $('.btnpaywithmunchies').css("display", "none"); $('.munchiesAmount').css("display", "none"); } } } }); } } </script> <script type="text/javascript"> function CartPickup() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var StorageLocationId = ""; var LocationId = document.getElementById('lblLId').value; var SubTotal = 0; if (GroupId != null && GroupId != "" && GroupId != undefined) { retrievedData = localStorage.getItem("OtherMembersItems"); } else { var retrievedData = localStorage.getItem("TotalItems"); } var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { if (AddedItems.length > 0) { if (GroupId != null && GroupId != "" && GroupId != undefined) { if (AddedItems[0].GroupItems.length > 0) { StorageLocationId = AddedItems[0].GroupItems[0].LId; } } else { StorageLocationId = AddedItems[0].LId; } } } if (StorageLocationId == LocationId || StorageLocationId == "") { document.getElementById('tblUserDrivers').innerHTML = ""; document.getElementById('tblDrivers').innerHTML = ""; localStorage.removeItem("OrderType"); localStorage.removeItem("GroupOrderType"); localStorage.setItem("OrderType", $("#lblPickupname").text()); localStorage.setItem("GroupOrderType", $("#lblPickupname").text()); $("#ddlOrderType").val($("#lblPickupname").text()); if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow(); } else { BindItems(); } } } else { $("#lblorderror").text("Sorry you are trying to place an order with multiple restaurants. Once refresh the page and try again"); $(".ordererror").show().delay(3000).fadeOut(); $(".userdeliveryloader1").fadeOut("fast"); return; } getOrderTypeSettings(); } function deliverycheck() { var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberType; if (Details != null) { MemberType = Details.MemberType; } BindStoredDeliveryAddress() var UId = document.getElementById("UserId").innerHTML; if (UId != "") { $(".acessaddress").css("display", "none"); $('.btngust').css("display", "none"); $("#spnwelback").css("display", "none"); $('.divsavedaddressheight').css("display", "block"); GetSavedAddress(); }else $(".divsavedaddressheight").css("display", "none"); $(".deliverycheck").css("display", "inline-block"); if (MemberType == "Member") { $(".deliveryvalidationpanel").fadeOut("slow"); } else { $(".deliveryvalidationpanel").css("display", "block"); } //$(".deliveryvalidationpanel").css("margin-top", $(document).scrollTop() - 0); $(".shippingcheck").css("display", "none"); } function CustomOrderType(id) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var StorageLocationId = ""; var LocationId = document.getElementById('lblLId').value; var SubTotal = 0; if (GroupId != null && GroupId != "" && GroupId != undefined) { retrievedData = localStorage.getItem("OtherMembersItems");} else{ var retrievedData = localStorage.getItem("TotalItems"); } var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { if (AddedItems.length > 0) { if (GroupId != null && GroupId != "" && GroupId != undefined) { if (AddedItems[0].GroupItems.length > 0) { StorageLocationId = AddedItems[0].GroupItems[0].LId; } } else { StorageLocationId = AddedItems[0].LId; } } } if (StorageLocationId == LocationId || StorageLocationId == "") { $(".ShippingSpeeds").css("display", "none"); $(".deliverycheck").css("display", "none"); $(".shippingcheck").css("display", "none"); document.getElementById("lbTypeRequired").innerHTML = id; document.getElementById("lblItemId").innerHTML = ""; document.getElementById("radiotext").value = "radio"; $("#ddlOrderType").val(id); localStorage.removeItem("OrderType"); localStorage.removeItem("GroupOrderType"); localStorage.setItem("OrderType", id); localStorage.setItem("GroupOrderType", id); if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} } else { $("#lblorderror").text("Sorry you are trying to place an order with multiple restaurants. Once refresh the page and try again"); $(".ordererror").show().delay(3000).fadeOut(); $(".userdeliveryloader1").fadeOut("fast"); return; } getOrderTypeSettings(); } function CartDeliveryCheck(Type) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var StorageLocationId = ""; var LocationId = document.getElementById('lblLId').value; var SubTotal = 0; if (GroupId != null && GroupId != "" && GroupId != undefined) { retrievedData = localStorage.getItem("OtherMembersItems");} else{ var retrievedData = localStorage.getItem("TotalItems"); } var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { if (AddedItems.length > 0) { if (GroupId != null && GroupId != "" && GroupId != undefined) { if (AddedItems[0].GroupItems.length > 0) { StorageLocationId = AddedItems[0].GroupItems[0].LId; } } else { StorageLocationId = AddedItems[0].LId; } } } if (StorageLocationId == LocationId || StorageLocationId == "") { $(".ShippingSpeeds").css("display", "none"); $(".deliverycheck").css("display", "none"); $(".shippingcheck").css("display", "none"); document.getElementById("lbTypeRequired").innerHTML = Type; document.getElementById("lblItemId").innerHTML = ""; document.getElementById("radiotext").value = "radio"; $("#ddlOrderType").val(Type); if (Type == "Shipping") { ShippingDetails(); $(".shippingcheck").css("display", "inline-block"); $(".shippingcheck").css("width", "100%").css("margin", "0 auto"); var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberType; if (Details != null) { MemberType = Details.MemberType; } if (MemberType == "Member") { $(".deliveryvalidationpanel").fadeOut("slow"); } else { $(".deliveryvalidationpanel").fadeIn("slow");} $(".deliveryvalidationpanel").css("margin-top", $(document).scrollTop() - 0); } else { deliverycheck(); Deliveryareapromocheck(LocationId); GetSavedAddress(); } } else { $("#lblorderror").text("Sorry you are trying to place an order with multiple restaurants. Once refresh the page and try again"); $(".ordererror").show().delay(3000).fadeOut(); $(".userdeliveryloader1").fadeOut("fast"); return; } localStorage.removeItem("OrderType"); localStorage.removeItem("GroupOrderType"); localStorage.setItem("OrderType", Type); localStorage.setItem("GroupOrderType", Type); getOrderTypeSettings(); } function wanttoDelivery() { $(".deliverycheck").css("display", "inline-block"); $(".deliveryvalidationpanel").css("display", "block"); if (document.getElementById("UserId").innerHTML != "") { $(".acessaddress").css("display", "none"); $('.divsavedaddressheight').css("display", "inline-block"); } else $(".divsavedaddressheight").css("display", "none"); } function WanttoShipping() { $(".checkdeliverymrg").css("margin-left", "3px"); $(".deliveryvalidationpanel").css("display", "block"); ShippingDetails(); $(".shippingcheck").css("display", "inline-block"); $(".deliveryvalidationpanel").css("margin-top", $(document).scrollTop() - 0); } function BindPrices(PromoAmount) { var UId = document.getElementById("UserId").innerHTML; var UrlType = document.getElementById('lblurlnametype').innerHTML; var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.selectedIndex != -1) { var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; if (OrderType != "--Select Order Type--") { $('.userdeliveryloader1').css("display", "none"); var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { var Pri = 0; var TaxesPri = 0; var TaxItemsPrice = 0; var ItemTaxes = 0; var Taxes = 0; var CPrice = 0; var PayPalCharges = 0; var totaltip = 0; var deliveryfee = 0; var MileageCharge = 0; var driverfee = DriverPrice(); if (OrderTypevalue == "Shipping") { $(".ToggleMileageCharge").css("display", "none"); var Shippingfee = 0; var Commission = 0; var TotalWeight = 0; var Measurement = 0; $(".notefordelivery").css("display", "none"); $('.Deliverto').css("display", "block"); var NoTaxItemsPrice = 0; if (AddedItems != null) { for (var w = 0; w < AddedItems.length; w++) { if (AddedItems[w].OfferName == null || AddedItems[w].OfferName == undefined) { Pri = +Pri + +AddedItems[w].Price; } else { Pri = +Pri + +AddedItems[w].Price - AddedItems[w].OfferValue; } if (AddedItems[w].NoSalesTax.toLowerCase() == "false" || AddedItems[w].NoSalesTax == false) { if (AddedItems[w].OfferName != null) { var leftPri = parseFloat(AddedItems[w].Price) - parseFloat(AddedItems[w].OfferValue); ItemTaxes = (leftPri * AddedItems[w].CustomTax) / 100; } else ItemTaxes = (AddedItems[w].Price * AddedItems[w].CustomTax) / 100; TaxItemsPrice = +TaxItemsPrice + +ItemTaxes; } else { if (AddedItems[w].OfferName != null) { var NoTaxPri = parseFloat(AddedItems[w].Price) - parseFloat(AddedItems[w].OfferValue); NoTaxItemsPrice = +NoTaxItemsPrice + +NoTaxPri; } else { NoTaxItemsPrice = +NoTaxItemsPrice + +AddedItems[w].Price; } } if (AddedItems[w].Choices != null) { var Weight = 0; var MeasurementType = ""; if (AddedItems[w].OrderType == "Shipping") { if (AddedItems[w].Choices.length > 0) { if (AddedItems[w].Choices[0].Measurement != undefined) { if (AddedItems[w].Choices[0].Measurement == "Oz") { Weight = +Weight + +(AddedItems[w].Choices[0].Weight * 0.0625); MeasurementType = "Oz"; } else if (AddedItems[w].Choices[0].Measurement == "gm") { Weight = +Weight + +(AddedItems[w].Choices[0].Weight * 0.00220462); MeasurementType = "gm"; } else if (AddedItems[w].Choices[0].Measurement == "kg") { Weight = +Weight + +(AddedItems[w].Choices[0].Weight * 2.20462); MeasurementType = "kg"; } else if (AddedItems[w].Choices[0].Measurement == "tons") { Weight = +Weight + +(AddedItems[w].Choices[0].Weight * 2000); MeasurementType = "tons"; } else { Weight = +Weight + +AddedItems[w].Choices[0].Weight; MeasurementType = ""; } Weight = Weight * AddedItems[w].Quantity; Weight = Weight.toFixed(2); TotalWeight = +TotalWeight + +Weight; } } else { MeasurementType = ""; } } } } if (NoTaxItemsPrice > 0) { var Promobydollar = PromoAmount / Pri; PromoamountforTaxtotal = Promobydollar * TaxesPri; TaxesPri = TaxesPri - PromoamountforTaxtotal; } else { TaxesPri = TaxesPri - PromoAmount; } document.getElementById("lblAlltotalprice").innerHTML = document.getElementById("lblCurrency").innerHTML + Pri.toFixed(2); if (document.getElementById("Conveniencelbl").innerHTML != 0) { var Ctype = document.getElementById("lblConvType").innerHTML; if (~Ctype.indexOf("Amount")) { CPrice = document.getElementById("Conveniencelbl").innerHTML; } else { CPrice = ((Pri * document.getElementById("Conveniencelbl").innerHTML) / 100); CPrice = CPrice.toFixed(2); } } Pri = Pri - PromoAmount; if (document.getElementById("AwardPoint").innerHTML != "") { if (UId != "" && UId != null) { var ItemsAmount = Pri; var Award = document.getElementById("AwardPoint").innerHTML; var FirstOrderType = document.getElementById("Firstorder").innerHTML; var TotalAwards = 0; var Worth= localStorage.getItem("PointsWorth"); if(Worth=="Dollar") TotalAwards = (ItemsAmount * Award) / 100; else TotalAwards = (ItemsAmount * Award); var Ta = TotalAwards.toFixed(2); Ta=Ta.replace(".00", ""); document.getElementById("lblearnedpoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; //document.getElementById("lblmunchiespoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; var munchiespoint = Ta + " " + document.getElementById("lblAwardType").innerHTML; if (munchiespoint != "") { $("#munchiespoints").css("display", "block"); document.getElementById("lblmunchiespoints").innerHTML = munchiespoint; } else { $("#munchiespoints").css("display", "none"); } } else { MunchiesInfoforuser(Pri); } // UserMuncheiscount(); } else { MunchiesInfoforuser(Pri); } TotalWeight = TotalWeight.toFixed(2); document.getElementById("TotalWeight").innerHTML = TotalWeight + " Pounds"; $.ajax({ type: "POST", url: "Orders.aspx/ShippingPriceDetails", data: "{'ZoneId': '" + localStorage.getItem("ShippingZoneId") + "','Weight': '" + TotalWeight + "','Subtotal': '" + Pri + "','SpeedId': '" + document.getElementById("SpeedId").innerHTML + "','MeasurementType': '" + MeasurementType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { deliveryfee = msg.d; document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + msg.d.toFixed(2); if (msg.d.toFixed(2) == "0.00") { $(".Chtext").css("display", "none"); $("#lbldelivaryfeetextlbl").css("display", "none"); $("#lbldelivaryfee").css("display", "none"); $("#lbluserdelivery").css("display", "none"); } else { $(".Chtext").css("display", "block"); $("#lbldelivaryfeetextlbl").css("display", "block"); $("#lbldelivaryfee").css("display", "block"); $("#lbluserdelivery").css("display", "block"); } document.getElementById("lbldelivaryfee").innerHTML = document.getElementById("lblCurrency").innerHTML + msg.d.toFixed(2); document.getElementById("lblsubtotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + Pri.toFixed(2); document.getElementById("lbltaxes").innerHTML = document.getElementById("lblCurrency").innerHTML + TaxItemsPrice.toFixed(2); document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + TaxItemsPrice; var TotalPrice = +Pri + +TaxItemsPrice + +CPrice; var TotalPriceforPromo = +Pri + +TaxItemsPrice + +CPrice; if (document.getElementById("Conveniencelbl").innerHTML != 0) { $(".Typetax").text(document.getElementById("Taxeslabel").innerText); $(".CVFexist").fadeIn("fast") document.getElementById("lbltaxConven").innerHTML = document.getElementById("lbltaxes").innerHTML; document.getElementById("lblbconvenience").innerHTML = document.getElementById("lblCurrency").innerHTML + CPrice; document.getElementById("lblbconvenience1").innerHTML = document.getElementById("lblCurrency").innerHTML + CPrice; document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lbltaxes").innerHTML; if (document.getElementById("lbltaxes").innerHTML == "₹0.00" || document.getElementById("lbltaxes").innerHTML == "$0.00") { $(".taxpadding").css("display", "none"); //document.getElementsByClassName("taxpadding").style.display = "none"; document.getElementById("tdTaxdelivery").style.display = "none"; } else { $(".taxpadding").css("display", ""); //document.getElementsByClassName("taxpadding").style.display = "block"; document.getElementById("tdTaxdelivery").style.display = ""; } } else { $(".Typetax").text(document.getElementById("Taxeslabel").innerText); document.getElementById("lbltaxConven").innerHTML = document.getElementById("lbltaxes").innerHTML; document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lbltaxes").innerHTML; if (document.getElementById("lbltaxes").innerHTML == "₹0.00" || document.getElementById("lbltaxes").innerHTML == "$0.00") { document.getElementById("tdregister").style.display = "none"; document.getElementById("tdTaxdelivery").style.display = "none"; } else { document.getElementById("tdregister").style.display = ""; document.getElementById("tdTaxdelivery").style.display = ""; } } //document.getElementById("lbldelivaryfeetextlbl").style.display = "block"; document.getElementById("lbldelivaryfeetextlbl").innerHTML = "Shipping"; //$('#lbldelivaryfee').fadeIn("slow"); $('#lbldelivaryfee').parents('td').addClass("guuesttotal2"); $(".Chtext").text("Shipping"); TotalPrice = +TotalPrice + +deliveryfee; document.getElementById("lblTotalPriceforPromos").innerHTML = TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblcrtamount").innerHTML = document.getElementById("lbltotalamount").innerHTML; var showcart = document.getElementById("lblcrtamount").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (document.getElementById("lblorderfail").innerHTML == "InsertOrder") { InsertOrder(); } } }); } } else if (OrderTypevalue == "Delivery") { document.getElementById("TotalWeight").innerHTML = ""; var OrderType = ""; $(".providerdiv").fadeOut("fast"); $('.Deliverto').css("display", "block"); var NoTaxItemsPrice = 0; if (AddedItems != null) { for (var w = 0; w < AddedItems.length; w++) { if (AddedItems[w].OfferName == null || AddedItems[w].OfferName == undefined) Pri = +Pri + +AddedItems[w].Price; else Pri = +Pri + +AddedItems[w].Price - AddedItems[w].OfferValue; if (AddedItems[w].NoSalesTax.toLowerCase() == "false" || AddedItems[w].NoSalesTax == false) { if (AddedItems[w].OfferName != null) { var leftPri = parseFloat(AddedItems[w].Price) - parseFloat(AddedItems[w].OfferValue); ItemTaxes = (leftPri * AddedItems[w].CustomTax) / 100; } else ItemTaxes = (AddedItems[w].Price * AddedItems[w].CustomTax) / 100; TaxItemsPrice = +TaxItemsPrice + +ItemTaxes; } else { if (AddedItems[w].OfferName != null) { var NoTaxPri = parseFloat(AddedItems[w].Price) - parseFloat(AddedItems[w].OfferValue); NoTaxItemsPrice = +NoTaxItemsPrice + +NoTaxPri; } else { NoTaxItemsPrice = +NoTaxItemsPrice + +AddedItems[w].Price; } } } if (NoTaxItemsPrice > 0) { var Promobydollar = PromoAmount / Pri; PromoamountforTaxtotal = Promobydollar * TaxesPri; //PromoAmount = PromoamountforTaxtotal; TaxesPri = TaxesPri - PromoamountforTaxtotal; } else { TaxesPri = TaxesPri - PromoAmount; } document.getElementById("lblAlltotalprice").innerHTML = document.getElementById("lblCurrency").innerHTML + Pri.toFixed(2); if (document.getElementById("Conveniencelbl").innerHTML != 0) { var Ctype = document.getElementById("lblConvType").innerHTML; if (~Ctype.indexOf("Amount")) { CPrice = document.getElementById("Conveniencelbl").innerHTML; } else { CPrice = ((Pri * document.getElementById("Conveniencelbl").innerHTML) / 100); CPrice = CPrice.toFixed(2); } } document.getElementById("TipValue").innerHTML = document.getElementById("txttip").value.replace("$", "").replace("₹", ""); if (document.getElementById("TipValue").innerHTML != "") { var value = document.getElementById("TipValue").innerHTML; if (parseFloat(value.replace("%", "")) > 0) { if (~value.indexOf("%")) { value = value.replace("%", ""); totaltip = (value * Pri) / 100; totaltip = totaltip.toFixed(2); } else { totaltip = value; } TotalPrice = TotalPrice + +parseFloat(totaltip); document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + totaltip; //$("#txttip").val(document.getElementById("WTip").innerHTML); document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + totaltip; $('.tipEnable').fadeIn("slow"); } else { document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; if (document.getElementById("txttip").value == "0" || document.getElementById("txttip").value == "0.00" || document.getElementById("txttip").value == "0." || document.getElementById("txttip").value == "0.0" || document.getElementById("txttip").value == "" || document.getElementById("txttip").value == document.getElementById("lblCurrency").innerHTML + "0.00") { $('.tipEnable').fadeOut("slow"); } else document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; } } else { document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; } if (document.getElementById("charitylbl").innerHTML != "" && document.getElementById("Promoprice").innerHTML != "") { var promovalue = document.getElementById("Promoprice").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); Pri = +Pri + +promovalue; } else { Pri = Pri - PromoAmount; } if (document.getElementById("AwardPoint").innerHTML != "") { if (UId != "" && UId != null) { var ItemsAmount = Pri; var Award = document.getElementById("AwardPoint").innerHTML; var FirstOrderType = document.getElementById("Firstorder").innerHTML; var Worth= localStorage.getItem("PointsWorth"); if(Worth=="Dollar") TotalAwards = (ItemsAmount * Award) / 100; else TotalAwards = (ItemsAmount * Award); var Ta = TotalAwards.toFixed(2); Ta=Ta.replace(".00", ""); document.getElementById("lblearnedpoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; //document.getElementById("lblmunchiespoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; var munchiespoint = Ta + " " + document.getElementById("lblAwardType").innerHTML; if (munchiespoint != "") { $("#munchiespoints").css("display", "block"); document.getElementById("lblmunchiespoints").innerHTML = munchiespoint; } else { $("#munchiespoints").css("display", "none"); } // UserMuncheiscount(); } else { MunchiesInfoforuser(Pri); } } else { MunchiesInfoforuser(Pri); } } TaxItemsPrice = Math.round(TaxItemsPrice * 100) / 100; TaxItemsPrice = TaxItemsPrice.toFixed(2); document.getElementById("lbltaxes").innerHTML = document.getElementById("lblCurrency").innerHTML + TaxItemsPrice; document.getElementById("lbldelivaryfeetextlbl").style.display = "block"; document.getElementById("lbldelivaryfeetextlbl").innerHTML = "Delivery"; $(".Chtext").text("Delivery"); $('.notefordelivery').fadeIn("slow"); $('#lbldelivaryfee').fadeIn("slow"); $('#lbldelivaryfee').parents('td').addClass("guuesttotal2"); var Zone = localStorage.getItem("Zone"); var LocationId = document.getElementById('lblLId').value; var UId = document.getElementById("UserId").innerHTML; var FirstOrder = ""; var VIP = ""; var STotal = document.getElementById("lblAlltotalprice").innerHTML; if (STotal != "" && STotal != null) { STotal = STotal.replace("$", "").replace("₹", ""); } var AreaFirstuserOrder = document.getElementById("lbldeliveryareapromotioncheck").innerHTML; $.ajax({ type: "POST", url: "Orders.aspx/GetUserFirstOrder", data: "{'UserId': '" + UId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { FirstOrder = msg.d; $.ajax({ type: "POST", url: "Orders.aspx/ZoneDetailsByZoneId", data: "{'Zone': '" + Zone + "','LocationId': '" + LocationId + "','OrderType': '" + OrderType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0].appName != "Out Of the Zone") { document.getElementById("lblMileageCharge").style.display = "none"; document.getElementById("lblMileageCharge").innerHTML = "0"; document.getElementById("lblMileageChargelbl").style.display = "none"; if (Pri < msg.d[0].CertainAmount || msg.d[0].CertainAmount == 0) { deliveryfee = deliveryfee + msg.d[0].DeliveryFee; deliveryfee = deliveryfee.toFixed(2); if (DriversCheck == "Charge") document.getElementById("lbldiscountdeliveryfee").innerHTML = deliveryfee; else document.getElementById("lbldiscountdeliveryfee").innerHTML = (+deliveryfee + +driverfee).toFixed(2); } else { deliveryfee = "0.00"; } if (FirstOrder == "FirstOrder") { if (document.getElementById("lblCurrency").innerHTML != "₹") { if (AreaFirstuserOrder == "Enable") { deliveryfee = "0.00"; } } } if (DriversCheck == "Charge") { deliveryfee = +deliveryfee + +driverfee; deliveryfee = deliveryfee.toFixed(2); } //if (deliveryfee == 0.00) { // document.getElementById("lbldelivaryfeetextlbl").style.display = "none"; // document.getElementById("lbldelivaryfee").style.display = "none"; //} //else { document.getElementById("lbldelivaryfeetextlbl").style.display = "block"; document.getElementById("lbldelivaryfee").style.display = "block"; //} if (window.location !== window.parent.location) { if (document.getElementById("lblmarkupfee").innerHTML != null) { var ss = document.getElementById("lblmarkupfee").innerHTML; if (ss != null) { var df = Number(document.getElementById("lbldiscountdeliveryfee").innerHTML); var mf = Number(ss); var round = Number("0.00"); var total = df + mf + round; document.getElementById("lbldelivaryfee").innerHTML = document.getElementById("lblCurrency").innerHTML + total; document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lbldelivaryfee").innerHTML; deliveryfee = +df + +mf + +"0.00"; } else { document.getElementById("lbldelivaryfee").innerHTML = document.getElementById("lblCurrency").innerHTML + deliveryfee; document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lbldelivaryfee").innerHTML; } } } else { document.getElementById("lbldelivaryfee").innerHTML = document.getElementById("lblCurrency").innerHTML + deliveryfee; document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lbldelivaryfee").innerHTML; } } else { deliveryfee = deliveryfee + msg.d[0].DeliveryFee; deliveryfee = deliveryfee.toFixed(2); if (DriversCheck == "Charge") document.getElementById("lbldiscountdeliveryfee").innerHTML = deliveryfee; else document.getElementById("lbldiscountdeliveryfee").innerHTML = (+deliveryfee + +driverfee).toFixed(2);; if (FirstOrder == "FirstOrder") { if (document.getElementById("lblCurrency").innerHTML != "₹") { if (AreaFirstuserOrder == "Enable") { deliveryfee = "0.00"; } } } if (DriversCheck == "Charge") { deliveryfee = +deliveryfee + +driverfee; deliveryfee = deliveryfee.toFixed(2); } if (window.location !== window.parent.location) { if (document.getElementById("lblmarkupfee").innerHTML != null) { var ss = document.getElementById("lblmarkupfee").innerHTML; if (ss != null) { var df = Number(document.getElementById("lbldiscountdeliveryfee").innerHTML); var mf = Number(ss); var total = df + mf; document.getElementById("lbldelivaryfee").innerHTML = document.getElementById("lblCurrency").innerHTML + total; document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lbldelivaryfee").innerHTML; deliveryfee = +df + +mf + +"0.00"; } else { document.getElementById("lbldelivaryfee").innerHTML = document.getElementById("lblCurrency").innerHTML + deliveryfee; document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lbldelivaryfee").innerHTML; } } } else { document.getElementById("lbldelivaryfee").innerHTML = document.getElementById("lblCurrency").innerHTML + deliveryfee; document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lbldelivaryfee").innerHTML; } var Miles = localStorage.getItem("Miles"); if (typeof Miles !== 'undefined' && Miles !== null) { MileageCharge = msg.d[0].MileageCharge * Miles; MileageCharge = MileageCharge.toFixed(2); document.getElementById("lblMileageCharge").style.display = "block"; document.getElementById("lblMileageChargelbl").style.display = "block"; document.getElementById("lblMileageCharge").innerHTML = document.getElementById("lblCurrency").innerHTML + MileageCharge; } } } else { var Thirdpartydelivery = localStorage.getItem("Thirdpartydelivery"); if (Thirdpartydelivery != null) { var Thirdpartyfee = JSON.parse(Thirdpartydelivery); deliveryfee = Thirdpartyfee.fee; document.getElementById("lbldelivaryfee").innerHTML = document.getElementById("lblCurrency").innerHTML + deliveryfee; document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lbldelivaryfee").innerHTML; } } var TotalPrice = ""; var TotalPrice = +Pri + +TaxItemsPrice + +deliveryfee + +CPrice + +MileageCharge + +parseFloat(totaltip); var TotalPriceforPromo = +Pri + +Taxes + +CPrice; if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML != "") { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } else { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } } else { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } if (document.getElementById("Conveniencelbl").innerHTML != 0) { if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text(document.getElementById("Taxeslabel").innerText); } $(".CVFexist").fadeIn("fast") document.getElementById("lbltaxConven").innerHTML = document.getElementById("lbltaxes").innerHTML document.getElementById("lblbconvenience").innerHTML = document.getElementById("lblCurrency").innerHTML + CPrice; document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lbltaxes").innerHTML; document.getElementById("lblbconvenience1").innerHTML = document.getElementById("lblCurrency").innerHTML + CPrice; if (document.getElementById("lbltaxes").innerHTML == "₹0.00"||document.getElementById("lbltaxes").innerHTML == "$0.00") { document.getElementById("tdregister").style.display = "none"; document.getElementById("tdTaxdelivery").style.display = "none"; } else { document.getElementById("tdregister").style.display = ""; document.getElementById("tdTaxdelivery").style.display = ""; } } else { if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text(document.getElementById("Taxeslabel").innerText); } document.getElementById("lbltaxConven").innerHTML = document.getElementById("lbltaxes").innerHTML; document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lbltaxes").innerHTML; if (document.getElementById("lbltaxes").innerHTML == "₹0.00" || document.getElementById("lbltaxes").innerHTML == "$0.00") { document.getElementById("tdregister").style.display = "none"; document.getElementById("tdTaxdelivery").style.display = "none"; } else { document.getElementById("tdregister").style.display = ""; document.getElementById("tdTaxdelivery").style.display = ""; } } document.getElementById("lblTotalPriceforPromos").innerHTML = TotalPriceforPromo.toFixed(2); if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML != "") { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } else { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } } if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML != "") { document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } else { document.getElementById("lblTotaldelivery").innerHTML = ""; document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } } else if (document.getElementById("charitylbl").innerHTML != "") { document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalDonation.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalDonation.toFixed(2); } else { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } document.getElementById("lblcrtamount").innerHTML = document.getElementById("lbltotalamount").innerHTML; var showcart = document.getElementById("lblcrtamount").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); if (document.getElementById("lblorderfail").innerHTML == "InsertOrder") { InsertOrder(); } CardCanvienceFee(); } }); } }); } else if (document.getElementById("lblPickupname").innerHTML.replace("&", "&") == OrderTypevalue || OrderType != OrderTypevalue || OrderTypevalue=="DineIn") { document.getElementById("TotalWeight").innerHTML = ""; var NoTaxItemsPrice = 0; if (AddedItems != null) { for (var w = 0; w < AddedItems.length; w++) { if (AddedItems[w].OfferName == null || AddedItems[w].OfferName == undefined) Pri = +Pri + +AddedItems[w].Price; else Pri = +Pri + +AddedItems[w].Price - AddedItems[w].OfferValue; if (AddedItems[w].NoSalesTax != null && AddedItems[w].NoSalesTax != undefined) { if (AddedItems[w].NoSalesTax.toLowerCase() == "false" || AddedItems[w].NoSalesTax == false) { if (AddedItems[w].OfferName != null) { var leftPri = parseFloat(AddedItems[w].Price) - parseFloat(AddedItems[w].OfferValue); ItemTaxes = (leftPri * AddedItems[w].CustomTax) / 100; } else ItemTaxes = (AddedItems[w].Price * AddedItems[w].CustomTax) / 100; TaxItemsPrice = +TaxItemsPrice + +ItemTaxes; } else { if (AddedItems[w].OfferName != null) { var NoTaxPri = parseFloat(AddedItems[w].Price) - parseFloat(AddedItems[w].OfferValue); NoTaxItemsPrice = +NoTaxItemsPrice + +NoTaxPri; } else { NoTaxItemsPrice = +NoTaxItemsPrice + +AddedItems[w].Price; } } } } if (NoTaxItemsPrice > 0) { var Promobydollar = PromoAmount / Pri; PromoamountforTaxtotal = Promobydollar * TaxesPri; TaxesPri = TaxesPri - PromoamountforTaxtotal; } else { TaxesPri = TaxesPri - PromoAmount; } document.getElementById("lblAlltotalprice").innerHTML = document.getElementById("lblCurrency").innerHTML + Pri.toFixed(2); if (document.getElementById("Conveniencelbl").innerHTML != 0) { var Ctype = document.getElementById("lblConvType").innerHTML; if (~Ctype.indexOf("Amount")) { CPrice = document.getElementById("Conveniencelbl").innerHTML; } else { CPrice = ((Pri * document.getElementById("Conveniencelbl").innerHTML) / 100); CPrice = CPrice.toFixed(2); } } document.getElementById("TipValue").innerHTML = document.getElementById("txttip").value.replace("$", "").replace("₹", ""); if (document.getElementById("TipValue").innerHTML != "") { var value = document.getElementById("TipValue").innerHTML; if (parseFloat(value.replace("%", "")) > 0) { if (~value.indexOf("%")) { value = value.replace("%", ""); totaltip = (value * Pri) / 100; totaltip = totaltip.toFixed(2); } else { totaltip = value; } TotalPrice = TotalPrice + +parseFloat(totaltip); document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + totaltip; //$("#txttip").val(document.getElementById("WTip").innerHTML) document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + totaltip; $('.tipEnable').fadeIn("slow"); } else { document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; if (document.getElementById("txttip").value == "0" || document.getElementById("txttip").value == "0.00" || document.getElementById("txttip").value == document.getElementById("lblCurrency").innerHTML + "0.00") { $('.tipEnable').fadeOut("slow"); } } } else { document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; } if (document.getElementById("charitylbl").innerHTML != "" && document.getElementById("Promoprice").innerHTML != "") { var promovalue = document.getElementById("Promoprice").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); Pri = +Pri + +promovalue; } else { Pri = Pri - PromoAmount; } if (document.getElementById("AwardPoint").innerHTML != "") { if (UId != "" && UId != null) { var ItemsAmount = Pri; var Award = document.getElementById("AwardPoint").innerHTML; var FirstOrderType = document.getElementById("Firstorder").innerHTML; var TotalAwards = 0; var Worth= localStorage.getItem("PointsWorth"); if(Worth=="Dollar") TotalAwards = (ItemsAmount * Award) / 100; else TotalAwards = (ItemsAmount * Award); var Ta = TotalAwards.toFixed(2); Ta=Ta.replace(".00", ""); document.getElementById("lblearnedpoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; // document.getElementById("lblmunchiespoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; var munchiespoint = Ta + " " + document.getElementById("lblAwardType").innerHTML; if (munchiespoint != "") { $("#munchiespoints").css("display", "block"); document.getElementById("lblmunchiespoints").innerHTML = munchiespoint; } else { $("#munchiespoints").css("display", "none"); } // UserMuncheiscount(); } else { MunchiesInfoforuser(Pri); } } else { MunchiesInfoforuser(Pri); } } TaxItemsPrice = Math.round(TaxItemsPrice * 100) / 100; TaxItemsPrice = TaxItemsPrice.toFixed(2); document.getElementById("lbltaxes").innerHTML = document.getElementById("lblCurrency").innerHTML + TaxItemsPrice; var TotalPrice = +Pri + +TaxItemsPrice + +CPrice; if (document.getElementById("Conveniencelbl").innerHTML != 0) { if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text(document.getElementById("Taxeslabel").innerText); } $(".CVFexist").fadeIn("fast") document.getElementById("lbltaxConven").innerHTML = document.getElementById("lbltaxes").innerHTML; document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lbltaxes").innerHTML; document.getElementById("lblbconvenience").innerHTML = document.getElementById("lblCurrency").innerHTML + CPrice; document.getElementById("lblbconvenience1").innerHTML = document.getElementById("lblCurrency").innerHTML + CPrice; if (document.getElementById("lbltaxes").innerHTML == "₹0.00" ||document.getElementById("lbltaxes").innerHTML == "$0.00") { document.getElementById("tdregister").style.display = "none"; document.getElementById("tdTaxdelivery").style.display = "none"; } else { document.getElementById("tdregister").style.display = ""; document.getElementById("tdTaxdelivery").style.display = ""; } TotalPrice = 0; } else { if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text(document.getElementById("Taxeslabel").innerText); } document.getElementById("lbltaxConven").innerHTML = document.getElementById("lbltaxes").innerHTML; document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lbltaxes").innerHTML; if (document.getElementById("WTip").innerHTML == "₹0.00" || document.getElementById("WTip").innerHTML == "$0.00") $("#txttip").val(document.getElementById("WTip").innerHTML); if (document.getElementById("lbltaxes").innerHTML == "₹0.00" ||document.getElementById("lbltaxes").innerHTML == "$0.00") { document.getElementById("tdregister").style.display = "none"; document.getElementById("tdTaxdelivery").style.display = "none"; } else { document.getElementById("tdregister").style.display = ""; document.getElementById("tdTaxdelivery").style.display = ""; } } var TotalPrice = +Pri + +TaxItemsPrice + +CPrice + +PayPalCharges + +parseFloat(totaltip); if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML != "") { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } else { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } } document.getElementById("lblTotalPriceforPromos").innerHTML = TotalPrice.toFixed(2); if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML != "") { document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } else { document.getElementById("lblTotaldelivery").innerHTML = ""; document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lbltotalamount").innerHTML; } } else { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lbltotalamount").innerHTML; } $('.notefordelivery').css("display", "none"); document.getElementById("lbldelivaryfee").style.display = "none"; document.getElementById("lbldelivaryfeetextlbl").style.display = "none"; document.getElementById("lblMileageCharge").style.display = "none"; document.getElementById("lblMileageCharge").innerHTML = "0"; document.getElementById("lblMileageChargelbl").style.display = "none"; $('#lbldelivaryfee').parents('td').removeClass("guuesttotal2"); document.getElementById("lblcrtamount").innerHTML = document.getElementById("lbltotalamount").innerHTML; var showcart = document.getElementById("lblcrtamount").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); if (document.getElementById("lblorderfail").innerHTML == "InsertOrder") { InsertOrder(); } CardCanvienceFee(); } else { if (document.getElementById("lblDineInname").innerHTML.replace("&", "&") == OrderTypevalue || OrderType != OrderTypevalue) { document.getElementById("TotalWeight").innerHTML = ""; var NoTaxItemsPrice = 0; if (AddedItems != null) { for (var w = 0; w < AddedItems.length; w++) { if (AddedItems[w].OfferName == null || AddedItems[w].OfferName == undefined) Pri = +Pri + +AddedItems[w].Price; else Pri = +Pri + +AddedItems[w].Price - AddedItems[w].OfferValue; if (AddedItems[w].NoSalesTax != null && AddedItems[w].NoSalesTax != undefined) { if (AddedItems[w].NoSalesTax.toLowerCase() == "false" || AddedItems[w].NoSalesTax == false) { if (AddedItems[w].OfferName != null) { var leftPri = parseFloat(AddedItems[w].Price) - parseFloat(AddedItems[w].OfferValue); ItemTaxes = (leftPri * AddedItems[w].CustomTax) / 100; } else ItemTaxes = (AddedItems[w].Price * AddedItems[w].CustomTax) / 100; TaxItemsPrice = +TaxItemsPrice + +ItemTaxes; } else { if (AddedItems[w].OfferName != null) { var NoTaxPri = parseFloat(AddedItems[w].Price) - parseFloat(AddedItems[w].OfferValue); NoTaxItemsPrice = +NoTaxItemsPrice + +NoTaxPri; } else { NoTaxItemsPrice = +NoTaxItemsPrice + +AddedItems[w].Price; } } } } if (NoTaxItemsPrice > 0) { var Promobydollar = PromoAmount / Pri; PromoamountforTaxtotal = Promobydollar * TaxesPri; TaxesPri = TaxesPri - PromoamountforTaxtotal; } else { TaxesPri = TaxesPri - PromoAmount; } document.getElementById("lblAlltotalprice").innerHTML = document.getElementById("lblCurrency").innerHTML + Pri.toFixed(2); if (document.getElementById("Conveniencelbl").innerHTML != 0) { var Ctype = document.getElementById("lblConvType").innerHTML; if (~Ctype.indexOf("Amount")) { CPrice = document.getElementById("Conveniencelbl").innerHTML; } else { CPrice = ((Pri * document.getElementById("Conveniencelbl").innerHTML) / 100); CPrice = CPrice.toFixed(2); } } document.getElementById("TipValue").innerHTML = document.getElementById("txttip").value.replace("$", "").replace("₹", ""); if (document.getElementById("TipValue").innerHTML != "") { var value = document.getElementById("TipValue").innerHTML; if (parseFloat(value.replace("%", "")) > 0) { if (~value.indexOf("%")) { value = value.replace("%", ""); totaltip = (value * Pri) / 100; totaltip = totaltip.toFixed(2); } else { totaltip = value; } TotalPrice = TotalPrice + +parseFloat(totaltip); document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + totaltip; //$("#txttip").val(document.getElementById("WTip").innerHTML) document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + totaltip; $('.tipEnable').fadeIn("slow"); } else { document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; if (document.getElementById("txttip").value == "0" || document.getElementById("txttip").value == "0.00" || document.getElementById("txttip").value == document.getElementById("lblCurrency").innerHTML + "0.00") { $('.tipEnable').fadeOut("slow"); } } } else { document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; } if (document.getElementById("charitylbl").innerHTML != "" && document.getElementById("Promoprice").innerHTML != "") { var promovalue = document.getElementById("Promoprice").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); Pri = +Pri + +promovalue; } else { Pri = Pri - PromoAmount; } if (document.getElementById("AwardPoint").innerHTML != "") { if (UId != "" && UId != null) { var ItemsAmount = Pri; var Award = document.getElementById("AwardPoint").innerHTML; var FirstOrderType = document.getElementById("Firstorder").innerHTML; var TotalAwards = 0; var Worth= localStorage.getItem("PointsWorth"); if(Worth=="Dollar") TotalAwards = (((ItemsAmount * Award) / 100) * 100)/100; else TotalAwards = ((ItemsAmount * Award) / 100) * 100; var Ta = TotalAwards.toFixed(2); Ta=Ta.replace(".00", ""); document.getElementById("lblearnedpoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; // document.getElementById("lblmunchiespoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; var munchiespoint = Ta + " " + document.getElementById("lblAwardType").innerHTML; if (munchiespoint != "") { $("#munchiespoints").css("display", "block"); document.getElementById("lblmunchiespoints").innerHTML = munchiespoint; } else { $("#munchiespoints").css("display", "none"); } // UserMuncheiscount(); } else { MunchiesInfoforuser(Pri); } } else { MunchiesInfoforuser(Pri); } } TaxItemsPrice = Math.round(TaxItemsPrice * 100) / 100; TaxItemsPrice = TaxItemsPrice.toFixed(2); document.getElementById("lbltaxes").innerHTML = document.getElementById("lblCurrency").innerHTML + TaxItemsPrice; var TotalPrice = +Pri + +TaxItemsPrice + +CPrice; if (document.getElementById("Conveniencelbl").innerHTML != 0) { if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text(document.getElementById("Taxeslabel").innerText); } $(".CVFexist").fadeIn("fast") document.getElementById("lbltaxConven").innerHTML = document.getElementById("lbltaxes").innerHTML; document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lbltaxes").innerHTML; document.getElementById("lblbconvenience").innerHTML = document.getElementById("lblCurrency").innerHTML + CPrice; document.getElementById("lblbconvenience1").innerHTML = document.getElementById("lblCurrency").innerHTML + CPrice; if (document.getElementById("lbltaxes").innerHTML == "₹0.00" || document.getElementById("lbltaxes").innerHTML == "$0.00") { document.getElementById("tdregister").style.display = "none"; document.getElementById("tdTaxdelivery").style.display = "none"; } else { document.getElementById("tdregister").style.display = ""; document.getElementById("tdTaxdelivery").style.display = ""; } TotalPrice = 0; } else { if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text(document.getElementById("Taxeslabel").innerText); } document.getElementById("lbltaxConven").innerHTML = document.getElementById("lbltaxes").innerHTML; document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lbltaxes").innerHTML; if (document.getElementById("WTip").innerHTML == "₹0.00" || document.getElementById("WTip").innerHTML == "$0.00") $("#txttip").val(document.getElementById("WTip").innerHTML); if (document.getElementById("lbltaxes").innerHTML == "₹0.00" || document.getElementById("lbltaxes").innerHTML == "$0.00") { document.getElementById("tdregister").style.display = "none"; document.getElementById("tdTaxdelivery").style.display = "none"; } else { document.getElementById("tdregister").style.display = ""; document.getElementById("tdTaxdelivery").style.display = ""; } } var TotalPrice = +Pri + +TaxItemsPrice + +CPrice + +PayPalCharges + +parseFloat(totaltip); if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML != "") { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } else { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } } document.getElementById("lblTotalPriceforPromos").innerHTML = TotalPrice.toFixed(2); if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML != "") { document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } else { document.getElementById("lblTotaldelivery").innerHTML = ""; document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lbltotalamount").innerHTML; } } else { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lbltotalamount").innerHTML; } $('.notefordelivery').css("display", "none"); document.getElementById("lbldelivaryfee").style.display = "none"; document.getElementById("lbldelivaryfeetextlbl").style.display = "none"; document.getElementById("lblMileageCharge").style.display = "none"; document.getElementById("lblMileageCharge").innerHTML = "0"; document.getElementById("lblMileageChargelbl").style.display = "none"; $('#lbldelivaryfee').parents('td').removeClass("guuesttotal2"); document.getElementById("lblcrtamount").innerHTML = document.getElementById("lbltotalamount").innerHTML; var showcart = document.getElementById("lblcrtamount").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); if (document.getElementById("lblorderfail").innerHTML == "InsertOrder") { InsertOrder(); } CardCanvienceFee(); } else{ if (localStorage.getItem("OrderType") == "DineInOnly" && $(".yourordersteststyles").css("display") == "none") { if (localStorage.getItem("EntityDisabled") != "Disabled") { alert("Both " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + " and Delivery are disabled, You can't place an order"); localStorage.setItem("EntityDisabled", "Disabled"); //$(".hmcrt1").css("display", "block"); document.getElementById("lblcrtamount").innerHTML = ""; if (window.innerWidth < 767) { $("#lblcartcount").css("margin-top", "0px"); $(".hmcrt1").css("padding", "4px 0"); } } } } } $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage2").css("display", "none"); if (AddedItems.length == 0) { document.getElementById("lblcartcount").innerHTML = "0"; //$(".hmcrt1").css("display", "none"); document.getElementById("lblcrtamount").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; } } } } } function InsertOrder() { var OrderType = localStorage.getItem("OrderType"); var ItemsData = localStorage.getItem("TotalItems"); var CheckItems = JSON.parse(ItemsData); if (CheckItems != null) { if (CheckItems.length > 0) { if (CheckItems[0].LId == document.getElementById('lblLId').value) { if (OrderType == "Delivery") { var ZoneId = localStorage.getItem("Zone"); if (ZoneId == "00000000-0000-0000-0000-000000000000") { $("#lblorderror").text("We're sorry! We don't deliver to this address."); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblorderfail").innerHTML = ""; $('.userdeliveryloader').css("display", "none"); return; } } $(".UserDeliveryPanel").fadeOut("slow"); PlaceAnOrder(); $(".OrderprocessingPanelAdj").css("margin-top", $(document).scrollTop() - 0); $(".OrderprocessingPanel").fadeIn("slow"); //$(".OrderprocessingPanel").css("display", "block"); // return; } else { $("#lblorderror").text("Sorry you are trying to place an order with multiple restaurants. Once refresh the page and try again"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblorderfail").innerHTML = ""; $('.userdeliveryloader').css("display", "none"); return; } } else { $("#lblorderror").text("Sorry you are trying to place an order with multiple restaurants. Once refresh the page and try again"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblorderfail").innerHTML = ""; $('.userdeliveryloader').css("display", "none"); return; } } else { $("#lblorderror").text("Sorry you are trying to place an order with multiple restaurants. Once refresh the page and try again"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblorderfail").innerHTML = ""; $('.userdeliveryloader').css("display", "none"); return; } } function InsertOrderConfirmation() { var NewTotal = document.getElementById("lbltotalamount").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); var total = localStorage.getItem("GroupOTotal"); var sAmount = JSON.parse(total); if (sAmount != null) { if (sAmount.Total == NewTotal) { GroupOrderStatus(); } else { if ($('#rbtShipping').is(':checked')) { AddShippingItemstoPanel(); document.getElementById("lblsubtotaldelivery").innerHTML = document.getElementById("lblAlltotalprice").innerHTML; document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lbltaxConven").innerHTML; document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lbldelivaryfee").innerHTML; } else { AddItemstoPanelingrouporder(); document.getElementById("lblsubtotaldelivery").innerHTML = document.getElementById("lblAlltotalprice").innerHTML; document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lbltaxConven").innerHTML; document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lbldelivaryfee").innerHTML; document.getElementById("lblUserMileageCharge").innerHTML = document.getElementById("lblMileageCharge").innerHTML; } alert("SomeOne Added/Deleted items to the cart."); document.getElementById("lblorderfail").innerHTML = ""; $('.userdeliveryloader').css("display", "none"); } } } function mainPromocalculations() { var UrlType = document.getElementById('lblurlnametype').innerHTML; var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (document.getElementById("Promoprice").innerHTML != "") { var TotalPrice = document.getElementById("lblTotalPrices").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); var promovalue = document.getElementById("Promoprice").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); promovalue = promovalue.replace("-", ""); if (document.getElementById("charitylbl").innerHTML == "") { document.getElementById("Promoprice").style.color = "red"; document.getElementById("udpv").style.color = "red"; // BindPrices(promovalue); } else { //var TotalDonation = +TotalPrice + +promovalue; //TotalDonation = TotalDonation.toFixed(2); if (document.getElementById("charitylbl").innerHTML != "") { //var retrievedData = localStorage.getItem("TotalItems"); //var AddedItems = JSON.parse(retrievedData); //var Pri = 0; //if (AddedItems != null) { // for (var w = 0; w < AddedItems.length; w++) { // if (AddedItems[w].OfferName == null || AddedItems[w].OfferName == undefined) { // Pri = +Pri + +AddedItems[w].Price; // } // else { // Pri = +Pri + +AddedItems[w].Price - AddedItems[w].OfferValue; // } // } //} $(".addcategoryloadingimage2").css("display", "none"); //document.getElementById("lbltotalamount").innerHTML = "$" + TotalDonation; //document.getElementById("lblTotaldelivery").innerHTML = "$" + TotalDonation; //document.getElementById("lblAlltotalprice").innerHTML = "$" + Pri.toFixed(2); } //else { // document.getElementById("lbltotalamount").innerHTML = "$" + TotalPrice; // document.getElementById("lblTotaldelivery").innerHTML = "$" + TotalPrice; //} document.getElementById("Promoprice").style.color = "black"; document.getElementById("udpv").style.color = "black"; $(".userdeliveryloader1").fadeOut("fast"); if (document.getElementById("lblorderfail").innerHTML == "InsertOrder") { InsertOrder(); } } if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(promovalue); } if (TotalPrice == "0.00") { $('#fdButtonpay1').fadeOut("fast"); $('#fdButtonpay1').css("display", "none"); // user c/d delivery $('.btnusingpromotion').fadeIn("slow"); $('#bntConfOrder').fadeOut("fast"); $('#mbntConfOrder').fadeOut("fast"); $('#BtnSquare').fadeOut("fast"); $('#bntConfOrder').css("display", "none"); // user c/d delivery $('#mbntConfOrder').css("display", "none"); // user c/d delivery $('#BtnSquare').css("display", "none"); } else { $('.btnusingpromotion').css("display", "none"); if (document.getElementById("lblCurrency").innerHTML != "$") { if (UrlType == "DineIn" && OrderType == "DineIn") { $('#bntConfOrder').css("display", "none"); $('#mbntConfOrder').css("display", "none"); }else{ if (document.getElementById("lblAllowinstore").innerHTML == "true") { $('#bntConfOrder').css("display", "block"); if (document.getElementById("lblCustomizedcash").innerHTML == "true") { $('#mbntConfOrder').css("display", "block"); } } } $('#btndeiverymunchies').css("display", "none"); } } } } function Assignsession() { $('.btngust').css("display", "none"); $("#spnwelback").css("display", "none"); OrderHours(); $(".signinpanel").css("display", "none"); } function GuestLogin() { $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage2").css("display", "block"); Assignsession(); BindDineInUserDetails(); } </script> <script type="text/javascript"> //Table Reservations function OpenTableReservation() { $(".Reservationloader1").css("display", "block"); $(".ddlweek").empty(); $(".ddlguest").empty(); $(".ddltimes").empty(); var LId = document.getElementById('lblLId').value; var ddlweek = document.getElementById('ddlweek'); var ddlguest = document.getElementById('ddlguest'); $.ajax({ type: "POST", url: "Orders.aspx/LoadWeeks", data: "{'LId': '" + LId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { $(".ddlweek").empty(); for (var l = 0; l < msg.d.length; l++) { var optmin = document.createElement("option"); optmin.text = msg.d[l]; optmin.value = msg.d[l]; ddlweek.options.add(optmin); if (optmin.text.indexOf("Today") != null && optmin.text.indexOf("Today") >= 0) { $(".ddlweek").val(optmin.text); } } var date = document.getElementById("ddlweek"); var Guestdate = date.options[date.selectedIndex].text; $.ajax({ type: "POST", url: "Orders.aspx/getrestautranttablesbylocationid", data: "{'LId': '" + LId + "','Date':'" + Guestdate + "'}", dataType: "json", contentType: "application/json", success: function (msg) { $(".ddlguest").empty(); $.each(msg.d, function (k, v) { $(".ddlguest").append($("<option></option>").val(this['Value']).html(this['Text'])); }); LoadTimings(); $(".Reservationloader1").css("display", "none"); $(".reservationPanel").fadeIn("slow"); } }); } }); } function LoadAllottedSeats() { var LId = document.getElementById('lblLId').value; var date = document.getElementById("ddlweek"); var Guestdate = date.options[date.selectedIndex].text; $.ajax({ type: "POST", url: "Orders.aspx/getrestautranttablesbylocationid", data: "{'LId': '" + LId + "','Date':'" + Guestdate + "'}", dataType: "json", contentType: "application/json", success: function (msg) { $(".ddlguest").empty(); $.each(msg.d, function (k, v) { $(".ddlguest").append($("<option></option>").val(this['Value']).html(this['Text'])); }); LoadTimings(); $(".Reservationloader1").css("display", "none"); $(".reservationPanel").fadeIn("slow"); } }); } function LoadTimings() { $(".Reservationloader").css("display", "block"); var LId = document.getElementById('lblLId').value; var G = document.getElementById("ddlguest"); var W = document.getElementById("ddlweek"); var TableId = G.options[G.selectedIndex].value; if (TableId != "0") { var Week = W.options[W.selectedIndex].text; $.ajax({ type: "POST", url: "Orders.aspx/LoadTimings", data: "{'TableId': '" + TableId + "','Week': '" + Week + "','LId': '" + LId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { $(".ddltimes").empty(); if (msg.d.length > 0) { $.each(msg.d, function (k, v) { $(".ddltimes").append($("<option></option>").val(this['Value']).html(this['Text'])); }); } else { $("#lblorderror").text("All tables are Reserved"); $(".ordererror").show().delay(3000).fadeOut(); } $(".Reservationloader").css("display", "none"); } }); } else { $(".Reservationloader").css("display", "none"); } } function BookTable() { var T = document.getElementById("ddltimes"); if (T.selectedIndex != "-1") { var G = document.getElementById("ddlguest"); var Table = G.options[G.selectedIndex].value; var W = document.getElementById("ddlweek"); if (Table != "0") { var Date1 = W.options[W.selectedIndex].text; var Times = T.options[T.selectedIndex].value; var LId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; $.ajax({ type: "POST", url: "Orders.aspx/CheckDate", data: "{'Date': '" + Date1 + "','Times': '" + Times + "','LId': '" + LId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.indexOf("Success") != null && msg.d.indexOf("Success") >= 0) { var message = "Do you want to reserve a table On " + msg.d.replace("Success", "") + " at " + T.options[T.selectedIndex].text; var r = confirm(message); if (r == true) { var UId = document.getElementById("UserId").innerHTML; if (UId != "") { $(".Reservationloader").css("display", "block"); var CId = document.getElementById('lblCId').value; var Guest = G.options[G.selectedIndex].text; $.ajax({ type: "POST", url: "Orders.aspx/BookTable", data: "{'Date': '" + Date1 + "','Guest': '" + Guest + "','Table': '" + Table + "','Times': '" + Times + "','LId': '" + LId + "','UId': '" + UId + "','CId': '" + CId + "','AppId': '" + AppId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d == "Phone no") { $("#lblordalert").text("Please Update your contact number in your profile before reserving table"); $(".orderalert").fadeIn(); $(".Reservationloader").css("display", "none"); } if (msg.d == "Success") { GetLocationDetails(T.options[T.selectedIndex].text, G.options[G.selectedIndex].text, Date1, G.options[G.selectedIndex].value); } } } }); } else { document.getElementById('lblOpenPanel').innerHTML = "Reservation"; document.getElementById('reservationPanel').style.display = "none"; document.getElementById('btngust').style.display = "none"; $("#spnwelback").css("display", "none"); $(".tableheight").css("padding-top", "10px"); if (document.getElementById('popupsscroll').innerHTML == "over") { $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 500); } else { $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 30); } $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); $(".signinpanel").fadeIn("slow"); } } } else { $("#lblorderror").text(msg.d); $(".ordererror").show().delay(3000).fadeOut(); } } }); } else { $("#lblordalert").text("Please Select The Table"); $(".orderalert").fadeIn(); } } else { $("#lblordalert").text("Please Select The Time"); $(".orderalert").fadeIn(); } } function ReserveTable() { var T = document.getElementById("ddltimes"); if (T.selectedIndex != "-1") { var G = document.getElementById("ddlguest"); var Table = G.options[G.selectedIndex].value; var W = document.getElementById("ddlweek"); var AppId = document.getElementById('lblAppId1').value; if (Table != "0") { var Guest = G.options[G.selectedIndex].text; var Date1 = W.options[W.selectedIndex].text; var Times = T.options[T.selectedIndex].value; var LId = document.getElementById('lblLId').value; var CId = document.getElementById('lblCId').value; var UId = document.getElementById("UserId").innerHTML; if (UId != "") { document.getElementById('LoadingPanel').style.display = "block"; $.ajax({ type: "POST", url: "Orders.aspx/BookTable", data: "{'Date': '" + Date1 + "','Guest': '" + Guest + "','Table': '" + Table + "','Times': '" + Times + "','LId': '" + LId + "','UId': '" + UId + "','CId': '" + CId + "','AppId': '" + AppId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d == "Phone no") { $("#lblordalert").text("Please Update your contact number in your profile before reserving table"); $(".orderalert").fadeIn(); document.getElementById('LoadingPanel').style.display = "none"; } if (msg.d == "Success") { GetLocationDetails(T.options[T.selectedIndex].text, G.options[G.selectedIndex].text, Date1, G.options[G.selectedIndex].value); localStorage.removeItem("ReserveTable"); } } } }); } } } } function GetLocationDetails(Times, Table, Date, TableId) { var LId = document.getElementById('lblLId').value; $.ajax({ type: "POST", url: "Orders.aspx/GetLocationDetails", data: "{'LId': '" + LId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { $(".addresslbl").text(msg.d[0].address); $(".restaurantlbl").text(msg.d[0].LocationName); $(".timelbl").text(Times); $(".lblTableId").text(TableId.split(',')[0]); $(".guestlbl").text(Table); $(".datelbl").text(Date.split(',')[1]); if (msg.d[0].Phone != "") { document.getElementById('checkPhone').style = ""; $(".phnolbl").text(msg.d[0].Phone); } else { document.getElementById('checkPhone').style.display = "none"; } document.getElementById('reservationPanel').style.display = "none"; $(".Reservationloader").css("display", "none"); document.getElementById('LoadingPanel').style.display = "none"; $(".viewreservationspanel").fadeIn("slow"); } } }); } function TimeChanged(Time) { var hours = document.getElementById("ddlhr"); var selectedHour = hours.options[hours.selectedIndex].text; if (selectedHour == "ASAP") { $(".Estimate").css("display", ""); } else { $(".Estimate").css("display", "none"); } } function DateChanged() { var DriverId = ""; $("#ddlhr").empty(); document.getElementById("lblUserDeliveryError").innerHTML = ""; $('#tblUserDrivers tr').each(function () { if ((this.childNodes[0].childNodes[0].checked == true)) { DriverId = this.id; } }); var Lid = document.getElementById('lblLId').value; var UId = document.getElementById("UserId").innerHTML; var UrlType = document.getElementById('lblurlnametype').innerHTML; var selectedDate = new Date(); selectedDate = document.getElementById('txtdeliverydate').value; var todaydate = ""; todaydate = document.getElementById("AppLocationTime").innerHTML; var OrderTypevalue = localStorage.getItem("OrderType"); var OrderType = "PickUp"; if (document.getElementById("lblPickupname").innerHTML.replace("&", "&") == OrderTypevalue) OrderType = "PickUp"; else if (document.getElementById("lblDineInname").innerHTML.replace("&", "&") == OrderTypevalue) OrderType = "DineIn"; else if (OrderTypevalue == "Delivery") OrderType = "Delivery"; else if (OrderTypevalue == "Shipping") OrderType = "Shipping"; else OrderType = OrderTypevalue; if (OrderType != "Shipping") { $(".lblasap").text(""); $(".Estimate").css("display", "none"); $(".Estimate").text(""); $("#lblreducedtime").text(""); $("#lblUserDeliveryError").text(""); document.getElementById("lblUserDeliveryError").innerHTML = ""; $("#lblUserDeliveryError").css("display", "none"); var retrievedData = localStorage.getItem("TotalItems"); var Aid = document.getElementById('lblAppId1').value; var selectedDate1 = new Date(); var commontime = document.getElementById("lblcommontime").innerHTML; if (OrderTypevalue == "Delivery") GetDrivers("", ""); var ItemCount = 0; var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); var arr = new Array(); if (AddedItems != null) { ItemCount = AddedItems.length; for (var S = 0; S < AddedItems.length; S++) { arr[S] = { Id: AddedItems[S].Id, MainCategoryId: AddedItems[S].MainCategoryId }; } } var PickupButtonName = ""; if (document.getElementById("lblPickupname") != null) { PickupButtonName = document.getElementById("lblPickupname").innerHTML; } if (UrlType == "DineIn") { if (document.getElementById("lblDineInname") != null) { PickupButtonName = document.getElementById("lblDineInname").innerHTML; } } var UsedOrderType = ""; var selectedOrderType = ""; var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.options.length > 0) { selectedOrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; UsedOrderType = ddlOrderType.options[ddlOrderType.selectedIndex].value; } if (UsedOrderType == PickupButtonName) { UsedOrderType = "PickUp"; } if (OrderType == null || OrderType == "") OrderType = UsedOrderType; var TimeZoneName = document.getElementById('lbltimezonename').value; var RawOffset = document.getElementById('lblrawoffset').innerHTML; var DataOffset = document.getElementById('lbldataoffset').innerHTML; var splitarray = new Array(); splitarray = todaydate.split(" "); var TotalDistance = localStorage.getItem("TotalDistance"); var Zone = localStorage.getItem("Zone"); if (OrderType == "PickUp") Zone = null; var f = 0; $.ajax({ type: "POST", url: "Orders.aspx/Checkholiday", data: "{'SelectedDate':'" + selectedDate + "','Lid':'" + Lid + "','AppId':'" + Aid + "','OrderType':'" + OrderType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "") { f++; } else { var Checkhoilday = msg.d.split('/&/')[1]; if (Checkhoilday == "Holiday") { document.getElementById("lblUserDeliveryError").innerHTML = msg.d.split('/&/')[0]; $("#lblUserDeliveryError").css("display", ""); } else { f++; } } if (f > 0) { $.ajax({ type: "POST", url: "Orders.aspx/CompareDates", data: "{'Todaydate':'" + splitarray[0] + "','SelectedDate':'" + selectedDate + "','Lid':'" + Lid + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { if (confirm("Order is selected for the future date of: " + selectedDate + ". Are you sure you want to place an order for future date selected.")) { document.getElementById('lblolddate').innerHTML = selectedDate; $("#ddlhr").empty(); $.ajax({ type: "POST", url: "Orders.aspx/BindRestaurantHours", data: "{'LId':'" + Lid + "','OrderType':'" + OrderType + "','Zone':'" + Zone + "','Date':'" + selectedDate + "','DriverId':'" + DriverId + "','ItemCount':'" + ItemCount + "','TotalDistance':'" + TotalDistance + "','Retrivedata':'" + JSON.stringify(arr) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { document.getElementById('txtdeliverydate').value = msg.d[0].AvailableDate; if (msg.d[0].OrderTimes.length > 0) { var tme = 0; for (var i = 0; i < msg.d[0].OrderTimes.length; i++) { if (document.getElementById("LimitTimestoASAP").innerHTML == "true") { if (msg.d[0].OrderTimes[i].Times == "ASAP") { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); tme = 1; } else { if (tme != 1) { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[0].Times); optmin2.text = time; if(i == 0){ ddlhr.options.add(optmin2); } } } } else { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); } if (msg.d[0].OrderTimes[i].Times == "ASAP") { document.getElementById("lblasaphr").innerHTML = msg.d[0].ASAPTime; $(".Estimate").css("display", "block"); $(".Estimate").text("Estimated " + selectedOrderType + " time is " + msg.d[0].ASAPTime); } } OpeningOrderSubmitionPnl(); } else if (msg.d[0].NextAvailableDate != null && msg.d[0].NextAvailableDate != "" && msg.d[0].Status != "" && msg.d[0].Status != null) { var Confirmmessage = msg.d[0].Status; alertify.set({ labels: { cancel: "Cancel", ok: "Continue" } }); alertify.confirm(Confirmmessage, function (e) { if (e) { document.getElementById('txtdeliverydate').value = msg.d[0].NextAvailableDate; selectedDate = msg.d[0].NextAvailableDate; $.ajax({ type: "POST", url: "Orders.aspx/BindRestaurantHours", data: "{'LId':'" + Lid + "','OrderType':'" + OrderType + "','Zone':'" + Zone + "','Date':'" + selectedDate + "','DriverId':'" + DriverId + "','ItemCount':'" + ItemCount + "','TotalDistance':'" + TotalDistance + "','Retrivedata':'" + JSON.stringify(arr) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { document.getElementById('txtdeliverydate').value = msg.d[0].AvailableDate; if (msg.d[0].OrderTimes.length > 0) { var tme = 0; for (var i = 0; i < msg.d[0].OrderTimes.length; i++) { if (document.getElementById("LimitTimestoASAP").innerHTML == "true") { if (msg.d[0].OrderTimes[i].Times == "ASAP") { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); tme = 1; } else { if (tme != 1) { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[0].Times); optmin2.text = time; if(i == 0){ ddlhr.options.add(optmin2); } } } } else { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); } if (msg.d[0].OrderTimes[i].Times == "ASAP") { document.getElementById("lblasaphr").innerHTML = msg.d[0].ASAPTime; $(".Estimate").css("display", "block"); $(".Estimate").text("Estimated " + selectedOrderType + " time is " + msg.d[0].ASAPTime); } } OpeningOrderSubmitionPnl(); $(".addcategoryloadingimage2").css("display", "none"); } else { alert(msg.d[0].Status); $(".addcategoryloadingimage2").css("display", "none"); } $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } } }); } else { $(".addcategoryloadingimage2").css("display", "none"); } }); } else if (msg.d[0].NextAvailableDate != null && msg.d[0].NextAvailableDate != "") { var Confirmmessage = "You can place your order now for a future time at " + msg.d[0].NextAvailableDate + ". Is that OK?"; if (confirm(Confirmmessage)) { document.getElementById('txtdeliverydate').value = msg.d[0].NextAvailableDate; selectedDate = msg.d[0].NextAvailableDate; $.ajax({ type: "POST", url: "Orders.aspx/BindRestaurantHours", data: "{'LId':'" + Lid + "','OrderType':'" + OrderType + "','Zone':'" + Zone + "','Date':'" + selectedDate + "','DriverId':'" + DriverId + "','ItemCount':'" + ItemCount + "','TotalDistance':'" + TotalDistance + "','Retrivedata':'" + JSON.stringify(arr) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { document.getElementById('txtdeliverydate').value = msg.d[0].AvailableDate; if (msg.d[0].OrderTimes.length > 0) { var tme = 0; for (var i = 0; i < msg.d[0].OrderTimes.length; i++) { if (document.getElementById("LimitTimestoASAP").innerHTML == "true") { if (msg.d[0].OrderTimes[i].Times == "ASAP") { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); tme = 1; } else { if (tme != 1) { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[0].Times); optmin2.text = time; if(i == 0){ ddlhr.options.add(optmin2); } } } } else { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); } if (msg.d[0].OrderTimes[i].Times == "ASAP") { document.getElementById("lblasaphr").innerHTML = msg.d[0].ASAPTime; $(".Estimate").css("display", "block"); $(".Estimate").text("Estimated " + selectedOrderType + " time is " + msg.d[0].ASAPTime); } } OpeningOrderSubmitionPnl(); } else { alert(msg.d[0].Status); $(".addcategoryloadingimage2").css("display", "none"); } $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } } }); } else { $(".addcategoryloadingimage2").css("display", "none"); } } else if (msg.d[0].Status != "" && msg.d[0].Status != null) { alert(msg.d[0].Status); $(".addcategoryloadingimage2").css("display", "none"); } $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } } }); } else { document.getElementById('txtdeliverydate').value = document.getElementById("lblolddate").innerHTML; selectedDate = document.getElementById("lblolddate").innerHTML; $.ajax({ type: "POST", url: "Orders.aspx/BindRestaurantHours", data: "{'LId':'" + Lid + "','OrderType':'" + OrderType + "','Zone':'" + Zone + "','Date':'" + selectedDate + "','DriverId':'" + DriverId + "','ItemCount':'" + ItemCount + "','TotalDistance':'" + TotalDistance + "','Retrivedata':'" + JSON.stringify(arr) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { document.getElementById('txtdeliverydate').value = msg.d[0].AvailableDate; if (msg.d[0].OrderTimes.length > 0) { var tme = 0; for (var i = 0; i < msg.d[0].OrderTimes.length; i++) { if (document.getElementById("LimitTimestoASAP").innerHTML == "true") { if (msg.d[0].OrderTimes[i].Times == "ASAP") { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); tme = 1; } else { if (tme != 1) { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[0].Times); optmin2.text = time; if(i == 0){ ddlhr.options.add(optmin2); } } } } else { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); } if (msg.d[0].OrderTimes[i].Times == "ASAP") { document.getElementById("lblasaphr").innerHTML = msg.d[0].ASAPTime; $(".Estimate").css("display", "block"); $(".Estimate").text("Estimated " + selectedOrderType + " time is " + msg.d[0].ASAPTime); } } OpeningOrderSubmitionPnl(); } else { $(".addcategoryloadingimage2").css("display", "none"); document.getElementById("lblUserDeliveryError").innerHTML = "Restaurant not accepting any orders on selected date"; $("#lblUserDeliveryError").css("display", ""); } } } }); } } else { $("#ddlhr").empty(); $.ajax({ type: "POST", url: "Orders.aspx/BindRestaurantHours", data: "{'LId':'" + Lid + "','OrderType':'" + OrderType + "','Zone':'" + Zone + "','Date':'" + selectedDate + "','DriverId':'" + DriverId + "','ItemCount':'" + ItemCount + "','TotalDistance':'" + TotalDistance + "','Retrivedata':'" + JSON.stringify(arr) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { document.getElementById('txtdeliverydate').value = msg.d[0].AvailableDate; if (msg.d[0].OrderTimes.length > 0) { var tme = 0; for (var i = 0; i < msg.d[0].OrderTimes.length; i++) { if (document.getElementById("LimitTimestoASAP").innerHTML == "true") { if (msg.d[0].OrderTimes[i].Times == "ASAP") { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); tme = 1; } else { if (tme != 1) { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[0].Times); optmin2.text = time; if(i == 0){ ddlhr.options.add(optmin2); } } } } else { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); } if (msg.d[0].OrderTimes[i].Times == "ASAP") { document.getElementById("lblasaphr").innerHTML = msg.d[0].ASAPTime; $(".Estimate").css("display", "block"); $(".Estimate").text("Estimated " + selectedOrderType + " time is " + msg.d[0].ASAPTime); } } OpeningOrderSubmitionPnl(); } else if (msg.d[0].NextAvailableDate != null && msg.d[0].NextAvailableDate != "") { var Confirmmessage = "You can place your order now for a future time at " + msg.d[0].NextAvailableDate + ". Is that OK?"; if (confirm(Confirmmessage)) { document.getElementById('txtdeliverydate').value = msg.d[0].NextAvailableDate; selectedDate = msg.d[0].NextAvailableDate; $.ajax({ type: "POST", url: "Orders.aspx/BindRestaurantHours", data: "{'LId':'" + Lid + "','OrderType':'" + OrderType + "','Zone':'" + Zone + "','Date':'" + selectedDate + "','DriverId':'" + DriverId + "','ItemCount':'" + ItemCount + "','TotalDistance':'" + TotalDistance + "','Retrivedata':'" + JSON.stringify(arr) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { document.getElementById('txtdeliverydate').value = msg.d[0].AvailableDate; if (msg.d[0].OrderTimes.length > 0) { var tme = 0; for (var i = 0; i < msg.d[0].OrderTimes.length; i++) { if (document.getElementById("LimitTimestoASAP").innerHTML == "true") { if (msg.d[0].OrderTimes[i].Times == "ASAP") { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); tme = 1; } else { if (tme != 1) { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[0].Times); optmin2.text = time; if(i == 0){ ddlhr.options.add(optmin2); } } } } else { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); } if (msg.d[0].OrderTimes[i].Times == "ASAP") { document.getElementById("lblasaphr").innerHTML = msg.d[0].ASAPTime; $(".Estimate").css("display", "block"); $(".Estimate").text("Estimated " + selectedOrderType + " time is " + msg.d[0].ASAPTime); } } OpeningOrderSubmitionPnl(); } else if (msg.d[0].Status != "" && msg.d[0].Status != null) { alert(msg.d[0].Status); $(".addcategoryloadingimage2").css("display", "none"); } $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } } }); } else { $(".addcategoryloadingimage2").css("display", "none"); document.getElementById("lblUserDeliveryError").innerHTML = "Restaurant not accepting any orders on selected date"; $("#lblUserDeliveryError").css("display", ""); } } else if (msg.d[0].Status != "" && msg.d[0].Status != null) { alert(msg.d[0].Status); $(".addcategoryloadingimage2").css("display", "none"); } $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } } }); } } }); } } }); } } function DuplicateValuesBinding(value, type) { var IsExists = false; var ddloption = null; ddloption = document.getElementById("ddlhr").options; var j = 0; for (var i = 0; i < ddloption.length; i++) { if (ddloption[i].text == value) { j++; return "True"; } } if (j == 0) { return "False"; } } </script> <script type="text/javascript"> function UserLoginval() { var Email, Password; Email = document.getElementById('txtEmail').value; Password = document.getElementById('txtPwd').value; emailExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i; numberexp = /^\+(?:[0-9] ?){6,14}[0-9]$/; //^[0-9-+]+$/ numberexp1 = /^\d{10}$/; pwdexp = /^[A-Za-z0-9!@#$%^&*()_]{5,20}$/; var i = 0; if (Email == '' && Password == '') { document.getElementById('txtEmail').className = 'userlogin_formtext1Error'; document.getElementById('txtPwd').className = 'userlogin_formtext1Error'; $('.lblMsg12').css("display", "block"); document.getElementById('lblMsg12').innerHTML = "Please fill out the required information"; $("#txtEmail").focus(); } else { $('.lblMsg12').css("display", "none"); if (Email == '') { document.getElementById('txtEmail').className = "userlogin_formtext1Error"; document.getElementById('lbluseremail').style.display = "block"; i++; $("#txtEmail").focus(); } if (isNaN(Email)) { if (!Email.match(emailExp)) { document.getElementById('lbluseremail').style.display = "block"; document.getElementById('lbluseremail').innerHTML = "Enter Valid Email"; $("#txtEmail").focus(); i++; } else { document.getElementById('lbluseremail').style.display = "none"; document.getElementById('txtEmail').className = "userlogin_formtext1"; $.ajax({ type: "POST", url: "orders.aspx/CheckMunchemAccount", data: "{'Email': '" + escape(Email) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { document.getElementById('txtEmail').className = "userlogin_formtext1Error"; $("#txtEmail").focus(); document.getElementById('lblMsg12').style.display = "block"; document.getElementById('lblMsg12').innerHTML = "The Email address that you've entered doesn't match any account. Sign up for an account."; } else { if (Password == '') { document.getElementById('txtPwd').className = "userlogin_formtext1Error"; document.getElementById('lbluserpwd').style.display = "block"; i++; if (!$('#lbluseremail').is(":visible")) { $("#txtPwd").focus(); } } else { document.getElementById('lbluserpwd').style.display = "none"; document.getElementById('txtPwd').className = "userlogin_formtext1"; UserLogin(); } } } }); } } else if (!Email.match(numberexp) && !Email.match(numberexp1)) { document.getElementById('lbluseremail').style.display = "block"; document.getElementById('lbluseremail').innerHTML = "Enter Valid Number"; $("#txtEmail").focus(); i++; } else { document.getElementById('lbluseremail').style.display = "none"; document.getElementById('txtEmail').className = "userlogin_formtext1"; $.ajax({ type: "POST", url: "orders.aspx/CheckMunchemAccount", data: "{'Email': '" + escape(Email) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { document.getElementById('txtEmail').className = "userlogin_formtext1Error"; $("#txtEmail").focus(); document.getElementById('lblMsg12').style.display = "block"; document.getElementById('lblMsg12').innerHTML = "The Phone Number that you've entered doesn't match any account. Sign up for an account."; } else { if (Password == '') { document.getElementById('txtPwd').className = "userlogin_formtext1Error"; document.getElementById('lbluserpwd').style.display = "block"; i++; if (!$('#lbluseremail').is(":visible")) { $("#txtPwd").focus(); } } else { document.getElementById('lbluserpwd').style.display = "none"; document.getElementById('txtPwd').className = "userlogin_formtext1"; UserLogin(); } } } }); } } } $('#UserNameReqpnl').keypress(function (e) { if (e.keyCode == '13') { namereqvalidation();//for user name reequired panel. e.preventDefault(); e.stopPropagation(); } }); function namereqvalidation() { var count = 0; $(".pmsgreq").text(""); var numberexp = /^\d{10}$/; if (document.getElementById("txtfPhnoreq").value != "") { if (document.getElementById("txtfPhnoreq").value.length >= 10) { var Number = document.getElementById("txtfPhnoreq").value; var phone = document.getElementById("txtfPhnoreq").value; if (Number.indexOf('+') || Number.indexOf("+1") || ~Number.indexOf("+91")) { if (~Number.indexOf('+91')) { phone = Number.replace('+91', ""); } else if (~Number.indexOf('+1')) { phone = Number.replace('+1', ""); } else { phone = Number.replace('+', ""); } } if (phone.match(numberexp)) { count++; document.getElementById("txtfPhnoreq").className = "userlogin_formtext1"; } else { $(".pmsgreq").text("Enter valid PhoneNumber"); document.getElementById("txtfPhnoreq").className = "userlogin_formtext1Error"; } } else { $(".pmsgreq").text("Enter valid PhoneNumber"); document.getElementById("txtfPhnoreq").className = "userlogin_formtext1Error"; } } else { document.getElementById("txtfPhnoreq").className = "userlogin_formtext1Error"; } if (document.getElementById("txtfnamereq").value != "" && document.getElementById("txtlnamereq").value != "") { document.getElementById("txtlnamereq").className = "userlogin_formtext1"; if (document.getElementById("txtfnamereq").value.length >= 2) { document.getElementById("txtfnamereq").className = "userlogin_formtext1"; if (count == 1) { UpdateName(); } } else { $(".pmsgreq").text("First Name must be more than 2 characters"); } } else { if (document.getElementById("txtfnamereq").value != "") { if (document.getElementById("txtfnamereq").value.length >= 2) { document.getElementById("txtfnamereq").className = "userlogin_formtext1"; } else { $(".pmsgreq").text("First Name must be more than 2 characters"); } } else { document.getElementById("txtfnamereq").className = "userlogin_formtext1Error"; } if (document.getElementById("txtlnamereq").value == "") { document.getElementById("txtlnamereq").className = "userlogin_formtext1Error"; } else { document.getElementById("txtlnamereq").className = "userlogin_formtext1"; } } } function UpdateName() { var UserId = document.getElementById("UserId").innerHTML; if (UserId != null && UserId != "") { $(".namereqloader").css("display", "block"); $.ajax({ type: "POST", url: "Orders.aspx/UpddateFaceBUserName", data: "{'FristName': '" + document.getElementById("txtfnamereq").value + "','LastName': '" + document.getElementById("txtlnamereq").value + "','UserId': '" + UserId + "' ,'PhoneNo': '" + document.getElementById("txtfPhnoreq").value + "' }", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "Success") { SessionLogin(); } else { $(".pmsgreq").text("Phone number already existed."); $(".namereqloader").css("display", "none"); } } }); } } function CheckUserFirstOrder(UserId) { $.ajax({ type: "POST", url: "Orders.aspx/CheckUserFirstOrder", data: "{'UId': '" + UserId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { document.getElementById("Firstorder").innerHTML = msg.d; } } }); } function SessionLogin() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; RestaurantPointDetails(); $.ajax({ type: "POST", url: "Orders.aspx/SessionLogin", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } document.getElementById("UserId").innerHTML = msg.d[0].UserId; if (msg.d[0].FirstName == null || msg.d[0].PhoneNo == null) { if (msg.d[0].FirstName != null && msg.d[0].FirstName != 'null') { document.getElementById("txtfnamereq").value = msg.d[0].FirstName; } if (msg.d[0].LastName != null && msg.d[0].LastName != 'null') { document.getElementById("txtlnamereq").value = msg.d[0].LastName; } $(".UserNameReqpnl").css("margin-top", $(document).scrollTop() - 100); $('.UserNameReqpnl').css("display", "block"); return; } else { $('.UserNameReqpnl').css("display", "none"); } $(".signin").css("display", "none"); GetUserImage(msg.d[0].FirstName); FavoriteLoad(); $(".signinpanel").css("display", "none"); $(".welcome").css("display", "block"); $(".popupdisplay1").css("display", "inline-block"); $("#lblEmail").css("display", "none"); $(".signinoptdiv").css("display", "none"); if (window.self !== window.top) { if (window.parent.location != window.location) { $(".signin-accountdiv").css("display", "block"); } } $(".createac").css("display", "none"); document.getElementById("FirstName").innerHTML = msg.d[0].FirstName; document.getElementById("LastName").innerHTML = msg.d[0].LastName; document.getElementById("txtguestdeliveryemail").value = msg.d[0].UserEmail; document.getElementById("EmailID").innerHTML = msg.d[0].UserEmail; if (msg.d[0].LastName != null && msg.d[0].LastName != "null") document.getElementById("txtguestdeliveryname").value = msg.d[0].FirstName + " " + msg.d[0].LastName; else document.getElementById("txtguestdeliveryname").value = msg.d[0].FirstName; document.getElementById("lblPhoneno").innerHTML = msg.d[0].PhoneNo; $(".namereqloader").css("display", "none"); $('.UserNameReqpnl').css("display", "none"); var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { CheckUserFirstOrder(msg.d[0].UserId); //UserMuncheiscount(); } } } }); } function UserLogin() { $('.signinloader').css("display", "block"); var UId = ''; document.getElementById("UserId").innerHTML = UId; if (UId != "") { $('.signinloader').css("display", "none"); SessionLogin(); } else { var Email = document.getElementById('txtEmail').value; var Pwd = document.getElementById('txtPwd').value; if (Email == "") Email = document.getElementById('txtUserEmail').value; if (Pwd == "") Pwd = document.getElementById('txtPassword').value; Pwd = escape(Pwd); $.ajax({ type: "POST", url: "Orders.aspx/UserLogin", data: "{'Email': '" + Email + "','Pwd': '" + Pwd + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { $('.signinloader').css("display", "none"); if (msg.d[0].Action == "Success") { document.getElementById("UserId").innerHTML = msg.d[0].UserId; var cookie = "UserName" + "=" + escape(Email) + ";"; document.cookie = cookie; $(".signinpanel").css("display", "none"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } $(".signin").css("display", "none"); $(".welcome").css("display", "block"); $(".popupdisplay1").css("display", "inline-block"); $("#lblEmail").css("display","none"); $(".signinoptdiv").css("display", "none"); if (window.self !== window.top) { if (window.parent.location != window.location) { $(".signin-accountdiv").css("display", "block"); } } ; $(".createac").css("display", "none"); RestaurantPointDetails(); //UserMuncheiscount(); $("#logintxt").fadeOut("fast"); if (msg.d[0].FirstName == null || msg.d[0].FirstName == "") { $(".UserNameReqpnl").css("margin-top", $(document).scrollTop() - 100); $('.UserNameReqpnl').css("display", "block"); return; } else { $('.UserNameReqpnl').css("display", "none"); } document.getElementById("FirstName").innerHTML = msg.d[0].FirstName; document.getElementById("LastName").innerHTML = msg.d[0].LastName; document.getElementById("EmailID").innerHTML = msg.d[0].UserEmail; document.getElementById("txtguestdeliveryemail").value = msg.d[0].UserEmail; if (msg.d[0].LastName != null && msg.d[0].LastName != "") document.getElementById("txtguestdeliveryname").value = msg.d[0].FirstName + " " + msg.d[0].LastName; else document.getElementById("txtguestdeliveryname").value = msg.d[0].FirstName; document.getElementById("lblPhoneno").innerHTML = msg.d[0].PhoneNo; GetSavedAddress(); GetUserImage(msg.d[0].FirstName); FavoriteLoad(); CheckUserFirstOrder(msg.d[0].UserId); $(".promcartuser").css("display", "none"); $("#tblCart").css('opacity', '1'); $('.addcategoryloadingimage2').css("display", "none"); if (document.getElementById("finishorderblb").innerHTML == "finishorder") { FinishOrderValidation(); } if (document.getElementById('lblOpenPanel').innerHTML == "Validationpopup") { deliverycheck(); document.getElementById('lblOpenPanel').innerHTML == ""; } else if (document.getElementById('lblOpenPanel').innerHTML == "Reservation") { $('.addcategoryloadingimage2').css("display", "block"); ReserveTable(); document.getElementById('lblOpenPanel').innerHTML == ""; } else if (document.getElementById('lblOpenPanel').innerHTML == "StartGroupOrder") { InsertGroup(); } var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { var Pri = 0; for (var w = 0; w < AddedItems.length; w++) { Pri = +Pri + +AddedItems[w].Price; } if (document.getElementById("AwardPoint").innerHTML != "") { var ItemsAmount = Pri; var Award = document.getElementById("AwardPoint").innerHTML; var FirstOrderType = document.getElementById("Firstorder").innerHTML; var TotalAwards = 0; //if (FirstOrderType == "FirstOrder") { // TotalAwards = Award; //} //else { TotalAwards = ((ItemsAmount * Award) / 100) * 100; //} var Ta = Math.round(TotalAwards); Ta=Ta.replace(".00", ""); document.getElementById("lblearnedpoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; //document.getElementById("lblmunchiespoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; var munchiespoint = Ta + " " + document.getElementById("lblAwardType").innerHTML; if (munchiespoint != "") { $("#munchiespoints").css("display", "block"); document.getElementById("lblmunchiespoints").innerHTML = munchiespoint; } else { $("#munchiespoints").css("display", "none"); } } } } else if (msg.d[0].Action == "An email has been sent to verify your e-mail address.Once your account is activated you can start making Orders/Reservations.") { if (confirm("An email has been sent to verify your e-mail address.Once your account is activated you can start making Orders/Reservations.")) { $(".popupdisplay1").css("display", "none"); $(".signinoptdiv").css("display", "block"); if (window.self !== window.top) { if (window.parent.location != window.location) { $(".signin-accountdiv").css("display", "none"); } } $('#signinpanel').fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } $('.Activatepanel').fadeIn("slow"); $('.Activateresend').css("display", "block"); document.getElementById("lnkresendtext").innerHTML = "Resend Activation Text Message"; document.getElementById("lnkresendmail").innerHTML = "Resend Activation Email"; } else { document.getElementById('lblMsg12').innerHTML = msg.d[0].Action; $('.lblMsg12').css("display", "block"); } } else { $(".popupdisplay1").css("display", "none"); $(".signinoptdiv").css("display", "block"); if (window.self !== window.top) { if (window.parent.location != window.location) { $(".signin-accountdiv").css("display", "none"); } } if (document.getElementById('lblsigntex').innerHTML != "" || document.getElementById('Promoprice').innerHTML != "") { document.getElementById('btngust').style.display = "none"; } else { var guestorder = documnet.getElementById('lblguestodrbtn').value; if (guestorder == "True") { document.getElementById('btngust').style.display = "block"; $("#spnwelback").css("display", "block"); } } if (document.getElementById('popupsscroll').innerHTML == "over") { $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 500); } else { $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 30); } $(".signinpanel").fadeIn("slow"); $('.lblMsg12').css("display", "block"); document.getElementById('lblMsg12').innerHTML = msg.d[0].Action; } } else { var guestorder = document.getElementById('lblguestodrbtn').value; if (guestorder == "True") { document.getElementById('btngust').style.display = "block"; $("#spnwelback").css("display", "block"); } if (document.getElementById('popupsscroll').innerHTML == "over") { $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 500); } else { $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 30); } $(".signinpanel").fadeIn("slow"); $(".popupdisplay1").css("display", "none"); $(".signinoptdiv").css("display", "block"); if (window.self !== window.top) { if (window.parent.location != window.location) { $(".signin-accountdiv").css("display", "none"); } } } } }); } } function ForgetPassword() { document.getElementById('forgetpasswordpnl').style.display = "block"; $(".signinpanel").css("display", "none"); $("#imgbtnPwdSubmit").css("display", "block"); } function Signinlabel() { document.getElementById("lbldchange").innerHTML = ""; var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems == null) { document.getElementById('btngust').style.display = "none"; $("#spnwelback").css("display", "none"); document.getElementById('lblOpenPanel').innerHTML = "Validationpopup"; } else if (AddedItems != null) { if (AddedItems.length == 0) { document.getElementById('btngust').style.display = "none"; $("#spnwelback").css("display", "none"); document.getElementById('lblOpenPanel').innerHTML = "Validationpopup"; } } else{ document.getElementById('btngust').style.display = "block"; $("#spnwelback").css("display", "block"); } if (document.getElementById('popupsscroll').innerHTML == "over") $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 500); else $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 30); $(".signinpanel").fadeIn("slow"); $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); $(".deliveryvalidationpanel").fadeOut("slow"); document.getElementById('deliveryvalidationpanel').style.display = "none"; } function forgetpasswordclose() { document.getElementById('forgetpasswordpnl').style.display = "none"; document.getElementById('btngust').style.display = "block"; $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 30); $(".signinpanel").fadeIn("slow"); $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); } function forgetpasswordValidation() { var Email = document.getElementById('txtEId').value; emailExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i; numberexp = /^\+(?:[0-9] ?){6,14}[0-9]$/; //^[0-9-+]+$/ numberexp1 = /^\d{10}$/; var i = 0; if (Email == '') { document.getElementById('Forgetlbl').style.display = "none"; document.getElementById('txtEId').className = "login_formtextError"; } else { document.getElementById('txtEId').className = "login_formtextError"; if (isNaN(Email)) { if (!Email.match(emailExp)) { document.getElementById('Forgetlbl').style.display = "block"; document.getElementById('Forgetlbl').innerHTML = "Enter Valid Email"; i++; } } else if (!Email.match(numberexp) && !Email.match(numberexp1)) { document.getElementById('Forgetlbl').style.display = "block"; document.getElementById('Forgetlbl').innerHTML = "Enter Valid Number"; i++; } if (i == 0) { forgetpasswordsubmit(); } } } function forgetpasswordsubmit() { $("#imgbtnPwdSubmit").css("display", "none"); $(".forgetloader").css("display", "block"); $('#Forgetlbl').css("display", "none"); var Email = document.getElementById('txtEId').value; if (Email != "") { $.ajax({ type: "POST", url: "Orders.aspx/forgetpasswordsubmit", data: "{'Email': '" + Email + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d != "Please Enter valid email or phonenumber") { $(".forgetloader").css("display", "none"); $('.CompanyRegistrepnl').css("display", "none"); document.getElementById('forgetpasswordpnl').style.display = "none"; document.getElementById('btngust').style.display = "block"; $("#spnwelback").css("display", "block"); if (document.getElementById('popupsscroll').innerHTML == "over") $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 500); else $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 30); $(".signinpanel").fadeIn("slow"); $('.lblMsg12').css("display", "block"); document.getElementById('lblMsg12').innerHTML = msg.d; } else { document.getElementById('forgetpasswordpnl').style.display = "block"; document.getElementById('Forgetlbl').innerHTML = msg.d; $('#Forgetlbl').css("display", "block"); $(".forgetloader").css("display", "none"); $("#imgbtnPwdSubmit").css("display", "block"); } $('.createaccountloader').css("display", "none"); } } }); } else { if (Email == "") { $(".forgetloader").css("display", "none"); document.getElementById('Forgetlbl').innerHTML = "Please Enter Email"; Email.focus; } } } function GetUserDetails() { var UId = document.getElementById("UserId").innerHTML; if (UId != "") { $.ajax({ type: "POST", url: "Orders.aspx/GetUserDetails", data: "{'UId': '" + UId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { if (msg.d.length > 0) { var Phono = msg.d; Phono = Phono.replace("+1", ""); Phono = Phono.replace("+", ""); Phono = Phono.replace("+91", ""); Phono = Phono.replace(" ", ""); document.getElementById('txtmobilenumber').value = Phono; } } } }); } } function GetSavedAddress() { var UId = document.getElementById("UserId").innerHTML; if (UId != "") { $.ajax({ type: "POST", url: "Orders.aspx/GetSavedAddress", data: "{'UId': '" + UId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var PreviousData = localStorage.getItem("DeliveryType"); var Table = JSON.parse(PreviousData); $(".ddlsavedaddress").empty(); var ddlmultiplecontacts = document.getElementById('ddlsavedaddress'); for (var l = 0; l < msg.d.length; l++) { if (msg.d[l].Text != "") { var optmin = document.createElement("option"); optmin.text = msg.d[l].Text; optmin.value = msg.d[l].Value; ddlmultiplecontacts.options.add(optmin); } $(".btngust").css("display", "none"); $("#spnwelback").css("display", "none"); if (Table != null) { if (Table.length > 0) { var textToFind = Table[0].Selectedaddrtype; var value = Table[0].AddressId; if (msg.d[l].Value === value) { $(".ddlsavedaddress").val(msg.d[l].Value); } } } } var G = document.getElementById("ddlsavedaddress"); var AddressId = G.options[G.selectedIndex].value; var selectedtext = G.options[G.selectedIndex].text; if (selectedtext == "-Add Address for delivery-") document.getElementById('AdrValue').innerHTML = "NewId"; else document.getElementById('AdrValue').innerHTML = AddressId; } }); } else $(".divsavedaddressheight").css("display", "none"); } function GetSelectedAddress() { var G = document.getElementById("ddlsavedaddress"); var AddressId = G.options[G.selectedIndex].value; var selectedtext = G.options[G.selectedIndex].text; if (selectedtext == "-Add Address for delivery-") { document.getElementById("txtaddress").value = ""; document.getElementById("txtvalidationcity").value = ""; document.getElementById("txtvalidationstate").value = ""; document.getElementById("txtvalidationzip").value = ""; document.getElementById("txtaddress").removeAttribute("disabled"); document.getElementById("txtvalidationcity").removeAttribute("disabled"); document.getElementById("txtvalidationstate").removeAttribute("disabled"); document.getElementById("txtvalidationzip").removeAttribute("disabled"); document.getElementById("txtDoorNO").removeAttribute("disabled"); document.getElementById("txtLandmark").removeAttribute("disabled"); } else { var UId = document.getElementById("UserId").innerHTML; if (UId != "") { $.ajax({ type: "POST", url: "Orders.aspx/GetContacts", data: "{'UId': '" + UId + "','AddressId': '" + AddressId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { GetUserDetails(); if (msg.d[1] != null) document.getElementById("txtaddress").value = msg.d[0] + msg.d[1]; else document.getElementById("txtaddress").value = msg.d[0]; document.getElementById("txtvalidationcity").value = msg.d[2]; document.getElementById("txtvalidationstate").value = msg.d[3]; document.getElementById("txtvalidationzip").value = msg.d[4]; document.getElementById("txtDoorNO").value = msg.d[5]; document.getElementById("txtLandmark").value = msg.d[6]; document.getElementById("txtaddress").setAttribute("disabled", false); document.getElementById("txtvalidationcity").setAttribute("disabled", false); document.getElementById("txtvalidationstate").setAttribute("disabled", false); document.getElementById("txtvalidationzip").setAttribute("disabled", false); document.getElementById("txtDoorNO").setAttribute("disabled", false); document.getElementById("txtLandmark").setAttribute("disabled", false); } }); } } } </script> <script type="text/javascript"> function AddItemstoPanel() { var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); document.getElementById('TableDeliveryCart').innerHTML = ""; if (AddedItems != null) { for (var g = 0; g < AddedItems.length; g++) { var trItem = document.createElement("tr"); setAttributes(trItem, { "style": "color:#333333;vertical-align: top;", "align": "center" }); var tdItem = document.createElement("td"); setAttributes(tdItem, { "class": "Order_contnet1", "width": "60%" }); var lblItem = document.createElement("span"); lblItem.innerHTML += unescape(AddedItems[g].ItemName); tdItem.appendChild(lblItem); if (AddedItems[g].Variations != null) { if (AddedItems[g].Variations.length > 0) { for (var v = 0; v < AddedItems[g].Variations.length; v++) { var brvariation = document.createElement("br"); tdItem.appendChild(brvariation); var lblVariations = document.createElement("span"); lblVariations.innerHTML = AddedItems[g].Variations[v].Name; tdItem.appendChild(lblVariations); } } } if (AddedItems[g].Choices != null) { if (AddedItems[g].Choices.length > 0) { var br = document.createElement("br"); tdItem.appendChild(br); var lblOptions = document.createElement("span"); setAttributes(lblOptions, { "style": "font-size:10px;", }); for (var d = 0; d < AddedItems[g].Choices.length; d++) { if(d > 0){ if(lblOptions.innerHTML.indexOf("<br> ",lblOptions.innerHTML.length-34) == -1) lblOptions.innerHTML += "<br> "; } else { lblOptions.innerHTML = " "; } if (AddedItems[g].Choices[d].Notify == true) { if (AddedItems[g].Choices[d].ChoiceName != undefined) { var ChoicesQuantity = AddedItems[g].Choices[d].ChoicesQuantity; var Quantity = AddedItems[g].Choices[d].Quantity; if (Quantity == "0" || Quantity == undefined) Quantity = ""; if (d == 0) lblOptions.innerHTML += unescape(Quantity + " " + AddedItems[g].Choices[d].ChoiceName); else lblOptions.innerHTML += unescape(Quantity + " " + AddedItems[g].Choices[d].ChoiceName); if (ChoicesQuantity == "0" || ChoicesQuantity == undefined) ChoicesQuantity = ""; lblOptions.innerHTML += " " + ChoicesQuantity + "<br> "; var OptionId = ""; if (AddedItems[g].Choices[d].ChildChoices != undefined) { for (var W = 0; W < AddedItems[g].Choices[d].ChildChoices.length; W++) { if (AddedItems[g].Choices[d].ChildChoices[W].Notify == true) { if (AddedItems[g].Choices[d].ChildChoices[W].OptionId != OptionId) { if(lblOptions.innerHTML.indexOf("<br> ",lblOptions.innerHTML.length-34) == -1){ lblOptions.innerHTML += "<br> " + unescape(AddedItems[g].Choices[d].ChildChoices[W].ChoiceName); }else{ lblOptions.innerHTML += " " + unescape(AddedItems[g].Choices[d].ChildChoices[W].ChoiceName);; } } else{ lblOptions.innerHTML += "<br> " + unescape(AddedItems[g].Choices[d].ChildChoices[W].ChoiceName); } OptionId = AddedItems[g].Choices[d].ChildChoices[W].OptionId; } } } } else { if (AddedItems[g].Choices[d].Measurement != undefined) { if (AddedItems[g].Choices[d].Measurement != "Lbs") lblOptions.innerHTML += unescape(AddedItems[g].Choices[d].Weight * AddedItems[g].Quantity + " " + AddedItems[g].Choices[d].Measurement) + " (" + AddedItems[g].Choices[d].Conversation + ")" + "<br> "; else lblOptions.innerHTML += unescape(AddedItems[g].Choices[d].Weight * AddedItems[g].Quantity + " " + AddedItems[g].Choices[d].Measurement) + "<br> "; } } tdItem.appendChild(lblOptions); } } } } if (AddedItems[g].OfferName != null) { var br = document.createElement("br"); tdItem.appendChild(br); var OfferName = document.createElement("span"); setAttributes(OfferName, { "style": "color:red;", "id":unescape(AddedItems[g].OfferName.split("/")[1])}); OfferName.innerHTML += unescape(AddedItems[g].OfferName.split("/")[0]); tdItem.appendChild(OfferName); } if (AddedItems[g].Instructions != "") { var br = document.createElement("br"); tdItem.appendChild(br); var lblInstructions = document.createElement("span"); setAttributes(lblInstructions, { "style": "font-size:10px;", }); lblInstructions.innerHTML += "Instructions: " + unescape(AddedItems[g].Instructions); tdItem.appendChild(lblInstructions); } trItem.appendChild(tdItem); var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Order_contnet1", "width": "24%"}); setAttributes(tdQuantity, { "style": "text-align:center;vertical-align:baseline;" }); var lblQuantity = document.createElement("span"); var UnitType = ""; if (AddedItems[g].PriceType == "Per Unit") { UnitType = " (" + AddedItems[g].ItemUnitQty + " " + AddedItems[g].UnitName + ")"; } lblQuantity.innerHTML += AddedItems[g].Quantity + UnitType; tdQuantity.appendChild(lblQuantity); trItem.appendChild(tdQuantity); var tdPrice = document.createElement("td"); setAttributes(tdPrice, { "class": "Order_contnet1", "style": "text-align:center;vertical-align:baseline;", "width": "15%" }); var lblPrice = document.createElement("span"); lblPrice.innerHTML += document.getElementById("lblCurrency").innerHTML + AddedItems[g].Price; tdPrice.appendChild(lblPrice); if (AddedItems[g].Choices != null) { if (AddedItems[g].Choices.length > 0) { var br = document.createElement("br"); tdItem.appendChild(br); var lblOptions = document.createElement("span"); setAttributes(lblOptions, { "style": "font-size:10px;", }); for (var d = 0; d < AddedItems[g].Choices.length; d++) { if(lblOptions.innerHTML.indexOf("<br>",lblOptions.innerHTML.length-4) == -1) lblOptions.innerHTML += "<br>"; if (AddedItems[g].Choices[d].Notify == true) { if (AddedItems[g].Choices[d].ChoiceName != undefined) { var ChoicesQuantity = AddedItems[g].Choices[d].ChoicesQuantity; var Quantity = AddedItems[g].Choices[d].Quantity; if (Quantity == "0" || Quantity == undefined) Quantity = ""; if (d == 0) lblOptions.innerHTML += document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].Price; else lblOptions.innerHTML += document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].Price; lblOptions.innerHTML += "<br>"; var OptionId = ""; if (AddedItems[g].Choices[d].ChildChoices != undefined) { for (var W = 0; W < AddedItems[g].Choices[d].ChildChoices.length; W++) { if (AddedItems[g].Choices[d].ChildChoices[W].Notify == true) { if (AddedItems[g].Choices[d].ChildChoices[W].OptionId != OptionId) { if(lblOptions.innerHTML.indexOf("<br>",lblOptions.innerHTML.length-4) == -1){ lblOptions.innerHTML += "<br>"+ document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].ChildChoices[W].Price; }else{ lblOptions.innerHTML += document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].ChildChoices[W].Price;; } } else{ lblOptions.innerHTML += "<br>" + document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].ChildChoices[W].Price; } OptionId = AddedItems[g].Choices[d].ChildChoices[W].OptionId; } } } } tdPrice.appendChild(lblOptions); } } } } if (AddedItems[g].OfferName != null) { var br = document.createElement("br"); tdPrice.appendChild(br); var OfferValue = document.createElement("span"); setAttributes(OfferValue, { "style": "color:red;", "id":unescape(AddedItems[g].OfferName.split("/")[1])}); OfferValue.innerHTML += document.getElementById("lblCurrency").innerHTML + AddedItems[g].OfferValue; tdPrice.appendChild(OfferValue); } trItem.appendChild(tdPrice); document.getElementById('TableDeliveryCart').appendChild(trItem); var LOrderType = localStorage.getItem("OrderType"); if (LOrderType == "Delivery") GetDrivers("CurrentDay", "Drivers"); } } } function AddItemstoPanelingrouporder() { document.getElementById('TableDeliveryCart').innerHTML = ""; var OtherMembersItems = localStorage.getItem("OtherMembersItems"); var AddedItems = JSON.parse(OtherMembersItems); if (AddedItems != null) { if (AddedItems.length > 0) { for (var M = 0; M < AddedItems.length; M++) { var membertable = document.createElement("table"); setAttributes(membertable, { "class": "groupcart" }); var membertr = document.createElement("tr"); var membertd = document.createElement("td"); var memberspanName = document.createElement("span"); setAttributes(memberspanName, { "style": "font-size: 16px;font-weight: bold;color: black;" }); memberspanName.innerHTML += AddedItems[M].MemberName; var memberType = document.createElement("span"); memberType.innerHTML += " (" + AddedItems[M].MemberType + ")"; membertd.appendChild(memberspanName); membertd.appendChild(memberType); membertr.appendChild(membertd); membertable.appendChild(membertr); var Price = 0; for (var I = 0; I < AddedItems[M].GroupItems.length; I++) { var trItem = document.createElement("tr"); setAttributes(trItem, { "style": "color:#333333;", "align": "center", }); var tdItem = document.createElement("td"); setAttributes(tdItem, { "class": "Order_contnet1", "width": "50%" }); var lblItem = document.createElement("span"); setAttributes(lblItem, { "style": "font-weight:bold;font-size:12px;", "class": "CartItem" }); lblItem.innerHTML += unescape(AddedItems[M].GroupItems[I].ItemName); tdItem.appendChild(lblItem); if (AddedItems[M].GroupItems[I].Variations != null) { if (AddedItems[M].GroupItems[I].Variations.length > 0) { for (var v = 0; v < AddedItems[M].GroupItems[I].Variations.length; v++) { var brvariation = document.createElement("br"); tdItem.appendChild(brvariation); var lblVariations = document.createElement("span"); lblVariations.innerHTML = AddedItems[M].GroupItems[I].Variations[v].Name; tdItem.appendChild(lblVariations); itmvaritaions = AddedItems[M].GroupItems[I].Variations[v].Name; } } } if (AddedItems[M].GroupItems[I].Choices != null) { if (AddedItems[M].GroupItems[I].Choices.length > 0) { var br = document.createElement("br"); tdItem.appendChild(br); var lblOptions = document.createElement("span"); setAttributes(lblOptions, { "style": "font-size:10px;", }); for (var Ch = 0; Ch < AddedItems[M].GroupItems[I].Choices.length; Ch++) { if (Ch == 0) { lblOptions.innerHTML += unescape(AddedItems[M].GroupItems[I].Choices[Ch].ChoiceName); } else { lblOptions.innerHTML += ", " + unescape(AddedItems[M].GroupItems[I].Choices[Ch].ChoiceName); } var OptionId = ""; if (AddedItems[M].GroupItems[I].Choices[Ch].ChildChoices != undefined) { for (var CCh = 0; CCh < AddedItems[M].GroupItems[I].Choices[Ch].ChildChoices.length; CCh++) { if (AddedItems[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].OptionId != OptionId) { lblOptions.innerHTML += " / " + unescape(AddedItems[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].OptionName); lblOptions.innerHTML += " / " + unescape(AddedItems[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].ChoiceName); } else { lblOptions.innerHTML += " , " + unescape(AddedItems[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].ChoiceName); } OptionId = AddedItems[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].OptionId; } } } tdItem.appendChild(lblOptions); } } if (AddedItems[M].GroupItems[I].Instructions != "") { var br = document.createElement("br"); tdItem.appendChild(br); var lblInstructions = document.createElement("span"); setAttributes(lblInstructions, { "style": "font-size:10px;", }); lblInstructions.innerHTML += "Instructions: " + unescape(AddedItems[M].GroupItems[I].Instructions); tdItem.appendChild(lblInstructions); } trItem.appendChild(tdItem); var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Order_contnet1", "style": "text-align:center;vertical-align:baseline;", "width": "10%" }); var lblQuantity = document.createElement("span"); lblQuantity.innerHTML += AddedItems[M].GroupItems[I].Quantity; tdQuantity.appendChild(lblQuantity); trItem.appendChild(tdQuantity); var tdPrice = document.createElement("td"); setAttributes(tdPrice, { "class": "Order_contnet1", "style": "text-align:right;vertical-align:baseline;", "width": "10%" }); var lblPrice = document.createElement("span"); lblPrice.innerHTML += AddedItems[M].GroupItems[I].Price; tdPrice.appendChild(lblPrice); trItem.appendChild(tdPrice); membertable.appendChild(trItem); Price = +Price + AddedItems[M].GroupItems[I].Price; } var trSubtotal = document.createElement("tr"); setAttributes(trSubtotal, { "style": "width:100%;text-align:right;" }); var tdSubtotal = document.createElement("td"); setAttributes(tdSubtotal, { "colspan": "3", "style": "border-top: gray 2px solid;color: black;" }); var lblSubtotalPrice = document.createElement("span"); var lblSubtotalText = document.createElement("span"); setAttributes(lblSubtotalPrice, { "style": "font-weight: bold;color: green;font-size: 14px;" }); //setAttributes(lblItem, { "style": "font-weight:bold;font-size:12px;cursor:pointer;", "onclick": "EditItemOptions(this);", "id": "EditItem" + g, "class": "CartItem" }); lblSubtotalText.innerHTML += "SubTotal: "; lblSubtotalPrice.innerHTML += Price.toFixed(2); tdSubtotal.appendChild(lblSubtotalText); tdSubtotal.appendChild(lblSubtotalPrice); trSubtotal.appendChild(tdSubtotal); membertable.appendChild(trSubtotal); document.getElementById('TableDeliveryCart').appendChild(membertable); } } } } var DriversCheck = ""; function DriverPrice() { var G = 0; var Price = 0; var check = 0; $('#tblUserDrivers tr.DriversClass').each(function () { if ((this.childNodes[0].childNodes[0].checked == true)) { check++; var Drivers = localStorage.getItem("Drivers"); var DriversPrices = JSON.parse(Drivers); if (DriversPrices.length > 0) { DriversCheck = DriversPrices[G].Action; if (DriversPrices[G].DriverFee > 0) { Price = DriversPrices[G].DriverFee.toFixed(2); } } } G++; }); if (check == 0) { G = 0; $('#tblDrivers tr.DriversClass').each(function () { if ((this.childNodes[0].childNodes[0].checked == true)) { var Drivers = localStorage.getItem("Drivers"); var DriversPrices = JSON.parse(Drivers); if (DriversPrices.length > 0) { DriversCheck = DriversPrices[G].Action; if (DriversPrices[G].DriverFee > 0) { Price = DriversPrices[G].DriverFee.toFixed(2); } } } G++; }); } return Price; } function CheckDrivers(id, len, DriverId) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; for (var i = 0; i < len; i++) { if (id != "Radio" + i) { document.getElementById("Radio" + i).checked = false; } } document.getElementById("lblselecteddriver").innerHTML = DriverId; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} } function CheckUserDrivers(id, len) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; for (var i = 0; i < len; i++) { if (id != "Radios" + i) { document.getElementById("Radios" + i).checked = false; } } if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} } function GetDrivers(Expected, Type) { if (document.getElementById("lblMyDrivers").innerHTML == "true" || document.getElementById("lblMyDrivers").innerHTML == true) { var Currency = document.getElementById("lblCurrency").innerHTML; if (Currency == "$") { var UId = document.getElementById("UserId").innerHTML; if (UId != "") { document.getElementById('tblUserDrivers').innerHTML = ""; var DriverId = ""; if (Type == "Drivers") document.getElementById('tblDrivers').innerHTML = ""; else { $('#tblDrivers tr').each(function () { if ((this.childNodes[0].childNodes[0].checked == true)) { DriverId = this.id; } }); } var Timezone = document.getElementById('lbltimezonename').value; var RawOffset = document.getElementById('lblrawoffset').innerHTML; var LocationId = document.getElementById('lblLId').value; var selectedDate = ""; if (Type != "Drivers") selectedDate = document.getElementById('txtdeliverydate').value; $.ajax({ type: "POST", url: "Orders.aspx/GetDrivers", data: "{'LocationId': '" + LocationId + "','Timezone': '" + Timezone + "','Expected': '" + Expected + "','selectedDate': '" + selectedDate + "','RawOffset':'" + RawOffset + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { localStorage.setItem("Drivers", JSON.stringify(msg.d)); for (var i = 0; i < msg.d.length; i++) { var trDrivers = document.createElement("tr"); setAttributes(trDrivers, { "id": msg.d[i].Driverid, "class": "DriversClass" }); var tdDeliveryPrice = document.createElement("td"); setAttributes(tdDeliveryPrice, { "style": "width:80px;" }); var rbtnDeliveryPrice = document.createElement("input"); var Driverfee = ""; if (msg.d[i].DriverFee > 0) { Driverfee = document.getElementById("lblCurrency").innerHTML + msg.d[i].DriverFee.toFixed(2); } var lblDriverFee = document.createElement("label"); if (Type == "Drivers") { setAttributes(rbtnDeliveryPrice, { "id": "Radio" + i, "type": "checkbox", "Name": "DriversRadio", "onclick": "CheckDrivers(this.id, " + msg.d.length + ",'" + msg.d[i].Driverid + "');", "value": Driverfee, "style": "cursor:pointer;", "onchange": "SelectedDriver(" + msg.d[i].Driverid + ")" }); lblDriverFee.innerHTML = Driverfee; setAttributes(lblDriverFee, { "for": "Radio" + i, "style": "cursor:pointer;" }); } else { setAttributes(rbtnDeliveryPrice, { "id": "Radios" + i, "type": "checkbox", "Name": "UserDriversRadio", "onclick": "CheckUserDrivers(this.id, " + msg.d.length + ");", "value": Driverfee, "style": "cursor:pointer;" }); lblDriverFee.innerHTML = Driverfee; setAttributes(lblDriverFee, { "for": "Radios" + i, "style": "cursor:pointer;" }); } tdDeliveryPrice.appendChild(rbtnDeliveryPrice); tdDeliveryPrice.appendChild(lblDriverFee); trDrivers.appendChild(tdDeliveryPrice); var tdDriverInfo = document.createElement("td"); setAttributes(tdDriverInfo, { "style": "width:200px;" }); var tableDriverInfo = document.createElement("table"); setAttributes(tableDriverInfo, { "style": "font-size: 13px;color: black;" }); var trDriverName = document.createElement("tr"); var tdDriverName = document.createElement("td"); var lblDriverName = document.createElement("label"); lblDriverName.innerHTML = msg.d[i].DriverName; lblDriverName.setAttribute("Id", msg.d[i].Driverid); lblDriverName.setAttribute("onclick", "OpenDriverReviews(this);"); lblDriverName.setAttribute("style", "cursor:pointer"); tdDriverName.appendChild(lblDriverName); trDriverName.appendChild(tdDriverName); tableDriverInfo.appendChild(trDriverName); if (msg.d[i].OrderDeliveryTime != '0' && msg.d[i].OrderDeliveryTime != null) { var trDriverAvail = document.createElement("tr"); var tdDriverAvail = document.createElement("td"); var lblDriverAvail = document.createElement("label"); lblDriverAvail.innerHTML = "Deliver in " + msg.d[i].OrderDeliveryTime + " min."; tdDriverAvail.appendChild(lblDriverAvail); trDriverAvail.appendChild(tdDriverAvail); tableDriverInfo.appendChild(trDriverAvail); } var trDriverRating = document.createElement("tr"); var tdDriverRating = document.createElement("td"); var ratingtext = document.createElement("span"); var Rating = Math.floor(msg.d[i].DriverReview); ratingtext.innerHTML = msg.d[i].DriverReview; var R = 1; for (var S = 1; S <= Rating; S++) { var img1 = document.createElement("img"); img1.setAttribute("src", "images/RatingOver.png"); img1.setAttribute("alt", "Rating Over"); img1.setAttribute("class", "raringimg"); tdDriverRating.appendChild(img1); R++; } if (ratingtext.innerHTML.indexOf(".") != -1) { var img1 = document.createElement("img"); img1.setAttribute("src", "images/HalfRating.png"); img1.setAttribute("alt", "Half Rating"); img1.setAttribute("class", "raringimg"); tdDriverRating.appendChild(img1); R++; } for (var S = R; S <= 5; S++) { var img1 = document.createElement("img"); img1.setAttribute("src", "images/RatingNormal.png"); img1.setAttribute("alt", "Normal Rating"); img1.setAttribute("class", "raringimg"); tdDriverRating.appendChild(img1); } trDriverRating.appendChild(tdDriverRating); tableDriverInfo.appendChild(trDriverRating); tdDriverInfo.appendChild(tableDriverInfo); trDrivers.appendChild(tdDriverInfo); var tdDriverImage = document.createElement("td"); setAttributes(tdDriverImage, { "style": "width:200px;" }); var img1 = document.createElement("img"); setAttributes(img1, { "style": "width:60px;height:60px;border-radius: 15px;", "src": msg.d[i].DriverImage }); tdDriverImage.appendChild(img1); var availablestatus = document.createElement("label"); availablestatus.setAttribute("style", "font-size:12px;padding-left:4px;"); var img1 = document.createElement("img"); if (msg.d[i].Availability == true) { setAttributes(img1, { "style": "width:10px;height:10px", "src": "images/Availability.png", "alt": "Availability" }); availablestatus.innerHTML = "(Available)"; } else { setAttributes(img1, { "style": "width:10px;height:10px", "src": "images/Away.png", "alt": "Away" }); availablestatus.innerHTML = "(Busy)"; } tdDriverImage.appendChild(img1); tdDriverImage.appendChild(availablestatus); trDrivers.appendChild(tdDriverImage); if (UId != "" && UId != null) { document.getElementById("tblUserDrivers").appendChild(trDrivers); if (Type == "Drivers") { document.getElementById("tblDrivers").appendChild(trDrivers); } if (DriverId != "") { $('#tblUserDrivers tr').each(function () { if ((this.id == DriverId)) { this.childNodes[0].childNodes[0].checked = true; } }); } } } } else { if (Type == "Drivers" && document.getElementById("lblCurrency").innerHTML == "$") { document.getElementById("tblDrivers").innerHTML = ""; } } } }); } } } else document.getElementById('tblUserDrivers').innerHTML = ""; } function OpenDriverReviews(DriverId) { document.getElementById('DriverReviewTable').innerHTML = ""; $("#lblnoreviewmsg").css("display", "none"); document.getElementById("lblnoreviewmsg").innerHTML = ""; $.ajax({ type: "POST", url: "orders.aspx/GetDriverReviewsInfo", data: "{'DriverId': '" + DriverId.id + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById('DriverReviewTable').innerHTML = ""; if (msg.d.length > 0) { document.getElementById("lbldrivername").innerHTML = msg.d[0].DriverName; document.getElementById("lbldriverycount").innerHTML = msg.d[0].DriverDeliverorderCount; document.getElementById("lbldriveryaverage").innerHTML = msg.d[0].AverageDeliveryTime; var image = document.getElementById("imgdriverimage"); if (msg.d[0].DriverImage != "" && msg.d[0].DriverImage != null) setAttributes(image, { "src": msg.d[0].DriverImage, "width": "80px", "height": "95px" }); else setAttributes(image, { "src": "https://www.munchem.com/images/imagenotavailable.png", "width": "80px", "height": "95px", "alt": "User Image Not available" }); if (msg.d[0].DriverReviews != null) { for (i = 0; i < msg.d[0].DriverReviews.length; i++) { var DateRow = document.createElement("tr"); var DateCell = document.createElement("td"); var Namediv = document.createElement("div"); var Nametable = document.createElement("table"); setAttributes(Nametable, { "style": "width:100%;" }); var Nametr = document.createElement("tr"); var Nametd = document.createElement("td"); setAttributes(Nametd, { "style": "text-align:left;color:black" }); var UserName = document.createElement("span"); setAttributes(UserName, { "style": "font-weight: bold;font-size: 12pt;" }); UserName.innerHTML = msg.d[0].DriverReviews[i].Reviewusername; Nametd.appendChild(UserName); var datetd = document.createElement("td"); setAttributes(datetd, { "style": "text-align:right;color:black" }); var date = document.createElement("span"); date.innerHTML = msg.d[0].DriverReviews[i].ReviewCreatedDateTime; datetd.appendChild(date); Nametr.appendChild(Nametd); Nametr.appendChild(datetd); Nametable.appendChild(Nametr); Namediv.appendChild(Nametable); var ReviewData = document.createElement("div"); var Rtable = document.createElement("table"); setAttributes(Rtable, { "style": "width:100%;" }); var rtr = document.createElement("tr"); var rtd = document.createElement("td"); var rimage = document.createElement("img"); if (msg.d[0].DriverReviews[i].ReviewUserImageUrl != "" && msg.d[0].DriverReviews[i].ReviewUserImageUrl != null) setAttributes(rimage, { "src": msg.d[i].UserImage, "width": "80px", "height": "95px" }); else setAttributes(rimage, { "src": "https://www.munchem.com/images/imagenotavailable.png", "width": "80px", "height": "95px", "alt": "User Image Not Available" }); rtd.appendChild(rimage); setAttributes(rtd, { "style": "width:18%;" }); var reviewtd = document.createElement("td"); var subrtable = document.createElement("table"); setAttributes(subrtable, { "style": "width:100%;" }); var subrrevtr = document.createElement("tr"); var RatingCell = document.createElement("td"); setAttributes(RatingCell, { "style": "padding-top: 20px;" }); var img1 = document.createElement("img"); var img2 = document.createElement("img"); var img3 = document.createElement("img"); var img4 = document.createElement("img"); var img5 = document.createElement("img"); if (msg.d[0].DriverReviews[i].Rating == 0 || msg.d[0].DriverReviews[i].Rating == null) { setAttributes(img1, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;margin-left: 10px;", "alt": "Normal Rating" }); setAttributes(img2, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img3, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img4, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img5, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); } else if (msg.d[0].DriverReviews[i].Rating == 1) { setAttributes(img1, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;margin-left: 10px;", "alt": "Rating Over" }); setAttributes(img2, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img3, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img4, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img5, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); } else if (msg.d[0].DriverReviews[i].Rating == 2) { setAttributes(img1, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;margin-left: 10px;", "alt": "Rating Over" }); setAttributes(img2, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img3, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img4, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img5, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); } else if (msg.d[0].DriverReviews[i].Rating == 3) { setAttributes(img1, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;margin-left: 10px;", "alt": "Rating Over" }); setAttributes(img2, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img3, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img4, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img5, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); } else if (msg.d[0].DriverReviews[i].Rating == 4) { setAttributes(img1, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;margin-left: 10px;", "alt": "Rating Over" }); setAttributes(img2, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img3, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img4, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img5, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); } else if (msg.d[0].DriverReviews[i].Rating == 5) { setAttributes(img1, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;margin-left: 10px;", "alt": "Rating Over" }); setAttributes(img2, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img3, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img4, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img5, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); } RatingCell.appendChild(img1); RatingCell.appendChild(img2); RatingCell.appendChild(img3); RatingCell.appendChild(img4); RatingCell.appendChild(img5); subrrevtr.appendChild(RatingCell); var OptionRow = document.createElement("tr"); var OptionCell = document.createElement("td"); var OptionText = document.createElement("span"); if (msg.d[0].DriverReviews[i].Description != null && msg.d[0].DriverReviews[i].Description != "") OptionText.innerHTML = msg.d[0].DriverReviews[i].Description; setAttributes(OptionCell, { "colspan": "2", "style": "color: black;padding: 10px 0px;line-height: 1.4;" }); setAttributes(OptionText, { "style": "float:left;text-align: left;margin-left:7%;" }); OptionCell.appendChild(OptionText); OptionRow.appendChild(OptionCell); subrtable.appendChild(subrrevtr); subrtable.appendChild(OptionRow); reviewtd.appendChild(subrtable); rtr.appendChild(rtd); rtr.appendChild(reviewtd); Rtable.appendChild(rtr); ReviewData.appendChild(Rtable); DateCell.appendChild(Namediv); DateCell.appendChild(ReviewData); setAttributes(Namediv, { "style": "padding-top:2px;;" }); setAttributes(ReviewData, { "style": "border-bottom:2px solid #7f7f7f;padding-bottom: 8px;" }); DateRow.appendChild(DateCell); document.getElementById('DriverReviewTable').appendChild(DateRow); } } else { $("#lblnoreviewmsg").css("display", "block"); document.getElementById("lblnoreviewmsg").innerHTML = "No Reviews"; } $(".DriverReviewloader").css("display", "none"); var menuheight = $(".menu").css('height'); menuheight = menuheight.replace("px", ""); var documentheight = $(document).scrollTop(); var reviewstblheight = $(".DriverReviewTable").css('height'); reviewstblheight = reviewstblheight.replace("px", ""); var docht = $(".TabbedPanelsContent").css('height'); docht = docht.replace("px", ""); } else $(".DriverReviewloader").css("display", "none"); $(".DriverReviews").fadeIn("slow"); } }); } function ViewDriverReviewClose() { $(".DriverReviews").fadeOut("fast"); } </script> <script type="text/javascript"> // code for order submit on enter key press $('#trPromo').keypress(function (e) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (e.keyCode == '13') { if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} e.preventDefault(); e.stopPropagation(); } }); // Code for payment selections var radiocheck = 0; function UDSelection() { $('.paypalmsg').fadeOut("slow"); $('.debitpnl').fadeOut("slow"); $('.CardConnectform').fadeOut("slow"); $("#CloverPanel").css("display", "none"); $("#SquarePanel").css("display", "none"); $(".BillingText").text("Is Billing Address same as Delivery Address?"); if ($('#Instamojo1').is(':checked')) { $('.errormsg').text(""); document.getElementById("Paytype").innerHTML = "Instamojo"; $('.paypalmsg').fadeIn("slow"); } else if ($('#fdButtonpay').is(':checked')) { $('.errormsg').text(""); if (document.getElementById("lblPaymentType").innerHTML == "clover") { document.getElementById("Paytype").innerHTML = "CreditCard"; $('.debitpnl').fadeIn("slow"); } else { document.getElementById("Paytype").innerHTML = "CreditCard"; $('.debitpnl').fadeIn("slow"); } } else if ($('#btndeiverymunchies1').is(':checked')) { $('.errormsg').text(""); if (document.getElementById('lblLoyaltyText').innerText == "Pay with Munchies") document.getElementById("Paytype").innerHTML = "PaywithMunchies"; else document.getElementById("Paytype").innerHTML = "PaywithPoints"; } else if ($('#btnUDSquare').is(':checked')) { // paymentFormGuestDelivery.build(); $('.errormsg').text(""); document.getElementById("Paytype").innerHTML = "SquareCreditCard"; $("#SquarePanel").css("display", "block"); } else if ($('#btndeliveryromotions1').is(':checked')) { $('.errormsg').text(""); var total = document.getElementById("lbltotalamount").innerHTML total = total.replace(document.getElementById("lblCurrency").innerHTML, ""); if (total == "0.00") document.getElementById("Paytype").innerHTML = "Promotion"; else { $("#lblorderror").text("Sorry using Promotions you can place orders only if total amount is 0 "); $(".ordererror").show().delay(3000).fadeOut(); } } else if ($('#bntConfOrder1').is(':checked')) { $('.errormsg').text(""); document.getElementById("Paytype").innerHTML = "Cash"; } else if ($('#mbntConfOrder1').is(':checked')) { $('.errormsg').text(""); var txtCustomizedcash= $(".CODtext1").text(); document.getElementById("Paytype").innerHTML = "Cash"; document.getElementById("txtCustomizedcash").innerHTML = txtCustomizedcash; } CheckCardCanvienceFee(); var LOrderType = localStorage.getItem("OrderType"); if (LOrderType != "Shipping" && LOrderType != "Delivery") { document.getElementById("chkcard").checked = true; document.getElementById("Chkyeschk").checked = false; $(".Billingaddress").fadeIn("slow"); $(".billing").fadeOut("slow"); } else { $(".billing").fadeIn("slow"); $(".Billingaddress").fadeOut("slow"); document.getElementById("chkcard").checked = false; document.getElementById("Chkyeschk").checked = true; } var UId = document.getElementById("UserId").innerHTML; if (UId != "") { document.getElementById("txtcardname").value = document.getElementById("FirstName").innerHTML; document.getElementById("txtClastname").value = document.getElementById("LastName").innerHTML; } } function CheckCardCanvienceFee() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var cardconviencefee = document.getElementById("lblcardconviencefee").innerHTML; var conviencefee = document.getElementById("lblbconvenience1").innerHTML; conviencefee = conviencefee.replace(document.getElementById("lblCurrency").innerHTML, ""); var PayType = document.getElementById("Paytype").innerHTML; if (PayType == "Cash") { if (radiocheck == 0) { if (cardconviencefee == "true" || cardconviencefee == "True") { radiocheck = 1; $(".CVFexist").fadeOut("fast") var total = document.getElementById("lblTotaldelivery").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); total = total - conviencefee; document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + total.toFixed(2); document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + total.toFixed(2); } } } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); radiocheck = 0; } else{GetDeal();radiocheck = 0; } } } function CardCanvienceFee() { var cardconviencefee = document.getElementById("lblcardconviencefee").innerHTML; var conviencefee = document.getElementById("lblbconvenience1").innerHTML; conviencefee = conviencefee.replace(document.getElementById("lblCurrency").innerHTML, ""); var PayType = document.getElementById("Paytype").innerHTML; if (PayType == "Cash") { if (cardconviencefee == "true" || cardconviencefee == "True") { $(".CVFexist").fadeOut("fast") var total = document.getElementById("lblTotaldelivery").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); total = total - conviencefee; document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + total.toFixed(2); document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + total.toFixed(2); } } } function userdeliveryvalidation() { $(".placeorderbtndiv").css("display", "none"); $(".placeorderloaderdiv").css("display", "inline-block"); $('.errormsg').text(""); var UrlType = document.getElementById('lblurlnametype').innerHTML; var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; var EmailId, Name, PhoneNumber,lblRequiredEmail,lblRequiredPhone,lblRequiredName,lblRequiredLName,lblRequiredTableNo,TableNo; EmailId = document.getElementById("txtguestdeliveryemail").value; Name = document.getElementById("txtguestdeliveryname").value; PhoneNumber = document.getElementById('txtmobilenumber').value; lblRequiredEmail = document.getElementById('lblRequiredEmail').innerHTML; lblRequiredPhone = document.getElementById('lblRequiredPhone').innerHTML; lblRequiredName = document.getElementById('lblRequiredName').innerHTML; lblRequiredLName = document.getElementById('lblRequiredLName').innerHTML; lblRequiredTableNo = document.getElementById('lblRequiredTableNo').innerHTML; TableNo = document.getElementById('dineintableid').value; var nameexp = /^[a-zA-Z ]*$/; var emailExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i; var i = 0; if (UrlType == "DineIn" && OrderType == "DineIn") { if (lblRequiredName == "Required" || lblRequiredLName == "Required") { if (Name != '') { $("#txtguestdeliveryname").removeClass("reqruiredc"); } else if (!Name.match(nameexp)) { $("#txtguestdeliveryname").focus(); i++; } else { $("#txtguestdeliveryname").focus(); $("#txtguestdeliveryname").addClass("reqruiredc"); i++; } } //if (lblRequiredLName == "Required") { // if (Name != '') { // $("#txtguestdeliveryname").removeClass("reqruiredc"); // } // else if (!Name.match(nameexp)) { // $("#txtguestdeliveryname").focus(); // i++; // } // else { // $("#txtguestdeliveryname").focus(); // $("#txtguestdeliveryname").addClass("reqruiredc"); // i++; // } //} if (lblRequiredPhone == "Required") { if (PhoneNumber != '') { $("#txtmobilenumber").removeClass("reqruiredc"); if (PhoneNumber.length != 10) { $("#txtmobilenumber").focus(); $('.errormsg').text("Enter Valid Phone Number."); i++; } } else { $("#txtmobilenumber").focus(); $("#txtmobilenumber").addClass("reqruiredc"); i++; } } if (lblRequiredEmail == "Required") { if (EmailId != '') { $("#txtguestdeliveryemail").removeClass("reqruiredc"); if (!EmailId.match(emailExp)) { $("#txtguestdeliveryemail").focus(); $('.errormsg').text("Enter Valid Email."); i++; } } else { $("#txtguestdeliveryemail").focus(); $("#txtguestdeliveryemail").addClass("reqruiredc"); i++; } } if (lblRequiredTableNo == "Required") { if (TableNo == "") { $("#dineintableid").focus(); $("#dineintableid").addClass("reqruiredc"); i++; } else { $("#dineintableid").removeClass("reqruiredc"); } } if (i == 0) { var numOfVisibleRows = $('.rcount').filter(function () { return $(this).css('display') !== 'none'; }).length; if (lblRequiredEmail == "Optional" || lblRequiredPhone == "Optional" || lblRequiredName == "Optional" || lblRequiredLName == "Optional" || lblRequiredTableNo == "Optional") { if (Name != "" || PhoneNumber != "" || EmailId != "" || TableNo != "") { } else{ if (numOfVisibleRows == "1") { if($("#txtmobilenumber").css('display') != "none") { if (PhoneNumber != '') { $("#txtmobilenumber").removeClass("reqruiredc"); if (PhoneNumber.length != 10) { $("#txtmobilenumber").focus(); $('.errormsg').text("Enter Valid Phone Number."); i++; } } else { $("#txtmobilenumber").focus(); $("#txtmobilenumber").addClass("reqruiredc"); i++; } } else if ($("#txtguestdeliveryemail").css('display') != "none") { if (EmailId != '') { $("#txtguestdeliveryemail").removeClass("reqruiredc"); if (!EmailId.match(emailExp)) { $("#txtguestdeliveryemail").focus(); $('.errormsg').text("Enter Valid Email."); i++; } } else { $("#txtguestdeliveryemail").focus(); $("#txtguestdeliveryemail").addClass("reqruiredc"); i++; } }else if ($("#txtguestdeliveryname").css('display') != "none") { if (Name != '') { $("#txtguestdeliveryname").removeClass("reqruiredc"); } else if (!Name.match(nameexp)) { $("#txtguestdeliveryname").focus(); i++; } else { $("#txtguestdeliveryname").focus(); $("#txtguestdeliveryname").addClass("reqruiredc"); i++; } } else if ($("#dineintableid").css('display') != "none") { if (TableNo == "") { $("#dineintableid").focus(); $("#dineintableid").addClass("reqruiredc"); i++; } else { $("#dineintableid").removeClass("reqruiredc"); } } } if (Name != '') { $("#txtguestdeliveryname").removeClass("reqruiredc"); if (!Name.match(nameexp)) { $("#txtguestdeliveryname").focus(); i++; } } if (PhoneNumber != '') { $("#txtmobilenumber").removeClass("reqruiredc"); if (PhoneNumber.length != 10) { $("#txtmobilenumber").focus(); $('.errormsg').text("Enter Valid Phone Number."); i++; } } if (EmailId != '') { $("#txtguestdeliveryemail").removeClass("reqruiredc"); if (!EmailId.match(emailExp)) { $("#txtguestdeliveryemail").focus(); $('.errormsg').text("Enter Valid Email."); i++; } } } } } }else{ if (EmailId == '' && Name == '' && PhoneNumber == '') { $("#txtmobilenumber").addClass("reqruiredc"); $("#txtguestdeliveryemail").addClass("reqruiredc"); $("#txtguestdeliveryname").addClass("reqruiredc"); i++; } else { if (PhoneNumber != '') { $("#txtmobilenumber").removeClass("reqruiredc"); if (PhoneNumber.length != 10) { $("#txtmobilenumber").focus(); $('.errormsg').text("Enter Valid Phone Number."); i++; } } else { $("#txtmobilenumber").focus(); $("#txtmobilenumber").addClass("reqruiredc"); i++; } if (EmailId != '') { $("#txtguestdeliveryemail").removeClass("reqruiredc"); if (!EmailId.match(emailExp)) { $("#txtguestdeliveryemail").focus(); $('.errormsg').text("Enter Valid Email."); i++; } } else { $("#txtguestdeliveryemail").focus(); $("#txtguestdeliveryemail").addClass("reqruiredc"); i++; } if (Name != '') { $("#txtguestdeliveryname").removeClass("reqruiredc"); } else if (!Name.match(nameexp)) { $("#txtguestdeliveryname").focus(); i++; } else { $("#txtguestdeliveryname").focus(); $("#txtguestdeliveryname").addClass("reqruiredc"); i++; } } } // $('.placeorder').css("display", "block"); if (i == 0) { userdeliveryaddressvalidation(); } else { $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } } // Code for validations function userdeliveryaddressvalidation() { $('.errormsg').text(""); if (document.getElementById("Paytype").innerHTML != " " && document.getElementById("Paytype").innerHTML != "") { if (document.getElementById("Paytype").innerHTML == "PaywithMunchies" || document.getElementById("Paytype").innerHTML == "PaywithPoints") { var Totalprice = document.getElementById("lblTotaldelivery").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); var Worth = localStorage.getItem("PointsWorth"); if(Worth=="Dollar") Totalprice = parseFloat(Totalprice); else Totalprice = parseFloat(Totalprice) * 100; var Awards = document.getElementById("lblpoinsyoucanyern").innerHTML; if (parseFloat(Totalprice) > parseFloat(Awards)) { var expectedmunchies = parseFloat(Totalprice) - parseFloat(Awards); expectedmunchies = Math.round(expectedmunchies); $("#lblorderror").text("Sorry.. You need " + expectedmunchies + " more " + document.getElementById("lblAwardType").innerHTML + " to place this order"); $(".ordererror").show().delay(3000).fadeOut(); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } $('.placeorder').css("display", "none"); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { InsertOrderValidationinGroupOrder(document.getElementById('txtguestdeliveryemail'), document.getElementById('txtguestdeliveryname'), document.getElementById('txtmobilenumber'), document.getElementById('txtdeliverydate'), document.getElementById("ddlhr"), document.getElementById("txtcardname"), document.getElementById("txtcardno"), document.getElementById("ddlBindMonth"), document.getElementById("ddlBindYear"), document.getElementById("instructions"), document.getElementById("txtCVV"), document.getElementById("txtBZC"), document.getElementById("chkDguest"), document.getElementById("txtDGName"), document.getElementById("txtDGEmail"), document.getElementById("txtDGPhno"), document.getElementById("txtcLine1")); } else { InsertOrderValidation(document.getElementById('txtguestdeliveryemail'), document.getElementById('txtguestdeliveryname'), document.getElementById('txtmobilenumber'), document.getElementById('txtdeliverydate'), document.getElementById("ddlhr"), document.getElementById("txtcardname"), document.getElementById("txtcardno"), document.getElementById("ddlBindMonth"), document.getElementById("ddlBindYear"), document.getElementById("instructions"), document.getElementById("txtCVV"), document.getElementById("txtBZC"), document.getElementById("chkDguest"), document.getElementById("txtDGName"), document.getElementById("txtDGEmail"), document.getElementById("txtDGPhno"), document.getElementById("txtcLine1")); } } else { $('.errormsg').text("Please select payment type."); var container = document.querySelector(".yurcrt"); if (container) { container.scrollTop = container.scrollHeight; } $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } } function uncheckpaymentselection() { $('.paypalmsg').fadeOut("slow"); $(".debitpnl").fadeOut("slow"); $(".debitpnl").css("display", "none"); var all = document.getElementsByTagName("input"); for (i = 0; i < all.length; i++) { if (all[i].type == "radio") { var count = all[i].name.match("userpickcash"); if (count != null) { if (count.length > 0) { if (all[i].checked == true) { all[i].checked = false; } } } } } document.getElementById("Paytype").innerHTML = ""; $("#txtcardname").removeClass("reqruiredc"); $("#txtcardno").removeClass("reqruiredc"); $("#txtBZC").removeClass("reqruiredc"); $("#txtCVV").removeClass("reqruiredc"); $('.errormsg ').text(""); $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage2").css("display", "none"); } function OpeningOrderSubmitionPnl() { var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; var PaymentType = document.getElementById("Paytype").innerHTML if (PaymentType == "CreditCard") { $('.debitpnl').fadeIn("slow"); } else { $('.debitpnl').fadeOut("slow"); } var UId = document.getElementById("UserId").innerHTML; if (UId != "") { if (OrderTypevalue != "Shipping") { var paywithloyality = document.getElementById('lblLoyaltyText').innerText; if (paywithloyality != "") { $('#btndeiverymunchies').fadeIn("slow"); } else { $('#btndeiverymunchies').fadeOut("slow"); } } } ////if (document.getElementById("lbldelivaryfee").innerHTML == "₹0.00" || document.getElementById("lbldelivaryfee").innerHTML == "$0.00") { // $('.Chtext').css("display", "none"); // $('#lbluserdelivery').css("display", "none"); //} //else { $('.Chtext').css("display", "block"); $('#lbluserdelivery').css("display", "block"); //} document.getElementById("lblsubtotaldelivery").innerHTML = document.getElementById("lblAlltotalprice").innerHTML; document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lbltaxConven").innerHTML; document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lbldelivaryfee").innerHTML; document.getElementById("lblUserMileageCharge").innerHTML = document.getElementById("lblMileageCharge").innerHTML; $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage2").css("display", "none"); $(".notefordelivery").css("display", "none"); // $('.justtip').css("display", "none"); $(".vehicledetlsdiv").css("display","none"); $("#divvehicledtls").css("display","none"); document.getElementById('lblVehicleDetails').innerHTML = "false"; if (document.getElementById("lblPickupname").innerHTML.replace("&", "&") == OrderTypevalue || OrderTypevalue != OrderType) { if (document.getElementById("lblPickupname").innerHTML.replace("&", "&") == OrderTypevalue){ if (UId != "") { GetAllFeatures(); GetVehicleDetails(); } } $("#instructions").attr("placeholder", "Order Instructions") $(".notefordelivery").css("display", "none"); $(".lbluserdelivery").fadeOut("slow"); $(".deliveryHeading").text(OrderType + " Order Submission"); $(".DeliveryType").fadeOut("fast"); if (document.getElementById("UserId").innerHTML != "") $(".GuestPart").fadeOut("fast"); else $(".GuestPart").fadeIn("fast"); } if (document.getElementById("lblDineInname").innerHTML.replace("&", "&") == OrderTypevalue || OrderTypevalue != OrderType) { $("#instructions").attr("placeholder", "Order Instructions") $(".notefordelivery").css("display", "none"); $(".lbluserdelivery").fadeOut("slow"); $(".deliveryHeading").text(OrderType + " Order Submission"); $(".DeliveryType").fadeOut("fast"); if (document.getElementById("UserId").innerHTML != "") $(".GuestPart").fadeOut("fast"); else $(".GuestPart").fadeIn("fast"); } else if (OrderTypevalue == "Shipping" || OrderTypevalue == "Delivery") { var ins = "Order Instructions \n (Hotel Name, Building Number, Etc.)"; $("#instructions").attr("placeholder", ins) //if (document.getElementById("lbldelivaryfee").innerHTML == "₹0.00" || document.getElementById("lbldelivaryfee").innerHTML == "$0.00") { // $(".lbluserdelivery").fadeOut("slow"); //} //else { $(".lbluserdelivery").fadeIn("slow"); //} $('.tipEnable').css("display", "none"); if (OrderTypevalue == "Shipping") { $(".deliveryHeading").text("Shipping Order Submission"); } else $(".deliveryHeading").text("Delivery Order Submission"); $(".DeliveryType").fadeIn("fast"); if (document.getElementById("UserId").innerHTML != "") $(".GuestPart").fadeOut("fast"); else $(".GuestPart").fadeIn("fast"); } if (OrderTypevalue == "Shipping") { $('.btnpaywithmunchies').css("display", "none"); } $(".UserDeliveryAdjustPanel").css("margin-top", $(document).scrollTop() - 50); //var AvailableDays = ""; //var Ordersupto; //if (OrderTypevalue.toLowerCase() == "pick up") // AvailableDays = $("#pickupdays").text(); //else if (OrderTypevalue.toLowerCase() == "delivery") // AvailableDays = $("#deliverydays").text(); //ordersupto = $("#ordersupto").text(); //disableMonday = function (date) { // var day = date.getDay(); // AvailableDays = AvailableDays.replace("Sun", "0").replace("Mon", "1").replace("Tue", "2").replace("Wed", "3").replace("Thu", "4").replace("Fri", "5").replace("Sat", "6"); // if (AvailableDays.indexOf(day) != -1) { // return [true]; // } // else { // return [false]; // } //} //$('.datepicker').datepicker("destroy"); //if (AvailableDays != ""&&AvailableDays != null&&AvailableDays != 'null') { // if (ordersupto != "") { // if (ordersupto.indexOf("Days") != -1) // jQuery(function ($) { $(".datepicker").datepicker({ minDate: 0, maxDate: "+0M +" + ordersupto.split(' ')[0] + "D", beforeShowDay: disableMonday }); }); // else if (ordersupto.indexOf("Months") != -1) // jQuery(function ($) { $(".datepicker").datepicker({ minDate: 0, maxDate: "+" + ordersupto.split(' ')[0] + "M +0D", beforeShowDay: disableMonday }); }); // else if (ordersupto.indexOf("Hours") != -1) // jQuery(function ($) { $(".datepicker").datepicker({ minDate: 0, maxDate: "+0M +1D", beforeShowDay: disableMonday }); }); // else // $(".datepicker").datepicker({ minDate: 0, maxDate: "+2M +15D", beforeShowDay: disableMonday }); // } // else // $(".datepicker").datepicker({ minDate: 0, maxDate: "+2M +15D", beforeShowDay: disableMonday }); //} //else // $(".datepicker").datepicker({ minDate: 0, maxDate: "+2M +15D" }); if (window.innerWidth > 767) { if ($("#lblMenuTheme").val() == "Grid" || $("#lblMenuTheme").val() == "Grid-no-images" || $("#lblMenuTheme").val() == "New-Grid" || $("#lblMenuTheme").val() == "New-Grid-no-images") { CloseCart(); } else { $(".scrollcart").css("display", "block"); } } $(".UserDeliveryPanel").fadeIn("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } function InsertOrderValidation(Emailele, Nameele, Phoneele, dateele, timeele, cardele, cardnoele, ExyMonth, ExyYear, Note, Cardcvv, BZCele, CLine1ele) { var nameexp = /^[a-zA-Z ]*$/; var count = 0; var emailExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i; var EmailId = Emailele.value; var FirstName = Nameele.value; var phone = Phoneele.value; var deliverdate = dateele.value; var CardName = cardele.value.trim(); var CardNo = cardnoele.value; var DeliveryTime = ""; var CVV = Cardcvv.value; var time = timeele; var displaytimedropdown = document.getElementById("lblDisplayTimeSelection").innerHTML; var CCity, CState, CZip, CLine1, CLine2; CLine1 = document.getElementById("txtcLine1").value; CLine2 = document.getElementById("txtcline2").value; CState = document.getElementById("txtCState").value; CCity = document.getElementById("txtcCity").value; var TableId = document.getElementById("dineintableid").value.trim(); CZip = BZCele.value; var CLastName = document.getElementById("txtClastname").value; if (displaytimedropdown == "false") { DeliveryTime = "12:00 AM"; } else{ if (time.selectedIndex != "-1") DeliveryTime = time.options[time.selectedIndex].text; else DeliveryTime = ""; } var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; // if (OrderType == "DineIn") { // if (TableId == '') { // $("#dineintableid").addClass("reqruiredc"); // $('.placeorder').css("display", "inline-table"); // $(".placeorderloaderdiv").delay(3000).fadeOut(); // $(".placeorderbtndiv").delay(3000).fadeIn(); // return; // } // else { // $("#dineintableid").removeClass("reqruiredc"); // } //} if (OrderTypevalue == "Delivery" || OrderTypevalue == "Shipping") { var city, state, zip, Line1; Line1 = document.getElementById('txtline1'); city = document.getElementById('txtcity'); state = document.getElementById('txtstate'); zip = document.getElementById('txtZip'); if (city.value != '' && state.value != '' && Line1.value != '') { count++; $(city).removeClass("reqruiredc"); $(state).removeClass("reqruiredc"); $(Line1).removeClass("reqruiredc"); } else if (city.value != '' && state.value != '' && zip.value != '' && Line1.value == '') { $(Line1).focus(); $(city).removeClass("reqruiredc"); $(state).removeClass("reqruiredc"); $(zip).removeClass("reqruiredc"); $(Line1).addClass("reqruiredc"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } else if (city.value != '' && state.value != '' && zip.value == '' && Line1.value == '') { $(Line1).focus(); $(city).removeClass("reqruiredc"); $(state).removeClass("reqruiredc"); $(Line1).addClass("reqruiredc"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } else if (city.value != '' && state.value == '' && zip.value == '' && Line1.value == '') { $(Line1).focus(); $(city).removeClass("reqruiredc"); $(state).addClass("reqruiredc"); $(Line1).addClass("reqruiredc"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } else if (city.value == '' && state.value == '' && zip.value == '' && Line1.value == '') { $(Line1).focus(); $(city).addClass("reqruiredc"); $(state).addClass("reqruiredc"); $(Line1).addClass("reqruiredc"); } else if (city.value != '' && state.value != '' && zip.value == '' && Line1.value != '') { $(city).removeClass("reqruiredc"); $(state).removeClass("reqruiredc"); $(Line1).removeClass("reqruiredc"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } else if (city.value != '' && state.value == '' && zip.value == '' && Line1.value != '') { $(city).removeClass("reqruiredc"); $(state).addClass("reqruiredc"); $(Line1).removeClass("reqruiredc"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } else if (city.value == '' && state.value == '' && zip.value == '' && Line1.value != '') { $(city).addClass("reqruiredc"); $(state).addClass("reqruiredc"); $(Line1).removeClass("reqruiredc"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } } if (document.getElementById("CCBaseURL").innerHTML != "" && document.getElementById("Paytype").innerHTML == "CreditCard") { if (token.length < 60) { var msg = token; var M = JSON.parse(msg); if (M.message == "") { $('.errormsg').text(M.validationError); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else CardNo = M.message; CVV = "1111" document.getElementById('mytoken').value = M.message; } else { $('.errormsg').text("Invalid card details"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } if (document.getElementById("Paytype").innerHTML == "CreditCard") { if (CardName != '' && CardNo != '' && CLastName != '' && CVV != '') { if (!CardName.match(nameexp) || !CLastName.match(nameexp)) { $(cardele).removeClass("reqruiredc"); $(cardnoele).removeClass("reqruiredc"); $('.errormsg').text("Enter valid Card Holder Name"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } if (CVV.length >= 3 && CardName.match(nameexp) && CLastName.match(nameexp) && CardNo.length >= 10) { $(Cardcvv).removeClass("reqruiredc"); var CurrDate = new Date(); var D = new Date(ExyYear.options[ExyYear.selectedIndex].text, ExyMonth.options[ExyMonth.selectedIndex].text,0 , 23, 59, 59); if (CurrDate > D) { $('.errormsg').text("Enter valid expiry date"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { if (document.getElementById("chkcard").checked == true || (OrderTypevalue != "Delivery" && OrderTypevalue != "Shipping")) { if (CZip != '') { if (CZip.length >= 5) { count++; } else { $('.errormsg').text("Billing Zip Code must be 5-6 digits."); $(BZCele).focus(); $(BZCele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } else { if (CZip == '') { $(BZCele).focus(); $(BZCele).addClass("reqruiredc"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); $('.placeorder').css("display", "inline-table"); return; } else { $(BZCele).removeClass("reqruiredc"); } if($('#txtCState').css('display') != 'none'){ if (CState == '') { $("#txtCState").focus(); $("#txtCState").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtCState").removeClass("reqruiredc"); } } if($('#txtcCity').css('display') != 'none'){ if (CCity == '') { $("#txtcCity").focus(); $("#txtcCity").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcCity").removeClass("reqruiredc"); } } if($('#txtcLine1').css('display') != 'none'){ if (CLine1 == '') { $("#txtcLine1").focus(); $("#txtcLine1").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcLine1").removeClass("reqruiredc"); } } } if($('#txtCState').css('display') != 'none'){ if (CState == '') { $("#txtCState").focus(); $("#txtCState").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtCState").removeClass("reqruiredc"); } } if($('#txtcCity').css('display') != 'none'){ if (CCity == '') { $("#txtcCity").focus(); $("#txtcCity").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcCity").removeClass("reqruiredc"); } } if($('#txtcLine1').css('display') != 'none'){ if (CLine1 == '') { $("#txtcLine1").focus(); $("#txtcLine1").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcLine1").removeClass("reqruiredc"); } } } else { count++; } } } else { if (CardNo.length < 10) { $('.errormsg').text("Check card number"); $(CardNo).focus(); $(CardNo).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $('.errormsg').text("Security Code must be 3-4 digits."); $(Cardcvv).focus(); $(Cardcvv).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } } else { if (document.getElementById("chkcard").checked == true) { if (CZip != '') { if (CZip.length >= 5) { } else { $('.errormsg').text("Billing Zip Code must be 5-6 digits."); $(BZCele).focus(); $(BZCele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } else { if (CZip == '') { $(BZCele).focus(); $(BZCele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $(BZCele).removeClass("reqruiredc"); } if($('#txtCState').css('display') != 'none'){ if (CState == '') { $("#txtCState").focus(); $("#txtCState").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtCState").removeClass("reqruiredc"); } } if($('#txtcCity').css('display') != 'none'){ if (CCity == '') { $("#txtcCity").focus(); $("#txtcCity").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcCity").removeClass("reqruiredc"); } } if($('#txtcLine1').css('display') != 'none'){ if (CLine1 == '') { $("#txtcLine1").focus(); $("#txtcLine1").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcLine1").removeClass("reqruiredc"); } } } if($('#txtCState').css('display') != 'none'){ if (CState == '') { $("#txtCState").focus(); $("#txtCState").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtCState").removeClass("reqruiredc"); } } if($('#txtcCity').css('display') != 'none'){ if (CCity == '') { $("#txtcCity").focus(); $("#txtcCity").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcCity").removeClass("reqruiredc"); } } if($('#txtcLine1').css('display') != 'none'){ if (CLine1 == '') { $("#txtcLine1").focus(); $("#txtcLine1").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcLine1").removeClass("reqruiredc"); } } } else { $("#txtcline2").removeClass("reqruiredc"); $("#txtcLine1").removeClass("reqruiredc"); $("#txtcCity").removeClass("reqruiredc"); $("#txtCState").removeClass("reqruiredc"); $(BZCele).removeClass("reqruiredc"); } if (CVV != '') { $(Cardcvv).removeClass("reqruiredc"); } else { $(Cardcvv).focus(); $(Cardcvv).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } if (CardNo != '') { $(cardnoele).removeClass("reqruiredc"); } else { $(cardnoele).focus(); $(cardnoele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } if (CLastName != '') { $("#txtClastname").removeClass("reqruiredc"); if (!CLastName.match(nameexp)) { $("#txtClastname").focus(); $('.errormsg').text("Enter valid Card Holder Name"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } } else { $("#txtClastname").focus(); $("#txtClastname").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } if (CardName != '') { $(cardele).removeClass("reqruiredc"); if (!CardName.match(nameexp)) { $(cardele).focus(); $('.errormsg').text("Enter valid Card Holder Name"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } } else { $(cardele).focus(); $(cardele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } } else { $(cardele).removeClass("reqruiredc"); $(cardnoele).removeClass("reqruiredc"); $(Cardcvv).removeClass("reqruiredc"); $(BZCele).removeClass("reqruiredc"); } if (Note.value != "") { if (Note.value.length > 490) { $('.errormsg').text("Order instructions should be less than 500 characters."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } if (document.getElementById("lblPickupname").innerHTML.replace("&", "&") == OrderTypevalue) { if (document.getElementById("lblVehicleDetails").innerHTML == "true") { var ddlvehicledetails = document.getElementById("ddlVehicleDetails"); var vehicledetails = ddlvehicledetails.options[ddlvehicledetails.selectedIndex].value; if (vehicledetails == "--Select Vehicle Details--") { $('.errormsg').text("Please select vehicle details"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } } var checkinInfo = "",CheckInlbl = ""; if (OrderType == "CurbSide") { if (document.getElementById("lblbeforeorderafterorder").innerHTML == "true") { checkinInfo = document.getElementById("txtcustomerinfo").value.trim(); CheckInlbl = document.getElementById("lblcustomerinfo").innerHTML; //if (checkinInfo == "") { // $('.errormsg').text("Please enter " + $("#lblcustomerinfo").text()); // $("#txtcustomerinfo").addClass("reqruiredc"); // return; //} } } var AdvancedLabel = document.getElementById("txtAdvancedlbl").value; if (document.getElementById("lblindication").innerHTML == "TextBox to Enter Customer Location" || document.getElementById("lblindication").innerHTML == "CustomerOrderDetails") AdvancedLabel = document.getElementById("txtCustomerOrderDe").value.trim(); var screenAdvancedLabel = document.getElementById("screentxtAdvancedlbl").value; if (document.getElementById("screenlblindication").innerHTML == "TextBox to Enter Customer Location" || document.getElementById("screenlblindication").innerHTML == "CustomerOrderDetails") screenAdvancedLabel = document.getElementById("screentxtCustomerOrderDe").value.trim(); if (OrderType == "DineIn") { var p = 0; if (DeliveryTime != '') { } else { p++; } if (p == 0) { $(Emailele).removeClass("reqruiredc"); $(Nameele).removeClass("reqruiredc"); $(Phoneele).removeClass("reqruiredc"); $(dateele).removeClass("reqruiredc"); $(timeele).removeClass("reqruiredc"); if(EmailId != "" && phone != ""){ if (EmailId.match(emailExp) && phone.length == 10) { $.ajax({ type: "POST", url: "orders.aspx/CheckMunchemAccount", data: "{'Email':'" + EmailId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var UId = document.getElementById("UserId").innerHTML; if (UId == "") { if (msg.d != "UNRegistered User") { alertify.set({ labels: { cancel: "Cancel", ok: "Ok" } }); alertify.confirm("There is already munchem account with this email. Do you want to Proceed as Guest", function (e) { if (e) { count++; OrderSuccessCount(count, OrderTypevalue); } else { $('.placeorder').fadeIn("slow"); $(".placeorderloaderdiv").fadeOut(); $(".placeorderbtndiv").delay(300).fadeIn(); $('.userdeliveryloader').css("display", "none"); return; } }); } else { count++; OrderSuccessCount(count, OrderTypevalue); } } else { count++; OrderSuccessCount(count, OrderTypevalue); } } }); // } } else if (!EmailId.match(emailExp) && phone.length < 10) { $(Emailele).focus(); $('.errormsg').text("Enter Valid Email and Phone Number."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else if (!EmailId.match(emailExp) && phone.length == 10) { $(Emailele).focus(); $('.errormsg').text("Enter Valid Email."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else if (EmailId.match(emailExp) && phone.length < 10) { $(Phoneele).focus(); $('.errormsg').text("Enter Valid Phone Number."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else if (phone.length != 10) { $(Phoneele).focus(); $('.errormsg').text("Enter Valid Phone Number."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } else { count++; OrderSuccessCount(count, OrderTypevalue); } } else { $('.errormsg').text("Select Time."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } }else{ if (FirstName != '' && EmailId != '' && phone != '' && deliverdate != '') { var p = 0; if (OrderTypevalue == "Shipping") { } else { if (DeliveryTime != '') { } else { p++; } } if (document.getElementById("AdvancedOption").innerHTML == "true" && OrderTypevalue != OrderType) { if (OrderType == "CurbSide") { if (document.getElementById("lblbeforeorderafterorder").innerHTML == "true") { //checkinInfo = document.getElementById("txtcustomerinfo").value.trim(); //CheckInlbl = document.getElementById("lblcustomerinfo").innerHTML; if (checkinInfo == "") { p++; $('.errormsg').text("Please enter " + $("#lblcustomerinfo").text()); $("#txtcustomerinfo").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcustomerinfo").removeClass("reqruiredc"); } } } var G1 = document.getElementById("ddldropdownoptions"); if (G1.selectedIndex != "-1") AdvancedLabel = G1.options[G1.selectedIndex].value if (AdvancedLabel == "" || AdvancedLabel == "0") { p++; if (document.getElementById("lblindication").innerHTML == "Textbox") { $('.errormsg').text("Please enter " + $("#lblpickuptext").text()); $("#txtAdvancedlbl").addClass("reqruiredc"); } else if (document.getElementById("lblindication").innerHTML == "Dropdown") { $('.errormsg').text("Please select " + $("#lblpickuptext").text()); $("#ddldropdownoptions").addClass("reqruiredc"); } else { $('.errormsg').text("Please enter " + $("#lblpickuptext").text()); $("#txtCustomerOrderDe").addClass("reqruiredc"); } $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { if (document.getElementById("lblindication").innerHTML == "Textbox") { var TextboxRangeFrom = $("#txtRangeFrom").text(); var TextboxRangeTo = $("#txtRangeTo").text(); if (parseInt(TextboxRangeFrom) <= parseInt(AdvancedLabel) && parseInt(TextboxRangeTo) >= parseInt(AdvancedLabel)) { } else { var pickuplbl = $("#lblpickuptext").text(); $('.errormsg').text("Please enter " + pickuplbl + " between " + parseInt(TextboxRangeFrom) + " and " + parseInt(TextboxRangeTo)); $("#txtAdvancedlbl").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } $("#ddldropdownoptions").removeClass("reqruiredc"); $("#txtAdvancedlbl").removeClass("reqruiredc"); $("#txtCustomerOrderDe").removeClass("reqruiredc"); } //Theaters screen if (OrderType == "Theater Seat"){ var G2 = document.getElementById("screenddldropdownoptions"); if (G2.selectedIndex != "-1") screenAdvancedLabel = G2.options[G2.selectedIndex].value if (screenAdvancedLabel == "" || screenAdvancedLabel == "0") { p++; if (document.getElementById("screenlblindication").innerHTML == "Textbox") { $('.errormsg').text("Please enter " + $("#screenlblpickuptext").text()); $("#screentxtAdvancedlbl").addClass("reqruiredc"); } else if (document.getElementById("screenlblindication").innerHTML == "Dropdown") { $('.errormsg').text("Please select " + $("#screenlblpickuptext").text()); $("#screenddldropdownoptions").addClass("reqruiredc"); } else { $('.errormsg').text("Please enter " + $("#screenlblpickuptext").text()); $("#screentxtCustomerOrderDe").addClass("reqruiredc"); } $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { if (document.getElementById("screenlblindication").innerHTML == "Textbox") { var TextboxRangeFrom = $("#txtRangeFrom").text(); var TextboxRangeTo = $("#txtRangeTo").text(); if (parseInt(TextboxRangeFrom) <= parseInt(screenAdvancedLabel) && parseInt(TextboxRangeTo) >= parseInt(screenAdvancedLabel)) { } else { var pickuplbl = $("#screenlblpickuptext").text(); $('.errormsg').text("Please enter " + pickuplbl + " between " + parseInt(TextboxRangeFrom) + " and " + parseInt(TextboxRangeTo)); $("#screentxtAdvancedlbl").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } $("#screenddldropdownoptions").removeClass("reqruiredc"); $("#screentxtAdvancedlbl").removeClass("reqruiredc"); $("#screentxtCustomerOrderDe").removeClass("reqruiredc"); } } } if (p == 0) { $(Emailele).removeClass("reqruiredc"); $(Nameele).removeClass("reqruiredc"); $(Phoneele).removeClass("reqruiredc"); $(dateele).removeClass("reqruiredc"); $(timeele).removeClass("reqruiredc"); if (EmailId.match(emailExp) && phone.length == 10) { //if (CardName != '' || CardNo != '' || CLastName != '' || CVV != '' || CLine1 != '' || CState != '' || CCity != '' || CZip != '') { $.ajax({ type: "POST", url: "orders.aspx/CheckMunchemAccount", data: "{'Email':'" + EmailId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var UId = document.getElementById("UserId").innerHTML; if (UId == "") { if (msg.d != "UNRegistered User") { alertify.set({ labels: { cancel: "Cancel", ok: "Ok" } }); alertify.confirm("There is already munchem account with this email. Do you want to Proceed as Guest", function (e) { if (e) { count++; OrderSuccessCount(count, OrderTypevalue); } else { $('.placeorder').fadeIn("slow"); $(".placeorderloaderdiv").fadeOut(); $(".placeorderbtndiv").delay(300).fadeIn(); $('.userdeliveryloader').css("display", "none"); return; } }); } else { count++; OrderSuccessCount(count, OrderTypevalue); } } else { count++; OrderSuccessCount(count, OrderTypevalue); } } }); // } } else if (!EmailId.match(emailExp) && phone.length < 10) { $(Emailele).focus(); $('.errormsg').text("Enter Valid Email and Phone Number."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else if (!EmailId.match(emailExp) && phone.length == 10) { $(Emailele).focus(); $('.errormsg').text("Enter Valid Email."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else if (EmailId.match(emailExp) && phone.length < 10) { $(Phoneele).focus(); $('.errormsg').text("Enter Valid Phone Number."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else if (phone.length != 10) { $(Phoneele).focus(); $('.errormsg').text("Enter Valid Phone Number."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } else { $('.errormsg').text("Select Time."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } else { if (document.getElementById("AdvancedOption").innerHTML == "true" && OrderTypevalue != OrderType) { if (OrderType == "CurbSide") { if (document.getElementById("lblbeforeorderafterorder").innerHTML == "true") { //checkinInfo = document.getElementById("txtcustomerinfo").value.trim(); //CheckInlbl = document.getElementById("lblcustomerinfo").innerHTML; if (checkinInfo == "") { $('.errormsg').text("Please enter " + $("#lblcustomerinfo").text()); $("#txtcustomerinfo").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcustomerinfo").removeClass("reqruiredc"); } } } var G1 = document.getElementById("ddldropdownoptions"); if (G1.selectedIndex != "-1") { AdvancedLabel = G1.options[G1.selectedIndex].value } if (AdvancedLabel == "" || AdvancedLabel == "0") { if (document.getElementById("lblindication").innerHTML == "Textbox") { $('.errormsg').text("Please enter " + $("#lblpickuptext").text()); $("#txtAdvancedlbl").addClass("reqruiredc"); } else if (document.getElementById("lblindication").innerHTML == "Dropdown") { $('.errormsg').text("Please select " + $("#lblpickuptext").text()); $("#ddldropdownoptions").addClass("reqruiredc"); } else { $('.errormsg').text("Please enter " + $("#lblpickuptext").text()); $("#txtCustomerOrderDe").addClass("reqruiredc"); } $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { if (document.getElementById("lblindication").innerHTML == "Textbox") { var TextboxRangeFrom = $("#txtRangeFrom").text(); var TextboxRangeTo = $("#txtRangeTo").text(); if (parseInt(TextboxRangeFrom) <= parseInt(AdvancedLabel) && parseInt(TextboxRangeTo) >= parseInt(AdvancedLabel)) { } else { $('.errormsg').text("Please enter " + $("#lblpickuptext").text() + " between " + parseInt(TextboxRangeFrom) + " and " + parseInt(TextboxRangeTo)); $("#txtAdvancedlbl").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } $("#ddldropdownoptions").removeClass("reqruiredc"); $("#txtAdvancedlbl").removeClass("reqruiredc"); $("#txtCustomerOrderDe").removeClass("reqruiredc"); } //Theaters if (OrderType == "Theater Seat") { var G2 = document.getElementById("screenddldropdownoptions"); if (G2.selectedIndex != "-1") { screenAdvancedLabel = G2.options[G2.selectedIndex].value } if (screenAdvancedLabel == "" || screenAdvancedLabel == "0") { if (document.getElementById("screenlblindication").innerHTML == "Textbox") { $('.errormsg').text("Please enter " + $("#screenlblpickuptext").text()); $("#screentxtAdvancedlbl").addClass("reqruiredc"); } else if (document.getElementById("screenlblindication").innerHTML == "Dropdown") { $('.errormsg').text("Please select " + $("#screenlblpickuptext").text()); $("#screenddldropdownoptions").addClass("reqruiredc"); } else { $('.errormsg').text("Please enter " + $("#screenlblpickuptext").text()); $("#screentxtCustomerOrderDe").addClass("reqruiredc"); } $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { if (document.getElementById("screenlblindication").innerHTML == "Textbox") { var TextboxRangeFrom = $("#txtRangeFrom").text(); var TextboxRangeTo = $("#txtRangeTo").text(); if (parseInt(TextboxRangeFrom) <= parseInt(screenAdvancedLabel) && parseInt(TextboxRangeTo) >= parseInt(screenAdvancedLabel)) { } else { $('.errormsg').text("Please enter " + $("#screenlblpickuptext").text() + " between " + parseInt(TextboxRangeFrom) + " and " + parseInt(TextboxRangeTo)); $("#screentxtAdvancedlbl").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } $("#screenddldropdownoptions").removeClass("reqruiredc"); $("#screentxtAdvancedlbl").removeClass("reqruiredc"); $("#screentxtCustomerOrderDe").removeClass("reqruiredc"); } } } if (OrderTypevalue == "Shipping") { } else { if (DeliveryTime != '') { $(timeele).removeClass("reqruiredc"); } else { $(timeele).focus(); $(timeele).addClass("reqruiredc"); } } if (deliverdate != '') { $(dateele).removeClass("reqruiredc"); } else { $(dateele).focus(); $(dateele).addClass("reqruiredc"); } $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } } function OrderSuccessCount(count, OrderTypevalue) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (document.getElementById("Paytype").innerHTML == "CreditCard") { if (OrderTypevalue == "Shipping" || OrderTypevalue == "Delivery") { if (count == 3) { document.getElementById("lblorderfail").innerHTML = "InsertOrder"; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } //CardCanvienceFee(); return; } } else { if (count == 2) { document.getElementById("lblorderfail").innerHTML = "InsertOrder"; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } // CardCanvienceFee(); return; } } } else { if (OrderTypevalue == "Shipping" || OrderTypevalue == "Delivery") { if (count == 2) { if (document.getElementById("Paytype").innerHTML == "SquareCreditCard") { document.getElementById("card-button").click(); } else if (document.getElementById("Paytype").innerHTML == "CloverCreditCard") { CloverFormSubmit(); } else { document.getElementById("lblorderfail").innerHTML = "InsertOrder"; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } //CardCanvienceFee(); return; } } } else { if (count == 1) { if (document.getElementById("Paytype").innerHTML == "SquareCreditCard") { document.getElementById("card-button").click(); } else if (document.getElementById("Paytype").innerHTML == "CloverCreditCard") { CloverFormSubmit(); } else { document.getElementById("lblorderfail").innerHTML = "InsertOrder"; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } //CardCanvienceFee(); return; } //CardCanvienceFee(); } } } return; } function OrderFailed(msg) { alertify.set({ labels: { ok: "Continue", cancel: "Cancel" } }); if (msg.includes("We already see another order with same") == true) { alertify.confirm(msg, function (e) { if (e) { document.getElementById("lbldouplicate").innerHTML = "Duplicate"; InsertOrder(); } else ShowpnlsOrderFailed(""); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); }); } else ShowpnlsOrderFailed(msg); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } function ShowpnlsOrderFailed(msg) { $('.placeorder').fadeIn("slow"); alertify.set({ labels: { cancel: "Cancel", ok: "Ok" } }); document.getElementById("lblorderfail").innerHTML = ""; if (msg != "Please verify your Phone Number from My Account -> My Profile screen to use Points") { if (msg != "") { $("#lblordalert").text(msg); $(".orderalert").fadeIn(); } } // UserMuncheiscount(); $('.userdeliveryloader').css("display", "none"); document.getElementById("lbldouplicate").innerHTML = ""; $('.OrderprocessingPanel').fadeOut("slow"); $('.placeorder').fadeIn("slow"); OpeningOrderSubmitionPnl(); } // code for inserting order function PlaceAnOrder() { try { var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; var UId = document.getElementById("UserId").innerHTML; var UrlType = document.getElementById('lblurlnametype').innerHTML; if ($('#mbntConfOrder1').is(':checked')) { var CustomizedCashAs = document.getElementById('txtCustomizedcash').innerHTML; } else { var CustomizedCashAs = ""; } var DriverId = ""; $('#tblUserDrivers tr').each(function () { if ((this.childNodes[0].childNodes[0].checked == true)) { DriverId = this.id; } }); if (document.getElementById('AdrValue').innerHTML == "NewId") var AddressId = 0; else var AddressId = document.getElementById('AdrValue').innerHTML; var EntityType = OrderType; var CustomOrderTypeId = OrderTypevalue; if (document.getElementById("lblPickupname").innerHTML.replace("&", "&") == OrderTypevalue) EntityType = "PickUp"; if (UrlType == "DineIn") { if (document.getElementById("lblDineInname").innerHTML.replace("&", "&") == OrderTypevalue) EntityType = "DineIn"; } if (EntityType == "Shipping" || EntityType == "Delivery" || document.getElementById("lblPickupname").innerHTML.replace("&", "&") == OrderTypevalue || document.getElementById("lblDineInname").innerHTML.replace("&", "&") == OrderTypevalue) CustomOrderTypeId = ""; var SpType = "Guestsp"; if (UId != "") { var G = document.getElementById("ddlsavedaddress"); if (G != undefined) { if (G.selectedIndex != -1) { // if (EntityType == "Shipping" || EntityType == "Delivery") { var AddressId = G.options[G.selectedIndex].value; if (AddressId != "0") { SpType = "Usersp"; } } } // } } var time = document.getElementById("ddlhr"); if (time.selectedIndex != "-1" || EntityType == "Shipping") { var PointType = document.getElementById("lblAwardType").innerHTML; $('.userdeliveryloader').css("display", "block"); $('.placeorder').css("display", "none"); var GuestTime = ""; var orderesttime = ""; if (time.selectedIndex != "-1") { GuestTime = time.options[time.selectedIndex].text; orderesttime = document.getElementById("lblasaphr").innerHTML; } var displaytimedropdown = document.getElementById("lblDisplayTimeSelection").innerHTML; if (displaytimedropdown == "false") { GuestTime = "12:00 AM"; } var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); var arr = new Array(); if (AddedItems != null) { for (var S = 0; S < AddedItems.length; S++) { arr[S] = { Id: AddedItems[S].Id, MainCategoryId: AddedItems[S].MainCategoryId }; } } var LocationId = document.getElementById('lblLId').value; var AppName = escape(document.getElementById('lblAppName').innerHTML); var AppId = document.getElementById('lblAppId1').value; var CompanyId = document.getElementById('lblCId').value; var GuestName = document.getElementById("txtguestdeliveryname").value; var GuestEmail = document.getElementById("txtguestdeliveryemail").value; var TotalWeight = document.getElementById("TotalWeight").innerHTML; var GuestPhno = document.getElementById('txtmobilenumber').value; var UCountryName = document.getElementById('lblCountry').innerHTML; var GuestDate = document.getElementById('txtdeliverydate').value; var OrderInstructions = escape(document.getElementById('instructions').value); var TotalPrice = document.getElementById("lbltotalamount").innerHTML; document.getElementById("lblamnt").innerHTML = TotalPrice; var Tax = document.getElementById("lbltaxes").innerHTML; var Subtotal = document.getElementById("lblAlltotalprice").innerHTML; var Tip = document.getElementById("WTip").innerHTML; var Deliveryfee = "0.00"; var DiscountDeliveryFee = "0.00"; if (EntityType == "Shipping" || EntityType == "Delivery") { Deliveryfee = document.getElementById("lbldelivaryfee").innerHTML; DiscountDeliveryFee = document.getElementById("lbldiscountdeliveryfee").innerHTML; } var PaymentType = document.getElementById("Paytype").innerHTML; var sPath = window.location.pathname; var RestaurantName = sPath.substring(sPath.lastIndexOf('/') + 1); var PValue = escape(document.getElementById('Promocodetxt').value); if (PValue == "Enter Promo Code") PValue = ""; if (document.getElementById("Promoprice").innerHTML == "") PValue = ""; if (document.getElementById("lblbconvenience").innerHTML != "") { var ConvenienceFee = document.getElementById("lblbconvenience").innerHTML; } else { var ConvenienceFee = 0; } var CardConvenienceFee = document.getElementById("lblcardconviencefee").innerHTML.toLowerCase(); if (GuestTime == "") { $('.placeorder').fadeIn("slow"); document.getElementById("lblorderfail").innerHTML = ""; $("#lblorderror").text("Sorry you can't place an order using ASAP time. Plz try with another time."); $(".ordererror").show().delay(3000).fadeOut(); $('.userdeliveryloader').css("display", "none"); return; } var promotitle = document.getElementById("promotitle").innerHTML; var Promoprice = document.getElementById("Promoprice").innerHTML; var Line1 = document.getElementById("txtline1").value; var Line2 = document.getElementById("txtline2").value; var City = document.getElementById("txtcity").value; var Zip = document.getElementById("txtZip").value; var State = document.getElementById("txtstate").value; var RestAddr = document.getElementById('restaddr').innerHTML; var RestPhno = document.getElementById('RestPhno').innerHTML; var RestName = document.getElementById('lblAppName').innerHTML; var LocationName = document.getElementById('lbllocationname').innerHTML; var TimeZoneName = document.getElementById('lbltimezonename').value; var RawOffset = document.getElementById('lblrawoffset').innerHTML; var LastName = ""; if (promotitle != "") { if (document.getElementById("charitylbl").innerHTML == "") var PromoType = "User Discount"; else var PromoType = "Charity"; } else var PromoType = ""; if (document.getElementById('OpenorClose').innerHTML.toLowerCase() == "closed now") var PhoneCallStatus = "false"; else var PhoneCallStatus = "true"; if (document.getElementById("Conveniencelbl").innerHTML != 0) var ConvenienceFee1 = document.getElementById("Conveniencelbl").innerHTML; else var ConvenienceFee1 = 0; var Orderstring = getQueryStrings(); var OrderFrom; var CustomWebsites = Orderstring["CustomWebsites"]; if (CustomWebsites != undefined) { if (CustomWebsites == "FaceBookOrdering") OrderFrom = "FaceBook"; else if (document.getElementById("lblcwurl").innerHTML != "") OrderFrom = document.getElementById("lblcwurl").innerHTML; else OrderFrom = "MunchEm Website"; } else if (document.getElementById("lblcwurl").innerHTML != "") OrderFrom = document.getElementById("lblcwurl").innerHTML; else OrderFrom = "MunchEm Website"; var GroupId = Orderstring["OrderId"]; if (GroupId == undefined) GroupId = ""; if (ConvenienceFee != 0) ConvenienceFee = ConvenienceFee.replace(document.getElementById("lblCurrency").innerHTML, ''); Subtotal = Subtotal.replace(document.getElementById("lblCurrency").innerHTML, ''); TotalPrice = TotalPrice.replace(document.getElementById("lblCurrency").innerHTML, ''); var ZoneId = localStorage.getItem("Zone"); if (ZoneId == null) ZoneId = ""; var CouponType = document.getElementById("CouponType").innerHTML; if (CouponType == "Coupon") PromoType = "Coupon"; var MileageCharge = document.getElementById("lblMileageCharge").innerHTML; var Miles = localStorage.getItem("Miles"); if (typeof Miles !== 'undefined' && Miles !== null) { } else Miles = 0; var CustomerName = ""; var CustomerEmail = ""; var CustomerPhno = ""; if ($('#chkDguest').is(':checked')) { CustomerName = document.getElementById("txtDGName").value.trim(); CustomerEmail = document.getElementById("txtDGEmail").value; CustomerPhno = document.getElementById("txtDGPhno").value; } var LandMark = document.getElementById("txtLandmark").value; var Nonce = ""; if (PaymentType == "CreditCard") { var Amount = document.getElementById("lbltotalamount").innerHTML; Amount = Amount.replace(document.getElementById("lblCurrency").innerHTML, ""); if (document.getElementById("lblCurrency").innerHTML == "$") Country = "US"; else Country = "IN"; var CTables = new Array(); var CardDetails = new Object; var monthddl = document.getElementById("ddlBindMonth"); var Month = monthddl.options[monthddl.selectedIndex].text; var yddl = document.getElementById("ddlBindYear"); var Year = yddl.options[yddl.selectedIndex].text; CardDetails.FirstName = document.getElementById("txtcardname").value.trim(); CardDetails.LastName = document.getElementById("txtClastname").value.trim(); CardDetails.CardHoldersName = document.getElementById("txtcardname").value.trim(); if (document.getElementById("CCBaseURL").innerHTML != "") CardDetails.CardNumber = document.getElementById("mytoken").value; else CardDetails.CardNumber = document.getElementById("txtcardno").value; CardDetails.ExpiryMonth = Month; CardDetails.ExpiryYear = Year; CardDetails.OrderAmount = Amount; CardDetails.Country = Country; CardDetails.CVV = document.getElementById("txtCVV").value; CardDetails.BillingZipCode = document.getElementById("txtBZC").value; CardDetails.PayPalBillingAddress = new Object; if (document.getElementById("chkcard").checked == true) { CardDetails.PayPalBillingAddress.Line1 = document.getElementById("txtcLine1").value; CardDetails.PayPalBillingAddress.Line2 = document.getElementById("txtcline2").value; CardDetails.PayPalBillingAddress.City = document.getElementById("txtcCity").value; CardDetails.PayPalBillingAddress.State = document.getElementById("txtCState").value; CardDetails.PayPalBillingAddress.Zip = document.getElementById("txtBZC").value; CardDetails.PayPalBillingAddress.Country = Country; } else { CardDetails.PayPalBillingAddress.Line1 = document.getElementById("txtaddress").value; CardDetails.PayPalBillingAddress.Line2 = ""; CardDetails.PayPalBillingAddress.City = document.getElementById("txtvalidationcity").value; CardDetails.PayPalBillingAddress.State = document.getElementById("txtvalidationstate").value; CardDetails.PayPalBillingAddress.Zip = document.getElementById('txtvalidationzip').value; CardDetails.PayPalBillingAddress.Country = Country; } CTables.push(CardDetails); localStorage.setItem("CreditCardDetails", JSON.stringify(CTables)); } else if (PaymentType == "SquareCreditCard" || PaymentType == "CloverCreditCard") { if (localStorage.getItem("Nonce") != null) Nonce = localStorage.getItem("Nonce"); } var CheckInInfo = "", CheckInlbl = "", EnableCheckInMobile = "", BeforeorAfterPlaceOrder = ""; if (EntityType == "CurbSide") { if (document.getElementById("lblbeforeorderafterorder").innerHTML == "true") { CheckInInfo = document.getElementById("txtcustomerinfo").value.trim(); CheckInlbl = document.getElementById("lblcustomerinfo").innerHTML; EnableCheckInMobile = document.getElementById("lblcheckinmobile").innerHTML; BeforeorAfterPlaceOrder = document.getElementById("lblbeforeorderafterorder").innerHTML; } } var AdvancedLabel = document.getElementById("txtAdvancedlbl").value; if (document.getElementById("lblindication").innerHTML == "TextBox to Enter Customer Location" || document.getElementById("lblindication").innerHTML == "CustomerOrderDetails") AdvancedLabel = document.getElementById("txtCustomerOrderDe").value; var screenAdvancedLabel = document.getElementById("screentxtAdvancedlbl").value; if (document.getElementById("screenlblindication").innerHTML == "TextBox to Enter Customer Location" || document.getElementById("screenlblindication").innerHTML == "CustomerOrderDetails") screenAdvancedLabel = document.getElementById("screentxtCustomerOrderDe").value; var G1 = document.getElementById("ddldropdownoptions"); if (G1.selectedIndex != "-1") { AdvancedLabel = G1.options[G1.selectedIndex].value } if (AdvancedLabel != "" && AdvancedLabel != "0") AdvancedLabel = $("#lblpickuptext").text() + ": " + AdvancedLabel; if (AdvancedLabel == "0") AdvancedLabel = ""; if (UrlType == "DineIn" && OrderType== "DineIn") { AdvancedLabel = document.getElementById("dineintableid").value; AdvancedLabel = "Table Id : " + AdvancedLabel; } //Theaters if (EntityType == "Theater Seat") { var G2 = document.getElementById("screenddldropdownoptions"); if (G2.selectedIndex != "-1") { screenAdvancedLabel = G2.options[G2.selectedIndex].value } if (screenAdvancedLabel != "" && screenAdvancedLabel != "0") screenAdvancedLabel = $("#screenlblpickuptext").text() + ": " + screenAdvancedLabel; if (screenAdvancedLabel == "0") screenAdvancedLabel = ""; if (UrlType == "DineIn" && OrderType== "DineIn") { screenAdvancedLabel = document.getElementById("dineintableid").value; screenAdvancedLabel = "Table Id : " + screenAdvancedLabel; } } var VehicleType = "";var VehicleColor = ""; if (document.getElementById("lblVehicleDetails").innerHTML == "true") { var ddlvehicledetails = document.getElementById("ddlVehicleDetails"); var vehicledetails = ddlvehicledetails.options[ddlvehicledetails.selectedIndex].value; if (vehicledetails != "--Select Vehicle Details--") { var vhcledtl = vehicledetails.split('&'); VehicleType = vhcledtl[1]; VehicleColor = vhcledtl[0]; } } var TotalDistance = localStorage.getItem("TotalDistance"); var AllowDuplicateOrders = "false"; if (document.getElementById("lbldouplicate").innerHTML == "Duplicate") AllowDuplicateOrders = "true"; var ShipmentDays = ""; if (document.getElementById("SpeedId").innerHTML != '') ShipmentDays = $("label[for='Days" + document.getElementById("SpeedId").innerHTML + "']").text(); var ReducedTime = document.getElementById("lblreducedtime").innerHTML; if (localStorage.getItem("EnableDoorDash") == "true" && OrderType == "Delivery") { if (localStorage.getItem("DoorDash") == "true") { var Zip = ""; if (document.getElementById('txtvalidationzip').value != 'Zip') { Zip = document.getElementById('txtvalidationzip').value; } var BusinessName = escape(document.getElementById('lblAppName').innerHTML); var CustomerContactNumber = document.getElementById('txtmobilenumber').value; var CustomerName = document.getElementById('txtguestdeliveryname').value; var DeliveryAddress = document.getElementById('txtaddress').value + ", " + document.getElementById('txtvalidationcity').value + ", " + document.getElementById('txtvalidationstate').value + ", " + Zip; var time = document.getElementById("ddlhr"); var GuestTime = time.options[time.selectedIndex].text; if (GuestTime == "ASAP") var Pickuptime = document.getElementById('txtdeliverydate').value + " " + document.getElementById("lblasaphr").innerHTML; else var Pickuptime = document.getElementById('txtdeliverydate').value + " " + GuestTime; $.ajax({ type: "POST", contentType: "application/json", dataType: 'json', url: "Orders.aspx/DoorDashPriceAndTimeEstimates", data: "{'LocationId': '" + LocationId + "','PickupAddress': '" + escape(localStorage.getItem("BusinessAddress")) + "','DeliveryAddress': '" + escape(DeliveryAddress) + "','PickupPhonenumber': '" + localStorage.getItem("BusinessContactNumber") + "','DeliveryPhonenumber': '" + CustomerContactNumber + "','Pickuptime': '" + Pickuptime + "','CustomerName': '" + CustomerName + "','BusinessName': '" + BusinessName + "','Tip': '" + Tip + "'}", success: function (msg) { if (msg.d.quote_id != null) { var fee = msg.d.fee / 100; var existingDeliveryfee = document.getElementById("lbluserdelivery").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); var thirdpartydelivery = new Object(); thirdpartydelivery.quote_id = msg.d.quote_id; thirdpartydelivery.fee = fee; thirdpartydelivery.time = Date(); localStorage.setItem("Thirdpartydelivery", JSON.stringify(thirdpartydelivery)); if (fee == existingDeliveryfee) { $.ajax({ type: "POST", url: "Orders.aspx/InsertOrderDetails", data: "{'retrievedData': '" + escape(retrievedData) + "','GuestName': '" + GuestName + "','GuestEmail': '" + GuestEmail + "','GuestPhno': '" + GuestPhno + "','GuestDate': '" + GuestDate + "','GuestTime': '" + GuestTime + "','OrderInstructions': '" + OrderInstructions + "','PaymentType': '" + PaymentType + "','TotalPrice': '" + TotalPrice + "','Tax': '" + Tax + "','Subtotal': '" + Subtotal + "','AppId': '" + AppId + "','LocationId': '" + LocationId + "','CompanyId': '" + CompanyId + "','UId': '" + UId + "','UCountryName': '" + UCountryName + "','Deliveryfee': '" + Deliveryfee + "','AddressId': '" + AddressId + "','AppName': '" + AppName + "','Tip' :'" + Tip + "','PValue':'" + PValue + "' ,'Promoprice':'" + Promoprice + "','Line1': '" + Line1 + "','Line2': '" + Line2 + "','City' :'" + City + "','State':'" + State + "' ,'Zip':'" + Zip + "','SpType': '" + SpType + "','ConvenienceFee': '" + ConvenienceFee + "','ConvenienceFeePercentage': '" + ConvenienceFee1 + "', 'PhoneCallStatus': '" + PhoneCallStatus + "', 'OrderFrom': '" + OrderFrom + "','TimeZone':'" + TimeZoneName + "','ZoneId':'" + ZoneId + "','CouponType':'" + CouponType + "','OrderETime':'" + orderesttime + "','MileageCharge':'" + MileageCharge + "','Miles':'" + Miles + "','CustomerName':'" + CustomerName + "','CustomerEmail':'" + CustomerEmail + "','CustomerPhno':'" + CustomerPhno + "','DiscountDeliveryFee':'" + DiscountDeliveryFee + "','DriverId':'" + DriverId + "', 'LandMark': '" + LandMark + "', 'GroupId': '" + GroupId + "','EntityType': '" + escape(EntityType) + "', 'CardDetails': '" + localStorage.getItem("CreditCardDetails") + "','Nonce':'" + Nonce + "','RawOffset':'" + RawOffset + "','AdvancedLabel':'" + escape(AdvancedLabel) + "','TotalWeight': '" + TotalWeight + "','CustomOrderTypeId': '" + CustomOrderTypeId + "', 'AllowDuplicateOrders':'" + AllowDuplicateOrders + "','ShipmentDays':'" + ShipmentDays + "','ReducedTime':'" + ReducedTime + "','CardConvenienceFee':'" + CardConvenienceFee + "','CheckInInfo':'" + escape(CheckInInfo) + "','EnableCheckInMobile':'" + EnableCheckInMobile + "','BeforeorAfterPlaceOrder':'" + BeforeorAfterPlaceOrder + "','CurbSideCheckInInfoLabel':'" + escape(CheckInlbl) + "','DeliveryServiceBy': 'DoorDash','VehicleColor':'"+VehicleColor+"','VehicleType':'"+VehicleType+"','screenAdvancedLabel':'" + escape(screenAdvancedLabel) + "','CustomizedCashAs':'" + escape(CustomizedCashAs) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { if (msg.d[0].Action == "Success") { if (PaymentType == "SquareCreditCard") { PaymentType = "CreditCard"; } if (PaymentType == "Cash") { if (CardConvenienceFee == "true") { if (ConvenienceFee != "") { var TotalOrderPrice = TotalPrice - ConvenienceFee; TotalPrice = TotalOrderPrice.toFixed(2); } } } var Tables = new Array(); var AddTable = new Object; AddTable.UId = UId; AddTable.Tip = Tip; AddTable.MileageCharge = MileageCharge; AddTable.AppId = AppId; AddTable.AppName = AppName; AddTable.CompanyId = CompanyId; AddTable.LocationId = LocationId; AddTable.GuestName = GuestName; AddTable.GuestEmail = GuestEmail; AddTable.GuestPhno = GuestPhno; AddTable.UCountryName = UCountryName; AddTable.GuestDate = GuestDate; AddTable.GuestTime = msg.d[0].Time; AddTable.TimeRange = GuestTime; AddTable.TotalPrice = TotalPrice; AddTable.Line1 = Line1; AddTable.Line2 = Line2; AddTable.OrderFrom = OrderFrom; AddTable.City = City; AddTable.State = State; AddTable.promotitle = promotitle; AddTable.Promoprice = Promoprice; AddTable.Zip = Zip; AddTable.Tax = document.getElementById("lbltaxConven").innerHTML; AddTable.TaxLabel = document.getElementById("Taxeslabel").innerText; AddTable.SpType = SpType; AddTable.PValue = PValue; AddTable.AddressId = AddressId; AddTable.Deliveryfee = Deliveryfee; AddTable.Subtotal = Subtotal; AddTable.TypeOfOrder = EntityType; AddTable.OrderInstructions = OrderInstructions; AddTable.PaymentType = PaymentType; AddTable.PointType = PointType; var erndpnts = document.getElementById("lblearnedpoints").innerHTML; if (erndpnts != "") { erndpnts = erndpnts.split(" "); AddTable.EarnedPoints = erndpnts[0]; } else { AddTable.EarnedPoints = ""; } var awrdpnt = document.getElementById("AwardPoint").innerHTML; if (awrdpnt != "") { AddTable.AwardPoint = awrdpnt; } else { AddTable.AwardPoint = ""; } var valueofpoint = document.getElementById("lblValueOfPoint").innerHTML; if (valueofpoint != "") { AddTable.Worth = valueofpoint; } else { AddTable.Worth = ""; } AddTable.CustomOrderTypeId = CustomOrderTypeId; AddTable.BeforeorAfterPlaceOrder = BeforeorAfterPlaceOrder; AddTable.CustomerCheckInInfo = CheckInlbl + " : " + CheckInInfo; AddTable.CustomerCheckInInfoLabel = CheckInlbl; AddTable.EnableCheckInMobile = EnableCheckInMobile; AddTable.CardConvenienceFee = CardConvenienceFee; AddTable.VehicleType = VehicleType; AddTable.VehicleColor = VehicleColor; if (OrderType == document.getElementById("lblPickupname").innerHTML.replace("&", "&")) { AddTable.PickupButtonName = document.getElementById("lblPickupname").innerHTML.replace("&", "&"); AddTable.OrderNotes = $(".TextNotes").text(); AddTable.AdvancedLabel = ""; } else if (OrderType == document.getElementById("lblDineInname").innerHTML.replace("&", "&")) { AddTable.PickupButtonName = document.getElementById("lblDineInname").innerHTML.replace("&", "&"); AddTable.OrderNotes = $(".TextNotes").text(); AddTable.AdvancedLabel = ""; } else { if (EntityType != "Delivery" && EntityType != "Shipping") { AddTable.PickupButtonName = ""; AddTable.OrderNotes = $(".TextNotes").text(); AddTable.AdvancedLabel = escape(AdvancedLabel); } else AddTable.OrderNotes = $("#lbldeliveryOrdernote").text(); } if (EntityType == "Theater Seat") { AddTable.ScreenAdvancedLabel= escape(screenAdvancedLabel); } AddTable.UserType = EntityType; if (GroupId != "") AddTable.OrderType = "Group Order"; else AddTable.OrderType = "Normal Order"; AddTable.PromoType = PromoType; AddTable.RestPhno = RestPhno; AddTable.contactEmail = document.getElementById('lblContactEmail').innerHTML; AddTable.RestAddr = RestAddr; AddTable.RestName = RestName; AddTable.LocationName = LocationName; AddTable.LastName = LastName; AddTable.ConvenienceFee = ConvenienceFee; AddTable.OrderId = msg.d[0].GenerateId; AddTable.NewOrderId = msg.d[0].NewOrderId; AddTable.PosId = msg.d[0].PosId; Tables.push(AddTable); localStorage.setItem("PaymentSucessOrder", JSON.stringify(Tables)); var parentUrl = document.getElementById("lblcwurl").innerHTML; var parentUrl1 = document.getElementById("lblcwurl1").innerHTML; if (PaymentType == "Instamojo") { if (TotalPrice > 10) window.location = "Instamojo.aspx?Email=" + GuestEmail + "&PhNo=" + GuestPhno; else { $("#lblordalert").text("Sorry minimum Order Amount should be greater than " + document.getElementById("lblCurrency").innerHTML + 10 + " for online payments."); $(".orderalert").fadeIn(); $('.placeorder').fadeIn("slow"); $('.userdeliveryloader').css("display", "none"); $('.OrderprocessingPanel').css("display", "none"); return; } } else { try { if (localStorage.getItem("EnableDoorDash") == "true" && OrderType == "Delivery") { if (localStorage.getItem("DoorDash") == "true") { var Thirdpartydelivery = JSON.parse( localStorage.getItem("Thirdpartydelivery")); $.ajax({ type: "POST", contentType: "application/json", dataType: 'json', url: "Orders.aspx/RequestDoorDashDriver", data: "{'OrderId': '" + AddTable.OrderId + "','QuoteId': '" + Thirdpartydelivery.quote_id + "' }", success: function (d) { var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["demo"]; if (CustomWebsites == "demo") { var UrlName = '/HOAGIESCafe'; window.location.href = UrlName + '/confirmation?demo=demo'; } else if (parentUrl1 == "") { var UrlName = '/HOAGIESCafe'; window.location.href = UrlName + '/confirmation'; } else { window.parent.location = parentUrl1 + "?Status=C"; } } }); } } } catch (err) { var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["demo"]; if (CustomWebsites == "demo") { var UrlName = '/HOAGIESCafe'; window.location.href = UrlName + '/confirmation?demo=demo'; } else if (parentUrl1 == "") { var UrlName = '/HOAGIESCafe'; window.location.href = UrlName + '/confirmation'; } else { window.parent.location = parentUrl1 + "?Status=C"; } } } } else { if (UId != null) { $('.placeorder').css("display", "inline-block"); if (msg.d[0].Action == "Please verify your Phone Number from My Account -> My Profile screen to use Points") { $(".OrderprocessingPanel").css("display", "none"); $('.userdeliveryloader').css("display", "none"); $(".UserDeliveryPanel").css("display", "none"); if (confirm("Your mobile number was not verified with us. would you like to verify now? Please check your mobile and enter the activation code")) { $.ajax({ type: "POST", url: "Orders.aspx/SendActivationcodetouser", data: "{'UserId': '" + UId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "Success") { $(".ActivateMobileconfirm").fadeIn("slow"); $(".placeorderloaderdiv").css("display", "none"); $(".placeorderbtndiv").css("display", "inline-block"); } else { $(".placeorderloaderdiv").css("display", "none"); $(".placeorderbtndiv").css("display", "inline-block"); } } }); } else { $(".placeorderloaderdiv").css("display", "none"); $(".placeorderbtndiv").css("display", "inline-block"); document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblamnt").innerHTML; OrderFailed(msg.d[0].Action); } } else { document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblamnt").innerHTML; OrderFailed(msg.d[0].Action); } } else { document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblamnt").innerHTML; OrderFailed(msg.d[0].Action); } } } else { document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblamnt").innerHTML; OrderFailed("Sorry your order failed."); } } }); } else { document.getElementById("lbldelivaryfee").innerHTML = "$" + fee; document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lbldelivaryfee").innerHTML; document.getElementById("lblorderfail").innerHTML == ""; OrderFailed("Delivery fee updated, please check and proceed"); CheckDeal(); } } else { document.getElementById("lblorderfail").innerHTML == ""; OrderFailed(msg.d); CheckDeal(); } } }); } } else { $.ajax({ type: "POST", url: "Orders.aspx/InsertOrderDetails", data: "{'retrievedData': '" + escape(retrievedData) + "','GuestName': '" + GuestName + "','GuestEmail': '" + GuestEmail + "','GuestPhno': '" + GuestPhno + "','GuestDate': '" + GuestDate + "','GuestTime': '" + GuestTime + "','OrderInstructions': '" + OrderInstructions + "','PaymentType': '" + PaymentType + "','TotalPrice': '" + TotalPrice + "','Tax': '" + Tax + "','Subtotal': '" + Subtotal + "','AppId': '" + AppId + "','LocationId': '" + LocationId + "','CompanyId': '" + CompanyId + "','UId': '" + UId + "','UCountryName': '" + UCountryName + "','Deliveryfee': '" + Deliveryfee + "','AddressId': '" + AddressId + "','AppName': '" + AppName + "','Tip' :'" + Tip + "','PValue':'" + PValue + "' ,'Promoprice':'" + Promoprice + "','Line1': '" + Line1 + "','Line2': '" + Line2 + "','City' :'" + City + "','State':'" + State + "' ,'Zip':'" + Zip + "','SpType': '" + SpType + "','ConvenienceFee': '" + ConvenienceFee + "','ConvenienceFeePercentage': '" + ConvenienceFee1 + "', 'PhoneCallStatus': '" + PhoneCallStatus + "', 'OrderFrom': '" + OrderFrom + "','TimeZone':'" + TimeZoneName + "','ZoneId':'" + ZoneId + "','CouponType':'" + CouponType + "','OrderETime':'" + orderesttime + "','MileageCharge':'" + MileageCharge + "','Miles':'" + Miles + "','CustomerName':'" + CustomerName + "','CustomerEmail':'" + CustomerEmail + "','CustomerPhno':'" + CustomerPhno + "','DiscountDeliveryFee':'" + DiscountDeliveryFee + "','DriverId':'" + DriverId + "', 'LandMark': '" + LandMark + "', 'GroupId': '" + GroupId + "','EntityType': '" + escape(EntityType) + "', 'CardDetails': '" + localStorage.getItem("CreditCardDetails") + "','Nonce':'" + Nonce + "','RawOffset':'" + RawOffset + "','AdvancedLabel':'" + escape(AdvancedLabel) + "','TotalWeight': '" + TotalWeight + "','CustomOrderTypeId': '" + CustomOrderTypeId + "', 'AllowDuplicateOrders':'" + AllowDuplicateOrders + "','ShipmentDays':'" + ShipmentDays + "','ReducedTime':'" + ReducedTime + "','CardConvenienceFee':'" + CardConvenienceFee + "','CheckInInfo':'" + escape(CheckInInfo) + "','EnableCheckInMobile':'" + EnableCheckInMobile + "','BeforeorAfterPlaceOrder':'" + BeforeorAfterPlaceOrder + "','CurbSideCheckInInfoLabel':'" + escape(CheckInlbl) + "','DeliveryServiceBy': '','VehicleColor':'"+VehicleColor+"','VehicleType':'"+VehicleType+"','screenAdvancedLabel':'" + escape(screenAdvancedLabel) + "','CustomizedCashAs':'" + escape(CustomizedCashAs) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { if (msg.d[0].Action == "Success") { if (PaymentType == "SquareCreditCard") { PaymentType = "CreditCard"; } if (PaymentType == "Cash") { if (CardConvenienceFee == "true") { if (ConvenienceFee != "") { var TotalOrderPrice = TotalPrice - ConvenienceFee; TotalPrice = TotalOrderPrice.toFixed(2); } } } var Tables = new Array(); var AddTable = new Object; AddTable.UId = UId; AddTable.Tip = Tip; AddTable.MileageCharge = MileageCharge; AddTable.AppId = AppId; AddTable.AppName = AppName; AddTable.CompanyId = CompanyId; AddTable.LocationId = LocationId; AddTable.GuestName = GuestName; AddTable.GuestEmail = GuestEmail; AddTable.GuestPhno = GuestPhno; AddTable.UCountryName = UCountryName; AddTable.GuestDate = GuestDate; AddTable.GuestTime = msg.d[0].Time; AddTable.TimeRange = GuestTime; AddTable.TotalPrice = TotalPrice; AddTable.Line1 = Line1; AddTable.Line2 = Line2; AddTable.OrderFrom = OrderFrom; AddTable.City = City; AddTable.State = State; AddTable.promotitle = promotitle; AddTable.Promoprice = Promoprice; AddTable.Zip = Zip; AddTable.Tax = document.getElementById("lbltaxConven").innerHTML; AddTable.TaxLabel = document.getElementById("Taxeslabel").innerText; AddTable.SpType = SpType; AddTable.PValue = PValue; AddTable.AddressId = AddressId; AddTable.Deliveryfee = Deliveryfee; AddTable.Subtotal = Subtotal; AddTable.TypeOfOrder = EntityType; AddTable.OrderInstructions = OrderInstructions; AddTable.PaymentType = PaymentType; AddTable.PointType = PointType; var erndpnts = document.getElementById("lblearnedpoints").innerHTML; if (erndpnts != "") { erndpnts = erndpnts.split(" "); AddTable.EarnedPoints = erndpnts[0]; } else { AddTable.EarnedPoints = ""; } var awrdpnt = document.getElementById("AwardPoint").innerHTML; if (awrdpnt != "") { AddTable.AwardPoint = awrdpnt; } else { AddTable.AwardPoint = ""; } var valueofpoint = document.getElementById("lblValueOfPoint").innerHTML; if (valueofpoint != "") { AddTable.Worth = valueofpoint; } else { AddTable.Worth = ""; } AddTable.CustomOrderTypeId = CustomOrderTypeId; AddTable.BeforeorAfterPlaceOrder = BeforeorAfterPlaceOrder; AddTable.CustomerCheckInInfo = CheckInlbl + " : " + CheckInInfo; AddTable.CustomerCheckInInfoLabel = CheckInlbl; AddTable.EnableCheckInMobile = EnableCheckInMobile; AddTable.CardConvenienceFee = CardConvenienceFee; AddTable.VehicleType = VehicleType; AddTable.VehicleColor = VehicleColor; if (OrderType == document.getElementById("lblPickupname").innerHTML.replace("&", "&")) { AddTable.PickupButtonName = document.getElementById("lblPickupname").innerHTML.replace("&", "&"); AddTable.OrderNotes = $(".TextNotes").text(); AddTable.AdvancedLabel = ""; } else if (OrderType == document.getElementById("lblDineInname").innerHTML.replace("&", "&")) { AddTable.PickupButtonName = document.getElementById("lblDineInname").innerHTML.replace("&", "&"); AddTable.OrderNotes = $(".TextNotes").text(); AddTable.AdvancedLabel = ""; } else { if (EntityType != "Delivery" && EntityType != "Shipping") { AddTable.PickupButtonName = ""; AddTable.OrderNotes = $(".TextNotes").text(); AddTable.AdvancedLabel = escape(AdvancedLabel); } else AddTable.OrderNotes = $("#lbldeliveryOrdernote").text(); } if (EntityType == "Theater Seat") { AddTable.ScreenAdvancedLabel= escape(screenAdvancedLabel); } AddTable.UserType = EntityType; if (GroupId != "") AddTable.OrderType = "Group Order"; else AddTable.OrderType = "Normal Order"; AddTable.PromoType = PromoType; AddTable.RestPhno = RestPhno; AddTable.contactEmail = document.getElementById('lblContactEmail').innerHTML; AddTable.RestAddr = RestAddr; AddTable.RestName = RestName; AddTable.LocationName = LocationName; AddTable.LastName = LastName; AddTable.ConvenienceFee = ConvenienceFee; AddTable.OrderId = msg.d[0].GenerateId; AddTable.NewOrderId = msg.d[0].NewOrderId; AddTable.PosId = msg.d[0].PosId; Tables.push(AddTable); localStorage.setItem("PaymentSucessOrder", JSON.stringify(Tables)); var parentUrl = document.getElementById("lblcwurl").innerHTML; var parentUrl1 = document.getElementById("lblcwurl1").innerHTML; if (PaymentType == "Instamojo") { if (TotalPrice > 10) window.location = "Instamojo.aspx?Email=" + GuestEmail + "&PhNo=" + GuestPhno; else { $("#lblordalert").text("Sorry minimum Order Amount should be greater than " + document.getElementById("lblCurrency").innerHTML + 10 + " for online payments."); $(".orderalert").fadeIn(); $('.placeorder').fadeIn("slow"); $('.userdeliveryloader').css("display", "none"); $('.OrderprocessingPanel').css("display", "none"); return; } } else { var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["demo"]; if (CustomWebsites == "demo") { var UrlName = '/HOAGIESCafe'; window.location.href = UrlName + '/confirmation?demo=demo'; } else if (parentUrl1 == "") { var UrlName = '/HOAGIESCafe'; window.location.href = UrlName + '/confirmation'; } else { window.parent.location = parentUrl1 + "?Status=C"; } } } else { var Orderstring = getQueryStrings(); var Type = Orderstring["Type"]; if (Type != null) { if (Type.includes("preview")) { if (msg.d[0].Action.includes("doesn't accept any orders at this time")) { msg.d[0].Action = msg.d[0].Action + " Please publish the business." } } } if (UId != null) { $('.placeorder').css("display", "inline-block"); if (msg.d[0].Action == "Please verify your Phone Number from My Account -> My Profile screen to use Points") { $(".OrderprocessingPanel").css("display", "none"); $('.userdeliveryloader').css("display", "none"); $(".UserDeliveryPanel").css("display", "none"); if (confirm("Your mobile number was not verified with us. would you like to verify now? Please check your mobile and enter the activation code")) { $.ajax({ type: "POST", url: "Orders.aspx/SendActivationcodetouser", data: "{'UserId': '" + UId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "Success") { $(".ActivateMobileconfirm").fadeIn("slow"); $(".placeorderloaderdiv").css("display", "none"); $(".placeorderbtndiv").css("display", "inline-block"); } else { $(".placeorderloaderdiv").css("display", "none"); $(".placeorderbtndiv").css("display", "inline-block"); } } }); } else { $(".placeorderloaderdiv").css("display", "none"); $(".placeorderbtndiv").css("display", "inline-block"); document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblamnt").innerHTML; OrderFailed(msg.d[0].Action); } } else { document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblamnt").innerHTML; OrderFailed(msg.d[0].Action); } } else { document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblamnt").innerHTML; OrderFailed(msg.d[0].Action); } } } else { document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblamnt").innerHTML; OrderFailed("Sorry your order failed."); } } }); } } else { $("#lblorderror").text("Item(s) in your cart are no longer available for ordering today. Either remove these Order for Later Items or place your order for a future day."); $(".ordererror").show().delay(3000).fadeOut(); } } catch (err) { $.ajax({ type: "POST", url: "OrderConfirmation.aspx/SendExceptionEmail", data: "{'Excep': '" + escape(err.message) + "','Stack': '" + escape(err.stack) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { } }); } } function userTip(value) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; document.getElementById("txttip").value = value; document.getElementById("TipValue").innerHTML = value; if (document.getElementById("lblorderfail").innerHTML != "InsertOrder") { if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} //CardCanvienceFee(); // UserMuncheiscount(); } } function userTip1(value) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var finaltotal = 0; document.getElementById("TipValue").innerHTML = value; alertify.set({ labels: { ok: "Okay" } }); var txttips = "Tip beyond 50% of your order total is not allowed"; if (~value.indexOf('%')) { if (~value.indexOf(document.getElementById("lblCurrency").innerHTML)) { $("#lblorderror").text("Please Enter the Price should be either in " + document.getElementById("lblCurrency").innerHTML + " or in %"); $(".ordererror").show().delay(3000).fadeOut(); if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} } else if (value > '50%') { if (document.getElementById("fifty") != null) { if (document.getElementById("fifty").value == "50%") { document.getElementById("txttip").value = value; if (document.getElementById("lblorderfail").innerHTML != "InsertOrder") { if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} //CardCanvienceFee(); } } } else { $("#lblordalert").text(txttips); $(".orderalert").fadeIn(); document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("WTip").innerHTML = document.getElementById("txttip").value; if (document.getElementById("txttip").value == "0" || document.getElementById("txttip").value == "0.00" || document.getElementById("txttip").value == document.getElementById("lblCurrency").innerHTML + "0.00") { $('.tipEnable').fadeOut("slow"); if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} } } //alertify.message("Tips beyond 50% of your order total is not allowed", function (e) { // if (e) { // document.getElementById("txttip").value = value; // if (document.getElementById("lblorderfail").innerHTML != "InsertOrder") { // GetDeal(); // //CardCanvienceFee(); // document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; // document.getElementById("WTip").innerHTML = document.getElementById("txttip").value; // document.getElementById("WTip").innerHTML = document.getElementById("txttip").value; // if (document.getElementById("txttip").value == "0" || document.getElementById("txttip").value == "0.00" || document.getElementById("txttip").value == document.getElementById("lblCurrency").innerHTML + "0.00") { // $('.tipEnable').fadeOut("slow"); // } // } // } // else { // document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; // document.getElementById("WTip").innerHTML = document.getElementById("txttip").value; // if (document.getElementById("txttip").value == "0" || document.getElementById("txttip").value == "0.00" || document.getElementById("txttip").value == document.getElementById("lblCurrency").innerHTML + "0.00") { // $('.tipEnable').fadeOut("slow"); // } // } //}); } else { value = value.replace("%", ""); var tip = Number(value); if (tip <= 1000) { document.getElementById("TipValue").innerHTML = value; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} if (tip == "0" || tip == "0.00" || tip == "0." || tip == "0.0" || tip == "0.00" || tip == "") { $('.tipEnable').fadeOut("slow"); } //CardCanvienceFee(); // UserMuncheiscount(); } else { $("#lblorderror").text("Please add tip amount less than " + document.getElementById("lblCurrency").innerHTML + "1000"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("txttip").value = "0.00"; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} } } } else { if (~value.indexOf('%')) { $("#lblorderror").text("Please Enter the Price should be either in " + document.getElementById("lblCurrency").innerHTML + " or in %"); $(".ordererror").show().delay(3000).fadeOut(); if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} } else { value = value.replace(document.getElementById("lblCurrency").innerHTML, ""); var subtotal = $('#lblAlltotalprice').text(); subtotal = subtotal.replace(document.getElementById("lblCurrency").innerHTML, ""); var totaltip = parseInt(subtotal / 2); var tip = Number(value); if (tip > totaltip) { if (document.getElementById("fifty") != null) { if (document.getElementById("fifty").value == "50%") { document.getElementById("txttip").value = value; if (document.getElementById("lblorderfail").innerHTML != "InsertOrder") { if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} //CardCanvienceFee(); } } } else { $("#lblordalert").text(txttips); $(".orderalert").fadeIn(); document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("WTip").innerHTML = document.getElementById("txttip").value; if (document.getElementById("txttip").value == "0" || document.getElementById("txttip").value == "0.00" || document.getElementById("txttip").value == document.getElementById("lblCurrency").innerHTML + "0.00") { $('.tipEnable').fadeOut("slow"); if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} } } //alertify.confirm("Tips beyond 50% of your order total is not allowed", function (e) { // if (e) { // document.getElementById("txttip").value = value; // if (document.getElementById("lblorderfail").innerHTML != "InsertOrder") { // GetDeal(); // //CardCanvienceFee(); // document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; // document.getElementById("WTip").innerHTML = document.getElementById("txttip").value; // if (document.getElementById("txttip").value == "0" || document.getElementById("txttip").value == "0.00" || document.getElementById("txttip").value == document.getElementById("lblCurrency").innerHTML + "0.00") { // $('.tipEnable').fadeOut("slow"); // } // } // } // else { // document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; // document.getElementById("WTip").innerHTML = document.getElementById("txttip").value; // if (document.getElementById("txttip").value == "0" || document.getElementById("txttip").value == "0.00" || document.getElementById("txttip").value == document.getElementById("lblCurrency").innerHTML + "0.00") { // $('.tipEnable').fadeOut("slow"); // } // } //}); } else if (tip <= 1000) { document.getElementById("TipValue").innerHTML = document.getElementById("lblCurrency").innerHTML + value; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} if (tip == "0" || tip == "0.00" || tip == "0." || tip == "0.0" || tip == "0.00" || tip == "") { $('.tipEnable').fadeOut("slow"); } //CardCanvienceFee(); // UserMuncheiscount(); } else { $("#lblorderror").text("Please add tip amount less than " + document.getElementById("lblCurrency").innerHTML + "1000"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("txttip").value = "0.00"; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} } } } // CardCanvienceFee(); } </script> <script type="text/javascript"> function Trim(el) { el.value = el.value. replace(/(^\s*)|(\s*$)/gi, ""). replace(/[ ]{2,}/gi, " "). replace(/\n +/, "\n"); return; } function signinpanelopen(Login) { document.getElementById('lblMsg12').innerHTML = ""; $("#signinpanel").find("input[type=text],input[type=password]").val(''); $(".registererror").css("display", "none"); $("#signinpanel").find("input[type=text],input[type=password]").removeClass("userlogin_formtext1Error").addClass("userlogin_formtext1"); if (document.getElementById('popupsscroll').innerHTML == "over") $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 500); else $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 0); $('.signinpanel').fadeIn("slow"); $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); $("#txtPwd").attr("type", "password"); $("#imgpwd").attr("src", "/images/hidepassword.png"); } function signinpanelopen1() { document.getElementById('lblMsg12').innerHTML = ""; $('#signinpanel').fadeIn("slow"); $('#CompanyRegistrepnl').fadeOut("slow"); $('.Activatepanel').fadeOut("slow"); $('#signinpanel').fadeIn("slow"); $("#signinpanel").find("input[type=text],input[type=password]").val(''); $(".registererror").css("display", "none"); $("#signinpanel").find("input[type=text],input[type=password]").removeClass("userlogin_formtext1Error").addClass("userlogin_formtext1"); if (document.getElementById('popupsscroll').innerHTML == "over") $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 80); else $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 0); } function subpanelopen() { $(".mnupopup").css("display", "block"); } function GetUserImage(Name) { var UId = document.getElementById("UserId").innerHTML; if (UId != "") { $.ajax({ type: "POST", url: "orders.aspx/UserImage", data: "{'UId':'" + UId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { $(".userimage1").attr("src", msg.d); $(".signmenu").css("display", "block"); if (msg.d == "data:image/png;base64,") { $(".showuserimage1").attr("src", "images/photonotavailablepng.png"); $(".showuserimage1").attr("alt", "User Image Not available"); $(".showuserimage1").css("display", "none"); if (~Name.indexOf(" ")) { Name = Name.substr(0, Name.indexOf(" ")); } if (Name == "") { $(".popupdisplay1").css("display", "inline-block"); $(".showuserimage").attr("src", "/images/photonotavailablepng.png"); $(".showuserimage").attr("alt", "User Image Not available"); $(".showuserimage").css("display", "inline-block"); } document.getElementById('lblEmail').innerHTML = Name; $("#lblEmail").css("display", "inline-block"); $(".signinoptdiv").css("display", "none"); if (window.self !== window.top) { if (window.parent.location != window.location) { $(".signin-accountdiv").css("display", "block"); } } } else { $(".showuserimage1").attr("src", msg.d); $("#lblEmail").css("display", "none"); // $(".signinoptdiv").css("display", "block"); // if (window.self !== window.top) { // if (window.parent.location != window.location) { // $(".signin-accountdiv").css("display", "none"); // } //} document.getElementById('lblEmail').innerHTML = ""; } } else { $(".userimage1").attr("src", "images/photonotavailablepng.png"); $(".userimage1").attr("alt", "User Image Not available"); $(".showuserimage1").attr("src", "images/photonotavailablepng.png"); $(".showuserimage1").attr("alt", "User Image Not available"); $(".showuserimage1").css("display", "none"); $(".signmenu").css("display", "block"); if (~Name.indexOf(" ")) { Name = Name.substr(0, Name.indexOf(" ")); } if (Name == "") { $(".popupdisplay1").css("display", "inline-block"); $(".showuserimage").attr("src", "/images/photonotavailablepng.png"); $(".showuserimage").attr("alt", "User Image Not available"); $(".showuserimage").css("display", "block"); } document.getElementById('lblEmail').innerHTML = Name; $("#lblEmail").text(Name.substring(0, 1)); $("#lblEmail").css("display", "inline-block"); $(".signinoptdiv").css("display", "none"); if (window.self !== window.top) { if (window.parent.location != window.location) { $(".signin-accountdiv").css("display", "block"); } } } } }); } } //$(document).click(function (e) { // if (!$(e.target).is('.popupdisplay1')) { // $('.popupdisplay2').fadeOut("slow"); // } //}); function registrationopen() { $("#ddlusercountry").empty(); $.ajax({ type: "POST", url: "Default.aspx/BindCountries", data: "{'string1':''}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { $('.ddlusercountry').empty(); var country = document.getElementById("ddlusercountry"); for (var l = 0; l < msg.d.length; l++) { var optmin2 = document.createElement("option"); optmin2.text = msg.d[l]; optmin2.value = msg.d[l]; country.options.add(optmin2); } var optionValues =[]; $('#ddlusercountry option').each(function(){ if($.inArray(this.value, optionValues) >-1){ $(this).remove() }else{ optionValues.push(this.value); } }); } $('.signinpanel').fadeOut("slow"); $('.CompanyRegistrepnl').fadeIn("slow"); $(".ViewReviews").css("display", "none"); $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 0); $("#regerror").css("display", "none"); $("#lblchkmsg").css("display", "none"); $(".registererror").css("display", "none"); $("#CompanyRegistrepnl").find("input[type=text],input[type=password]").val(''); $("#CompanyRegistrepnl").find("input[type=text],input[type=password]").removeClass("userregistrer_formtext1Error").addClass("userregistrer_formtext1"); } }); } function CompanyRegisterClose() { $('.CompanyRegistrepnl').fadeOut("slow"); $("#imgshowpwd").removeAttr("style"); $("#imgconfirmpwd").removeAttr("style"); $("#imgshowpwd").attr("style", "margin-top:6px;margin-left:-25px;"); $("#imgconfirmpwd").attr("style", "margin-top:6px;margin-left:-25px;"); $("#txtPwd").attr("type", "password"); $("#imgpwd").attr("src", "/images/hidepassword.png"); $("#txtPassword").attr("type", "password"); $("#imgshowpwd").attr("src", "/images/hidepassword.png"); $("#txtconformpsw").attr("type", "password"); $("#imgconfirmpwd").attr("src", "/images/hidepassword.png"); } function ActivatePanelClose() { $('.Activatepanel').fadeOut("slow"); } function Registervalidation() { $(".samplep").text(""); var EmailId, FirstName, LastName, Password, Number, Country, About; EmailId = document.getElementById('txtUserEmail').value; FirstName = document.getElementById('txtFirstName').value.trim(); LastName = document.getElementById('txtLastName').value.trim(); Password = document.getElementById('txtPassword').value; conformPassword = document.getElementById('txtconformpsw').value; Number = document.getElementById('txtPhonenumber').value; Country = $("#ddlusercountry option:selected").text(); emailExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i; //emailExp = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i; numberexp1 = /^\+(?:[0-9] ?){6,14}[0-9]$/; //^[0-9-+]+$/ pwdexp = /^[A-Za-z0-9!@#$%^&*'()_ ]{5,50}$/; numberexp = /^\d{10}$/; //10 Digit Number Validation /^\d{3}-?\d{3}-?\d{4}$/ nameexp = /^[A-Za-z0-9!@#$%^&*()_ ]{2,50}$/; About = $("#ddlhearabout option:selected").text(); if (About == "Other") Other = escape(document.getElementById('txtother').value); if (About == "Driver") Other = escape(document.getElementById('txtdrivername').value); if (About == "Hotel VIP") Other = escape(document.getElementById('txtconname').value); var i = 0; if (EmailId == '' && FirstName == '' && LastName == '' && Password == '' && Number == '' && Country == '-Select Country-' && About == "How did you hear about us?") { document.getElementById('txtUserEmail').className = "userregistrer_formtext1Error"; document.getElementById('txtFirstName').className = "userregistrer_formtext1Error "; document.getElementById('txtLastName').className = "userregistrer_formtext1Error"; document.getElementById('txtPassword').className = "userregistrer_formtext1Error "; document.getElementById('txtconformpsw').className = "userregistrer_formtext1Error "; document.getElementById('txtPhonenumber').className = "userregistrer_formtext1Error "; document.getElementById('ddlusercountry').className = "userregistrer_formtext1Error "; document.getElementById("ddlhearabout").className = "userregistrer_formtext1Error "; $("#txtFirstName").attr("alt", "Enter your First Name"); $("#txtFirstName").focus(); $(".samplep").text("firstfocus"); $("#imgshowpwd").removeAttr("style"); $("#imgconfirmpwd").removeAttr("style"); $("#imgshowpwd").attr("style", "margin-left:-52px;margin-top:6px;"); $("#imgconfirmpwd").attr("style", "margin-left:-52px;margin-top:6px;"); } else { $("#regerror").fadeOut(); if (FirstName == '') { document.getElementById('txtFirstName').className = "userregistrer_formtext1Error"; $("#txtFirstName").focus(); i++; } else if (!FirstName.match(nameexp)) { $("#txtFirstName").focus(); i++; } else document.getElementById('txtFirstName').className = "userregistrer_formtext1"; if (LastName == '') { document.getElementById('txtLastName').className = "userregistrer_formtext1Error"; //$("#txtLastName").attr("alt", "Enter your Last Name"); if (FirstName != '' && FirstName.match(nameexp)) { $("#txtLastName").attr("alt", "Enter your Last Name"); if (i == 0) { $("#txtLastName").focus(); } } i++; } else { document.getElementById('txtLastName').className = "userregistrer_formtext1"; } if (EmailId == '') { document.getElementById('txtUserEmail').className = "userregistrer_formtext1Error"; $("#txtUserEmail").attr("alt", "Enter your Email"); if (FirstName != '' && (FirstName.match(nameexp)) && LastName != '') { if (i == 0) { $("#txtUserEmail").focus(); } } i++; } else if (!EmailId.match(emailExp)) { if (FirstName != '' && (FirstName.match(nameexp)) && LastName != '') { if (i == 0) { $("#txtUserEmail").focus(); } } i++; } else { document.getElementById('txtUserEmail').className = "userregistrer_formtext1"; } if (Number == '') { document.getElementById('txtPhonenumber').className = "userregistrer_formtext1Error"; $("#txtPhonenumber").attr("alt", "Enter your PhoneNumber"); if (FirstName != '' && (FirstName.match(nameexp)) && LastName != '' && EmailId != '' && EmailId.match(emailExp)) { if (i == 0) { $("#txtPhonenumber").focus(); } } i++; } else { if (~Number.indexOf('+') || ~Number.indexOf("+1") || ~Number.indexOf("+91")) { var phone; if (~Number.indexOf('+91')) { phone = Number.replace('+91', ""); } else if (~Number.indexOf('+1')) { phone = Number.replace('+1', ""); } else { phone = Number.replace('+', ""); } if (phone.length != '10') { if (FirstName != '' && (FirstName.match(nameexp)) && LastName != '' && EmailId != '' && EmailId.match(emailExp)) { if (i == 0) { $("#txtPhonenumber").focus(); } } i++; } } else if (!Number.match(numberexp)) { if (FirstName != '' && (FirstName.match(nameexp)) && LastName != '' && EmailId != '' && EmailId.match(emailExp)) { if (i == 0) { $("#txtPhonenumber").focus(); } } i++; } else { document.getElementById('txtPhonenumber').className = "userregistrer_formtext1"; } } if (Password == '') { document.getElementById('txtPassword').className = "userregistrer_formtext1Error tooltip"; $("#imgshowpwd").removeAttr("style"); $("#imgshowpwd").attr("style", "margin-left:-52px;margin-top:6px;"); $("#txtPassword").attr("alt", "Enter your Password"); if (FirstName != '' && (FirstName.match(nameexp)) && LastName != '' && EmailId != '' && EmailId.match(emailExp) && Number != '' && Number.match(numberexp)) { if (i == 0) { $("#txtPassword").focus(); } } i++; } else if (!Password.match(pwdexp)) { if (FirstName != '' && (FirstName.match(nameexp)) && LastName != '' && EmailId != '' && EmailId.match(emailExp) && Number != '' && Number.match(numberexp)) { if (i == 0) { $("#txtPassword").focus(); } } i++; } else { document.getElementById('txtPassword').className = "userregistrer_formtext1"; $("#imgshowpwd").removeAttr("style"); $("#imgshowpwd").attr("style", "margin-top:6px;"); } if (conformPassword == '') { document.getElementById('txtconformpsw').className = "userregistrer_formtext1Error tooltip"; $("#imgconfirmpwd").removeAttr("style"); $("#imgconfirmpwd").attr("style", "margin-left:-52px;margin-top:6px;"); $("#txtconformpsw").attr("alt", "Enter Confirm password "); if (FirstName != '' && (FirstName.match(nameexp)) && LastName != '' && EmailId != '' && EmailId.match(emailExp) && Number != '' && Number.match(numberexp)) { if (i == 0) { $("#txtconformpsw").focus(); } } i++; } else if (Password != conformPassword) { $("#txtconformpsw").attr("alt", "Confirm password does not match"); if (FirstName != '' && (FirstName.match(nameexp)) && LastName != '' && EmailId != '' && EmailId.match(emailExp) && Number != '' && Number.match(numberexp)) { if (i == 0) { $("#txtconformpsw").focus(); } } i++; } else { document.getElementById('txtconformpsw').className = "userregistrer_formtext1"; $("#imgconfirmpwd").removeAttr("style"); $("#imgconfirmpwd").attr("style", "margin-top:6px;"); } if (Country == '-Select Country-') { document.getElementById('ddlusercountry').className = "userregistrer_formtext1Error"; document.getElementById('lblusercountry').innerHTML = "Please select Country"; $('.lblusercountry').css("display", "block"); i++; } else { document.getElementById('ddlusercountry').className = "userregistrer_formtext1"; document.getElementById('lblusercountry').innerHTML = ""; } if (About == "How did you hear about us?") { document.getElementById('ddlhearabout').className = "userregistrer_formtext1Error"; i++; } else if (About == "Other") { document.getElementById('ddlhearabout').className = "userregistrer_formtext1"; if (Other == "") { document.getElementById('txtother').className = "userregistrer_formtext1Error"; document.getElementById('txtother').style.marginTop = "-10px"; i++; } else { document.getElementById('txtother').className = "userregistrer_formtext1"; document.getElementById('txtother').style.marginTop = "0px"; var OthersLegnth = document.getElementById("txtother").value; if (OthersLegnth != "" && OthersLegnth != null) { if (OthersLegnth.length > 92) { alert("Enter only 92 charecters for Others"); return false; } } } } else if (About == "Driver") { document.getElementById('ddlhearabout').className = "userregistrer_formtext1"; if (Other == "") { document.getElementById('txtdrivername').className = "userregistrer_formtext1Error"; i++; } else { document.getElementById('txtdrivername').className = "userregistrer_formtext1"; } } else if (About == "Hotel VIP") { document.getElementById('ddlhearabout').className = "userregistrer_formtext1"; if (Other == "") { document.getElementById('txtconname').className = "userregistrer_formtext1Error"; i++; } else { document.getElementById('txtconname').className = "userregistrer_formtext1"; } } else { document.getElementById('ddlhearabout').className = "userregistrer_formtext1"; document.getElementById('txtother').className = "userregistrer_formtext1"; document.getElementById('txtdrivername').className = "userregistrer_formtext1"; document.getElementById('txtconname').className = "userregistrer_formtext1"; } if (i == 0) { UserRegistration(); } } } function UserRegistration() { $('.createaccountloader').css("display", "block"); var UserFirstName = document.getElementById('txtFirstName').value.trim(); var UserLastName = document.getElementById('txtLastName').value.trim(); var UserName = document.getElementById('txtUserEmail').value; var Pwd = escape(document.getElementById('txtPassword').value); var UserPhoneno = document.getElementById('txtPhonenumber').value; var UserCountryName = $("#ddlusercountry option:selected").text(); var CheckedValue1 = "Text"; var CheckedValue = "Email"; if ($('#msgcheck').is(":checked")) CheckedValue1 = "Text"; else CheckedValue1 = ""; if ($('#msgcheck1').is(":checked")) CheckedValue = "Email"; else CheckedValue = ""; var UserHowdidyouknow = $("#ddlhearabout option:selected").text(); if (UserHowdidyouknow == "Driver") UserHowdidyouknow = UserHowdidyouknow + ": " + escape(document.getElementById('txtdrivername').value); if (UserHowdidyouknow == "Other") UserHowdidyouknow = UserHowdidyouknow + ": " + escape(document.getElementById('txtother').value); if (UserHowdidyouknow == "Hotel VIP") UserHowdidyouknow = UserHowdidyouknow + ": " + escape(document.getElementById('txtconname').value); $.ajax({ type: 'get', url: '//freegeoip.net/json/', dataType: "json", cache: "false", jsonpCallback: "onJSONPLoad", success: function (location) { var CountryName = location.country_name; InsertUserRegistration(UserName, escape(Pwd), UserFirstName, UserLastName, UserPhoneno, CheckedValue, CheckedValue1, CountryName, UserCountryName, UserHowdidyouknow); }, error: function () { var CountryName = "US"; InsertUserRegistration(UserName, escape(Pwd), UserFirstName, UserLastName, UserPhoneno, CheckedValue, CheckedValue1, CountryName, UserCountryName, UserHowdidyouknow); } }); } function InsertUserRegistration(UserName, Pwd, UserFirstName, UserLastName, UserPhoneno, CheckedValue, CheckedValue1, CountryName, UserCountryName, UserHowdidyouknow) { var PageName = location.pathname; $.ajax({ type: "POST", url: "orders.aspx/UserRegistration", data: "{'UserName': '" + UserName + "','Pwd': '" + Pwd + "','UserFirstName': '" + UserFirstName + "','UserLastName': '" + UserLastName + "','UserPhoneno': '" + UserPhoneno + "','CheckedValue': '" + CheckedValue + "','CheckedValue1': '" + CheckedValue1 + "','CountryName': '" + CountryName + "','UserCountry':'" + UserCountryName + "','UserHowdidyouknow':'" + UserHowdidyouknow + "','PageName':'" + PageName + "'}", dataType: "json", contentType: "application/json", success: function (msg) { $('.createaccountloader').css("display", "none"); if (msg.d == "Registered Successfully.. Please check your Email to activate your account") { $('.CompanyRegistrepnl').fadeOut("slow"); $('.Activatepanel').fadeIn("slow"); $('#divphnact').fadeOut("slow"); $('#divemlact').fadeIn("slow"); $('.Activateresend').css("display", "block"); if (CheckedValue == "Email") { document.getElementById("lnkresendmail").innerHTML = "Resend Activation Email"; document.getElementById("lnkresendtext").innerHTML = ""; } else { document.getElementById("lnkresendtext").innerHTML = "Resend Activation Text Message"; document.getElementById("lnkresendmail").innerHTML = ""; } } else if (msg.d == "Registered Successfully.. Please check your mobile to activate your account") { $('.CompanyRegistrepnl').fadeOut("slow"); $('.Activatepanel').fadeIn("slow"); $('.Activateresend').css("display", "block"); $('#divemlact').fadeOut("slow"); $('#divphnact').fadeIn("slow"); if (CheckedValue == "Email") { document.getElementById("lnkresendmail").innerHTML = "Resend Activation Email"; document.getElementById("lnkresendtext").innerHTML = ""; } else { document.getElementById("lnkresendtext").innerHTML = "Resend Activation Text Message"; document.getElementById("lnkresendmail").innerHTML = ""; } } else if (msg.d == "Registered Successfully.. Please check email and mobile to activate your account") { $('.CompanyRegistrepnl').fadeOut("slow"); $('.Activatepanel').fadeIn("slow"); $('#divemlact').fadeIn("slow"); $('#divphnact').fadeIn("slow"); $('.Activateresend').css("display", "block"); document.getElementById("lnkresendmail").innerHTML = "Resend Activation Email"; document.getElementById("lnkresendtext").innerHTML = "Resend Activation Text Message"; } else if (msg.d == "phone number already used") { $("#CompanyRegistrepnl").fadeOut("fast"); $("#signinpanel").fadeIn("fast"); $("#lblMsg12").fadeIn("fast"); document.getElementById("txtEmail").value = UserPhoneno; document.getElementById("lblMsg12").innerHTML = "This phone already exist in our system. Please sign in or, if you forgot your password, reset it."; } else { $('.createaccountloader').css("display", "none"); if (msg.d == "Please choose at least one") { document.getElementById('lblchkmsg').style.display = "block"; document.getElementById('lblchkmsg').innerHTML = "Please select a way to activate your account through text, email, or both... you should do both, just saying."; $("#regerror").fadeOut(); } else if (msg.d == "This email has already been registered, use forgot password to access account information... Happens to the best of us.") { $("#CompanyRegistrepnl").fadeOut("fast"); $("#signinpanel").fadeIn("fast"); $("#lblMsg12").fadeIn("fast"); document.getElementById("txtEmail").value = UserName; document.getElementById("lblMsg12").innerHTML = "This email already exist in our system. Please sign in or, if you forgot your password, reset it."; } else { $("#regerror").fadeIn(); $('.createaccountloader').css("display", "none"); document.getElementById("regerror").innerHTML = msg.d; $("#lblchkmsg").fadeOut(); } } } }); } function ConfirmNo() { $("#regerror").fadeIn(); if (document.getElementById("regerror").innerHTML == "This email has already been registered, use forgot password to access account information... Happens to the best of us.") document.getElementById("regerror").innerHTML = "Register with some other email"; else document.getElementById("regerror").innerHTML = "Register with some other phone number"; $(".RegErrorPopup").css("display", "none"); } function Sendforgetpwd() { $('.createaccountloader').css("display", "block"); document.getElementById('txtEId').value = document.getElementById('txtUserEmail').value; $(".RegErrorPopup").css("display", "none"); forgetpasswordsubmit(); } function Regclose() { $(".RegErrorPopup").css("display", "none"); } </script> <script type="text/javascript"> function Addreview() { $(".lblsuccess").css("display", "none"); document.getElementById('lblsuccess').innerHTML = ""; $(".ReviewsLoader").css("display", "block"); ReviewsData(); $(".ViewReviews").css("margin-top", $(document).scrollTop() - 0); $(".ViewReviews").css("display", "block"); document.getElementById('Addreviewspanel').style.display = "none"; $(".reviewsleft").removeAttr('style'); } function AddreviewClose() { $(".lblsuccess").css("display", "none"); document.getElementById('lblsuccess').innerHTML = ""; document.getElementById('Addreviewspanel').style.display = "none"; $(".lblDeliveryServicesuccess").css("display", "none"); document.getElementById('lblDeliveryServicesuccess').innerHTML = ""; document.getElementById('PnlDeliveryService').style.display = "none"; } function SubmitReview() { $(".ReviewLoader").css("display", "block"); var UId = document.getElementById("UserId").innerHTML; var AppId = document.getElementById('lblAppId1').value; var LId = document.getElementById('lblLId').value; var UserReview = document.getElementById('txtreviewadd').value; var UserRating = document.getElementById("Rating1_RatingExtender_ClientState").value; var PageName = "Orders Page"; var myFile = document.getElementById("reviewupload"); $(".lblsuccess").css("display", "none"); document.getElementById('lblsuccess').innerHTML = ""; if (UId != "" && UId != null) { var UserRating = document.getElementById("Rating1_RatingExtender_ClientState").value; if (UserRating != 0 && UserRating != "" && UserRating != null) { if (myFile.files[0] != null) { var ImageData = myFile.files[0]; var FReader = new FileReader(); FReader.onload = function (e) { var Image = e.target.result; var UId = document.getElementById("UserId").innerHTML; var AppId = document.getElementById('lblAppId1').value; var LId = document.getElementById('lblLId').value; var UserReview = document.getElementById('txtreviewadd').value; var UserRating = document.getElementById("Rating1_RatingExtender_ClientState").value; if (UserRating > 0) { $.ajax({ type: "POST", url: "orders.aspx/PostReview", data: "{'AppId': '" + AppId + "','UserId': '" + UId + "','Option': '" + UserRating + "','TextOption': '" + UserReview + "','LId': '" + LId + "','ImageData':'" + Image + "','PageName':'" + PageName + "' }", dataType: "json", async: true, contentType: "application/json", success: function (msg) { if (msg.d == "Already Exist") { if (confirm("You reviewed this restaurant already. Would you like to update your review?")) { $.ajax({ type: "POST", url: "orders.aspx/UpdateReviews", data: "{'AppId': '" + AppId + "','UserId': '" + UId + "','Option': '" + UserRating + "','TextOption': '" + UserReview + "','LId': '" + LId + "','ImageData':'" + Image + "' }", dataType: "json", async: true, contentType: "application/json", success: function (msg) { $(".lblsuccess").css("display", "block"); document.getElementById('lblsuccess').innerText = msg.d; document.getElementById('Addreviewspanel').style.display = "none"; document.getElementById('txtreviewadd').value = ""; document.getElementById("Rating1_RatingExtender_ClientState").value = 0; $find("myRBID").set_Rating(0); ReviewsData(); $(".ViewReviews").css("display", "block"); $(".ReviewLoader").css("display", "none"); SendReviewNotification(AppId, LId, UId, UserRating, "Update") } }); } else { document.getElementById('Addreviewspanel').style.display = "none"; $(".ViewReviews").css("display", "block"); $(".ReviewLoader").css("display", "none"); } } else { $(".lblsuccess").css("display", "block"); document.getElementById('lblsuccess').innerText = msg.d; document.getElementById('Addreviewspanel').style.display = "none"; document.getElementById('txtreviewadd').value = ""; document.getElementById("Rating1_RatingExtender_ClientState").value = 0; $find("myRBID").set_Rating(0); ReviewsData(); $(".ViewReviews").css("display", "block"); $(".ReviewLoader").css("display", "none"); SendReviewNotification(AppId, LId, UId, UserRating, "Insert") } } }); } else { $(".ReviewLoader").css("display", "none"); $(".lblerrorreview").css("display", "block"); document.getElementById('lblerrorreview').innerHTML = "Please select atleast one Rating"; setTimeout("HideLabel();", 10000); } } FReader.readAsDataURL(myFile.files[0]); } else { var UId = document.getElementById("UserId").innerHTML; var AppId = document.getElementById('lblAppId1').value; var LId = document.getElementById('lblLId').value; var UserReview = document.getElementById('txtreviewadd').value; var UserRating = document.getElementById("Rating1_RatingExtender_ClientState").value; var Image = ""; if (UserRating > 0) { $.ajax({ type: "POST", url: "orders.aspx/PostReview", data: "{'AppId': '" + AppId + "','UserId': '" + UId + "','Option': '" + UserRating + "','TextOption': '" + UserReview + "','LId': '" + LId + "','ImageData':'" + Image + "','PageName':'" + PageName + "' }", dataType: "json", async: true, contentType: "application/json", success: function (msg) { if (msg.d == "Already Exist") { if (confirm("You reviewed this restaurant already. Would you like to update your review?")) { $.ajax({ type: "POST", url: "orders.aspx/UpdateReviews", data: "{'AppId': '" + AppId + "','UserId': '" + UId + "','Option': '" + UserRating + "','TextOption': '" + UserReview + "','LId': '" + LId + "','ImageData':'" + ImageData + "' }", dataType: "json", async: true, contentType: "application/json", success: function (msg) { $(".lblsuccess").css("display", "block"); document.getElementById('lblsuccess').innerText = msg.d; document.getElementById('Addreviewspanel').style.display = "none"; document.getElementById('txtreviewadd').value = ""; document.getElementById("Rating1_RatingExtender_ClientState").value = 0; $find("myRBID").set_Rating(0); ReviewsData(); $(".ViewReviews").css("display", "block"); $(".ReviewLoader").css("display", "none"); SendReviewNotification(AppId, LId, UId, UserRating, "Update") } }); } else { document.getElementById('Addreviewspanel').style.display = "none"; $(".ViewReviews").css("display", "block"); $(".ReviewLoader").css("display", "none"); } } else { $(".lblsuccess").css("display", "block"); document.getElementById('lblsuccess').innerText = msg.d; document.getElementById('Addreviewspanel').style.display = "none"; document.getElementById('txtreviewadd').value = ""; document.getElementById("Rating1_RatingExtender_ClientState").value = 0; $find("myRBID").set_Rating(0); ReviewsData(); $(".ViewReviews").css("display", "block"); $(".ReviewLoader").css("display", "none"); SendReviewNotification(AppId, LId, UId, UserRating, "Insert") } } }); } else { $(".ReviewLoader").css("display", "none"); $(".lblerrorreview").css("display", "block"); document.getElementById('lblerrorreview').innerHTML = "Please select atleast one Rating"; setTimeout("HideLabel();", 10000); } } } else { $(".ReviewLoader").css("display", "none"); $(".lblerrorreview").css("display", "block"); document.getElementById('lblerrorreview').innerHTML = "Give atleast one Rating"; setTimeout("HideLabel();", 5000); } } else { $(".signinpanel").fadeIn("slow"); $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); } } function SendReviewNotification(AppId, LocationId, UserId, Rating, Type) { $.ajax({ type: "POST", url: "orders.aspx/ReviewNotification", data: "{'AppId': '" + AppId + "','UserId': '" + UserId + "','Rating': '" + Rating + "','LId': '" + LocationId + "','Type':'" + Type + "'}", dataType: "json", async: true, contentType: "application/json", success: function (msg) { } }); } function HideLabel() { document.getElementById('lblerrorreview').style.display = "none"; document.getElementById('lblDeliveryServiceerrorreview').style.display = "none"; } function AddUsersReview() { //$(".signinpanel").css("position", "inherit"); var UId = document.getElementById("UserId").innerHTML; var AppId = document.getElementById('lblAppId1').value; var LId = document.getElementById('lblLId').value; if (UId != "" && UId != null) { $.ajax({ type: "POST", url: "orders.aspx/GetLocationuserreview", data: "{'AppId': '" + AppId + "','UserId': '" + UId + "','LocationId':'" + LId + "' }", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { var rating = msg.d[0].Rating; document.getElementById("Rating1_A").title = rating; if (rating == 1) { $("#Rating1_Star_1").addClass("rating_filled"); $("#Rating1_Star_1").removeClass("rating_empty"); } else if (rating == 2) { $("#Rating1_Star_1").addClass("rating_filled"); $("#Rating1_Star_1").removeClass("rating_empty"); $("#Rating1_Star_2").addClass("rating_filled"); $("#Rating1_Star_2").removeClass("rating_empty"); } else if (rating == 3) { $("#Rating1_Star_1").addClass("rating_filled"); $("#Rating1_Star_1").removeClass("rating_empty"); $("#Rating1_Star_2").addClass("rating_filled"); $("#Rating1_Star_2").removeClass("rating_empty"); $("#Rating1_Star_3").addClass("rating_filled"); $("#Rating1_Star_3").removeClass("rating_empty"); } else if (rating == 4) { $("#Rating1_Star_1").addClass("rating_filled"); $("#Rating1_Star_1").removeClass("rating_empty"); $("#Rating1_Star_2").addClass("rating_filled"); $("#Rating1_Star_2").removeClass("rating_empty"); $("#Rating1_Star_3").addClass("rating_filled"); $("#Rating1_Star_3").removeClass("rating_empty"); $("#Rating1_Star_4").addClass("rating_filled"); $("#Rating1_Star_4").removeClass("rating_empty"); } else if (rating == 5) { $("#Rating1_Star_1").addClass("rating_filled"); $("#Rating1_Star_1").removeClass("rating_empty"); $("#Rating1_Star_2").addClass("rating_filled"); $("#Rating1_Star_2").removeClass("rating_empty"); $("#Rating1_Star_3").addClass("rating_filled"); $("#Rating1_Star_3").removeClass("rating_empty"); $("#Rating1_Star_4").addClass("rating_filled"); $("#Rating1_Star_4").removeClass("rating_empty"); $("#Rating1_Star_5").addClass("rating_filled"); $("#Rating1_Star_5").removeClass("rating_empty"); } document.getElementById("Rating1_RatingExtender_ClientState").value = msg.d[0].Rating; document.getElementById('txtreviewadd').value = msg.d[0].Description; document.getElementById('txtreviewadd').innerHTML = msg.d[0].Description; if (msg.d[0].UserImages != null && msg.d[0].UserImages != "") { document.getElementById("ReviewUserImages").innerHTML = ""; $("#ReviewUserImages").css("height", "70px"); for (i = 0; i < msg.d[0].UserImages.length; i++) { var elemdiv = document.createElement("div"); elemdiv.setAttribute("style", "width:80px;height:80px;float:left;margin-left:2%;"); var elemdiv1 = document.createElement("div"); elemdiv1.setAttribute("style", "height:28px;position: absolute;margin-left: 62px;cursor: pointer"); var elemdiv2 = document.createElement("div"); elemdiv2.setAttribute("style", "text-align: center;"); var elemdel = document.createElement("img"); elemdel.setAttribute("src", "images/IconCloseWindow.png"); elemdel.setAttribute("alt", "Close"); elemdel.setAttribute("class", "deleteimagebutton"); elemdel.setAttribute("id", msg.d[0].UserImages[i].ImageId); elemdel.setAttribute("style", "float:right;height:20px;"); elemdel.setAttribute("onclick", "deletereviewImage_onClick(this);"); elemdiv1.appendChild(elemdel); var elem = document.createElement("img"); elem.setAttribute("src", msg.d[0].UserImages[i].UserImage); elem.setAttribute("class", "Image"); elem.setAttribute("style", "width:auto;height:auto;height:80px;width:80px;border-width:6px;border-color:White;margin-left:5px;margin-right:5px;margin-bottom:5px"); elemdiv2.appendChild(elem); elemdiv.appendChild(elemdiv1); elemdiv.appendChild(elemdiv2); document.getElementById("ReviewUserImages").appendChild(elemdiv); } } else { $("#ReviewUserImages").css("height", "0px"); document.getElementById("ReviewUserImages").innerHTML = ""; } } $(".Addreviewspanel").css("display","block"); document.getElementById('ViewReviews').style.display = "none"; $(".lblsuccess").css("display", "none"); document.getElementById('lblsuccess').innerHTML = ""; } }); } else { $(".signinpanel").fadeIn("slow"); //$(".signinpanel").css("position","relative"); $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); } } function deletereviewImage_onClick(Id) { var ImageId = $(Id).attr("id"); ImageId = escape(ImageId); var AppId = document.getElementById('lblAppId1').value; $.ajax({ type: "POST", url: "orders.aspx/DeleteUserImage", data: "{'ImageId': '" + ImageId + "','AppId': '" + AppId + "' }", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "Delete Successfully") { var UId = document.getElementById("UserId").innerHTML; var LId = document.getElementById('lblLId').value; $.ajax({ type: "POST", url: "orders.aspx/GetUserReviewImages", data: "{'AppId': '" + AppId + "','UserId': '" + UId + "','LocationId':'" + LId + "' }", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "" && msg.d != null && msg.d.count != 0) { if (msg.d[0].UserImages != null && msg.d[0].UserImages != "") { $("#ReviewUserImages").css("height", "70px"); document.getElementById("ReviewUserImages").innerHTML = ""; for (i = 0; i < msg.d[0].UserImages.length; i++) { var elemdiv = document.createElement("div"); elemdiv.setAttribute("style", "width:80px;height:80px;float:left;margin-left:2%;"); var elemdiv1 = document.createElement("div"); elemdiv1.setAttribute("style", "height:28px;position: absolute;margin-left: 58px"); var elemdiv2 = document.createElement("div"); elemdiv2.setAttribute("style", "text-align: center;"); var elemdel = document.createElement("img"); elemdel.setAttribute("src", "images/IconCloseWindow.png"); elemdel.setAttribute("alt", "Close"); elemdel.setAttribute("class", "deleteimagebutton"); elemdel.setAttribute("id", msg.d[0].UserImages[i].ImageId); elemdel.setAttribute("style", "float:right;height:20px;"); elemdel.setAttribute("onclick", "deletereviewImage_onClick(this);"); elemdiv1.appendChild(elemdel); var elem = document.createElement("img"); elem.setAttribute("src", msg.d[0].UserImages[i].UserImage); elem.setAttribute("class", "Image"); elem.setAttribute("style", "width:auto;height:auto;height:80px;width:80px;border-width:6px;border-color:White;margin-left:5px;margin-right:5px;margin-bottom:5px"); elemdiv2.appendChild(elem); elemdiv.appendChild(elemdiv1); elemdiv.appendChild(elemdiv2); document.getElementById("ReviewUserImages").appendChild(elemdiv); } } } else { $("#ReviewUserImages").css("height", "0px"); document.getElementById("ReviewUserImages").innerHTML = ""; } } }); } } }); } function viewreviewClose() { document.getElementById('ViewReviews').style.display = "none"; $(".lblsuccess").css("display", "none"); document.getElementById('lblsuccess').innerHTML = ""; document.getElementById('ViewDeliveryServiceReviews').style.display = "none"; $(".lblDeliveryServicesuccess").css("display", "none"); document.getElementById('lblDeliveryServicesuccess').innerHTML = ""; } function ViewFavoritesClose() { document.getElementById('ViewFavorites').style.display = "none"; $(".lblsuccess").css("display", "none"); document.getElementById('lblsuccess').innerHTML = ""; } function viewspecialClose() { document.getElementById('ViewSpecials').style.display = "none"; } function FavoritesData() { var UId = document.getElementById("UserId").innerHTML; var AppName = escape(document.getElementById('lblAppName').innerHTML); var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; if (UId != null && UId != "") { document.getElementById('FavoritesTable').innerHTML = ""; var LId = document.getElementById('lblLId').value; $.ajax({ type: "POST", url: "orders.aspx/GetFavorites", data: "{'LId': '" + LId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById('FavoritesTable').innerHTML = ""; if (msg.d.length > 0) { for (i = 0; i < msg.d.length; i++) { var DateRow = document.createElement("tr"); var DateCell = document.createElement("td"); var Alltable = document.createElement("table"); setAttributes(Alltable, { "style": "width:100%;border-bottom: 1px solid #f1f1f1;padding-bottom: 15px;padding-top: 10px;" }); var Imagetr = document.createElement("tr"); var Imagetd = document.createElement("td"); setAttributes(Imagetd, { "style": "width:30%;" }); var Image = document.createElement("img"); if (msg.d[i].UserImage != "" && msg.d[i].UserImage != null) { setAttributes(Image, { "src": msg.d[i].UserImage, "width": "80px", "height": "95px" }); } else { setAttributes(Image, { "src": "https://www.munchem.com/images/imagenotavailable.png", "width": "80px", "height": "95px", "alt": "User Image Not Available" }); } Imagetd.appendChild(Image); var Alltd = document.createElement("td"); setAttributes(Alltd, { "style": "text-align:left;" }); var Nametable = document.createElement("table"); var Nametr = document.createElement("tr"); var Nametd = document.createElement("td"); setAttributes(Nametd, { "style": "color:black;" }); var UserName = document.createElement("span"); setAttributes(UserName, { "style": "font-weight: bold;font-size: 12pt;" }); UserName.innerHTML = msg.d[i].UserName; Nametd.appendChild(UserName); Nametr.appendChild(Nametd); var datetr = document.createElement("tr"); var datetd = document.createElement("td"); setAttributes(datetd, { "style": "color:black;padding-top: 11px;" }); var date = document.createElement("span"); date.innerHTML = msg.d[i].CreatedDate; datetd.appendChild(date); datetr.appendChild(datetd); Nametable.appendChild(Nametr); Nametable.appendChild(datetr); Alltd.appendChild(Nametable); Imagetr.appendChild(Imagetd); Imagetr.appendChild(Alltd); Alltable.appendChild(Imagetr); DateCell.appendChild(Alltable); DateRow.appendChild(DateCell); document.getElementById('FavoritesTable').appendChild(DateRow); } $('#ViewFavorites').fadeIn("slow"); $(".ReviewsLoader").css("display", "none"); } else { $(".ReviewsLoader").css("display", "none"); $(".lblsuccess").css("display", "block"); document.getElementById('lblsuccess').innerHTML = "No Reviews Yet!"; } document.getElementById('Addreviewspanel').style.display = "none"; } } ); } else { $(".signinpanel").fadeIn("slow"); $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); } } function ReviewsData() { document.getElementById('reviewstable').innerHTML = ""; var AppId = document.getElementById('lblAppId1').value; var LId = document.getElementById('lblLId').value; $.ajax({ type: "POST", url: "orders.aspx/GetReviews", data: "{'AppId': '" + AppId + "','LId': '" + LId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById('reviewstable').innerHTML = ""; if (msg.d.length > 0) { for (i = 0; i < msg.d.length; i++) { var DateRow = document.createElement("tr"); var DateCell = document.createElement("td"); var Namediv = document.createElement("div"); var Nametable = document.createElement("table"); setAttributes(Nametable, { "style": "width:100%;" }); var Nametr = document.createElement("tr"); var Nametd = document.createElement("td"); setAttributes(Nametd, { "style": "text-align:left;color:black" }); var UserName = document.createElement("span"); setAttributes(UserName, { "style": "font-weight: bold;font-size: 12pt;" }); UserName.innerHTML = msg.d[i].UserName; Nametd.appendChild(UserName); var datetd = document.createElement("td"); setAttributes(datetd, { "style": "text-align:right;color:black" }); var date = document.createElement("span"); date.innerHTML = msg.d[i].CreatedDate; datetd.appendChild(date); Nametr.appendChild(Nametd); Nametr.appendChild(datetd); Nametable.appendChild(Nametr); Namediv.appendChild(Nametable); var ReviewData = document.createElement("div"); var Rtable = document.createElement("table"); setAttributes(Rtable, { "style": "width:100%;" }); var rtr = document.createElement("tr"); var rtd = document.createElement("td"); var rimage = document.createElement("img"); if (msg.d[i].UserImage != "" && msg.d[i].UserImage != null) setAttributes(rimage, { "src": msg.d[i].UserImage, "width": "80px", "height": "95px" }); else setAttributes(rimage, { "src": "https://www.munchem.com/images/imagenotavailable.png", "width": "80px", "height": "95px", "alt": "User Image Not available" }); rtd.appendChild(rimage); setAttributes(rtd, { "style": "width:18%;" }); var reviewtd = document.createElement("td"); var subrtable = document.createElement("table"); setAttributes(subrtable, { "style": "width:100%;" }); var subraddtr = document.createElement("tr"); var subaddtd = document.createElement("td"); var subadd = document.createElement("span"); setAttributes(subadd, { "style": "margin-left:7%;" }); if (msg.d[i].Address != null) subadd.innerHTML = msg.d[i].Address; subaddtd.appendChild(subadd); subaddtd.setAttribute("style", "text-align: left;color: black;"); subraddtr.appendChild(subaddtd); var subrrevtr = document.createElement("tr"); var RatingCell = document.createElement("td"); setAttributes(RatingCell, { "style": "padding-top: 20px;" }); var img1 = document.createElement("img"); var img2 = document.createElement("img"); var img3 = document.createElement("img"); var img4 = document.createElement("img"); var img5 = document.createElement("img"); if (msg.d[i].OptionName == 0 || msg.d[i].OptionName == null) { setAttributes(img1, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;margin-left: 10px;", "alt": "Normal Rating" }); setAttributes(img2, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img3, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;;", "alt": "Normal Rating" }); setAttributes(img4, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img5, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); } else if (msg.d[i].OptionName == 1) { setAttributes(img1, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;margin-left: 10px;", "alt": "Rating Over" }); setAttributes(img2, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img3, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;;", "alt": "Normal Rating" }); setAttributes(img4, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img5, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); } else if (msg.d[i].OptionName == 2) { setAttributes(img1, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;margin-left: 10px;", "alt": "Rating Over" }); setAttributes(img2, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img3, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img4, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img5, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); } else if (msg.d[i].OptionName == 3) { setAttributes(img1, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;margin-left: 10px;", "alt": "Rating Over" }); setAttributes(img2, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img3, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img4, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); setAttributes(img5, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); } else if (msg.d[i].OptionName == 4) { setAttributes(img1, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;margin-left: 10px;", "alt": "Rating Over" }); setAttributes(img2, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img3, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img4, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img5, { "src": "images/RatingNormal.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Normal Rating" }); } else if (msg.d[i].OptionName == 5) { setAttributes(img1, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;margin-left: 10px;", "alt": "Rating Over" }); setAttributes(img2, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img3, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img4, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); setAttributes(img5, { "src": "images/RatingOver.png", "style": "width:25px;height:25px;margin-right:10px;", "alt": "Rating Over" }); } RatingCell.appendChild(img1); RatingCell.appendChild(img2); RatingCell.appendChild(img3); RatingCell.appendChild(img4); RatingCell.appendChild(img5); subrrevtr.appendChild(RatingCell); var OptionRow = document.createElement("tr"); var OptionCell = document.createElement("td"); var OptionText = document.createElement("span"); if (msg.d[i].TextOption != null && msg.d[i].TextOption != "") OptionText.innerHTML = msg.d[i].TextOption; setAttributes(OptionCell, { "colspan": "2", "style": "color: black;padding: 10px 0px;line-height: 1.4;" }); setAttributes(OptionText, { "style": "float:left;text-align: left;margin-left:7%;" }); OptionCell.appendChild(OptionText); OptionRow.appendChild(OptionCell); subrtable.appendChild(subraddtr); subrtable.appendChild(subrrevtr); subrtable.appendChild(OptionRow); reviewtd.appendChild(subrtable); rtr.appendChild(rtd); rtr.appendChild(reviewtd); var Imagestr = document.createElement("tr"); var imagetd1 = document.createElement("td"); var Imagetd2 = document.createElement("td"); var ImagesDiv = document.createElement("div"); ImagesDiv.setAttribute("id", "allReviewImagesDiv"); if (msg.d[i].UserReviewImages.count != 0 && msg.d[i].UserReviewImages != null && msg.d[i].UserReviewImages != "") { ImagesDiv.setAttribute("style", "height:87px;"); if (msg.d[i].UserReviewImages.count > 4) Imagetd2.setAttribute("style", "overflow-x: scroll;"); else Imagetd2.setAttribute("style", "overflow-x: auto;"); for (var o = 0; o < msg.d[i].UserReviewImages.length; o++) { if (msg.d[i].UserReviewImages[o].UserImage != null) { var elemdiv = document.createElement("div"); elemdiv.setAttribute("style", "width:80px;height:80px;float:left;margin-left:2%;"); var elemdiv2 = document.createElement("div"); elemdiv2.setAttribute("style", "text-align: center;"); var elem = document.createElement("img"); elem.setAttribute("src", msg.d[i].UserReviewImages[o].UserImage); elem.setAttribute("class", "Image"); elem.setAttribute("style", "width:auto;height:auto;height:80px;width:80px;border-width:6px;border-color:White;margin-left:5px;margin-right:5px;margin-bottom:5px"); elemdiv2.appendChild(elem); elemdiv.appendChild(elemdiv2); ImagesDiv.appendChild(elemdiv); } } } else ImagesDiv.setAttribute("style", "height:0px;"); Imagetd2.appendChild(ImagesDiv); Imagestr.appendChild(imagetd1); Imagestr.appendChild(Imagetd2); Rtable.appendChild(rtr); Rtable.appendChild(Imagestr); ReviewData.appendChild(Rtable); DateCell.appendChild(Namediv); DateCell.appendChild(ReviewData); setAttributes(Namediv, { "style": "padding-top:2px;;" }); setAttributes(ReviewData, { "style": "border-bottom:2px solid #7f7f7f;padding-bottom: 8px;" }); DateRow.appendChild(DateCell); document.getElementById('reviewstable').appendChild(DateRow); } $(".ReviewsLoader").css("display", "none"); } else { $(".ReviewsLoader").css("display", "none"); $(".lblsuccess").css("display", "block"); document.getElementById('lblsuccess').innerHTML = "No Reviews Yet!"; } document.getElementById('Addreviewspanel').style.display = "none"; } }); } function AutoApplyStorageCouponCode() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var LocationId = document.getElementById('lblLId').value; var PromoEnteredData = localStorage.getItem("PromoEntered"); if (PromoEnteredData != "") { var Table = JSON.parse(PromoEnteredData); if (Table != null) { if (Table.length > 0) { if (LocationId == Table[0].LocationId) { if (Table[0].PromoCode == document.getElementById('Promocodetxt').value) { document.getElementById('Promocodetxt').value = unescape(Table[0].PromoCode); if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} } else { var promoArray = new Array(); var addr = new Object(); addr.LocationId = LocationId; addr.PromoCode = unescape(Table[0].PromoCode); promoArray.push(addr); localStorage.removeItem("PromoEntered"); localStorage.setItem("PromoEntered", JSON.stringify(promoArray)); if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} } } else { var promoArray = new Array(); var addr = new Object(); addr.LocationId = LocationId; addr.PromoCode = unescape(Table[0].PromoCode); promoArray.push(addr); localStorage.removeItem("PromoEntered"); localStorage.setItem("PromoEntered", JSON.stringify(promoArray)); if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} } } } } } function StorageCouponCode() { var LocationId = document.getElementById('lblLId').value; var PromoCode = escape(document.getElementById('Promocodetxt').value); var promoArray = new Array(); var addr = new Object(); addr.LocationId = LocationId; addr.PromoCode = PromoCode; promoArray.push(addr); localStorage.removeItem("PromoEntered"); localStorage.setItem("PromoEntered", JSON.stringify(promoArray)); //GetDeal(); NewGetDeal(); } function GetDeal() { var LocationId = document.getElementById('lblLId').value; var PromoEnteredData = localStorage.getItem("PromoEntered"); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var isCouponlen = 0; if (PromoEnteredData != "") { var Table = JSON.parse(PromoEnteredData); if (Table != null) { if (Table.length > 0) { if (LocationId == Table[0].LocationId) { var StorageLocationId = ""; var PromoCode = escape(document.getElementById('Promocodetxt').value); var SubTotal = 0; var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); var arr = new Array(); var CouponFor = 1; var ItemTotal = 0; if (PromoCode != "" && PromoCode != null && PromoCode != undefined) { $.ajax({ type: "POST", url: "orders.aspx/GetPromodetails", data: "{'PromoCode':'" + PromoCode + "','LocationId':'" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { isCouponlen = msg.d.length; if (msg.d.length > 0) { CouponFor = msg.d[0].IncludemenuType; if (msg.d[0].IncludemenuType == 1) { if (AddedItems != null) { if (AddedItems.length > 0) { StorageLocationId = AddedItems[0].LId; for (var w = 0; w < AddedItems.length; w++) { if (AddedItems[w].OfferName != null) SubTotal = +SubTotal + +(parseFloat(AddedItems[w].Price) - parseFloat(AddedItems[w].OfferValue)); else SubTotal = +SubTotal + +AddedItems[w].Price; arr[w] = { Id: AddedItems[w].Id }; ItemTotal = +ItemTotal + +AddedItems[w].Price; } } } } else { var List = ""; if (msg.d[0].ItemList != null) { if (msg.d[0].ItemList.length > 0) { for (var a = 0; a < msg.d[0].ItemList.length; a++) { if (List == "") { List = msg.d[0].ItemList[a].MenuId; } else { List = List + "," + msg.d[0].ItemList[a].MenuId; } } } } if (List != "") { var n; if (msg.d[0].IncludemenuType == 2) { if (AddedItems != null) { if (AddedItems.length > 0) { StorageLocationId = AddedItems[0].LId; for (var w = 0; w < AddedItems.length; w++) { if (AddedItems[w].OfferName != null) { ItemTotal = +ItemTotal + +(parseFloat(AddedItems[w].Price) - parseFloat(AddedItems[w].OfferValue)); } else { n = List.includes(AddedItems[w].ItemCategoryId); if (n == true) { SubTotal = +SubTotal + +AddedItems[w].Price; } else { n = List.includes(AddedItems[w].SubcategoryId); if (n == true) { SubTotal = +SubTotal + +AddedItems[w].Price; } else { n = List.includes(AddedItems[w].SubSubcategoryId); if (n == true) { SubTotal = +SubTotal + +AddedItems[w].Price; } } } ItemTotal = +ItemTotal + +AddedItems[w].Price; } arr[w] = { Id: AddedItems[w].Id }; } } } } else if (msg.d[0].IncludemenuType == 3) { if (AddedItems != null) { if (AddedItems.length > 0) { StorageLocationId = AddedItems[0].LId; for (var w = 0; w < AddedItems.length; w++) { if (AddedItems[w].OfferName != null) { ItemTotal = +ItemTotal + +(parseFloat(AddedItems[w].Price) - parseFloat(AddedItems[w].OfferValue)); } else { n = List.includes(AddedItems[w].Id); if (n == true) { SubTotal = +SubTotal + +AddedItems[w].Price; } ItemTotal = +ItemTotal + +AddedItems[w].Price; } arr[w] = { Id: AddedItems[w].Id }; } } } } } else { if (ItemTotal == 0) { if (AddedItems != null) { if (AddedItems.length > 0) { StorageLocationId = AddedItems[0].LId; for (var w = 0; w < AddedItems.length; w++) { if (AddedItems[w].OfferName != null) ItemTotal = +ItemTotal + +(parseFloat(AddedItems[w].Price) - parseFloat(AddedItems[w].OfferValue)); else { ItemTotal = +ItemTotal + +AddedItems[w].Price; SubTotal = +SubTotal + +AddedItems[w].Price; } arr[w] = { Id: AddedItems[w].Id }; } } } } } } } if (StorageLocationId == LocationId || StorageLocationId == "") { var AppId = document.getElementById('lblAppId1').value; var Total = document.getElementById("lblTotalPriceforPromos").innerHTML; var UId = document.getElementById("UserId").innerHTML; var Site = location.host; var OrderType = localStorage.getItem("OrderType"); var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.selectedIndex != -1) { OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].value; } else { if (OrderType == "Delivery") OrderType = "Delivery"; else if (OrderType == "Shipping") OrderType = "Shipping"; else OrderType = "Pickup"; } if (Site == "localhost:27746" || Site == "107.130.183.186:8064" || Site == "www.munchem.com" || Site == "64.37.50.50") Site = "MunchEm Website/App"; else if (Site == "touristeats.com" || Site == "216.239.163.155:874") Site = "TouristEats.com"; else Site = "Restaurant Website/App"; var RawOffset = document.getElementById('lblrawoffset').innerHTML; if (AddedItems != null) { if (AddedItems.length > 0) { if (document.getElementById("Promocodetxt").value != "" && SubTotal > 0 && Total != "") { $.ajax({ type: "POST", url: "orders.aspx/PromoValidations", data: "{'AppId': '" + AppId + "', 'PromoCode':'" + PromoCode + "','Total':'" + Total + "','SubTotal':'" + SubTotal + "','UId':'" + UId + "','LocationId':'" + LocationId + "' ,'Site':'" + Site + "', 'TimeZoneName':'" + document.getElementById('lbltimezonename').value + "','OrderType':'" + escape(OrderType) + "','RawOffset':'" + RawOffset + "','Items':'" + JSON.stringify(arr) + "', 'ItemTotal':'" + ItemTotal + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0].Action == "success") { document.getElementById("CouponType").innerHTML = msg.d[0].PromotionType; document.getElementById("lblRequireuseraccount").innerHTML = msg.d[0].Requireuseraccount; document.getElementById("lblPromoprice").innerHTML = msg.d[0].DiscountType + " Coupon Applied"; var UId = document.getElementById("UserId").innerHTML; if (UId == "") { $('.promovisible').css("display", "inline-block"); $('.discountCheckout').removeAttr("style"); if (msg.d[0].Requireuseraccount == true) document.getElementById("cartpromomsg").innerHTML = "*To use a Promo you must have an account"; $('.promcartuser').css("display", "block"); $('.charitytest').css("display", "none"); document.getElementById("Userfirstorderlbl").innerHTML = msg.d[0].UserFirstorder; if (parseInt(SubTotal) < parseInt(msg.d[0].DiscountAmount)) { //var tip = document.getElementById("txttip").value; //if (tip != null && tip != "" && tip != document.getElementById("lblCurrency").innerHTML + "0.00") { // BindPrices(0); //} document.getElementById("Promoprice").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + SubTotal.toFixed(2); document.getElementById("udpv").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + SubTotal.toFixed(2); } else { //var tip = document.getElementById("txttip").value; //if (tip != null && tip != "" && tip != document.getElementById("lblCurrency").innerHTML + "0.00") { // BindPrices(0); //} document.getElementById("Promoprice").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + msg.d[0].DiscountAmount; document.getElementById("udpv").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + msg.d[0].DiscountAmount; } mainPromocalculations(); document.getElementById("promotitle").innerHTML = msg.d[0].PromotionName; document.getElementById("udpt").innerHTML = msg.d[0].PromotionName; if (document.getElementById("Promotioncodeid").innerHTML == "") document.getElementById("Promotioncodeid").innerHTML = PromoCode; $('.promocodetext').css("display", "inline-block"); $(".getdealbtn").css("display", "inline-block"); //$(".getdealbtn").fadeOut("slow"); //alert("coupon code applied successfully"); } else { document.getElementById("Userfirstorderlbl").innerHTML = msg.d[0].UserFirstorder; $('.promcartuser').css("display", "none"); $('.charitytest').css("display", "none"); if (parseInt(SubTotal) < parseInt(msg.d[0].DiscountAmount)) { //var tip = document.getElementById("txttip").value; //if (tip != null && tip != "" && tip != document.getElementById("lblCurrency").innerHTML + "0.00") { // BindPrices(0); //} document.getElementById("Promoprice").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + SubTotal.toFixed(2); document.getElementById("udpv").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + SubTotal.toFixed(2) } else { //var tip = document.getElementById("txttip").value; //if (tip != null && tip != "" && tip != document.getElementById("lblCurrency").innerHTML + "0.00") { // BindPrices(0); //} document.getElementById("Promoprice").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + msg.d[0].DiscountAmount; document.getElementById("udpv").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + msg.d[0].DiscountAmount; } document.getElementById("promotitle").innerHTML = msg.d[0].PromotionName; document.getElementById("udpt").innerHTML = msg.d[0].PromotionName; var Userfirstorder = document.getElementById("Userfirstorderlbl").innerHTML; $.ajax({ type: "POST", type: "POST", url: "orders.aspx/PromocodeLimit", data: "{ 'UId':'" + UId + "','PromoCode':'" + PromoCode + "','AppId':'" + AppId + "','PromotionType':'" + msg.d[0].PromotionType + "','LocationId':'" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "ok") { document.getElementById("Promoprice").innerHTML = ""; document.getElementById("Promotioncodeid").innerHTML = ""; DeleteDeal(); $("#lblorderror").text(msg.d); $(".ordererror").show().delay(3000).fadeOut(); if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } else { mainPromocalculations(); $('.promovisible').css("display", "inline-block"); $('.discountCheckout').removeAttr("style"); $('.promocodetext').css("display", "inline-block"); $(".getdealbtn").css("display", "inline-block"); // $(".getdealbtn").fadeOut("slow"); } } }); } } else if (msg.d[0].Action == "success1") { $('.charitytest').css("display", "block"); document.getElementById("Userfirstorderlbl").innerHTML = msg.d[0].UserFirstorder; document.getElementById("promotitle").innerHTML = msg.d[0].PromotionName; document.getElementById("cartpromomsg1").innerHTML = "Thank You! A donation Of " + msg.d[0].NoOfUses + " will be made in your name to:" + msg.d[0].PromotionName; document.getElementById("charitylbl").innerHTML = "Thank You! A donation Of " + msg.d[0].NoOfUses + " will be made in your name to:" + msg.d[0].PromotionName; document.getElementById("charitylbl1").innerHTML = "Thank You! A donation Of " + msg.d[0].NoOfUses + " will be made in your name to:" + msg.d[0].PromotionName; document.getElementById("Promoprice").innerHTML = document.getElementById("lblCurrency").innerHTML + msg.d[0].DiscountAmount; document.getElementById("udpv").innerHTML = document.getElementById("lblCurrency").innerHTML + msg.d[0].DiscountAmount; document.getElementById("udpv").innerHTML = document.getElementById("lblCurrency").innerHTML + msg.d[0].DiscountAmount; document.getElementById("udpt").innerHTML = msg.d[0].PromotionName; document.getElementById("lblPromoprice").innerHTML = msg.d[0].DiscountType + " Coupon Applied "; //BindPrices(0); mainPromocalculations(); $('.promocodetext').css("display", "none"); $(".getdealbtn").css("display", "none"); $(".getdealbtn").fadeOut("slow"); $('.promovisible').css("display", "inline-block"); $('.discountCheckout').removeAttr("style"); $('.promcartuser').css("display", "none"); } else { if (msg.d[0].Action.indexOf('$')) { msg.d[0].Action = msg.d[0].Action.replace("$", document.getElementById("lblCurrency").innerHTML) } $("#lblorderror").text(msg.d[0].Action); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("Promoprice").innerHTML = ""; document.getElementById("Promotioncodeid").innerHTML = ""; DeleteDeal(); if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } else { $("#lblorderror").text("Invalid Promo/Coupon Code"); $(".ordererror").show().delay(3000).fadeOut(); if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } }); } else { if (SubTotal == 0) { if (AddedItems.length > 0) { if (CouponFor >= 1) { if (isCouponlen == 0) { $("#lblorderror").text("Coupon code does not exists."); } else { $("#lblorderror").text("Coupon not applicable for any one of added items"); } $(".ordererror").show().delay(3000).fadeOut(); localStorage.removeItem("PromoEntered"); $('.btnusingpromotion').css("display", "none"); document.getElementById("Promoprice").innerHTML = ""; $('.promovisible').css("display", "none"); $('.discountCheckout').css("display", "none"); $('.promcartuser').css("display", "none"); $('.promocodetext').css("display", "inline-block"); $(".getdealbtn").fadeIn("slow"); if (document.getElementById("lblAllowinstore").innerHTML == "true"){ $('#bntConfOrder').css("display", "block"); if (document.getElementById("lblCustomizedcash").innerHTML == "true"){ $('#mbntConfOrder').css("display", "block"); } } $('#Button6').css("display", "block"); $('.charitytest').css("display", "none"); document.getElementById("Promotioncodeid").innerHTML = ""; document.getElementById("charitylbl").innerHTML = ""; document.getElementById("promotitle").innerHTML = ""; document.getElementById("CouponType").innerHTML = ""; document.getElementById("lblRequireuseraccount").innerHTML = ""; document.getElementById("cartpromomsg").innerHTML = ""; } } } //$("#lblorderror").text("Invalid Coupon"); //$(".ordererror").show().delay(3000).fadeOut(); if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } } //else { // $("#lblorderror").text("Invalid Coupon"); // $(".ordererror").show().delay(3000).fadeOut(); // BindPrices(0); //} } else { $("#lblorderror").text("Sorry you are trying to place an order with multiple restaurants. Once refresh the page and try again"); $(".ordererror").show().delay(3000).fadeOut(); $(".userdeliveryloader1").fadeOut("fast"); return; } } }); } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } function NewGetDeal() { var PromoEnteredData = localStorage.getItem("PromoEntered"); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (PromoEnteredData != "") { var Table = JSON.parse(PromoEnteredData); if (Table != null) { if (Table.length > 0) { var LocationId = document.getElementById('lblLId').value; if (LocationId == Table[0].LocationId) { if (Table[0].PromoCode != null && Table[0].PromoCode != "") { $(".userdeliveryloader1").fadeOut("fast"); if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } return; } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } } } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } } } } } } function ValidateGiftCards() { var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; var Code = escape(document.getElementById('Promocodetxt').value); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var SubTotal = $('#lblAlltotalprice').text(); SubTotal = SubTotal.replace($('#lblCurrency').text(),"") $.ajax({ type: "POST", url: "orders.aspx/ValidateGiftCardCodes", data: "{'Code':'" + Code + "','LocationId':'" + LocationId + "','AppId':'" + AppId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { if (msg.d.length > 0) { if (msg.d[0].Action == "Success") { document.getElementById("CouponType").innerHTML = "GiftCard"; document.getElementById("lblRequireuseraccount").innerHTML = true; var UId = document.getElementById("UserId").innerHTML; if (UId == "") { document.getElementById("cartpromomsg").innerHTML = "*To use a Gift Card you must have an account"; } $('.promovisible').css("display", "inline-block"); $('.discountCheckout').removeAttr("style"); $('.promcartuser').css("display", "block"); $('.charitytest').css("display", "none"); // document.getElementById("Userfirstorderlbl").innerHTML = msg.d[0].UserFirstorder; if (parseInt(SubTotal) < parseInt(msg.d[0].Discount)) { document.getElementById("Promoprice").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + parseFloat(SubTotal).toFixed(2); document.getElementById("udpv").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + parseFloat(SubTotal).toFixed(2); } else { document.getElementById("Promoprice").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + msg.d[0].Discount.toFixed(2);; document.getElementById("udpv").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + msg.d[0].Discount.toFixed(2); } mainPromocalculations(); document.getElementById("promotitle").innerHTML = msg.d[0].CardName; document.getElementById("udpt").innerHTML = msg.d[0].CardName; if (document.getElementById("Promotioncodeid").innerHTML == "") document.getElementById("Promotioncodeid").innerHTML = Code; $('.promocodetext').css("display", "inline-block"); $(".getdealbtn").css("display", "inline-block"); if (UId != "") { $.ajax({ type: "POST", url: "orders.aspx/ValidateEmailOrPhone", data: "{ 'GiftCardCodeId':'" + msg.d[0].GiftCardCodeId + "','Email':'" + document.getElementById("txtguestdeliveryemail").value + "','Phone':'" + document.getElementById("lblPhoneno").innerHTML + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "ok") { document.getElementById("Promoprice").innerHTML = ""; document.getElementById("Promotioncodeid").innerHTML = ""; DeleteDeal(); $("#lblorderror").text(msg.d); $(".ordererror").show().delay(3000).fadeOut(); if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } else { mainPromocalculations(); $('.promovisible').css("display", "inline-block"); $('.discountCheckout').removeAttr("style"); $('.promocodetext').css("display", "inline-block"); $(".getdealbtn").css("display", "inline-block"); // $(".getdealbtn").fadeOut("slow"); } } }); } } else { $("#lblorderror").text(msg.d[0].Action); $(".ordererror").show().delay(3000).fadeOut(); DeleteDeal(); } } } } }); } function CheckDeal() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (document.getElementById("Promoprice").innerHTML == "") { $('.userdeliveryloader1').css("display", "block"); } if (document.getElementById("Promocodetxt").value != "") { StorageCouponCode(); } else { $('.userdeliveryloader1').css("display", "none"); $("#lblorderror").text("Please enter promo code"); $(".ordererror").show().delay(3000).fadeOut(); if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } function DeleteDeal() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; localStorage.removeItem("PromoEntered"); $('.btnusingpromotion').css("display", "none"); document.getElementById("Promoprice").innerHTML = ""; $('.promovisible').css("display", "none"); $('.discountCheckout').css("display", "none"); $('.promcartuser').css("display", "none"); $('.promocodetext').css("display", "inline-block"); $(".getdealbtn").fadeIn("slow"); if (document.getElementById("lblAllowinstore").innerHTML == "true") { $('#bntConfOrder').css("display", "block"); if (document.getElementById("lblCustomizedcash").innerHTML == "true") { $('#mbntConfOrder').css("display", "block"); } } $('#Button6').css("display", "block"); $('.charitytest').css("display", "none"); document.getElementById("Promotioncodeid").innerHTML = ""; document.getElementById("charitylbl").innerHTML = ""; document.getElementById("promotitle").innerHTML = ""; document.getElementById("CouponType").innerHTML = ""; document.getElementById("lblRequireuseraccount").innerHTML = ""; document.getElementById("cartpromomsg").innerHTML = ""; if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else{GetDeal();} } function addfavorite() { var UId = document.getElementById("UserId").innerHTML; var AppName = escape(document.getElementById('lblAppName').innerHTML); var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; var Image = document.getElementById("btnfavorite"); $('#btnfavorite').attr('disabled', 'disabled'); if (UId != null && UId != "") { $.ajax({ type: "POST", url: "orders.aspx/ExstingFavorite", data: "{'LocationId': '" + LocationId + "', 'UserId':'" + UId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.split(' ')[0] == "UnFavorite") { $.ajax({ type: "POST", url: "orders.aspx/PostFavorite", data: "{'LocationId': '" + LocationId + "', 'UserId':'" + UId + "','AppId': '" + AppId + "', 'AppName':'" + AppName + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "Successfully Inserted") { $("#btnfavorite").css("background-image", "images/fav%20grey.png"); $("#lblordsucc").text("Thanks for adding the restaurant as a favorite"); $(".ordersuccess").show().delay(3000).fadeOut(); $('#btnfavorite').removeAttr('disabled'); $.ajax({ type: "POST", url: "orders.aspx/PostFavoriteNotification", data: "{'LocationId': '" + LocationId + "', 'UserId':'" + UId + "','AppId': '" + AppId + "', 'AppName':'" + AppName + "'}", dataType: "json", contentType: "application/json", success: function (msg) { FavourateandRevies(); } }); } } }) } else if (msg.d.split(' ')[0] == "Favorite") { $.ajax({ type: "POST", url: "orders.aspx/DeleteFavorite", data: "{'WatchListId': '" + msg.d.split(' ')[1] + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "Removed Successfully") { $("#btnfavorite").css("background-image", "images/fav.png"); $("#lblordsucc").text("Favorite Removed Successfully"); $(".ordersuccess").show().delay(3000).fadeOut(); FavourateandRevies(); $('#btnfavorite').removeAttr('disabled'); } } }) } } }) } else { $(".signinpanel").fadeIn("slow"); $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); $('#btnfavorite').removeAttr('disabled'); } } function checkRestaurantOpenState() { var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; $.ajax({ type: "POST", url: "orders.aspx/CheckRestaurantOpenStatus", data: "{'LocationId': '" + LocationId + "','AppId':'" + AppId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "Close") { $.ajax({ type: "POST", url: "orders.aspx/CheckRestaurantFutureAvailability", data: "{'LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { alertify.set({ labels: { ok: "Ok" } }); if (msg.d == "true" || msg.d == "True") { } else { $("#lblordalert").text(document.getElementById("lblAppName").innerHTML.replace("&", "&") + " is closed at this time of day, please see our current operating hours. Meanwhile feel free to browse our selections."); $(".orderalert").fadeIn(); } } }); } } }); } function getOrdinalNum(n) { return (n > 0 ? ['th', 'st', 'nd', 'rd'][(n > 3 && n < 21) || n % 10 > 3 ? 0 : n % 10] : ''); } $('#dineinsettingspanel').keypress(function (e) { if (e.keyCode == '13') { $("#dineinbtn").click(); e.preventDefault(); e.stopPropagation(); } }); $('#UserDeliveryPanel').keypress(function (e) { if (e.keyCode == '13') { userdeliveryvalidation(); e.preventDefault(); e.stopPropagation(); } }); $(document).ready(function () { $(".scrollcart").css("display", "none"); $(window).scrollTop(0); GetCateringSettings(); BindInfo(); setQuantitytoCart(); var ItemsData = localStorage.getItem("TotalItems"); var CheckItems = JSON.parse(ItemsData); if (CheckItems != null) { if (CheckItems.length > 0) { if(document.getElementById('lblAppName').innerHTML != unescape(CheckItems[0].AppName)){ localStorage.setItem("ShippingAddress", null); localStorage.setItem("ShippingZoneId", null); } } else { localStorage.setItem("ShippingAddress", null); localStorage.setItem("ShippingZoneId", null); } } else { localStorage.setItem("ShippingAddress", null); localStorage.setItem("ShippingZoneId", null); } localStorage.removeItem("PromoEntered"); var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["CustomWebsites"]; if (CustomWebsites != undefined) { if (CustomWebsites == "FaceBookOrdering") { $("#btngmaillogin").css("display", "none"); $(".gmaildiv1").css("display", "none"); } } var Type = Orderstring["Type"]; if (Type != null) { if (Type == "preview" && $("#lblIsPublished").text() != "True") { $(".crtordbtn").css("display", "none"); } else if (Type == "mobilepreview" && $("#lblIsPublished").text() != "True") { $(".crtordbtn").css("display", "none"); ChangeView("mobile"); } else if (Type == "mobilepreview") { $(".wrappercs").css("display", "none"); ChangeView("mobile"); } } var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["demo"]; if (CustomWebsites == "demo") { $("#bntfnshedord").val("Check Out as a Guest"); } var Guestordervalue = document.getElementById('lblguestodrbtn').value; var UId = ''; if (Guestordervalue == "False"){ document.getElementById('btngust').style.display = "none"; $("#spnwelback").css("display", "none"); }else{ document.getElementById('btngust').style.display = "block"; $("#spnwelback").css("display", "block"); } localStorage.setItem("BusinessAddress", document.getElementById('restaddr').innerHTML); localStorage.setItem("BusinessContactNumber", document.getElementById('ContactNumber1').innerHTML); // var retrievedData = localStorage.getItem("TotalItems"); //var AddedItems = JSON.parse(retrievedData); //if (AddedItems != null) { // for (var g = 0; g < AddedItems.length; g++) { // var date = new Date(); // if (AddedItems[g].AddedDate != null) { // var previousDate = new Date(date); // previousDate.setDate(date.getDate() - 1); // var dd = previousDate.getDate(); // var mm = previousDate.getMonth(); // var y = previousDate.getFullYear(); // var newDate = new Date(y, mm, dd); // var ODate = new Date(AddedItems[g].AddedDate); // var dd1 = ODate.getDate(); // var mm1 = ODate.getMonth(); // var y1 = ODate.getFullYear(); // var orderDate = new Date(y1, mm1, dd1); // alert(newDate); // alert(orderDate); // if (orderDate < newDate) { // AddedItems[g].removeItem(); // g--; // } // } // } //} //var cartdate = localStorage.getItem("CartCreated"); //var date = new Date(year, month, day) //if (cartdate != undefined) { // var previousDate = date.setDate(dateObj.getDate() - 1); // if (cartdate < previousDate) { // ClearLocalStorage(); // } //} //localStorage.setItem("CartCreated", date); var Urltype = document.getElementById('lblurlnametype').innerHTML; if (Urltype == "DineIn") { $(".pricesize").css("display", 'none'); } else { $(".pricesize").css("display", ''); } if (document.getElementById('lblAppId1').value == "2bb3d84c-8c46-4963-b06c-a54299e2c1f5" || document.getElementById('lblAppId1').value == "af9400b1-7b28-4ee7-a7be-538d474af6b1") { $(".btnRecipe").val("See the video"); $("#RecipeDisplay .guestpicktitile").html("Item Video"); } if ($("#lblIsPublished").text() == "True") { //GetCateringSettings(); SetBrandingColors(); CheckQunatitiesforMenu(); DineinSettings(); } $(".addcategoryloadingimage").css("display", "block"); var LocationId = document.getElementById('lblLId').value; var todaydate = $("#AppLocationTime").text(); if ($("#AppLocationTime").text() != "") { var todaydate = $("#AppLocationTime").text(); var date = new Date($("#AppLocationTime").text()); var d = new Date(); var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] var X = getOrdinalNum(date.getDate()); var Holidaydate = monthNames[d.getMonth()] + " " + date.getDate() + X + ", " + date.getFullYear(); if ($("#lblholidaymsg").text() != "") { if ($("#lblholidaymsg").text().split("/")[0] == "Close All Day") { var fromtime = $("#lblholidaymsgfromtime").text(); var totime = $("#lblholidaymsgtotime").text(); if (fromtime == totime) { $("#lblordalert").text("Restaurant is closed on " + Holidaydate + " for " + $("#lblholidaymsg").text().split("/")[1] + ". Feel free to browse our menu or order for a later time."); $(".orderalert").fadeIn(); } else { $("#lblordalert").text("Restaurant is closed from " + fromtime + " - " + totime + " for " + $("#lblholidaymsg").text().split("/")[1] + ". Feel free to browse our menu or order for a later time"); $(".orderalert").fadeIn(); } // GetAvailableDates(HolidayName, fromtime, totime, Holidaydate); document.getElementById("lblholiday").innerHTML = Holidaydate; } else if ($("#lblholidaymsg").text().split("/")[0] == "Close This Time") { document.getElementById("lblholiday").innerHTML = Holidaydate; var fromtime = $("#lblholidaymsgfromtime").text(); var totime = $("#lblholidaymsgtotime").text(); var HolidayName = $("#lblholidaymsg").text().split("/")[1]; GetAvailableDates(HolidayName, fromtime, totime, Holidaydate); // $("#lblordalert").text("Restaurant is closed on" + " " + Holidaydate + " from " + fromtime + " to " + totime + " for " + $("#lblholidaymsg").text().split("/")[1] + ". Please choose another date"); // $(".orderalert").fadeIn(); } } } if (document.getElementById("lbldelivary").innerHTML == "Delivery Only") { GetDeliveryAddress(); } if (document.getElementById("Commissionlbl").innerHTML != "" && document.getElementById("Commissionlbl").innerHTML != null && document.getElementById("Commissionlbl").innerHTML != 0) { $("#btnBusiness").css("display", "block"); $("#editbusine").css("display", "block"); } else { $("#editbusine").css("display", "none"); $("#btnBusiness").css("display", "none"); } var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetGroupOrder(); } else{ localStorage.removeItem("GroupMemberType"); var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { if (AddedItems.length > 0) { for (var M = 0; M < AddedItems.length; M++) { if (AddedItems[M].GroupItems!= null) { for (var I = 0; I < AddedItems[M].GroupItems.length; I++) { localStorage.removeItem("TotalItems"); }}}}} } }); function GetGroupOrder() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; //start group order //if (GroupId != null && GroupId != "" && GroupId != undefined) { // GetGroupAdmin(GroupId); //} if (GroupId != null && GroupId != "" && GroupId != undefined) { GetStartGroupOrder(); $("#tdGroupOrder").attr("style", "display:none"); $(".urefresh").css("display","block"); } else { $("#tdGroupOrder").attr("style", "display:block"); $(".urefresh").css("display","none"); } } function GetStartGroupOrder() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var OrderId = Orderstring["OId"]; var GroupOrderType = Orderstring["GroupOrderType"]; //if (OrderId != null && OrderId != "" && OrderId != undefined) { if (GroupOrderType == "AdminReOrder") { if (GroupId != null && GroupId != "" && GroupId != undefined) { $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/GetGroupMembersByGroupId", data: "{'GroupId': '" + GroupId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var mes = new Array(); mes = msg.d.split("//"); var Details = new Object; Details.MemberType = "Admin"; Details.GroupId = GroupId; Details.MemberId = mes[0]; Details.MemberName = mes[1]; localStorage.setItem("GroupMemberType", JSON.stringify(Details)); localStorage.setItem("GroupIdExist", JSON.stringify(Details)); var gExist = localStorage.getItem("GroupIdExist"); var GroupExist = JSON.parse(gExist); if (GroupExist != null && GroupExist != "" && GroupExist != "00000000-0000-0000-0000-000000000000") { GroupIdentification(GroupExist); } else if (GroupExist == "00000000-0000-0000-0000-000000000000") { window.location.href = "../Default.aspx"; } else if (GroupExist == "00000000-0000-0000-0000-000000000000") { window.location.href = "../Default.aspx"; } else { MemberIdentification(); } } }); } } else { var gExist = localStorage.getItem("GroupIdExist"); var GroupExist = JSON.parse(gExist); if (GroupExist != null && GroupExist != "" && GroupExist != "00000000-0000-0000-0000-000000000000") { GroupIdentification(GroupExist); } else if (GroupExist == "00000000-0000-0000-0000-000000000000") { window.location.href = "../Default.aspx"; } else if (GroupExist == "00000000-0000-0000-0000-000000000000") { window.location.href = "../Default.aspx"; } else { MemberIdentification(); } } } function GroupIdentification(GroupExist) { var RealGroupId = GroupExist.GroupId; var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId == RealGroupId) { var lo = localStorage.getItem("GroupMemberType"); var MemberDetails = JSON.parse(lo); if (MemberDetails != null && MemberDetails != "") { if (RealGroupId == MemberDetails.GroupId) { CheckOrderType(); $("#SharedUrlsPanel").fadeOut("fast"); $("#PnlMembersJoining").fadeOut("fast"); //document.getElementById('RestautantinfoPanel').style.display = "none"; //document.getElementById('orderspanel').style.display = "block"; $("#sharegorder").css("display", "block"); } else { localStorage.removeItem("GroupMemberType"); localStorage.removeItem("MemberOrderStatus"); InsertNewMember1("Admin", FirstName); $("#PnlMembersJoining").fadeOut("fast"); } } else { InsertNewMember1("Admin", FirstName); $("#PnlMembersJoining").fadeOut("fast"); } } else { localStorage.removeItem("GroupIdExist"); MemberIdentification(); } } function MemberIdentification() { CheckOrderType(); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; $("#bntfnshedord").css("display", "none"); $(".Membervisible").css("display", "block"); $(".yourordersteststyles").css("display", "none"); $(".getdealbtn").css("display", "none"); var lo = localStorage.getItem("GroupMemberType"); var MemberDetails = JSON.parse(lo); if (MemberDetails != null) { //var GroupId = GetgroupId(); var RealGroupId = MemberDetails.GroupId; if (RealGroupId != "") { if (RealGroupId == GroupId) { $("#SharedUrlsPanel").fadeOut("fast"); $("#PnlMembersJoining").fadeOut("fast"); } else { localStorage.removeItem("GroupMemberType"); localStorage.removeItem("MemberOrderStatus"); $("#SharedUrlsPanel").fadeOut("fast"); $("#PnlMembersJoining").fadeIn("fast"); } } else { $("#SharedUrlsPanel").fadeOut("fast"); $("#PnlMembersJoining").fadeIn("fast"); } } else { localStorage.removeItem("GroupMemberType"); localStorage.removeItem("MemberOrderStatus"); $("#SharedUrlsPanel").fadeOut("fast"); $("#PnlMembersJoining").fadeIn("fast"); } document.getElementById("lblusertype").innerHTML = "Member"; } function GetgroupId() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; return GroupId; } function SharedUrlClose1() { SharedUrlClose(); } function StartMemberValidation() { $("#txtmembername").removeClass("reqruiredc"); $(".successmsg1").text(""); $(".sendloaderm").css("display", "block"); var Name = escape(document.getElementById('txtmembername').value); if (Name != "") { $('#PnlMembersJoining').css("display", "none"); InsertNewMember1("Member", Name); } else if (Name == "") { $("#txtmembername").addClass("reqruiredc"); $(".sendloaderm").css("display", "none"); } else { $(".successmsg1").text("Please enter your Name"); $(".sendloaderm").css("display", "none"); } } function GetGroupAdmin(GroupId) { if (GroupId != null || GroupId != "") { $.ajax({ type: "POST", url: "Orders.aspx/GetGroupAdmin", data: "{'GroupId': '" + GroupId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (document.getElementById("lblGAdmin").innerHTML != null) { document.getElementById("lblGAdmin").innerHTML = msg.d + "'s"; } } } }); } } function GetCateringSettings() { var LocationId = document.getElementById('lblLId').value; $.ajax({ type: "POST", url: "Orders.aspx/GetCateringSettings", data: "{'LocationId': '" + LocationId + "'}", datatype: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0].AcceptCatering == true || msg.d[0].CateringPickup == true) { document.getElementById("lblCatering").innerHTML = "True"; } else { document.getElementById("lblCatering").innerHTML = "False"; } } } }); } function Deliveryareapromocheck(LocationId) { $.ajax({ type: "POST", url: "orders.aspx/UserFirstOrderDeliveryfreevalidation", data: "{'LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { if (msg.d == "Enable") { document.getElementById("lbldeliveryareapromotioncheck").innerHTML = msg.d; } } } }); } function CheckQunatitiesforMenu() { var LocationId = document.getElementById('lblLId').value; $.ajax({ type: "POST", url: "orders.aspx/CheckItemQuantitiesenablestatus", data: "{'LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById("lblshowquantity").innerHTML = msg.d; } }); } function GetApprovedCoupons() { $(".addcategoryloadingimage").removeAttr("style"); $(".addcategoryloadingimage").css("display", "block"); $("#restcoupons").css("display", "none"); document.getElementById("couponsdisplay").innerHTML = ""; var LocationId = document.getElementById('lblLId').value; var TimeZone = document.getElementById('lbltimezonename').value; var RawOffset = document.getElementById('lblrawoffset').innerHTML; $.ajax({ type: "POST", url: "orders.aspx/GetApprovedCoupons", data: "{'LocationId': '" + LocationId + "','TimeZone': '" + TimeZone + "','RawOffset':'" + RawOffset + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { $("#missingcoupon").css("display", "none"); $("#restcoupons").css("display", "block"); var tablerows = ""; var couponheadertext = document.getElementById("lbllogotext").innerHTML; var couponheaderurl = document.getElementById("imglogo").innerHTML; tablerows = "<table style='width:100%;padding: 10px 2%;'>"; for (var i = 0; i < msg.d.length; i++) { if (msg.d[i].Discounttype.indexOf("%") != -1) msg.d[i].Discount = msg.d[i].Discount + " %"; else if (msg.d[i].Discounttype.indexOf("$") != -1) msg.d[i].Discount = "$ " + msg.d[i].Discount; else msg.d[i].Discount = "Rs." + msg.d[i].Discount; if (msg.d[i].CouponImage != "" && msg.d[i].CouponImage != null) { tablerows += "<tr><td><div style='width:70%;float:left'><div style='font-size: 16px;color: #13a7e2;font-weight:bold'><label>" + msg.d[i].CouponName + "</label><label style='float: right;margin-right: 5px;'>" + msg.d[i].Discount + " Off</label></div><div style='font-size: 14px;'><label>" + msg.d[i].Description + "</label></div>"; if (msg.d[i].OrderMinimum != "" && msg.d[i].OrderMinimum != null) tablerows += "<div style='font-size: 14px;'><label>Minimum Order: " + $("#lblCurrency").text() + " " + msg.d[i].OrderMinimum + "</label></div>"; tablerows += "<div style='font-size: 14px;'><label>Expire Date: " + msg.d[i].ExpirationDate + "</label></div>"; if (msg.d[i].OrderMaximum != "" && msg.d[i].OrderMaximum != null) { tablerows += "<div style='font-size: 14px;'><label>Order Max Limit: " + $("#lblCurrency").text() + " " + msg.d[i].OrderMaximum + "</label></div>" } tablerows += "</div><div style='float:left;width:25%;margin-top:5px;'><div><img class='couponimg' src='" + msg.d[i].CouponImage + "' alt='" + msg.d[i].CouponName + " image' width='120' height='60' /><label style='position: absolute;right: calc(100% - 76%);font-size: 12px;margin-top: 15px;color: white;'>" + msg.d[i].CouponName + "</label><label style='position: absolute;right: calc(100% - 77%);font-size: 12px;margin-top: 42px;color: red;'>" + msg.d[i].Code + "</label><label style='position: absolute;right: calc(100% - 76%);font-size: 13px;margin-top: 30px;color: blue;'>" + msg.d[i].Discount + " Off</label>"; if (couponheadertext != null && couponheadertext != "") { tablerows += "<span class='temlogoleft'>" + couponheadertext + "</span>"; } else { tablerows += "<img src='" + couponheaderurl + "' class='temlogoleft'/>"; } tablerows += "</div></div></td></tr><tr><td style='font-size: 12px;text-align: center;padding-top: 1px;color: black'><label>Coupon Code</label></td></tr>"; if (msg.d.length - 1 == i) { tablerows += "<tr><td style='font-size: 18px;text-align: center;padding-top: 6px;padding-bottom: 5px;'><label style='color: #e7a05b;border: 2px dashed;padding: 1px 10px;'>" + msg.d[i].Code + "</label></td></tr>"; } else { tablerows += "<tr><td style='font-size: 18px;text-align: center;padding-top: 6px;border-bottom: 1px solid #e6e3e3;padding-bottom: 5px;'><label style='color: #e7a05b;border: 2px dashed;padding: 1px 10px;'>" + msg.d[i].Code + "</label></td></tr>"; } } else { tablerows += "<tr><td><div style='width:100%;'><div style='font-size: 16px;color: #13a7e2;font-weight:bold'><label>" + msg.d[i].CouponName + "</label><label style='float: right;margin-right: 5px;'>" + msg.d[i].Discount + " Off</label></div><div style='font-size: 14px;'><label>" + msg.d[i].Description + "</label></div>"; if (msg.d[i].OrderMinimum != "" && msg.d[i].OrderMinimum != null) tablerows += "<div style='font-size: 14px;'><label>Minimum Order: " + $("#lblCurrency").text() + " " + msg.d[i].OrderMinimum + "</label></div>"; tablerows += "<div style='font-size: 14px;'><label>Expire Date: " + msg.d[i].ExpirationDate + "</label></div>"; if (msg.d[i].OrderMaximum != "" && msg.d[i].OrderMaximum != null) { tablerows += "<div style='font-size: 14px;'><label>Order Max Limit: " + $("#lblCurrency").text() + " " + msg.d[i].OrderMaximum + "</label></div>" } tablerows += "</div></td></tr><tr><td style='font-size: 12px;text-align: center;padding-top: 1px;color: black'><label>Coupon Code</label></td></tr>"; if (msg.d.length - 1 == i) { tablerows += "<tr><td style='font-size: 18px;text-align: center;padding-top: 6px;padding-bottom: 5px;'><label style='color: #e7a05b;border: 2px dashed;padding: 1px 10px;'>" + msg.d[i].Code + "</label></td></tr>"; } else { tablerows += "<tr><td style='font-size: 18px;text-align: center;padding-top: 6px;border-bottom: 1px solid #e6e3e3;padding-bottom: 5px;'><label style='color: #e7a05b;border: 2px dashed;padding: 1px 10px;'>" + msg.d[i].Code + "</label></td></tr>"; } } } tablerows += "</table>"; document.getElementById("couponsdisplay").innerHTML = tablerows; } else { if (document.getElementById("nosettingslbl").innerHTML != "Restaurant Menu not available for ordering at this time") { var Urltype = document.getElementById('lblurlnametype').innerHTML; if (Urltype != "DineIn") { $("#missingcoupon").css("display", "block"); } } } $(".addcategoryloadingimage").css("display", "none"); $("#divcoupons").css("display", "block"); } }); } function ReOrderItems(OId) { if (OId != undefined) { var myItem = localStorage.getItem('CheckedDeliveryAddress'); localStorage.clear(); localStorage.setItem('CheckedDeliveryAddress', myItem); localStorage.setItem("BusinessAddress", document.getElementById('restaddr').innerHTML); localStorage.setItem("BusinessContactNumber", document.getElementById('RestPhno').innerHTML); $.ajax({ type: "POST", url: "orders.aspx/ReOrderItems", data: "{'OId': '" + OId + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); localStorage.setItem("Page", JSON.stringify(sPage)); for (var S = 0; S < msg.d.length; S++) { var Items = new Array(); var Item = new Object; Item.ItemName = escape(msg.d[S].ItemName); Item.Id = msg.d[S].ItemId; Item.MainCategoryId = msg.d[S].MainCategoryId; Item.LId = msg.d[S].Description; if (msg.d[S].Instructions != "Order instruction, suggestions") Item.Instructions = escape(msg.d[S].Instructions); Item.NoSalesTax = msg.d[S].UnitName; Item.CustomTax = msg.d[S].CustomTax; Item.TaxLabel = escape(msg.d[S].TaxLabel); Item.Quantity = msg.d[S].Quantity; Item.Price = msg.d[S].Price; Item.Time = ""; Item.TimeId = msg.d[S].TimePeriodId; Item.AppName = escape(document.getElementById('lblAppName').innerHTML); Item.Choices = new Array(); Item.Variations = new Array(); for (var k = 0; k < msg.d[S].Options.length; k++) { var Choice = new Object; Choice.Id = msg.d[S].Options[k].ChoiceId; Choice.OptionId = msg.d[S].Options[k].OptionId; Choice.ChoiceName = msg.d[S].Options[k].OptionName; Choice.OptionName = msg.d[S].Options[k].OptionName; for (var ic = 0; ic < msg.d[S].Options[k].itemOptionChoices.length; ic++) { Choice.Notify = msg.d[S].Options[k].itemOptionChoices[ic].Notify; Choice.Price = msg.d[S].Options[k].itemOptionChoices[ic].Price.toFixed(2); } Choice.ChildChoices = new Array(); for (var Ch = 0; Ch < msg.d[S].Options[k].userChildOptions.length; Ch++) { var ChildChoice = new Object; ChildChoice.Id = msg.d[S].Options[k].userChildOptions[Ch].ChoiceId; ChildChoice.OptionId = msg.d[S].Options[k].userChildOptions[Ch].OptionId; ChildChoice.OptionName = escape(msg.d[S].Options[k].userChildOptions[Ch].OptionName); ChildChoice.ChoiceName = escape(msg.d[S].Options[k].userChildOptions[Ch].Action); ChildChoice.Price = parseFloat(msg.d[S].Options[k].userChildOptions[Ch].ItemPrice).toFixed(2); ChildChoice.Notify = (msg.d[S].Options[k].userChildOptions[Ch].Notify); ChildChoice.DefaultVSOption = (msg.d[S].Options[k].userChildOptions[Ch].DefaultVSOption); Choice.ChildChoices.push(ChildChoice); } Item.Choices.push(Choice); } Item.AddedDate = new Date(); if (S == 0) { Items.push(Item); localStorage.setItem("TotalItems", JSON.stringify(Items)); } else { Items.push(Item); var retrievedData = localStorage.getItem("TotalItems"); if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var allItems; allItems = AddedItems.concat(Items); localStorage.setItem("TotalItems", JSON.stringify(allItems)); } } } var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow(); } else { BindItems(); } } if (msg.d[0].Category == "Delivery") { $.ajax({ type: "POST", url: "orders.aspx/ReOrderAddress", data: "{'OId': '" + OId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { document.getElementById('txtaddress').value = msg.d.Line1; document.getElementById('txtvalidationcity').value = msg.d.City; document.getElementById('txtvalidationstate').value = msg.d.State; document.getElementById('txtvalidationzip').value = msg.d.Zip; GetSavedAddress(); $('.divsavedaddressheight').css("display", "block"); } } }); } var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.selectedIndex != -1) { if ($('#ddlOrderType option[value="' + msg.d[0].Category + '"]').length > 0) { $("#ddlOrderType").val(msg.d[0].Category); OpenOrderTypePnl(msg.d[0].Category); ChangeOrderType(); } else { localStorage.removeItem("OrderType"); OpenOrderTypePnl(""); } } BindPrices(0); } } }); } } function getQueryStrings() { var assoc = {}; var decode = function (s) { return decodeURIComponent(s.replace(/\+/g, " ")); }; var queryString = location.search.substring(1); var keyValues = queryString.split('&'); if (keyValues != "" && keyValues != null) { for (var i in keyValues) { var key = keyValues[i].split('='); if (key.length > 1) { assoc[decode(key[0])] = decode(key[1]); } } } return assoc; } function FavoriteLoad() { var UId = document.getElementById("UserId").innerHTML; var LocationId = document.getElementById('lblLId').value; var Image = document.getElementById("btnfavorite"); if (UId != null && UId != "") { $.ajax({ type: "POST", url: "orders.aspx/FavoriteLoad", data: "{'LocationId': '" + LocationId + "', 'UserId':'" + UId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "Favorite") { $("#btnfavorite").css("background-image", "images/fav%20grey.png"); } else { $("#btnfavorite").css("background-image", "images/fav.png"); } } }) } else { setAttributes(Image, { "src": "images/fav.png", "alt": "Favourites" }); } } function opensigninpanel() { $('.Activatepanel').fadeOut("slow"); $('.signinpanel').css("display", "block"); $('.userstyleguest').css("display", "none"); $("#spnwelback").css("display", "none"); } function ConformActivation() { $('.activateloader').css("display", "block"); var Email = document.getElementById('txtUserEmail').value; var SignedEmail = document.getElementById('txtEmail').value; var Code = document.getElementById('txtcode').value; if (Code != null && Code != "") { $.ajax({ type: "POST", url: "orders.aspx/ActivateAccount", data: "{'Email': '" + Email + "', 'Code':'" + Code + "','SignedEmail': '" + SignedEmail + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "success") { $('.activateloader').css("display", "none"); var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); document.getElementById('lblermsg1').innerHTML = "Your Account is Activated"; $("#lblermsg1").delay(5000).fadeOut(100); document.getElementById('txtcode').innerHTML = ""; if (AddedItems != null) { if (AddedItems.length > 0) { $('.Activatepanel').fadeOut("slow"); UserLogin(); } else { $('.Activatepanel').fadeOut("slow"); $('.signinpanel').fadeIn("slow"); $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); document.getElementById('txtcode').value = ""; } } } else { $('.activateloader').css("display", "none"); $("#lblermsg1").fadeIn("Slow"); document.getElementById('lblermsg1').innerHTML = "Invalid Code"; $("#lblermsg1").delay(5000).fadeOut(100); } } }) } else { $('.activateloader').css("display", "none"); document.getElementById('lblermsg1').innerHTML = "Enter Code"; } } $('#signinpanel').keypress(function (e) { if (e.keyCode == '13') { UserLoginval();//for sign in panel. e.preventDefault(); e.stopPropagation(); } }); $('#deliveryvalidationpanel').keypress(function (e) { if (e.keyCode == '13') { DeliveryAddressCheckValidation();//for delivery panel. e.preventDefault(); e.stopPropagation(); } }); $('#forgetpasswordpnl').keypress(function (e) { if (e.keyCode == '13') { forgetpasswordsubmit();//for forgetpasswordpanel. e.preventDefault(); e.stopPropagation(); } }); var RestaurantHeader = ""; function CartDisplay() { if (window.innerWidth < 767) { if (localStorage.getItem("EntityDisabled") == "Disabled") alert("Both " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + " and Delivery are disabled, You can't place an order"); document.getElementById("lblscrolltop").innerHTML = $(window).scrollTop(); $('.scrollcart').css("display", "block"); $('.menu').css("display", "none"); $('.pnlpromoimg').css("display", "none"); $('.orderdivw').css("display", "none"); $('.CartDisplay').css("display", "block"); $('.backarrow').css("display", "block"); $('.backrestlist').css("display", "none"); $(".menusrtb").css("display", "none"); $('.startgright').css("margin-top", "-112px"); $(".couponrt").css("display", "block"); $(window).scrollTop(0); if (localStorage.getItem("OrderType") == "DineInOnly") $(".checkout").css("display", "none"); else $(".checkout").attr('style', "display:block;" + ButtonColor); } } function MobileBackmenu() { var scrolltop = document.getElementById("lblscrolltop").innerHTML; $(window).scrollTop(scrolltop); if(document.getElementById("promoimageexist").innerHTML=="true") { $(".pnlpromoimg").css("display", "block"); } $('.scrollcart').css("display", "none"); $('.itemfiltertable').css("display", "block"); $('.margin-bottom').css("display", "4px"); $('.menu').css("display", "block"); $('.orderdivw').css("display", "block"); $('.CartDisplay').css("display", "block"); $('.backarrow').css("display", "none"); $(".menusrtb").removeAttr("style"); $('.startgright').removeAttr("style"); if (document.getElementById("lblNavigationBar").innerHTML == "true") $('.backrestlist').css("display", "block"); else $('.backrestlist').css("display", "none"); $(".couponrt").css("display", "none"); } function SetOrderType() { Addresses = localStorage.getItem("Addresses"); Address = JSON.parse(Addresses); if (Address != null) { if (Address.length > 0) { document.getElementById('txtaddress').value = Address[0].Line1; document.getElementById('txtvalidationcity').value = Address[0].City; document.getElementById('txtvalidationstate').value = Address[0].State; document.getElementById('txtvalidationzip').value = Address[0].Zip; if (Address[0].DoorNo != undefined) document.getElementById('txtDoorNO').value = Address[0].DoorNo; if (Address[0].LandMark != undefined) document.getElementById('txtLandmark').value = Address[0].LandMark; document.getElementById("txtline1").value = document.getElementById('txtaddress').value; document.getElementById("txtcity").value = document.getElementById('txtvalidationcity').value; document.getElementById("txtstate").value = document.getElementById('txtvalidationstate').value; document.getElementById("txtZip").value = document.getElementById('txtvalidationzip').value; document.getElementById("txtline2").value = document.getElementById('txtDoorNO').value; document.getElementById("txtulandmark").value = document.getElementById('txtLandmark').value; document.getElementById('AdrValue').innerHTML = "NewId"; } } localStorage.removeItem("Addresses"); } function BlockHeader() { //if ($("#lblLId").val() == "9a706bba-b3cd-4bcd-a23d-2be581c8e1a4") { // $(".Ordersmain").css("width", "100%"); // $(".menu").css("max-height", "500px"); //} var QueryString = getQueryStrings(); var hbgcolor = QueryString["Hbc"]; if (hbgcolor != "" && hbgcolor != "undefined" && hbgcolor != null) { } else $('#wrapper').attr('style', 'display:none;'); $('.fcontainer').css('display', 'none;'); if (window.innerWidth < 767) { if ($("#lblMenuTheme").val() != "Grid" && $("#lblMenuTheme").val() != "Grid-no-images" && $("#lblMenuTheme").val() != "New-Grid" && $("#lblMenuTheme").val() != "New-Grid-no-images") { //$(".mobileresheader").attr('style', 'display:block;' + ButtonColor); $('#wrapper').attr('style', 'display:block;'); $(".hmheaderdlt ").css("display", "none"); //$(".hmlgin ").css("display", "none"); } } } function ShowHeader() { if (window.location !== window.parent.location) { $(".orderswidth").css("width", "100%"); $(".checkout").addClass("iframecheckout"); } else { if (window.innerWidth < 767) { $('#wrapper').attr('style', 'display:block;'); $('.ordfooter').css('display', 'block;'); } else { $('#wrapper').attr('style', 'display:block;'); $('.ordfooter').css('display', 'block;'); } } } function ResendEmail() { document.getElementById('lblvalue').innerHTML = "ResendEmail"; var msg = document.getElementById("lblmsgcount").innerHTML; if (msg > 0) { } else { // $('#lnkresendmail').attr('disabled', 'true'); ResendEmailAndTextMessageToUser(); } } function ResendText() { document.getElementById('lblvalue').innerHTML = "ResendText"; var msg = document.getElementById("lblmsgcount").innerHTML; if (msg > 0) { } else { // $('#lnkresendtext').attr('disabled', 'true'); ResendEmailAndTextMessageToUser(); } } function ResendEmailAndTextMessageToUser() { var Z = 0; $('.activateloader').css("display", "block"); var Resend = document.getElementById('lblvalue').innerHTML; if (Resend == "ResendText") { Z = Z + 1; document.getElementById("lblmsgcount").innerHTML = Z; } if (Resend == "ResendEmail") { Z = Z + 1; document.getElementById("lblmsgcount").innerHTML = Z; } var Email = document.getElementById('txtEmail').value; if (Email == "") { Email=document.getElementById("txtUserEmail").value; } if (Email != null) { $.ajax({ type: "POST", url: "orders.aspx/ResendEmailAndTextMessageToUser", data: "{'Email': '" + Email + "', 'Resend':'" + Resend + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "Activation Code sent to your Registered Email") { document.getElementById('lblermsg1').innerHTML = msg.d; $('#lblermsg1').css("display", "block"); $('#lblermsg1').delay(5000).fadeOut(100); if ($('.munchiesAmount').text() != '') { $('.Activatepanel').fadeIn("slow"); $('.Activatepanel').css("z-index", "10000"); $('.Activatepanel').css("position", "relative"); } // $('#lnkresendmail').attr('disabled', 'false'); //$('#lnkresendtext').attr('disabled', 'false'); document.getElementById("lblmsgcount").innerHTML = ""; } else { document.getElementById('lblermsg1').innerHTML = msg.d; $('#lblermsg1').css("display", "block"); $('#lblermsg1').delay(5000).fadeOut(100); if ($('.munchiesAmount').text() != '') { $('.Activatepanel').fadeIn("slow"); $('.Activatepanel').css("z-index", "10000"); $('.Activatepanel').css("position", "relative"); } // $('#lnkresendmail').attr('disabled', 'false'); //$('#lnkresendtext').attr('disabled', 'false'); document.getElementById("lblmsgcount").innerHTML = ""; } $('.activateloader').css("display", "none"); } }); } else { // $('#lnkresendtext').attr('disabled', 'false'); //$('#lnkresendmail').attr('disabled', 'false'); document.getElementById("lblmsgcount").innerHTML = ""; } } (function (i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { (i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); ga('create', 'UA-53879552-1', 'auto'); ga('send', 'pageview'); </script> <script type="text/javascript"> ///// TimePeriods New Code function GetCommonTime() { $('.ddlhr').empty(); var todaydate = ""; todaydate = $("#AppLocationTime").text(); var splitarray = new Array(); splitarray = todaydate.split(" "); document.getElementById('lblolddate').innerHTML = splitarray[0]; document.getElementById('txtdeliverydate').value = splitarray[0]; var retrievedData = localStorage.getItem("TotalItems"); CheckCartAvailableTimes(); } function GetCurrentDates() { $('.ddlhr').empty(); var todaydate = ""; todaydate = $("#AppLocationTime").text(); var splitarray = new Array(); splitarray = todaydate.split(" "); document.getElementById('lblolddate').innerHTML = splitarray[0]; document.getElementById('txtdeliverydate').value = splitarray[0]; var retrievedData = localStorage.getItem("TotalItems"); var currenttime = $("#AppLocationTime").text(); } function tConvert(time) { var timeString = ""; if (time.length > 8) { return time; } else { if (time != "ASAP") { timeString = time; var H = +timeString.substr(0, 2); var h = (H % 12) || 12; var ampm = H < 12 ? " AM" : " PM"; return timeString = h + timeString.substr(2, 3) + ampm; } else { return timeString = "ASAP"; } } } function resettimings() { //$("#lblordsucc").text("Timings has been updated, please check and place your order"); //$(".ordersuccess").show().delay(3000).fadeOut(); //CheckCartAvailableTimes(); alertify.alert("Timings has been updated, please check and place your order"); $("#ddlhr").css("display", ""); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } function CheckCartAvailableTimes() { var UrlType = document.getElementById('lblurlnametype').innerHTML; var TableNo = document.getElementById("txtdinetable").value.trim(); document.getElementById("dineintableid").value = TableNo; var OrderTypevalue = localStorage.getItem("OrderType"); var OrderType = "PickUp"; if (document.getElementById("lblPickupname").innerHTML.replace("&", "&") == OrderTypevalue) OrderType = "PickUp"; else if (document.getElementById("lblDineInname").innerHTML.replace("&", "&") == OrderTypevalue) OrderType = "DineIn"; else if (OrderTypevalue == "Delivery") OrderType = "Delivery"; else if (OrderTypevalue == "Shipping") OrderType = "Shipping"; else OrderType = OrderTypevalue; //if (OrderTypevalue != null && OrderTypevalue != "") { //} //else { // BindOrderTypes(); // $(".deliveryvalidationpanel").css("display", "block"); // $(".deliveryvalidationpanel").css("margin-top", $(document).scrollTop() - 0); // return; //} var LocationId = document.getElementById('lblLId').value; var CurrentTime = document.getElementById("AppLocationTime").innerHTML; var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); var arr = new Array(); if (AddedItems != null) { for (var S = 0; S < AddedItems.length; S++) { arr[S] = { Id: AddedItems[S].Id, MainCategoryId: AddedItems[S].MainCategoryId }; } } if (OrderType != "Shipping") { $("#txtdeliverydate").removeAttr("disabled"); document.getElementById("lblDisplayTimeSelection").innerHTML = true; $.ajax({ type: "POST", url: "orders.aspx/GetGeneralSettings", data: "{'LocationId': '" + LocationId + "'}", dataType: "json", async: true, contentType: "application/json", success: function (msg) { if (msg.d != null) { if (msg.d[0].DisplayTimeSelection == false) { $("#ddlhr").css("display", "none"); $("#txtdeliverydate").css("width", "auto"); document.getElementById("lblDisplayTimeSelection").innerHTML = false; } else { $("#ddlhr").css("display", ""); $("#txtdeliverydate").css("width", "146px"); } } else { $("#ddlhr").css("display", ""); } } }); $(".Estimate").css("display", "none"); $(".Estimate").text(""); $("#lblreducedtime").text(""); if (document.getElementById("lblMileageCharge").style.display == "block") $(".ToggleMileageCharge").fadeIn("slow"); else $(".ToggleMileageCharge").css("display", "none"); var DriverId = ""; DriverId = document.getElementById("lblselecteddriver").innerHTML; document.getElementById("lblUserDeliveryError").innerHTML = ""; var commontime = document.getElementById("lblcommontime").innerHTML; var UId = document.getElementById("UserId").innerHTML; var sDate = new Date(); sDate = document.getElementById('txtdeliverydate').value; var ItemCount = 0; var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) ItemCount = AddedItems.length; var CommonTime = document.getElementById("lblcommontime").innerHTML; var LId = document.getElementById('lblLId').value; var Zone = localStorage.getItem("Zone"); if (OrderType == "PickUp") Zone = null; var selectedDate = new Date(); selectedDate = document.getElementById('txtdeliverydate').value; var CurrentTime = document.getElementById("AppLocationTime").innerHTML; var Aid = document.getElementById('lblAppId1').value; var TimeZoneName = document.getElementById('lbltimezonename').value; var RawOffset = document.getElementById('lblrawoffset').innerHTML; var ExtraMiles = localStorage.getItem("Miles"); var TotalDistance = localStorage.getItem("TotalDistance"); $('.ddlhr').empty(); var ddlhr = document.getElementById("ddlhr"); var ddlOrderType = document.getElementById("ddlOrderType"); var PickupButtonName = ""; if (document.getElementById("lblPickupname") != null) { PickupButtonName = document.getElementById("lblPickupname").innerHTML; } if (UrlType == "DineIn") { if (document.getElementById("lblDineInname") != null) { PickupButtonName = document.getElementById("lblDineInname").innerHTML; } } var tp = document.getElementById("lblDefaultTipAmount").innerHTML; if (tp != ""){ if(tp != "Custom"){ tp = tp + "%"; userTip(tp); } } var UsedOrderType = ""; var SelectedOrderType = ""; if (ddlOrderType.options.length > 0) { SelectedOrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; UsedOrderType = ddlOrderType.options[ddlOrderType.selectedIndex].value; } if (UsedOrderType == PickupButtonName) { UsedOrderType = "PickUp"; } if (OrderType == null || OrderType == "") OrderType = UsedOrderType; $.ajax({ type: "POST", url: "Orders.aspx/BindRestaurantHours", data: "{'LId':'" + LId + "','OrderType':'" + OrderType + "','Zone':'" + Zone + "','Date':'" + selectedDate + "','DriverId':'" + DriverId + "','ItemCount':'" + ItemCount + "','TotalDistance':'" + TotalDistance + "','Retrivedata':'" + JSON.stringify(arr) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { document.getElementById('txtdeliverydate').value = msg.d[0].AvailableDate; if (msg.d[0].OrderTimes.length > 0) { var tme =0; for (var i = 0; i < msg.d[0].OrderTimes.length; i++) { if (document.getElementById("LimitTimestoASAP").innerHTML == "true") { if (msg.d[0].OrderTimes[i].Times == "ASAP") { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); tme = 1; } else { if (tme != 1) { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[0].Times); optmin2.text = time; if(i == 0){ ddlhr.options.add(optmin2); } } } } else { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); } if (msg.d[0].OrderTimes[i].Times == "ASAP") { document.getElementById("lblasaphr").innerHTML = msg.d[0].ASAPTime; $(".Estimate").css("display", "block"); $(".Estimate").text("Estimated " + SelectedOrderType + " time is " + msg.d[0].ASAPTime); } } var refreshIntervalId = setInterval("resettimings();", 5*60 *1000); localStorage.setItem("clearInterval",refreshIntervalId ); OpeningOrderSubmitionPnl(); } else if (msg.d[0].NextAvailableDate != null && msg.d[0].NextAvailableDate != "" && msg.d[0].Status != "" && msg.d[0].Status != null) { var Confirmmessage = msg.d[0].Status; const myArr = Confirmmessage.split('.'); var Cmessage = []; for (var i = 0; i < myArr.length; i++) { var vmessage = myArr[i]; Cmessage.push(vmessage); if (i == 0) Cmessage.push(msg.d[0].NextAvailableDate); } var Cmes = Cmessage.toString().split(','); Cmes = Cmes[0] + ". The next available date is " + Cmes[1]; Confirmmessage = Cmes; alertify.set({ labels: { ok: "Continue", cancel: "Cancel" } }); alertify.confirm(Confirmmessage, function (e) { if (e) { document.getElementById('txtdeliverydate').value = msg.d[0].NextAvailableDate; selectedDate = msg.d[0].NextAvailableDate; $.ajax({ type: "POST", url: "Orders.aspx/BindRestaurantHours", data: "{'LId':'" + LId + "','OrderType':'" + OrderType + "','Zone':'" + Zone + "','Date':'" + selectedDate + "','DriverId':'" + DriverId + "','ItemCount':'" + ItemCount + "','TotalDistance':'" + TotalDistance + "','Retrivedata':'" + JSON.stringify(arr) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { document.getElementById('txtdeliverydate').value = msg.d[0].AvailableDate; if (msg.d[0].OrderTimes.length > 0) { var tme = 0; for (var i = 0; i < msg.d[0].OrderTimes.length; i++) { if (document.getElementById("LimitTimestoASAP").innerHTML == "true") { if (msg.d[0].OrderTimes[i].Times == "ASAP") { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); tme = 1; } else { if (tme != 1) { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[0].Times); optmin2.text = time; if(i == 0){ ddlhr.options.add(optmin2); } } } } else { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); } if (msg.d[0].OrderTimes[i].Times == "ASAP") { document.getElementById("lblasaphr").innerHTML = msg.d[0].ASAPTime; $(".Estimate").css("display", "block"); $(".Estimate").text("Estimated " + SelectedOrderType + " time is " + msg.d[0].ASAPTime); } } var refreshIntervalId = setInterval("resettimings();", 5*60 *1000); localStorage.setItem("clearInterval",refreshIntervalId ); OpeningOrderSubmitionPnl(); $(".addcategoryloadingimage2").css("display", "none"); } else if (msg.d[0].Status != "" && msg.d[0].Status != null) { alert(msg.d[0].Status); $(".checkbtndiv").css("display", "inline-block"); $(".checkoutloaderdiv").css("display", "none"); $(".addcategoryloadingimage2").css("display", "none"); } } else if (msg.d[0].Status != "" && msg.d[0].Status != null) { alert(msg.d[0].Status); $(".checkbtndiv").css("display", "inline-block"); $(".checkoutloaderdiv").css("display", "none"); $(".addcategoryloadingimage2").css("display", "none"); } $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } }); } else { $(".addcategoryloadingimage2").css("display", "none"); } }); } else if (msg.d[0].NextAvailableDate != null && msg.d[0].NextAvailableDate != "") { var Confirmmessage = "You can place your order now for a future time at " + msg.d[0].NextAvailableDate + ". Is that OK?"; if (confirm(Confirmmessage)) { document.getElementById('txtdeliverydate').value = msg.d[0].NextAvailableDate; selectedDate = msg.d[0].NextAvailableDate; $.ajax({ type: "POST", url: "Orders.aspx/BindRestaurantHours", data: "{'LId':'" + LId + "','OrderType':'" + OrderType + "','Zone':'" + Zone + "','Date':'" + selectedDate + "','DriverId':'" + DriverId + "','ItemCount':'" + ItemCount + "','TotalDistance':'" + TotalDistance + "','Retrivedata':'" + JSON.stringify(arr) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { document.getElementById('txtdeliverydate').value = msg.d[0].AvailableDate; if (msg.d[0].OrderTimes.length > 0) { var tme = 0; for (var i = 0; i < msg.d[0].OrderTimes.length; i++) { if (document.getElementById("LimitTimestoASAP").innerHTML == "true") { if (msg.d[0].OrderTimes[i].Times == "ASAP") { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); tme = 1; } else { if (tme != 1) { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[0].Times); optmin2.text = time; if(i == 0){ ddlhr.options.add(optmin2); } } } } else { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); } if (msg.d[0].OrderTimes[i].Times == "ASAP") { document.getElementById("lblasaphr").innerHTML = msg.d[0].ASAPTime; $(".Estimate").css("display", "block"); $(".Estimate").text("Estimated " + SelectedOrderType + " time is " + msg.d[0].ASAPTime); } } var refreshIntervalId = setInterval("resettimings();", 5*60 *1000); localStorage.setItem("clearInterval",refreshIntervalId ); OpeningOrderSubmitionPnl(); $(".addcategoryloadingimage2").css("display", "none"); } else { alert(msg.d[0].Status); $(".checkbtndiv").css("display", "inline-block"); $(".checkoutloaderdiv").css("display", "none"); $(".addcategoryloadingimage2").css("display", "none"); } } } }); } else { $(".addcategoryloadingimage2").css("display", "none"); } } else if (msg.d[0].Status != "" && msg.d[0].Status != null) { alert(msg.d[0].Status); $(".checkbtndiv").css("display", "inline-block"); $(".checkoutloaderdiv").css("display", "none"); $(".addcategoryloadingimage2").css("display", "none"); } $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } } }); } else { var shippingZoneId = localStorage.getItem("ShippingZoneId"); if (shippingZoneId != null && shippingZoneId != undefined) { var ShipmentDays = ""; if (document.getElementById("SpeedId").innerHTML != '') ShipmentDays = $("label[for='Days" + document.getElementById("SpeedId").innerHTML + "']").text(); $.ajax({ type: "POST", url: "Orders.aspx/BindShippingHours", data: "{'LId':'" + LocationId + "','ZoneId':'" + shippingZoneId + "','Time':'" + CurrentTime + "','ShipmentDays':'" + ShipmentDays + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0].ErrorMessage == "") { $("#txtdeliverydate").attr("disabled", "disabled"); $(".Estimate").css("display", "none"); $(".Estimate").text(""); $("#ddlhr").css("display", "none"); $("#txtdeliverydate").css("width", "297px"); if (~msg.d[0].AddDays.indexOf('Days')) { var Adddays = msg.d[0].AddDays.split(' ')[0]; jQuery(function ($) { $(".datepicker").datepicker({ minDate: "+" + Adddays + "D" }); }); } else { var Adddays = msg.d[0].AddDays.split(' ')[0]; jQuery(function ($) { $(".datepicker").datepicker({ minDate: "+" + Adddays + "M" }); }); } $("#txtdeliverydate").val(msg.d[0].ShippingDate); $(".guestpicktitile").text("Shipping Order Submission"); $(".UserDeliveryPanel").css("display", "block"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } if (window.innerWidth > 767) { if ($("#lblMenuTheme").val() == "Grid" || $("#lblMenuTheme").val() == "Grid-no-images" || $("#lblMenuTheme").val() == "New-Grid" || $("#lblMenuTheme").val() == "New-Grid-no-images") { CloseCart(); }else{$(".scrollcart").css("display", "block");} } $(".DeliveryType").fadeIn("fast"); } else { $("#lblordalert").text(msg.d[0].ErrorMessage); $(".orderalert").fadeIn(); } } else { $("#lblordalert").text("Restaurant doesn't accept Any shipping Orders at this time"); $(".orderalert").fadeIn(); } } }); } } } $("#txtvalidationstate").focusout(function () { var xmlhttp = new XMLHttpRequest(); var addressLine1 = document.getElementById('txtaddress').value; var addressCity = document.getElementById('txtvalidationcity').value; var addressState = document.getElementById('txtvalidationstate').value; xmlhttp.open("Post", "http://production.shippingapis.com/ShippingAPITest.dll?API=Verify&XML=<AddressValidateRequest USERID='647MUNCH4746'><Address ID='1'><Address1>" + addressLine1 + "</Address1><Address2></Address2><City>" + addressCity + "</City><State>" + addressState + "</State><Zip5></Zip5><Zip4></Zip4></Address></AddressValidateRequest>", true); xmlhttp.send(null); xmlhttp.onreadystatechange = function () { var response; if (xmlhttp.readyState == 4) { if (window.ActiveXObject) { response = new ActiveXObject("Microsoft.XMLDOM"); response.async = "false"; response.loadXML(xmlhttp.responseText); } // code for Mozilla, Firefox, Opera, etc. else { var parser = new DOMParser(); response = parser.parseFromString(xmlhttp.responseText, "text/xml"); } } } }); function GetDeliveryZones() { var LId = document.getElementById('lblLId').value; $('#ifmDeliveryZones').attr("src", "DeliveryZones.aspx?LId=" + LId); $("#DeliveryZonesDisplay").css("display", "block"); } function CloseDeliveryZone() { $("#DeliveryZonesDisplay").css("display", "none"); } function GetPhotos() { var id = $(".PictureGallery").attr("id"); document.getElementById(id).innerHTML = ""; var appid = document.getElementById('lblAppId1').value; var newappid = escape(appid); $.ajax({ type: "POST", url: "Orders.aspx/ImageFileLoad", data: "{'AppId':'" + newappid + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var id = $(".PictureGallery").attr("id"); var i; document.getElementById(id).innerHTML = ""; for (i = 0; i < msg.d.length; i++) { var elemdiv = document.createElement("div"); elemdiv.setAttribute("class", "Photosdisplay"); var elemdiv1 = document.createElement("div"); elemdiv1.setAttribute("style", "height:28px;"); var elemdiv2 = document.createElement("div"); elemdiv2.setAttribute("style", "text-align: center;"); var elem = document.createElement("img"); elem.setAttribute("src", msg.d[i].FilePath); elem.setAttribute("class", "Image"); elem.setAttribute("style", "width:auto;height:auto;max-height:114px;max-width:170px;"); elemdiv2.appendChild(elem); elemdiv.appendChild(elemdiv1); elemdiv.appendChild(elemdiv2); document.getElementById(id).appendChild(elemdiv); } $("#PhotosDisplay").css("display", "block"); } }); } function ClosePhotosPanel() { $("#PhotosDisplay").css("display", "none"); } function CheckPhotosExist() { var appid = document.getElementById('lblAppId1').value; var newappid = escape(appid); $.ajax({ type: "POST", url: "Orders.aspx/ImageFileLoad", data: "{'AppId':'" + newappid + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) $("#TogglePhotos").css("display", "block"); else $("#TogglePhotos").css("display", "none"); } }); } // Item Nutritions coding starting from here function Nvisible() { var imgvisible1 = document.getElementById('imgvisible1'); imgvisible1.src = "images/RoundMinus.png"; imgvisible1.alt = "Minus"; document.getElementById('imgvisible1').setAttribute("onclick", "Ninvisible();") $(".nutritiontable1").fadeIn("fast"); } function Ninvisible() { var imgvisible1 = document.getElementById('imgvisible1'); imgvisible1.src = "images/RoundPlus.png"; imgvisible1.alt = "Plus"; document.getElementById('imgvisible1').setAttribute("onclick", "Nvisible();") $(".nutritiontable1").fadeOut("fast"); } function GetItemNutrition(ItemId) { $.ajax({ type: "POST", url: "orders.aspx/GetItemNutritionDetails", data: "{'ItemId': '" + ItemId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { document.getElementById("txtCalories").innerHTML = msg.d[0].Calories; document.getElementById("txtCfat").innerHTML = msg.d[0].CaloriesFromFat; document.getElementById("txtTotalFat").innerHTML = msg.d[0].TotalFat; document.getElementById("txtSaturatedFat").innerHTML = msg.d[0].SaturatedFat; document.getElementById("txtTransFat").innerHTML = msg.d[0].TransFat; document.getElementById("txtCholestrol").innerHTML = msg.d[0].CholestrolMG; document.getElementById("txtSodium").innerHTML = msg.d[0].SodiumMG; document.getElementById("txtCarbohydrates").innerHTML = msg.d[0].TotalCarbohydrates; document.getElementById("txtFiber").innerHTML = msg.d[0].DietaryFiber; document.getElementById("txtSugars").innerHTML = msg.d[0].Sugars; document.getElementById("txtProtein").innerHTML = msg.d[0].Protein; if (msg.d[0].OtherNutritions != null && msg.d[0].OtherNutritions != "") { document.getElementById("tblOthernutr").innerHTML = ""; var others = msg.d[0].OtherNutritions; if (~others.indexOf(",")) { var nutr = new Array(); nutr = others.split(","); for (var i = 0; i < nutr.length; i++) { var tr = document.createElement("tr"); var td1 = document.createElement("td"); var td2 = document.createElement("td"); td1.setAttribute("style", "width: 90%"); td2.setAttribute("class", "Nutrition"); if (~nutr[i].indexOf("/")) { var nutrt = new Array(); nutrt = nutr[i].split("/"); if (nutrt[i] != "") { td1.innerHTML = nutrt[0]; td2.innerHTML = nutrt[1]; tr.appendChild(td1); tr.appendChild(td2); document.getElementById("tblOthernutr").appendChild(tr); } } else { if (nutr[i] != "") { td1.innerHTML = nutr[i]; td2.innerHTML = "0"; tr.appendChild(td1); tr.appendChild(td2); document.getElementById("tblOthernutr").appendChild(tr); } } $(".nutritiontable").fadeIn("fast"); } } else { var tr = document.createElement("tr"); var td1 = document.createElement("td"); var td2 = document.createElement("td"); td1.setAttribute("style", "width: 90%"); td2.setAttribute("class", "Nutrition"); if (~others.indexOf("/")) { var nutr = new Array(); nutr = others.split("/"); if (nutr[0] != "") { td1.innerHTML = nutr[0]; td2.innerHTML = nutr[1]; tr.appendChild(td1); tr.appendChild(td2); document.getElementById("tblOthernutr").appendChild(tr); } } else { td1.innerHTML = others; td2.innerHTML = "0"; tr.appendChild(td1); tr.appendChild(td2); document.getElementById("tblOthernutr").appendChild(tr); } $(".nutritiontable").fadeIn("fast"); } } else { document.getElementById("tblOthernutr").innerHTML = ""; $(".nutritiontable").fadeIn("fast"); } } else { $(".nutritiontable1").fadeOut("fast"); $(".nutritiontable").fadeOut("fast"); } } }); } // Item Nutritions coding ending here function StartGroupOrder() { var rclose = document.getElementById("lblholiday").innerHTML; if (rclose != "") { if (confirm(document.getElementById("lblAppName").innerHTML.replace("&", "&") + " Restaurant is Closed on " + document.getElementById("lblholiday").innerHTML + ". Are you sure, you want to proceed?")) { if (document.getElementById("UserId").innerHTML == "") SatrtGroupSignin(); else InsertGroup(); } } else { if (document.getElementById("UserId").innerHTML == "") { SatrtGroupSignin(); } else InsertGroup(); } } function SatrtGroupSignin() { document.getElementById('lblMsg12').innerHTML = ""; $("#signinpanel").find("input[type=text],input[type=password]").val(''); $(".registererror").css("display", "none"); $("#signinpanel").find("input[type=text],input[type=password]").removeClass("userlogin_formtext1Error").addClass("userlogin_formtext1"); if (document.getElementById('popupsscroll').innerHTML == "over") { $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 500); } else { $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 0); } $('.signinpanel').fadeIn("slow"); $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); document.getElementById('lblOpenPanel').innerHTML = "StartGroupOrder" } function InsertGroup() { var LocationId = document.getElementById('lblLId').value; var parentUrl1 = document.getElementById("lblcwurl1").innerHTML; var pageURL = window.location; if (LocationId != null || LocationId != "") { $(".startorder").css("display", "block"); $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/StartGroupOrder", data: "{'LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { InsertNewMember(msg.d); var Details = new Object; Details.GroupId = msg.d; localStorage.setItem("GroupIdExist", JSON.stringify(Details)); if (parentUrl1 != "") { var url = parentUrl1; if (location.hostname == "localhost") { url = url.replace(parentUrl1, pageURL + "?" + "GroupId=" + msg.d); document.getElementById('txtShUrl').value = url; } else if (location.hostname == "107.130.183.186") { url = url.replace(parentUrl1, pageURL + "?" + "GroupId=" + msg.d); document.getElementById('txtShUrl').value = url; } else if (location.hostname == "64.37.50.50") { url = url.replace(parentUrl1, pageURL + "?" + "GroupId=" + msg.d); document.getElementById('txtShUrl').value = url; } else { url = url.replace(parentUrl1, pageURL + "?" + "GroupId=" + msg.d); document.getElementById('txtShUrl').value = url; } } else if (location.hostname == "localhost") { document.getElementById('txtShUrl').value = pageURL+ "?" + "GroupId=" + msg.d; } else if (location.hostname.indexOf("216.239.163.155") != null && location.hostname.indexOf("216.239.163.155") >= 0) { document.getElementById('txtShUrl').value = pageURL+ "?" + "GroupId=" + msg.d; } else if (location.hostname.indexOf("107.130.183.186") == null) { document.getElementById('txtShUrl').value = pageURL+ "?" + "GroupId=" + msg.d; } else if (location.hostname.indexOf("64.37.50.50") == null) { document.getElementById('txtShUrl').value = pageURL+ "?" + "GroupId=" + msg.d; } else { document.getElementById('txtShUrl').value = pageURL+ "?" + "GroupId=" + msg.d; } $("#pnlgrouporder").fadeIn("slow"); $(".startorder").css("display", "none"); } } }); } } function InsertNewMember(GroupId) { var retrievedData = localStorage.getItem("TotalItems"); var myItem = localStorage.getItem('CheckedDeliveryAddress'); var FirstName = ""; //localStorage.clear(); localStorage.setItem('CheckedDeliveryAddress', myItem); if (GroupId != null || GroupId != "") { $.ajax({ type: "POST", url: "Orders.aspx/SessionLogin", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { FirstName = msg.d[0].FirstName; if (msg.d[0].FirstName != null || msg.d[0].FirstName != "") { $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/InsertNewMember", data: "{'MemberType': 'Admin','GroupId': '" + GroupId + "','Name': '" + msg.d[0].FirstName + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var Details = new Object; Details.MemberType = "Admin"; Details.GroupId = GroupId; Details.MemberId = msg.d; Details.MemberName = FirstName; localStorage.setItem("GroupMemberType", JSON.stringify(Details)); if (retrievedData != null) { $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/InsertItemsForAdmin", data: "{'Item': '" + retrievedData + "','GroupId': '" + GroupId + "','MemberId': '" + msg.d + "'}", dataType: "json", contentType: "application/json", success: function (msg) { } }); } } } }); } } } }); } } function grouporderClose() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var GroupOrderType = Orderstring["GroupOrderType"]; $(".startorder").css("display", "block"); if (GroupOrderType == "AdminReOrder") { var URL = document.getElementById('txtShUrl').value; URL = URL.replace("MemberReOrder","AdminReOrder"); document.getElementById('txtShUrl').value = URL; } else if (GroupOrderType == "MemberReOrder") { var URL = document.getElementById('txtShUrl').value; document.getElementById('txtShUrl').value = URL; } window.location = document.getElementById('txtShUrl').value; $("#pnlgrouporder").css("display", "none"); $("#pnlgrouporderconfirm").css("display", "none"); $('.startgright').css("display", "none"); } function grouporderconfirmClose() { $("#pnlgrouporderconfirm").css("display", "none"); } function grouporvalidation() { $(".startorder1").css("display", "block"); $(".Psucess").text(""); localStorage.removeItem("SMSOREMAIL"); if ($('#txtemailorphno').text() != "") { $("#txtemailorphno").removeAttr("style"); var Phnumberexp = /^\d{10}$/; var EmailExp = /^[A-Z0-9#-_~!$&()*+,;=:]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i; var totalinfo1 = $('#txtemailorphno').text(); var totalinfo = totalinfo1.replace(/\s/g, ''); var array = new Array(); array = totalinfo.split("×"); var Correct = new Array(); var message = ""; var URL = document.getElementById('txtShUrl').value; for (var i = 0; i < array.length - 1; i++) { if (array[i] != "") { var Type; if (array[i].match(EmailExp)) { Type = "Email" + array[i]; Correct.push(Type); } else { var Number = array[i]; if (~Number.indexOf('+') || ~Number.indexOf("+1") || ~Number.indexOf("+91")) { var phone; if (~Number.indexOf('+91')) { phone = Number.replace('+91', ""); } else if (~Number.indexOf('+1')) { phone = Number.replace('+1', ""); } else { phone = Number.replace('+', ""); } if (!phone.match(Phnumberexp)) { if (phone.length != '10') { if (message == "") { message = array[i]; } else { message += "," + array[i]; } } else { if (message == "") { message = array[i]; } else { message += "," + array[i]; } } } else { Type = "Phone" + phone; Correct.push(Type); } } else if (!Number.match(Phnumberexp)) { if (Number.length != '10') { if (message == "") { message = array[i]; } else { message += "," + array[i]; } } else { if (message == "") { message = array[i]; } else { message += "," + array[i]; } } } else { Type = "Phone" + array[i]; Correct.push(Type); } } if (i == array.length - 2) { if (message != "") { $("#lblordalert").text("Please enter correct details " + message); $(".orderalert").fadeIn(); $(".startorder1").css("display", "none"); } else { SendEmailPhone(Correct); } } } else { if (i == array.length - 1) { $("#lblordalert").text("Please enter correct details " + message); $(".orderalert").fadeIn(); $(".startorder1").css("display", "none"); } } } } else { $("#txtemailorphno").focus(); $("#txtemailorphno").attr("style", "border: 1px solid red"); $(".startorder1").css("display", "none"); } } function SendEmailPhone(Data) { var CountryName = "US"; if (document.getElementById("lblCurrency").innerHTML != "$") { CountryName = "India"; } var URL = document.getElementById('txtShUrl').value; for (var i = 0; i < Data.length; i++) { if (~Data[i].indexOf("Email")) { var Value = escape(Data[i].replace("Email", "")); $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/SendGroupOrderEmail", data: "{'RName': '" + escape(document.getElementById('lblAppName').innerHTML) + "','Email': '" + escape(Value) + "','Link': '" + escape(URL) + "', 'message': '" + escape(document.getElementById('txtmessage').value) + "', 'CountryName': '" + CountryName + "'}", dataType: "json", contentType: "application/json", success: function (msg) { $(".sendloader").css("display", "none"); $(".successmsg").text("Successfully shared"); $("#pnlgrouporderconfirm").css("display", "block"); //var msg = 'Successfully sent request to your group, Would you like to add more to your group?'; //var div = $("<div>" + msg + "</div>"); //div.dialog({ // title: "Confirm", // buttons: [ // { // text: "Yes", // click: function () { // div.dialog("close"); // } // }, // { // text: "No", // click: function () { // div.dialog("close"); // $(".startorder").css("display", "block"); // window.location = document.getElementById('txtShUrl').value; // $("#pnlgrouporder").css("display", "none"); // } // } // ] //}); } }); } else if (~Data[i].indexOf("Phone")) { var Value = escape(Data[i].replace("Phone", "")); $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/SendGroupOrderSMS", data: "{'RName': '" + escape(document.getElementById('lblAppName').innerHTML) + "','PhoneNum': '" + escape(Value) + "','Link': '" + escape(URL) + "', 'CountryName': '" + CountryName + "' , 'message': '" + escape(document.getElementById('txtmessage').value) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { $(".sendloader").css("display", "none"); $(".successmsg").text("Successfully shared"); } }); } if (i == Data.length - 1) { $(".tag").empty(); $(".tag").remove(); document.getElementById('txtmessage').value = ""; $(".startorder1").css("display", "none"); } } } </script> <script type="text/javascript"> function GetCurrentLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition, showError); } else { $("#lblordalert").text("Geolocation is not supported by this browser."); $(".orderalert").fadeIn(); } } function showError(error) { switch (error.code) { case error.PERMISSION_DENIED: $("#lblordalert").text("Location information is unavailable. Please enter your address manually."); $(".orderalert").fadeIn(); break; case error.POSITION_UNAVAILABLE: $("#lblordalert").text("Location information is unavailable. Please enter your address manually."); $(".orderalert").fadeIn(); break; case error.TIMEOUT: $("#lblordalert").text("Location information is unavailable. Please enter your address manually."); $(".orderalert").fadeIn(); break; case error.UNKNOWN_ERROR: $("#lblordalert").text("Location information is unavailable. Please enter your address manually."); $(".orderalert").fadeIn(); break; } } function showPosition(position) { var Line1; var Country; var lat = position.coords.latitude; var lng = position.coords.longitude; var latlng = new google.maps.LatLng(lat, lng); var geocoder = geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'latLng': latlng }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[0]) { for (var i = 0; i < results[2].address_components.length; i++) { for (var b = 0; b < results[2].address_components[i].types.length; b++) { //there are different types that might hold a city admin_area_lvl_1 usually does in come cases looking for sublocality type will be more appropriate if (results[2].address_components[i].types[b] == "administrative_area_level_1") { //this is the object you are looking for state = results[2].address_components[i]; break; } if (results[2].address_components[i].types[b] == "postal_code") { //this is the object you are looking for Zipcode = results[2].address_components[i]; break; } if (results[2].address_components[i].types[b] == "locality") { //this is the object you are looking for city = results[2].address_components[i]; break; } if (results[2].address_components[i].types[b] == "country") { //this is the object you are looking for Country = results[2].address_components[i]; break; } if (results[2].formatted_address != undefined && results[2].formatted_address != null); Line1 = results[2].formatted_address; } } var Homeaddress = Line1.replace(city.long_name + ",", "").replace(state.long_name + " " + Zipcode.long_name + ",", "").replace(Country.long_name, ""); //Address data var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.selectedIndex != -1) { var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; if (OrderTypevalue != "--Select Order Type--") { if (OrderTypevalue == "Shipping") { $(".shploader").css("display", "block"); if ($('#ddlshpcountry > option').length > 1) {// has countries or not if ($('#ddlshpcountry option[value="' + Country.long_name + '"]').length > 0) {// has existed country or not $("#ddlshpcountry").val(Country.long_name);//select country if exist BindShippingStates(state.long_name, Homeaddress, city.long_name, Zipcode.long_name); } else ShippingNotAvailable(); } else ShippingNotAvailable(); } else { document.getElementById('txtaddress').value = Homeaddress; document.getElementById('txtvalidationstate').value = state.long_name; document.getElementById('txtvalidationzip').value = Zipcode.long_name; document.getElementById('txtvalidationcity').value = city.long_name; } } } } } }); } function GetCardBillingInfo() { var BInfo = localStorage.getItem('CardBillingInfo'); var BillingInfo = JSON.parse(BInfo); if (BillingInfo != null) { if (BillingInfo.length > 0) { document.getElementById("txtcLine1").value = BillingInfo[0].Line1; document.getElementById("txtcline2").value = BillingInfo[0].Line2; document.getElementById("txtcCity").value = BillingInfo[0].City; document.getElementById("txtCState").value = BillingInfo[0].State; document.getElementById("txtBZC").value = BillingInfo[0].Zip; if (BillingInfo[0].FirstName != undefined) { document.getElementById("txtcardname").value = BillingInfo[0].FirstName; document.getElementById("txtClastname").value = BillingInfo[0].LastName; document.getElementById("txtcardno").value = BillingInfo[0].CardNumber; BindCardExpiryDates(BillingInfo[0].ExpiryMonth, BillingInfo[0].ExpiryYear); } else BindCardExpiryDates('', ''); } else BindCardExpiryDates('', ''); } else BindCardExpiryDates('', ''); } function BindCardExpiryDates(ExpiryMonth, ExpiryYear) { if (document.getElementById("lblfinishcount").innerHTML == "0") {// this condition is used without binding everytime when finishorder is cliked.so the selected values are not clear BindMonths(ExpiryMonth); BindYears(ExpiryYear); document.getElementById("lblfinishcount").innerHTML = "1"; } } function ShippingNotAvailable() { $(".shploader").css("display", "none"); $("#lblordalert").text("Current address is not available for Shipping. Please enter your address manually."); $(".orderalert").fadeIn(); } </script> <script type="text/javascript"> function DChangelink() { document.getElementById("lbldchange").innerHTML = "OpenDpanel"; $("#UserDeliveryPanel").fadeOut("fast"); $("#GuestDeliveryPanel").fadeOut("fast"); var OrderType = localStorage.getItem("OrderType"); CartDeliveryCheck(OrderType); } //Popups will be closed, we clicked on black screen $(".companymodal").click(function () { $(".CompanyRegistrepnl").css("display", "none"); }) $(".photosmodal").click(function () { $(".PhotosDisplay").css("display", "none"); }) $(".grouporrdmodal").click(function () { $(".pnlgrouporder").css("display", "none"); $(".pnlpopup").css("display", "none"); }) $(".reservemodal").click(function () { $(".reservationPanel").css("display", "none"); }) </script> <script type="text/javascript"> function GetCouponByLocationId() { var LocationId = document.getElementById('lblLId').value; var TimeZoneName = document.getElementById('lbltimezonename').value; var RawOffset = document.getElementById('lblrawoffset').innerHTML; var DataOffset = document.getElementById('lbldataoffset').innerHTML; $.ajax({ type: "POST", url: "Orders.aspx/GetCouponByLocationId", data: "{'LId': '" + LocationId + "','Timezone':'" + TimeZoneName + "','RawOffset':'" + RawOffset + "','DataOffset':'" + DataOffset + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { document.getElementById('Promocodetxt').value = msg.d[0].PromoCode; CheckDeal(); } } }); } // Start Code for User Email and Phone verification code to use munchies function Closepnluserverify() { $(".pnluserverify").css("display", "none"); } function Closepnlphverif() { $(".pnlphverif").css("display", "none"); } function SendConfrimationCode() { var Resend = "ResendText"; var Email = document.getElementById("EmailID").innerHTML; if (document.getElementById("luphno").innerHTML != "") { if (Email != null && Email != "") { $.ajax({ type: "POST", url: "orders.aspx/ResendEmailAndTextMessageToUser", data: "{'Email': '" + Email + "', 'Resend':'" + Resend + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { $(".pnluserverify").css("display", "none"); $(".pnlphverif").css("display", "block"); $(".adjustpnlphverif").css("margin-top", $(document).scrollTop() - 30); document.getElementById("lblphnomsg").innerHTML = msg.d; } } }); } } else { $("#lblordalert").text("Phone Number is not existed. Please update it in My Account -> My Profile "); $(".orderalert").fadeIn(); } } function SendConfemail() { var Resend = "ResendEmail"; var Email = document.getElementById("EmailID").innerHTML; if (Email != null) { $.ajax({ type: "POST", url: "orders.aspx/ResendEmailAndTextMessageToUser", data: "{'Email': '" + Email + "', 'Resend':'" + Resend + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { $("#lblorderror").text(msg.d); $(".ordererror").show().delay(3000).fadeOut(); $(".pnluserverify").css("display", "none"); FinishOrder(); } } }); } } function Phnoverifyvalidation() { if (document.getElementById("txtphvcode").value != "") { var Code = document.getElementById("txtphvcode").value; if (Code != null && Code != "") { $.ajax({ type: "POST", url: "orders.aspx/ActivateAccount", data: "{'Email': '" + "" + "', 'Code':'" + Code + "','SignedEmail': '" + document.getElementById("EmailID").innerHTML + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "success") { $(".pnlphverif").css("display", "none"); FinishOrder(); } else { document.getElementById("lblphnomsg").innerHTML = "Please enter correct code"; } } }); } } else { document.getElementById("lblphnomsg").innerHTML = "Please enter code"; } } $('#pnlphverif').keypress(function (e) { if (e.keyCode == '13') { Phnoverifyvalidation();//Phone verification Validations. e.preventDefault(); e.stopPropagation(); } }); // End code for User Email and Phone verification code to use munchies $('#txtItemSearch').autocomplete({ source: function (request, response) { var LocationId = document.getElementById('lblLId').value; var s = document.getElementById('txtItemSearch').value.trim(); var AppId = document.getElementById('lblAppId1').value; if (s != " ") { $.ajax({ url: "Orders.aspx/GetItemNames", dataType: "json", data: "{'prefixText': '" + s + "','Action': '" + LocationId + "','AppId': '" + AppId + "','OrderType':''}", contentType: "application/json; charset=utf-8", type: "POST", dataFilter: function (data) { return data; }, success: function (data) { if (data.d.split(',').length > 9) { $(".ui-autocomplete").css("height", "200px"); } else { $(".ui-autocomplete").css("height", "auto"); } response(data.d.split(',')); }, }); } }, select: function (e, ui) { var sname = ui.item.value; } }); function DeleteItemSearch() { $("#deleteitems").fadeOut("fast"); $(".itemsearchicon ").fadeIn("slow"); document.getElementById("txtItemSearch").value = ""; $("#lblsrhmsg").text(""); GetMenuCategories(); } $('#txtItemSearch').keypress(function (e) { if (e.keyCode == '13') { ItemNameSearch(); e.preventDefault(); e.stopPropagation(); } }); function ItemNameSearch() { $("#lblsrhmsg").text(""); var appname = document.getElementById("txtItemSearch").value; var i = 0; if (appname == '') { document.getElementById('txtItemSearch').className = 'itemsearcherror'; $("#txtItemSearch").focus(); $(".itemsearchicon ").fadeIn("slow"); $("#deleteitems").fadeOut("slow"); return; } else { document.getElementById('txtItemSearch').className = 'itemsearch'; GetMenuBySearch(); $(".itemsearchicon ").fadeOut("slow"); $("#deleteitems").fadeIn("slow"); } } function GetMenuBySearch() { $("#lblsrhmsg").text(""); //$(".menusrtb").css("display", "block"); $(".addcategoryloadingimage").css("display", "block"); var h = 0; var PickUp = ""; var Delivery = ""; var AppName = ""; var LocationName = ""; var Shipping = ""; var CustomTypeOrders = ""; var EntityDetails = localStorage.getItem("EntityDetails"); EntityDetails = JSON.parse(EntityDetails); if (EntityDetails != null) { h = EntityDetails.Allow; PickUp = EntityDetails.PickUp; Delivery = EntityDetails.Delivery; AppName = EntityDetails.AppName; LocationName = EntityDetails.LocationName; Shipping = EntityDetails.Shipping; CustomTypeOrders = EntityDetails.OtherDeliveryService; } var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; var UserOrderType = ""; $(".addcategoryloadingimage").css("display", "block"); var ItemName = document.getElementById('txtItemSearch').value.trim(); $("#lblsrhmsg").text(""); $("#lblsrhmsg").css("display","block"); $.ajax({ type: "POST", url: "Orders.aspx/GetItemsBYItemName", data: "{'LocationId': '" + LocationId + "','AppId': '" + AppId + "','ItemName':'" + ItemName + "','OrderType':''}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { document.getElementById('Itemstable').innerHTML = ""; if($("#lblMenuTheme").val() == "New-Grid" || $("#lblMenuTheme").val() == "New-Grid-no-images"){ //if (document.getElementById('lblAppId1').value == "5b64040f-4585-467d-b37c-4a4ad30304c6") { MenuNewGridDesignSearchItems(msg); }else{ BindAllItemsforItemSearch(msg, "Search", "", PickUp, Delivery, Shipping, CustomTypeOrders, h); } } else { document.getElementById('Itemstable').innerHTML = ""; $(".itemsearchicon ").fadeIn("slow"); $("#deleteitems").fadeOut("slow"); $("#lblsrhmsg").text("No item(s) found."); setTimeout(function () { $("#lblsrhmsg").css("display","none"); }, 1000); } $(".addcategoryloadingimage").css("display", "none"); } }); } </script> <script type="text/javascript"> function Couponadd() { var UId = document.getElementById("UserId").innerHTML; if (UId != null && UId != "undefined" && UId != "") { var Hours = []; Hours = ["12:00 AM", "12:30 AM", "01:00 AM", "01:30 AM", "02:00 AM", "02:30 AM", "03:00 AM", "03:30 AM", "04:00 AM", "04:30 AM", "05:00 AM", "05:30 AM", "06:00 AM", "06:30 AM", "07:00 AM", "07:30 AM", "08:00 AM", "08:30 AM", "09:00 AM", "09:30 AM", "10:00 AM", "10:30 AM", "11:00 AM", "11:30 AM", "12:00 PM", "12:30 PM", "01:00 PM", "01:30 PM", "02:00 PM", "02:30 PM", "03:00 PM", "03:30 PM", "04:00 PM", "04:30 PM", "05:00 PM", "05:30 PM", "06:00 PM", "06:30 PM", "07:00 PM", "07:30 PM", "08:00 PM", "08:30 PM", "09:00 PM", "09:30 PM", "10:00 PM", "10:30 PM", "11:00 PM", "11:30 PM",] for (var i = 0; i < Hours.length; i++) { $('#ddlfromtimes1').append('<option value="' + Hours[i] + '">' + Hours[i] + '</option>'); } if ($("#lblCurrency").text() == "₹") $('#ddlcupndistype').append('<option value="₹ Amount">₹ Amount</option>'); else $('#ddlcupndistype').append('<option value="$ Amount">$ Amount</option>'); $('#ddlcupndistype').append('<option value="% Discount">% Discount</option>'); $("#txtcupnrst").val($("#lblAppName").text() + " - " + $("#lbllocationname").text()); $("#couponpnl").fadeIn("slow"); $("#divcoupons").css("display","none"); } else { $(".signinpanel").fadeIn("slow"); $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); } } function Coupoaddclose() { $("#couponpnl").fadeOut("fast"); } function GetMenuCategories() { var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; var UserOrderType = ""; var Orderstring = getQueryStrings(); var Type = Orderstring["Type"]; if (Type != undefined) UserOrderType = Type; var h = 0; var PickUp = ""; var Delivery = ""; var CustomTypeOrders = ""; var LocationName = ""; var Shipping = ""; var EntityDetails = localStorage.getItem("EntityDetails"); EntityDetails = JSON.parse(EntityDetails); if (EntityDetails != null) { h = EntityDetails.Allow; PickUp = EntityDetails.PickUp; Delivery = EntityDetails.Delivery; AppName = EntityDetails.AppName; LocationName = EntityDetails.LocationName; Shipping = EntityDetails.Shipping; CustomTypeOrders = EntityDetails.OtherDeliveryService; } var Orderstring = getQueryStrings(); var ItemId = Orderstring["ItemId"]; if (ItemId == undefined) { if ($("#lblMenuTheme").val() != "Grid" && $("#lblMenuTheme").val() != "Grid-no-images" && $("#lblMenuTheme").val() != "New-Grid" && $("#lblMenuTheme").val() != "New-Grid-no-images") { $.ajax({ type: "POST", url: "Orders.aspx/GetMenuCategories", data: "{'LocationId': '" + LocationId + "','AppId': '" + AppId + "','OrderType': '" + UserOrderType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById('Itemstable').innerHTML = ""; if (msg.d.length > 0) { var CatId = Orderstring["CatId"]; if (CatId != undefined) { for (var C = 0; C < msg.d.length; C++) { if (msg.d[C].CategoryId == CatId) { var CategoryTable = ""; var cdesc = ""; var cstatus = false; var Viewonlycategory = ""; if (msg.d[C].Description != "" && msg.d[C].Description != "\n" && msg.d[C].Description != null && msg.d[C].Description != "null") cdesc += "<div class='itemcdes' style='" + CategoryBold + ";" + CategoryFontFamily + ";" + CategoryTextColor + "'>" + msg.d[C].Description + "</div>"; if (msg.d[C].ViewOnly == true) cstatus = true; if (cstatus == true) Viewonlycategory = "<span style='color:#fd8534'>(View Only)</span>"; CategoryTable += "<div class='itemfont' id=" + msg.d[C].CategoryId + " onclick= 'BindCategoryItemsandSubCategories(this);' Status= '" + cstatus + "' style='" + MenuColors + "'>"; if (msg.d[C].ThumbnailURL != null) CategoryTable += "<div class='categoryfleft' style= '" + CategoryTextColor + ";" + CategoryBgColor + "'><img id='img" + msg.d[C].Name + "' src='" + msg.d[C].ThumbnailURL + "' alt='" + msg.d[C].Name + "' /></div><div class='categoryleft1' style= '" + CategoryTextColor + "'><span style='" + CategoryBold + ";" + CategoryFontSize + ";" + CategoryFontFamily + "'>" + msg.d[C].Name + Viewonlycategory + "</span>" + cdesc + "</div><div class='categoryright'><i class= 'arrow downArrow' style= '" + MenuForeColors + "'></i></div>"; else CategoryTable += "<div class='categoryleft' style= '" + CategoryTextColor + ";" + CategoryBgColor + "'><span style='" + CategoryBold + ";" + CategoryFontSize + ";" + CategoryFontFamily + "'>" + msg.d[C].Name + Viewonlycategory + "</span>" + cdesc + "</div><div class='categoryright'><i class= 'arrow downArrow' style= '" + MenuForeColors + "'></i></div>"; CategoryTable += "</div><div class='catitems' id= 'ItemsOf" + msg.d[C].CategoryId + "' style='" + MenuFont + "'></div>"; document.getElementById('Itemstable').innerHTML += CategoryTable; var QueryString = getQueryStrings(); var Menuexpand = QueryString["Mcollaps"]; if (msg.d[C].CollapseCategory != null) { if (msg.d[C].CollapseCategory == true) { BindCategoryItemsandSubCategories(msg.d[C].CategoryId); } else { if (Menuexpand != "" && Menuexpand != null && Menuexpand != "undefined") { if (Menuexpand == "No") { BindCategoryItemsandSubCategories(msg.d[C].CategoryId); } } else if (document.getElementById('lblMenuType').value == "Expand") { BindCategoryItemsandSubCategories(msg.d[C].CategoryId); } } } $(".addcategoryloadingimage").css("display", "none"); } } } else { for (var C = 0; C < msg.d.length; C++) { // start code For scroll to particular category[anchor name tag or # tag] var CategoryTable = " <a name='" + msg.d[C].Name.toLowerCase() + "' id='AchorName" + msg.d[C].CategoryId + "' style='display:none' ></a>"; // End code For scroll to particular category var cdesc = ""; var cstatus = false; if (msg.d[C].Description != "" && msg.d[C].Description != "\n" && msg.d[C].Description != null && msg.d[C].Description != "null") cdesc += "<div class='itemcdes' style='" + CategoryBold + ";" + CategoryFontFamily + ";" + CategoryTextColor + "'>" + msg.d[C].Description + "</div>"; if (msg.d[C].ViewOnly == true) cstatus = true; var Viewonlycategory = ""; if (cstatus == true) Viewonlycategory = "<span style='color:#fd8534'>(View Only)</span>"; CategoryTable += "<div class='itemfont' id=" + msg.d[C].CategoryId + " onclick= 'BindCategoryItemsandSubCategories(this);' Status= '" + cstatus + "' style='" + MenuColors + "'>"; if (msg.d[C].ThumbnailURL != null) CategoryTable += "<div class='categoryfleft' style= '" + CategoryTextColor + ";" + CategoryBgColor + "'><img id='img" + msg.d[C].Name + "' src='" + msg.d[C].ThumbnailURL + "' alt='" + msg.d[C].Name + "' /></div><div class='categoryleft1' style= '" + CategoryTextColor + "'><span style='" + CategoryBold + ";" + CategoryFontSize + ";" + CategoryFontFamily + "'>" + msg.d[C].Name + Viewonlycategory + "</span>" + cdesc + "</div><div class='categoryright'><i class= 'arrow downArrow' style= '" + MenuForeColors + "'></i></div>"; else CategoryTable += "<div class='categoryleft' style= '" + CategoryTextColor + ";" + CategoryBgColor + "'><span style='" + CategoryBold + ";" + CategoryFontSize + ";" + CategoryFontFamily + "'>" + msg.d[C].Name + Viewonlycategory + "</span>" + cdesc + "</div><div class='categoryright'><i class= 'arrow downArrow' style= '" + MenuForeColors + "'></i></div>"; CategoryTable += "</div><div class='catitems' id= 'ItemsOf" + msg.d[C].CategoryId + "' style='" + MenuFont + "'></div>"; document.getElementById('Itemstable').innerHTML += CategoryTable; var QueryString = getQueryStrings(); var Menuexpand = QueryString["Mcollaps"]; if (msg.d[C].CollapseCategory != null) { if (msg.d[C].CollapseCategory == true) { BindCategoryItemsandSubCategories(msg.d[C].CategoryId); } else { if (Menuexpand != "" && Menuexpand != null && Menuexpand != "undefined") { if (Menuexpand == "No") { BindCategoryItemsandSubCategories(msg.d[C].CategoryId); } } else if (document.getElementById('lblMenuType').value == "Expand") { BindCategoryItemsandSubCategories(msg.d[C].CategoryId); } } } $(".addcategoryloadingimage").css("display", "none"); // code for opening category for anchor name tag or # tag if (C == msg.d.length - 1) { if (window.location.hash.substr(1) != '') { var ele = document.getElementsByName(unescape(window.location.hash.substr(1)).toLowerCase())[0]; if (ele != undefined) { var CAtID = ele.id.replace("AchorName", ""); $("#" + CAtID).trigger("click"); $('html, body').stop().animate({ scrollTop: $("#" + CAtID).offset().top }, 1000); } } } } } $(".addcategoryloadingimage").css("display", "none"); } else { document.getElementById("nosettingslbl").innerHTML = "Restaurant Menu not available for ordering at this time"; $("#nosettingslbl").addClass("ordererrormsg"); $(".addcategoryloadingimage").css("display", "none"); $(".menusrtb").css("display", "none"); $("#nosettingslbl").css("display", "block"); return; } BindOrderTypes(); EnableAddress(); //$(".addcategoryloadingimage").css("display", "none"); GetCouponByLocationId(); GetSocialMediaDetails(LocationId); BindInfo(); } }); } else { if ($("#lblMenuTheme").val() == "New-Grid" || $("#lblMenuTheme").val() == "New-Grid-no-images") { //if (document.getElementById('lblAppId1').value == "5b64040f-4585-467d-b37c-4a4ad30304c6") { MenuNewDesign1(); } else { $.ajax({ type: "POST", url: "Orders.aspx/GetMenuCategories", data: "{'LocationId': '" + LocationId + "','AppId': '" + AppId + "','OrderType': '" + UserOrderType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { MenuNewDesign(msg, "", "", PickUp, Delivery, Shipping, CustomTypeOrders, h, ""); //MenuNewDesign1(); $(".addcategoryloadingimage").css("display", "none"); } }); } BindOrderTypes(); } } else { $.ajax({ type: "POST", url: "Orders.aspx/GetItemsBYItemName", data: "{'LocationId': '" + LocationId + "','AppId': '" + ItemId + "','ItemName':'GetItemByItemId'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { document.getElementById('Itemstable').innerHTML = ""; BindAllItems(msg, "Search", "", PickUp, Delivery, Shipping, CustomTypeOrders, h); } else $("#lblsrhmsg").text("No item(s) found."); $(".addcategoryloadingimage").css("display", "none"); GetCouponByLocationId(); GetSocialMediaDetails(LocationId); BindInfo(); } }); } var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetAllItems(); } } function MenuNewDesign(msg, id, Status, PickUp, Delivery, Shipping, CustomTypeOrders, h,CatName) { //if (id != "") { // alert($("#" + id).children(".mncatname").text()); alert($("#" + id).find(".mncatname").text()) //} //$(".TabbedPanelsfororder").css("width", "100%"); //$(".scrollcart").css("display", "none"); //$(".couponrt").css("display", "none"); if (id == "") { var maincatdiv = "<div class='mncatht'>"; var cstatus = false; for (var i = 0; i < msg.d.length; i++) { if (msg.d[i].ViewOnly == true) cstatus = true; if (i % 4 == 0) maincatdiv += "</div><div class='mncatht'>"; maincatdiv += "<div class='mncatlft' id=" + msg.d[i].CategoryId + " Status='" + cstatus + "' onclick='BindCategoryItemsandSubCategories(this)'>"; if (msg.d[i].ThumbnailURL != null) maincatdiv += "<div class='mncatfst'><img class='allitemimage' src='" + msg.d[i].ImageUrl + "' /></div>"; else maincatdiv += "<div class='mncatfst'><img class='allitemimage' src='images/noitemImg.png' /></div>"; maincatdiv += "<div class='mncatname' style='" + MenuColors + ";" + CategoryTextColor + "'><span style='"+CategoryBold+";"+CategoryFontSize+";color:black;"+CategoryFontFamily+"'>" + msg.d[i].Name +"</span>"; if (msg.d[i].ViewOnly == true) maincatdiv += "<div class='mncatview'>View Only</div>"; maincatdiv += "</div></div>"; } document.getElementById('Itemstable').innerHTML = maincatdiv; if (window.innerWidth > 767) { if (msg.d.length < 4) { $(".mncatht").css("margin", "0 auto"); if (msg.d.length < 4) { $(".mncatht").css("width", "80%"); $(".mncatlft").css("width", "30%"); } if (msg.d.length < 3) { $(".mncatht").css("width", "60%"); $(".mncatlft").css("width", "40%"); } if (msg.d.length < 2) { $(".mncatht").css("width", "25%"); $(".mncatlft").css("width", "96%"); } } } } else { if (CatName == "") CatName = $("#" + id).children(".mncatname").text(); var viewonly = ""; if (CatName.indexOf("View Only") != -1) { viewonly = "<span style='color: #fd8534;font-size: 14px;font-weight:600'> View Only</span>"; CatName = CatName.replace("View Only", ""); } var maincatdiv = "<div class='category-title'><span class='category-titletxt'><h3 class='mncatithd'>" + CatName + viewonly + "</h3></span><span class='backcategory-titletxt'><input type='button' onclick='GetCategoriesOnly()' value='Back to Categories' class='mncatbacktab' style='" + ButtonColor + "' /></span></div><div class='mncatht'>"; var MenuQunatity = document.getElementById("lblshowquantity").innerHTML; var ItemClick = "GetItemOptions(this)"; if (Status == "true") ItemClick = 'DineInOnly("Show", this);'; for (var i = 0; i < msg.d.length; i++) { if (msg.d[i].EntityType == "SubCategory" || msg.d[i].EntityType == "SubSubCategory") { maincatdiv += "<div class='mncatlft' id=" + msg.d[i].Id + " Status='" + cstatus + "' onclick='BindCategoryItemsandSubCategories(this)'>"; if (msg.d[i].ThumbnailURL != null) maincatdiv += "<div class='mncatfst'><img class='allitemimage' src='" + msg.d[i].ImageUrl + "' id=" + msg.d[i].Id + " onclick='" + ItemClick + "' /></div>"; else maincatdiv += "<div class='mncatfst'><img class='allitemimage' src='images/noitemImg.png' id=" + msg.d[i].Id + " onclick='" + ItemClick + "' /></div>"; maincatdiv += "<div class='mncatname' style=" + MenuColors + ';' +CategoryTextColor+ "><span style='"+CategoryBold+";"+CategoryFontSize+";color:black;"+CategoryFontFamily+"'>" + msg.d[i].Name +"</span>"; if (msg.d[i].ViewOnly == true) maincatdiv += "<div class='mncatview'>View Only</div>"; maincatdiv += "</div></div>"; } if (msg.d[i].EntityType == "Item") { var cartbtn = ""; if (i % 4 == 0) maincatdiv += "</div><div class='mncatht'>"; if (MenuQunatity == "Enable") { if (msg.d[i].ItemAvailability == "NoQuantity") { maincatdiv += "<div id='ItemsOf"+id+"' class='mncatlft' style='border: 1px solid " + DividerColor + ";'>"; cartbtn = "<div><label id='qty" + msg.d[i].Id + "' style='color:white'>" + msg.d[i].ItemAvailability + "</label></div><div class='mncatqt'><input type='button' value='Choose Qty & Options' id=" + msg.d[i].Id + " onclick='" + ItemClick + "' class='mncatqttab' style='" + ButtonColor + "' /></div>"; } else { var Quantity = Number(msg.d[i].ItemAvailability); if (Quantity > 0) { maincatdiv += "<div class='mncatlft' id='ItemsOf"+id+"' style='border: 1px solid " + DividerColor + ";'>"; cartbtn = "<div><label id='qty" + msg.d[i].Id + "' style='margin-left:5px'>" + msg.d[i].ItemAvailability + "</label><span> Items left</span></div><div class='mncatqt'><input type='button' value='Choose Qty & Options' id=" + msg.d[i].Id + " onclick='" + ItemClick + "' class='mncatqttab' style='" + ButtonColor + "' /></div>"; } else { maincatdiv += "<div class='mncatlft' id='ItemsOf"+id+"' style='opacity:0.4;border: 1px solid " + DividerColor + ";'>"; cartbtn = "<div><label id='qty" + msg.d[i].Id + "' style='margin-left:5px'>" + msg.d[i].ItemAvailability + "</label><span> Items left</span></div>"; } } } else { maincatdiv += "<div class='mncatlft' id='ItemsOf"+id+"' style='border: 1px solid " + DividerColor + ";'>"; cartbtn = "<div><label id='qty" + msg.d[i].Id + "' style='display:none'>NoQuantity</label></div><div class='mncatqt'><input type='button' value='Choose Qty & Options' id=" + msg.d[i].Id + " onclick='" + ItemClick + "' class='mncatqttab' style='" + ButtonColor + "' /></div>"; } if (msg.d[i].ThumbnailURL != null) maincatdiv += "<div class='mncatfst'><img class='allitemimage' src='" + msg.d[i].ImageUrl + "' id=" + msg.d[i].Id + " onclick='" + ItemClick + "' /></div>"; else maincatdiv += "<div class='mncatfst'><img class='allitemimage' src='images/noitemImg.png' id=" + msg.d[i].Id + " onclick='" + ItemClick + "' /></div>"; maincatdiv += "<div class='mnitmname'>" + msg.d[i].Name + "</div>"; maincatdiv += "<div class='itemprice mncatpr' style='" + PriceColor + "'>" + document.getElementById("lblCurrency").innerHTML + msg.d[i].VariantPrice + "</div>"; //if (MenuQunatity == "Enable") { // if (msg.d[i].ItemAvailability == "NoQuantity") // maincatdiv += "<div><label id='qty" + msg.d[i].Id + "' style='display:none'>" + msg.d[i].ItemAvailability + "</label></div>"; // else // maincatdiv += "<div><label id='qty" + msg.d[i].Id + "' style='margin-left:5px'>" + msg.d[i].ItemAvailability + "</label><span> Items left</span></div>"; //} //else // maincatdiv += "<div><label id='qty" + msg.d[i].Id + "' style='display:none'>NoQuantity</label></div>"; maincatdiv += cartbtn; maincatdiv += "</div>"; } } maincatdiv += "<div class='mncatback' style='display:none;'><input type='button' onclick='GetCategoriesOnly()' value='Back to Categories' class='mncatbacktab' style='" + ButtonColor + "' /></div>"; document.getElementById('Itemstable').innerHTML = maincatdiv; if (window.innerWidth > 767) { if (msg.d.length < 4) { $(".mncatht").css("margin", "0 auto"); if (msg.d.length < 4) { $(".mncatht").css("width", "80%"); $(".mncatlft").css("width", "30%"); } if (msg.d.length < 3) { $(".mncatht").css("width", "60%"); $(".mncatlft").css("width", "40%"); } if (msg.d.length < 2) { $(".mncatht").css("width", "25%"); $(".mncatlft").css("width", "96%"); } } } } $(".addcategoryloadingimage").css("display", "none"); if ($("#lblMenuTheme").val() == "Grid-no-images" || $("#lblMenuTheme").val() == "New-Grid-no-images") { $(".allitemimage").attr('src','images/noitemImg.png'); } } function GetCategoriesOnly() { //$(".menusrtb").css("display", "block"); $(".addcategoryloadingimage").css("margin-top", $(document).scrollTop()-70).css("display", "block"); var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; var UserOrderType = ""; var h = 0; var PickUp = ""; var Delivery = ""; var CustomTypeOrders = ""; var LocationName = ""; var Shipping = ""; var EntityDetails = localStorage.getItem("EntityDetails"); EntityDetails = JSON.parse(EntityDetails); if (EntityDetails != null) { h = EntityDetails.Allow; PickUp = EntityDetails.PickUp; Delivery = EntityDetails.Delivery; AppName = EntityDetails.AppName; LocationName = EntityDetails.LocationName; Shipping = EntityDetails.Shipping; CustomTypeOrders = EntityDetails.OtherDeliveryService; } $.ajax({ type: "POST", url: "Orders.aspx/GetMenuCategories", data: "{'LocationId': '" + LocationId + "','AppId': '" + AppId + "','OrderType': '" + UserOrderType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById('Itemstable').innerHTML = ""; if (msg.d.length > 0) { MenuNewDesign(msg, "", "", PickUp, Delivery, Shipping, CustomTypeOrders, h,""); } } }) } function EnableAddress() { $("#txtaddress").removeAttr('style'); $("#txtaddress").removeAttr('disabled'); $("#txtaddress").removeAttr('autocomplete'); } function BindCategoryItemsandSubCategories(Cat) { var Id = ""; var CatName = ""; var pattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i; if (Cat.id != undefined) { if (Cat.id.match(pattern)) Id = Cat.id; else Id = Cat; } else Id = Cat; if (Id.indexOf("/") != -1) { CatName = Id.split("/")[1]; Id = Id.split("/")[0]; } var P = $('#' + Id).position(); if (P != undefined) $(".addcategoryloadingimage").css("margin-top", (P.top - 370)).css("display", "block"); else $(".addcategoryloadingimage").css("margin-top", "150px").css("display", "block"); var Status = $('#' + Id).attr("Status"); var LocationId = document.getElementById('lblLId').value; var UserOrderType = ""; var h = 0; var PickUp = ""; var Delivery = ""; var Shipping = ""; var AppName = ""; var LocationName = ""; var CustomTypeOrders = ""; var EntityDetails = localStorage.getItem("EntityDetails"); EntityDetails = JSON.parse(EntityDetails); if (EntityDetails != null) { h = EntityDetails.Allow; PickUp = EntityDetails.PickUp; Delivery = EntityDetails.Delivery; AppName = EntityDetails.AppName; LocationName = EntityDetails.LocationName; Shipping = EntityDetails.Shipping; CustomTypeOrders = EntityDetails.OtherDeliveryService; } if (document.getElementById('ItemsOf' + Id) == null) { //DeleteItemSearch(); } if ($("#lblMenuTheme").val() != "Grid" && $("#lblMenuTheme").val() != "Grid-no-images" && $("#lblMenuTheme").val() != "New-Grid" && $("#lblMenuTheme").val() != "New-Grid-no-images") { $.ajax({ type: "POST", url: "Orders.aspx/GetCategoryItemsByCategoryId", data: "{'CategoryId': '" + Id + "','OrderType': '" + UserOrderType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (document.getElementById('ItemsOf' + Id) != null) { document.getElementById('ItemsOf' + Id).innerHTML = ""; BindAllItems(msg, Id, Status, PickUp, Delivery, Shipping, CustomTypeOrders, h); } else { BindAllItems(msg, "Search", Status, PickUp, Delivery, Shipping, CustomTypeOrders, h); } $("#" + Id).attr("onclick", "HideCategoryItemsandSubCategories(this);"); $("#" + Id + " i").attr("class", "arrow upArrow"); $(".addcategoryloadingimage").css("display", "none"); } }); } else { if ($("#lblMenuTheme").val() == "New-Grid" || $("#lblMenuTheme").val() == "New-Grid-no-images") { //if (document.getElementById('lblAppId1').value == "5b64040f-4585-467d-b37c-4a4ad30304c6") { MenuNewDesign1(); } else { $.ajax({ type: "POST", url: "Orders.aspx/GetCategoryItemsByCategoryId", data: "{'CategoryId': '" + Id + "','OrderType': '" + UserOrderType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { MenuNewDesign(msg, Id, Status, PickUp, Delivery, Shipping, CustomTypeOrders, h, CatName); } }); } } } function BindAllItems(msg, id, Status, PickUp, Delivery, Shipping, CustomTypeOrders, h) { var H = 0; if ($("#lblMenuTheme").val() != "Grid" && $("#lblMenuTheme").val() != "Grid-no-images" && $("#lblMenuTheme").val() != "New-Grid" && $("#lblMenuTheme").val() != "New-Grid-no-images") { var MenuTheme = ""; var menustring = getQueryStrings(); var Mt = menustring["Cmd"]; if (Mt != null && Mt != "" && Mt != "undefined") MenuTheme = Mt; else MenuTheme = document.getElementById('lblMenuTheme').value; var MenuItems = ""; var MenuQunatity = document.getElementById("lblshowquantity").innerHTML; for (var I = 0; I < msg.d.length; I++) { if (msg.d[I].EntityType == "SubCategory" || msg.d[I].EntityType == "SubSubCategory") { var SubCategoryTable = ""; var description = ""; if (msg.d[I].Description != "" && msg.d[I].Description != "\n" && msg.d[I].Description != null && msg.d[I].Description != "null") description = "<div class='itemcdes' style= '"+CategoryBold+";"+CategoryFontFamily+";"+CategoryTextColor+"'>" + msg.d[I].Description + "</div>"; if (msg.d[I].EntityType == "SubCategory") SubCategoryTable = "<div class= 'SubCatfont' style='" + MenuColors + "' Status='false' id= " + msg.d[I].Id + " onclick='BindCategoryItemsandSubCategories(this);'>"; if (msg.d[I].EntityType == "SubSubCategory") SubCategoryTable = "<div class= 'SubSubCatfont' style='" + MenuColors + "' Status='false' id= " + msg.d[I].Id + " onclick='BindCategoryItemsandSubCategories(this);'>"; if (msg.d[I].ThumbnailURL != null) SubCategoryTable += "<div class='categoryfleft'><img id='img" + msg.d[I].Name + "' src='" + msg.d[I].ThumbnailURL + "' alt='" + msg.d[I].Name + "' /></div><div class='categoryleft1'><span class= 'subcatdes' style='" + SubMenuColors + "' >" + msg.d[I].Name + "</span>" + description + "</div><div class='categoryright'><i class= 'arrow downArrow', style= '" + MenuForeColors + "'></i></div>"; else SubCategoryTable += "<div class='categoryleft'><span class= 'subcatdes' style='" + SubMenuColors + "' >" + msg.d[I].Name + "</span>" + description + "</div><div class='categoryright'><i class= 'arrow downArrow', style= '" + MenuForeColors + "'></i></div>"; if (msg.d[I].EntityType == "SubCategory") SubCategoryTable += "</div><div class='subcatitems' id= 'ItemsOf" + msg.d[I].Id + "' style='" + MenuFont + "'></div>"; else SubCategoryTable += "</div><div class='subsubcatitems' id= 'ItemsOf" + msg.d[I].Id + "' style='" + MenuFont + "'></div>"; if (id == "") document.getElementById('Itemstable').innerHTML += SubCategoryTable; else document.getElementById('ItemsOf' + id).innerHTML += SubCategoryTable; } else if (msg.d[I].EntityType == "Category") { var CategoryTable = ""; var cdesc = ""; var cstatus = false; if (msg.d[I].Description != "" && msg.d[I].Description != "\n" && msg.d[I].Description != null && msg.d[I].Description != "null") cdesc += "<div class='itemcdes' style='"+CategoryBold+";"+CategoryFontFamily+";"+CategoryTextColor+"'>" + msg.d[I].Description + "</div>"; if (msg.d[I].ViewOnly == true) cstatus = true; CategoryTable += "<div class='itemfont' id=" + msg.d[I].Id + " onclick= 'BindCategoryItemsandSubCategories(this);' Status= '" + cstatus + "' style='" + MenuColors + "'>"; if (msg.d[I].ThumbnailURL != null) CategoryTable += "<div class='categoryfleft' style= '" + CategoryTextColor + ";"+CategoryBgColor+"'><img id='img" + msg.d[I].Name + "' src='" + msg.d[I].ThumbnailURL + "' alt='" + msg.d[I].Name + "' /></div><div class='categoryleft1' style= '" + CategoryTextColor + "'><span style='"+CategoryBold+";"+CategoryFontSize+";"+CategoryFontFamily+"'>" + msg.d[I].Name + "</span>" + cdesc + "</div><div class='categoryright'><i class= 'arrow downArrow' style= '" + MenuForeColors + "'></i></div>"; else CategoryTable += "<div class='categoryleft' style= '" + CategoryTextColor + ";"+CategoryBgColor+"'><span style='"+CategoryBold+";"+CategoryFontSize+";"+CategoryFontFamily+"'>" + msg.d[I].Name + "</span>" + cdesc + "</div><div class='categoryright'><i class= 'arrow downArrow' style= '" + MenuForeColors + "'></i></div>"; CategoryTable += "</div><div class='catitems' id= 'ItemsOf" + msg.d[I].Id + "' style='" + MenuFont + "'></div>"; document.getElementById('Itemstable').innerHTML += CategoryTable; var QueryString = getQueryStrings(); var Menuexpand = QueryString["Mcollaps"]; if (msg.d[C].CollapseCategory != null) { if (msg.d[C].CollapseCategory == true) { BindCategoryItemsandSubCategories(msg.d[C].CategoryId); } else { if (Menuexpand != "" && Menuexpand != null && Menuexpand != "undefined") { if (Menuexpand == "No") BindCategoryItemsandSubCategories(msg.d[I].Id); } else if (document.getElementById('lblMenuType').value == "Expand") BindCategoryItemsandSubCategories(msg.d[I].Id); } } } else if (msg.d[I].EntityType == "Item") { var ItemClick = ""; H++; if (h == 1) { if (PickUp != "" || Delivery != "" || Shipping != "" || CustomTypeOrders != "") { if (PickUp != false || Delivery != false || Shipping != false || CustomTypeOrders != false) { if (msg.d[I].ViewOnly != true) ItemClick = "GetItemOptions(this);"; else ItemClick = 'DineInOnly("Show", this);'; } } } else { var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.selectedIndex != -1) { if (msg.d[I].ViewOnly != true) ItemClick = "GetItemOptions(this);"; } else ItemClick = 'DineInOnly("Show", this);'; } if (Status == "true") ItemClick = 'DineInOnly("Show", this);'; if (MenuQunatity == "Enable") { if (msg.d[I].ItemAvailability == "NoQuantity") { MenuItems += "<div id='" + msg.d[I].Id + "' class='itemstyle' onclick='" + ItemClick + "' style='border-color: " + DividerColor + ";'>"; } else { var Quantity = Number(msg.d[I].ItemAvailability); if (Quantity > 0) { MenuItems += "<div id='" + msg.d[I].Id + "' class='itemstyle' onclick='" + ItemClick + "' style='border-color: " + DividerColor + ";'>"; } else { MenuItems += "<div id='" + msg.d[I].Id + "' class='itemstyle' style='opacity:0.4;' style='border-color: " + DividerColor + ";'>"; } } } else { MenuItems += "<div id='" + msg.d[I].Id + "' class='itemstyle' onclick='" + ItemClick + "' style='border-color: " + DividerColor + ";'>"; } if (msg.d[I].ThumbnailURL != null) MenuItems += "<div class='itemleft'><img alt='Item' src='" + msg.d[I].ThumbnailURL + "' class='itemimage' /></div>"; if (msg.d[I].ShowItem == true && msg.d[I].ThumbnailURL != null) { MenuItems += "<div class='itemright' style='display:none;'><div class='itemnamest' id='"+msg.d[I].CategoryId+"' Title='" + msg.d[I].Name + "' style='"+ItemNamestyles+"'>"; } else { MenuItems += "<div class='itemright'><div class='itemnamest' id='"+msg.d[I].CategoryId+"' Title='" + msg.d[I].Name + "' style='"+ItemNamestyles+"'>"; } if (msg.d[I].Calories != null) MenuItems += "<span>" + msg.d[I].Calories + "</span>"; if (msg.d[I].PopularItem == true) MenuItems += "<img src='images/ItemQualitiesSmallPopular.png' alt='Popular' class='Popular itemfclas' />"; if (msg.d[I].SpicyItem == true) MenuItems += "<img src='images/ItemQualitiesSmallSpicy.png' alt='Spicy' class='Spicy itemfclas' />"; if (msg.d[I].Vegetarian == true) MenuItems += "<img src='images/ItemQualitiesSmallVegetarian.png' alt='Vegetarian' class='Vegetarian itemfclas' />"; if (msg.d[I].GlutenFreeItem == true) MenuItems += "<img src='images/ItemQualitiesSmallGlutenFree.png' alt='GlutenFree' class='GlutenFree itemfclas' />"; if (msg.d[I].RawItem == true) MenuItems += "<img src='images/ItemQualitiesSmallRaw.png' alt='Raw' class='Raw itemfclas' />"; MenuItems += "<span>" + msg.d[I].Name + "</span></div><div class='itemquality'>"; if (MenuQunatity == "Enable") { if (msg.d[I].ItemAvailability == "NoQuantity") MenuItems += "<label id='qty" + msg.d[I].Id + "' style='display:none'>" + msg.d[I].ItemAvailability + "</label>"; else MenuItems += "<label id='qty" + msg.d[I].Id + "' style='margin-left:5px'>" + msg.d[I].ItemAvailability + "</label><span> Items left</span>"; } else MenuItems += "<label id='qty" + msg.d[I].Id + "' style='display:none'>NoQuantity</label>"; MenuItems += "</div><div class='itemdesc'>"; if (msg.d[I].Description != "" && msg.d[I].Description != "\n" && msg.d[I].Description != null && msg.d[I].Description != "null") MenuItems += msg.d[I].Description; MenuItems += "</div><div class='itemprice' style='" + PriceColor + "'>" + document.getElementById("lblCurrency").innerHTML + msg.d[I].VariantPrice + "</div>"; MenuItems += "</div></div>"; } } if (id == "Search") document.getElementById('Itemstable').innerHTML += MenuItems; else if (id == "") document.getElementById('Itemstable').innerHTML += MenuItems; else document.getElementById('ItemsOf' + id).innerHTML += "<div class='itemsmain'>" + MenuItems; if (document.getElementById("lblBogoSubCatId").innerHTML != "") { BindCategoryItemsandSubCategories(document.getElementById("lblBogoSubCatId").innerHTML); document.getElementById("lblBogoSubCatId").innerHTML = ""; } if (document.getElementById("lblBogoSubSubId").innerHTML != "") { BindCategoryItemsandSubCategories(document.getElementById("lblBogoSubSubId").innerHTML); document.getElementById("lblBogoSubSubId").innerHTML = ""; } if (MenuTheme == "Column1") { if ($("#lblImageOrientation").val() == "Top") { $(".itemimage").addClass("itemimage1"); } else { $(".itemleft").addClass("itemleft1"); $(".itemright").addClass("itemright1"); } } else if (MenuTheme == "Column2") { if ($("#lblImageOrientation").val() == "Top") { $(".itemstyle").addClass("itemstyletop2"); $(".itemright").addClass("itemrighttop2"); $(".itemimage").addClass("itemimagetop2"); } else { $(".itemstyle").addClass("itemstyle2"); $(".itemleft").addClass("itemleft2"); $(".itemright").addClass("itemright2"); $(".itemimage").addClass("itemimage2"); } } else if (MenuTheme == "Column3") { if ($("#lblImageOrientation").val() == "Top") { $(".itemstyle").addClass("itemstyletop3"); $(".itemright").addClass("itemrighttop3"); } else { $(".itemstyle").addClass("itemstyle3"); $(".itemleft").addClass("itemleft3"); $(".itemright").addClass("itemright3"); } } else if (MenuTheme == "Column1-no-images") { if ($("#lblImageOrientation").val() == "Top") { $(".itemimage").addClass("itemimage1"); } else { $(".itemleft").addClass("itemleft1"); $(".itemright").addClass("itemright1"); $(".itemleft1").css("display","none"); $(".itemright1").css("display","block"); $(".categoryfleft").css("display","none"); } } else if (MenuTheme == "Column2-no-images") { if ($("#lblImageOrientation").val() == "Top") { $(".itemstyle").addClass("itemstyletop2"); $(".itemright").addClass("itemrighttop2"); $(".itemimage").addClass("itemimagetop2"); } else { $(".itemstyle").addClass("itemstyle2"); $(".itemleft").addClass("itemleft2"); $(".itemright").addClass("itemright2"); $(".itemimage").addClass("itemimage2"); $(".itemleft2").css("display","none"); $(".itemright2").css("display","block"); $(".categoryfleft").css("display","none"); } } else if (MenuTheme == "Column3-no-images") { if ($("#lblImageOrientation").val() == "Top") { $(".itemstyle").addClass("itemstyletop3"); $(".itemright").addClass("itemrighttop3"); } else { $(".itemstyle").addClass("itemstyle3"); $(".itemleft").addClass("itemleft3"); $(".itemright").addClass("itemright3"); $(".itemleft3").css("display","none"); $(".itemright3").css("display","block"); $(".categoryfleft").css("display","none"); } } } if (MenuTheme == "Grid-no-images" || MenuTheme == "New-Grid-no-images") { $(".allitemimage").attr('src','images/noitemImg.png'); } if ($("#lblImageOrientation").val() == "Right") { $(".itemleft").css("float", "right"); } else { $(".itemleft").css("float", "left"); } if (document.getElementById("lblBogoItemId").innerHTML != "" && id != document.getElementById("lblBogoItemId").innerHTML) $("#" + document.getElementById("lblBogoItemId").innerHTML).trigger("click"); } function HideCategoryItemsandSubCategories(Cat) { document.getElementById('ItemsOf' + Cat.id).innerHTML = ""; Cat.setAttribute("onclick", "BindCategoryItemsandSubCategories(this);"); $("#" + Cat.id + " i").attr("class", "arrow downArrow"); } function GetPopular() { $(".addcategoryloadingimage").css("padding-top", "0px").css("display", "block").css("position", "absolute").css("margin-left", "22%"); if (($('#chkPopular').is(':checked')) || ($('#chkGlutenFree').is(':checked')) || ($('#chkVegetarian').is(':checked')) || ($('#chkSpicy').is(':checked')) || ($('#chkRaw').is(':checked'))) { var h = 0; var PickUp = ""; var Delivery = ""; var AppName = ""; var LocationName = ""; var Shipping = ""; var CustomTypeOrders = ""; var EntityDetails = localStorage.getItem("EntityDetails"); EntityDetails = JSON.parse(EntityDetails); if (EntityDetails != null) { h = EntityDetails.Allow; PickUp = EntityDetails.PickUp; Delivery = EntityDetails.Delivery; AppName = EntityDetails.AppName; LocationName = EntityDetails.LocationName; Shipping = EntityDetails.Shipping; CustomTypeOrders = EntityDetails.OtherDeliveryService; } var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; $.ajax({ type: "POST", url: "Orders.aspx/GetItemsBYItemQualities", data: "{'Popular': '" + ($('#chkPopular').is(':checked')) + "','Raw': '" + ($('#chkRaw').is(':checked')) + "','GlutenFree': '" + ($('#chkGlutenFree').is(':checked')) + "','Spicy': '" + ($('#chkSpicy').is(':checked')) + "','Vegetarian': '" + ($('#chkVegetarian').is(':checked')) + "','AppId': '" + AppId + "','LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { document.getElementById('Itemstable').innerHTML = ""; BindAllItems(msg, "", "", PickUp, Delivery, Shipping, CustomTypeOrders, h); $(".addcategoryloadingimage").css("display", "none"); } else { $("#lblordalert").text("Restaurant doesnt contains any items with selected type"); $(".orderalert").fadeIn(); $(".addcategoryloadingimage").css("display", "none"); } } }); } else { GetMenuCategories(); } } function CheckUserGuest() { if ($('#chkPguest').is(':checked')) { $(".userguest").fadeIn("fast"); } else if ($('#chkDguest').is(':checked')) { $(".userguest").fadeIn("fast"); } else { $(".userguest").fadeOut("fast"); } } </script> <script type="text/javascript" src="css/dist/tagging.js?ver=638828579754368837"></script> <script type="text/javascript"> async function SquareLoad() { var ApplicationId = document.getElementById("PaymentAppId").innerHTML; var SquareLocationId = document.getElementById("lblSquareLocationId").innerHTML; const payments = Square.payments(ApplicationId, SquareLocationId); const card = await payments.card(); await card.attach('#card-container'); const cardButton = document.getElementById('card-button'); cardButton.addEventListener('click', async () => { try { const result = await card.tokenize(); if (result.status === 'OK') { localStorage.setItem("Nonce", result.token); document.getElementById("lblorderfail").innerHTML = "InsertOrder"; var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } return; } else { var errorMessage = ""; if (result.errors) { for (var T = 0; T < result.errors.length; T++) { errorMessage += result.errors[T].message + ", "; } } errorMessage = errorMessage.substring(0, errorMessage.length - 2); $('.placeorder').css("display", "block"); $("#lblorderror").text(errorMessage); $(".ordererror").show().delay(3000).fadeOut(); return; } } catch (e) { console.error(e); } }); } var clover; if (document.getElementById("PaymentAppId").innerHTML != "") { var ApplicationId = document.getElementById("PaymentAppId").innerHTML; if (document.getElementById("lblPaymentType").innerHTML == "square") { // applicationId: ApplicationId, SquareLoad(); } else if (document.getElementById("lblPaymentType").innerHTML == "clover") { clover = new Clover(ApplicationId); const elements = clover.elements(); const styles = { 'card-number input': { 'width': '18em', 'font-size': '14px', 'border': '1px gray solid', 'padding': '12px 3px', 'margin': '3px', 'font-weight': 'bold' }, //'card-number input': { // 'background-color': '#BBBBBB' //}, 'card-date input': { 'width': '18em', 'font-size': '14px', 'border': '1px gray solid', 'padding': '12px 3px', 'margin': '3px', 'font-weight': 'bold' //'background-color': '#CCCCCC' }, 'card-cvv input': { 'width': '18em', 'font-size': '14px', 'border': '1px gray solid', 'padding': '12px 3px', 'margin': '3px', 'font-weight': 'bold' //'background-color': '#DDDDDD' }, 'card-postal-code input': { 'width': '18em', 'font-size': '14px', 'border': '1px gray solid', 'padding': '12px 3px', 'margin': '3px', 'font-weight': 'bold' //'background-color': '#EEEEEE' }, }; const cardNumber = elements.create('CARD_NUMBER', styles); const cardDate = elements.create('CARD_DATE', styles); const cardCvv = elements.create('CARD_CVV', styles); const cardPostalCode = elements.create('CARD_POSTAL_CODE', styles); cardNumber.mount('#card-number'); cardDate.mount('#card-date'); cardCvv.mount('#card-cvv'); cardPostalCode.mount('#card-postal-code'); } } function CloverFormSubmit() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; clover.createToken() .then(function (result) { if (result.errors) { var errors = ""; Object.values(result.errors).forEach(function (value) { errors += value + ", "; }); $('.placeorder').css("display", "block"); // $('.errormsg').text(""); $("#lblorderror").text(errors); $(".ordererror").show().delay(3000).fadeOut(); } else { localStorage.setItem("Nonce", result.token); var Nonce = localStorage.getItem("Nonce"); if (Nonce != null) { document.getElementById("lblorderfail").innerHTML = "InsertOrder"; if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} return; } else { return; } } }); } </script> <script type="text/javascript"> function ShippingDetails() { var LocationId = document.getElementById('lblLId').value; if (LocationId != "") { $.ajax({ type: "POST", url: "Orders.aspx/ShippingDetails", data: "{'LId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0].AcceptShipping != false) { document.getElementById('lblShipping').innerHTML = msg.d[0].AcceptShipping; $(".orderShpping").css("display", "block"); if (msg.d[0].AcceptShipping == true) { var PreviousData = localStorage.getItem("ShippingAddress"); var Table = JSON.parse(PreviousData); if (Table != null) { if (Table.length > 0) { document.getElementById("txtshpaddress").value = Table[0].Address; document.getElementById("txtshpcity").value = Table[0].City; document.getElementById("txtshpzip").value = Table[0].Zip; BindShippingDropdown('Country', Table[0].Country, Table[0].State); } } else { BindShippingDropdown('Country', '', ''); } document.getElementById('lblShipMinAmt').innerHTML = msg.d[0].ShippingMinAmount; $(".shpbtn").css("display", "inline-block"); } else { document.getElementById('lblShipMinAmt').innerHTML = 0; } } } } }); } } function GetNextAvailableDeliveryTime() { var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; $.ajax({ type: "POST", url: "Orders.aspx/GetNextAvailableDeliveryDayTime", data: "{'LocationId': '" + LocationId + "','Appid':'" + AppId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { document.getElementById("lblpreorder").innerHTML = msg.d; $("#lblpreorder").css("display", "block"); } else { document.getElementById("lblpreorder").innerHTML = ""; $("#lblpreorder").css("display", "none"); } } }); } function ShippingClose() { $(".ShippingConfPanel").fadeOut("slow"); $(".deliverycheck").fadeIn("fast"); DeliveryNotAvailable(""); if (document.getElementById("lbldelivary").innerHTML == "Delivery") { $("body").addClass("fullpanel"); if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "none"); $(".fcontainer").css("display", "none"); $(".Ordersmain").css("display", "none"); $(".orderdivr").css("display", "none"); $(".griditemsmodal").css("background-color", "white"); $(".griditemscroll").css("width", "100%"); $(".grditemspanel").fadeIn("slow"); $(".itemimageshow").css("width", "100%"); $(".itemimageshow").css("height", "320px"); $(".itemimageshow").css("object-fit", "cover"); $("#txtinstructions").css("margin-bottom", "100px;"); $(".txtinstructions").addClass("txtinstructionscs"); $("#lblitemmesg").css("display", "none"); $(".itemmain").css("display", "none"); $(".itemnamecs").css("display", "block"); $(".closeitemdiv").css("display", "block"); $(".checkoutloaderdiv").css("display", "none"); $(".mblcheckbtndiv").css("display", "inline-block"); //$(".checkbtndiv").css("display", "inline-block"); } else { //$(".grditemspanel").fadeIn("slow"); } } else { //$(".grditemspanel").fadeIn("slow"); } $(".btnloaderdiv").css("display", "none"); $(".addtocartdiv").css("display", "block"); } } function GetDeliveryServices() { document.getElementById('tblDeliveryServices').innerHTML = ""; $(".dlvservices").css("display", "none"); $.ajax({ type: "POST", url: "Orders.aspx/GetDeliveryServices", data: "{'LocId': '" + document.getElementById('lblLId').value + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { document.getElementById('tblDeliveryServices').innerHTML = ""; $(".dlvservices").css("display", "block"); $("#divdeliServicesRight").css("display", "none"); for (var L = 0; L < msg.d.length; L++) { if (msg.d[L].API != true) { var Maintr = document.createElement("tr"); var Maintd = document.createElement("td"); var ServiceTable = document.createElement("table"); setAttributes(ServiceTable, { "class": "Deliverybox" }); //// Service Name var ServiceNametable = document.createElement("table"); setAttributes(ServiceNametable, { "class": "ServiceName", "align": "center" }); var ServiceNametr = document.createElement("tr"); var ServiceNametd = document.createElement("td"); var ServicetrName = document.createElement("tr"); setAttributes(ServicetrName, { "class": "EditService" }); var ServicetdNametxt = document.createElement("td"); setAttributes(ServicetdNametxt, { "colspan": "2" }); if (msg.d[L].URL != null && msg.d[L].URL != "") { var ServiceNametxt = document.createElement("a"); setAttributes(ServiceNametxt, { "align": "center", "href": msg.d[L].URL, "style": "color: white;" }); ServiceNametxt.innerHTML = msg.d[L].ServiceName; } else { var ServiceNametxt = document.createElement("span"); setAttributes(ServiceNametxt, { "align": "center" }); ServiceNametxt.innerHTML = msg.d[L].ServiceName; } ServiceNametd.appendChild(ServiceNametxt); ServiceNametr.appendChild(ServiceNametd); ServiceNametable.appendChild(ServiceNametr); ServicetdNametxt.appendChild(ServiceNametable); ServicetrName.appendChild(ServicetdNametxt); ServiceTable.appendChild(ServicetrName); if (msg.d[L].ShowNotes == true) { var ServiceNotestr = document.createElement("tr"); setAttributes(ServiceNotestr, { "class": "EditService" }); var ServiceNotestd = document.createElement("td"); setAttributes(ServiceNotestd, { "colspan": "2" }); var ServiceNotestxt = document.createElement("span"); setAttributes(ServiceNotestxt, { "align": "center" }); ServiceNotestxt.innerHTML = msg.d[L].Notes; ServiceNotestd.appendChild(ServiceNotestxt); ServiceNotestr.appendChild(ServiceNotestd); ServiceTable.appendChild(ServiceNotestr); } else { ////Delivery Fee var ServicetrDeliveryFee = document.createElement("tr"); setAttributes(ServicetrDeliveryFee, { "class": "EditService" }); var ServicetdDeliveryFeelbl = document.createElement("td"); setAttributes(ServicetdDeliveryFeelbl, { "style": "width: 50%;", }); var DeliveryFeelbl = document.createElement("span"); DeliveryFeelbl.innerHTML = "Delivery Fee:"; ServicetdDeliveryFeelbl.appendChild(DeliveryFeelbl); var ServicetdDeliveryFeetxt = document.createElement("td"); setAttributes(ServicetdDeliveryFeetxt, { "style": "text-align:right" }); var DeliveryFeetxt = document.createElement("span"); setAttributes(DeliveryFeetxt, { "class": "EditServiceText", }); DeliveryFeetxt.innerHTML = document.getElementById("lblCurrency").innerHTML + msg.d[L].DeliveryFee.toFixed(2); ServicetdDeliveryFeetxt.appendChild(DeliveryFeetxt); ServicetrDeliveryFee.appendChild(ServicetdDeliveryFeelbl); ServicetrDeliveryFee.appendChild(ServicetdDeliveryFeetxt); ServiceTable.appendChild(ServicetrDeliveryFee); ///Delivery Fee ////Booking/Service Fee var ServicetrBookingFee = document.createElement("tr"); setAttributes(ServicetrBookingFee, { "class": "EditService" }); var ServicetdBookingFeelbl = document.createElement("td"); var BookingFeelbl = document.createElement("span"); BookingFeelbl.innerHTML = "Service Fees(" + msg.d[L].BookingOrServicefees.toFixed(2) + '%)'; +"):"; ServicetdBookingFeelbl.appendChild(BookingFeelbl); var ServicetdBookingFeetxt = document.createElement("td"); setAttributes(ServicetdBookingFeetxt, { "style": "text-align:right" }); var BookingFeetxt = document.createElement("span"); setAttributes(BookingFeetxt, { "class": "EditServiceText", }); var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); var Pri = 0; if (AddedItems != null) { for (var w = 0; w < AddedItems.length; w++) { Pri = +Pri + +AddedItems[w].Price; } } var servicefee = ((Pri * msg.d[L].BookingOrServicefees) / 100).toFixed(2) BookingFeetxt.innerHTML = document.getElementById("lblCurrency").innerHTML + servicefee; ServicetdBookingFeetxt.appendChild(BookingFeetxt); ServicetrBookingFee.appendChild(ServicetdBookingFeelbl); ServicetrBookingFee.appendChild(ServicetdBookingFeetxt); ServiceTable.appendChild(ServicetrBookingFee); ////Booking/Service Fee ///Minimum Order var ServicetrMinimumOrder = document.createElement("tr"); setAttributes(ServicetrMinimumOrder, { "class": "EditService" }); var ServicetdMinimumOrderlbl = document.createElement("td"); var MinimumOrderlbl = document.createElement("span"); MinimumOrderlbl.innerHTML = "Order Minimum:"; ServicetdMinimumOrderlbl.appendChild(MinimumOrderlbl); var ServicetdMinimumOrdertxt = document.createElement("td"); setAttributes(ServicetdMinimumOrdertxt, { "style": "text-align:right" }); var MinimumOrdertxt = document.createElement("span"); setAttributes(MinimumOrdertxt, { "class": "EditServiceText", }); ServicetdMinimumOrdertxt.appendChild(MinimumOrdertxt); MinimumOrdertxt.innerHTML = document.getElementById("lblCurrency").innerHTML + msg.d[L].OrderMin.toFixed(2); ServicetrMinimumOrder.appendChild(ServicetdMinimumOrderlbl); ServicetrMinimumOrder.appendChild(ServicetdMinimumOrdertxt); ServiceTable.appendChild(ServicetrMinimumOrder); /////Estimated Time var ServicetrEstimatedTime = document.createElement("tr"); setAttributes(ServicetrEstimatedTime, { "class": "EditService" }); var ServicetdEstimatedTimelbl = document.createElement("td"); var EstimatedTimelbl = document.createElement("span"); EstimatedTimelbl.innerHTML = "Est. Delivery Time:"; ServicetdEstimatedTimelbl.appendChild(EstimatedTimelbl); var ServicetdEstimatedTimetxt = document.createElement("td"); setAttributes(ServicetdEstimatedTimetxt, { "style": "text-align:right" }); var EstimatedTimetxt = document.createElement("span"); setAttributes(EstimatedTimetxt, { "class": "EditServiceTextMin", }); EstimatedTimetxt.innerHTML = msg.d[L].MinEstimatedTime + " - " + msg.d[L].MaxEstimatedTime + "min"; ServicetdEstimatedTimetxt.appendChild(EstimatedTimetxt); ServicetrEstimatedTime.appendChild(ServicetdEstimatedTimelbl); ServicetrEstimatedTime.appendChild(ServicetdEstimatedTimetxt); ServiceTable.appendChild(ServicetrEstimatedTime); /////Estimated Total cost var ServicetrEstimatedCost = document.createElement("tr"); setAttributes(ServicetrEstimatedCost, { "class": "EditService" }); var ServicetdEstimatedCostlbl = document.createElement("td"); var EstimatedCostlbl = document.createElement("span"); EstimatedCostlbl.innerHTML = "Est. Total Cost:"; ServicetdEstimatedCostlbl.appendChild(EstimatedCostlbl); var ServicetdEstimatedCosttxt = document.createElement("td"); setAttributes(ServicetdEstimatedCosttxt, { "style": "text-align:right" }); var EstimatedCosttxt = document.createElement("span"); setAttributes(EstimatedCosttxt, { "class": "EditServiceTextMin", }); Taxes = (Pri * document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "")) / 100; Taxes = Taxes.toFixed(2); EstimatedCosttxt.innerHTML = document.getElementById("lblCurrency").innerHTML + (+msg.d[L].DeliveryFee + +servicefee + +Pri + +Taxes).toFixed(2); ServicetdEstimatedCosttxt.appendChild(EstimatedCosttxt); ServicetrEstimatedCost.appendChild(ServicetdEstimatedCostlbl); ServicetrEstimatedCost.appendChild(ServicetdEstimatedCosttxt); ServiceTable.appendChild(ServicetrEstimatedCost); ////Rating var trDriverRating = document.createElement("tr"); var tdDriverRating = document.createElement("td"); setAttributes(tdDriverRating, { "id": msg.d[L].Id, "onclick": "DeliveryServiceReview(this,'');", "style": "cursor:pointer" }); var ratingtext = document.createElement("span"); var Rating = Math.floor(msg.d[L].Rating); ratingtext.innerHTML = msg.d[L].Rating; var R = 1; for (var S = 1; S <= Rating; S++) { var img1 = document.createElement("img"); img1.setAttribute("src", "images/RatingOver.png"); img1.setAttribute("alt", "Rating Over"); img1.setAttribute("class", "raringimg"); tdDriverRating.appendChild(img1); R++; } if (ratingtext.innerHTML.indexOf(".") != -1) { var img1 = document.createElement("img"); img1.setAttribute("src", "images/HalfRating.png"); img1.setAttribute("alt", "Half Rating"); img1.setAttribute("class", "raringimg"); tdDriverRating.appendChild(img1); R++; } for (var S = R; S <= 5; S++) { var img1 = document.createElement("img"); img1.setAttribute("src", "images/RatingNormal.png"); img1.setAttribute("alt", "Normal Rating"); img1.setAttribute("class", "raringimg"); tdDriverRating.appendChild(img1); } trDriverRating.appendChild(tdDriverRating); ServiceTable.appendChild(trDriverRating); } Maintd.appendChild(ServiceTable); Maintr.appendChild(Maintd); document.getElementById('tblDeliveryServices').appendChild(Maintr); } } } } }); } function DeliveryServiceReview(input, DriverId) { var id = DriverId; if (DriverId == "") { id = input.id; } document.getElementById('tblDeliveryServiceReviews').innerHTML = ""; document.getElementById('lblDeliveryServiceId').innerHTML = id; $.ajax({ type: "POST", url: "orders.aspx/GetDeliveryServicesById", data: "{'Id': '" + id + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById('tblDeliveryServiceReviews').innerHTML = ""; document.getElementById('ViewDeliveryServiceReviews').style.display = "block"; if (msg.d.length > 0) { for (i = 0; i < msg.d.length; i++) { var DateRow = document.createElement("tr"); var DateCell = document.createElement("td"); var Namediv = document.createElement("div"); var Nametable = document.createElement("table"); setAttributes(Nametable, { "style": "width:100%;" }); var Nametr = document.createElement("tr"); var Nametd = document.createElement("td"); setAttributes(Nametd, { "style": "text-align:left;color:black" }); var UserName = document.createElement("span"); setAttributes(UserName, { "style": "font-weight: bold;font-size: 12pt;" }); UserName.innerHTML = msg.d[i].UserName; Nametd.appendChild(UserName); Nametr.appendChild(Nametd); Nametable.appendChild(Nametr); Namediv.appendChild(Nametable); var ReviewData = document.createElement("div"); var Rtable = document.createElement("table"); setAttributes(Rtable, { "style": "width:100%;" }); var rtr = document.createElement("tr"); var rtd = document.createElement("td"); var rimage = document.createElement("img"); if (msg.d[i].UserImage != "" && msg.d[i].UserImage != null) setAttributes(rimage, { "src": msg.d[i].UserImage, "width": "80px", "height": "95px" }); else setAttributes(rimage, { "src": "https://www.munchem.com/images/imagenotavailable.png", "width": "80px", "height": "95px", "alt": "User Image Not available" }); rtd.appendChild(rimage); setAttributes(rtd, { "style": "width:18%;" }); var reviewtd = document.createElement("td"); var subrtable = document.createElement("table"); setAttributes(subrtable, { "style": "width:100%;" }); var subraddtr = document.createElement("tr"); var subaddtd = document.createElement("td"); var subadd = document.createElement("span"); setAttributes(subadd, { "style": "margin-left:7%;" }); if (msg.d[i].Description != null && msg.d[i].Description != "") subadd.innerHTML = msg.d[i].Description; subaddtd.appendChild(subadd); subaddtd.setAttribute("style", "text-align: left;color: black;"); subraddtr.appendChild(subaddtd); var subrrevtr = document.createElement("tr"); var RatingCell = document.createElement("td"); setAttributes(RatingCell, { "style": "padding-top: 20px;" }); var ratingtext = document.createElement("span"); ratingtext.innerHTML = msg.d[i].Rating; var Rating = Math.floor(msg.d[i].Rating); var R = 1; for (var S = 1; S <= Rating; S++) { var img1 = document.createElement("img"); img1.setAttribute("src", "images/RatingOver.png"); img1.setAttribute("alt", "Rating Over"); img1.setAttribute("class", "raringimg"); RatingCell.appendChild(img1); R++; } if (ratingtext.innerHTML.indexOf(".") != -1) { var img1 = document.createElement("img"); img1.setAttribute("src", "images/HalfRating.png"); img1.setAttribute("alt", "Half Rating"); img1.setAttribute("class", "raringimg"); RatingCell.appendChild(img1); R++; } for (var S = R; S <= 5; S++) { var img1 = document.createElement("img"); img1.setAttribute("src", "images/RatingNormal.png"); img1.setAttribute("alt", "Normal Rating"); img1.setAttribute("class", "raringimg"); RatingCell.appendChild(img1); } subrrevtr.appendChild(RatingCell); var OptionRow = document.createElement("tr"); var OptionCell = document.createElement("td"); var OptionText = document.createElement("span"); if (msg.d[i].TextOption != null && msg.d[i].TextOption != "") { OptionText.innerHTML = msg.d[i].TextOption; } setAttributes(OptionCell, { "colspan": "2", "style": "color: black;padding: 10px 0px;line-height: 1.4;" }); setAttributes(OptionText, { "style": "float:left;text-align: left;margin-left:7%;" }); OptionCell.appendChild(OptionText); OptionRow.appendChild(OptionCell); subrtable.appendChild(subraddtr); subrtable.appendChild(subrrevtr); subrtable.appendChild(OptionRow); reviewtd.appendChild(subrtable); rtr.appendChild(rtd); rtr.appendChild(reviewtd); var Imagestr = document.createElement("tr"); var imagetd1 = document.createElement("td"); var Imagetd2 = document.createElement("td"); Imagestr.appendChild(imagetd1); Imagestr.appendChild(Imagetd2); Rtable.appendChild(rtr); Rtable.appendChild(Imagestr); ReviewData.appendChild(Rtable); DateCell.appendChild(Namediv); DateCell.appendChild(ReviewData); setAttributes(Namediv, { "style": "padding-top:2px;;" }); setAttributes(ReviewData, { "style": "border-bottom:2px solid #7f7f7f;padding-bottom: 8px;" }); DateRow.appendChild(DateCell); document.getElementById('tblDeliveryServiceReviews').appendChild(DateRow); } $(".ReviewsLoader").css("display", "none"); var menuheight = $(".menu").css('height'); menuheight = menuheight.replace("px", ""); var documentheight = $(document).scrollTop(); var reviewstblheight = $(".tblDeliveryServiceReviews").css('height'); } else { $(".ReviewsLoader").css("display", "none"); $(".lblDeliveryServicesuccess").css("display", "block"); document.getElementById('lblDeliveryServicesuccess').innerHTML = "No Reviews Yet!"; } document.getElementById('PnlDeliveryService').style.display = "none"; } }); } function AddDeliveryServiceReview() { //$(".signinpanel").css("position", "inherit"); var UId = document.getElementById("UserId").innerHTML; if (UId != "" && UId != null) { $.ajax({ type: "POST", url: "orders.aspx/GetDeliveryServicesByIdForUser", data: "{'DeliveryServiceId': '" + document.getElementById('lblDeliveryServiceId').innerHTML + "','UserId': '" + UId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var rating = msg.d[0].Rating; document.getElementById("DeliveryServiceRating_A").title = rating; if (rating == 1) { $("#DeliveryServiceRating_Star_1").addClass("rating_filled1"); $("#DeliveryServiceRating_Star_1").removeClass("rating_empty1"); } else if (rating == 2) { $("#DeliveryServiceRating_Star_1").addClass("rating_filled1"); $("#DeliveryServiceRating_Star_1").removeClass("rating_empty1"); $("#DeliveryServiceRating_Star_2").addClass("rating_filled1"); $("#DeliveryServiceRating_Star_2").removeClass("rating_empty1"); } else if (rating == 3) { $("#DeliveryServiceRating_Star_1").addClass("rating_filled1"); $("#DeliveryServiceRating_Star_1").removeClass("rating_empty1"); $("#DeliveryServiceRating_Star_2").addClass("rating_filled1"); $("#DeliveryServiceRating_Star_2").removeClass("rating_empty1"); $("#DeliveryServiceRating_Star_3").addClass("rating_filled1"); $("#DeliveryServiceRating_Star_3").removeClass("rating_empty1"); } else if (rating == 4) { $("#DeliveryServiceRating_Star_1").addClass("rating_filled1"); $("#DeliveryServiceRating_Star_1").removeClass("rating_empty1"); $("#DeliveryServiceRating_Star_2").addClass("rating_filled1"); $("#DeliveryServiceRating_Star_2").removeClass("rating_empty1"); $("#DeliveryServiceRating_Star_3").addClass("rating_filled1"); $("#DeliveryServiceRating_Star_3").removeClass("rating_empty1"); $("#DeliveryServiceRating_Star_4").addClass("rating_filled1"); $("#DeliveryServiceRating_Star_4").removeClass("rating_empty1"); } else if (rating == 5) { $("#DeliveryServiceRating_Star_1").addClass("rating_filled1"); $("#DeliveryServiceRating_Star_1").removeClass("rating_empty1"); $("#DeliveryServiceRating_Star_2").addClass("rating_filled1"); $("#DeliveryServiceRating_Star_2").removeClass("rating_empty1"); $("#DeliveryServiceRating_Star_3").addClass("rating_filled1"); $("#DeliveryServiceRating_Star_3").removeClass("rating_empty1"); $("#DeliveryServiceRating_Star_4").addClass("rating_filled1"); $("#DeliveryServiceRating_Star_4").removeClass("rating_empty1"); $("#DeliveryServiceRating_Star_5").addClass("rating_filled1"); $("#DeliveryServiceRating_Star_5").removeClass("rating_empty1"); } document.getElementById("DeliveryServiceRating_RatingExtender_ClientState").value = msg.d[0].Rating; document.getElementById('txtDeliveryServiceReview').value = msg.d[0].Description; document.getElementById('txtDeliveryServiceReview').innerHTML = msg.d[0].Description; } $(".PnlDeliveryService").fadeIn("slow"); document.getElementById('ViewDeliveryServiceReviews').style.display = "none"; $(".lblDeliveryServicesuccess").css("display", "none"); document.getElementById('lblDeliveryServicesuccess').innerHTML = ""; } }); } else { $(".signinpanel").fadeIn("slow"); //$(".signinpanel").css("position", "relative"); $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); } } function SubmitDeliveryServiceReview() { $(".ReviewLoader").css("display", "block"); var UId = document.getElementById("UserId").innerHTML; var DriverId = document.getElementById("lblDeliveryServiceId").innerHTML; var UserReview = document.getElementById('txtDeliveryServiceReview').value; var UserRating = document.getElementById("DeliveryServiceRating_RatingExtender_ClientState").value; $(".lblDeliveryServicesuccess").css("display", "none"); document.getElementById('lblDeliveryServicesuccess').innerHTML = ""; if (UId != "" && UId != null) { if (UserRating != 0 && UserRating != "" && UserRating != null) { if (UserRating > 0) { $.ajax({ type: "POST", url: "orders.aspx/PostDeliveryServiceReview", data: "{'UserId': '" + UId + "','Option': '" + UserRating + "','TextOption': '" + UserReview + "','DriverId': '" + DriverId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "Already Exist") { if (confirm("You reviewed this delivery service already. Would you like to update your review?")) { $.ajax({ type: "POST", url: "orders.aspx/UpdateDeliveryServiceReview", data: "{'UserId': '" + UId + "','Option': '" + UserRating + "','TextOption': '" + UserReview + "','DriverId': '" + DriverId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { $(".lblDeliveryServicesuccess").css("display", "block"); document.getElementById('lblDeliveryServicesuccess').innerText = msg.d; document.getElementById('PnlDeliveryService').style.display = "none"; document.getElementById('txtDeliveryServiceReview').value = ""; document.getElementById("DeliveryServiceRating_RatingExtender_ClientState").value = 0; $find("myRBID1").set_Rating(0); DeliveryServiceReview("", DriverId); GetDeliveryServices(); $(".ViewDeliveryServiceReviews").fadeIn("slow"); $(".ReviewLoader").css("display", "none"); } }); } else { document.getElementById('PnlDeliveryService').style.display = "none"; $(".ViewDeliveryServiceReviews").fadeIn("slow"); $(".ReviewLoader").css("display", "none"); } } else { $(".lblDeliveryServicesuccess").css("display", "block"); document.getElementById('lblDeliveryServicesuccess').innerText = msg.d; document.getElementById('PnlDeliveryService').style.display = "none"; document.getElementById('txtDeliveryServiceReview').value = ""; document.getElementById("DeliveryServiceRating_RatingExtender_ClientState").value = 0; $find("myRBID").set_Rating(0); DeliveryServiceReview("", DriverId); $(".ViewDeliveryServiceReviews").fadeIn("slow"); $(".ReviewLoader").css("display", "none"); } } }); } else { $(".ReviewLoader").css("display", "none"); $(".lblDeliveryServiceerrorreview").css("display", "block"); document.getElementById('lblDeliveryServiceerrorreview').innerHTML = "Please select atleast one Rating"; setTimeout("HideLabel();", 10000); } } else { $(".ReviewLoader").css("display", "none"); $(".lblDeliveryServiceerrorreview").css("display", "block"); document.getElementById('lblDeliveryServiceerrorreview').innerHTML = "Give atleast one Rating"; setTimeout("HideLabel();", 5000); } } else { $(".signinpanel").fadeIn("slow"); $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); } } $(".editbusiness").click(function () { $(".rstubibehind").fadeIn("slow"); $(".rstubibehind").css("display", "block"); }) function GetAppInfo() { var LocationId = document.getElementById('lblLId').value; $.ajax({ type: "POST", url: "orders.aspx/GetAppInfo", data: "{'LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { for (var P = 0; P < msg.d.length; P++) { var detail = new Object(); detail.AppName = msg.d[P].AppName; detail.PhoneNumber = msg.d[P].PhoneNumber; detail.CompanyWebsite = msg.d[P].CompanyWebsite; detail.ContactEmail = msg.d[P].ContactEmail; detail.Line1 = msg.d[P].Line1; detail.Line2 = msg.d[P].Line2; detail.Country = msg.d[P].Country; detail.State = msg.d[P].State; detail.City = msg.d[P].City; detail.Zip = msg.d[P].Zip; document.getElementById('txtupdatebusnsname').value = detail.AppName; document.getElementById('txtaddr1').value = detail.Line1; document.getElementById('txtaddr2').value = detail.Line2; document.getElementById('ddlcountry').innerHTML = detail.Country; document.getElementById('ddlcity1').value = detail.City; document.getElementById('ddlState1').value = detail.State; document.getElementById('txtphone').value = detail.PhoneNumber; document.getElementById('txtwebaddre').value = detail.CompanyWebsite; document.getElementById('txtAppemail').value = detail.ContactEmail; document.getElementById('txtzip1').value = detail.Zip; $("#Statetr").fadeOut(); $("#citytr").fadeOut(); $(".loaderc").css("display", "block"); $("#ddlcountry").empty(); var Countrys = document.getElementById("ddlcountry"); $.ajax({ type: "POST", url: "Orders.aspx/GetAllCountries", data: "", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { for (var i = 0; i < msg.d.length; i++) { if (msg.d[i] == "-Select Country-") { var optmin2 = document.createElement("option"); optmin2.text = msg.d[i]; optmin2.value = msg.d[i]; ddlcountry.options.add(optmin2); } else { var optmin2 = document.createElement("option"); optmin2.text = msg.d[i]; var country = msg.d[i] optmin2.value = msg.d[i]; var c = detail.Country; ddlcountry.options.add(optmin2); } } if (ddlcountry.options.length > 0) { for (var k = 0; k < ddlcountry.options.length; k++) { if (ddlcountry.options[k].text == detail.Country) { ddlcountry.options[k].selected = true; var Country = document.getElementById("ddlcountry"); var CId = Country.options[Country.selectedIndex].value; $("#ddlState1").empty(); var States = document.getElementById("ddlState1>"); if (CId != "-Select Country-") { $.ajax({ type: "POST", url: "Orders.aspx/GetStates1", data: "{'CountryId':'" + CId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { for (var i = 0; i < msg.d.length; i++) { if (msg.d[i] == "-Select State-") { var optmin2 = document.createElement("option"); optmin2.text = msg.d[i]; ddlState1.options.add(optmin2); } else { var optmin2 = document.createElement("option"); optmin2.text = msg.d[i]; optmin2.value = msg.d[i]; ddlState1.options.add(optmin2); } } if (ddlState1.options.length > 0) { for (var l = 0; l < ddlState1.options.length; l++) { if (ddlState1.options[l].text == detail.State) { ddlState1.options[l].selected = true; var ddlsource = document.getElementById("ddlcountry"); var Country = ddlsource.options[ddlsource.selectedIndex].text; var ddlsource1 = document.getElementById("ddlState1"); var State = ddlsource1.options[ddlsource1.selectedIndex].text; if (State != "-Select State-") { $.ajax({ type: "POST", url: "Orders.aspx/GetCities1", data: "{'Country': '" + Country + "','State': '" + State + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { if (msg.d.length > 0) { for (var i = 0; i < msg.d.length; i++) { if (msg.d[i] == "-Select City-") { var optmin2 = document.createElement("option"); optmin2.text = msg.d[i]; ddlcity1.options.add(optmin2); } else { var optmin2 = document.createElement("option"); optmin2.text = msg.d[i]; optmin2.value = msg.d[i]; ddlcity1.options.add(optmin2); } } if (ddlcity1.options.length > 0) { for (var m = 0; m < ddlcity1.options.length; m++) { if (ddlcity1.options[m].text == detail.City) { ddlcity1.options[m].selected = true; } } } } else { $("#ddlcity1").fadeOut("slow"); $("#ddlcity1").empty(); } } } }); } } } } } if (SelectedState != null && SelectedState != "") { $("#ddlState1").val(SelectedState); } $(".loaderc").css("display", "none"); } }); } } } } $(".loaderc").css("display", "none"); } } }); } } } }) } function CountryChange() { var Country = document.getElementById("ddlcountry"); var CId = Country.options[Country.selectedIndex].value; $("#ddlState1").empty(); var States = document.getElementById("ddlState1>"); if (CId != "-Select Country-") { $.ajax({ type: "POST", url: "Orders.aspx/GetStates1", data: "{'CountryId':'" + CId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { for (var i = 0; i < msg.d.length; i++) { if (msg.d[i] == "-Select State-") { var optmin2 = document.createElement("option"); optmin2.text = msg.d[i]; ddlState1.options.add(optmin2); } else { var optmin2 = document.createElement("option"); optmin2.text = msg.d[i]; optmin2.value = msg.d[i]; ddlState1.options.add(optmin2); } } } if (SelectedState != null && SelectedState != "") $("#ddlState1").val(SelectedState); $(".loaderc").css("display", "none"); } }); } else { $("#ddlState1").empty(); $("#ddlcity1").empty(); } } function GetCities1() { $("#ddlcity1").empty(); var ddlsource = document.getElementById("ddlcountry"); var Country = ddlsource.options[ddlsource.selectedIndex].text; var ddlsource1 = document.getElementById("ddlState1"); var State = ddlsource1.options[ddlsource1.selectedIndex].text; if (State != "-Select State-") { $.ajax({ type: "POST", url: "Orders.aspx/GetCities1", data: "{'Country': '" + Country + "','State': '" + State + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { if (msg.d.length > 0) { for (var i = 0; i < msg.d.length; i++) { if (msg.d[i] == "-Select City-") { var optmin2 = document.createElement("option"); optmin2.text = msg.d[i]; ddlcity1.options.add(optmin2); } else { var optmin2 = document.createElement("option"); optmin2.text = msg.d[i]; optmin2.value = msg.d[i]; ddlcity1.options.add(optmin2); } } } else { $("#ddlcity1").fadeOut("slow"); $("#ddlcity1").empty(); } } } }); } else { GetStates1(); $("#ddlcity1").fadeOut("slow"); $("#ddlcity1").empty(); } } function CheckedBillingAddress(obj) { if (obj.checked == true) { document.getElementById("Chkyeschk").checked = false; document.getElementById('txtcLine1').value = document.getElementById('txtaddress').value; document.getElementById('txtcCity').value = document.getElementById('txtvalidationcity').value; document.getElementById('txtCState').value = document.getElementById('txtvalidationstate').value; document.getElementById('txtBZC').value = document.getElementById('txtvalidationzip').value; document.getElementById('txtcline2').value = ""; $(".Billingaddress").fadeIn("slow"); } else { document.getElementById("chkcard").checked = true; $(".Billingaddress").fadeOut("slow"); } } function UnCheckedBillingAddress(obj) { if (obj.checked == true) { document.getElementById("chkcard").checked = false; $(".Billingaddress").fadeOut("slow"); } else { document.getElementById("Chkyeschk").checked = true; document.getElementById('txtcLine1').value = document.getElementById('txtaddress').value; document.getElementById('txtcCity').value = document.getElementById('txtvalidationcity').value; document.getElementById('txtCState').value = document.getElementById('txtvalidationstate').value; document.getElementById('txtBZC').value = document.getElementById('txtvalidationzip').value; document.getElementById('txtcline2').value = ""; $(".Billingaddress").fadeIn("slow"); } } function Registervalidation1() { $(".samplep").text(""); var EmailId, FirstName, LastName, Password, Number, Country; EmailId = document.getElementById('txtAppemail').value; FirstName = document.getElementById('txtupdatebusnsname').value; LastName = document.getElementById('txtaddr1').value; Number = document.getElementById('txtphone').value; Country1 = $("#ddlcountry option:selected").text(); State1 = $("#ddlState1 option:selected").text(); City1 = $("#ddlcity1 option:selected").text(); emailExp = /^[A-Z0-9#-_~!$&()*+,;=:]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i; //emailExp = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i; numberexp1 = /^\+(?:[0-9] ?){6,14}[0-9]$/; //^[0-9-+]+$/ pwdexp = /^[A-Za-z0-9!@#$%^&*()_ ]{5,50}$/; numberexp = /^\d{10}$/; //10 Digit Number Validation /^\d{3}-?\d{3}-?\d{4}$/ nameexp = /^[A-Za-z0-9!@#$%^&*'()_ ]{2,20}$/; var i = 0; if (EmailId == '' && FirstName == '' && LastName == '' && Number == '' && (Country1 == '' || Country1 == '-Select Country-') && (State1 == '' || State1 == '-Select State-') && (City1 == '' || City1 == '-Select City-')) { document.getElementById('txtAppemail').className = "userregistrer_formtext1Errorcb"; document.getElementById('txtupdatebusnsname').className = "userregistrer_formtext1Errorcb "; document.getElementById('txtaddr1').className = "userregistrer_formtext1Errorcb"; document.getElementById('txtphone').className = "userregistrer_formtext1Errorcb"; document.getElementById('ddlcountry').className = "userregistrer_formtext1Errorcb "; document.getElementById('ddlState1').className = "userregistrer_formtext1Errorcb "; document.getElementById('ddlcity1').className = "userregistrer_formtext1Errorcb "; $("#txtupdatebusnsname").attr("alt", "Enter your First Name"); $("#txtupdatebusnsname").focus(); $(".samplep").text("firstfocus"); } else { $("#regerror").fadeOut(); if (FirstName == '') { document.getElementById('txtupdatebusnsname').className = "userregistrer_formtext1Errorcb"; $("#txtupdatebusnsname").focus(); i++; } else if (!FirstName.match(nameexp)) { $("#txtupdatebusnsname").focus(); i++; } else { document.getElementById('txtupdatebusnsname').className = "userregistrer_formtext1cb"; } if (LastName == '') { document.getElementById('txtaddr1').className = "userregistrer_formtext1Errorcb"; $("#txtaddr1").attr("alt", "Enter your Last Name"); if (FirstName != '' && FirstName.match(nameexp)) { if (i == 0) { $("#txtaddr1").focus(); } } i++; } else { document.getElementById('txtaddr1').className = "userregistrer_formtext1cb"; } if (EmailId == '') { document.getElementById('txtAppemail').className = "userregistrer_formtext1Errorcb"; $("#txtemailclub").attr("alt", "Enter your Email"); if (FirstName != '' && (FirstName.match(nameexp)) && LastName != '') { if (i == 0) { $("#txtAppemail").focus(); } } i++; } else if (!EmailId.match(emailExp)) { if (FirstName != '' && (FirstName.match(nameexp)) && LastName != '') { if (i == 0) { $("#txtAppemail").focus(); } } i++; } else { document.getElementById('txtAppemail').className = "userregistrer_formtext1cb"; } if (Country1 == '-Select Country-') { document.getElementById('ddlcountry').className = "userregistrer_formtext1Errorcb"; i++; } else { document.getElementById('ddlcountry').className = "userregistrer_formtext1"; } if (State1 == '-Select State-' || State1 == '') { document.getElementById('ddlState1').className = "userregistrer_formtext1Errorcb"; i++; } else { document.getElementById('ddlState1').className = "userregistrer_formtext1"; } if (City1 == '-Select City-' || City1 == '') { document.getElementById('ddlcity1').className = "userregistrer_formtext1Errorcb"; i++; } else { document.getElementById('ddlcity1').className = "userregistrer_formtext1"; } if (Number == '') { document.getElementById('txtphone').className = "userregistrer_formtext1Errorcb"; //$("#txtphone").focus(); i++; } else if (!Number.match(numberexp)) { $("#txtphone").focus(); i++; } else { document.getElementById('txtphone').className = "userregistrer_formtext1cb"; } if (i == 0) { AddressSendEmail(); } } } function isNumber(evt) { evt = (evt) ? evt : window.event; var charCode = (evt.which) ? evt.which : evt.keyCode; if (charCode > 31 && (charCode < 48 || charCode > 57)) { return false; } return true; } function AddressSendEmail() { var Business, AppName, WebAddress, ContactEmail, Line1, Line2, City, State, Country, Zip, PhoneNumber, AdditionalInfo, OrdersType; if (document.getElementById('r1').checked) Business = document.getElementById('r1').value; else Business = document.getElementById('r2').value; AppName = document.getElementById('txtupdatebusnsname').value; Line1 = document.getElementById('txtaddr1').value; Line2 = document.getElementById('txtaddr2').value; var ddlsource = document.getElementById("ddlcountry"); if (ddlsource.options[ddlsource.selectedIndex].text != "-Select Country-" && ddlsource.options[ddlsource.selectedIndex].text != "") Country = ddlsource.options[ddlsource.selectedIndex].text; else document.getElementById('ddlcountry').value = ""; var ddlsource1 = document.getElementById('ddlState1'); if (ddlsource1.options.length > 0) { if (ddlsource1.options[ddlsource1.selectedIndex].text != "-Select State-" && ddlsource1.options[ddlsource1.selectedIndex].text != "" && ddlsource1.options[ddlsource1.selectedIndex].text != null) State = ddlsource1.options[ddlsource1.selectedIndex].text; } else document.getElementById('ddlState1').value = ""; var ddlsource2 = document.getElementById('ddlcity1'); if (ddlsource2.options.length > 0) { if (ddlsource2.options[ddlsource2.selectedIndex].text != "-Select City-" && ddlsource2.options[ddlsource2.selectedIndex].text != "") City = ddlsource2.options[ddlsource2.selectedIndex].text; } else document.getElementById('ddlcity1').value = ""; Zip = document.getElementById('txtzip1').value; PhoneNumber = document.getElementById('txtphone').value; WebAddress = document.getElementById('txtwebaddre').value; ContactEmail = document.getElementById('txtAppemail').value; AdditionalInfo = document.getElementById('txtcntxt').value; var CHK = document.getElementById("chklstord"); var checkbox = CHK.getElementsByTagName("input"); var Checkdata; var label = CHK.getElementsByTagName("label"); var data = Array(); for (var i = 0; i < checkbox.length; i++) { if (checkbox[i].checked) { if (label[i].innerHTML != 'undefinded' && label[i].innerHTML != '' && label[i].innerHTML != null) { data.push(label[i].innerHTML); } } } OrdersType = data; $("#lblmsg20").delay(5000).fadeIn(""); if (document.getElementById('txtupdatebusnsname').value != '' && document.getElementById('txtupdatebusnsname').value != null && document.getElementById('txtupdatebusnsname').value != 'undefined') { if (document.getElementById('ddlcountry').value != '' && document.getElementById('ddlcountry').value != null && document.getElementById('ddlcountry').value != 'undefined' && document.getElementById('ddlcountry').value != '-Select Country-') { if (document.getElementById('ddlState1').value != '' && document.getElementById('ddlState1').value != null && document.getElementById('ddlState1').value != 'undefined' && document.getElementById('ddlState1').value != '-Select State-') { if (document.getElementById('txtAppemail').value != '' && document.getElementById('txtAppemail').value != null && document.getElementById('txtAppemail').value != 'undefined') { $.ajax({ type: "POST", url: "Orders.aspx/EditBusinesstoSendEmail", data: "{'Business': '" + Business + "','RestaurantName': '" + AppName + "','Address1': '" + Line1 + "','Address2': '" + Line2 + "','City': '" + City + "','State': '" + State + "','Country': '" + Country + "','Zip': '" + Zip + "','PhoneNumber': '" + PhoneNumber + "','WebAddress': '" + WebAddress + "','ContactEmail': '" + ContactEmail + "','AdditionalInfo': '" + AdditionalInfo + "','OrdersType': '" + OrdersType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { if (msg.d == "Email Sent Successfully") { document.getElementById('lblMsg').innerHTML = "Email Sent Successfully"; document.getElementById('txtcntxt').value = ""; //chklstord.checked = false; var cbl = document.getElementById('chklstord').getElementsByTagName("input"); for (i = 0; i < cbl.length; i++) { cbl[i].checked = false; } $("#lblMsg").delay(5000).fadeOut(); $(".rstubibehind").css("display", "none"); } } } }) } else { document.getElementById('lblyouremail').innerHTML = "*"; $("#lblyouremail").delay(5000).fadeOut(); } } else { document.getElementById('lblstate').innerHTML = "*"; $("#lblstate").delay(5000).fadeOut(); } } else { document.getElementById('lblcountry2').innerHTML = "*"; $("#lblcountry2").delay(5000).fadeOut(); $("#Statetr").fadeOut(); $("#citytr").fadeOut(); $(".loaderc").css("display", "block"); $("#ddlcountry").empty(); var Countrys = document.getElementById("ddlcountry"); $.ajax({ type: "POST", url: "Orders.aspx/GetAllCountries", data: "", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { for (var i = 0; i < msg.d.length; i++) { if (msg.d[i] == "-Select Country-") { var optmin2 = document.createElement("option"); optmin2.text = msg.d[i]; Countrys.options.add(optmin2); } else { var optmin2 = document.createElement("option"); optmin2.text = msg.d[i]; optmin2.value = msg.d[i]; ddlcountry.options.add(optmin2); } } $(".loaderc").css("display", "none"); } } }); } } else { document.getElementById('lblrestname').innerHTML = "*"; $("#lblrestname").delay(5000); } } $(".rstubicls").click(function () { $(".rstubibehind").css("display", "none"); }) </script> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAMMKJpsP5L_gaT90myylu9Fzwiwhsk9SY&libraries=places&callback=initAutocomplete" async= async defer= defer></script> <script> var placeSearch, autocomplete; function initAutocomplete() { var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["CustomWebsites"]; if (CustomWebsites == undefined) { var sessionToken = Tokengeneration(); autocomplete = new google.maps.places.Autocomplete((document.getElementById('txtaddress')), { types: ['geocode'], fields: ['address_component,formatted_address,name'], sessionToken: sessionToken }); autocomplete.addListener('place_changed', fillInAddress); } } function Tokengeneration() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); } function fillInAddress() { var J = 0; var place = autocomplete.getPlace(); var placess = JSON.stringify(place); document.getElementById('txtaddress').value = ""; document.getElementById('txtvalidationzip').value = ""; document.getElementById('txtvalidationstate').value = ""; document.getElementById('txtvalidationcity').value = ""; document.getElementById('txtaddress').value = place.name; for (var i = 0; i < place.address_components.length; i++) { var addressType = place.address_components[i].types[0]; for (var b = 0; b < place.address_components[i].types.length; b++) { if (place.address_components[i].types[b] == "postal_code") { document.getElementById('txtvalidationzip').value = place.address_components[i].short_name; } if (place.address_components[i].types[b] == "locality") { document.getElementById('txtvalidationcity').value = place.address_components[i].long_name; } if (place.address_components[i].types[b] == "administrative_area_level_1") { document.getElementById('txtvalidationstate').value = place.address_components[i].short_name; } } } } function geolocate() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function (position) { var geolocation = { lat: position.coords.latitude, lng: position.coords.longitude }; var circle = new google.maps.Circle({ center: geolocation, radius: position.coords.accuracy }); autocomplete.setBounds(circle.getBounds()); }); } } function GetStateCityDetails() { var zip = document.getElementById("txtshpzip").value; var geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'address': zip }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { geocoder.geocode({ 'latLng': results[0].geometry.location }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[1]) { var loc = getCityState(results); } } }); } }); } function getCityState(results) { var a = results[0].address_components; var city, state; for (i = 0; i < a.length; ++i) { var t = a[i].types; if (compIsType(t, 'country')) country = a[i].long_name; //store the state else if (compIsType(t, 'administrative_area_level_1')) state = a[i].long_name; //store the state else if (compIsType(t, 'locality')) city = a[i].long_name; //store the city } BindShippingStates(state); document.getElementById("ddlshpcountry").value = country; document.getElementById("ddlshpState").value = state; document.getElementById("txtshpcity").value = city; } function compIsType(t, s) { for (z = 0; z < t.length; ++z) if (t[z] == s) return true; return false; } </script> <script type="text/javascript"> function SaveCart() { var UId = document.getElementById("UserId").innerHTML; if (UId == "") { $(".signinpanel").fadeIn("slow"); //$(".signinpanel").css("position", "relative"); $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); } else { var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null && AddedItems != "") { var OrderType = localStorage.getItem("OrderType"); if (OrderType == "Shipping") OrderType = "Shipping"; else if (OrderType == "Delivery") OrderType = "Delivery"; else OrderType = "PickUp"; if ($(".SaveCart").attr("Id") == "") { $.ajax({ type: "POST", url: "Orders.aspx/SaveCart", data: "{'retrievedData': '" + retrievedData + "','UId': '" + UId + "','LocationId': '" + document.getElementById('lblLId').value + "','OrderType': '" + OrderType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { $(".SaveCart").attr("Id", msg.d); $("#lblordalert").text("Saved"); $(".orderalert").fadeIn(); } } }) } else { $.ajax({ type: "POST", url: "Orders.aspx/UpdateCart", data: "{'retrievedData': '" + retrievedData + "','UId': '" + UId + "','LocationId': '" + document.getElementById('lblLId').value + "','OrderType': '" + OrderType + "','GroupId': '" + $(".SaveCart").attr("Id") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { $(".SaveCart").attr("Id", msg.d); $("#lblordalert").text("Saved"); $(".orderalert").fadeIn(); } } }) } } else { $("#lblordalert").text("Your cart is empty"); $(".orderalert").fadeIn(); } } } function ShowCart() { var Orderstring = getQueryStrings(); var OrderId = Orderstring["OrderId"]; var OrderType = ""; if (OrderId != undefined) { localStorage.removeItem("TotalItems"); localStorage.removeItem("EntityDisabled"); localStorage.removeItem("OrderType"); localStorage.removeItem("DeliveryDetails"); localStorage.removeItem("DeliveryType"); $(".SaveCart").attr("Id", OrderId); $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/GetAllItems", data: "{'GroupId': '" + OrderId + "','MemberId': '" + "" + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var itCount = 0; if (msg.d.length > 0) { var Items = new Array(); for (var M = 0; M < msg.d.length; M++) { for (var I = 0; I < msg.d[M].GroupItems.length; I++) { itCount++; var Item = new Object; Item.Id = msg.d[M].GroupItems[I].ItemId; Item.ItemName = escape(msg.d[M].GroupItems[I].ItemName); Item.LId = msg.d[M].LocationId; Item.AppName = escape(document.getElementById('lblAppName').innerHTML); Item.MemberId = msg.d[M].GroupItems[I].MemberId; Item.Price = msg.d[M].GroupItems[I].Price; Item.Quantity = msg.d[M].GroupItems[I].Quantity; if(msg.d[M].GroupItems[I].Instructions!="Order instruction, suggestions") Item.Instructions = escape(msg.d[M].GroupItems[I].Instructions); Item.TimeName = msg.d[M].GroupItems[I].TimeName; Item.CategoryId = msg.d[M].GroupItems[I].CategoryId; Item.OrderType = msg.d[M].GroupItems[I].OrderType; Item.NoSalesTax = document.getElementById('lblItemNoTax').innerHTML; Item.CustomTax = document.getElementById("lblCustomTax").innerHTML; Item.TaxLabel = document.getElementById("lblTaxLabel").innerHTML; OrderType = Item.OrderType; localStorage.setItem("OrderType", Item.OrderType); localStorage.setItem("GroupOrderType", Item.OrderType); Item.Choices = new Array(); if (Item.OrderType == "Shipping") { if (msg.d[M].GroupItems[I].ItemWeight != "" && msg.d[M].GroupItems[I].ItemWeight != null) { if (~msg.d[M].GroupItems[I].ItemWeight.indexOf("Pounds")) { var Measurement = msg.d[M].GroupItems[I].ItemWeight.slice(-6); var ItemWeight = msg.d[M].GroupItems[I].ItemWeight.replace(" ", "").replace(Measurement, ""); Item.ItemWeight = ItemWeight; Item.Measurement = Measurement; for (var Ch = 0; Ch < msg.d[M].GroupItems[I].Choices.length; Ch++) { var Choice = new Object; Choice.ShippingOptionId = msg.d[M].GroupItems[I].Choices[Ch].ShippingOptionId; Choice.OptionName = msg.d[M].GroupItems[I].Choices[Ch].OptionName; Item.Choices.push(Choice); } } else { var Measurement = msg.d[M].GroupItems[I].ItemWeight.slice(-2); var ItemWeight = msg.d[M].GroupItems[I].ItemWeight.replace(" ", "").replace(Measurement, ""); Item.ItemWeight = ItemWeight; Item.Measurement = Measurement; for (var Ch = 0; Ch < msg.d[M].GroupItems[I].Choices.length; Ch++) { var Choice = new Object; Choice.ShippingOptionId = msg.d[M].GroupItems[I].Choices[Ch].ShippingOptionId; Choice.OptionName = msg.d[M].GroupItems[I].Choices[Ch].OptionName; Item.Choices.push(Choice); } } } } else { for (var Ch = 0; Ch < msg.d[M].GroupItems[I].Choices.length; Ch++) { var Choice = new Object; Choice.Id = msg.d[M].GroupItems[I].Choices[Ch].id; Choice.OptionName = escape(msg.d[M].GroupItems[I].Choices[Ch].OptionName); Choice.OptionId = msg.d[M].GroupItems[I].Choices[Ch].OptionId; Choice.ChoiceName = escape(msg.d[M].GroupItems[I].Choices[Ch].ChoiceName); Choice.ChildChoices = new Array(); for (var CCh = 0; CCh < msg.d[M].GroupItems[I].Choices[Ch].ChildChoices.length; CCh++) { var ChildChoice = new Object; ChildChoice.Id = msg.d[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].id; ChildChoice.OptionName = escape(msg.d[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].OptionName); ChildChoice.OptionId = msg.d[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].OptionId; ChildChoice.ChoiceName = escape(msg.d[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].ChoiceName); ChildChoice.Price = escape(msg.d[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].Price); Choice.ChildChoices.push(ChildChoice); } Item.Choices.push(Choice); } } Item.AddedDate = new Date(); Items.push(Item); } } localStorage.setItem("TotalItems", JSON.stringify(Items)); localStorage.setItem("OtherMembersItems", JSON.stringify(Items)); } if (GroupId != null && GroupId != "" && GroupId != undefined) { // BindItemsforgrouporders(); } else { if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow();} else { BindItems(); } } } }); } } function FavourateandRevies() { $.ajax({ type: "POST", url: "Orders.aspx/GetFavoriteandReviewscount", data: "{'LocationId': '" + document.getElementById('lblLId').value + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "" && msg.d != null) { if (msg.d[0].ReviewsCount != undefined) document.getElementById('lblreviewcxount').innerHTML = "(" + msg.d[0].ReviewsCount + ")"; if (msg.d[0].FavoritesCount != undefined) document.getElementById('lblfavouratecount').innerHTML = "(" + msg.d[0].FavoritesCount + ")"; } } }); } $(".coupnx").click(function () { $("#couponpnl").fadeOut(); }) function GetCustomOrderTypeSettings() { var UrlType = document.getElementById('lblurlnametype').innerHTML; var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; //if (OrderType != "CurbSide") { var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; $(".CustomAdvnacedSettings").fadeOut("fast"); $(".advancedineinsettings").fadeOut("fast"); if (OrderTypevalue != OrderType) { $.ajax({ type: "POST", url: "Orders.aspx/GetCustomOrderTypeSettings", data: "{'Id': '" + OrderTypevalue + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { document.getElementById("lblEnableSignIn").innerHTML = msg.d[0].EnableSignIn; $(".screenCustomAdvnacedSettings").fadeOut("fast"); $(".screenAdvnacedSettings").fadeOut("fast"); $(".screenddlAdvnacedSettings").fadeOut("fast"); if(OrderType != "CurbSide"){ document.getElementById("AdvancedOption").innerHTML = "true"; document.getElementById("lblbeforeorderafterorder").innerHTML = ""; document.getElementById("lblcustomerinfo").innerHTML = ""; document.getElementById("lblcheckinmobile").innerHTML = ""; $("#ddldropdownoptions").empty(); $("#screenddldropdownoptions").empty(); $(".checkinsettings").css("display","none"); $(".lblpickuptext").text(msg.d[0].LocationLabel); $(".screenlblpickuptext").text(msg.d[0].ScreenLocationLabel); $("#lblpickuptext").text(msg.d[0].LocationLabel); $("#txtRangeFrom").text(""); $("#txtRangeTo").text(""); document.getElementById("lblindication").innerHTML = msg.d[0].IndicationMethod; if(msg.d[0].ScreenIndicationMethod != null && msg.d[0].ScreenIndicationMethod != "" && msg.d[0].ScreenIndicationMethod != " " ){ document.getElementById("screenlblindication").innerHTML = msg.d[0].ScreenIndicationMethod; } $(".Pickupnone").val(document.getElementById("lblPickupname").innerHTML.replace("&", "&")); if (document.getElementById("lblindication").innerHTML == "Textbox") { $("#txtRangeFrom").text(msg.d[0].TextboxRangeFrom); $("#txtRangeTo").text(msg.d[0].TextboxRangeTo); $(".AdvnacedSettings").fadeIn("fast"); document.getElementById("lblAdvinst").innerHTML = msg.d[0].TextBoxInstructions; var range = msg.d[0].TextboxRangeFrom+ " to "+msg.d[0].TextboxRangeTo; $("#txtAdvancedlbl").attr("placeholder",range); $(".ddlAdvnacedSettings").fadeOut("fast"); $(".CustomAdvnacedSettings").fadeOut("fast"); } else if (document.getElementById("lblindication").innerHTML == "Dropdown") { $(".ddlAdvnacedSettings").fadeIn("fast"); $(".AdvnacedSettings").fadeOut("fast"); $(".CustomAdvnacedSettings").fadeOut("fast"); var btns = msg.d[0].DropDownOptions.split(','); if (~msg.d[0].DropDownOptions.indexOf(',')) { btns = msg.d[0].DropDownOptions.split(',') } else btns = msg.d[0].DropDownOptions.split('\r\n') if (btns.length > 0) { var ddldropdownoptions = document.getElementById("ddldropdownoptions"); var optmin2 = document.createElement("option"); optmin2.text = "--Select--"; optmin2.value = "0"; ddldropdownoptions.options.add(optmin2); for (var l = 0; l < btns.length; l++) { if(btns[l] != "" && btns[l] != " "){ var optmin2 = document.createElement("option"); optmin2.text = btns[l]; optmin2.value = btns[l]; ddldropdownoptions.options.add(optmin2); } } } } else { $(".CustomAdvnacedSettings").fadeIn("fast"); $(".AdvnacedSettings").fadeOut("fast"); $(".ddlAdvnacedSettings").fadeOut("fast"); //$("#txtCustomerOrderDe").attr("placeholder",msg.d[0].LocationLabel); } if(OrderType == "Theater Seat"){ if (document.getElementById("screenlblindication").innerHTML == "Textbox") { $("#txtRangeFrom").text(msg.d[0].TextboxRangeFrom); $("#txtRangeTo").text(msg.d[0].TextboxRangeTo); $(".screenAdvnacedSettings").fadeIn("fast"); document.getElementById("screenlblAdvinst").innerHTML = msg.d[0].TextBoxInstructions; var range = msg.d[0].TextboxRangeFrom+ " to "+msg.d[0].TextboxRangeTo; $("#screentxtAdvancedlbl").attr("placeholder",range); $(".screenddlAdvnacedSettings").fadeOut("fast"); $(".screenCustomAdvnacedSettings").fadeOut("fast"); } else if (document.getElementById("screenlblindication").innerHTML == "Dropdown") { $(".screenddlAdvnacedSettings").fadeIn("fast"); $(".screenAdvnacedSettings").fadeOut("fast"); $(".screenCustomAdvnacedSettings").fadeOut("fast"); var btns = msg.d[0].ScreenDropDownOptions.split(','); if (~msg.d[0].ScreenDropDownOptions.indexOf(',')) { btns = msg.d[0].ScreenDropDownOptions.split(',') } else btns = msg.d[0].ScreenDropDownOptions.split('\r\n') if (btns.length > 0) { var screenddldropdownoptions = document.getElementById("screenddldropdownoptions"); var optmin2 = document.createElement("option"); optmin2.text = "--Select--"; optmin2.value = "0"; screenddldropdownoptions.options.add(optmin2); for (var l = 0; l < btns.length; l++) { var optmin2 = document.createElement("option"); optmin2.text = btns[l]; optmin2.value = btns[l]; screenddldropdownoptions.options.add(optmin2); } } } else { $(".screenCustomAdvnacedSettings").fadeIn("fast"); $(".screenAdvnacedSettings").fadeOut("fast"); $(".screenddlAdvnacedSettings").fadeOut("fast"); //$("#txtCustomerOrderDe").attr("placeholder",msg.d[0].LocationLabel); } } } else { if (msg.d[0].BeforeandAfterplacingorder == true) { document.getElementById("lblbeforeorderafterorder").innerHTML = msg.d[0].BeforeandAfterplacingorder; document.getElementById("AdvancedOption").innerHTML = "true"; document.getElementById("lblcustomerinfo").innerHTML = msg.d[0].CheckInInfoLabel; //$("#txtcustomerinfo").attr("placeholder",msg.d[0].CheckInInfoLabel); document.getElementById("lblcheckinmobile").innerHTML = msg.d[0].EnableCheckInMobileNumber; $(".checkinsettings").css("display","table-row"); $("#ddldropdownoptions").empty(); $("#screenddldropdownoptions").empty(); $(".lblpickuptext").text(msg.d[0].LocationLabel); $("#lblpickuptext").text(msg.d[0].LocationLabel); $("#txtRangeFrom").text(""); $("#txtRangeTo").text(""); document.getElementById("lblindication").innerHTML = msg.d[0].IndicationMethod; $(".Pickupnone").val(document.getElementById("lblPickupname").innerHTML.replace("&", "&")); if (document.getElementById("lblindication").innerHTML == "Textbox") { $("#txtRangeFrom").text(msg.d[0].TextboxRangeFrom); $("#txtRangeTo").text(msg.d[0].TextboxRangeTo); $(".AdvnacedSettings").fadeIn("fast"); document.getElementById("lblAdvinst").innerHTML = msg.d[0].TextBoxInstructions; $(".ddlAdvnacedSettings").fadeOut("fast"); $(".CustomAdvnacedSettings").fadeOut("fast"); var range = msg.d[0].TextboxRangeFrom+ " to "+msg.d[0].TextboxRangeTo; $("#txtAdvancedlbl").attr("placeholder",range); } else if (document.getElementById("lblindication").innerHTML == "Dropdown") { $(".ddlAdvnacedSettings").fadeIn("fast"); $(".AdvnacedSettings").fadeOut("fast"); $(".CustomAdvnacedSettings").fadeOut("fast"); var btns = msg.d[0].DropDownOptions.split(','); if (~msg.d[0].DropDownOptions.indexOf(',')) { btns = msg.d[0].DropDownOptions.split(',') } else btns = msg.d[0].DropDownOptions.split('\r\n') if (btns.length > 0) { var ddldropdownoptions = document.getElementById("ddldropdownoptions"); var optmin2 = document.createElement("option"); optmin2.text = "--Select--"; optmin2.value = "0"; ddldropdownoptions.options.add(optmin2); for (var l = 0; l < btns.length; l++) { if(btns[l] != "" && btns[l] != " "){ var optmin2 = document.createElement("option"); optmin2.text = btns[l]; optmin2.value = btns[l]; ddldropdownoptions.options.add(optmin2); } } } } else { $(".CustomAdvnacedSettings").fadeIn("fast"); $(".AdvnacedSettings").fadeOut("fast"); $(".ddlAdvnacedSettings").fadeOut("fast"); //$("#txtCustomerOrderDe").attr("placeholder",msg.d[0].LocationLabel); } if(OrderType == "Theater Seat"){ if (document.getElementById("screenlblindication").innerHTML == "Textbox") { $("#txtRangeFrom").text(msg.d[0].TextboxRangeFrom); $("#txtRangeTo").text(msg.d[0].TextboxRangeTo); $(".screenAdvnacedSettings").fadeIn("fast"); document.getElementById("screenlblAdvinst").innerHTML = msg.d[0].TextBoxInstructions; var range = msg.d[0].TextboxRangeFrom+ " to "+msg.d[0].TextboxRangeTo; $("#screentxtAdvancedlbl").attr("placeholder",range); $(".screenddlAdvnacedSettings").fadeOut("fast"); $(".screenCustomAdvnacedSettings").fadeOut("fast"); } else if (document.getElementById("screenlblindication").innerHTML == "Dropdown") { $(".screenddlAdvnacedSettings").fadeIn("fast"); $(".screenAdvnacedSettings").fadeOut("fast"); $(".screenCustomAdvnacedSettings").fadeOut("fast"); var btns = msg.d[0].ScreenDropDownOptions.split(','); if (~msg.d[0].ScreenDropDownOptions.indexOf(',')) { btns = msg.d[0].ScreenDropDownOptions.split(',') } else btns = msg.d[0].ScreenDropDownOptions.split('\r\n') if (btns.length > 0) { var screenddldropdownoptions = document.getElementById("screenddldropdownoptions"); var optmin2 = document.createElement("option"); optmin2.text = "--Select--"; optmin2.value = "0"; screenddldropdownoptions.options.add(optmin2); for (var l = 0; l < btns.length; l++) { var optmin2 = document.createElement("option"); optmin2.text = btns[l]; optmin2.value = btns[l]; screenddldropdownoptions.options.add(optmin2); } } } else { $(".screenCustomAdvnacedSettings").fadeIn("fast"); $(".screenAdvnacedSettings").fadeOut("fast"); $(".screenddlAdvnacedSettings").fadeOut("fast"); //$("#txtCustomerOrderDe").attr("placeholder",msg.d[0].LocationLabel); } } }else { $(".checkinsettings").css("display","none"); document.getElementById("lblbeforeorderafterorder").innerHTML = msg.d[0].BeforeandAfterplacingorder; document.getElementById("lblcustomerinfo").innerHTML = ""; document.getElementById("lblcheckinmobile").innerHTML = ""; document.getElementById("AdvancedOption").innerHTML = ""; $(".CustomAdvnacedSettings").fadeOut("fast"); $(".AdvnacedSettings").fadeOut("fast"); $(".ddlAdvnacedSettings").fadeOut("fast"); } } } } }); } else { RequiredDineInFeilds(); } //} else { // document.getElementById("AdvancedOption").innerHTML = ""; //} } $(document).on('focusout', '.ChoicesQuantity', function (e) { if (e.target.value == "") { e.target.style.border = "1px solid #C22727"; } else { e.target.style.border = "1px solid #b9bcbe"; } }); // $(document).on('focusout', '#txtshpzip', function (e) { // GetStateCityDetails(); //}); $(document).on('keypress', '.ChoicesQuantity', function (e) { var charCode = (e.which) ? e.which : e.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true; }); function SetDefaultColors() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; $("#imglogo").attr("src", "https://www.munchem.com/images/MunchemNewLogoWhite.png"); $("#imglogo").attr("alt", "Munchem Logo"); $(".hmheader").css("background-color", "#ffffff"); $(".backrestlist").css("background-color", "#fe0000"); $(".laodpages").css("background-color", "#FFFFFF"); $(".btnaddreview").attr("style", ButtonColor); $("#ReserveTablebtn").attr("style", ButtonColor); $("#Reservebtn").attr("style", ButtonColor); $(".ordqnty").attr("style", ButtonColor); $("#itemflowqty").attr("style", ButtonColor); $(".btnshare").attr("style", ButtonColor); $(".hidcart").attr("style", ButtonColor); $(".btnfavorite").attr("style", ButtonColor); $("#btnBusiness").attr("style", ButtonColor); $(".grouporderbtn").attr("style", ButtonColor); $(".orderCatering").attr("style", ButtonColor); $(".finishorder").attr("style", ButtonColor); $(".mncatcncl").attr("style", ButtonColor); $(".getdealbtn").attr("style", ButtonColor); $(".recsrchbtn").attr("style", ButtonColor); $(".placeorder").attr("style", ButtonColor); $(".bnttip").attr("style", ButtonColor); $(".bnttip").attr("style", ButtonColor); $(".btnVideoURL").attr("style", ButtonColor); $(".btnRecipe").attr("style", ButtonColor); $(".additem").attr("style", ButtonColor); $(".ordadditem").attr("style", ButtonColor); $(".fcontainer").css("background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #161616), color-stop(1, #161616))"); $("#AddVehicleDetails").attr("style", ButtonColor); $("#lblitemmesg").css("font-family", "Quicksand"); $(".OptionTable").css("font-family", "Quicksand"); $(".nutritiontable").css("font-family", "Quicksand"); $(".spnsvgicon").css("font-family", "Quicksand"); } var DeliveryService = ""; var PriceColor = "color:#fe0000"; var MenuFont = "font-family: Quicksand;"; var DividerColor = "#fe0000"; var MenuColors = "background-color:#e0e0e0;color:#535353"; var SubMenuColors = "color:#535353"; var MenuForeColors = "border-color: #a8a8a8"; var CategoryTextColor = "color: #a8a8a8"; var CategoryBgColor = "background-color: #ffffff"; var CategoryBold = "font-weight:initial"; var CategoryFontSize = "font-size:20px"; var CategoryFontFamily = "font-family:Quicksand"; var ItemPriceFontSize = "font-size:28px"; var ItemPriceFontWeight = "font-weight:initial"; var ItemNameFontSize = "font-size:20px";var ItemNameFontFamily = "font-family:Quicksand"; var ItemNameColor = "color: #010101"; var ItemNameFontWeight = "font-weight:initial"; var ItemNamestyles = ItemNameFontSize+";"+ItemNameFontFamily+";"+ItemNameColor+";"+ItemNameFontWeight; var ButtonColor = "background:-webkit-gradient(linear,left top,left bottom,color-stop(0.05,#fe0000),color-stop(1,#fe0000));background:-moz-linear-gradient(center top,#fe00000 5%,#fe0000 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fe0000',endColorstr='#fe0000');background-color:#fe0000;border:1px solid #cc0000;color:#fff;border-radius: 7px;font-family:Quicksand !important;font-weight:initial;font-size:14px"; var MenuButtonColor = "background:-webkit-gradient(linear,left top,left bottom,color-stop(0.05,#fe0000),color-stop(1,#fe0000));background:-moz-linear-gradient(center top,#fe0000 5%,#fe0000 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fe0000',endColorstr='#fe0000');background-color:#fe0000;border:1px solid #cc0000;color:#fff;border-radius: 26px;"; var Button = ""; var optionColor = "-moz-box-shadow:0 0 2px 0 #F0E4D0;-webkit-box-shadow:0 0 2px 0 #F0E4D0;background:-webkit-gradient(linear,left top,left bottom,color-stop(0.05,#F0E4D0),color-stop(1,#F0E4D0));background:-moz-linear-gradient(center top,#F0E4D0 5%,#F0E4D0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#F0E4D0',endColorstr='#F0E4D0');background-color:#F0E4D0;border:1px solid #F0E4D0;color:black;"; var OptionTextColor = "color:black"; var MenuTheme1="Column1"; var PageBackgroundColor = "background:#E0E0E0"; function SetBrandingColors() { var colortype = "light"; var QueryString = getQueryStrings(); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var Type = Orderstring["Type"]; var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; if (LocationId != "") { var Urltype = document.getElementById('lblurlnametype').innerHTML; $.ajax({ type: "POST", url: "Orders.aspx/BindBrandingFeatures", data: "{'LocationId': '" + LocationId + "', 'AppId':'" + AppId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { // $("#lblAppName,#lbllocationname,#spanname").css("color", msg.d[0].RestaurantNameColor); var hbgcolor = QueryString["Hbc"]; if (hbgcolor != "" && hbgcolor != "undefined" && hbgcolor != null) { $("#reservetablebutton").css("display", ""); if (msg.d.length > 0) { document.getElementById('lblMenuoptions').value = msg.d[0].OptionsMenu; $("#form1").css("font-family", msg.d[0].Font); if (msg.d[0].Showsiginbutton == false) { $(".hmlgin").attr("style", "display:none"); } else if (msg.d[0].Showsiginbutton == null) { $(".hmlgin").attr("style", "display:flex"); } else { $(".hmlgin").attr("style", "display:flex"); } if(msg.d[0].HeaderTextFont != null && msg.d[0].HeaderTextFont != "") $(".cartrst").css("font-family", msg.d[0].HeaderTextFont); else $(".cartrst").css("font-family", "Quicksand"); if (msg.d[0].HeaderType == "Text") { if (msg.d[0].HeaderText != null && msg.d[0].HeaderText != "") $("#lbllogotext").text(msg.d[0].HeaderText); else $("#lbllogotext").text($("#lblAppName").text()); $("#imglogo").css("display", "none"); $("#lbllogotext").css("display", "block"); var HeaderFontWeight = "font-weight:initial"; if (msg.d[0].HeaderFontWeight == true) { HeaderFontWeight = "font-weight:bold"; } $("#lbllogotext").attr("style", "display:inline-block; font-size:" + msg.d[0].FontSize + "px;margin-top: 7px;color:" + msg.d[0].HeaderTextColor + ";font-family:" + msg.d[0].HeaderTextFont +";"+HeaderFontWeight); } else { $("#lbllogotext").css("display", "none"); if (msg.d[0].HeaderLogoURL!= null) { if (msg.d[0].HeaderLogoURL.trim() != null && msg.d[0].HeaderLogoURL.trim() != "" && msg.d[0].HeaderLogoURL.trim() != "undefined") { $("#imglogo").attr("src", msg.d[0].HeaderLogoURL); $("#imglogo").css("display", "inline-block"); } else { $("#lbllogotext").text($("#lblAppName").text()); $("#imglogo").css("display", "none"); $("#lbllogotext").css("display", "block"); //$("#imglogo").attr("src", "https://www.munchem.com/images/MunchemNewLogoWhite.png"); //$("#imglogo").attr("alt", "Munchem New Logo"); //$("#imglogo").css("display", "inline-block"); //$("#hmheader").css("background-color", "#d80000"); } } else { $("#lbllogotext").text($("#lblAppName").text()); $("#imglogo").css("display", "none"); $("#lbllogotext").css("display", "block"); //$("#imglogo").attr("src", "https://www.munchem.com/images/MunchemNewLogoWhite.png"); //$("#imglogo").attr("alt", "Munchem New Logo"); //$("#imglogo").css("display", "inline-block"); //$("#hmheader").css("background-color", "#d80000"); } } var AppId1 = document.getElementById('lblAppId1').value; if(AppId1=="5fdef4ff-59b6-4470-a535-16ecffc4880b") { if (msg.d[0].BackgroundImageURL != null && msg.d[0].BackgroundImageURL != "" && msg.d[0].BackgroundImageURL != "undefined"){ $(".orderswidth").css("background-image", "url(" + msg.d[0].BackgroundImageURL + ")"); $(".orderswidth").css("width", "100%"); } } else { if (msg.d[0].BackgroundImageURL != null && msg.d[0].BackgroundImageURL != "" && msg.d[0].BackgroundImageURL != "undefined") $(".CustomBG").css("background-image", "url(" + msg.d[0].BackgroundImageURL + ")"); } } else $("#tdGroupOrder").css("display", "none"); $(".hmheader").css("background-color", "#" + hbgcolor); colortype = lightOrDark("#" + hbgcolor); if (msg.d[0].HeaderLogoURL != null && msg.d[0].HeaderLogoURL != "" && msg.d[0].HeaderLogoURL != "undefined") { $("#imglogo").attr("src", msg.d[0].HeaderLogoURL); } else if (colortype == "dark") { $("#imglogo").attr("src", "https://www.munchem.com/images/MunchemLogo.png", "alt", "Munchem Logo"); } else { $("#imglogo").attr("src", "https://www.munchem.com/images/MunchemNewLogoWhite.png", "alt", "Munchem Logo"); } var RHbcolor = QueryString["RHbc"]; if (RHbcolor != "" && RHbcolor != "undefined" && RHbcolor != null) { $(".RestaurantHGB").css("background-color", "#" + RHbcolor); $(".hmheader").css("background-color", "#" + RHbcolor); } var Pbgcolor = QueryString["Pbc"]; if (Pbgcolor != "" && Pbgcolor != "undefined" && Pbgcolor != null) document.body.style.background = "#" + Pbgcolor; SpecialsDisplay(); var SNB = QueryString["SNB"]; if (SNB != "" && SNB != "undefined" && SNB != null) { if (SNB == "true") { $(".backrestlist").css("display", ""); Checkdeliveryzoneslink(); } else { $(".backrestlist").css("display", "none"); } } var nbgcolor = QueryString["Nbc"]; if (nbgcolor != "" && nbgcolor != "undefined" && nbgcolor != null) { $(".backrestlist").css("background-color", "#" + nbgcolor); menucolortype = lightOrDark(nbgcolor); if (menucolortype == "dark") $(".contmenubar").css("background-color", "#000000"); else $(".contmenubar").css("background-color", "#ffffff"); } var nfcolor = QueryString["Nfc"]; if (nfcolor != "" && nfcolor != "undefined" && nfcolor != null) { $(".backrestlist").css("color", "#" + nfcolor); } var Buttonbackgroundcolor = QueryString["Bbc"]; var Buttontextcolor = QueryString["Btc"]; if (Buttonbackgroundcolor != "" && Buttonbackgroundcolor != "undefined" && Buttonbackgroundcolor != null) { Button = "#" + Buttonbackgroundcolor; $(".bntSignin").css("background-color", Button); $(".bntSignin").css("color", "#" + Buttontextcolor); $(".hmcrt1").css("border-color", Button); ButtonColor = "-moz-box-shadow:0 0 2px 0 " + Button + ";-webkit-box-shadow:0 0 2px 0 " + Button + ";background:-webkit-gradient(linear,left top,left bottom,color-stop(0.05," + Button + "),color-stop(1," + Button + "));background:-moz-linear-gradient(center top," + Button + " 5%," + Button + " 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=" + Button + ",endColorstr=" + Button + ");background-color:" + Button + ";border:1px solid " + Button + ";color:#" + Buttontextcolor + ";border-radius: 7px"; if (colortype == "dark") { CartImageColor("#ffffff"); $(".hmcrt1 span").css("color", "#ffffff"); } else { CartImageColor(Button); } } var mbgcolor = QueryString["Mbc"]; var mtxtcolor = QueryString["Mtc"]; if (mbgcolor != "" && mbgcolor != "undefined" && mbgcolor != null) { MenuColors = "background-color:#" + mbgcolor + ";color:#" + mtxtcolor + ";font-family:" + msg.d[0].ItemPriceFont; SubMenuColors = "color:#" + mtxtcolor; MenuForeColors = "border-color: #" + mtxtcolor; // CategoryTextColor= "color: #a8a8a8"; } var mpricecolor = QueryString["Mpc"]; if (mpricecolor != "" && mpricecolor != "undefined" && mpricecolor != null) PriceColor = "color:#" + mpricecolor; var mdividercolor = QueryString["IDC"]; if (mdividercolor != "" && mdividercolor != "undefined" && mdividercolor != null) DividerColor = "#" + mdividercolor; var Fontfamily = QueryString["Fntst"]; if (Fontfamily != null && Fontfamily != "" && Fontfamily != "undefined") $("#Itemstable").css("font-family", Fontfamily); var displaybuttons = QueryString["Btns"]; var K = 0; if (displaybuttons != "" && displaybuttons != null && displaybuttons != "undefined") { if (~displaybuttons.indexOf(',')) { if (displaybuttons.indexOf("Cpn") != -1) { $("#lblcoupons").css("display", "none"); } else { if (Urltype != "DineIn") { $("#lblcoupons").css("display", ""); } } if (displaybuttons.indexOf("Fav") != -1) { $("#tdFavoriteUs").css("display", "none"); $(".backrestlistP3").css("display", "none"); K++; } else { $("#tdFavoriteUs").css("display", ""); $(".backrestlistP3").css("display", ""); } if (displaybuttons.indexOf("Rev") != -1) { $("#tdReview").css("display", "none"); $(".backrestlistP4").css("display", "none"); K++; } else { $("#tdReview").css("display", ""); $(".backrestlistP4").css("display", ""); } if (displaybuttons.indexOf("Share") != -1) { $("#tdShare").css("display", "none"); } else { $("#tdShare").css("display", ""); } if (displaybuttons.indexOf("Cat") != -1 && document.getElementById("lblCatering").innerHTML != "True") $("#orderCatering").css("display", "none"); else $("#orderCatering").css("display", ""); if (displaybuttons.indexOf("Gorder") != -1) { $("#tdGroupOrder").css("display", "none"); } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { $("#tdGroupOrder").css("display", "none"); } else { $("#tdGroupOrder").css("display", ""); } } } else { if (displaybuttons == "Cpn") { $("#lblcoupons").css("display", "none"); } else { if (Urltype != "DineIn") { $("#lblcoupons").css("display", ""); } } if (displaybuttons == "Fav") { $("#tdFavoriteUs").css("display", "none"); $(".backrestlistP3").css("display", "none"); K++; } else { $("#tdFavoriteUs").css("display", ""); $(".backrestlistP3").css("display", ""); } if (displaybuttons == "Rev") { $("#tdReview").css("display", "none"); $(".backrestlistP4").css("display", "none"); K++; } else { $("#tdReview").css("display", ""); $(".backrestlistP4").css("display", ""); } if (displaybuttons == "Share") $("#tdShare").css("display", "none"); else $("#tdShare").css("display", ""); if (displaybuttons == "Gorder") $("#tdGroupOrder").css("display", "none"); else { if (GroupId != null && GroupId != "" && GroupId != undefined) { $("#tdGroupOrder").css("display", "none"); } else { $("#tdGroupOrder").css("display", ""); } } } } else { $(".backrestlistP3").css("display", ""); $(".backrestlistP4").css("display", ""); $("#tdFavoriteUs").css("display", ""); $("#tdReview").css("display", ""); $("#tdShare").css("display", ""); if (GroupId != null && GroupId != "" && GroupId != undefined) { $("#tdGroupOrder").css("display", "none"); } else { $("#tdGroupOrder").css("display", ""); } if (Urltype != "DineIn") { $("#lblcoupons").css("display", ""); } } var MenuOrientation = QueryString["Mortn"]; if (MenuOrientation == "Top") $("#lblImageOrientation").val("Top"); var displaypromocode = QueryString["Dpc"]; if (displaypromocode != null) { if (displaypromocode == "Y") $("#trPromo").css("display", "block"); else $("#trPromo").css("display", "none"); } var MenuTheme = QueryString["Cmd"]; MenuTheme1 = QueryString["Cmd"]; if (MenuTheme != "Top" != null && MenuTheme != "" && MenuTheme != "undefined") $("#lblMenuTheme").val(MenuTheme); var MenuCollapsed = QueryString["Mcollaps"]; if (MenuCollapsed == "No") $("#lblMenuType").val("Expand"); var Header = QueryString["Header"]; if (Header == "true") { $(".hmheader").css("visibility", "hidden"); } else $(".hmheader").css("visibility", ""); if (QueryString["BGColor"] != undefined) { $(".CustomBG").css("background-color", "#" + QueryString["BGColor"]); $("body").css("background-color", "#" + QueryString["BGColor"]); } var AppId1 = document.getElementById('lblAppId1').value; if(AppId1== "5fdef4ff-59b6-4470-a535-16ecffc4880b") { if (QueryString["ImageDisplay"] != undefined) { if (QueryString["ImageDisplay"] == "Tiled") $(".orderswidth").css("background-repeat", "repeat").css("background-position", "center").css("background-size", "contain"); else if (QueryString["ImageDisplay"] == "Fixed") $(".orderswidth").css("background-attachment", "fixed"); else{ $(".orderswidth").css("background-repeat", "repeat").css("background-position", "center").css("background-size", "contain"); } if (window.innerWidth < 767){ $(".orderswidth").css("width", "100%").css("margin", "0 auto").css("background-color", "white"); } else{ $(".oderwidth").css("width", "1125px").css("margin", "0 auto").css("background-color", "white");} $(".scrollcart").css("margin-left", "-80px"); } } else{ if (QueryString["ImageDisplay"] != undefined) { if (QueryString["ImageDisplay"] == "Tiled") $(".CustomBG").css("background-repeat", "repeat"); else if (QueryString["ImageDisplay"] == "Fixed") $(".CustomBG").css("background-attachment", "fixed"); else $(".CustomBG").css("background-repeat", "no-repeat").css("background-position", "center"); } } var Rating = QueryString["Rtngs"]; if (Rating == "No") $("#Rating").css("display", "none"); else $("#Rating").css("display", ""); var Additionalfilters = QueryString["Saf"]; var K = 0; if (Additionalfilters != "" && Additionalfilters != null && Additionalfilters != "undefined") { if (~Additionalfilters.indexOf(',')) { if (Additionalfilters.indexOf("Popular") != -1) $("#tdPopular").css("display", "none"); if (Additionalfilters.indexOf("Raw") != -1) $("#tdRaw").css("display", "none"); if (Additionalfilters.indexOf("Spicy") != -1) $("#tdSpicy").css("display", "none"); if (Additionalfilters.indexOf("Gluten") != -1) $("#tdGlutenFree").css("display", "none"); if (Additionalfilters.indexOf("Veg") != -1) $("#tdVegetarian").css("display", "none"); } else { if (Additionalfilters == "Popular") $("#tdPopular").css("display", "none"); else if (Additionalfilters == "Raw") $("#tdRaw").css("display", "none"); else if (Additionalfilters == "Spicy") $("#tdSpicy").css("display", "none"); else if (Additionalfilters == "Gluten") $("#tdGlutenFree").css("display", "none"); else if (Additionalfilters == "Veg") $("#tdVegetarian").css("display", "none"); } } $(".editbusiness").fadeOut("slow"); $("#editbusine").fadeOut("slow"); $(".ordqnty").attr("style", ButtonColor); $("#itemflowqty").attr("style", ButtonColor); $(".btnaddreview").attr("style", ButtonColor); $("#ReserveTablebtn").attr("style", ButtonColor); $("#Reservebtn").attr("style", ButtonColor); $(".btnshare").attr("style", ButtonColor); $(".hidcart").attr("style", ButtonColor); $(".btnfavorite").attr("style", ButtonColor); $("#btnBusiness").attr("style", ButtonColor); $(".grouporderbtn").attr("style", ButtonColor); $(".orderCatering").attr("style", ButtonColor); $(".finishorder").attr("style", ButtonColor); $(".mncatcncl").attr("style", ButtonColor); $(".getdealbtn").attr("style", ButtonColor); $(".recsrchbtn").attr("style", ButtonColor); $(".placeorder").attr("style", ButtonColor); $(".bnttip").attr("style", ButtonColor); $(".additem").attr("style", ButtonColor); $(".ordadditem").attr("style", ButtonColor); $(".btnVideoURL").attr("style", ButtonColor); $(".btnRecipe").attr("style", ButtonColor); $("#AddVehicleDetails").attr("style", ButtonColor); var Fbcolor = QueryString["Fbc"]; var Ftcolor = QueryString["Ftc"]; if (Type != null) { if (Type == "mobilepreview") { $(".fcontainer").css("color", "transparent"); $(".fcontainer").css("background-color", "transparent"); } else { $(".fcontainer").css("color", "#" + Ftcolor); $(".fcontainer").css("background-color", "#" + Fbcolor); } } else { $(".fcontainer").css("color", "#" + Ftcolor); $(".fcontainer").css("background-color", "#" + Fbcolor); } $(".cssterms").css("color", "#" + Ftcolor); if(msg.d[0].PromoImageActive==true) { document.getElementById("promoimageexist").innerHTML="true"; $(".pnlpromoimg").css("display", "block"); if(msg.d[0].PromoImageURL !=null && msg.d[0].PromoImageURL !="") { $("#lblpromoimage").attr("src", msg.d[0].PromoImageURL); } else { $(".pnlpromoimg").css("display", "none"); } } else { $(".pnlpromoimg").css("display", "none"); } } else { $("#reservetablebutton").css("display", ""); if (msg.d.length > 0) { if (msg.d[0].Showsiginbutton == false) { $(".hmlgin").attr("style", "display:none"); } else if (msg.d[0].Showsiginbutton == null) { $(".hmlgin").attr("style", "display:flex"); } else { $(".hmlgin").attr("style", "display:flex"); } //if (msg.d[0].ShowBgImage == true) { // $("#imglogo").css("display", "block"); // document.body.style.background = ""; //} //else { // $("#imglogo").css("display", "none"); //} document.getElementById('lblMenuoptions').value = msg.d[0].OptionsMenu; $("#form1").css("font-family", msg.d[0].Font); if(msg.d[0].HeaderTextFont != null && msg.d[0].HeaderTextFont != "") $(".cartrst").css("font-family", msg.d[0].HeaderTextFont); else $(".cartrst").css("font-family", "Quicksand"); if (msg.d[0].HeaderType == "Text") { if (msg.d[0].HeaderText != null && msg.d[0].HeaderText != "") $("#lbllogotext").text(msg.d[0].HeaderText); else $("#lbllogotext").text($("#lblAppName").text()); $("#imglogo").css("display", "none"); $("#lbllogotext").css("display", "block"); var HeaderFontWeight = "font-weight:initial"; if (msg.d[0].HeaderFontWeight == true) { HeaderFontWeight = "font-weight:bold"; } $("#lbllogotext").attr("style", "display:inline-block; font-size:" + msg.d[0].FontSize + "px;color:" + msg.d[0].HeaderTextColor + ";font-family:" + msg.d[0].HeaderTextFont + ";" + HeaderFontWeight); } else { $("#lbllogotext").css("display", "none"); if (msg.d[0].HeaderLogoURL != null) { if (msg.d[0].HeaderLogoURL.trim() != null && msg.d[0].HeaderLogoURL.trim() != "" && msg.d[0].HeaderLogoURL.trim() != "undefined") { $("#imglogo").attr("src", msg.d[0].HeaderLogoURL); $("#imglogo").css("display", "inline-block"); } else { //$("#imglogo").attr("src", "https://www.munchem.com/images/MunchemNewLogoWhite.png"); //$("#imglogo").attr("alt", "Munchem Logo") //$("#imglogo").css("display", "inline-block"); //$("#hmheader").css("background-color", "#d80000"); $("#lbllogotext").text($("#lblAppName").text()); $("#imglogo").css("display", "none"); $("#lbllogotext").css("display", "block"); } } else { //$("#imglogo").attr("src", "https://www.munchem.com/images/MunchemNewLogoWhite.png"); //$("#imglogo").attr("alt", "Munchem Logo") //$("#imglogo").css("display", "inline-block"); //$("#hmheader").css("background-color", "#d80000"); $("#lbllogotext").text($("#lblAppName").text()); $("#imglogo").css("display", "none"); $("#lbllogotext").css("display", "block"); } } $(".hmheader").css("background-color", msg.d[0].HeaderBackground); colortype = lightOrDark(msg.d[0].HeaderBackground); //if (msg.d[0].HeaderLogoURL != null && msg.d[0].HeaderLogoURL != " " && msg.d[0].HeaderLogoURL != "undefined") { // $("#imglogo").attr("src", msg.d[0].HeaderLogoURL); // $("#lbllogotext").css("display", "none"); // $("#imglogo").css("display", "inline-block"); //} //else { // if (colortype == "dark") { // $("#imglogo").attr("src", "https://www.munchem.com/images/MunchemLogo.png"); // $("#imglogo").attr("alt", "Munchem Logo"); // } //} if (msg.d[0].RestaurantHeaderBGColor != null && msg.d[0].RestaurantHeaderBGColor != "") { $(".hmheader").css("background-color", msg.d[0].RestaurantHeaderBGColor); } else $(".RestaurantHGB").css("background-color", "#f2f2f2"); if (msg.d[0].PageBGColor != null && msg.d[0].PageBGColor != ""){ document.body.style.background = msg.d[0].PageBGColor; PageBackgroundColor = "background:"+msg.d[0].PageBGColor; } else{ document.body.style.background = "#E0E0E0"; PageBackgroundColor = "background:#E0E0E0"; } SpecialsDisplay(); if (msg.d[0].ShowNavigationBar == true) { document.getElementById("lblNavigationBar").innerHTML = "true"; $(".backrestlist").css("display", ""); Checkdeliveryzoneslink(); } else $(".backrestlist").css("display", "none"); $(".backrestlist").css("background-color", msg.d[0].NavigationBackground); $(".hoursdivstyles").css("background-color", msg.d[0].NavigationBackground); $(".urordertext").css("background-color", msg.d[0].NavigationBackground); $(".couponsdivstyles").css("background-color", msg.d[0].NavigationBackground); $(".gpickuporderstyles").css("background-color", msg.d[0].NavigationBackground); menucolortype = lightOrDark(msg.d[0].NavigationBackground); if (menucolortype == "dark") $(".contmenubar").css("background-color", "#000000"); else $(".contmenubar").css("background-color", "#ffffff"); if (msg.d[0].NavigationForeColor != null && msg.d[0].NavigationForeColor != "") { $(".backrestlist").css("color", msg.d[0].NavigationForeColor); $(".hoursdivstyles").css("color", msg.d[0].NavigationForeColor); $(".couponsdivstyles").css("color", msg.d[0].NavigationForeColor); $(".gpickuporderstyles").css("color", msg.d[0].NavigationForeColor); $(".urordertext").css("color", msg.d[0].NavigationForeColor); } if (msg.d[0].NavigationFontWeight == true) { $(".backrestlist").css("font-weight", "bold"); $(".hoursdivstyles").css("font-weight", "bold"); $(".couponsdivstyles").css("font-weight", "bold"); $(".gpickuporderstyles").css("font-weight", "bold"); $(".urordertext").css("font-weight", "bold"); } else { $(".backrestlist").css("font-weight", "initial"); $(".hoursdivstyles").css("font-weight", "initial"); $(".couponsdivstyles").css("font-weight", "initial"); $(".gpickuporderstyles").css("font-weight", "initial"); $(".urordertext").css("font-weight", "initial"); } if (msg.d[0].NavigationFontSize != null && msg.d[0].NavigationFontSize != "") { var NavigationFontSize = msg.d[0].NavigationFontSize +"px"; $(".backrestlist").css("font-size", NavigationFontSize); $(".hoursdivstyles").css("font-size", NavigationFontSize); $(".couponsdivstyles").css("font-size", NavigationFontSize); $(".gpickuporderstyles").css("font-size", NavigationFontSize); $(".urordertext").css("font-size", NavigationFontSize); } if (msg.d[0].NavigationFontFamily != null && msg.d[0].NavigationFontFamily != "") { $(".backrestlist").css("font-family", msg.d[0].NavigationFontFamily); $(".hoursdivstyles").css("font-family", msg.d[0].NavigationFontFamily); $(".couponsdivstyles").css("font-family", msg.d[0].NavigationFontFamily); $(".gpickuporderstyles").css("font-family", msg.d[0].NavigationFontFamily); $(".urordertext").css("font-family", msg.d[0].NavigationFontFamily); } var ButtonFontWeight = "font-weight:initial"; $(".bntSignin").css("font-weight","initial"); if (msg.d[0].ButtonFontWeight == true) { ButtonFontWeight = "font-weight:bold"; $(".bntSignin").css("font-weight","bold"); } var ButtonFontSize = "font-size:14px"; $(".bntSignin").css("font-size","14px"); if (msg.d[0].ButtonFontSize != null && msg.d[0].ButtonFontSize != "") { ButtonFontSize = "font-size:"+msg.d[0].ButtonFontSize+"px"; ButtonFontSize1 = msg.d[0].ButtonFontSize+"px"; $(".bntSignin").css("font-size",ButtonFontSize1); } var ButtonFontFamily = "font-family:Quicksand !important"; $(".bntSignin").css("font-family","Quicksand !important"); if (msg.d[0].ButtonFontFamily != null && msg.d[0].ButtonFontFamily != "") { ButtonFontFamily = "font-family:"+msg.d[0].ButtonFontFamily+" !important"; $(".bntSignin").css("font-family",msg.d[0].ButtonFontFamily+" !important"); } MenuButtonColor = "-moz-box-shadow:0 0 2px 0 " + msg.d[0].MenuButtonBgColor + ";-webkit-box-shadow:0 0 2px 0 " + msg.d[0].MenuButtonBgColor + ";background:-webkit-gradient(linear,left top,left bottom,color-stop(0.05," + msg.d[0].MenuButtonBgColor + "),color-stop(1," + msg.d[0].MenuButtonBgColor + "));background:-moz-linear-gradient(center top," + msg.d[0].MenuButtonBgColor + " 5%," + msg.d[0].MenuButtonBgColor + " 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=" + msg.d[0].MenuButtonBgColor + ",endColorstr=" + msg.d[0].MenuButtonBgColor + ");background-color:" + msg.d[0].MenuButtonBgColor + ";border:1px solid " + msg.d[0].MenuButtonBgColor + ";color:" + msg.d[0].MenuButtonTextColor + ";border-radius: 7px"; optionColor = "-moz-box-shadow:0 0 2px 0 " + msg.d[0].OptionBgColor + ";-webkit-box-shadow:0 0 2px 0 " + msg.d[0].OptionBgColor + ";background:-webkit-gradient(linear,left top,left bottom,color-stop(0.05," + msg.d[0].OptionBgColor + "),color-stop(1," + msg.d[0].OptionBgColor + "));background:-moz-linear-gradient(center top," + msg.d[0].OptionBgColor + " 5%," + msg.d[0].OptionBgColor + " 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=" + msg.d[0].OptionBgColor + ",endColorstr=" + msg.d[0].OptionBgColor + ");background-color:" + msg.d[0].OptionBgColor + ";border:1px solid " + msg.d[0].OptionBgColor + ";color:" + msg.d[0].OptionTextColor + ";"; OptionTextColor = msg.d[0].OptionTextColor; ButtonColor = "-moz-box-shadow:0 0 2px 0 " + msg.d[0].ButtonBackground + ";-webkit-box-shadow:0 0 2px 0 " + msg.d[0].ButtonBackground + ";background:-webkit-gradient(linear,left top,left bottom,color-stop(0.05," + msg.d[0].ButtonBackground + "),color-stop(1," + msg.d[0].ButtonBackground + "));background:-moz-linear-gradient(center top," + msg.d[0].ButtonBackground + " 5%," + msg.d[0].ButtonBackground + " 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=" + msg.d[0].ButtonBackground + ",endColorstr=" + msg.d[0].ButtonBackground + ");background-color:" + msg.d[0].ButtonBackground + ";border:1px solid " + msg.d[0].ButtonBackground + ";color:" + msg.d[0].ButtonTextColor + ";border-radius: 7px;"+ButtonFontWeight+";"+ButtonFontSize+";"+ButtonFontFamily; $(".bntSignin").css("background-color", msg.d[0].ButtonBackground); $(".hmcrt1").css("border-color", msg.d[0].ButtonBackground); if (colortype == "dark") { CartImageColor("#ffffff"); $(".hmcrt1 span").css("color", "#ffffff"); } else { CartImageColor(msg.d[0].ButtonBackground); } $(".bntSignin").css("color", msg.d[0].ButtonTextColor); if (msg.d[0].CategoryBold == true) { CategoryBold = "font-weight:bold"; } if (msg.d[0].ItemPriceFontWeight == true) { ItemPriceFontWeight = "font-weight:bold"; } if (msg.d[0].ItemPriceFontSize != null && msg.d[0].ItemPriceFontSize != "") { ItemPriceFontSize = "font-size:"+msg.d[0].ItemPriceFontSize+"px"; } if (msg.d[0].ItemNameFontWeight == true) { ItemNameFontWeight = "font-weight:bold"; } if (msg.d[0].ItemNameFontSize != null && msg.d[0].ItemNameFontSize != "") { ItemNameFontSize = "font-size:"+msg.d[0].ItemNameFontSize+"px"; } if (msg.d[0].ItemNameFontFamily != null && msg.d[0].ItemNameFontFamily != "") { ItemNameFontFamily = "font-family:"+msg.d[0].ItemNameFontFamily; } if (msg.d[0].ItemNameColor != null && msg.d[0].ItemNameColor != "") { ItemNameColor = "color:"+msg.d[0].ItemNameColor; } ItemNamestyles = ItemNameFontSize+";"+ItemNameFontFamily+";"+ItemNameColor+";"+ItemNameFontWeight; if (msg.d[0].CategoryFontFamily != null && msg.d[0].CategoryFontFamily != "") { CategoryFontFamily = "font-family:"+msg.d[0].CategoryFontFamily; } if (msg.d[0].CategoryFontSize != null && msg.d[0].CategoryFontSize != "") { CategoryFontSize = "font-size:"+msg.d[0].CategoryFontSize+"px"; } if (msg.d[0].CategoryBgColor != null && msg.d[0].CategoryBgColor != "") { CategoryBgColor = "background-color:"+msg.d[0].CategoryBgColor; } if (msg.d[0].CategoryTextColor != null && msg.d[0].CategoryTextColor != "") { CategoryTextColor = "color:"+msg.d[0].CategoryTextColor; MenuForeColors = "border-color: " + msg.d[0].CategoryTextColor; } MenuColors = CategoryBgColor + "; font-family:" + msg.d[0].ItemPriceFont + ";"+ ItemPriceFontSize +";"+ItemPriceFontWeight; SubMenuColors = CategoryTextColor + ";"+CategoryBold+";"+CategoryFontSize+";"+CategoryFontFamily+";"+CategoryBgColor; CategoryTextColor = CategoryTextColor; if (msg.d[0].EnablePriceDisplay == true) { PriceColor = "color:" + msg.d[0].MenuPriceColor + "; font-family:" + msg.d[0].ItemPriceFont + "; display:inline-block; "+ ItemPriceFontSize +";"+ItemPriceFontWeight; } else { PriceColor = "color:" + msg.d[0].MenuPriceColor + "; font-family:" + msg.d[0].ItemPriceFont + "; display:none; "+ ItemPriceFontSize +";"+ItemPriceFontWeight; } MenuFont = "font-family:" + msg.d[0].ItemPriceFont +";"+ ItemPriceFontSize +";"+ItemPriceFontWeight; DividerColor = msg.d[0].MenuItemDividerColor; $("#Itemstable").css("font-family", msg.d[0].Font); $("#lblitemmesg").css("font-family", msg.d[0].ItemNameFontFamily); $(".OptionTable").css("font-family", msg.d[0].ItemNameFontFamily); $(".nutritiontable").css("font-family", msg.d[0].ItemNameFontFamily); $(".spnsvgicon").css("font-family", msg.d[0].ItemNameFontFamily); var K = 0; if (msg.d[0].Review == true) { $("#tdReview").css("display", ""); $(".backrestlistP4").css("display", ""); K++; } else { $("#tdReview").css("display", "none"); $(".backrestlistP4").css("display", "none"); } if (msg.d[0].FavoriteUs == true) { $("#tdFavoriteUs").css("display", ""); $(".backrestlistP3").css("display", ""); K++; } else { $("#tdFavoriteUs").css("display", "none"); $(".backrestlistP3").css("display", "none"); $("#tdShare").css("text-align", "center"); } if (msg.d[0].Share == true) { $("#tdShare").css("display", ""); K++; } else $("#tdShare").css("display", "none"); if (Urltype != "DineIn") { if (msg.d[0].GroupOrder == true) { if (GroupId != null && GroupId != "" && GroupId != undefined) { $("#tdGroupOrder").css("display", "none"); } else { $("#tdGroupOrder").css("display", ""); } K++; } else $("#tdGroupOrder").css("display", "none"); if (msg.d[0].Catering == true && document.getElementById("lblCatering").innerHTML == "True") { $("#orderCatering").css("display", ""); } else $("#orderCatering").css("display", "none"); } if (msg.d[0].Coupon == true) $("#lblcoupons").css("display", "block") else { $("#lblcoupons").css("display", "none"); } document.getElementById("lblImageOrientation").value=msg.d[0].MenuImageOrientation; if (msg.d[0].MenuImageOrientation == "Top") $("#lblImageOrientation").val("Top"); if (msg.d[0].DisplayPromocode == true) { if ($("#lbloffers").text() == "Coupons" || $("#lbloffers").text() == "Both") $("#trPromo").css("display", "block"); else $("#trPromo").css("display", "none"); } else $("#trPromo").css("display", "none"); MenuTheme1=msg.d[0].MenuTheme; if (msg.d[0].MenuTheme != "") $("#lblMenuTheme").val(msg.d[0].MenuTheme); if (msg.d[0].MenuCollapsed == false) $("#lblMenuType").val("Expand"); if (msg.d[0].MainHeader == true) { $(".hmheader").css("visibility", "hidden"); if (window.innerWidth < 767){ $(".hmcrt").css("margin-left", -"12px").css("margin-top", " -5px"); } else { $(".hmcrt").css("margin-left", -"12px").css("margin-top", "12px"); } $(".hmshell").css("min-height", "auto"); $(".hmheader .hmheadersub").css("width", "100%"); if (window.innerWidth < 767) { $(".hmheaderleft").css("max-height", "10px").css("height", "10px").css("min-height", "10px"); $(".hmhdrt1").css("padding-top", "0"); $(".oderwidth").css("padding-top", "0"); } } else $(".hmheader").css("visibility", ""); var AppId1 = document.getElementById('lblAppId1').value; if(AppId1=="5fdef4ff-59b6-4470-a535-16ecffc4880b") { if (msg.d[0].ShowBgImage == true) { if (msg.d[0].BackgroundImageURL != null && msg.d[0].BackgroundImageURL != "" && msg.d[0].BackgroundImageURL != "undefined") $(".orderswidth").css("background-image", "url(" + msg.d[0].BackgroundImageURL + ")"); else $("#Itemstable").css("background-color", msg.d[0].MenuBackgroundColor); $(".orderswidth").css("background-color", msg.d[0].BackgroundColor); $("body").css("background-color", msg.d[0].BackgroundColor); if (msg.d[0].BGImageDisplay == "Tiled") $(".orderswidth").css("background-repeat", "repeat").css("background-position", "center").css("background-size", "contain"); else if (msg.d[0].BGImageDisplay == "Fixed") $(".orderswidth").css("background-attachment", "fixed"); else{ $(".orderswidth").css("background-repeat", "repeat").css("background-position", "center").css("background-size", "contain"); } if (window.innerWidth < 767){ $(".orderswidth").css("width", "100%").css("margin", "0 auto").css("background-color", "white"); } else { $(".oderwidth").css("width", "1125px").css("margin", "0 auto").css("background-color", "white"); } $(".orderswidth").css("width", "100%"); $(".scrollcart").css("margin-left", "-80px"); document.body.style.background = "#E0E0E0"; } else { if (msg.d[0].PageBGColor != null && msg.d[0].PageBGColor != ""){ document.body.style.background = msg.d[0].PageBGColor; PageBackgroundColor = "background:"+msg.d[0].PageBGColor; }else{ document.body.style.background = "#E0E0E0"; PageBackgroundColor = "background:#E0E0E0"; } if (msg.d[0].MenuBackgroundColor != null && msg.d[0].MenuBackgroundColor != "") { $("#Itemstable").css("background-color", msg.d[0].MenuBackgroundColor); } } } else{ if (msg.d[0].ShowBgImage == true) { if (msg.d[0].BackgroundImageURL != null && msg.d[0].BackgroundImageURL != "" && msg.d[0].BackgroundImageURL != "undefined") $(".CustomBG").css("background-image", "url(" + msg.d[0].BackgroundImageURL + ")"); else $("#Itemstable").css("background-color", msg.d[0].MenuBackgroundColor); $(".CustomBG").css("background-color", msg.d[0].BackgroundColor); $("body").css("background-color", msg.d[0].BackgroundColor); if (msg.d[0].BGImageDisplay == "Tiled") $(".CustomBG").css("background-repeat", "repeat"); else if (msg.d[0].BGImageDisplay == "Fixed") $(".CustomBG").css("background-attachment", "fixed"); else $(".CustomBG").css("background-repeat", "no-repeat").css("background-position", "center"); document.body.style.background = "#E0E0E0"; } else { if (msg.d[0].PageBGColor != null && msg.d[0].PageBGColor != ""){ document.body.style.background = msg.d[0].PageBGColor; PageBackgroundColor = "background:"+msg.d[0].PageBGColor; }else{ document.body.style.background = "#E0E0E0"; PageBackgroundColor = "background:#E0E0E0"; } if (msg.d[0].MenuBackgroundColor != null && msg.d[0].MenuBackgroundColor != "") { $("#Itemstable").css("background-color", msg.d[0].MenuBackgroundColor); } } } if (msg.d[0].Rating == true) $("#Rating").css("display", ""); else $("#Rating").css("display", "none"); if (msg.d[0].AdditionalFilters == false) $("#trAdditionalFilters").css("display", "none"); else { if (msg.d[0].Popular == false) $("#tdPopular").css("display", "none"); if (msg.d[0].Spicy == false) $("#tdSpicy").css("display", "none"); if (msg.d[0].Raw == false) $("#tdRaw").css("display", "none"); if (msg.d[0].GlutenFree == false) $("#tdGlutenFree").css("display", "none"); if (msg.d[0].Vegetarian == false) $("#tdVegetarian").css("display", "none"); } $(".editbusiness").fadeOut("slow"); $("#editbusine").fadeOut("slow"); $(".ordqnty").attr("style", MenuButtonColor); $(".itemflowqty").attr("style", MenuButtonColor); $(".ordadditem").attr("style", MenuButtonColor); $(".btnaddreview").attr("style", ButtonColor); $("#ReserveTablebtn").attr("style", ButtonColor); $("#Reservebtn").attr("style", ButtonColor); $(".btnshare").attr("style", ButtonColor); $(".hidcart").attr("style", ButtonColor); $(".btnfavorite").attr("style", ButtonColor); $("#btnBusiness").attr("style", ButtonColor); $(".grouporderbtn").attr("style", ButtonColor); $(".orderCatering").attr("style", ButtonColor); $(".finishorder").attr("style", ButtonColor); $(".mncatcncl").attr("style", ButtonColor); $(".getdealbtn").attr("style", ButtonColor); $(".recsrchbtn").attr("style", ButtonColor); $(".placeorder").attr("style", ButtonColor); $(".bnttip").attr("style", ButtonColor); $(".additem").attr("style", ButtonColor); $(".btnVideoURL").attr("style", ButtonColor); $(".btnRecipe").attr("style", ButtonColor); $(".btnRecipe").attr("style", ButtonColor); $("#AddVehicleDetails").attr("style", ButtonColor); $(".cssterms").css("color", "" + msg.d[0].FooterTextColor + ""); if (Type != null) { if (Type == "mobilepreview") { $(".fcontainer").css("color", "transparent"); $(".fcontainer").css("background-color", "transparent"); } else { $(".fcontainer").css("background-color", "" + msg.d[0].FooterBackgroundcolor + ""); $(".fcontainer").css("color", "" + msg.d[0].FooterTextColor + ""); } } else { $(".fcontainer").css("background-color", "" + msg.d[0].FooterBackgroundcolor + ""); $(".fcontainer").css("color", "" + msg.d[0].FooterTextColor + ""); } if(msg.d[0].PromoImageActive==true) { document.getElementById("promoimageexist").innerHTML="true"; $(".pnlpromoimg").css("display", "block"); if(msg.d[0].PromoImageURL !=null && msg.d[0].PromoImageURL !="") { $("#lblpromoimage").attr("src", msg.d[0].PromoImageURL); } else { $(".pnlpromoimg").css("display", "none"); } } else { $(".pnlpromoimg").css("display", "none"); } } else SetDefaultColors(); } if ($("#lblMenuTheme").val() == "Grid" || $("#lblMenuTheme").val() == "Grid-no-images" || $("#lblMenuTheme").val() == "New-Grid" || $("#lblMenuTheme").val() == "New-Grid-no-images") { if($("#lblMenuTheme").val() == "New-Grid" || $("#lblMenuTheme").val() == "New-Grid-no-images"){ //if (document.getElementById('lblAppId1').value == "5b64040f-4585-467d-b37c-4a4ad30304c6") { $(".TabbedPanelsfororder").css("width", "100%"); $(".scrollcart").css("display", "none"); $(".couponrt").css("display", "none"); $(".orderswidth").css("width", "100%"); $("#tblbuttons").css("margin", "0").css("width","96%"); $(".addcategoryloadingimage").css("width","100%"); $(".addcategoryloadingimage1").css("width","100%"); $(".addcategoryloadingimage1").css("margin","0 auto"); if (window.innerWidth < 767) { $(".userregistrer_formtext1").css("width", "92%"); $(".userregistrer_formtext1Error").css("width", "92%"); $(".createrightdiv #ddlusercountry").css("width", "100%"); $(".createrightdiv #ddlhearabout").css("width", "100%"); $("#txtEId").css("width", "85% ! important"); //$(".oderwidth").css("padding", "0"); $(".orderswidth").removeAttr("style"); $("#tblbuttons").css("margin-top", "30px") } if (window.innerWidth > 767) { $("#trSearch").css("margin","0 auto"); $("#trSearch").css("width","90%"); $("#txtItemSearch").css("width","97%"); } $(".menusrtb").css("display", "block"); } else{ $(".TabbedPanelsfororder").css("width", "100%"); $(".scrollcart").css("display", "none"); $(".couponrt").css("display", "none"); $(".menusrtb").css("display", "none"); $(".orderswidth").css("width", "100%"); $("#tblbuttons").css("margin", "0").css("width","96%"); if (window.innerWidth < 767) { $(".userregistrer_formtext1").css("width", "92%"); $(".userregistrer_formtext1Error").css("width", "92%"); $(".createrightdiv #ddlusercountry").css("width", "100%"); $(".createrightdiv #ddlhearabout").css("width", "100%"); $("#txtEId").css("width", "85% ! important"); //$(".oderwidth").css("padding", "0"); $(".orderswidth").removeAttr("style"); $("#tblbuttons").css("margin-top", "30px") } } } else { $(".scrollcart").css("display", "block"); $(".menusrtb").css("display", "block"); } //Disable footer for iframe menu //if ($('#wrapper').css('display') == 'none') // $(".fcontainer").css("display", "none"); //else // $(".fcontainer").css("display", "block"); if (window.width < 767) { $(".fcontainer").css("display", "none"); } var h = 0; var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; var UserOrderType = ''; if (UserOrderType == "PickUp") { document.getElementById('checkdelivery').innerHTML = "Sucess"; document.getElementById('deliveryavailabul').innerHTML = ""; } $.ajax({ type: "POST", url: "Orders.aspx/GetTaxes", data: "{'LId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (document.getElementById("lblCurrency").innerHTML == "₹") { $(".clsdoorno").fadeIn("slow"); document.getElementById("txtaddress").placeholder = "Area Name"; } var PickUp = ""; var Shipping = ""; var Delivery = ""; var CustomTypeOrders = ""; var UrlType = document.getElementById('lblurlnametype').innerHTML; var EntityDetails = new Object; if (msg.d.length > 0) { EntityDetails.Allow = 1; EntityDetails.PickUp = msg.d[0].AcceptPickupFoodOrders; EntityDetails.Delivery = msg.d[0].AcceptDelivery; EntityDetails.Shipping = msg.d[0].ShippingOrders; Shipping = msg.d[0].ShippingOrders; CustomTypeOrders = msg.d[0].OtherDeliveryService; EntityDetails.AppName = msg.d[0].AppName; EntityDetails.LocationName = msg.d[0].Name; var PickUp = msg.d[0].AcceptPickupFoodOrders; document.getElementById("lblMyDrivers").innerHTML = msg.d[0].MyDrivers; var Delivery = msg.d[0].AcceptDelivery; if (UserOrderType == "Delivery" && Delivery == true) { document.getElementById('deliveryavailabul').innerHTML = "Yes"; GetSavedAddress(); } else if (UserOrderType == "") { if (Delivery == true) { document.getElementById('deliveryavailabul').innerHTML = "Yes"; } } var CateringOrders = msg.d[0].CateringOrders; var t = msg.d[0].TaxesByState; var DeliveryMinimum = msg.d[0].DeliveryMinimum; var DeliveryTime = msg.d[0].DeliveryTime; var FoodPreparationTime = msg.d[0].FoodPreparationTime; var momentOfTime = new Date(); // just for example, can be any other time var myTimeSpan = 100 * 60 * 1000; // 5 minutes in milliseconds momentOfTime.setTime(momentOfTime.getTime() + myTimeSpan); document.getElementById("Taxes").innerHTML = document.getElementById("lblCurrency").innerHTML + t; document.getElementById("Taxeslabel").innerHTML = msg.d[0].TaxLabel; if(UrlType != "DineIn"){ if (PickUp == false && Delivery == false && Shipping == false && CustomTypeOrders == false && CateringOrders == false) { EntityDetails.Allow = 0; localStorage.removeItem("TotalItems"); localStorage.removeItem("EntityDisabled"); localStorage.removeItem("EntityDetails"); localStorage.removeItem("OrderType"); localStorage.removeItem("DeliveryDetails"); localStorage.removeItem("DeliveryType"); $("#nosettingslbl").addClass("ordererrormsg"); $("#nosettingslbl").css("display", "block"); if (document.getElementById("nosettingslbl").innerHTML != "Restaurant Menu not available for ordering at this time") document.getElementById("nosettingslbl").innerHTML = "Online ordering is currently not available but feel free to browse our menu."; if ((msg.d[0].PickupClosedMessage != "" && msg.d[0].PickupClosedMessage != null) && PickUp == false) { document.getElementById("Reasontoclose").innerHTML = msg.d[0].PickupClosedMessage; } if ((msg.d[0].DeliveryClosedMessage != "" && msg.d[0].DeliveryClosedMessage != null) && Delivery == false) { if (msg.d[0].DeliveryClosedMessage != msg.d[0].PickupClosedMessage) { if (document.getElementById("Reasontoclose").innerHTML == "") document.getElementById("Reasontoclose").innerHTML = msg.d[0].DeliveryClosedMessage; else document.getElementById("Reasontoclose").innerHTML = document.getElementById("Reasontoclose").innerHTML + " " + msg.d[0].DeliveryClosedMessage; } } } } if (Delivery == true) { if (document.getElementById("Commissionlbl").innerHTML > 0) { DeliveryService = "Show"; } document.getElementById('deliveryavailabul').innerHTML = "Yes"; $(".orderdeliveryimgred1").css("display", "block"); $("#ToggleDeliveryZones").css("display", "block"); } if (PickUp == true) { $(".orderpickupimgblue1").css("display", "block"); if (msg.d[0].PickupButtonName != null && msg.d[0].PickupButtonName != "") { document.getElementById("lblPickupname").innerHTML = msg.d[0].PickupButtonName; $(".Pickupnone").val(document.getElementById("lblPickupname").innerHTML.replace("&", "&")); } else { document.getElementById("lblPickupname").innerHTML = "PickUp"; $(".Pickupnone").val("PickUp"); } } if (UrlType == "DineIn") { $(".orderpickupimgblue1").css("display", "block"); document.getElementById("lblDineInname").innerHTML = "DineIn"; $(".Pickupnone").val("DineIn"); } if (Delivery == false) { DeliveryService = "Show"; $(".shpdl").css("display", "none") } //if (msg.d[0].PickupAvailableDays != "" && msg.d[0].PickupAvailableDays != null) // $("#pickupdays").text(msg.d[0].PickupAvailableDays); //if (msg.d[0].DeliveryAvailableDays != "" && msg.d[0].DeliveryAvailableDays != null) // $("#deliverydays").text(msg.d[0].DeliveryAvailableDays); //if (msg.d[0].OrdersMadeUpto != "" && msg.d[0].OrdersMadeUpto != null) // $("#ordersupto").text(msg.d[0].OrdersMadeUpto); } else { DeliveryService = "Show"; EntityDetails.Allow = 0; localStorage.removeItem("TotalItems"); localStorage.removeItem("EntityDisabled"); localStorage.removeItem("EntityDetails"); localStorage.removeItem("OrderType"); localStorage.removeItem("DeliveryDetails"); localStorage.removeItem("DeliveryType"); document.getElementById("nosettingslbl").innerHTML = "Online ordering not available now. Please try again after sometime."; $("#nosettingslbl").addClass("ordererrormsg"); $("#nosettingslbl").css("display", "block"); } localStorage.setItem("EntityDetails", JSON.stringify(EntityDetails)); GetMenuCategories(); AutoApplyStorageCouponCode(); checkRestaurantOpenState(); //if (Urltype != "DineIn") { ClearItems(); //} var Orderstring = getQueryStrings(); var OrderId = Orderstring["OrderId"]; if (OrderId != undefined) { ShowCart(); } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else{GetDeal();} } } }); } }); } } function hexToRGB(hex) { var long = parseInt(hex.replace(/^#/, ""), 16); return { R: (long >>> 16) & 0xff, G: (long >>> 8) & 0xff, B: long & 0xff }; } function CartImageColor(Color) { //var mug = document.getElementById("btncrt"); //var img = new Image(); //img.src = mug.src; //var canvas = document.createElement("canvas"); //var ctx = canvas.getContext("2d"); //var originalPixels = null; //var currentPixels = null; //canvas.width = img.width; //canvas.height = img.height; //ctx.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight, 0, 0, img.width, img.height); //originalPixels = ctx.getImageData(0, 0, img.width, img.height); //currentPixels = ctx.getImageData(0, 0, img.width, img.height); //img.onload = null; //if (!originalPixels) return; //var newColor = hexToRGB(Color); //for (var I = 0, L = originalPixels.data.length; I < L; I += 4) { // if (currentPixels.data[I + 3] > 0) // If it's not a transparent pixel // { // currentPixels.data[I] = newColor.R; // currentPixels.data[I + 1] = newColor.G; // currentPixels.data[I + 2] = newColor.B; // } //} //ctx.putImageData(currentPixels, 0, 0); //mug.src = canvas.toDataURL("image/png"); } function lightOrDark(color) { if (color != null) { var r, g, b, hsp; if (color.match(/^rgb/)) { color = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/); r = color[1]; g = color[2]; b = color[3]; } else { color = +("0x" + color.slice(1).replace( color.length < 5 && /./g, '$&$&')); r = color >> 16; g = color >> 8 & 255; b = color & 255; } hsp = Math.sqrt( 0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b) ); if (hsp > 127.5) return 'light'; else return 'dark'; } } function GetSocialMediaDetails(LocationId) { if (LocationId != "") { $.ajax({ type: "POST", url: "Orders.aspx/GetSocialMediaDetails", data: "{'LocationId': '" + LocationId + "','PageName':'Menu'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0].FacebookPageUrl != "" && msg.d[0].FacebookPageUrl != null) { $("#smfacebook1").css("display", "inline-block"); $(".smfacebook").attr("href", msg.d[0].FacebookPageUrl); } if (msg.d[0].TwitterUserName != "" && msg.d[0].TwitterUserName != null) { $("#smtwitter1").css("display", "inline-block"); $(".smtwitter").attr("href", msg.d[0].TwitterUserName); } if (msg.d[0].InstagramUserName != "" && msg.d[0].InstagramUserName != null) { $("#sminstagran1").css("display", "inline-block"); $(".sminstagran").attr("href", msg.d[0].InstagramUserName); } if (msg.d[0].LinkedInUrl != "" && msg.d[0].LinkedInUrl != null) { $("#smlinkedin1").css("display", "inline-block"); $(".smlinkedin").attr("href", msg.d[0].LinkedInUrl); } if (msg.d[0].YoutubeLink != "" && msg.d[0].YoutubeLink != null) { $("#smyoutube1").css("display", "inline-block"); $(".smyoutube").attr("href", msg.d[0].YoutubeLink); } if (msg.d[0].WebsiteUrl != "" && msg.d[0].WebsiteUrl != null) { $("#lblwebsitedisplay").css("display", "inline-block"); $("#websitelink").attr("href", msg.d[0].WebsiteUrl); } } } }); } } $(".hmcrt").click(function () { var Count = $("#lblcartcount").text(); if (Count != 0) { if (window.innerWidth < 767) CartDisplay(); else { if (localStorage.getItem("EntityDisabled") == "Disabled") { alert("Both " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + " and Delivery are disabled, You can't place an order"); } else { if ($("#lblMenuTheme").val() == "Grid" || $("#lblMenuTheme").val() == "Grid-no-images" || $("#lblMenuTheme").val() == "New-Grid" || $("#lblMenuTheme").val() == "New-Grid-no-images") { $(".scrollcart").css("display", "block"); $(".scrollcart").addClass("mncatnewpopup"); $(".carright").addClass("mncatnewpopupsub"); $(".promcartcharity").css("margin-left", "610px"); //$("body").css("overflow", "hidden"); } else { //var scrollposition = $(window).scrollTop(); //var cartheight = $(".carright").css("height"); //var cartheight1 = $(".carright").height(); //var carttop = scrollposition - cartheight1; //if (carttop < 0) // carttop = 0; //else // carttop = carttop + 150; //if (carttop != 0) // $(".carright").css({ "margin-top": (carttop) + "px" }); //$(".carright").css({ "margin-top": ($(window).scrollTop() / 2) + "px" }); } } } } else { $("#lblordalert").text("Your Cart is empty"); $(".orderalert").fadeIn(); } }); function CloseCart() { $(".scrollcart").css("display", "none"); $("body").removeAttr("style"); $("body").attr("style",PageBackgroundColor); } $("#txtFirstName").keypress(function (e) { if (e.keyCode === 46 && this.value.split('.').length === 2) { return false; } }) $("#txtLastName").keypress(function (e) { if (e.keyCode === 46 && this.value.split('.').length === 2) { return false; } }) $("#txtguestdeliveryname").keypress(function (e) { if (e.keyCode === 46 && this.value.split('.').length === 2) { return false; } }) $("#txtDGName").keypress(function (e) { if (e.keyCode === 46 && this.value.split('.').length === 2) { return false; } }) function CloseRegPanel() { $(".UserNameReqpnl").css("display", "none"); SignOut(); } function SignOut() { $.ajax({ type: "POST", url: "../Orders.aspx/SessionLogout", dataType: "json", contentType: "application/json", success: function (msg) { } }) } function AccountSignOut() { $.ajax({ type: "POST", url: "Orders.aspx/SignOut", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById("UserId").innerHTML = ""; } }) } function checkTextAreaMaxLength(textBox, e, length) { var mLen = textBox["MaxLength"]; if (null == mLen) mLen = length; var maxLength = parseInt(mLen); if (!checkSpecialKeys(e)) { if (textBox.value.length > maxLength - 1) { if (window.event)//IE e.returnValue = false; else//Firefox e.preventDefault(); } } } function checkSpecialKeys(e) { if (e.keyCode != 8 && e.keyCode != 46 && e.keyCode != 37 && e.keyCode != 38 && e.keyCode != 39 && e.keyCode != 40) return false; else return true; } function BindShippingStates(SelectedState, Line1, City, ZipCode) { var LocationId = document.getElementById('lblLId').value; var dcountry = document.getElementById("ddlshpcountry"); var Country = dcountry.options[dcountry.selectedIndex].text; if (Country != "Select Country") { $(".shploader").css("display", "block"); $.ajax({ type: "POST", url: "../Orders.aspx/ShippingAddress", data: "{'LocationId':'" + LocationId + "','Action':'GetStates','Country':'" + Country + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var selectList = ""; $("#ddlshpState").empty(); selectList = $("#ddlshpState"); selectList.append('<option>Select State</option>'); if (selectList != "") { for (var i = 0; i < msg.d.length; i++) { selectList.append('<option value="' + msg.d[i].State + '" >' + msg.d[i].State + '</option>'); } if (SelectedState != "") { if ($('#ddlshpState option[value="' + SelectedState + '"]').length > 0) { document.getElementById('ddlshpState').value = SelectedState; if (Line1 != undefined && Line1 != "") document.getElementById('txtshpaddress').value = Line1; if (ZipCode != undefined && ZipCode != "") document.getElementById('txtshpzip').value = ZipCode; if (City != undefined && City != "") document.getElementById('txtshpcity').value = City; } else if (Line1 != undefined && Line1 != "" && ZipCode != undefined && ZipCode != "" && City != undefined && City != "") ShippingNotAvailable(); } $(".shploader").css("display", "none"); } } else { var selectList = ""; $("#ddlshpState").empty(); selectList = $("#ddlshpState"); selectList.append('<option>Select State</option>'); } $(".shploader").css("display", "none"); } }); } else { var selectList = ""; $("#ddlshpState").empty(); selectList = $("#ddlshpState"); selectList.append('<option>Select State</option>'); $(".shploader").css("display", "none"); } } function BindShippingDropdown(Action, SelectedCountry, SelectedState) { $(".shploader").css("display", "block"); var LocationId = document.getElementById('lblLId').value; $.ajax({ type: "POST", url: "../Orders.aspx/ShippingAddress", data: "{'LocationId':'" + LocationId + "','Action':'" + Action + "','Country':''}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var selectList = ""; $("#ddlshpcountry").empty(); selectList = $("#ddlshpcountry"); selectList.append('<option>Select Country</option>'); if (selectList != "") { for (var i = 0; i < msg.d.length; i++) { if (SelectedCountry == "") { if (msg.d[i].Country == "United States" || msg.d.length == 1) SelectedCountry = msg.d[i].Country; } selectList.append('<option value="' + msg.d[i].Country + '" >' + msg.d[i].Country + '</option>'); } if (SelectedCountry != "") document.getElementById('ddlshpcountry').value = SelectedCountry; if (SelectedState != "") BindShippingStates(SelectedState, '', '', ''); else BindShippingStates('', '', '', '', ''); } else { $(".deliveryvalidationpanel").css("display", "block"); $(".deliveryvalidationpanel").css("margin-top", $(document).scrollTop() - 0); } } else { $("#lblorderror").text("Sorry! We can't ship to this address"); $(".ordererror").show().delay(3000).fadeOut(); } $(".shploader").css("display", "none"); } }) } //Share Panel Coding function OpenSharePanel() { var twwtlnk = document.getElementById('tweet'); //or grab it by tagname etc twwtlnk.href = "https://twitter.com/share?url="+ document.URL; var fblnk = document.getElementById('facebooklnk'); fblnk.href = "https://www.facebook.com/sharer.php?u="+ document.URL; var a = document.getElementById('sharelink'); a.href = "https://plus.google.com/share?url=" + document.URL; $("#sharepanel").css("display","block"); } function Closesharepanel() { $("#sharepanel").css("display","none"); $("#divsharelnk2").css("display","none"); $("#divsharelnk1").attr("style","display:flex;align-items:center;justify-content:center"); } function DeliveryHours() { $("#deliveryhours").slideToggle(500); } function RestaurantHours() { $("#restauranthours").slideToggle(500); } function CloseMobActivate() { $(".ActivateMobileconfirm").fadeOut(); } function StartCateringOrder() { var url = document.getElementById("lblUrl").innerHTML; if (location.hostname == "localhost") { window.location = "http://localhost:27746/Catering" + url; } else if (location.hostname.indexOf("107.130.183.186") != null && location.hostname.indexOf("107.130.183.186") >= 0) { window.location = "http://107.130.183.186:8064" + "/Catering" + url; } else if (location.hostname.indexOf("64.37.50.50") != null && location.hostname.indexOf("64.37.50.50") >= 0) { window.location = "http://64.37.50.50:8064" + "/Catering" + url; } else { window.location = "https://www.munchem.com" + "/Catering" + url; } } function ViewReserveTable() { var LocationId = document.getElementById('lblLId').value; if (location.hostname == "localhost") { window.open("http://localhost:27746/ReserveTable.aspx?LocationId=" + LocationId, "_blank"); } else if (location.hostname.indexOf("64.37.50.50") != null && location.hostname.indexOf("64.37.50.50") >= 0) { window.open("http://64.37.50.50:8064/ReserveTable.aspx?LocationId=" + LocationId, "_blank"); } else { window.open("http://munchem.com/ReserveTable.aspx?LocationId=" + LocationId, "_blank"); } } function ShowRecipe(obj) { var Blogid=obj.id; $.ajax({ type: "POST", url: "orders.aspx/GetBlogContent", data: "{'Blogid': '" + Blogid + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null && msg.d != "") { $('#ifmRecipe').attr("src", "RecipePnl.aspx?Id=" + obj.id); $("#RecipeDisplay").css("display", "block"); $(".RecipeAdjustPanel").css("margin-top", $(document).scrollTop() - 0); } else { alertify.alert("Recipe information not available."); } } }); } function viewMunchiesClose() { $("#RecipeDisplay").css("display", "none"); } function CloseRecipe() { $("#RecipeDisplay").css("display", "none"); } function SpecialsData() { var LocationId = document.getElementById('lblLId').value; if (LocationId != null || LocationId != "") { document.getElementById('bogooffers').innerHTML = ""; $.ajax({ type: "POST", url: "orders.aspx/GetSpecials", data: "{'LocationId': '" + LocationId + "','Action':''}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById('bogooffers').innerHTML = ""; if (msg.d.length > 0) { var bogoitems = ""; var trspan; bogoitems += "<table style='width:80%;margin:0 auto;'>"; for (var i = 0; i < msg.d.length; i++) { if (msg.d[i].BogoImageUrl != null && msg.d[i].BogoImageUrl != null) { tdspan = "1"; } else { tdspan = "2"; } bogoitems += "<tr><td colspan='"+tdspan+"'><div style='color:#13a7e2;font-size:16px;font-weight:bold'><label>" + msg.d[i].OfferName + "</label></div>"; if (msg.d[i].GetQuantity == "Custom %") bogoitems += "<div style='font-size:16px; margin-top: 10px;'><label>Buy " + msg.d[i].BuyQuantity + " <span style='color:red;'>" + msg.d[i].BuyItemName + "</span> Get " + msg.d[i].GetOffer + " % Off on <span style='color:red;'>" + msg.d[i].GetItemName + "</label></div>"; else if (msg.d[i].GetQuantity == "Custom $") bogoitems += "<div style='font-size:16px; margin-top: 10px;'><label>Buy " + msg.d[i].BuyQuantity + " <span style='color:red;'>" + msg.d[i].BuyItemName + "</span> Get $" + msg.d[i].GetOffer.toFixed(2) + " Off on <span style='color:red;'>" + msg.d[i].GetItemName + "</label></div>"; else bogoitems += "<div style='font-size:16px; margin-top: 10px;'><label>Buy " + msg.d[i].BuyQuantity + " <span style='color:red;'>" + msg.d[i].BuyItemName + "</span> Get " + msg.d[i].GetQuantity + " <span style='color:red;'>" + msg.d[i].GetItemName + "</label></div>"; bogoitems += "<div style='font-size:14px; margin-top: 10px;'><label>Available On: " + msg.d[i].Action + "</label></div></td>"; if (msg.d[i].BogoImageUrl != null && msg.d[i].BogoImageUrl != null) { bogoitems += "<td><div style='font-size:14px;'><img src='"+ msg.d[i].BogoImageUrl +"' width='130' height='75'/></div></td>"; } bogoitems += "</tr><tr><td colspan='2' style='font-size: 18px;text-align: center;padding-top: 6px;border-bottom: 1px solid #e6e3e3;padding-bottom: 5px;'>"; } bogoitems += "</table>"; document.getElementById('bogooffers').innerHTML += bogoitems; } $('#ViewSpecials').css("display", "block"); } }); } } function SpecialsDisplay() { var LocationId = document.getElementById('lblLId').value; if (LocationId != "" || LocationId != null) { $.ajax({ type: "POST", url: "orders.aspx/GetSpecials", data: "{'LocationId': '" + LocationId + "','Action':'checkbogo'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { if (msg.d.length > 0) { if ($("#lbloffers").text() == "BOGO" || $("#lbloffers").text() == "Both") { $('#lblbogodisplay').css("display", "block"); document.getElementById('lblcheckbogo').innerHTML = "BOGO"; } else { $('#lblbogodisplay').css("display", "none"); document.getElementById('lblcheckbogo').innerHTML = ""; } } else { $('#lblbogodisplay').css("display", "none"); document.getElementById('lblcheckbogo').innerHTML = ""; } } else { $('#lblbogodisplay').css("display", "none"); document.getElementById('lblcheckbogo').innerHTML = ""; } } }); } } function AddNewCoupon() { if (Page_ClientValidate("Savenewcoupon")) { var UserId = document.getElementById("UserId").innerHTML; var DiscountType = ddlcupndistype.options[ddlcupndistype.selectedIndex].text; if (DiscountType == "₹ Amount") DiscountType = "Rs Amount"; var DiscountAmount = $("#txtcupndst").val(); if (DiscountAmount == "") DiscountAmount = "0"; var MaxDiscountType = ddlcupndistype.options[ddlcupndistype.selectedIndex].text; var ExpiryTime = ddlfromtimes1.options[ddlfromtimes1.selectedIndex].text; var AppId = $("#lblAppId1").val(); var LocationId = $("#lblLId").val(); $.ajax({ type: "POST", url: "Orders.aspx/SavePromoCodes", data: "{'TimeZone': '" + escape($("#lbltimezonename").val()) + "','RawOffSet': '" + escape($("#lblrawoffset").text()) + "','PromoCode': '" + escape($("#txtcupnlink").val()) + "','PromotionName': '" + escape($("#txtcuptitle").val()) + "','UserId': '" + UserId + "','Description': '" + escape($("#txtcupnother").val()) + "','DiscountType': '" + DiscountType + "','DiscountAmount': '" + DiscountAmount + "','DisplayValue': '" + $("#txtcupndst").val() + "','ExpiryDate': '" + $("#txtcupndate").val() + "','MaxDiscountType': '" + MaxDiscountType + "','ExpiryTime':'" + ExpiryTime + "','AppId':'" + AppId + "','LocationId':'" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "Successfully Saved") { $("#lblordalert").text("Coupon added successfully. Coupon will activate after admin can approved"); $(".orderalert").fadeIn(); $("#txtcuptitle").val(""); $("#txtcupnlink").val(""); $("#txtcupnother").val(""); $("#txtcupndst").val(""); } else { $("#lblordalert").text(msg.d); $(".orderalert").fadeIn(); } } }); } } function viewMunchiesClose() { $("#pnlMoreMunchies").css("display", "none"); } function ViewMoreMunchies() { var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; var Action = document.getElementById('lblAwardType').innerHTML; if (LocationId != null || LocationId != "") { document.getElementById('ViewMunchies').innerHTML = ""; $.ajax({ type: "POST", url: "Orders.aspx/GetRestaurantMunchiesDetails", data: "{'LocationId': '" + LocationId + "','AppId':'" + AppId + "' ,'Action':'" + Action + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById('ViewMunchies').innerHTML = ""; if (msg.d.length > 0) { var munchies = "<div style='margin-top:2%;margin-bottom:2%'><table style='width:80%;margin:0 auto;'>"; munchies += "<tr><td colspan='2' class='pointhead1' >What is the munchies program, and how does it work?</td></tr>" munchies += "<tr><td colspan='2' class='pointsubhead1' >Munchies is a loyalty program that allows us to reward our best customers with free food. You can earn Munchies by using our app or website to order food or share with friends. Earn enough Munchies to use like cash for food orders.</td></tr>" munchies += "<tr><td colspan='2' style='line-height:18px'></td></tr>" munchies += "<tr><td colspan='2' class='pointhead' >Earn points based upon Order Amount</td></tr>" munchies += "<tr class='pointsubhead'><td >Percentage of Order Total</td><td>" + msg.d[0].PercentageForOrder + " " + Action + "</td></tr>"; if (Action == "Munchies") { munchies += "<tr ><td colspan='2' class='pointhead'>Earn points based upon recommending to friends</td></tr>" munchies += "<tr class='pointsubhead'><td >Friend Creates Account</td><td>" + msg.d[0].FriendsCreateAccount + " Munchies</td></tr>"; munchies += "<tr class='pointsubhead'><td>Friend Places 1st Order</td><td>" + msg.d[0].FriendFirstOrder + " Munchies</td></tr>"; munchies += "<tr><td colspan='2' class='pointhead'>Earn points based upon one-time events</td></tr>" munchies += "<tr class='pointsubhead'><td >Create An Account</td><td>" + msg.d[0].CreateAccount + " Munchies</td></tr>"; munchies += "<tr class='pointsubhead'><td>Place Your First Order </td><td>" + msg.d[0].FirstOrder + " Munchies</td></tr>"; munchies += "<tr class='pointsubhead'><td >Set Your Preferences</td><td>" + msg.d[0].Preferences + " Munchies</td></tr>"; munchies += "<tr class='pointsubhead'><td >Add Profile Photo </td><td>" + msg.d[0].ProfilePhoto + " Munchies</td></tr>"; munchies += "<tr class='pointsubhead'><td>Provide Feedback/Review</td><td>" + msg.d[0].Review + " Munchies</td></tr>"; } munchies += "</table></div>"; document.getElementById('ViewMunchies').innerHTML = munchies; } $(".pnlMoreMunchiesadjst").css("margin-top", $(document).scrollTop() - 0); $('#pnlMoreMunchies').css("display", "block"); } }); } } function Trim(el) { el.value = el.value. replace(/(^\s*)|(\s*$)/gi, ""). replace(/[ ]{2,}/gi, " "). replace(/\n +/, "\n"); return; } function DineinSettings() { var LocationId = document.getElementById('lblLId').value; var UrlType = document.getElementById('lblurlnametype').innerHTML; if (UrlType == "DineIn") { RequiredFields(); localStorage.removeItem("OrderType"); } else { $("#dineinsettingspanel").css("display", "none"); } } function SkipDineInSettings() { $("#dineinsettingspanel").css("display", "none"); } function RequiredFields() { var LocationId = document.getElementById('lblLId').value; if (LocationId != "" && LocationId != null && LocationId != "undefined") { $.ajax({ type: "POST", url: "Orders.aspx/GetDineInSettings", data: "{'LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { document.getElementById("lblAllowcart").innerHTML = msg.d[0].PayOnline; document.getElementById("lbldineintip").innerHTML = msg.d[0].AllowTip; document.getElementById("lblRequiredEmail").innerHTML = msg.d[0].RequiredEmail; document.getElementById("lblRequiredPhone").innerHTML = msg.d[0].RequiredPhoneNo; document.getElementById("lblRequiredName").innerHTML = msg.d[0].RequiredName; document.getElementById("lblRequiredLName").innerHTML = msg.d[0].RequiredLastName; document.getElementById("lblRequiredTableNo").innerHTML = msg.d[0].RequiredTableNo; if (msg.d[0].RequiredName != "No") { $(".dineinfnamerow").css("display", "block"); DisplayColumns(); } if (msg.d[0].RequiredLastName != "No") { $(".dineinlnamerow").css("display", "block"); DisplayColumns(); } if (msg.d[0].RequiredEmail != "No") { $(".dineinemailrow").css("display", "block"); $("#txtguestdeliveryemail").css("display", "block"); DisplayColumns(); } else { $("#txtguestdeliveryemail").css("display", "none"); } if (msg.d[0].RequiredPhoneNo != "No") { $(".dineinphnrow").css("display", "block"); $("#txtmobilenumber").css("display", "block"); DisplayColumns(); }else { $("#txtmobilenumber").css("display", "none"); } if (msg.d[0].RequiredTableNo != "No") { $(".dineintablerow").css("display", "block"); DisplayColumns(); $(".advancedineinsettings").css("display", "block"); } else { $(".advancedineinsettings").css("display", "none"); } if (msg.d[0].RequiredName == "No" && msg.d[0].RequiredLastName == "No"){ $("#txtguestdeliveryname").css("display", "none"); } else { $("#txtguestdeliveryname").css("display", "block"); } } else { $("#dineinsettingspanel").css("display", "none"); } } }); } } function DisplayColumns() { var LocationId = document.getElementById('lblLId').value; if (LocationId != "" && LocationId != null && LocationId != "undefined") { $.ajax({ type: "POST", url: "Orders.aspx/GetDineInSettings", data: "{'LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0].RequiredEmail == "Required" || msg.d[0].RequiredPhoneNo == "Required" || msg.d[0].RequiredName == "Required" || msg.d[0].RequiredLastName == "Required" || msg.d[0].RequiredTableNo == "Required") { $("#dineskipbtn").css("display", "none"); $("#dineinsettingspanel").css("display", "block"); $("#dineinbtn").css("display", "block"); } else if (msg.d[0].RequiredEmail == "Optional" || msg.d[0].RequiredPhoneNo == "Optional" || msg.d[0].RequiredName == "Optional" || msg.d[0].RequiredLastName == "Optional" || msg.d[0].RequiredTableNo == "Optional") { $("#dineskipbtn").css("display", "block"); $("#dineinbtn").css("display", "block"); $("#dineinsettingspanel").css("display", "block"); } else { $("#dineinsettingspanel").css("display", "none"); } } } }); } } function RequiredDineInFeilds() { var LocationId = document.getElementById('lblLId').value; if (LocationId != "" && LocationId != null && LocationId != "undefined") { $.ajax({ type: "POST", url: "Orders.aspx/GetDineInSettings", data: "{'LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { document.getElementById("lblAllowcart").innerHTML = msg.d[0].PayOnline; document.getElementById("lbldineintip").innerHTML = msg.d[0].AllowTip; document.getElementById("lblRequiredEmail").innerHTML = msg.d[0].RequiredEmail; document.getElementById("lblRequiredPhone").innerHTML = msg.d[0].RequiredPhoneNo; document.getElementById("lblRequiredName").innerHTML = msg.d[0].RequiredName; document.getElementById("lblRequiredLName").innerHTML = msg.d[0].RequiredLastName; document.getElementById("lblRequiredTableNo").innerHTML = msg.d[0].RequiredTableNo; if (msg.d[0].RequiredEmail != "No") { $("#txtguestdeliveryemail").css("display", "block"); } else { $("#txtguestdeliveryemail").css("display", "none"); } if (msg.d[0].RequiredPhoneNo != "No") { $("#txtmobilenumber").css("display", "block"); }else { $("#txtmobilenumber").css("display", "none"); } if (msg.d[0].RequiredTableNo != "No") { $(".dineintablerow").css("display", "block"); $(".advancedineinsettings").css("display", "block"); } else { $(".advancedineinsettings").css("display", "none"); } if (msg.d[0].RequiredName == "No" && msg.d[0].RequiredLastName == "No"){ $("#txtguestdeliveryname").css("display", "none"); } else { $("#txtguestdeliveryname").css("display", "block"); } } else { document.getElementById("lblRequiredEmail").innerHTML = ""; document.getElementById("lblRequiredPhone").innerHTML = ""; document.getElementById("lblRequiredName").innerHTML = ""; document.getElementById("lblRequiredLName").innerHTML = ""; document.getElementById("lblRequiredTableNo").innerHTML = ""; } } }); } } function SubmitDineinValidations() { var LocationId = document.getElementById('lblLId').value; if (LocationId != "" && LocationId != null && LocationId != "undefined") { $.ajax({ type: "POST", url: "Orders.aspx/GetDineInSettings", data: "{'LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var FirstName = document.getElementById("txtdinefname").value.trim(); var LastName = document.getElementById("txtdinelname").value.trim(); var Email = document.getElementById("txtdineemail").value.trim(); var PhoneNo = document.getElementById("txtdinephn").value.trim(); var TableNo = document.getElementById("txtdinetable").value.trim(); var i = 0; if (msg.d[0].RequiredName == "Required") { if (FirstName == "") { // document.getElementById("lbldineinfname").innerHTML = "First Name is Required"; document.getElementById("txtdinefname").style.border = "2px solid red"; i++; } else { //document.getElementById("lbldineinfname").innerHTML = ""; document.getElementById("txtdinefname").style.border = "none"; } } if (msg.d[0].RequiredLastName == "Required") { if (LastName == "") { //document.getElementById("lbldineinlname").innerHTML = "Last Name is Required"; document.getElementById("txtdinelname").style.border = "2px solid red"; i++; } else { // document.getElementById("lbldineinlname").innerHTML = ""; document.getElementById("txtdinelname").style.border = "none"; } } if (msg.d[0].RequiredPhoneNo == "Required") { if (PhoneNo == "") { //document.getElementById("lbldineinphn").innerHTML = "Phone Number is Required"; document.getElementById("txtdinephn").style.border = "2px solid red"; i++; } else { if (PhoneNo.length > 10 || PhoneNo.length < 10) { document.getElementById("lbldineinphn").innerHTML = "Enter valid Number"; i++; } else { document.getElementById("lbldineinphn").innerHTML = ""; } } } if (msg.d[0].RequiredEmail == "Required") { if (Email == "") { //document.getElementById("lbldineinemail").innerHTML = " Enter Email is Required"; document.getElementById("txtdineemail").style.border = "2px solid red"; i++; } else { var emailExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i; if (Email.match(emailExp)) { document.getElementById("lbldineinemail").innerHTML = ""; } else { document.getElementById("lbldineinemail").innerHTML = "Enter Valid Email"; i++; } } } if (msg.d[0].RequiredTableNo == "Required") { if (TableNo == "") { document.getElementById("txtdinetable").style.border = "2px solid red"; i++; } else { document.getElementById("txtdinetable").style.border = "none"; } } if (i == 0) { var numOfVisibleRows = $('.rowcount').filter(function () { return $(this).css('display') !== 'none'; }).length; if (msg.d[0].RequiredEmail == "Optional" || msg.d[0].RequiredPhoneNo == "Optional" || msg.d[0].RequiredName == "Optional" || msg.d[0].RequiredLastName == "Optional" || msg.d[0].RequiredTableNo == "Optional") { if (FirstName != "" || LastName != "" || PhoneNo != "" || Email != "" || TableNo != "") { } else if (numOfVisibleRows == "1") { if (FirstName == "" || LastName == "" || PhoneNo == "" || Email == "" || TableNo == "") { alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Please Enter Field"); i++; } } else if (FirstName == "" || LastName == "" || PhoneNo == "" || Email == "" || TableNo == "") { alertify.set({ labels: { ok: "Ok" } }); alertify.alert("Plaese Enter Any One Field"); i++; } } } } if (i == 0) { InsertdineinSettings(); } } }); } } function InsertdineinSettings() { var FirstName = document.getElementById("txtdinefname").value; var LastName = document.getElementById("txtdinelname").value; var Email = document.getElementById("txtdineemail").value; var PhoneNo = document.getElementById("txtdinephn").value; var AppId = document.getElementById('lblAppId1').value; $.ajax({ type: "POST", url: "Orders.aspx/InsertUsers", data: "{'FirstName': '" + FirstName + "','Email': '" + Email + "','PhoneNo': '" + PhoneNo + "','AppId':'" + AppId + "','LastName':'" + LastName + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "Email Already Exist") { //document.getElementById("lbldineinemail").innerHTML = "Email already exist."; $("#dineinsettingspanel").css("display", "none"); } else if (msg.d == "Phone Number Already Exist") { // document.getElementById("lbldineinphn").innerHTML = "Phone Number already Exist."; $("#dineinsettingspanel").css("display", "none"); } else if (msg.d == "Successfully Inserted") { $("#dineinsettingspanel").css("display", "none"); } } }); } $("#txtdeliverydate").on('focus', function () { $(this).trigger('blur'); }); function CloseAlertError() { $(".orderalert").removeAttr("style"); $("#lblordalert").text(""); $(".placeorderloaderdiv").css("display", "none"); $(".placeorderbtndiv").css("display", "inline-block"); } $('#txtinstructions').keyup(function () { var maxlength = $("#txtinstructions").attr("maxlength"); if ($('#txtinstructions').val() != null || $('#txtinstructions').val() != "") { var textlen = maxlength - $("#txtinstructions").val().length; if (textlen < maxlength) { $('#lblitemintcount').text(textlen + " " + "Characters Remaining"); $('#lblitemintcount').css("display", "block"); } else $('#lblitemintcount').css("display", "none"); } }); $('#instructions').keyup(function () { var maxlength = $("#instructions").attr("maxlength"); if ($('#instructions').val() != null || $('#instructions').val() != "") { var textlen = maxlength - $("#instructions").val().length; if (textlen < maxlength) { $('#lblinstructcout').text(textlen + " " + "Characters Remaining"); $('#lblinstructcout').css("display", "block"); } else { $('#lblinstructcout').css("display", "none"); } } }); $(document).on('keypress', '#txtdeliverydate', function (e) { var charCode = (e.which) ? e.which : e.keyCode if (charCode != 58 && charCode != 59 && charCode != 65 && charCode != 77 && charCode != 80 && charCode != 32 && charCode != 09 && charCode != 08) return false; return true; }); function GetActiveTiles() { if (document.getElementById("lblNavigationBar").innerHTML == "true") { CheckPhotosExist(); FavourateandRevies(); } var AppId = document.getElementById('lblAppId1').value; if (AppId != "") { $(".addcategoryloadingimage").removeAttr("style"); $(".addcategoryloadingimage").css("display", "block"); $.ajax({ type: "POST", url: "Orders.aspx/GetPageDetailsByAppId", data: "{'AppId':'" + AppId + "'}", dataType: "json", contentType: "application/json", success: function (mesg) { if (mesg.d.length > 0) { var Loadpages = ""; for (var i = 0; i < mesg.d.length; i++) { if (mesg.d[i].Status == true) { var content = mesg.d[i].PageContent; if (mesg.d[i].PageContent != null && mesg.d[i].PageContent != "" && mesg.d[i].PageContent.toLowerCase() != "enter your content here") { Loadpages += "<div class='pagename' id='" + mesg.d[i].PageId + "' name='" + mesg.d[i].PageName + "' onclick='ShowContent(this.id)'>" + mesg.d[i].PageName + "</div>" if (content.includes("'")) { Loadpages += '<div style="display:none;" id="content' + mesg.d[i].PageId + '" name="' + mesg.d[i].PageContent + '"></div>'; } else { Loadpages += "<div style='display:none;' id='content" + mesg.d[i].PageId + "' name='" + mesg.d[i].PageContent + "'></div>"; } document.getElementById('tilescontent').innerHTML = Loadpages; } } } } $("html, body").css("overflow-y", "hidden"); $(".popupdisplay2").css("display", "none"); $(".hmrtpnl").css("right", "0"); $(".hmrtpnlmdl").css("margin", "0 0 0 0"); $(".addcategoryloadingimage").css("display", "none"); } }); } } function ShowContent(id) { var OrdersPageURL=window.location; var contenid = "content" + id; var PageContent = $("#" + contenid).attr('name'); if(PageContent.includes("order.html") || PageContent.includes("Order.html")) { PageContent = PageContent.replace("order.html",OrdersPageURL); } var PageName = $("#" + id).attr('name'); document.getElementById('contenttileshead').innerHTML = PageName; if (PageContent != undefined) { document.getElementById('contenttilesdescrp').innerHTML = PageContent; } $(".contentilespanelopen").css("top", $(document).scrollTop() + 70); document.getElementById('contenttilespanel').style.display = "block"; } function CloseContentTiles() { document.getElementById('contenttilespanel').style.display = "none"; } $("#pnlclose").click(function () { $("html, body").css("overflow-y", ""); $(".hmrtpnl").css("right", "-100%"); $(".hmrtpnlmdl").css("margin", "0 -300px 0 0"); }) $(".hmrtpnl").click(function (e) { if (!$(e.target).is('.hmrtpnltxt')) { $(".hmrtpnl").removeAttr("Style"); $(".hmrtpnlmdl").removeAttr("Style"); $("html, body").css("overflow-y", "visible"); } }) $(document).click(function (e) { if (!$(e.target).is('.popupdisplay1')) { $('.popupdisplay2').css("display", "none"); } }); </script> <style type="text/css"> .sq-input { width: 200px; height: 25px; border-radius: 2px; color: #898989; vertical-align: middle; box-shadow: 0 1px 3px hsla(0, 0%, 0%, 0.2) inset; border: 1px solid hsl(204, 4%, 74%); font-size: 20px; outline-offset: -2px; margin-bottom: 5px; } .sq-input--focus { /* how your inputs should appear when they have focus */ outline: 5px auto rgb(59, 153, 252); } .sq-input--error { /* how your inputs should appear when invalid */ outline: 5px auto rgb(255, 97, 97); } </style> <script type="text/javascript" language="JavaScript"> var token = ""; window.addEventListener('message', function (event) { token = event.data; }, false); function loadFrame() { if (document.getElementById("CCBaseURL").innerHTML != "") { document.getElementById("CCBaseURL").innerHTML = document.getElementById("CCBaseURL").innerHTML.replace(".com/", ".com"); var queryString = "useexpiry=true&usecvv=true&tokenizewheninactive=true&cardlabel=Card%20Number&expirylabel=Expiration%20Date%20&cvvlabel=CVV&invalidinputevent=true"; document.getElementById("tokenframe").src = document.getElementById("CCBaseURL").innerHTML + "/itoke/ajax-tokenizer.html?" + queryString; } } loadFrame(); //Cart scrolling with window scroll only stelaskitchenbar //var lastScrollTop = 0; //$(window).scroll(function () { // if (window.innerWidth > 767) { // var retrievedData = localStorage.getItem("TotalItems"); // var AddedItems = JSON.parse(retrievedData); // if (AddedItems != null) { // if (AddedItems.length > 0) { // if ($("#lblMenuTheme").val() != "Grid") { // var top = $(window).scrollTop() / 2; // var cartheight = $(".carright").height(); // var documentheight = $(document).scrollTop(); // var menuheight = $(".orderdivw").height(); // if (documentheight > lastScrollTop) { // // downscroll code // if (parseInt(documentheight) > parseInt(cartheight)) { // if (parseInt(menuheight) > parseInt(documentheight)) { // $(".carright").stop().animate({ "margin-top": ($(window).scrollTop() + 150 - parseInt(cartheight)) + "px" }, "slow"); //it moves towards bottom position of the cart // } // else { // //to stop scrolling } // } // } // } // else { // // upscroll code // if (lastScrollTop > 300) { // if (parseInt(cartheight) > 700) { // if (parseInt(lastScrollTop) - parseInt(cartheight) + 250.00 > 10) { // $(".carright").stop().animate({ "margin-top": (parseInt(lastScrollTop) - parseInt(cartheight) + 250.00) + "px" }, "slow");// it moves towards starting position of the cart // } // else { // $(".carright").stop().animate({ "margin-top": 0 + "px" }, "slow"); // } // } // else if (parseInt(cartheight) > 500) { // if (parseInt(lastScrollTop) - parseInt(cartheight) + 200.00 > 10) { // $(".carright").stop().animate({ "margin-top": (parseInt(lastScrollTop) - parseInt(cartheight) + 200.00) + "px" }, "slow");// it moves towards starting position of the cart // } // else { // $(".carright").stop().animate({ "margin-top": 0 + "px" }, "slow"); // } // } // else if (parseInt(cartheight) > 300) { // if (parseInt(lastScrollTop) - parseInt(cartheight) + 50.00 > 10) { // $(".carright").stop().animate({ "margin-top": (parseInt(lastScrollTop) - parseInt(cartheight) + 50.00) + "px" }, "slow");// it moves towards starting position of the cart // } // else { // $(".carright").stop().animate({ "margin-top": 0 + "px" }, "slow"); // } // } // else { // $(".carright").stop().animate({ "margin-top": (parseInt(lastScrollTop) - 100 - parseInt(cartheight) + 10.00) + "px" }, "slow");// it moves towards starting position of the cart // } // } // else { // //margin-top : (0.00) // $(".carright").stop().animate({ "margin-top": (0.00) + "px" }, "slow");// min cart height is 300px.so scrolling height is below 300 it goes to start position.without this step when we move from bottom to top we have some gap b/w master page and cart // } // } // lastScrollTop = documentheight; // } // } // } // } //}); function SignOutOrder() { $.ajax({ type: "POST", url: "Orders.aspx/SignOut", dataType: "json", contentType: "application/json", success: function (msg) { sessionStorage.clear(); //localStorage.clear(); document.getElementById("UserId").innerHTML = ""; document.getElementById("lbluseremail").innerHTML = ""; document.getElementById("txtEmail").innerHTML = ""; document.getElementById("lblEmail").innerHTML = ""; $(".showuserimage1").attr("src", "images/photonotavailablepng.png"); $(".showuserimage1").css("display", "none"); $("#lblEmail").css("display", "none"); $(".signinoptdiv").css("display", "block"); if (window.self !== window.top) { if (window.parent.location != window.location) { $(".signin-accountdiv").css("display", "none"); } } $(".popupdisplay1").css("display", "none"); $("#bntSignin").css("display", "block"); $(".welcome").css("display", "none"); $("#idloginoints").css("display", "block"); $("#idorderwithpoints").css("display", "none"); document.getElementById('btndeiverymunchies1').value = ""; document.getElementById('lblLoyaltyText').innerText = ""; $('.btnpaywithmunchies').css("display", "none"); $('#munchiespoints').css("display", "none"); $('.munchiesAmount').css("display", "none"); $('.munchiesAmount').text("You only have: 0 Munchies"); } }); } function GetAvailableDates(HolidayName, fromtime, totime, Holidaydate) { var LId = document.getElementById('lblLId').value; var appId = document.getElementById('lblAppId1').value; var OrderType = "PickUp"; var Zone = ""; var selectedDate; var DriverId = ""; var ItemCount = ""; var TotalDistance = ""; var Retrivedata = ""; var today = new Date(); var dd = String(today.getDate()).padStart(2, '0'); var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0! var yyyy = today.getFullYear(); selectedDate = mm + '/' + dd + '/' + yyyy; $.ajax({ type: "POST", url: "Orders.aspx/CheckRestaurantNextAvailabletime", data: "{'LocationId':'" + LId + "','appId':'" + appId + "','curretdate':'" + selectedDate + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { $("#lblordalert").text("Due to" + " " + HolidayName + " , the earliest time available to order is " + msg.d.AvailableDate + " at " + msg.d.OpenTime + "."); $(".orderalert").fadeIn(); } } }); } $("#imgpwd").click(function () { var x = document.getElementById("txtPwd"); if (x.type == "password") { $("#txtPwd").attr("type", "text"); $("#imgpwd").attr("src", "/images/showpassword.png"); } else { $("#txtPwd").attr("type", "password"); $("#imgpwd").attr("src", "/images/hidepassword.png"); } }); $("#imgshowpwd").click(function () { var x = document.getElementById("txtPassword"); if (x.type == "password") { $("#txtPassword").attr("type", "text"); $("#imgshowpwd").attr("src", "/images/showpassword.png"); } else { $("#txtPassword").attr("type", "password"); $("#imgshowpwd").attr("src", "/images/hidepassword.png"); } }); $("#imgconfirmpwd").click(function () { var x = document.getElementById("txtconformpsw"); if (x.type == "password") { $("#txtconformpsw").attr("type", "text"); $("#imgconfirmpwd").attr("src", "/images/showpassword.png"); } else { $("#txtconformpsw").attr("type", "password"); $("#imgconfirmpwd").attr("src", "/images/hidepassword.png"); } }); function couponsdata() { $("#divcoupons").css("display", "block"); } function closecouponsdiv() { $("#divcoupons").css("display", "none"); } function closehoursdiv() { $("#divhours").css("display", "none"); } </script> <script type="text/javascript" language="JavaScript"> /*group order changes*/ function BindOtherMembersItems(MemberId, MemberType) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var OtherMembersItems = localStorage.getItem("OtherMembersItems"); var AddedItems = JSON.parse(OtherMembersItems); document.getElementById('tblOthersCart').innerHTML = ""; if ($("#lblMenuTheme").val() == "Grid" || $("#lblMenuTheme").val() == "Grid") { $("#sharegorder").css("display", "none"); } else{ $("#sharegorder").css("display", "block"); } if (AddedItems != null) { if (AddedItems.length > 0) { $(".displayonitem").css("display", "block"); $(".Emptycart").css("display", "none"); $(".cartitems").css("display", "block"); $('.carright').css("display", "block"); //$(".urscart").css("width", $(".carright").width() + "px"); if (MemberType == "Admin") { $(".yourordersteststyles").css("display", "block"); } if (MemberType == "Member") { $(".yourordersteststyles").css("display", "none"); } for (var M = 0; M < AddedItems.length; M++) { var membertable = document.createElement("table"); setAttributes(membertable, { "class": "groupcart" }); var membertr = document.createElement("tr"); var membertd = document.createElement("td"); var memberspanName = document.createElement("span"); setAttributes(memberspanName, { "style": "font-size: 16px;font-weight: bold;color: black;" }); memberspanName.innerHTML += AddedItems[M].MemberName; var memberType = document.createElement("span"); //setAttributes(memberType, { "style": "font-size: 16px;font-weight: bold;color: black;" }); memberType.innerHTML += " (" + AddedItems[M].MemberType + ")"; var memberStatustd = document.createElement("td"); setAttributes(memberStatustd, { "class": "gcartright" }); var memberOrderStatusimg = document.createElement("img"); if (AddedItems[M].OrderStatus == "Adding") { setAttributes(memberOrderStatusimg, { "src": "/images/AddingtoCart.png", 'title': 'Adding', 'alt': 'Add' }); } else if (AddedItems[M].OrderStatus == "Finished") { setAttributes(memberOrderStatusimg, { "src": "/images/GreenCheck.png", 'title': 'Finished', 'alt': 'Finish' }); } else if (AddedItems[M].OrderStatus == "Editing") { setAttributes(memberOrderStatusimg, { "src": "/images/EGreen.png", 'title': 'Editing', 'alt': 'Edit' }); } membertd.appendChild(memberspanName); membertd.appendChild(memberType); memberStatustd.appendChild(memberOrderStatusimg); membertr.appendChild(membertd); membertr.appendChild(memberStatustd); membertable.appendChild(membertr); var Price = 0; for (var I = 0; I < AddedItems[M].GroupItems.length; I++) { var trItem = document.createElement("tr"); setAttributes(trItem, { "style": "color:#333333;", "align": "center", "id": AddedItems[M].GroupItems[I].ItemId, "value": AddedItems[M].GroupItems[I].CategoryId }); var tdItem = document.createElement("td"); setAttributes(tdItem, { "class": "Order_contnet1", "width": "50%" }); var lblItem = document.createElement("span"); setAttributes(lblItem, { "style": "font-weight:bold;font-size:12px;", "class": "CartItem" }); if (AddedItems[M].GroupItems[I].NoSalesTax == "true" || AddedItems[M].GroupItems[I].CustomTax == "0") lblItem.innerHTML += AddedItems[M].GroupItems[I].Quantity + " " + unescape(AddedItems[M].GroupItems[I].ItemName)+ " (No Tax)"; else lblItem.innerHTML += AddedItems[M].GroupItems[I].Quantity + " " + unescape(AddedItems[M].GroupItems[I].ItemName)+ " (" + unescape(AddedItems[M].GroupItems[I].TaxLabel) + ": " + AddedItems[M].GroupItems[I].CustomTax + "%)"; tdItem.appendChild(lblItem); if (MemberType == "Admin") { setAttributes(lblItem, { "onclick": "EditItemOptionsinGroupOrder(this);", "id": "EditItem" + AddedItems[M].GroupItems[I].Id, "style": "font-weight:bold;font-size:12px;cursor:pointer" }); var DeleteItem = document.createElement("img"); setAttributes(DeleteItem, { "src": "/images/DeleteCartItem.png", "onclick": "DeleteIteminGroupOrder(this);", "id": "DeleteItem" + AddedItems[M].GroupItems[I].Id, "style": "padding-left:6px;vertical-align: middle;cursor:pointer", "alt": "Delete Cart Item" }); tdItem.appendChild(DeleteItem); } else { if (MemberId == AddedItems[M].Id) { setAttributes(lblItem, { "onclick": "EditItemOptionsinGroupOrder(this);", "id": "EditItem" + AddedItems[M].GroupItems[I].Id, "style": "font-weight:bold;font-size:12px;cursor:pointer" }); var DeleteItem = document.createElement("img"); setAttributes(DeleteItem, { "src": "/images/DeleteCartItem.png", "onclick": "DeleteIteminGroupOrder(this);", "id": "DeleteItem" + AddedItems[M].GroupItems[I].Id, "style": "padding-left:6px;vertical-align: middle;cursor:pointer", "alt": "Delete Cart Item" }); tdItem.appendChild(DeleteItem); } } if (AddedItems[M].GroupItems[I].Variations != null) { if (AddedItems[M].GroupItems[I].Variations.length > 0) { for (var v = 0; v < AddedItems[M].GroupItems[I].Variations.length; v++) { var brvariation = document.createElement("br"); tdItem.appendChild(brvariation); var lblVariations = document.createElement("span"); lblVariations.innerHTML = AddedItems[M].GroupItems[I].Variations[v].Name; tdItem.appendChild(lblVariations); itmvaritaions = AddedItems[M].GroupItems[I].Variations[v].Name; } } } var OrderType = localStorage.getItem("GroupOrderType"); if (OrderType == "Shipping") { if (AddedItems[M].GroupItems[I].OrderType == "Shipping") { if (AddedItems[M].GroupItems[I].ItemWeight != null) { var br = document.createElement("br"); tdItem.appendChild(br); var lblOptions = document.createElement("span"); setAttributes(lblOptions, { "style": "font-size:10px;", }); lblOptions.innerHTML += unescape(AddedItems[M].GroupItems[I].ItemWeight * AddedItems[M].GroupItems[I].Quantity) + " " + AddedItems[M].GroupItems[I].Measurement; tdItem.appendChild(lblOptions); } } } else { if (AddedItems[M].GroupItems[I].OrderType != "Shipping") { if (AddedItems[M].GroupItems[I].Choices != null) { if (AddedItems[M].GroupItems[I].Choices.length > 0) { var br = document.createElement("br"); tdItem.appendChild(br); var lblOptions = document.createElement("span"); setAttributes(lblOptions, { "style": "font-size:10px;", }); for (var Ch = 0; Ch < AddedItems[M].GroupItems[I].Choices.length; Ch++) { if (Ch == 0) { lblOptions.innerHTML += unescape(AddedItems[M].GroupItems[I].Choices[Ch].ChoiceName); } else { lblOptions.innerHTML += "," + unescape(AddedItems[M].GroupItems[I].Choices[Ch].ChoiceName); } var OptionId = ""; if (AddedItems[M].GroupItems[I].Choices[Ch].ChildChoices != undefined) { for (var CCh = 0; CCh < AddedItems[M].GroupItems[I].Choices[Ch].ChildChoices.length; CCh++) { if (AddedItems[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].OptionId != OptionId) { lblOptions.innerHTML += " / " + unescape(AddedItems[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].OptionName); lblOptions.innerHTML += " / " + unescape(AddedItems[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].ChoiceName); } else { lblOptions.innerHTML += " , " + unescape(AddedItems[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].ChoiceName); } OptionId = AddedItems[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].OptionId; } } } tdItem.appendChild(lblOptions); } } } } if (AddedItems[M].GroupItems[I].Instructions != "") { var br = document.createElement("br"); tdItem.appendChild(br); var lblInstructions = document.createElement("span"); setAttributes(lblInstructions, { "style": "font-size:10px;", }); lblInstructions.innerHTML += "Instructions: " + unescape(AddedItems[M].GroupItems[I].Instructions); tdItem.appendChild(lblInstructions); } trItem.appendChild(tdItem); var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Order_contnet1 gcartright });" }); var lblQuantity = document.createElement("span"); lblQuantity.innerHTML += AddedItems[M].GroupItems[I].Quantity; //tdQuantity.appendChild(lblQuantity); //trItem.appendChild(tdQuantity); var tdPrice = document.createElement("td"); setAttributes(tdPrice, { "class": "Order_contnet1", "style": "text-align:right;vertical-align:baseline;", "width": "10%" }); var lblPrice = document.createElement("span"); lblPrice.innerHTML += document.getElementById("lblCurrency").innerHTML +AddedItems[M].GroupItems[I].Price; tdPrice.appendChild(lblPrice); trItem.appendChild(tdPrice); membertable.appendChild(trItem); Price = +Price + AddedItems[M].GroupItems[I].Price; } var trSubtotal = document.createElement("tr"); setAttributes(trSubtotal, { "style": "width:100%;text-align:right;" }); var tdSubtotal = document.createElement("td"); setAttributes(tdSubtotal, { "colspan": "2", "style": "border-top: gray 2px solid;color: black;" }); var lblSubtotalPrice = document.createElement("span"); var lblSubtotalText = document.createElement("span"); setAttributes(lblSubtotalPrice, { "style": "font-weight: bold;color: green;font-size: 14px;" }); //setAttributes(lblItem, { "style": "font-weight:bold;font-size:12px;cursor:pointer;", "onclick": "EditItemOptionsinGroupOrder(this);", "id": "EditItem" + g, "class": "CartItem" }); lblSubtotalText.innerHTML += "SubTotal: "; lblSubtotalPrice.innerHTML += document.getElementById("lblCurrency").innerHTML +Price.toFixed(2); tdSubtotal.appendChild(lblSubtotalText); tdSubtotal.appendChild(lblSubtotalPrice); trSubtotal.appendChild(tdSubtotal); membertable.appendChild(trSubtotal); document.getElementById('tblOthersCart').appendChild(membertable); } if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder();} else BindPrices(); } } var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberType; if (Details != null) { MemberType = Details.MemberType; } if (MemberType == "Member") { $(".yourordersteststyles").css("display", "none"); $(".checkbtndiv").css("display", "none"); } } function GetAllItems() { var OrderType = localStorage.getItem("GroupOrderType"); var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberId; var MemberType; if (Details != null) { MemberId = Details.MemberId; MemberType = Details.MemberType; } else { MemberId = ""; } var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var OrderId = Orderstring["OId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/GetAllItems", data: "{'GroupId': '" + GroupId + "','MemberId': '" + MemberId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var itCount = 0; if (msg.d.length > 0) { var Members = new Array(); for (var M = 0; M < msg.d.length; M++) { var Member = new Object; Member.Id = msg.d[M].Id; Member.MemberName = msg.d[M].GroupMemberName; Member.MemberType = msg.d[M].MemberType; Member.OrderStatus = msg.d[M].OrderStatus; Member.GroupId = msg.d[M].GroupId; Member.LId = document.getElementById('lblLId').value; Member.GroupItems = new Array(); for (var I = 0; I < msg.d[M].GroupItems.length; I++) { itCount++; var Item = new Object; Item.Id = msg.d[M].GroupItems[I].Id; Item.ItemId = msg.d[M].GroupItems[I].ItemId; Item.ItemName = escape(msg.d[M].GroupItems[I].ItemName); Item.MemberId = msg.d[M].GroupItems[I].MemberId; Item.Price = msg.d[M].GroupItems[I].Price; Item.Quantity = msg.d[M].GroupItems[I].Quantity; Item.Instructions = escape(msg.d[M].GroupItems[I].Instructions); Item.TimeName = msg.d[M].GroupItems[I].TimeName; Item.CategoryId = msg.d[M].GroupItems[I].CategoryId; Item.OrderType = msg.d[M].GroupItems[I].OrderType; Item.LId = document.getElementById('lblLId').value; Item.AppName = escape(document.getElementById('lblAppName').innerHTML); Item.MainCategoryId = msg.d[M].GroupItems[I].CategoryId; Item.NoSalesTax = document.getElementById('lblItemNoTax').innerHTML; if(msg.d[M].GroupItems[I].CustomTax != null && msg.d[M].GroupItems[I].CustomTax != "" && msg.d[M].GroupItems[I].CustomTax != "0") { Item.CustomTax = msg.d[M].GroupItems[I].CustomTax; } else { Item.CustomTax=document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); } Item.TaxLabel = msg.d[M].GroupItems[I].TaxLabel; Item.Choices = new Array(); Item.Variations = new Array(); if (Item.OrderType == "Shipping") { if (msg.d[M].GroupItems[I].ItemWeight != "" && msg.d[M].GroupItems[I].ItemWeight != null) { if (~msg.d[M].GroupItems[I].ItemWeight.indexOf("Pounds")) { var Measurement = msg.d[M].GroupItems[I].ItemWeight.slice(-6); var ItemWeight = msg.d[M].GroupItems[I].ItemWeight.replace(" ", "").replace(Measurement, ""); Item.ItemWeight = ItemWeight; Item.Measurement = Measurement; for (var Ch = 0; Ch < msg.d[M].GroupItems[I].Choices.length; Ch++) { var Choice = new Object; Choice.ShippingOptionId = msg.d[M].GroupItems[I].Choices[Ch].ShippingOptionId; Choice.OptionName = msg.d[M].GroupItems[I].Choices[Ch].OptionName; Item.Choices.push(Choice); } } else { var Measurement = msg.d[M].GroupItems[I].ItemWeight.slice(-2); var ItemWeight = msg.d[M].GroupItems[I].ItemWeight.replace(" ", "").replace(Measurement, ""); Item.ItemWeight = ItemWeight; Item.Measurement = Measurement; for (var Ch = 0; Ch < msg.d[M].GroupItems[I].Choices.length; Ch++) { var Choice = new Object; Choice.ShippingOptionId = msg.d[M].GroupItems[I].Choices[Ch].ShippingOptionId; Choice.OptionName = msg.d[M].GroupItems[I].Choices[Ch].OptionName; Item.Choices.push(Choice); } } } } else { for (var Ch = 0; Ch < msg.d[M].GroupItems[I].Choices.length; Ch++) { var Choice = new Object; Choice.id = msg.d[M].GroupItems[I].Choices[Ch].id; Choice.OptionName = escape(msg.d[M].GroupItems[I].Choices[Ch].OptionName); Choice.OptionId = msg.d[M].GroupItems[I].Choices[Ch].OptionId; Choice.ChoiceName = escape(msg.d[M].GroupItems[I].Choices[Ch].ChoiceName); Choice.ChildChoices = new Array(); for (var CCh = 0; CCh < msg.d[M].GroupItems[I].Choices[Ch].ChildChoices.length; CCh++) { var ChildChoice = new Object; ChildChoice.id = msg.d[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].id; ChildChoice.OptionName = escape(msg.d[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].OptionName); ChildChoice.OptionId = msg.d[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].OptionId; ChildChoice.ChoiceName = escape(msg.d[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].ChoiceName); ChildChoice.Price = escape(msg.d[M].GroupItems[I].Choices[Ch].ChildChoices[CCh].Price); Choice.ChildChoices.push(ChildChoice); } Item.Choices.push(Choice); } for (var variations = 0; variations < msg.d[M].GroupItems[I].Variations.length; variations++) { var itemvar = new Object; itemvar.Name = msg.d[M].GroupItems[I].Variations[variations].ItemName; itemvar.Id = msg.d[M].GroupItems[I].Variations[variations].Id; Item.Variations.push(itemvar); } } Member.GroupItems.push(Item); } Members.push(Member); } if (OrderId != null && OrderId != "" && OrderId != undefined) { localStorage.setItem("GroupMemberType", (MemberDetails)); } document.getElementById("lblcartcount").innerHTML = itCount; localStorage.setItem("OtherMembersItems", JSON.stringify(Members)); localStorage.setItem("TotalItems", JSON.stringify(Members)); var OrderType = localStorage.getItem("GroupOrderType"); if (OrderType == "Delivery" || OrderType == "Shipping") { if (OrderType == "Delivery") { document.getElementById("rbtdelivery").checked = true; if($("#rbtShipping").length > 0){ document.getElementById("rbtShipping").checked = false; } } else if (OrderType == "Shipping") { document.getElementById("rbtdelivery").checked = false; if($("#rbtShipping").length > 0){ document.getElementById("rbtShipping").checked = true; } } document.getElementById("rbtpickup").checked = false; var PreviousData = localStorage.getItem("GroupDeliveryDetails"); var Table = JSON.parse(PreviousData); if (Table != null) { if (Table.length > 0) { document.getElementById('txtaddress').value = Table[0].Line1; document.getElementById('txtvalidationcity').value = Table[0].City; document.getElementById('txtvalidationstate').value = Table[0].State; document.getElementById('txtvalidationzip').value = Table[0].Zip; document.getElementById("txtline1").value = Table[0].Line1; document.getElementById("txtcity").value = Table[0].City; document.getElementById("txtstate").value = Table[0].State; document.getElementById("txtZip").value = Table[0].Zip; var UId = document.getElementById("UserId").innerHTML; if (UId != "" && UId != null) { GetSavedAddress(); } } } } if (document.getElementById("txtaddress").value != "") { if (OrderType == "Shipping" && MemberType == "Admin") { $.ajax({ type: "POST", url: "Orders.aspx/GetCountryForShipping", data: "{'ToStreet1': '" + escape(document.getElementById("txtaddress").value) + "','ToCity': '" + escape(document.getElementById("txtvalidationcity").value) + "','ToState': '" + escape(document.getElementById("txtvalidationstate").value) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { document.getElementById("lblShCountry").innerHTML = msg.d; BindOtherMembersItems(MemberId, MemberType); } } }); } else { BindOtherMembersItems(MemberId, MemberType); } } else { BindOtherMembersItems(MemberId, MemberType); } retrievedData = localStorage.getItem("OtherMembersItems"); AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { if (AddedItems.length > 0) { for (var M = 0; M < AddedItems.length; M++) { if (AddedItems[M].GroupItems.length == 0) { //$(".Emptycart").css("display", "block"); //$(".cartitems").css("display", "none"); localStorage.removeItem("TotalItems"); } } } } SetOrderType(); MobileCArt(); document.getElementById("lblitemcount").innerHTML = itCount; $(".addcategoryloadingimage2").css("display", "none"); } } }); } } function InsertItemOnAdd(InsertItems, MemberId) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/InsertItemOnAdd", data: "{'Item': '" + JSON.stringify(InsertItems) + "','GroupId': '" + GroupId + "','MemberId': '" + MemberId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { GetAllItems(); } }); } } function DeleteItemOndelete(Id, MemberId, InsertItems) { $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/DeleteItemOndelete", data: "{'Id': '" + Id + "'}", dataType: "json", contentType: "application/json", success: function (msg) { InsertItemOnAdd(InsertItems, MemberId) } }); } function StartOrderValidation() { $("#txtshEmail").removeClass("reqruiredc"); $(".successmsg").text(""); $(".sendloader").css("display", "block"); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var Name = escape(document.getElementById('txtShUsername').value); if (Name != "") { $('#SharedUrlsPanel').css("display", "none"); var gExist = localStorage.getItem("GroupIdExist"); var GroupExist = JSON.parse(gExist); if (GroupExist != null && GroupExist != "") { var RealGroupId = GroupExist.GroupId; // var GroupId = GetgroupId(); if (GroupId == RealGroupId) { var lo = localStorage.getItem("GroupMemberType"); var MemberDetails = JSON.parse(lo); if (MemberDetails != null && MemberDetails != "") { if (RealGroupId == MemberDetails.GroupId) { GetAllItems(); $("#SharedUrlsPanel").fadeOut("fast"); $("#PnlMembersJoining").fadeOut("fast"); $("#sharegorder").css("display", "block"); } } else { InsertNewMember1("Admin", Name); } } else { InsertNewMember1("Admin", ''); //$("#SharedUrlsPanel").fadeIn("fast"); } } } else if (Name == "") { $("#txtShUsername").addClass("reqruiredc"); $(".sendloader").css("display", "none"); } else { $(".successmsg").text("Please enter your Name"); $(".sendloader").css("display", "none"); } } function Shareorderval() { $("#pnlgrouporder").fadeIn("slow"); $(".startorder").css("display", "none"); var pageURL = window.location; var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var GroupOrderType = Orderstring["GroupOrderType"]; var OrderId = Orderstring["OId"]; if (OrderId != null && OrderId != "" && OrderId != undefined) { if (GroupOrderType == "AdminReOrder") { var URL = window.location.href; URL = URL.replace("AdminReOrder","MemberReOrder"); document.getElementById('txtShUrl').value = URL; } else if (GroupOrderType == "MemberReOrder") { var URL = window.location.href; URL = URL.replace("MemberReOrder","MemberReOrder"); document.getElementById('txtShUrl').value = URL; } } else{ document.getElementById('txtShUrl').value = pageURL; } } function InsertNewMember1(MemberType, Name) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var GroupOrderType = Orderstring["GroupOrderType"]; var OrderId = Orderstring["OId"]; if (OrderId != null && OrderId != "" && OrderId != undefined) { if (GroupOrderType == "MemberReOrder") { if (GroupId != null || GroupId != "") { $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/InsertNewMember", data: "{'MemberType': '" + MemberType + "','GroupId': '" + GroupId + "','Name': '" + Name + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { //GetAllItems(); var Details = new Object; Details.MemberType = MemberType; Details.GroupId = GroupId; Details.MemberId = msg.d; Details.MemberName = Name; localStorage.setItem("GroupMemberType", JSON.stringify(Details)); if (MemberType == "Member") { document.getElementById("lblusertype").innerHTML = "Member"; var Details1 = new Object; Details1.MemberId = Details.MemberId; Details1.OrderStatus = "Adding"; localStorage.setItem("MemberOrderStatus", JSON.stringify(Details1)); } else { $("#sharegorder").css("display", "block"); } $(".sendloader").css("display", "none"); GetAllItems(); } } }); } }else{ //Do not create group member for reorder process } } else{ if (GroupId != null && GroupId != "" && GroupId != undefined) { if (GroupId != null || GroupId != "") { $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/InsertNewMember", data: "{'MemberType': '" + MemberType + "','GroupId': '" + GroupId + "','Name': '" + Name + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { //GetAllItems(); var Details = new Object; Details.MemberType = MemberType; Details.GroupId = GroupId; Details.MemberId = msg.d; Details.MemberName = Name; localStorage.setItem("GroupMemberType", JSON.stringify(Details)); if (MemberType == "Member") { document.getElementById("lblusertype").innerHTML = "Member"; var Details1 = new Object; Details1.MemberId = Details.MemberId; Details1.OrderStatus = "Adding"; localStorage.setItem("MemberOrderStatus", JSON.stringify(Details1)); } else { $("#sharegorder").css("display", "block"); } $(".sendloader").css("display", "none"); GetAllItems(); } } }); } } } } function DeleteIteminGroupOrder(Item) { var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberId; var MemberType; if (Details != null) { MemberId = Details.MemberId; MemberType = Details.MemberType; } var Orderstring = getQueryStrings(); var OrderId = Orderstring["OId"]; alertify.set({ labels: { ok: "Yes", cancel: "No" } }); alertify.confirm("Do you want to delete this item?", function (e) { if (e) { var GroupOStatus = "InComplete"; $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/CheckgroupStatusforMemberByMemberId", data: "{'GroupId': '" + GetgroupId() + "','MemberId' : '"+MemberId+"'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { var mes = new Array(); mes = msg.d.split("//"); if (mes[0] != "Completed" && mes[0] != "Placing") { var mos = localStorage.getItem("MemberOrderStatus"); var MemberOrderStatus = JSON.parse(mos); if (MemberOrderStatus != null) { if (MemberOrderStatus.OrderStatus == "Finished") { return; } } document.getElementById("lblorderfail").innerHTML = ""; LoadEditItemImage(); var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberId; if (Details != null) { MemberId = Details.MemberId; } var retrievedData = localStorage.getItem("OtherMembersItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { for (var M = 0; M < AddedItems.length; M++) { if (AddedItems[M].Id == MemberId) { var Id = ($(Item).attr("id")).replace("DeleteItem", ""); $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/DeleteItemOndelete", data: "{'Id': '" + Id + "'}", dataType: "json", contentType: "application/json", success: function (msg) { GetAllItems(); } }); } } } GetAllItems(); MobileCartDelete(); } else { alertify.error("Sorry this order has been placed."); return; } } else { alertify.error("Sorry this order has been placed."); return; } } }); } }); } function SharedUrlClose() { var lo = localStorage.getItem("GroupMemberType"); var MemberDetails = JSON.parse(lo); if (MemberDetails == null || MemberDetails == "") { var LocationId = document.getElementById('lblLId').value; if (LocationId != null && LocationId != "") { $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/CloseGroupOrder", data: "{'LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { $('#SharedUrlsPanel').css("display", "none"); $('#PnlMembersJoining').css("display", "none"); window.location.href = "../" + msg.d; } } }); } } else { $('#SharedUrlsPanel').css("display", "none"); $('#PnlMembersJoining').css("display", "none"); } } function SendLinkValidation() { $(".successmsg").text(""); $(".sendloader").css("display", "block"); var G = document.getElementById("ddlsharedtype"); var Type = G.options[G.selectedIndex].value; if (Type == "Email") { var emailExp = /^[A-Z0-9#-_~!$&()*+,;=:]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i; var email = escape(document.getElementById('txtshEmail').value) if (email.match(emailExp)) { SendLink(Type); } else { if (email == "") { $("#txtshEmail").addClass("reqruiredc"); $(".sendloader").css("display", "none"); } else { $(".successmsg").text("Please enter valid Email"); $(".sendloader").css("display", "none"); } } } else if (Type == "Phone") { var numberexp = /^\d{10}$/; var number = escape(document.getElementById('txtshEmail').value) if (number.match(numberexp)) { SendLink(Type); } else { if (number == "") { $("#txtshEmail").addClass("reqruiredc"); $(".sendloader").css("display", "none"); } else { $(".successmsg").text("Please enter valid Phone Number"); $(".sendloader").css("display", "none"); } } } } function SendLink(Type) { var message = ""; var CountryName = "US"; if (document.getElementById("lblCurrency").innerHTML != "$") { CountryName = "India"; } if (Type == "Email") { $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/SendGroupOrderEmail", data: "{'RName': '" + escape(document.getElementById('lblAppName').innerHTML) + "','Email': '" + escape(document.getElementById('txtshEmail').value) + "','Link': '" + escape(window.location.href) + "', 'message': '" + message + "', 'CountryName': '" + CountryName + "'}", dataType: "json", contentType: "application/json", success: function (msg) { $(".sendloader").css("display", "none"); $(".successmsg").text("Successfully shared"); } }); } else if (Type == "Phone") { $.ajax({ type: 'get', url: '//freegeoip.net/json/', dataType: "json", cache: "false", jsonpCallback: "onJSONPLoad", success: function (location) { var CountryName = location.country_name; $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/SendGroupOrderSMS", data: "{'RName': '" + escape(document.getElementById('lblAppName').innerHTML) + "','PhoneNum': '" + escape(document.getElementById('txtshEmail').value) + "','Link': '" + escape(window.location.href) + "', 'CountryName': '" + CountryName + "', 'message': '" + message + "'}", dataType: "json", contentType: "application/json", success: function (msg) { $(".sendloader").css("display", "none"); $(".successmsg").text("Successfully shared"); } }); }, error: function () { var CountryName = "US"; $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/SendGroupOrderSMS", data: "{'RName': '" + escape(document.getElementById('lblAppName').innerHTML) + "','PhoneNum': '" + escape(document.getElementById('txtshEmail').value) + "','Link': '" + escape(window.location.href) + "', 'CountryName': '" + CountryName + "', 'message': '" + message + "'}", dataType: "json", contentType: "application/json", success: function (msg) { $(".sendloader").css("display", "none"); $(".successmsg").text("Successfully shared"); } }); } }); } } function FinishedAddingofItems(OrderStatus) { var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); if (Details != null) { var retrievedData = localStorage.getItem("OtherMembersItems"); $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/CheckMemberItemsAvailability", data: "{'retrievedData': '" + retrievedData + "','MemberId': '" + Details.MemberId + "','GroupId': '" + Details.GroupId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (OrderStatus == "Finished") { if (msg.d[0].Ids != "" || msg.d[1].Ids != "" || msg.d[2].Ids != "") { if (msg.d[0].Ids != "") { var CheckedID = msg.d[0].Ids.split(','); for (var K = 0; K < CheckedID.length; K++) { var Available1 = $("#tblOthersCart").find("span#" + "EditItem" + CheckedID[K]); Available1.css("color", "red"); } alertify.error("Some of the items in your cart are not available"); $(".userdeliveryloader2").css("display", "none"); return; } else if (msg.d[1].Ids != "") { var CheckedID = msg.d[1].Ids.split(','); for (var K = 0; K < CheckedID.length; K++) { var Available1 = $("#tblOthersCart").find("span#" + "EditItem" + CheckedID[K]); Available1.css("color", "red"); } alertify.error("Some of the items in your cart are inactive"); $(".userdeliveryloader2").css("display", "none"); return; } else if (msg.d[2].Ids != "") { var CheckedID = msg.d[2].Ids.split(','); for (var K = 0; K < CheckedID.length; K++) { var Available1 = $("#tblOthersCart").find("span#" + "EditItem" + CheckedID[K]); Available1.css("color", "red"); } var Type = ''; if (Type != "" && Type != null) { alertify.error("Some of the items in your cart are not available for " + Type); } else { alertify.error("Some of the items in your cart are not available"); } $(".userdeliveryloader2").css("display", "none"); return; } } } $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/FinishedAddingofItems", data: "{'MemberId': '" + Details.MemberId + "','OrderStatus': '" + OrderStatus + "'}", dataType: "json", contentType: "application/json", success: function (msg) { GetAllItems(); var Details = new Object; Details.MemberId = Details.MemberId; Details.OrderStatus = OrderStatus; localStorage.setItem("MemberOrderStatus", JSON.stringify(Details)); if (OrderStatus == "Finished") { $("#btnFinishedAddingofItems").attr("onclick", "FinishedAddingofItems('Editing');"); $("#btnFinishedAddingofItems").attr("value", "Make Changes"); } else { $("#btnFinishedAddingofItems").attr("onclick", "FinishedAddingofItems('Finished');"); $("#btnFinishedAddingofItems").attr("value", "Done"); } } }); } }); } } function InsertOrderConfirmation() { var NewTotal = document.getElementById("lbltotalamount").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); var total = localStorage.getItem("GroupOTotal"); var sAmount = JSON.parse(total); if (sAmount != null) { if (sAmount.Total == NewTotal) { GroupOrderStatus(); } else { if ($('#rbtShipping').is(':checked')) { AddShippingItemstoPanel(); document.getElementById("lblsubtotaldelivery").innerHTML = document.getElementById("lblAlltotalprice").innerHTML; document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lbltaxConven").innerHTML; document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lbldelivaryfee").innerHTML; } else { AddItemstoPanelingrouporder(); document.getElementById("lblsubtotaldelivery").innerHTML = document.getElementById("lblAlltotalprice").innerHTML; document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lbltaxConven").innerHTML; document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lbldelivaryfee").innerHTML; document.getElementById("lblUserMileageCharge").innerHTML = document.getElementById("lblMileageCharge").innerHTML; } alert("SomeOne Added/Deleted items to the cart."); document.getElementById("lblorderfail").innerHTML = ""; $('.userdeliveryloader').css("display", "none"); } } } function GroupOrderStatus() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/GetGroupOrderStatus", data: "{'GroupId': '" + GroupId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "0") { document.getElementById("lblorderfail").innerHTML = "InsertOrder"; BindPricesinGrouporder(); } else { $(".grouplaceorderalert").fadeIn(); } } }); } } function BindCartItems() { var OrderType = localStorage.getItem("GroupOrderType"); GetAllItems(); BindPricesinGrouporder(); } function CheckOrderType() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/CheckOrderType", data: "{'GroupId': '" + GroupId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "" && msg.d != null) { var OrderType = msg.d; localStorage.removeItem("GroupOrderType"); if (msg.d != null && msg.d != "") { localStorage.setItem("GroupOrderType", OrderType); } if (OrderType == "Delivery") { document.getElementById("rbtdelivery").checked = true; document.getElementById("rbtpickup").checked = false; } else if (OrderType == "Shipping") { if($("#rbtShipping").length > 0){ document.getElementById("rbtShipping").checked = true; } document.getElementById("rbtdelivery").checked = false; document.getElementById("rbtpickup").checked = false; } else { document.getElementById("rbtdelivery").checked = false; document.getElementById("rbtpickup").checked = true; } } } }); } } function EditItemOptionsinGroupOrder(ItemOption) { var ItemId = $(ItemOption.parentNode.parentNode).attr("id"); var Orderstring = getQueryStrings(); var OrderId = Orderstring["OId"]; //start Item Nutritions calling $(".nutritiontable1").fadeOut("fast"); $(".nutritiontable").fadeOut("fast"); Ninvisible(); GetItemNutrition(ItemId); $(".btnloaderdiv").css("display", "none"); $(".addtocartdiv").css("display", "block"); //End Item Nutritions calling var GroupOStatus = "InComplete"; var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberId; var MemberType; if (Details != null) { MemberId = Details.MemberId; MemberType = Details.MemberType; } $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/CheckgroupStatusforMemberByMemberId", data: "{'GroupId': '" + GetgroupId() + "','MemberId' : '"+MemberId+"'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { var mes = new Array(); mes = msg.d.split("//"); //if (mes[1] != null && mes[1] != "") { //MEMBERItemsCheck(mes[1]); //} if (mes[0] != "Completed" && mes[0] != "Placing") { var mos = localStorage.getItem("MemberOrderStatus"); var MemberOrderStatus = JSON.parse(mos); if (MemberOrderStatus != null) { if (MemberOrderStatus.OrderStatus == "Finished") { return; } } document.getElementById("lblorderfail").innerHTML = ""; var Id = $(ItemOption).attr("id"); document.getElementById("EditItemNum").innerHTML = Id; LoadEditItemImage(); document.getElementById('OptionTable').innerHTML = ""; //var ItemId = $(ItemOption.parentNode.parentNode).attr("id"); document.getElementById("lblItemType").innerHTML = "EditItem"; LoadItemOptionsinGroupOrder(ItemOption); } else { alertify.error("Sorry this order has been placed."); return; } } else { alertify.error("Sorry this order has been placed."); return; } } }); } function MEMBERItemsCheck(Type) { var orderType = ''; if (orderType != null && orderType != "") { if (Type != orderType) { var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); if (Details != null) { var retrievedData = localStorage.getItem("OtherMembersItems"); $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/CheckMemberItemsAvailability", data: "{'retrievedData': '" + retrievedData + "','MemberId': '" + Details.MemberId + "','GroupId': '" + Details.GroupId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d[0].Ids != "" || msg.d[1].Ids != "" || msg.d[2].Ids != "") { if (msg.d[0].Ids != "") { var CheckedID = msg.d[0].Ids.split(','); for (var K = 0; K < CheckedID.length; K++) { var Available1 = $("#tblOthersCart").find("span#" + "EditItem" + CheckedID[K]); Available1.css("color", "red"); } alertify.error("Some of the items in your cart are not available"); $(".userdeliveryloader2").css("display", "none"); return; } else if (msg.d[1].Ids != "") { var CheckedID = msg.d[1].Ids.split(','); for (var K = 0; K < CheckedID.length; K++) { var Available1 = $("#tblOthersCart").find("span#" + "EditItem" + CheckedID[K]); Available1.css("color", "red"); } alertify.error("Some of the items in your cart are inactive"); $(".userdeliveryloader2").css("display", "none"); return; } else if (msg.d[2].Ids != "") { var CheckedID = msg.d[2].Ids.split(','); for (var K = 0; K < CheckedID.length; K++) { var Available1 = $("#tblOthersCart").find("span#" + "EditItem" + CheckedID[K]); Available1.css("color", "red"); } if (mes[1] != null && mes[1] != "") { alertify.error("Some of the items in your cart are not available for " + Type); } else { alertify.error("Some of the items in your cart are not available"); } $(".userdeliveryloader2").css("display", "none"); return; } } } }); } } } } function AddItemstoCartinGrouporder(OptionsCheck) { var OrderType = localStorage.getItem("GroupOrderType"); document.getElementById("additemserror").innerHTML = ""; var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var Price = 0; var CustomTax = 0; var TaxLabel = ""; var totalprice = 0; var Itemdetails = document.getElementById("lblItemId").innerHTML.split('//'); var SubcategoryId = "00000000-0000-0000-0000-000000000000"; var SubSubcategoryId = "00000000-0000-0000-0000-000000000000"; var ItemCategoryId = "00000000-0000-0000-0000-000000000000"; var CategoryId = "00000000-0000-0000-0000-000000000000"; $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/GetItemOptions", data: "{'ItemId': '" + Itemdetails[0] + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { Price = msg.d[0].Price; CustomTax = msg.d[0].CustomTax; TaxLabel = escape(msg.d[0].TaxLabel); SubcategoryId = msg.d[0].SubCategoryId; SubSubcategoryId = msg.d[0].SubSubCategoryId; ItemCategoryId = msg.d[0].ItemMainCategoryId; CategoryId = msg.d[0].CategoryId; } var d = 0; if ($('#rbtShipping').is(':checked')) { ///Recalculating ItemPrice before adding to cart for (var i = 1; i < msg.d.length; i++) { if (document.getElementById(msg.d[i].Id).checked) { d = +msg.d[i].Price + +d; } } d = +d + +Price; totalprice = (document.getElementById('txtquantity').value * d); totalprice = totalprice.toFixed(2); if (totalprice != "0.00") { var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); var Items = new Array(); var Item = new Object; Item.Id = createGuid(); Item.ItemName = escape(Itemdetails[1]); Item.ItemId = Itemdetails[0]; Item.Instructions = escape(document.getElementById('txtinstructions').value); Item.Quantity = document.getElementById('txtquantity').value; Item.Price = totalprice; Item.LId = document.getElementById('lblLId').value; Item.CategoryId = msg.d[0].CategoryId; Item.AddedDate = new Date(); Item.NoSalesTax = document.getElementById('lblItemNoTax').innerHTML; Item.CustomTax = document.getElementById("lblCustomTax").innerHTML; Item.TaxLabel = document.getElementById("lblTaxLabel").innerHTML; Item.BasePrice = parseFloat((document.getElementById("PriceVal").innerHTML) * (document.getElementById('txtquantity').value)).toFixed(2); document.getElementById('txtinstructions').value = ""; var OrderType = localStorage.getItem("GroupOrderType"); Item.OrderType = OrderType; Item.AppName = escape(document.getElementById('lblAppName').innerHTML); Item.MainCategoryId = CategoryId; Item.ItemCategoryId = ItemCategoryId; Item.SubcategoryId = SubcategoryId; Item.SubSubCategoryId = SubSubcategoryId; Item.Choices = new Array(); for (var J = 1; J < msg.d.length; J++) { if ($('#' + msg.d[J].Id).is(':checked')) { var Choice = new Object; Choice.ShippingOptionId = msg.d[J].Id; Choice.ItemId = msg.d[J].ItemId; Choice.Measurement = msg.d[J].Measurement; Choice.Price = msg.d[J].Price; Choice.Weight = msg.d[J].Weight; var Weight = 0; if (Choice.Measurement == "gm") { Weight = +Weight + +(Choice.Weight / 1000); } else if (Choice.Measurement == "Pounds") { Weight = +Weight + +(Choice.Weight / 2.20462); } else { Weight = +Weight + +Choice.Weight; } Weight = Weight * Item.Quantity; Weight = Weight.toFixed(2); Weight = Weight + " kg"; Choice.Conversation = Weight; Item.Choices.push(Choice); } } Items.push(Item); } else { $(".btnaddtocart").css("display", "block"); alertify.error("This item is not selectable. Please choose other items."); } } else { ///Recalculating ItemPrice before adding to cart for (var J = 0; J < OptionsCheck.length; J++) { if (document.getElementById("lblitemflowtype").innerHTML == "true") { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if ($('#' + OptionsCheck[J].Choices[F].Id).hasClass("Validate")){ d = +OptionsCheck[J].Choices[F].Price + +d; if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { d = +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { d = +OptionsCheck[J].Choices[F].Price + +d; if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { d = +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price + +d; } } } } } } } } } d = +d + +Price; var ddlvariation = $(".ddlVariation"); if (ddlvariation.length > 0) { if (ddlvariation[0].selectedIndex != 0) { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { d = (+Variations[J].Price + +d); } } } } } totalprice = (document.getElementById('txtquantity').value * d); totalprice = totalprice.toFixed(2); if (totalprice != "0.00") { $(".bntfnshedord").css("style", "display:block"); var Item = new Object; Item.Id = createGuid(); Item.ItemName = escape(Itemdetails[1]); Item.ItemId = Itemdetails[0]; Item.NoSalesTax = document.getElementById('lblItemNoTax').innerHTML; Item.CustomTax = document.getElementById("lblCustomTax").innerHTML; Item.TaxLabel = document.getElementById("lblTaxLabel").innerHTML; Item.Instructions = escape(document.getElementById('txtinstructions').value); Item.Quantity = document.getElementById('txtquantity').value; Item.Price = totalprice; Item.LId = document.getElementById('lblLId').value; document.getElementById('txtinstructions').value = ""; var OrderType = localStorage.getItem("GroupOrderType"); if (localStorage.getItem("priceType") == "Per Unit") { Item.ItemUnitQty = document.getElementById('txtunitquantity').value; Item.PriceType = localStorage.getItem("priceType"); Item.UnitName = localStorage.getItem("UnitType"); } Item.CategoryId = msg.d[0].CategoryId; Item.AddedDate = new Date(); Item.BasePrice = parseFloat((document.getElementById("PriceVal").innerHTML) * (document.getElementById('txtquantity').value)).toFixed(2); document.getElementById('txtinstructions').value = ""; var OrderType = localStorage.getItem("GroupOrderType"); Item.OrderType = OrderType; Item.AppName = escape(document.getElementById('lblAppName').innerHTML); Item.MainCategoryId = CategoryId; Item.ItemCategoryId = ItemCategoryId; Item.SubcategoryId = SubcategoryId; Item.SubSubCategoryId = SubSubcategoryId; Item.Choices = new Array(); for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Type != "Multiline Textbox") { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { var Choice = new Object; Choice.Id = OptionsCheck[J].Choices[F].Id; Choice.OptionId = OptionsCheck[J].Id; Choice.OptionName = escape(OptionsCheck[J].Name); Choice.ChoiceName = escape(OptionsCheck[J].Choices[F].Name); Choice.Notify = (OptionsCheck[J].Choices[F].Notify); Choice.DefaultVSOption = (OptionsCheck[J].Choices[F].DefaultVSOption); Choice.ChildChoices = new Array(); if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Multiline Textbox" && OptionsCheck[J].Choices[F].ChildOptions[L].Type != "Dropdown") { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if ($('#' + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id).is(':checked')) { var ChildChoice = new Object; ChildChoice.Id = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify); ChildChoice.DefaultVSOption = (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption); Choice.ChildChoices.push(ChildChoice); } } } else if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Multiline Textbox") { var ChildChoice = new Object; ChildChoice.Id = ""; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); if (document.getElementById(ChildChoice.OptionId).value != "") { ChildChoice.ChoiceName = escape(document.getElementById(ChildChoice.OptionId).value); Choice.ChildChoices.push(ChildChoice); } } else { var ChildChoice = new Object; ChildChoice.OptionId = OptionsCheck[J].Choices[F].ChildOptions[L].Id ChildChoice.OptionName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Name); ChildChoice.DefaultOptionText = escape(OptionsCheck[J].Choices[F].ChildOptions[L].DefaultOptionText); ChildChoice.Type = OptionsCheck[J].Choices[F].ChildOptions[L].Type; if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() != "") { ChildChoice.Id = $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val().split('/')[0]; for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (ChildChoice.Id == OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id) { ChildChoice.ChoiceName = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Name); ChildChoice.Notify = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; ChildChoice.DefaultVSOption = OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].DefaultVSOption; ChildChoice.Price = escape(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Price); Choice.ChildChoices.push(ChildChoice); } } } } } } } Item.Choices.push(Choice); } } } else { var Choice = new Object; Choice.Id = ""; Choice.OptionId = OptionsCheck[J].Id; Choice.Notify = OptionsCheck[J].Notify; Choice.DefaultVSOption = OptionsCheck[J].DefaultVSOption; Choice.OptionName = escape(OptionsCheck[J].Name); if (document.getElementById(Choice.OptionId).value != "") { Choice.ChoiceName = escape(document.getElementById(Choice.OptionId).value); Item.Choices.push(Choice); } } } //variations Item.Variations = new Array(); var ddlvariation = $(".ddlVariation"); if (ddlvariation != undefined) { if (ddlvariation.length > 0) { var ItemVariations = localStorage.getItem("ItemVariation"); if (ItemVariations != null) { Variations = JSON.parse(ItemVariations); for (var J = 0; J < Variations.length; J++) { if (Variations[J].Id == ddlvariation[0].value) { var Variation = new Object; Variation.Id = Variations[J].Id; Variation.ItemId = Variations[J].ItemId; Variation.ItemName = Variations[J].Name; Variation.Price = Variations[J].Price; Variation.GroupId = GroupId; Item.Variations.push(Variation); } } } } } //AddItemstoPanelingrouporder(); } else { $(".btnaddtocart").css("display", "block"); alertify.error("This item is not selectable. Please choose other items."); } } var InsertItems = new Array(); InsertItems.push(Item); var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberId; var MemberType; if (Details != null) { MemberId = Details.MemberId; MemberType = Details.MemberType; } if (document.getElementById("lblItemType").innerHTML == "AddItem") { InsertItemOnAdd(InsertItems, MemberId); localStorage.setItem("OtherMembersItems", JSON.stringify(Item)); localStorage.setItem("TotalItems", JSON.stringify(Item)); } else if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Id = document.getElementById("EditItemNum").innerHTML.replace("EditItem", ""); //localStorage.setItem("OtherMembersItems", JSON.stringify(allItems)); //localStorage.setItem("TotalItems", JSON.stringify(allItems)); var retrievedData = localStorage.getItem("OtherMembersItems"); var AddedItems = JSON.parse(retrievedData); if (MemberType == "Admin") { if (AddedItems != null) { for (var M = 0; M < AddedItems.length; M++) { for (var Itemcount = 0; Itemcount < AddedItems[M].GroupItems.length; Itemcount++) { if (AddedItems[M].GroupItems[Itemcount].Id == Id) { DeleteItemOndelete(AddedItems[M].GroupItems[Itemcount].Id, AddedItems[M].Id, InsertItems); } } } } } else { if (AddedItems != null) { for (var M = 0; M < AddedItems.length; M++) { if (AddedItems[M].Id == MemberId) { DeleteItemOndelete(Id, MemberId, InsertItems); } } } } } $(".displayonitem").css("display", "block"); $(".yourordersteststyles").css("display", "block"); document.getElementById("displayMultipleImages").innerHTML = ""; $("#grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } $("body").removeClass("fullpanel"); GetDealinGroupOrder(); } }); } function createGuid() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); } function BindPricesinGrouporder() { var Pri = 0; var Taxes = 0; var ItemTaxes = 0; var CPrice = 0; var totaltip = 0; var deliveryfee = 0; var MileageCharge = 0; var Ctype = 0; var PromoAmount = document.getElementById("Promoprice").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); var UId = document.getElementById("UserId").innerHTML; PromoAmount = PromoAmount.replace("-", ""); if ($('#rbtShipping').is(':checked')) { var Shippingfee = 0; var Commission = 0; var TotalWeight = 0; var Measurement = 0; $(".notefordelivery").css("display", "none"); $('.Deliverto').css("display", "block"); $('.cssdelivery').fadeOut("slow"); var OtherMembersItems = localStorage.getItem("OtherMembersItems"); var OtherItems = JSON.parse(OtherMembersItems); if (OtherItems != null) { for (var M = 0; M < OtherItems.length; M++) { for (var I = 0; I < OtherItems[M].GroupItems.length; I++) { Pri = +Pri + +OtherItems[M].GroupItems[I].Price; var Weight = 0; if (OtherItems[M].GroupItems[I].OrderType == "Shipping") { if (OtherItems[M].GroupItems[I].Measurement == "gm") { Weight = +Weight + +(OtherItems[M].GroupItems[I].ItemWeight / 1000); } else if (OtherItems[M].GroupItems[I].Measurement == "Pounds") { Weight = +Weight + +(OtherItems[M].GroupItems[I].ItemWeight / 2.20462); } else { Weight = +Weight + +OtherItems[M].GroupItems[I].ItemWeight; } Weight = Weight * OtherItems[M].GroupItems[I].Quantity; Weight = Weight.toFixed(2); TotalWeight = +TotalWeight + +Weight; } } } TotalWeight = TotalWeight.toFixed(2); if (document.getElementById("TotalWeight").innerHTML != null) { document.getElementById("TotalWeight").innerHTML = TotalWeight + " kgs"; } document.getElementById("lblAlltotalprice").innerHTML = document.getElementById("lblCurrency").innerHTML + Pri.toFixed(2); document.getElementById("lblsubtotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + Pri.toFixed(2); if (document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") != "") { Taxes = (Pri * document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "")) / 100; Taxes = Taxes.toFixed(2); document.getElementById("lbltaxes").innerHTML = document.getElementById("lblCurrency").innerHTML + Taxes; document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + Taxes; } else { document.getElementById("lbltaxes").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; } if (document.getElementById("Conveniencelbl").innerHTML != 0) { if (document.getElementById("lblConvType").innerHTML != null) { Ctype = document.getElementById("lblConvType").innerHTML; } if (~Ctype.indexOf("Amount")) { CPrice = document.getElementById("Conveniencelbl").innerHTML; } else { CPrice = ((Pri * document.getElementById("Conveniencelbl").innerHTML) / 100); CPrice = CPrice.toFixed(2); } } Pri = Pri - PromoAmount; if (document.getElementById("AwardPoint").innerHTML != "") { if (UId != "" && UId != null) { var ItemsAmount = Pri; var Award = document.getElementById("AwardPoint").innerHTML; var FirstOrderType = document.getElementById("Firstorder").innerHTML; var TotalAwards = 0; //if (FirstOrderType == "FirstOrder") { // TotalAwards = Award; //} //else { TotalAwards = ((ItemsAmount * Award) / 100) * 100; //} var Ta = Math.round(TotalAwards); Ta=Ta.replace(".00", ""); document.getElementById("lblearnedpoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; //document.getElementById("lblmunchiespoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; var munchiespoint = Ta + " " + document.getElementById("lblAwardType").innerHTML; if (munchiespoint != "") { $("#munchiespoints").css("display", "block"); document.getElementById("lblmunchiespoints").innerHTML = munchiespoint; } else { $("#munchiespoints").css("display", "none"); } } else { MunchiesInfoforuser(Pri); } // UserMuncheiscount(); } else { MunchiesInfoforuser(Pri); } TaxItemsPrice = Taxes; var TotalPrice = +Pri + +Taxes + +CPrice; var TotalPriceforPromo = +Pri + +Taxes + +CPrice; if (document.getElementById("Conveniencelbl").innerHTML != 0) { var taxwithconv = +Taxes + +CPrice; if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text("Tax + Svc"); } if (document.getElementById("lbltaxConven").innerHTML != null) { document.getElementById("lbltaxConven").innerHTML = document.getElementById("lblCurrency").innerHTML + taxwithconv.toFixed(2); } document.getElementById("lblbconvenience").innerHTML = document.getElementById("lblCurrency").innerHTML + CPrice; // document.getElementById("lblguestdeliverytax").innerHTML = document.getElementById("lblCurrency").innerHTML + taxwithconv.toFixed(2); document.getElementById("lblTaxdelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + taxwithconv.toFixed(2); } else { if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text("Tax"); } if (document.getElementById("lbltaxConven").innerHTML != null) { document.getElementById("lbltaxConven").innerHTML = document.getElementById("grplbltaxes").innerHTML; } } document.getElementById("lblMileageCharge").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("lbldelivaryfeetextlbl").style.display = "block"; document.getElementById("lbltaxes").style.display = "none"; document.getElementById("lbldelivaryfeetextlbl").innerHTML = "Shipping"; if ($(".Chtext").text() != null) { $(".Chtext").text("Shipping"); } if (document.getElementById("lblShCountry").innerHTML != null) { var Country = document.getElementById("lblShCountry").innerHTML; } if (Country != "") { $.ajax({ type: "POST", url: "Orders.aspx/GetShippingPricesByCountry", data: "{ 'Country': '" + Country + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { Shippingfee = 1.3 * (msg.d[0].MinShippingAmt + +(msg.d[0].RatePerKg * TotalWeight)); Shippingfee = parseFloat(Shippingfee); Commission = (30 * Shippingfee) / 100; Shippingfee = Shippingfee + +Commission.toFixed(2); document.getElementById("lbldelivaryfee").innerHTML = document.getElementById("lblCurrency").innerHTML + Shippingfee.toFixed(2); $('.notefordelivery').fadeOut("slow"); $('#lbldelivaryfee').fadeIn("slow"); $('#lbldelivaryfee').parents('td').addClass("guuesttotal2"); TotalPrice = +TotalPrice + +Shippingfee; document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + Shippingfee.toFixed(2); document.getElementById("lbldelivaryfee").innerHTML = document.getElementById("lblCurrency").innerHTML + Shippingfee.toFixed(2); document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); if (document.getElementById("TipValue").innerHTML != "") { var value = document.getElementById("TipValue").innerHTML; if (parseFloat(value.replace("%", "")) > 0) { if (~value.indexOf("%")) { value = value.replace("%", ""); totaltip = (value * Pri) / 100; totaltip = totaltip.toFixed(2); } else { totaltip = value; } } TotalPrice = TotalPrice + +parseFloat(totaltip); document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + totaltip; document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + totaltip; $('.tipEnable').css("display", "inline-table"); } else { document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; } if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML == "") { if (document.getElementById("lblorderfail").innerHTML == "TotalCheck") { InsertOrderConfirmation(); } else if (document.getElementById("lblorderfail").innerHTML == "InsertOrder") { InsertOrderInGroupOrder(); } } else if (document.getElementById("lblorderfail").innerHTML == "InsertOrder") { InsertOrderInGroupOrder(); } } $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage2").css("display", "none"); } } }); } else { document.getElementById("lbluserdelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("lbldelivaryfee").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } } } else if ($('#rbtdelivery').is(':checked')) { var OtherMembersItems = localStorage.getItem("OtherMembersItems"); var OtherItems = JSON.parse(OtherMembersItems); if (OtherItems != null) { for (var M = 0; M < OtherItems.length; M++) { for (var I = 0; I < OtherItems[M].GroupItems.length; I++) { Pri = +Pri + +OtherItems[M].GroupItems[I].Price; } } } document.getElementById("lblAlltotalprice").innerHTML = document.getElementById("lblCurrency").innerHTML + Pri.toFixed(2); if (Pri.toFixed(2) == "0.00") { document.getElementById("lbldelivaryfeetextlbl").style.display = "block"; document.getElementById("lbldelivaryfee").style.display = "block"; document.getElementById("lbldelivaryfee").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("lbltaxes").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; // document.getElementById("lblbconvenience").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; if (document.getElementById("lbltaxConven").innerHTML != null) { document.getElementById("lbltaxConven").innerHTML = document.getElementById("lbltaxes").innerHTML; } if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text("Tax + Svc"); } return; } if (document.getElementById("Conveniencelbl").innerHTML != 0) { document.getElementById("lblbconvenience").innerHTML = document.getElementById("lblCurrency").innerHTML + CPrice; } if (document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") != "") { Taxes = (Pri * document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "")) / 100; Taxes = Taxes.toFixed(2); document.getElementById("lbltaxes").innerHTML = document.getElementById("lblCurrency").innerHTML + Taxes; } else { document.getElementById("lbltaxes").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; } if (document.getElementById("Conveniencelbl").innerHTML != 0) { if (document.getElementById("lblConvType").innerHTML != null) { Ctype = document.getElementById("lblConvType").innerHTML; } if (~Ctype.indexOf("Amount")) { CPrice = document.getElementById("Conveniencelbl").innerHTML; } else { CPrice = ((Pri * document.getElementById("Conveniencelbl").innerHTML) / 100); CPrice = CPrice.toFixed(2); } } Pri = Pri - PromoAmount; if (document.getElementById("AwardPoint").innerHTML != "") { if (UId != "" && UId != null) { var ItemsAmount = Pri; var Award = document.getElementById("AwardPoint").innerHTML; var FirstOrderType = document.getElementById("Firstorder").innerHTML; var TotalAwards = 0; //if (FirstOrderType == "FirstOrder") { // TotalAwards = Award; //} //else { TotalAwards = ((ItemsAmount * Award) / 100) * 100; //} var Ta = Math.round(TotalAwards); Ta=Ta.replace(".00", ""); document.getElementById("lblearnedpoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; //document.getElementById("lblmunchiespoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; var munchiespoint = Ta + " " + document.getElementById("lblAwardType").innerHTML; if (munchiespoint != "") { $("#munchiespoints").css("display", "block"); document.getElementById("lblmunchiespoints").innerHTML = munchiespoint; } else { $("#munchiespoints").css("display", "none"); } // UserMuncheiscount(); } else { MunchiesInfoforuser(Pri); } } else { MunchiesInfoforuser(Pri); } TaxItemsPrice = Taxes; if ($(".Chtext").text() != null) { $(".Chtext").text("Delivery"); } document.getElementById("lbldelivaryfeetextlbl").style.display = "block"; document.getElementById("lbldelivaryfeetextlbl").innerHTML = "Delivery"; $('.cssdelivery').fadeIn("slow"); document.getElementById("lbltaxes").style.display = "none"; $('.notefordelivery').fadeIn("slow"); $('#lbldelivaryfee').fadeIn("slow"); $('#lbldelivaryfee').css("float", "right"); $('#lbldelivaryfee').parents('td').addClass("guuesttotal2"); var Zone = localStorage.getItem("Zone"); var LocationId = document.getElementById('lblLId').value; var UserId = document.getElementById("UserId").innerHTML; var FirstOrder = ""; var OrderType = ""; $.ajax({ type: "POST", url: "Orders.aspx/GetUserFirstOrder", data: "{'UserId': '" + UserId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { FirstOrder = msg.d; $.ajax({ type: "POST", url: "Orders.aspx/ZoneDetailsByZoneId", data: "{'Zone': '" + Zone + "','LocationId': '" + LocationId + "','OrderType': '" + OrderType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0].appName != "Out Of the Zone") { document.getElementById("lblMileageCharge").style.display = "none"; document.getElementById("lblMileageChargelbl").style.display = "none"; if (Pri < msg.d[0].CertainAmount || msg.d[0].CertainAmount == 0) { deliveryfee = msg.d[0].DeliveryFee; deliveryfee = deliveryfee.toFixed(2); if (document.getElementById("lbldiscountdeliveryfee").innerHTML != null) { document.getElementById("lbldiscountdeliveryfee").innerHTML = deliveryfee; } } else { deliveryfee = "0.00"; } if (FirstOrder == "FirstOrder") { deliveryfee = "0.00"; } document.getElementById("lbldelivaryfee").innerHTML = document.getElementById("lblCurrency").innerHTML + deliveryfee; } else { deliveryfee = msg.d[0].DeliveryFee; deliveryfee = deliveryfee.toFixed(2); if (document.getElementById("lbldiscountdeliveryfee").innerHTML != null) { document.getElementById("lbldiscountdeliveryfee").innerHTML = deliveryfee; } if (FirstOrder == "FirstOrder") { deliveryfee = "0.00"; } document.getElementById("lbldelivaryfee").innerHTML = document.getElementById("lblCurrency").innerHTML + deliveryfee; var Miles = localStorage.getItem("Miles"); MileageCharge = msg.d[0].MileageCharge * Miles; MileageCharge = MileageCharge.toFixed(2); document.getElementById("lblMileageCharge").style.display = "block"; document.getElementById("lblMileageChargelbl").style.display = "block"; document.getElementById("lblMileageCharge").innerHTML = document.getElementById("lblCurrency").innerHTML + MileageCharge; } } var TotalPrice = ""; var TotalPrice = +Pri + +Taxes + +deliveryfee + +CPrice + +MileageCharge; var TotalPriceforPromo = +Pri + +Taxes + +CPrice; if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML != "") { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } else { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } } if (document.getElementById("TipValue").innerHTML != "") { var value = document.getElementById("TipValue").innerHTML; if (parseFloat(value.replace("%", "")) > 0) { if (~value.indexOf("%")) { value = value.replace("%", ""); totaltip = (value * Pri) / 100; totaltip = totaltip.toFixed(2); } else { totaltip = value; } } TotalPrice = TotalPrice + +parseFloat(totaltip); document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + totaltip; document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + totaltip; $('.tipEnable').css("display", "inline-table"); } else { document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; } $('.cclass').css("display", "none"); if (document.getElementById("Conveniencelbl").innerHTML != 0) { if (TotalPrice != "0") { var taxwithconv = +Taxes + +CPrice; if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text("Tax + Svc"); } if (document.getElementById("lbltaxConven").innerHTML != null) { document.getElementById("lbltaxConven").innerHTML = document.getElementById("lblCurrency").innerHTML + taxwithconv.toFixed(2); } document.getElementById("lblbconvenience").innerHTML = document.getElementById("lblCurrency").innerHTML + CPrice; } } else { if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text("Tax"); } if (document.getElementById("lbltaxConven").innerHTML != null) { document.getElementById("lbltaxConven").innerHTML = document.getElementById("lbltaxes").innerHTML; } } document.getElementById("lblTotalPriceforPromos").innerHTML = TotalPriceforPromo.toFixed(2); if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML != "") { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } else { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } } if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML != "") { // GetDeal(); document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } else { document.getElementById("lblTotaldelivery").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } } else { document.getElementById("lblTotaldelivery").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML == "") { if (document.getElementById("lblorderfail").innerHTML == "TotalCheck") { InsertOrderConfirmation(); } else if (document.getElementById("lblorderfail").innerHTML == "InsertOrder") { InsertOrderInGroupOrder(); } } else if (document.getElementById("lblorderfail").innerHTML == "InsertOrder") { InsertOrderInGroupOrder(); } } } }); } }); } else if ($('#rbtpickup').is(':checked')) { localStorage.removeItem("GroupOrderType"); localStorage.setItem("GroupOrderType", "PickUp"); $('.cssdelivery').fadeOut("slow"); var OtherMembersItems = localStorage.getItem("OtherMembersItems"); var OtherItems = JSON.parse(OtherMembersItems); if (OtherItems != null) { for (var M = 0; M < OtherItems.length; M++) { for (var I = 0; I < OtherItems[M].GroupItems.length; I++) { Pri = +Pri + +OtherItems[M].GroupItems[I].Price; } } } document.getElementById("lblAlltotalprice").innerHTML = document.getElementById("lblCurrency").innerHTML + Pri.toFixed(2); if (Pri.toFixed(2) == "0.00") { document.getElementById("lbltaxes").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; // document.getElementById("lblbconvenience").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; if (document.getElementById("lbltaxConven").innerHTML != null) { document.getElementById("lbltaxConven").innerHTML = document.getElementById("lbltaxes").innerHTML; } if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text("Tax"); } return; } if (document.getElementById("Conveniencelbl").innerHTML != 0) { document.getElementById("lblbconvenience").innerHTML = document.getElementById("lblCurrency").innerHTML + CPrice; } if (document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") != "") { Taxes = (Pri * document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "")) / 100; Taxes = Taxes.toFixed(2); document.getElementById("lbltaxes").innerHTML = document.getElementById("lblCurrency").innerHTML + Taxes; } else { document.getElementById("lbltaxes").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; } if (document.getElementById("Conveniencelbl").innerHTML != 0) { if (document.getElementById("lblConvType").innerHTML != null) { Ctype = document.getElementById("lblConvType").innerHTML; } if (~Ctype.indexOf("Amount")) { CPrice = document.getElementById("Conveniencelbl").innerHTML; } else { CPrice = ((Pri * document.getElementById("Conveniencelbl").innerHTML) / 100); CPrice = CPrice.toFixed(2); } } Pri = Pri - PromoAmount; if (document.getElementById("AwardPoint").innerHTML != "") { if (UId != "" && UId != null) { var ItemsAmount = Pri; var Award = document.getElementById("AwardPoint").innerHTML; var FirstOrderType = document.getElementById("Firstorder").innerHTML; var TotalAwards = 0; //if (FirstOrderType == "FirstOrder") { // TotalAwards = Award; //} //else { TotalAwards = ((ItemsAmount * Award) / 100) * 100; //} var Ta = Math.round(TotalAwards); Ta=Ta.replace(".00", ""); document.getElementById("lblearnedpoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; // document.getElementById("lblmunchiespoints").innerHTML = Ta + " " + document.getElementById("lblAwardType").innerHTML; var munchiespoint = Ta + " " + document.getElementById("lblAwardType").innerHTML; if (munchiespoint != "") { $("#munchiespoints").css("display", "block"); document.getElementById("lblmunchiespoints").innerHTML = munchiespoint; } else { $("#munchiespoints").css("display", "none"); } // UserMuncheiscount(); } else { MunchiesInfoforuser(Pri); } } else { MunchiesInfoforuser(Pri); } TaxItemsPrice = Taxes; var TotalPrice = +Pri + +Taxes + +CPrice; $('.cclass').css("display", "none"); if (document.getElementById("Conveniencelbl").innerHTML != 0) { if (TotalPrice != "0") { var taxwithconv = +Taxes + +CPrice; if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text("Tax + Svc"); } if (document.getElementById("lbltaxConven").innerHTML != null) { document.getElementById("lbltaxConven").innerHTML = document.getElementById("lblCurrency").innerHTML + taxwithconv.toFixed(2); } document.getElementById("lblbconvenience").innerHTML = document.getElementById("lblCurrency").innerHTML + CPrice; TotalPrice = 0; } } else { if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text("Tax"); } if (document.getElementById("lbltaxConven").innerHTML != null) { document.getElementById("lbltaxConven").innerHTML = document.getElementById("lbltaxes").innerHTML; } } TaxItemsPrice = Taxes; var TotalPrice = +Pri + +Taxes + +CPrice; if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML != "") { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } else { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } } if (document.getElementById("TipValue").innerHTML != "") { var value = document.getElementById("TipValue").innerHTML; if (parseFloat(value.replace("%", "")) > 0) { if (~value.indexOf("%")) { value = value.replace("%", ""); totaltip = (value * Pri) / 100; totaltip = totaltip.toFixed(2); } else { totaltip = value; } } TotalPrice = TotalPrice + +parseFloat(totaltip); document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + totaltip; document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + totaltip; $('.tipEnable').css("display", "inline-table"); } else { document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; } document.getElementById("lblTotalPriceforPromos").innerHTML = TotalPrice.toFixed(2); if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML != "") { // GetDeal(); document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } else { $('.bntSubmitCoupon').css("display", "none"); document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lbltotalamount").innerHTML; } } else { document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lbltotalamount").innerHTML; } $('.notefordelivery').css("display", "none"); document.getElementById("lbldelivaryfee").style.display = "none"; document.getElementById("lbldelivaryfeetextlbl").style.display = "none"; document.getElementById("lbltaxes").style.display = "none"; document.getElementById("lblMileageCharge").style.display = "none"; document.getElementById("lblMileageChargelbl").style.display = "none"; $('#lbldelivaryfee').parents('td').removeClass("guuesttotal2"); if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML == "") { if (document.getElementById("lblorderfail").innerHTML == "TotalCheck") { InsertOrderConfirmation(); } else if (document.getElementById("lblorderfail").innerHTML == "InsertOrder") { InsertOrderInGroupOrder(); } } else if (document.getElementById("lblorderfail").innerHTML == "InsertOrder") { InsertOrderInGroupOrder(); } } } else { $('.cssdelivery').fadeOut("slow"); var OtherMembersItems = localStorage.getItem("OtherMembersItems"); localStorage.setItem("TotalItems", OtherMembersItems); var OtherItems = JSON.parse(OtherMembersItems); if (OtherItems != null) { for (var M = 0; M < OtherItems.length; M++) { for (var I = 0; I < OtherItems[M].GroupItems.length; I++) { Pri = +Pri + +OtherItems[M].GroupItems[I].Price; } } } document.getElementById("lblAlltotalprice").innerHTML = document.getElementById("lblCurrency").innerHTML + Pri.toFixed(2); if (Pri.toFixed(2) == "0.00") { document.getElementById("lbltaxes").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; // document.getElementById("lblbconvenience").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; if (document.getElementById("lbltaxConven").innerHTML != null) { document.getElementById("lbltaxConven").innerHTML = document.getElementById("lbltaxes").innerHTML; } if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text("Tax"); } return; } if (document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") != "") { Taxes = (Pri * document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "")) / 100; Taxes = Taxes.toFixed(2); document.getElementById("lbltaxes").innerHTML = document.getElementById("lblCurrency").innerHTML + Taxes; } else { document.getElementById("lbltaxes").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; } $('.cclass').css("display", "none"); if (document.getElementById("Conveniencelbl").innerHTML != 0) { if (document.getElementById("lblConvType").innerHTML != null) { Ctype = document.getElementById("lblConvType").innerHTML; } if (~Ctype.indexOf("Amount")) { CPrice = document.getElementById("Conveniencelbl").innerHTML; } else { CPrice = ((Pri * document.getElementById("Conveniencelbl").innerHTML) / 100); CPrice = CPrice.toFixed(2); } } Pri = Pri - PromoAmount; TaxItemsPrice = Taxes; var TotalPrice = +Pri + +Taxes + +CPrice; if (document.getElementById("Conveniencelbl").innerHTML != 0) { if (TotalPrice != "0") { var taxwithconv = +Taxes + +CPrice; if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text("Tax + Svc"); } if (document.getElementById("lbltaxConven").innerHTML != null) { document.getElementById("lbltaxConven").innerHTML = document.getElementById("lblCurrency").innerHTML + taxwithconv.toFixed(2); } document.getElementById("lblbconvenience").innerHTML = document.getElementById("lblCurrency").innerHTML + CPrice; TotalPrice = 0; } } else { if (document.getElementById("lblCountry").innerHTML == "India") { $(".Typetax").text("GST"); } else { $(".Typetax").text("Tax"); } if (document.getElementById("lbltaxConven").innerHTML != null) { document.getElementById("lbltaxConven").innerHTML = document.getElementById("lbltaxes").innerHTML; } } TaxItemsPrice = Taxes; var TotalPrice = +Pri + +Taxes + +CPrice; if (document.getElementById("TipValue").innerHTML != "") { var value = document.getElementById("TipValue").innerHTML; if (parseFloat(value.replace("%", "")) > 0) { if (~value.indexOf("%")) { value = value.replace("%", ""); totaltip = (value * Pri) / 100; totaltip = totaltip.toFixed(2); } else { totaltip = value; } } TotalPrice = TotalPrice + +parseFloat(totaltip); document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + totaltip; document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + totaltip; $('.tipEnable').css("display", "inline-table"); } else { document.getElementById("WTip").innerHTML = document.getElementById("lblCurrency").innerHTML + "0.00"; document.getElementById("txttip").value = document.getElementById("lblCurrency").innerHTML + "0.00"; } if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML != "") { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } else { document.getElementById("lblTotalPrices").innerHTML = ""; document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotalPrices").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } } document.getElementById("lblTotalPriceforPromos").innerHTML = TotalPrice.toFixed(2); if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML != "") { // GetDeal(); document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); } else { $('.bntSubmitCoupon').css("display", "none"); document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lbltotalamount").innerHTML; } } else { document.getElementById("lbltotalamount").innerHTML = document.getElementById("lblCurrency").innerHTML + TotalPrice.toFixed(2); document.getElementById("lblTotaldelivery").innerHTML = document.getElementById("lbltotalamount").innerHTML; } $('.notefordelivery').css("display", "none"); document.getElementById("lbldelivaryfee").style.display = "none"; document.getElementById("lbldelivaryfeetextlbl").style.display = "none"; document.getElementById("lbltaxes").style.display = "none"; document.getElementById("lblMileageCharge").style.display = "none"; document.getElementById("lblMileageChargelbl").style.display = "none"; $('#lbldelivaryfee').parents('td').removeClass("guuesttotal2"); if (document.getElementById("charitylbl").innerHTML == "") { if (document.getElementById("Promoprice").innerHTML == "") { if (document.getElementById("lblorderfail").innerHTML == "TotalCheck") { InsertOrderConfirmation(); } else if (document.getElementById("lblorderfail").innerHTML == "InsertOrder") { InsertOrderInGroupOrder(); } } else if (document.getElementById("lblorderfail").innerHTML == "InsertOrder") { InsertOrderInGroupOrder(); } } } $("#tblOthersCart").css('opacity', '1'); $(".addcategoryloadingimage2").css("display", "none"); } function FinishOrderValidationinGroupOrder() { var count = 0; $(".CustomAdvnacedSettings").fadeOut("fast"); $(".ddlAdvnacedSettings").fadeOut("fast"); $(".screenAdvnacedSettings").fadeOut("fast"); $(".AdvnacedSettings").fadeOut("fast"); $(".checkinsettings").css("display","none"); var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; var OtherMembersItems = localStorage.getItem("OtherMembersItems"); if (OrderTypevalue == "Delivery") { var ZoneId = localStorage.getItem("Zone"); if (ZoneId == "00000000-0000-0000-0000-000000000000") { $("#lblorderror").text("We're sorry! We don't deliver to this address."); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblorderfail").innerHTML = ""; $('.userdeliveryloader').css("display", "none"); $(".checkoutloaderdiv").delay(3000).fadeOut(); if (window.innerWidth < 767) { $(".mblcheckbtndiv").delay(3000).fadeIn(); } else { $(".checkbtndiv").delay(3000).fadeIn(); } return; } if ((document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value != "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value != "") || (document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value != "" && document.getElementById("txtvalidationstate").value != "") || (document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value != "") ) { deliverycheck(); return; } document.getElementById('VALID').innerHTML = "1"; if (document.getElementById('AdrValue').innerHTML == "NewId") { GetSavedAddress(); } } else if (OrderTypevalue == "Shipping") { document.getElementById("finishorderblb").innerHTML = "finishorder"; var ShippingZoneId = localStorage.getItem("ShippingZoneId"); if (ShippingZoneId != null) { var Country = ""; var State = ""; var City = ""; var Address = document.getElementById("txtshpaddress").value; var dcountry = document.getElementById("ddlshpcountry"); Country = dcountry.options[dcountry.selectedIndex].text; var ddlshpState = document.getElementById("ddlshpState"); State = ddlshpState.options[ddlshpState.selectedIndex].text; City = $("#txtshpcity").val(); Zip = $("#txtshpzip").val(); if (Address != "" && Country != "Select Country" && State != "" && City != "") { document.getElementById("txtline1").value = Address; document.getElementById("txtcity").value = City; document.getElementById("txtstate").value = State; document.getElementById("txtZip").value = Zip; } else { WanttoShipping(); return; } } else { WanttoShipping(); return; } } else { if (OrderType != OrderTypevalue) { GetCustomOrderTypeSettings(); } else { document.getElementById("AdvancedOption").innerHTML = ""; document.getElementById("lblEnableSignIn").innerHTML = ""; } } var vOrderType = OrderType; if (OrderTypevalue != "Shipping" && OrderTypevalue != "Delivery") { vOrderType = "PickUp"; $(".deliveryestpara").css("display", "none"); $(".creditcardinfopara").css("display", "none"); } else { $(".deliveryestpara").css("display", "block"); $(".creditcardinfopara").css("display", "block"); } var OtherItems = JSON.parse(OtherMembersItems); if (OtherItems != null) { for (var M = 0; M < OtherItems.length; M++) { for (var I = 0; I < OtherItems[M].GroupItems.length; I++) { if ($('#rbtShipping').is(':checked')) { if (OtherItems[M].GroupItems[I].OrderType != "Shipping" || OtherItems[M].GroupItems[I].ItemWeight == null) { var Available = $("#tblOthersCart").find("tr#" + OtherItems[M].GroupItems[I].ItemId); var Available1 = Available.find("td span.CartItem"); Available1.css("color", "red"); setTimeout(function () { $(".CartItem").css("color", "#333333") }, 1000); count++; } } else { if (OtherItems[M].GroupItems[I].OrderType == "Shipping" || OtherItems[M].GroupItems[I].ItemWeight != null) { var Available = $("#tblOthersCart").find("tr#" + OtherItems[M].GroupItems[I].ItemId); var Available1 = Available.find("td span.CartItem"); Available1.css("color", "red"); setTimeout(function () { $(".CartItem").css("color", "#333333") }, 1000); count++; } } } if (M == OtherItems.length - 1) { if (count > 0) { alertify.error("Some of the items in your cart are not available for " + OrderType); return; } else { if ($('#rbtShipping').is(':checked')) { if (document.getElementById('lblShipMinAmt').innerHTML != "0") { var Total = parseFloat(document.getElementById("lblAlltotalprice").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "")); if (Total < parseFloat(document.getElementById('lblShipMinAmt').innerHTML)) { alertify.error("Sorry minimum shipping amount should be " + document.getElementById("lblCurrency").innerHTML + document.getElementById('lblShipMinAmt').innerHTML); return; } else { if ((document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value != "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value != "") || (document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value != "" && document.getElementById("txtvalidationstate").value != "") || (document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value != "") ) { deliverycheck(); return; } FinishOrderinGroupOrder(); } } else { if ((document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value != "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value != "") || (document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value != "" && document.getElementById("txtvalidationstate").value != "") || (document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value != "") ) { deliverycheck(); return; } FinishOrderinGroupOrder(); } } else { FinishOrderinGroupOrder(); } } } } } } function FinishOrderinGroupOrder() { //$(".userdeliveryloader2").css("display", "block"); var subtotal = document.getElementById("lblAlltotalprice").innerHTML; subtotal = subtotal.replace(document.getElementById("lblCurrency").innerHTML, ""); if (subtotal == "0.00") { alertify.error("Please select atleast one item to place an order"); $(".userdeliveryloader2").css("display", "none"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } return; } GetAllItems(); uncheckpaymentselection(); $('.debitpnl').fadeOut("slow"); var UId = document.getElementById("UserId").innerHTML; if (UId != "") { GetUserDetails(); } if (document.getElementById("lbldelivary").innerHTML == "Delivery Only") { if ((document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value != "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value != "") || (document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value != "" && document.getElementById("txtvalidationstate").value != "") || (document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value != "") ) { deliverycheck(); return; } } $('.debitpnl').fadeOut("slow"); document.getElementById("lblorderfail").innerHTML = ""; var retrievedData = localStorage.getItem("OtherMembersItems"); var Type; if ($('#rbtdelivery').is(':checked') || $('#rbtShipping').is(':checked')) { Type = localStorage.getItem("GroupOrderType"); document.getElementById("txtBZC").value = document.getElementById("txtvalidationzip").value; if ((document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value != "" && document.getElementById("txtvalidationstate").value == "") || (document.getElementById("txtaddress").value != "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value != "") || (document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value != "" && document.getElementById("txtvalidationstate").value != "") || (document.getElementById("txtaddress").value == "" && document.getElementById("txtvalidationcity").value == "" && document.getElementById("txtvalidationstate").value != "") ) { deliverycheck(); return; } document.getElementById('VALID').innerHTML = "1"; if (document.getElementById('AdrValue').innerHTML == "NewId") { GetSavedAddress(); } } if ($('#rbtpickup').is(':checked')) { Type = "PickUp"; } $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/CheckItemsAvailability", data: "{'retrievedData': '" + retrievedData + "','Type': '" + Type + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d[0].Ids != "" || msg.d[1].Ids != "" || msg.d[2].Ids != "" || msg.d[3].Ids != "") { if (msg.d[0].Ids != "") { var CheckedID = msg.d[0].Ids.split(','); for (var K = 0; K < CheckedID.length; K++) { var Available = $("#tblOthersCart").find("tr#" + CheckedID[K]); var Available1 = Available.find("td span.CartItem"); Available1.css("color", "red"); setTimeout(function () { $(".CartItem").css("color", "#333333") }, 1000); } alertify.error("Some of the items in your cart are not available"); $(".userdeliveryloader2").css("display", "none"); return; } else if (msg.d[1].Ids != "") { var CheckedID = msg.d[1].Ids.split(','); for (var K = 0; K < CheckedID.length; K++) { var Available = $("#tblOthersCart").find("tr#" + CheckedID[K]); var Available1 = Available.find("td span.CartItem"); Available1.css("color", "red"); setTimeout(function () { $(".CartItem").css("color", "#333333") }, 1000); } alertify.error("Some of the items in your cart are inactive"); $(".userdeliveryloader2").css("display", "none"); return; } else if (msg.d[2].Ids != "") { var CheckedID = msg.d[2].Ids.split(','); for (var K = 0; K < CheckedID.length; K++) { var Available = $("#tblOthersCart").find("tr#" + CheckedID[K]); var Available1 = Available.find("td span.CartItem"); Available1.css("color", "red"); setTimeout(function () { $(".CartItem").css("color", "#333333") }, 1000); } alertify.error("Some of the items in your cart are not available for " + Type); $(".userdeliveryloader2").css("display", "none"); return; } if (msg.d[3].Ids != "") { var CheckedID = msg.d[3].Ids.split(','); var LocationId = document.getElementById('lblLId').value; ProcedureAfterCondition(); } } else { ProcedureAfterCondition(); } } }); } function ProcedureAfterCondition() { //checkButtons(); var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; CheckOrderTypeSettingsinGroupOrder(OrderType,OrderTypevalue); document.getElementById("finishorderblb").innerHTML = "finishorder"; BindPricesinGrouporder(); if (document.getElementById("lblfinishcount").innerHTML == "0") {// this condition is used without binding month, year everytime when finishorder is cliked.so the selected values are not clear BindMonths(); BindYears(); document.getElementById("lblfinishcount").innerHTML = "1"; } if ($('#rbtShipping').is(':checked')) { document.getElementById("lbldchange").innerHTML = ""; if (document.getElementById("SubmissionNotes").innerHTML != "") { $('.submissionnotes').text("Note: " + document.getElementById("SubmissionNotes").innerHTML); } LoadEditItemImage(); var UId = document.getElementById("UserId").innerHTML; if (UId != "") { AddShippingItemstoPanel(); //document.getElementById('btngust').style.display = "none"; } else { // document.getElementById('btngust').style.display = "block"; if (document.getElementById('popupsscroll').innerHTML == "over") { $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 500); } else { $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 0); } if (document.getElementById("UserId").innerHTML != "") { if (document.getElementById("promotitle").innerHTML != "") { $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); } //else { $(".userstyleguest").css("display", "block"); } } //else { $(".userstyleguest").css("display", "block"); } if (document.getElementById("lbldchange").innerHTML == "OpenDpanel") { $(".signinpanel").fadeOut("slow"); } else { $(".signinpanel").fadeIn("slow"); } document.getElementById('btngust').style.display = "none"; $("#spnwelback").css("display", "none"); $("#signinpanel").find("input[type=text],input[type=password]").val(''); $(".registererror").css("display", "none"); $("#signinpanel").find("input[type=text],input[type=password]").removeClass("userlogin_formtext1Error").addClass("userlogin_formtext1"); document.getElementById('lblMsg12').innerHTML = ""; document.getElementById('lblsigntex').innerHTML = "Sign In to MunchEm"; } } else if ($('#rbtdelivery').is(':checked')) { var Zone = localStorage.getItem("Zone"); var LocationId = document.getElementById('lblLId').value; var OrderType = ""; if (Zone != null) { $.ajax({ type: "POST", url: "Orders.aspx/ZoneDetailsByZoneId", data: "{'Zone': '" + Zone + "','LocationId': '" + LocationId + "','OrderType': '" + OrderType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0].MinimumOrder != null && msg.d[0].MinimumOrder != "") { var Price = 0; var Min = 0; var P = 0; var OtherMembersItems = localStorage.getItem("OtherMembersItems"); var OtherItems = JSON.parse(OtherMembersItems); if (OtherItems != null) { for (var M = 0; M < OtherItems.length; M++) { for (var I = 0; I < OtherItems[M].GroupItems.length; I++) { P = +P + +OtherItems[M].GroupItems[I].Price; } } document.getElementById("lblAlltotalprice").innerHTML = document.getElementById("lblCurrency").innerHTML + P.toFixed(2); } Price = parseFloat(P); var M = msg.d[0].MinimumOrder; Min = parseFloat(M); if (Price >= Min) { //BindOrderingPanelinGroupOrder(); } else { if (msg.d[0].appName != "Out Of the Zone") alertify.error("We require subtotal amount of " + document.getElementById("lblCurrency").innerHTML + msg.d[0].MinimumOrder); else alertify.error("We require subtotal amount of " + document.getElementById("lblCurrency").innerHTML + msg.d[0].MinimumOrder + " or more for out of zone orders"); $(".userdeliveryloader2").css("display", "none"); } } else { // BindOrderingPanelinGroupOrder(); } } else { //BindOrderingPanelinGroupOrder(); } } }); } else { // BindOrderingPanelinGroupOrder(); } } else { // BindOrderingPanelinGroupOrder(); } } function checkButtons() { if ($('#rbtShipping').is(':checked')) { //Start Delivery to shipping changes $(".justtip").css("display", "none"); $(".notefordelivery").css("display", "none"); $(".notshipping").css("display", "none"); $(".deliveryHeading").text("Shipping Order Submission"); // End Delivery to shipping changes if (document.getElementById("lblfinishcount").innerHTML == "0") {// this condition is used without binding month, year everytime when finishorder is cliked.so the selected values are not clear BindMonths(); BindYears(); document.getElementById("lblfinishcount").innerHTML = "1"; } $('.BtnSquare').css("display", "none"); $('.btnStripe').css("display", "none"); if (document.getElementById("lblCurrency").innerHTML != "₹") { if (document.getElementById("lblCloverPayment").innerHTML == "true") { $('#fdButtonpay1').fadeIn("slow"); $('#Paypal').css("display", "none"); $('#Instamojo').css("display", "none"); } else { $('#Instamojo').css("display", "none"); $('#Instamojo').css("display", "none"); $('#Paypal').fadeIn("slow");// user online delivery $('#fdButtonpay1').fadeIn("slow");// user c/d delivery } } else { $('#Paypal').fadeOut("slow");// user online delivery $('#fdButtonpay1').fadeOut("slow");// user c/d delivery $('#Instamojo').fadeIn("slow"); } } else { $(".providerdiv").css("display", "none"); $(".deliveryHeading").text("Delivery Order Submission"); $(".notshipping").css("display", "block"); $('.BtnSquare').css("display", "none"); $('.btnStripe').css("display", "none"); if ((document.getElementById("lblcpickup").innerHTML == "true" && $('#rbtpickup').is(':checked'))) { if (document.getElementById("Promoprice").innerHTML == ""){ $('#bntConfOrder').fadeIn("slow"); $('#mbntConfOrder').fadeIn("slow"); } else{ $('#bntConfOrder').css("display", "none"); $('#mbntConfOrder').css("display", "none"); } } else if ((document.getElementById("lblcdelivery").innerHTML == "true" && $('#rbtdelivery').is(':checked'))) { if (document.getElementById("Promoprice").innerHTML == ""){ $('#bntConfOrder').fadeIn("slow"); $('#mbntConfOrder').fadeIn("slow"); } else{ $('#bntConfOrder').css("display", "none"); $('#mbntConfOrder').css("display", "none"); } } else { $('#bntConfOrder').css("display", "none"); $('#mbntConfOrder').css("display", "none"); } if (document.getElementById("lblCurrency").innerHTML == "₹") { $('.CODtext').text(" Cash on Delivery"); $('.CODtext1').text(" Cash on Delivery"); } if (document.getElementById("lblfinishcount").innerHTML == "0") {// this condition is used without binding everytime when finishorder is cliked.so the selected values are not clear BindMonths(); BindYears(); document.getElementById("lblfinishcount").innerHTML = "1"; } if (document.getElementById("lblopickup").innerHTML == "true" && $('#rbtpickup').is(':checked')) { if (document.getElementById("lblCurrency").innerHTML != "₹") { if (document.getElementById("lblCloverPayment").innerHTML == "true") { $('#fdButtonpay1').fadeIn("slow"); $('#Paypal').css("display", "none"); $('#Instamojo').css("display", "none"); } else { $('#Paypal').fadeIn("slow");// user online delivery $('#fdButtonpay1').fadeIn("slow");// user c/d delivery } } if (document.getElementById("lblCurrency").innerHTML == "₹") { $('#Instamojo').fadeIn("slow"); $('#Paypal').css("display", "none"); $('#fdButtonpay1').css("display", "none"); } } else if (document.getElementById("lblodelivery").innerHTML == "true" && $('#rbtdelivery').is(':checked')) { if (document.getElementById("lblCurrency").innerHTML != "₹") { if (document.getElementById("lblCloverPayment").innerHTML == "true") { $('#fdButtonpay1').fadeIn("slow"); $('#Paypal').css("display", "none"); $('#Instamojo').css("display", "none"); } else { $('#Paypal').fadeIn("slow");// user online delivery $('#fdButtonpay1').fadeIn("slow");// user c/d delivery } } if (document.getElementById("lblCurrency").innerHTML == "₹") { $('#Instamojo').fadeIn("slow"); $('#Paypal').css("display", "none"); $('#fdButtonpay1').css("display", "none"); } } else { $('#Paypal').css("display", "none"); $('#Instamojo').css("display", "none"); $('#fdButtonpay1').css("display", "none"); } if (document.getElementById("lblCurrency").innerHTML != "₹") { $('#Instamojo').css("display", "none"); } else { $('.CODtext').text(" Cash on Delivery"); $('.CODtext1').text(" Cash on Delivery"); $('.pamericancc').text(" International Credit Cards"); } if (document.getElementById("Promoprice").innerHTML != "") { $('#bntConfOrder').css("display", "none"); $('#mbntConfOrder').css("display", "none"); } } } function AddShippingItemstoPanel() { document.getElementById('TableDeliveryCart').innerHTML = ""; var OtherMembersItems = localStorage.getItem("OtherMembersItems"); var AddedItems = JSON.parse(OtherMembersItems); if (AddedItems != null) { if (AddedItems.length > 0) { $(".displayonitem").css("display", "block"); $(".yourordersteststyles").css("display", "block"); for (var M = 0; M < AddedItems.length; M++) { var membertable = document.createElement("table"); setAttributes(membertable, { "class": "groupcart" }); var membertr = document.createElement("tr"); var membertd = document.createElement("td"); var memberspanName = document.createElement("span"); setAttributes(memberspanName, { "style": "font-size: 16px;font-weight: bold;color: black;" }); memberspanName.innerHTML += AddedItems[M].MemberName; var memberType = document.createElement("span"); //setAttributes(memberType, { "style": "font-size: 16px;font-weight: bold;color: black;" }); memberType.innerHTML += " (" + AddedItems[M].MemberType + ")"; membertd.appendChild(memberspanName); membertd.appendChild(memberType); membertr.appendChild(membertd); membertable.appendChild(membertr); var Price = 0; for (var I = 0; I < AddedItems[M].GroupItems.length; I++) { var trItem = document.createElement("tr"); setAttributes(trItem, { "style": "color:#333333;", "align": "center", "id": AddedItems[M].GroupItems[I].ItemId, "value": AddedItems[M].GroupItems[I].CategoryId }); var tdItem = document.createElement("td"); setAttributes(tdItem, { "class": "Order_contnet1", "width": "50%" }); var lblItem = document.createElement("span"); setAttributes(lblItem, { "style": "font-weight:bold;font-size:12px;", "class": "CartItem" }); lblItem.innerHTML += AddedItems[M].GroupItems[I].Quantity + " " + unescape(AddedItems[M].GroupItems[I].ItemName); tdItem.appendChild(lblItem); var OrderType = localStorage.getItem("GroupOrderType"); if (OrderType == "Shipping") { if (AddedItems[M].GroupItems[I].ItemWeight != null) { var br = document.createElement("br"); tdItem.appendChild(br); var lblOptions = document.createElement("span"); setAttributes(lblOptions, { "style": "font-size:10px;", }); lblOptions.innerHTML += unescape(AddedItems[M].GroupItems[I].ItemWeight * AddedItems[M].GroupItems[I].Quantity) + " " + AddedItems[M].GroupItems[I].Measurement; tdItem.appendChild(lblOptions); } } if (AddedItems[M].GroupItems[I].Instructions != "") { var br = document.createElement("br"); tdItem.appendChild(br); var lblInstructions = document.createElement("span"); setAttributes(lblInstructions, { "style": "font-size:10px;", }); lblInstructions.innerHTML += "Instructions: " + unescape(AddedItems[M].GroupItems[I].Instructions); tdItem.appendChild(lblInstructions); } trItem.appendChild(tdItem); var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Order_contnet1 gcartright });" }); var lblQuantity = document.createElement("span"); lblQuantity.innerHTML += AddedItems[M].GroupItems[I].Quantity; //tdQuantity.appendChild(lblQuantity); //trItem.appendChild(tdQuantity); var tdPrice = document.createElement("td"); setAttributes(tdPrice, { "class": "Order_contnet1", "style": "text-align:right;vertical-align:baseline;", "width": "10%" }); var lblPrice = document.createElement("span"); lblPrice.innerHTML += AddedItems[M].GroupItems[I].Price; tdPrice.appendChild(lblPrice); trItem.appendChild(tdPrice); membertable.appendChild(trItem); Price = +Price + AddedItems[M].GroupItems[I].Price; } var trSubtotal = document.createElement("tr"); setAttributes(trSubtotal, { "style": "width:100%;text-align:right;" }); var tdSubtotal = document.createElement("td"); setAttributes(tdSubtotal, { "colspan": "2", "style": "border-top: gray 2px solid;color: black;" }); var lblSubtotalPrice = document.createElement("span"); var lblSubtotalText = document.createElement("span"); setAttributes(lblSubtotalPrice, { "style": "font-weight: bold;color: green;font-size: 14px;" }); //setAttributes(lblItem, { "style": "font-weight:bold;font-size:12px;cursor:pointer;", "onclick": "EditItemOptions(this);", "id": "EditItem" + g, "class": "CartItem" }); lblSubtotalText.innerHTML += "SubTotal: "; lblSubtotalPrice.innerHTML += Price.toFixed(2); tdSubtotal.appendChild(lblSubtotalText); tdSubtotal.appendChild(lblSubtotalPrice); trSubtotal.appendChild(tdSubtotal); membertable.appendChild(trSubtotal); document.getElementById('TableDeliveryCart').appendChild(membertable); } } BindPricesinGrouporder(); var LocationId = document.getElementById('lblLId').value; $.ajax({ type: "POST", url: "Orders.aspx/LocationTime", data: "{'LId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var todaydate = ""; todaydate = msg.d; splitarray = todaydate.split(" "); document.getElementById('lblpDate').innerHTML = splitarray[0]; var date = new Date(document.getElementById("lblpDate").innerHTML); var newdate = new Date(date); var d = 0; if (document.getElementById("lblCurrency").innerHTML != "$") { d = document.getElementById("lblDdd").innerHTML; newdate.setDate(+newdate.getDate() + +d); } else if (document.getElementById("lblCurrency").innerHTML == "$") { d = document.getElementById("lblDdd").innerHTML; newdate.setDate(+newdate.getDate() + +d); } else { d = document.getElementById("lblIdd").innerHTML; newdate.setDate(+newdate.getDate() + +d); } $(".signinpanel").fadeOut("slow"); document.getElementById("txtline1").value = document.getElementById('txtaddress').value; document.getElementById("txtcity").value = document.getElementById('txtvalidationcity').value; document.getElementById("txtstate").value = document.getElementById('txtvalidationstate').value; document.getElementById("txtZip").value = document.getElementById('txtvalidationzip').value; document.getElementById('txtdeliverydate').value = newdate.getMonth() + 1 + "/" + newdate.getDate() + "/" + newdate.getFullYear(); $(".Estimate").text(""); var ddlhr = document.getElementById("ddlhr"); var option = document.createElement("option"); option.text = "4:00 PM"; ddlhr.add(option); $('.placeorder').fadeIn("slow"); OpeningOrderSubmitionPnl(); } }); } } function getOrderTypeSettings() { var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; var LocationId = document.getElementById('lblLId').value; $.ajax({ type: "POST", url: "Orders.aspx/getOrderTypeSettings", data: "{'LocationId': '" + LocationId + "','OrderType':'" + escape(OrderType) + "','CustomOrderId':'" + escape(OrderTypevalue) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { document.getElementById("lblAllowinstore").innerHTML=msg.d[0].AllowInstore ; document.getElementById("lblCustomizedcash").innerHTML=msg.d[0].Customizedcash ; } } }); } function BindOrderingPanelinGroupOrder() { //document.getElementById("userRatestbl").innerHTML = ""; //checkButtons(); var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; //CheckOrderTypeSettingsinGroupOrder(OrderType,OrderTypevalue); var subtotal = document.getElementById("lblAlltotalprice").innerHTML; subtotal = subtotal.replace(document.getElementById("lblCurrency").innerHTML, ""); if (subtotal == "0.00") { alertify.error("Please select atleast one item to place an order"); $(".userdeliveryloader2").css("display", "none"); return; } if (document.getElementById("SubmissionNotes").innerHTML != "") { $('.submissionnotes').text("Note: " + document.getElementById("SubmissionNotes").innerHTML); } var retrievedData = localStorage.getItem("OtherMembersItems"); var height = $(".UserDeliveryPanel").css('height'); var UId = document.getElementById("UserId").innerHTML; if (UId != "") { if (document.getElementById("Promocodetxt").value != "") { $('#bntConfOrder').css("display", "none"); $('#mbntConfOrder').css("display", "none"); $('#Button6').css("display", "none"); } AddItemstoPanelingrouporder(); GetCommonTimeinGroupOrder(); $(".userstyleguest").css("display", "block"); $("#spnwelback").css("display", "block"); } else { var type = document.getElementById("usertype").innerHTML; if (type == "Guest") { Assignsession(); } else { // document.getElementById('btngust').style.display = "block"; if (document.getElementById('popupsscroll').innerHTML == "over") { $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 500); } else { $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 0); } if (document.getElementById("Promocodetxt").value != "") { $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); } else { $(".userstyleguest").css("display", "block"); $("#spnwelback").css("display", "block"); } $(".signinpanel").fadeIn("slow"); $("#signinpanel").find("input[type=text],input[type=password]").val(''); $(".registererror").css("display", "none"); $("#signinpanel").find("input[type=text],input[type=password]").removeClass("userlogin_formtext1Error").addClass("userlogin_formtext1"); document.getElementById('lblMsg12').innerHTML = ""; document.getElementById('lblsigntex').innerHTML = "Sign In to MunchEm"; $(".userdeliveryloader2").css("display", "none"); } } } function GetCommonTimeinGroupOrder() { $('.ddlhr').empty(); var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; $.ajax({ type: "POST", url: "Orders.aspx/LocationTime", data: "{'LId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var todaydate = ""; document.getElementById("AppLocationTime").innerHTML = msg.d; todaydate = msg.d; var splitarray = new Array(); splitarray = todaydate.split(" "); document.getElementById('lblolddate').innerHTML = splitarray[0]; document.getElementById('txtdeliverydate').value = splitarray[0]; var retrievedData = localStorage.getItem("OtherMembersItems"); var currenttime = msg.d; // CheckCartAvailableTimesinGroupOrder(OrderType, OrderTypevalue); CheckCartAvailableTimesinGroupOrder(); } }); } function CheckOrderTypeSettingsinGroupOrder(OrderType, OrderTypevalue) { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var LocationId = document.getElementById('lblLId').value; if (OrderTypevalue == OrderType && OrderType == "Shipping") { $(".providerdiv").css("display", "none"); $(".justtip").css("display", "none"); $(".notefordelivery").css("display", "none"); $(".deliveryHeading").text("Shipping Order Submission"); $(".DeliveryType").fadeIn("fast"); // End Delivery to shipping changes $('.BtnSquare').css("display", "none"); $('.btnStripe').css("display", "none"); $('#bntConfOrder').css("display", "none"); $('#mbntConfOrder').css("display", "none"); if (document.getElementById("lblCurrency").innerHTML != "₹") { if (document.getElementById("lblPaymentType").innerHTML == "square") { $('#BtnSquare').fadeIn("slow"); $('.btnpaywithmunchies').css("display", "none"); $('#fdButtonpay1').css("display", "none"); $('#Instamojo').css("display", "none"); } else { $('#fdButtonpay1').fadeIn("slow"); $('#Instamojo').css("display", "none"); $('#BtnSquare').css("display", "none"); } } else { $('#fdButtonpay1').fadeOut("slow");// user c/d delivery $('#Instamojo').fadeIn("slow"); } document.getElementById("lbldchange").innerHTML = ""; if (document.getElementById("SubmissionNotes").innerHTML != "") { $('.submissionnotes').text("Note: " + document.getElementById("SubmissionNotes").innerHTML); } LoadEditItemImage(); var UId = document.getElementById("UserId").innerHTML; if (UId != "") { AddItemstoPanelingrouporder(); document.getElementById('btngust').style.display = "none"; $("#spnwelback").css("display", "none"); $(".btnpaywithmunchies").fadeOut("slow"); $('.btnpaywithmunchies').css("display", "none"); } else { document.getElementById('btngust').style.display = "none"; $("#spnwelback").css("display", "none"); $(".signinAdjustpanel").css("margin-top", $(document).scrollTop() - 0); if (document.getElementById("lblRequireuseraccount").innerHTML == "true") { if (document.getElementById("promotitle").innerHTML != ""){ $(".userstyleguest").css("display", "none"); $("#spnwelback").css("display", "none"); } } if (document.getElementById("lbldchange").innerHTML == "OpenDpanel") $(".signinpanel").fadeOut("slow"); else { $(".signinpanel").fadeIn("slow"); return; } $("#signinpanel").find("input[type=text],input[type=password]").val(''); $(".registererror").css("display", "none"); $("#signinpanel").find("input[type=text],input[type=password]").removeClass("userlogin_formtext1Error").addClass("userlogin_formtext1"); document.getElementById('lblMsg12').innerHTML = ""; } BindOrderingPanelinGroupOrder(); } else { if (OrderTypevalue == "Delivery") { var Zone = localStorage.getItem("Zone"); var LocationId = document.getElementById('lblLId').value; if (Zone != null) { $.ajax({ type: "POST", url: "Orders.aspx/ZoneDetailsByZoneId", data: "{'Zone': '" + Zone + "','LocationId': '" + LocationId + "','OrderType': ''}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0].MinimumOrder != null && msg.d[0].MinimumOrder != "") { var Price = 0; var Min = 0; var P = 0; var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { for (var w = 0; w < AddedItems.length; w++) { if (AddedItems[w].GroupItems != null) { for (var F = 0; F < AddedItems[w].GroupItems.length; F++) { P = +P + +AddedItems[w].GroupItems[F].Price; } } } } Price = parseFloat(P); var M = msg.d[0].MinimumOrder; Min = parseFloat(M); if (Price >= Min) { BindOrderingPanelinGroupOrder(); } else { if (msg.d[0].appName != "Out Of the Zone") { $("#lblorderror").text("We require subtotal amount of " + document.getElementById("lblCurrency").innerHTML + msg.d[0].MinimumOrder); $(".ordererror").show().delay(3000).fadeOut(); $(".checkoutloaderdiv").delay(3000).fadeOut(); if (window.innerWidth < 767) { $(".mblcheckbtndiv").delay(3000).fadeIn(); } else { $(".checkbtndiv").delay(3000).fadeIn(); } return; } else { $("#lblorderror").text("We require subtotal amount of " + document.getElementById("lblCurrency").innerHTML + msg.d[0].MinimumOrder + " or more for out of zone orders"); $(".ordererror").show().delay(3000).fadeOut(); $(".checkoutloaderdiv").delay(3000).fadeOut(); if (window.innerWidth < 767) { $(".mblcheckbtndiv").delay(3000).fadeIn(); } else { $(".checkbtndiv").delay(3000).fadeIn(); } return; } } } else { BindOrderingPanelinGroupOrder(); } } } }); } } $.ajax({ type: "POST", url: "Orders.aspx/getOrderTypeSettings", data: "{'LocationId': '" + LocationId + "','OrderType':'" + escape(OrderType) + "','CustomOrderId':'" + escape(OrderTypevalue) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0].AllowTip == true){ if (msg.d[0].DefaultTipAmount != null){ if (msg.d[0].DefaultTipAmount != "") { document.getElementById("lblDefaultTipAmount").innerHTML = msg.d[0].DefaultTipAmount; } else { document.getElementById("lblDefaultTipAmount").innerHTML = ""; } } else { document.getElementById("lblDefaultTipAmount").innerHTML = ""; } } else{ document.getElementById("lblDefaultTipAmount").innerHTML = ""; } if (msg.d[0].DefaultTipAmount != null){ if (msg.d[0].LimitTimestoASAP != null) { if (msg.d[0].LimitTimestoASAP != false) { document.getElementById("LimitTimestoASAP").innerHTML = msg.d[0].LimitTimestoASAP; } else { document.getElementById("LimitTimestoASAP").innerHTML = false; } } else { document.getElementById("LimitTimestoASAP").innerHTML = false; } } else { document.getElementById("LimitTimestoASAP").innerHTML = false; } if (OrderTypevalue != "Delivery") { var PickUpminamount = msg.d[0].OrderMinAmount; if (PickUpminamount != "" && PickUpminamount != null) { var Price = 0; var Min = 0; var P = 0; var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { for (var w = 0; w < AddedItems.length; w++) { if (AddedItems[w].GroupItems != null) { for (var F = 0; F < AddedItems[w].GroupItems.length; F++) { P = +P + +AddedItems[w].GroupItems[F].Price; } } } } Price = parseFloat(P); var M = PickUpminamount; Min = parseFloat(M); if (Price >= Min) { BindOrderingPanelinGroupOrder(); } else { $("#lblorderror").text("We require subtotal amount of " + document.getElementById("lblCurrency").innerHTML + PickUpminamount); $(".ordererror").show().delay(3000).fadeOut(); $(".checkoutloaderdiv").delay(3000).fadeOut(); if (window.innerWidth < 767) { $(".mblcheckbtndiv").delay(3000).fadeIn(); } else { $(".checkbtndiv").delay(3000).fadeIn(); } return; } } else { BindOrderingPanelinGroupOrder(); } } document.getElementById("finishorderblb").innerHTML = "finishorder"; if (GroupId != null && GroupId != "" && GroupId != undefined) { //GetDealinGroupOrder(); } $(".providerdiv").css("display", "none"); $(".deliveryHeading").text(OrderType + " Order Submission"); $('.BtnSquare').css("display", "none"); $('.btnStripe').css("display", "none"); document.getElementById("lbldouplicate").innerHTML = ""; if (msg.d[0].AllowInstore == true) { if (msg.d[0].CustomizeWord != "" && msg.d[0].CustomizeWord != null) $('.CODtext').text(msg.d[0].CustomizeWord); else { if (document.getElementById("lblCurrency").innerHTML == "₹") $('.CODtext').text("Cash On Delivery"); else $('.CODtext').text("Pay With Cash"); } if (document.getElementById("lblCurrency").innerHTML == "₹") { if (document.getElementById("Promoprice").innerHTML == "") $('#bntConfOrder').fadeIn("slow"); else $('#bntConfOrder').css("display", "none"); } else { $('#bntConfOrder').fadeIn("slow"); } if (msg.d[0].Customizedcash == true) { if (msg.d[0].CustomizedCashAs != "" && msg.d[0].CustomizedCashAs != null) $('.CODtext1').text(msg.d[0].Customizedcash); else { if (document.getElementById("lblCurrency").innerHTML == "₹") $('.CODtext1').text("Cash On Delivery"); else $('.CODtext1').text("Pay With Cash"); } if (document.getElementById("lblCurrency").innerHTML == "₹") { if (document.getElementById("Promoprice").innerHTML == "") $('#mbntConfOrder').fadeIn("slow"); else $('#mbntConfOrder').css("display", "none"); } else $('#mbntConfOrder').fadeIn("slow"); } else { $('#mbntConfOrder').css("display", "none"); } } else { $('#bntConfOrder').css("display", "none"); } $('.NormalForm').css("display", ""); if (msg.d[0].AllowOnline == true) { if (document.getElementById("lblCurrency").innerHTML != "₹") { if (document.getElementById("CCBaseURL").innerHTML != "") { $('#fdButtonpay1').fadeIn("slow"); $("#CardConnectform").css("display", "block"); $('.NormalForm').css("display", "none"); $('#Instamojo').css("display", "none"); $('#BtnSquare').css("display", "none"); } else if (document.getElementById("lblCloverPayment").innerHTML == "true") { $('#fdButtonpay1').fadeIn("slow"); $('.CardConnectform').fadeOut("slow"); $('.NormalForm').css("display", "block"); $('#Instamojo').css("display", "none"); $('#BtnSquare').css("display", "none"); $('#BtnCardConnect').css("display", "none"); } else if (document.getElementById("lblPaymentType").innerHTML == "square") { $('#BtnSquare').fadeIn("slow"); $('.btnpaywithmunchies').css("display", "none"); $('#fdButtonpay1').css("display", "none"); $('#Instamojo').css("display", "none"); $('#BtnCardConnect').css("display", "none"); } else $('#fdButtonpay1').fadeIn("slow");// user c/d delivery } if (document.getElementById("lblCurrency").innerHTML == "₹") { $('#Instamojo').fadeIn("slow"); $('#fdButtonpay1').css("display", "none"); } } else { $('#fdButtonpay1').css("display", "none"); $('#Instamojo').css("display", "none"); $('#BtnSquare').css("display", "none"); $('.CardConnectform').fadeOut("slow"); $('.NormalForm').css("display", "none"); $('#BtnCardConnect').css("display", "none"); } if (msg.d[0].AllowTip == true) $(".justtip").fadeIn("fast"); else $('.justtip').css("display", "none"); if (msg.d[0].TextNotes != "") { $('.TextNotes').text(msg.d[0].TextNotes) $('.TextNotes').fadeIn("fast"); } else { $('.TextNotes').text("") $('.TextNotes').css("display", "none"); } var UId = document.getElementById("UserId").innerHTML; var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["CustomWebsites"]; if (CustomWebsites == undefined) { if (UId != "") { if (document.getElementById("lblPaymentType").innerHTML == "square") { $('.btnpaywithmunchies').css("display", "none"); $('.munchiesAmount').css("display", "none"); } else { var Atype = document.getElementById("lblAwardType").innerHTML; if (Atype == "Munchies" || Atype == "Points") { $('.btnpaywithmunchies').fadeIn("slow"); } else { $('.btnpaywithmunchies').css("display", "none"); $('.btnpaywithmunchies').fadeOut("slow"); } } } } else { $('.btnpaywithmunchies').css("display", "none"); $('.munchiesAmount').css("display", "none"); } if (document.getElementById("Promoprice").innerHTML != "") { if (document.getElementById("lblCurrency").innerHTML != "$") { $('#bntConfOrder').css("display", "none"); $('#mbntConfOrder').css("display", "none"); } $('.btnpaywithmunchies').css("display", "none"); } } else { $('#fdButtonpay1').css("display", "none"); $('#Instamojo').css("display", "none"); $('#BtnSquare').css("display", "none"); } } }); } } function GetCurrentDatesinGroupOrder() { $('.ddlhr').empty(); var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; $.ajax({ type: "POST", url: "Orders.aspx/LocationTime", data: "{'LId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var todaydate = ""; document.getElementById("AppLocationTime").innerHTML = msg.d; todaydate = msg.d; var splitarray = new Array(); splitarray = todaydate.split(" "); document.getElementById('lblolddate').innerHTML = splitarray[0]; document.getElementById('txtdeliverydate').value = splitarray[0]; } }); } function GetDealinGroupOrder() { var LocationId = document.getElementById('lblLId').value; var PromoEnteredData = localStorage.getItem("PromoEntered"); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var isCouponlen = 0; if (PromoEnteredData != "") { var Table = JSON.parse(PromoEnteredData); if (Table != null) { if (Table.length > 0) { if (LocationId == Table[0].LocationId) { var StorageLocationId = ""; var PromoCode = escape(document.getElementById('Promocodetxt').value); var SubTotal = 0; var retrievedData = localStorage.getItem("OtherMembersItems"); var AddedItems = JSON.parse(retrievedData); var arr = new Array(); var CouponFor = 1; var ItemTotal = 0; if (PromoCode != "" && PromoCode != null && PromoCode != undefined) { $.ajax({ type: "POST", url: "Orders.aspx/GetPromodetails", data: "{'PromoCode':'" + PromoCode + "','LocationId':'" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { isCouponlen = msg.d.length; if (msg.d.length > 0) { CouponFor = msg.d[0].IncludemenuType; if (msg.d[0].IncludemenuType == 1) { if (AddedItems != null) { if (AddedItems.length > 0) { if (AddedItems[0].GroupItems.length > 0) { StorageLocationId = AddedItems[0].GroupItems[0].LId; for (var w = 0; w < AddedItems.length; w++) { for (var F = 0; F < AddedItems[w].GroupItems.length; F++) { if (AddedItems[w].GroupItems[F].OfferName != null) SubTotal = +SubTotal + +(parseFloat(AddedItems[w].GroupItems[F].Price) - parseFloat(AddedItems[w].GroupItems[F].OfferValue)); else SubTotal = +SubTotal + +AddedItems[w].GroupItems[F].Price; arr[w] = { Id: AddedItems[w].Id }; ItemTotal = +ItemTotal + +AddedItems[w].GroupItems[F].Price; } } } } } } else { var List = ""; if (msg.d[0].ItemList != null) { if (msg.d[0].ItemList.length > 0) { for (var a = 0; a < msg.d[0].ItemList.length; a++) { if (List == "") { List = msg.d[0].ItemList[a].MenuId; } else { List = List + "," + msg.d[0].ItemList[a].MenuId; } } } } if (List != "") { var n; if (msg.d[0].IncludemenuType == 2) { if (AddedItems != null) { if (AddedItems.length > 0) { if (AddedItems[0].GroupItems.length > 0) { StorageLocationId = AddedItems[0].GroupItems[0].LId; for (var w = 0; w < AddedItems.length; w++) { for (var F = 0; F < AddedItems[w].GroupItems.length; F++) { if (AddedItems[w].GroupItems[F].OfferName != null) { ItemTotal = +ItemTotal + +(parseFloat(AddedItems[w].GroupItems[F].Price) - parseFloat(AddedItems[w].GroupItems[F].OfferValue)); } else { n = List.includes(AddedItems[w].GroupItems[F].ItemCategoryId); if (n == true) { SubTotal = +SubTotal + +AddedItems[w].GroupItems[F].Price; } else { n = List.includes(AddedItems[w].GroupItems[F].SubcategoryId); if (n == true) { SubTotal = +SubTotal + +AddedItems[w].GroupItems[F].Price; } else { n = List.includes(AddedItems[w].GroupItems[F].SubSubcategoryId); if (n == true) { SubTotal = +SubTotal + +AddedItems[w].GroupItems[F].Price; } } } ItemTotal = +ItemTotal + +AddedItems[w].GroupItems[F].Price; } arr[w] = { Id: AddedItems[w].Id }; } } } } } } else if (msg.d[0].IncludemenuType == 3) { if (AddedItems != null) { if (AddedItems.length > 0) { if (AddedItems[0].GroupItems.length > 0) { StorageLocationId = AddedItems[0].GroupItems[0].LId; for (var w = 0; w < AddedItems.length; w++) { for (var F = 0; F < AddedItems[w].GroupItems.length; F++) { if (AddedItems[w].GroupItems[F].OfferName != null) { ItemTotal = +ItemTotal + +(parseFloat(AddedItems[w].GroupItems[F].Price) - parseFloat(AddedItems[w].GroupItems[F].OfferValue)); } else { n = List.includes(AddedItems[w].Id); if (n == true) { SubTotal = +SubTotal + +AddedItems[w].GroupItems[F].Price; } ItemTotal = +ItemTotal + +AddedItems[w].GroupItems[F].Price; } arr[w] = { Id: AddedItems[w].Id }; } } } } } } } else { if (ItemTotal == 0) { if (AddedItems != null) { if (AddedItems.length > 0) { if (AddedItems[0].GroupItems.length > 0) { StorageLocationId = AddedItems[0].GroupItems[0].LId; for (var w = 0; w < AddedItems.length; w++) { for (var F = 0; F < AddedItems[w].GroupItems.length; F++) { if (AddedItems[w].GroupItems[F].OfferName != null) ItemTotal = +ItemTotal + +(parseFloat(AddedItems[w].GroupItems[F].Price) - parseFloat(AddedItems[w].GroupItems[F].OfferValue)); else { ItemTotal = +ItemTotal + +AddedItems[w].GroupItems[F].Price; SubTotal = +SubTotal + +AddedItems[w].GroupItems[F].Price; } arr[w] = { Id: AddedItems[w].Id }; } } } } } } } } } if (StorageLocationId == LocationId || StorageLocationId == "") { var AppId = document.getElementById('lblAppId1').value; var Total = document.getElementById("lblTotalPriceforPromos").innerHTML; var UId = document.getElementById("UserId").innerHTML; var Site = location.host; var OrderType = localStorage.getItem("GroupOrderType"); var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.selectedIndex != -1) { OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].value; } else { if (OrderType == "Delivery") OrderType = "Delivery"; else if (OrderType == "Shipping") OrderType = "Shipping"; else OrderType = "Pickup"; } if (Site == "localhost:27746" || Site == "107.130.183.186:8064" || Site == "www.munchem.com" || Site == "64.37.50.50") Site = "MunchEm Website/App"; else if (Site == "touristeats.com" || Site == "216.239.163.155:874") Site = "TouristEats.com"; else Site = "Restaurant Website/App"; var RawOffset = document.getElementById('lblrawoffset').innerHTML; if (AddedItems != null) { if (AddedItems.length > 0) { if (document.getElementById("Promocodetxt").value != "" && SubTotal > 0 && Total != "") { $.ajax({ type: "POST", url: "orders.aspx/PromoValidations", data: "{'AppId': '" + AppId + "', 'PromoCode':'" + PromoCode + "','Total':'" + Total + "','SubTotal':'" + SubTotal + "','UId':'" + UId + "','LocationId':'" + LocationId + "' ,'Site':'" + Site + "', 'TimeZoneName':'" + document.getElementById('lbltimezonename').value + "','OrderType':'" + escape(OrderType) + "','RawOffset':'" + RawOffset + "','Items':'" + JSON.stringify(arr) + "', 'ItemTotal':'" + ItemTotal + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0] != null && msg.d[0] != "") { if (msg.d[0].Action != null && msg.d[0].Action != "") { if (msg.d[0].Action == "success") { document.getElementById("CouponType").innerHTML = msg.d[0].PromotionType; document.getElementById("lblRequireuseraccount").innerHTML = msg.d[0].Requireuseraccount; document.getElementById("lblPromoprice").innerHTML = msg.d[0].DiscountType + " Coupon Applied"; var UId = document.getElementById("UserId").innerHTML; if (UId == "") { $('.promovisible').css("display", "inline-block"); $('.discountCheckout').removeAttr("style"); if (msg.d[0].Requireuseraccount == true) document.getElementById("cartpromomsg").innerHTML = "*To use a Promo you must have an account"; $('.promcartuser').css("display", "block"); $('.charitytest').css("display", "none"); document.getElementById("Userfirstorderlbl").innerHTML = msg.d[0].UserFirstorder; if (parseInt(SubTotal) < parseInt(msg.d[0].DiscountAmount)) { document.getElementById("Promoprice").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + SubTotal.toFixed(2); document.getElementById("udpv").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + SubTotal.toFixed(2); } else { document.getElementById("Promoprice").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + msg.d[0].DiscountAmount; document.getElementById("udpv").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + msg.d[0].DiscountAmount; } mainPromocalculations(); document.getElementById("promotitle").innerHTML = msg.d[0].PromotionName; document.getElementById("udpt").innerHTML = msg.d[0].PromotionName; if (document.getElementById("Promotioncodeid").innerHTML == "") document.getElementById("Promotioncodeid").innerHTML = PromoCode; $('.promocodetext').css("display", "inline-block"); $(".getdealbtn").css("display", "inline-block"); } else { document.getElementById("Userfirstorderlbl").innerHTML = msg.d[0].UserFirstorder; $('.promcartuser').css("display", "none"); $('.charitytest').css("display", "none"); if (parseInt(SubTotal) < parseInt(msg.d[0].DiscountAmount)) { document.getElementById("Promoprice").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + SubTotal.toFixed(2); document.getElementById("udpv").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + SubTotal.toFixed(2) } else { document.getElementById("Promoprice").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + msg.d[0].DiscountAmount; document.getElementById("udpv").innerHTML = "-" + document.getElementById("lblCurrency").innerHTML + msg.d[0].DiscountAmount; } document.getElementById("promotitle").innerHTML = msg.d[0].PromotionName; document.getElementById("udpt").innerHTML = msg.d[0].PromotionName; var Userfirstorder = document.getElementById("Userfirstorderlbl").innerHTML; $.ajax({ type: "POST", type: "POST", url: "orders.aspx/PromocodeLimit", data: "{ 'UId':'" + UId + "','PromoCode':'" + PromoCode + "','AppId':'" + AppId + "','PromotionType':'" + msg.d[0].PromotionType + "','LocationId':'" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "ok") { document.getElementById("Promoprice").innerHTML = ""; document.getElementById("Promotioncodeid").innerHTML = ""; DeleteDealinGroupOrder(); $("#lblorderror").text(msg.d); $(".ordererror").show().delay(3000).fadeOut(); if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } else { mainPromocalculations(); $('.promovisible').css("display", "inline-block"); $('.discountCheckout').removeAttr("style"); $('.promocodetext').css("display", "inline-block"); $(".getdealbtn").css("display", "inline-block"); // $(".getdealbtn").fadeOut("slow"); } } }); } } else if (msg.d[0].Action == "success1") { $('.charitytest').css("display", "block"); document.getElementById("Userfirstorderlbl").innerHTML = msg.d[0].UserFirstorder; document.getElementById("promotitle").innerHTML = msg.d[0].PromotionName; document.getElementById("cartpromomsg1").innerHTML = "Thank You! A donation Of " + msg.d[0].NoOfUses + " will be made in your name to:" + msg.d[0].PromotionName; document.getElementById("charitylbl").innerHTML = "Thank You! A donation Of " + msg.d[0].NoOfUses + " will be made in your name to:" + msg.d[0].PromotionName; document.getElementById("charitylbl1").innerHTML = "Thank You! A donation Of " + msg.d[0].NoOfUses + " will be made in your name to:" + msg.d[0].PromotionName; document.getElementById("Promoprice").innerHTML = document.getElementById("lblCurrency").innerHTML + msg.d[0].DiscountAmount; document.getElementById("udpv").innerHTML = document.getElementById("lblCurrency").innerHTML + msg.d[0].DiscountAmount; document.getElementById("udpv").innerHTML = document.getElementById("lblCurrency").innerHTML + msg.d[0].DiscountAmount; document.getElementById("udpt").innerHTML = msg.d[0].PromotionName; document.getElementById("lblPromoprice").innerHTML = msg.d[0].DiscountType + " Coupon Applied "; //BindPrices(0); mainPromocalculations(); $('.promocodetext').css("display", "none"); $(".getdealbtn").css("display", "none"); $(".getdealbtn").fadeOut("slow"); $('.promovisible').css("display", "inline-block"); $('.discountCheckout').removeAttr("style"); $('.promcartuser').css("display", "none"); } else { if (msg.d[0].Action.indexOf('$')) { msg.d[0].Action = msg.d[0].Action.replace("$", document.getElementById("lblCurrency").innerHTML) } $("#lblorderror").text(msg.d[0].Action); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("Promoprice").innerHTML = ""; document.getElementById("Promotioncodeid").innerHTML = ""; DeleteDealinGroupOrder(); if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } } else { $("#lblorderror").text("Invalid Promo/Coupon Code"); $(".ordererror").show().delay(3000).fadeOut(); if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } } }); } else { if (SubTotal == 0) { if (AddedItems.length > 0) { if (AddedItems[0].GroupItems.length > 0) { if (CouponFor >= 1) { if (isCouponlen == 0) { $("#lblorderror").text("Coupon code does not exists."); } else { $("#lblorderror").text("Coupon not applicable for any one of added items"); } $(".ordererror").show().delay(3000).fadeOut(); localStorage.removeItem("PromoEntered"); $('.btnusingpromotion').css("display", "none"); document.getElementById("Promoprice").innerHTML = ""; $('.promovisible').css("display", "none"); $('.discountCheckout').css("display", "none"); $('.promcartuser').css("display", "none"); $('.promocodetext').css("display", "inline-block"); $(".getdealbtn").fadeIn("slow"); if (document.getElementById("lblAllowinstore").innerHTML == "true") { $('#bntConfOrder').css("display", "block"); if (document.getElementById("lblCustomizedcash").innerHTML == "true") { $('#mbntConfOrder').css("display", "block"); } } $('#Button6').css("display", "block"); $('.charitytest').css("display", "none"); document.getElementById("Promotioncodeid").innerHTML = ""; document.getElementById("charitylbl").innerHTML = ""; document.getElementById("promotitle").innerHTML = ""; document.getElementById("CouponType").innerHTML = ""; document.getElementById("lblRequireuseraccount").innerHTML = ""; document.getElementById("cartpromomsg").innerHTML = ""; } } } } //$("#lblorderror").text("Invalid Coupon"); //$(".ordererror").show().delay(3000).fadeOut(); if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } } //else { // $("#lblorderror").text("Invalid Coupon"); // $(".ordererror").show().delay(3000).fadeOut(); // BindPrices(0); //} } else { $("#lblorderror").text("Sorry you are trying to place an order with multiple restaurants. Once refresh the page and try again"); $(".ordererror").show().delay(3000).fadeOut(); $(".userdeliveryloader1").fadeOut("fast"); return; } } }); } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } else { if (GroupId != null && GroupId != "" && GroupId != undefined) { BindPricesinGrouporder(); } else { BindPrices(0); } } } function DeleteDealinGroupOrder() { $('.btnusingpromotion').css("display", "none"); document.getElementById("Promoprice").innerHTML = ""; document.getElementById('Promocodetxt').value = ""; $('.promovisible').css("display", "none"); $('.promcartuser').css("display", "none"); $('#trPromo').css("display", "block"); $(".getdealbtn").fadeIn("slow"); $('.charitytest').css("display", "none"); document.getElementById("Promotioncodeid").innerHTML = ""; document.getElementById("charitylbl").innerHTML = ""; BindPricesinGrouporder(); } function DisplayCartingrouporder(Item) { var retrievedData = localStorage.getItem("OtherMembersItems"); var AddedItems = JSON.parse(retrievedData); var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; var OrderType = "PickUp"; if (OrderType != "--Select Order Type--") { document.getElementById("choiceselect").innerHTML = ""; document.getElementById("additemserror").innerHTML = ""; var ItemId; if (document.getElementById("lblItemType").innerHTML == "AddItem") { ItemId = $(Item).attr("id"); document.getElementById('txtinstructions').value = ""; } else if (document.getElementById("lblItemType").innerHTML == "EditItem") { ItemId = $(Item.parentNode.parentNode).attr("id"); } if (ItemId == undefined) { ItemId = document.getElementById("lbldeliveryItemId").innerHTML; } // code for clearbogooffer when other items/categories selected except Offered Items. //if (document.getElementById("lblItemType").innerHTML != "EditItem") { // if (lblBogoItemId != "") { // if (lblBogoGetItemType == "Category") { // var CategoryId = $(Item.parentNode.parentNode).attr("id").replace("ItemsOf", ""); // if (CategoryId != lblBogoItemId && ItemId != lblBogoItemId) // ClearBogoOffer(); // } // else { // if (ItemId != lblBogoItemId) // ClearBogoOffer(); // } // } //} $.ajax({ type: "POST", url: "Orders.aspx/GetItemVariations", data: "{'ItemId': '" + ItemId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (document.getElementById('divVariations') != null && document.getElementById('divVariations') != undefined) { document.getElementById('divVariations').innerHTML = ""; localStorage.removeItem("ItemVariation"); var Variations = new Array(); if (msg.d.length > 0) { var ddlVariation = document.createElement("select"); ddlVariation.options.add(new Option("Select Variation", "")); setAttributes(ddlVariation, { "style": "width: 200px;height: 25px;", "class": "ddlVariation", "id": "ddlVariation", "onchange": "gettotalprice()" }); for (var V = 0; V < msg.d.length; V++) { var Variation = new Object; Variation.Id = msg.d[V].Id; Variation.Name = msg.d[V].Name; Variation.Price = msg.d[V].Price.toFixed(2); Variations.push(Variation); ddlVariation.options.add(new Option(msg.d[V].Name + " " + document.getElementById("lblCurrency").innerHTML + msg.d[V].Price, msg.d[V].Id)); } localStorage.setItem("ItemVariation", JSON.stringify(Variations)); document.getElementById('divVariations').appendChild(ddlVariation); } } $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + ItemId + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { MainCategoryId = msg.d[0].MainCategoryId; $(".lblitemmesg").text(msg.d[0].OptionName); $("#lblitemmesg").css("display", "none"); $(".grditemspanel .wiilldeliver").text(msg.d[0].OptionName); if (msg.d[0].ItemImage != null) { $("#ItemImageDisplay").attr("src", msg.d[0].ItemImage); $("#ItemImageDisplay").removeAttr("style"); $("#ItemImageDisplay").attr("style", "display:block;"); GetMultipleItemImages(ItemId); } else { $("#ItemImageDisplay").attr("src", ""); $("#ItemImageDisplay").attr("style", "display:none;"); } if (msg.d[0].Type != null && msg.d[0].Type != "null" && msg.d[0].Type != "\n") { $(".lbldescription").text(msg.d[0].Type); } else { $(".lbldescription").text(""); } lblItemNoTax = msg.d[0].NoSalesTax; document.getElementById("PriceVal").innerHTML = msg.d[0].Price; if (document.getElementById('txtunitquantity') != undefined) { if (msg.d[0].PriceType == "Per Unit") { document.getElementById("tdunitPrice").style.display = ""; document.getElementById("lblunitprice").innerHTML = msg.d[0].Price; document.getElementById("lblunit").innerHTML = msg.d[0].UnitType; } else { document.getElementById("tdunitPrice").style.display = "none"; } localStorage.setItem("priceType", msg.d[0].PriceType); localStorage.setItem("UnitType", msg.d[0].UnitType); } document.getElementById("lbldisplayItemPrice").innerHTML = document.getElementById("lblCurrency").innerHTML + (msg.d[0].Price).toFixed(2); document.getElementById("lblItemId").innerHTML = ItemId + "//" + msg.d[0].OptionName + "//" + msg.d[0].CloverOptionId + "//" + msg.d[0].PosId + ""; var deliveryCheck = document.getElementById('checkdelivery').innerHTML; if (deliveryCheck == "Sucess") { if (AddedItems == null) { if (OrderType == null || OrderType == "" || OrderType == "null") { OpenOrderTypePnl(""); return; } } if (OrderTypevalue != "Delivery" && msg.d[0].PickUp != true) { if ($("#lblorderror").length == 0) alertify.error("This Item is not available for " + OrderTypevalue); else { $("#lblorderror").text("This Item is not available for " + OrderTypevalue); $(".ordererror").show().delay(3000).fadeOut(); } $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + $(Item).attr("id")).css("opacity", "1"); return; } if (OrderTypevalue == "Delivery" && msg.d[0].Delivery != true) { if ($("#lblorderror").length == 0) alertify.error("This Item is not available for Delivery"); else { $("#lblorderror").text("This Item is not available for Delivery"); $(".ordererror").show().delay(3000).fadeOut(); } $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + $(Item).attr("id")).css("opacity", "1"); return; } } var s = 0; document.getElementById('OptionTable').innerHTML = ""; var Options = new Array(); for (var i = 1; i < msg.d.length; i++) { document.getElementById('OptionTable').style.display = "block"; document.getElementById('PreviewOptionTable').style.display = "none"; var tableOption = document.createElement("table"); tableOption.setAttribute("class", "optionrow"); tableOption.setAttribute("style", optionColor); var trOption = document.createElement("tr"); trOption.setAttribute("style", "font-weight:bold;"); var tdOption = document.createElement("td"); setAttributes(tdOption, { "class": "Optiontd", "colspan": "3" }); var lblOption = document.createElement("span"); lblOption.innerHTML += d[i].OptionName; lblOption.setAttribute("id", "ItemOption" + d[i].OptionId); var lblrequired = document.createElement("span"); tdOption.appendChild(lblOption); tdOption.appendChild(lblrequired); if (d[i].Type == "CheckBoxes") { if (d[i].MaxSize > 0) { if (d[i].MaxSize != 100 && d[i].MaxSize != d[i].Choice.length) { var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "padding-left:5px;display:none;" + OptionTextColor, "id": "ItemOptionSelection" + d[i].OptionId }); lblOptionSelection.innerHTML += "(Max Selection: " + d[i].MaxSize + ")"; tdOption.appendChild(lblOptionSelection); lblrequired.innerHTML = "<span style='float:right;color:Green;'>Optional</span>"; } } if (d[i].MinSize > 0) { if (d[i].MinSize != 100) { if (document.getElementById("choiceselect").innerHTML == "") { document.getElementById("choiceselect").innerHTML = d[i].OptionId; } else { document.getElementById("choiceselect").innerHTML = document.getElementById("choiceselect").innerHTML + "," + d[i].OptionId } var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "padding-left:5px;color:" + OptionTextColor, "id": "ItemOptionSelectionMin" + d[i].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "(Min Selection: " + d[i].MinSize + ")"; tdOption.appendChild(lblOptionSelection); lblrequired.innerHTML = "<span style='float:right;color:red;'>Required</span>"; } } if (d[i].FreeOptions > 0) { var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "color:red;padding-left:5px;", "id": "ItemOptionSelectionMin" + d[i].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "Select " + d[i].OptionName + " with no cost(you have " + d[i].FreeOptions + " free options)"; tdOption.appendChild(lblOptionSelection); } } trOption.appendChild(tdOption); tableOption.appendChild(trOption); if (d[i].OptionQuantity == true) { var trQuantity = document.createElement("tr"); trQuantity.setAttribute("style", "font-weight:bold;"); var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Optiontd", "colspan": "3" }); var lblQuantity = document.createElement("span"); lblQuantity.innerHTML += "Please select " + d[i].QuantitySelection + " by quantity"; /// lblQuantity.setAttribute("id", "ItemOption" + d[i].OptionId); tdQuantity.appendChild(lblQuantity); trQuantity.appendChild(tdQuantity); tableOption.appendChild(trQuantity); } var option = new Object; option.Type = d[i].Type; option.Id = d[i].OptionId; option.MinSize = d[i].MinSize; option.MaxSize = d[i].MaxSize; option.FreeOptions = d[i].FreeOptions; option.Name = d[i].OptionName; option.OptionQuantity = d[i].OptionQuantity; option.QuantitySelection = d[i].QuantitySelection; option.Collapse = d[i].Collapse; option.DefaultOptionText = d[i].DefaultOptionText; option.CloverOptionId = d[i].CloverOptionId; option.Chargable = d[i].Chargable; option.PosId = d[i].PosId; option.Choices = new Array(); // document.getElementById('OptionTable').appendChild(trOption); if (d[i].Type == "Radio Buttons" || d[i].Type == "CheckBoxes") { if (d[i].FreeOptions > 0) { d[i].Choice.sort(function (a, b) { return parseFloat(a.Price) - parseFloat(b.Price); }); //d[i].Choice.sort((a, b) => parseFloat(a.Price) - parseFloat(b.Price)); } var AddRow = ""; for (L = 0; L < d[i].Choice.length; L++) { var Choice = new Object; Choice.Id = d[i].Choice[L].Id; Choice.Name = d[i].Choice[L].ChoiceName; Choice.Notify = d[i].Choice[L].Notify; Choice.DefaultVSOption = d[i].Choice[L].DefaultVSOption; Choice.Price = d[i].Choice[L].Price.toFixed(2); Choice.Exist = d[i].Choice[L].Exist; Choice.FreeOptions = "No"; Choice.SelectionCount = 0; option.Choices.push(Choice); var trChoice = document.createElement("tr"); setAttributes(trChoice, { "class": "optionname", "style": "color:" + OptionTextColor, "id": d[i].OptionId }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "class": "Choicetd", "align": "left" }); var lblChoice = document.createElement("label"); lblChoice.innerHTML += d[i].Choice[L].ChoiceName; setAttributes(lblChoice, { "title": d[i].Choice[L].ChoiceName, "for": d[i].Choice[L].Id, "style": "cursor:pointer;" }); var Price = 0; if (d[i].Choice[L].Price != Price.toFixed(2)) { lblChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + d[i].Choice[L].Price.toFixed(2) + ")"; } if (d[i].Type == "Radio Buttons") { lblrequired.innerHTML = "<span style='float:right;color:red;'>Required</span>"; var radio = document.createElement("input"); if (msg.d[i].Choice[L].DefaultVSOption == true) { setAttributes(radio, { "type": "radio","class":"optionscheckedwithoutoptflow" ,"checked": "true", "Name": "Choiceradio" + d[i].OptionId, "value": d[i].Choice[L].Price.toFixed(2), "id": d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(radio, { "type": "radio","class":"optionscheckedwithoutoptflow" , "Name": "Choiceradio" + d[i].OptionId, "value": d[i].Choice[L].Price.toFixed(2), "id": d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } tdChoice.appendChild(radio); } if (d[i].Type == "CheckBoxes") { if (lblrequired.innerHTML.indexOf("Required") != -1) { } else lblrequired.innerHTML = "<span style='float:right;color:green;'>Optional</span>"; var checkbox = document.createElement("input"); if (msg.d[i].Choice[L].DefaultVSOption == true) { setAttributes(checkbox, { "type": "checkbox","class":"optionscheckedwithoutoptflow" ,"checked": "true", "Name": "Choiceradio" + d[i].OptionId, "value": d[i].Choice[L].Price.toFixed(2), "id": d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(checkbox, { "type": "checkbox","class":"optionscheckedwithoutoptflow" , "Name": "Choiceradio" + d[i].OptionId, "value": d[i].Choice[L].Price.toFixed(2), "id": d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } if (d[i].MaxSize > 0) { checkbox.setAttribute("onclick", "LimitOptionsSelection(this);"); } tdChoice.appendChild(checkbox); } tdChoice.appendChild(lblChoice); trChoice.appendChild(tdChoice); if (d[i].OptionQuantity == true) { var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Choicetd", "align": "left" }); var txtQuantity = document.createElement("input"); setAttributes(txtQuantity, { "id": "Quantity" + d[i].Choice[L].Id, "type": "text", "class": "ChoicesQuantity", "disabled": "disabled", "onchange": "gettotalprice()" }); tdQuantity.appendChild(txtQuantity); trChoice.appendChild(tdQuantity); } if (d[i].ChoicesQuantity == true) { var tdddlQuantity = document.createElement("td"); setAttributes(tdddlQuantity, { "class": "Choicetd", "align": "left" }); var ddlQuantity = document.createElement("select"); setAttributes(ddlQuantity, { "id": "ddlQuantity" + d[i].Choice[L].Id, "style": "display:none;", "class": "ChoicesQuantity", "onchange": "gettotalprice()" }); for (var Q = 1; Q <= 4; Q++) { ddlQuantity.options.add(new Option(Q, Q)); } tdddlQuantity.appendChild(ddlQuantity); trChoice.appendChild(tdddlQuantity); } if (d[i].FreeOptions > 0) { if (AddRow == "" && Choice.Price > 0) { var trChoiceFreeOptions = document.createElement("tr"); var tdChoiceFreeOptions = document.createElement("td"); var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "color:red;padding-left:5px;font-weight: bold;", "id": "ItemOptionSelectionMin" + d[i].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "Select " + d[i].OptionName + " for additional pricing"; tdChoiceFreeOptions.appendChild(lblOptionSelection); trChoiceFreeOptions.appendChild(tdChoiceFreeOptions); tableOption.appendChild(trChoiceFreeOptions); AddRow = "Exist"; } } tableOption.appendChild(trChoice); if (d[i].Choice[L].Exist == true) { var childExist = document.createElement("img"); setAttributes(childExist, { "src": "https://www.munchem.com/images/childExpand.png", "style": "width: 15px;vertical-align: top; margin-left: 4px;" }); lblChoice.appendChild(childExist); var childExisttr = document.createElement("tr"); setAttributes(childExisttr, { "id": "childOption" + d[i].Choice[L].Id }); tableOption.appendChild(childExisttr); } } Options.push(option); } else if (msg.d[i].Type == "Dropdown") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var ddlOption = document.createElement("select"); ddlOption.options.add(new Option("Select One", "")); setAttributes(ddlOption, { "style": "width: 200px;height: 25px;", "id": d[i].OptionId, "class": "ddlOption Validate", "onchange": "gettotalprice()" }); for (var S = 0; S < d[i].Choice.length; S++) { var Choice = new Object; Choice.Id = d[i].Choice[S].Id; Choice.Name = d[i].Choice[S].ChoiceName; Choice.Notify = d[i].Choice[S].Notify; Choice.DefaultVSOption = d[i].Choice[S].DefaultVSOption; Choice.Price = d[i].Choice[S].Price.toFixed(2); Choice.Exist = d[i].Choice[S].Exist; option.Choices.push(Choice); ddlOption.options.add(new Option(d[i].Choice[S].ChoiceName + " " + document.getElementById("lblCurrency").innerHTML + d[i].Choice[S].Price, d[i].Choice[S].Id)); } tdChoice.appendChild(ddlOption); trChoice.appendChild(tdChoice); tableOption.appendChild(trChoice); Options.push(option); if (d[i].Choice.length > 0) { lblrequired.innerHTML += "<span style='float:right;color:red;'>Required</span>"; } } if (d[i].Type == "Multiline Textbox") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var textbox = document.createElement("textarea"); setAttributes(textbox, { "class": "Choicetext", "id": d[i].OptionId }); tdChoice.appendChild(textbox); trChoice.appendChild(tdChoice); tableOption.appendChild(trChoice); Options.push(option); } document.getElementById('OptionTable').appendChild(tableOption); } FreeOptionCount = 1; localStorage.setItem("OptionCheck", JSON.stringify(Options)); if (document.getElementById("lblItemType").innerHTML == "AddItem") { if (lblBogoItemId != "") { document.getElementById('txtquantity').value = lblBogoOfferQ; document.getElementById("lbldisplayItemPrice").innerHTML = document.getElementById("lblCurrency").innerHTML + (parseFloat(document.getElementById("PriceVal").innerHTML) * parseFloat(lblBogoOfferQ)).toFixed(2); } else { document.getElementById('txtquantity').value = "1"; if (document.getElementById('txtunitquantity') != undefined) document.getElementById('txtunitquantity').value = "1"; } var Sucess = document.getElementById('checkdelivery').innerHTML; if (Sucess != "Sucess" && Sucess != "") { //document.getElementById('grditemspanel').style.display = "none"; if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "block"); $(".fcontainer").css("display", "block"); $(".Ordersmain").css("display", "block"); $(".orderdivr").css("display", "block"); $(".griditemscroll").css("width", "90%"); document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".mblcheckbtndiv").css("display", "inline-block"); } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".checkbtndiv").css("display", "inline-block"); } } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } } else { HideMenu(); if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "none"); $(".fcontainer").css("display", "none"); $(".Ordersmain").css("display", "none"); $(".orderdivr").css("display", "none"); $(".griditemsmodal").css("background-color", "white"); $(".griditemscroll").css("width", "100%"); $(".grditemspanel").fadeIn("slow"); $(".itemimageshow").css("width", "100%"); $(".itemimageshow").css("height", "320px"); $(".itemimageshow").css("object-fit", "cover"); $("#txtinstructions").css("margin-bottom", "100px;"); $(".txtinstructions").addClass("txtinstructionscs"); $("#lblitemmesg").css("display", "none"); $(".itemmain").css("display", "none"); $(".itemnamecs").css("display", "block"); $(".closeitemdiv").css("display", "block"); } else { $(".grditemspanel").fadeIn("slow"); } } else { $(".grditemspanel").fadeIn("slow"); } } if (MenuTheme1 == "Grid") { if (window.innerWidth < 767) $(".grditemspanel").css("margin-top", $(document).scrollTop() - 500); } else $(".grditemspanel").css("margin-top", $(document).scrollTop() - 0); $(".addcategoryloadingimage1").css("display", "none"); RemovemarginTop(); } else if (document.getElementById("lblItemType").innerHTML == "EditItem") { if (MenuTheme1 == "Grid") { $(".scrollcart").removeClass("mncatnewpopup"); $(".carright").removeClass("mncatnewpopupsub"); $(".scrollcart").css("display", "none"); $("body").removeAttr("style"); $("body").attr("style",PageBackgroundColor); } document.getElementById('txtquantity').value = "1"; if (MenuTheme1 == "Grid") { if (window.innerWidth < 767) $(".grditemspanel").css("margin-top", $(document).scrollTop() - 500); } else $(".grditemspanel").css("margin-top", $(document).scrollTop() - 0); $(".addcategoryloadingimage1").css("display", "none"); SelectOptionsforgrouporder(Item); $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage2").css("display", "none"); RemovemarginTop(); } $("#" + $(Item).attr("id")).css("opacity", "1"); } } }); } }); } } function userdeliveryaddressvalidationinGroupOrder() { $('.errormsg').text(""); if (document.getElementById("Paytype").innerHTML != " " && document.getElementById("Paytype").innerHTML != "") { if (document.getElementById("lblCurrency").innerHTML == "$") { $('.placeorder').css("display", "none"); NewUserValidation(document.getElementById('txtmobilenumber'), document.getElementById('txtdeliverydate'), document.getElementById("ddlhr"), document.getElementById("txtcardname"), document.getElementById("txtcardno"), document.getElementById("ddlBindMonth"), document.getElementById("ddlBindYear"), document.getElementById("instructions"), document.getElementById("txtCVV"), document.getElementById("txtBZC"), document.getElementById("txtcLine1"), document.getElementById("txtcline2"), document.getElementById("txtcCity"), document.getElementById("txtCState"), document.getElementById("txtClastname")); } else { if (document.getElementById("Paytype").innerHTML != "CreditCard" && document.getElementById("Paytype").innerHTML != "PayPal") { $('.placeorder').css("display", "none"); NewUserValidation(document.getElementById('txtmobilenumber'), document.getElementById('txtdeliverydate'), document.getElementById("ddlhr"), document.getElementById("txtcardname"), document.getElementById("txtcardno"), document.getElementById("ddlBindMonth"), document.getElementById("ddlBindYear"), document.getElementById("instructions"), document.getElementById("txtCVV"), document.getElementById("txtBZC"), document.getElementById("txtcLine1"), document.getElementById("txtcline2"), document.getElementById("txtcCity"), document.getElementById("txtCState"), document.getElementById("txtClastname")); } else { $('.userdeliveryloader').css("display", "block"); var TotalPrice = document.getElementById("lbltotalamount").innerHTML; TotalPrice = TotalPrice.replace(document.getElementById("lblCurrency").innerHTML, ""); $.ajax({ type: "POST", url: "Orders.aspx/ConvertINRTOUSD", data: "{'TotalPrice': '" + TotalPrice + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { if (confirm("You need to pay the bill in USD currency. So your total amount is $" + msg.d + ". Would you like to place an order?")) { $('.placeorder').css("display", "none"); NewUserValidation(document.getElementById('txtmobilenumber'), document.getElementById('txtdeliverydate'), document.getElementById("ddlhr"), document.getElementById("txtcardname"), document.getElementById("txtcardno"), document.getElementById("ddlBindMonth"), document.getElementById("ddlBindYear"), document.getElementById("instructions"), document.getElementById("txtCVV"), document.getElementById("txtBZC"), document.getElementById("txtcLine1"), document.getElementById("txtcline2"), document.getElementById("txtcCity"), document.getElementById("txtCState"), document.getElementById("txtClastname")); } } else { alertify.error("Sorry your currency conversion from INR to USD failed."); } $('.userdeliveryloader').css("display", "none"); } }); } } } else { $('.errormsg').text("Please select payment type."); var container = document.querySelector(".yurcrt"); if (container) { container.scrollTop = container.scrollHeight; } } } function NewUserValidation(Phoneele, dateele, timeele, cardele, cardnoele, ExyMonth, ExyYear, Note, Cardcvv, BZCele, CLine1ele, Cline2ele, CCityele, CStateele, CLastNameele) { var nameexp = /^[a-zA-Z ]*$/; var count = 0; var phone = Phoneele.value; var deliverdate = dateele.value; var CardName = cardele.value.trim(); var CardNo = cardnoele.value; var DeliveryTime = ""; var CVV = Cardcvv.value; var time = timeele; var CLastName = CLastNameele.value; if (time.selectedIndex != "-1") { DeliveryTime = time.options[time.selectedIndex].text; } else { DeliveryTime = ""; } if ($('#rbtdelivery').is(':checked') || $('#rbtShipping').is(':checked')) { var city, state, zip, Line1; Line1 = document.getElementById('txtline1'); city = document.getElementById('txtcity'); state = document.getElementById('txtstate'); zip = document.getElementById('txtZip'); if (city.value != '' && state.value != '' && Line1.value != '') { count++; $(city).removeClass("reqruiredc"); $(state).removeClass("reqruiredc"); // $(zip).removeClass("reqruiredc"); $(Line1).removeClass("reqruiredc"); } else if (city.value != '' && state.value != '' && zip.value != '' && Line1.value == '') { $(Line1).focus(); $(city).removeClass("reqruiredc"); $(state).removeClass("reqruiredc"); // $(zip).removeClass("reqruiredc"); $(Line1).addClass("reqruiredc"); } else if (city.value != '' && state.value != '' && zip.value == '' && Line1.value == '') { $(Line1).focus(); $(city).removeClass("reqruiredc"); $(state).removeClass("reqruiredc"); // $(zip).addClass("reqruiredc"); $(Line1).addClass("reqruiredc"); } else if (city.value != '' && state.value == '' && zip.value == '' && Line1.value == '') { $(Line1).focus(); $(city).removeClass("reqruiredc"); $(state).addClass("reqruiredc"); // $(zip).addClass("reqruiredc"); $(Line1).addClass("reqruiredc"); } else if (city.value == '' && state.value == '' && zip.value == '' && Line1.value == '') { $(Line1).focus(); $(city).addClass("reqruiredc"); $(state).addClass("reqruiredc"); $(zip).addClass("reqruiredc"); $(Line1).addClass("reqruiredc"); } else if (city.value != '' && state.value != '' && zip.value == '' && Line1.value != '') { $(city).removeClass("reqruiredc"); $(state).removeClass("reqruiredc"); //$(zip).addClass("reqruiredc"); $(Line1).removeClass("reqruiredc"); } else if (city.value != '' && state.value == '' && zip.value == '' && Line1.value != '') { $(city).removeClass("reqruiredc"); $(state).addClass("reqruiredc"); // $(zip).addClass("reqruiredc"); $(Line1).removeClass("reqruiredc"); } else if (city.value == '' && state.value == '' && zip.value == '' && Line1.value != '') { $(city).addClass("reqruiredc"); $(state).addClass("reqruiredc"); $(Line1).removeClass("reqruiredc"); } } if (document.getElementById("Paytype").innerHTML == "CreditCard") { var CCity, CState, CZip, CLine1, CLine2; CLine1 = document.getElementById("txtcLine1").value; CLine2 = document.getElementById("txtcline2").value; CState = document.getElementById("txtCState").value; CCity = document.getElementById("txtcCity").value; CZip = BZCele.value; if (CardName != '' && CardNo != '' && CLastName != '' && CVV != '') { if (!CardName.match(nameexp) || !CLastName.match(nameexp)) { $(cardele).removeClass("reqruiredc"); $(cardnoele).removeClass("reqruiredc"); $('.errormsg').text("Enter valid Card Holder Name"); $('.placeorder').css("display", "inline-table"); return; } if (CVV.length >= 3 && CardName.match(nameexp) && CLastName.match(nameexp)) { $(Cardcvv).removeClass("reqruiredc"); var CurrDate = new Date(); var D = new Date(ExyYear.options[ExyYear.selectedIndex].text, ExyMonth.options[ExyMonth.selectedIndex].text, 0, 23, 59, 59); if (CurrDate > D) { $('.errormsg').text("Enter valid expiry date"); $('.placeorder').css("display", "inline-table"); } else { if (document.getElementById("chkcard").checked == true || $('#rbtpickup').is(':checked')) { if (CZip != '') { if (CZip.length >= 5) { count++; } else { $('.errormsg').text("Billing Zip Code must be 5-6 digits."); $(BZCele).focus(); $(BZCele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } } else { if (CZip == '') { $(BZCele).focus(); $(BZCele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } else { $(BZCele).removeClass("reqruiredc"); } if($('#txtCState').css('display') != 'none'){ if (CState == '') { $("#txtCState").focus(); $("#txtCState").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } else { $("#txtCState").removeClass("reqruiredc"); } } if($('#txtcCity').css('display') != 'none'){ if (CCity == '') { $("#txtcCity").focus(); $("#txtcCity").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } else { $("#txtcCity").removeClass("reqruiredc"); } } if($('#txtcLine1').css('display') != 'none'){ if (CLine1 == '') { $("#txtcLine1").focus(); $("#txtcLine1").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } else { $("#txtcLine1").removeClass("reqruiredc"); } } } if($('#txtCState').css('display') != 'none'){ if (CState == '') { $("#txtCState").focus(); $("#txtCState").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } else { $("#txtCState").removeClass("reqruiredc"); } } if($('#txtcCity').css('display') != 'none'){ if (CCity == '') { $("#txtcCity").focus(); $("#txtcCity").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } else { $("#txtcCity").removeClass("reqruiredc"); } } if($('#txtcLine1').css('display') != 'none'){ if (CLine1 == '') { $("#txtcLine1").focus(); $("#txtcLine1").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } else { $("#txtcLine1").removeClass("reqruiredc"); } } } else { count++; } } } else { $('.errormsg').text("Security Code must be 3-4 digits."); $(Cardcvv).focus(); $(Cardcvv).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } } else { if (document.getElementById("chkcard").checked == true) { if (CZip != '') { if (CZip.length >= 5) { } else { $('.errormsg').text("Billing Zip Code must be 5-6 digits."); $(BZCele).focus(); $(BZCele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } } else { if (CZip == '') { $(BZCele).focus(); $(BZCele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } else { $(BZCele).removeClass("reqruiredc"); } if($('#txtCState').css('display') != 'none'){ if (CState == '') { $("#txtCState").focus(); $("#txtCState").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } else { $("#txtCState").removeClass("reqruiredc"); } } if($('#txtcCity').css('display') != 'none'){ if (CCity == '') { $("#txtcCity").focus(); $("#txtcCity").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } else { $("#txtcCity").removeClass("reqruiredc"); } } if($('#txtcLine1').css('display') != 'none'){ if (CLine1 == '') { $("#txtcLine1").focus(); $("#txtcLine1").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } else { $("#txtcLine1").removeClass("reqruiredc"); } } } if($('#txtCState').css('display') != 'none'){ if (CState == '') { $("#txtCState").focus(); $("#txtCState").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } else { $("#txtCState").removeClass("reqruiredc"); } } if($('#txtcCity').css('display') != 'none'){ if (CCity == '') { $("#txtcCity").focus(); $("#txtcCity").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } else { $("#txtcCity").removeClass("reqruiredc"); } } if($('#txtcLine1').css('display') != 'none'){ if (CLine1 == '') { $("#txtcLine1").focus(); $("#txtcLine1").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } else { $("#txtcLine1").removeClass("reqruiredc"); } } } else { $("#txtcline2").removeClass("reqruiredc"); $("#txtcLine1").removeClass("reqruiredc"); $("#txtcCity").removeClass("reqruiredc"); $("#txtCState").removeClass("reqruiredc"); $(BZCele).removeClass("reqruiredc"); } if (CVV != '') { $(Cardcvv).removeClass("reqruiredc"); } else { $(Cardcvv).focus(); $(Cardcvv).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } if (CardNo != '') { $(cardnoele).removeClass("reqruiredc"); } else { $(cardnoele).focus(); $(cardnoele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } if (CLastName != '') { $("#txtClastname").removeClass("reqruiredc"); if (!CLastName.match(nameexp)) { $("#txtClastname").focus(); $('.errormsg').text("Enter valid Card Holder Name"); $('.placeorder').css("display", "inline-table"); } } else { $("#txtClastname").focus(); $("#txtClastname").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } if (CardName != '') { $(cardele).removeClass("reqruiredc"); if (!CardName.match(nameexp)) { $(cardele).focus(); $('.errormsg').text("Enter valid Card Holder Name"); $('.placeorder').css("display", "inline-table"); } } else { $(cardele).focus(); $(cardele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); } } } else { $(cardele).removeClass("reqruiredc"); $(cardnoele).removeClass("reqruiredc"); $(Cardcvv).removeClass("reqruiredc"); $(BZCele).removeClass("reqruiredc"); } if (phone != '' && deliverdate != '' && DeliveryTime != '') { $(Phoneele).removeClass("reqruiredc"); $(dateele).removeClass("reqruiredc"); $(timeele).removeClass("reqruiredc"); if (phone.length < 10) { $(Phoneele).focus(); $('.errormsg').text("Enter Valid Phone Number."); $('.placeorder').fadeIn("slow"); return; } count++; if (Note.value != "") { if (Note.value.length > 490) { $('.errormsg').text("Order instructions should be less than 500 characters."); $('.placeorder').fadeIn("slow"); return; } } if (document.getElementById("Paytype").innerHTML == "CreditCard") { if ($('#rbtdelivery').is(':checked') || $('#rbtShipping').is(':checked')) { if (count == 3) { checkTotalCartBeforePlacingOrder(); return; } } else { if (count == 2) { checkTotalCartBeforePlacingOrder(); return; } } } else if (document.getElementById("Paytype").innerHTML == "PaywithMunchies") { var eligibility = $('.munchiesAmount').text(); if (~eligibility.indexOf("You only have")) { alertify.error("Sorry You Don't have enough Munchies"); $('.placeorder').fadeIn("slow"); return; } var UId = document.getElementById("UserId").innerHTML; if (UId != "") { $.ajax({ type: "POST", url: "Orders.aspx/CheckUserEligibility", data: "{'UserId': '" + UId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.split('/')[1] == "True") { if (msg.d.split('/')[2] == "True") { if (msg.d.split('/')[0] == "Yes") { count++; if ($('#rbtdelivery').is(':checked') || $('#rbtShipping').is(':checked')) { if (count == 3) { checkTotalCartBeforePlacingOrder(); return; } } else { if (count == 2) { checkTotalCartBeforePlacingOrder(); return; } } } else { alertify.error("You are not eligible to use Points. Please call Customer Service for help"); $('.placeorder').fadeIn("slow"); return; } } else { alertify.error("Your Phone number is not verified. Please verify your Phone number before using Points"); $('.placeorder').fadeIn("slow"); return; } } else { alertify.error("Your Email is not verified. Please verify your Email before using Points"); $('.placeorder').fadeIn("slow"); return; } } }); } } else { if ($('#rbtdelivery').is(':checked') || $('#rbtShipping').is(':checked')) { if (count == 2) { checkTotalCartBeforePlacingOrder(); return; } } else { if (count == 1) { checkTotalCartBeforePlacingOrder(); return; } } } return; } else if (phone != '' && deliverdate == '' && DeliveryTime != '') { $(Phoneele).removeClass("reqruiredc"); $(dateele).addClass("reqruiredc"); $(timeele).removeClass("reqruiredc"); if (phone.length < 10) { $(Phoneele).focus(); $('.errormsg').text("Enter Valid Phone Number."); $('.placeorder').fadeIn("slow"); return; } } else if (phone != '' && deliverdate != '' && DeliveryTime == '') { $(Phoneele).removeClass("reqruiredc"); $(dateele).removeClass("reqruiredc"); $(timeele).addClass("reqruiredc"); if (phone.length < 10) { $(Phoneele).focus(); $('.errormsg').text("Enter Valid Phone Number."); return; } $('.placeorder').fadeIn("slow"); return; } else if (phone == '' && DeliveryTime == '' && deliverdate != '') { $('.placeorder').fadeIn("slow"); $(Phoneele).focus(); $(timeele).addClass("reqruiredc"); $(Phoneele).addClass("reqruiredc"); $(dateele).removeClass("reqruiredc"); return; } else if (phone == '' && DeliveryTime != '' && deliverdate != '') { $('.placeorder').fadeIn("slow"); $(Phoneele).focus(); $(timeele).removeClass("reqruiredc"); $(Phoneele).addClass("reqruiredc"); $(dateele).removeClass("reqruiredc"); return; } else if (phone == '' && DeliveryTime == '' && deliverdate == '') { $('.placeorder').fadeIn("slow"); $(Phoneele).focus(); $(timeele).addClass("reqruiredc"); $(Phoneele).addClass("reqruiredc"); $(dateele).addClass("reqruiredc"); return; } } function checkTotalCartBeforePlacingOrder() { $('.userdeliveryloader').css("display", "block"); localStorage.removeItem("GroupOTotal"); var Details = new Object; Details.Total = document.getElementById("lbltotalamount").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, ""); localStorage.setItem("GroupOTotal", JSON.stringify(Details)); document.getElementById("lblorderfail").innerHTML = "TotalCheck"; GetAllItems(); } function InsertOrderInGroupOrder() { var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; var UId = document.getElementById("UserId").innerHTML; var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (UId != "") { var time = document.getElementById("ddlhr"); $(".OrderprocessingPanel").fadeIn("slow"); $(".UserDeliveryPanel").css("display", "none"); if (time.selectedIndex != "-1") { var PointType = document.getElementById("lblAwardType").innerHTML; $('.userdeliveryloader').css("display", "block"); $('.placeorder').css("display", "none"); var GuestTime = time.options[time.selectedIndex].text; var orderesttime = document.getElementById("lblasaphr").innerHTML; var retrievedData = localStorage.getItem("OtherMembersItems"); var LocationId = document.getElementById('lblLId').value; var AppName = escape(document.getElementById('lblAppName').innerHTML); var AppId = document.getElementById('lblAppId1').value; var CompanyId = document.getElementById('lblCId').value; var GuestName = document.getElementById("FirstName").innerHTML + " " + document.getElementById("LastName").innerHTML; var GuestEmail = document.getElementById("EmailID").innerHTML; var GuestPhno = document.getElementById('txtmobilenumber').value; var UCountryName = document.getElementById('lblCountry').innerHTML; var GuestDate = document.getElementById('txtdeliverydate').value; var OrderInstructions = escape(document.getElementById('instructions').value); var TotalPrice = document.getElementById("lblTotaldelivery").innerHTML; var Tax = document.getElementById("lbltaxes").innerHTML; var Tip = document.getElementById("WTip").innerHTML; var EntityType = OrderType; var CustomOrderTypeId = OrderTypevalue; var Miles = ""; if (EntityType == "Shipping" || EntityType == "Delivery" || document.getElementById("lblPickupname").innerHTML.replace("&", "&") == OrderTypevalue) CustomOrderTypeId = ""; if ($('#rbtpickup').is(':checked')) { var Deliveryfee = "0.00"; var DiscountDeliveryFee = "0.00"; //var Tip = "0.00"; Miles = ""; var MileageCharge = "0.00"; } else { var Deliveryfee = document.getElementById("lbldelivaryfee").innerHTML; var DiscountDeliveryFee = document.getElementById("lbldiscountdeliveryfee").innerHTML; Miles = localStorage.getItem("Miles"); var MileageCharge = document.getElementById("lblMileageCharge").innerHTML; } if (Miles == "" || Miles == null) { Miles = "0.00"; } var Subtotal = document.getElementById("lblAlltotalprice").innerHTML; var PaymentType = document.getElementById("Paytype").innerHTML; var sPath = window.location.pathname; var RestaurantName = sPath.substring(sPath.lastIndexOf('/') + 1); var PValue = document.getElementById('Promocodetxt').value; if (PValue == "Enter Promo Code") { PValue = ""; } if (document.getElementById("lblbconvenience").innerHTML != "") { var ConvenienceFee = document.getElementById("lblbconvenience").innerHTML; } else { var ConvenienceFee = 0; } if (GuestTime == "") { $('.placeorder').fadeIn("slow"); document.getElementById("lblorderfail").innerHTML = ""; $("#lblorderror").text("Sorry you can't place an order using ASAP time. Plz try with another time."); $(".ordererror").show().delay(3000).fadeOut(); $('.userdeliveryloader').css("display", "none"); return; } var CardConvenienceFee = document.getElementById("lblcardconviencefee").innerHTML.toLowerCase(); var promotitle = document.getElementById("promotitle").innerHTML; var Promoprice = document.getElementById("Promoprice").innerHTML; var Line1 = document.getElementById("txtline1").value; var Line2 = document.getElementById("txtline2").value; var City = document.getElementById("txtcity").value; var Zip = document.getElementById("txtZip").value; var State = document.getElementById("txtstate").value; var RestAddr = document.getElementById('restaddr').innerHTML; var RestPhno = document.getElementById('RestPhno').innerHTML; var LocationName = document.getElementById('lbllocationname').innerHTML; var RestName = document.getElementById('lblAppName').innerHTML; var LastName = ""; if (promotitle != "") { if (document.getElementById("charitylbl").innerHTML == "") { var PromoType = "User Discount"; } else { var PromoType = "Charity"; } } else { var PromoType = ""; } if (document.getElementById('OpenorClose').innerHTML == "Closed Now") { var PhoneCallStatus = "false"; } else { var PhoneCallStatus = "true"; } if (document.getElementById("Conveniencelbl").innerHTML != 0) { var ConvenienceFee1 = document.getElementById("Conveniencelbl").innerHTML } else { var ConvenienceFee1 = 0; } var AdvancedLabel = document.getElementById("txtAdvancedlbl").value; if (document.getElementById("lblindication").innerHTML == "TextBox to Enter Customer Location" || document.getElementById("lblindication").innerHTML == "CustomerOrderDetails") AdvancedLabel = document.getElementById("txtCustomerOrderDe").value; var G1 = document.getElementById("ddldropdownoptions"); if (G1.selectedIndex != "-1") { AdvancedLabel = G1.options[G1.selectedIndex].value } if (AdvancedLabel != "" && AdvancedLabel != "0") AdvancedLabel = $("#lblpickuptext").text() + ": " + AdvancedLabel; if (AdvancedLabel == "0") AdvancedLabel = ""; var Orderstring = getQueryStrings(); var OrderFrom; var CustomWebsites = Orderstring["CustomWebsites"]; if (CustomWebsites != undefined) { if (CustomWebsites == "FaceBookOrdering") { OrderFrom = "FaceBook"; } else if (document.getElementById("lblcwurl").innerHTML != "") { OrderFrom = document.getElementById("lblcwurl").innerHTML; } else { OrderFrom = "MunchEm Website"; } } else if (document.getElementById("lblcwurl").innerHTML != "") { OrderFrom = document.getElementById("lblcwurl").innerHTML; } else { OrderFrom = "MunchEm Website"; } if (ConvenienceFee != 0) { ConvenienceFee = ConvenienceFee.replace(document.getElementById("lblCurrency").innerHTML, ''); } if (EntityType == "Shipping" || EntityType == "Delivery") { Deliveryfee = document.getElementById("lbldelivaryfee").innerHTML; DiscountDeliveryFee = document.getElementById("lbldiscountdeliveryfee").innerHTML; } Subtotal = Subtotal.replace(document.getElementById("lblCurrency").innerHTML, ''); TotalPrice = TotalPrice.replace(document.getElementById("lblCurrency").innerHTML, ''); var TimeZoneName = document.getElementById('lbltimezonename').value; var RawOffset = document.getElementById('lblrawoffset').innerHTML; var ZoneId = localStorage.getItem("Zone"); //var OrderType = "PickUp"; if ($('#rbtdelivery').is(':checked')) { OrderType = "Delivery"; } else if ($('#rbtShipping').is(':checked')) { OrderType = "Shipping"; } var SpType = "Guestsp"; if ($('#rbtdelivery').is(':checked')) { var G = document.getElementById("ddlsavedaddress"); var AddressId = G.options[G.selectedIndex].value; if (AddressId != "0") { SpType = "Usersp"; } } if (PaymentType == "CreditCard") { var Amount = document.getElementById("lbltotalamount").innerHTML; Amount = Amount.replace(document.getElementById("lblCurrency").innerHTML, ""); if (document.getElementById("lblCurrency").innerHTML == "$") { Country = "US"; } else { Country = "IN"; } var CTables = new Array(); var CardDetails = new Object; var monthddl = document.getElementById("ddlBindMonth"); var Month = monthddl.options[monthddl.selectedIndex].text; var yddl = document.getElementById("ddlBindYear"); var Year = yddl.options[yddl.selectedIndex].text; CardDetails.FirstName = document.getElementById("txtcardname").value; CardDetails.LastName = document.getElementById("txtClastname").value; CardDetails.CardHoldersName = document.getElementById("txtcardname").value; CardDetails.CardNumber = document.getElementById("txtcardno").value; CardDetails.ExpiryMonth = Month; CardDetails.ExpiryYear = Year; CardDetails.OrderAmount = Amount; CardDetails.Country = Country; CardDetails.CVV = document.getElementById("txtCVV").value; CardDetails.BillingZipCode = document.getElementById("txtBZC").value; CardDetails.PayPalBillingAddress = new Object; if (document.getElementById("chkcard").checked == true) { CardDetails.PayPalBillingAddress.Line1 = document.getElementById("txtcLine1").value; CardDetails.PayPalBillingAddress.Line2 = document.getElementById("txtcline2").value; CardDetails.PayPalBillingAddress.City = document.getElementById("txtcCity").value; CardDetails.PayPalBillingAddress.State = document.getElementById("txtCState").value; CardDetails.PayPalBillingAddress.Zip = document.getElementById("txtBZC").value; CardDetails.PayPalBillingAddress.Country = Country; } else { CardDetails.PayPalBillingAddress.Line1 = document.getElementById("txtaddress").value; CardDetails.PayPalBillingAddress.Line2 = ""; CardDetails.PayPalBillingAddress.City = document.getElementById("txtvalidationcity").value; CardDetails.PayPalBillingAddress.State = document.getElementById("txtvalidationstate").value; CardDetails.PayPalBillingAddress.Zip = document.getElementById('txtvalidationzip').value; CardDetails.PayPalBillingAddress.Country = Country; } CTables.push(CardDetails); localStorage.setItem("CreditCardDetails", JSON.stringify(CTables)); } $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/InsertUserDelivery", data: "{'retrievedData': '" + retrievedData + "','GuestName': '" + GuestName + "','GuestEmail': '" + GuestEmail + "','GuestPhno': '" + GuestPhno + "','GuestDate': '" + GuestDate + "','GuestTime': '" + GuestTime + "','OrderInstructions': '" + OrderInstructions + "','PaymentType': '" + PaymentType + "','TotalPrice': '" + TotalPrice + "','Tax': '" + Tax + "','Subtotal': '" + Subtotal + "','AppId': '" + AppId + "','LocationId': '" + LocationId + "','CompanyId': '" + CompanyId + "','UId': '" + UId + "','UCountryName': '" + UCountryName + "','Deliveryfee': '" + Deliveryfee + "','AddressId': '" + AddressId + "','AppName': '" + AppName + "','Tip' :'" + Tip + "','PValue':'" + PValue + "' ,'Promoprice':'" + Promoprice + "','Line1': '" + Line1 + "','Line2': '" + Line2 + "','City' :'" + City + "','State':'" + State + "' ,'Zip':'" + Zip + "','SpType': '" + SpType + "','ConvenienceFee': '" + ConvenienceFee + "','ConvenienceFeePercentage': '" + ConvenienceFee1 + "', 'PhoneCallStatus': '" + PhoneCallStatus + "', 'OrderFrom': '" + OrderFrom + "','TimeZone':'" + TimeZoneName + "','MileageCharge':'" + MileageCharge + "','Miles':'" + Miles + "','ZoneId':'" + ZoneId + "','DiscountDeliveryFee':'" + DiscountDeliveryFee + "','OrderType':'" + OrderType + "', 'CardDetails': '" + localStorage.getItem("CreditCardDetails") + "','RawOffset':'" + RawOffset + "','OrderETime':'" + orderesttime + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { if (msg.d[0].Action == "Success") { if (PaymentType == "SquareCreditCard") { PaymentType = "CreditCard"; } if (PaymentType == "Cash") { if (CardConvenienceFee == "true") { if (ConvenienceFee != "") { var TotalOrderPrice = TotalPrice - ConvenienceFee; TotalPrice = TotalOrderPrice.toFixed(2); } } } var Tables = new Array(); var AddTable = new Object; AddTable.UId = UId; AddTable.Tip = Tip; AddTable.MileageCharge = MileageCharge; AddTable.AppId = AppId; AddTable.AppName = AppName; AddTable.CompanyId = CompanyId; AddTable.LocationId = LocationId; AddTable.GuestName = GuestName; AddTable.GuestEmail = GuestEmail; AddTable.GuestPhno = GuestPhno; AddTable.UCountryName = UCountryName; AddTable.GuestDate = GuestDate; AddTable.GuestTime = msg.d[0].Time; AddTable.TimeRange = GuestTime; AddTable.TotalPrice = TotalPrice; AddTable.Line1 = Line1; AddTable.Line2 = Line2; AddTable.OrderFrom = OrderFrom; AddTable.City = City; AddTable.State = State; AddTable.promotitle = promotitle; AddTable.Promoprice = Promoprice; AddTable.Zip = Zip; AddTable.Tax = document.getElementById("lbltaxConven").innerHTML; AddTable.TaxLabel = document.getElementById("Taxeslabel").innerText; AddTable.SpType = SpType; AddTable.PValue = PValue; AddTable.AddressId = AddressId; AddTable.Deliveryfee = Deliveryfee; AddTable.Subtotal = Subtotal; AddTable.TypeOfOrder = EntityType; AddTable.OrderInstructions = OrderInstructions; AddTable.PaymentType = PaymentType; AddTable.PointType = PointType; var erndpnts = document.getElementById("lblearnedpoints").innerHTML; if (erndpnts != "") { erndpnts = erndpnts.split(" "); AddTable.EarnedPoints = erndpnts[0]; } else { AddTable.EarnedPoints = ""; } var awrdpnt = document.getElementById("AwardPoint").innerHTML; if (awrdpnt != "") { AddTable.AwardPoint = awrdpnt; } else { AddTable.AwardPoint = ""; } var valueofpoint = document.getElementById("lblValueOfPoint").innerHTML; if (valueofpoint != "") { AddTable.Worth = valueofpoint; } else { AddTable.Worth = ""; } AddTable.CustomOrderTypeId = CustomOrderTypeId; AddTable.CardConvenienceFee = CardConvenienceFee; if (OrderType == document.getElementById("lblPickupname").innerHTML.replace("&", "&")) { AddTable.PickupButtonName = document.getElementById("lblPickupname").innerHTML.replace("&", "&"); AddTable.OrderNotes = $(".TextNotes").text(); AddTable.AdvancedLabel = ""; } else { if (EntityType != "Delivery" && EntityType != "Shipping") { AddTable.PickupButtonName = ""; AddTable.OrderNotes = $(".TextNotes").text(); AddTable.AdvancedLabel = escape(AdvancedLabel); } else AddTable.OrderNotes = $("#lbldeliveryOrdernote").text(); } AddTable.UserType = EntityType; if (GroupId != null && GroupId != "" && GroupId != undefined) AddTable.OrderType = "Group Order"; else AddTable.OrderType = "Normal Order"; AddTable.PromoType = PromoType; AddTable.RestPhno = RestPhno; AddTable.contactEmail = document.getElementById('lblContactEmail').innerHTML; AddTable.RestAddr = RestAddr; AddTable.RestName = RestName; AddTable.LocationName = LocationName; AddTable.LastName = LastName; AddTable.ConvenienceFee = ConvenienceFee; AddTable.OrderId = msg.d[0].GenerateId; AddTable.NewOrderId = msg.d[0].NewOrderId; AddTable.PosId = msg.d[0].PosId; Tables.push(AddTable); localStorage.setItem("PaymentSucessOrder", JSON.stringify(Tables)); var parentUrl = document.getElementById("lblcwurl").innerHTML; var parentUrl1 = document.getElementById("lblcwurl1").innerHTML; if (PaymentType == "Instamojo") { if (TotalPrice > 10) window.location = "Instamojo.aspx?Email=" + GuestEmail + "&PhNo=" + GuestPhno; else { $("#lblordalert").text("Sorry minimum Order Amount should be greater than " + document.getElementById("lblCurrency").innerHTML + 10 + " for online payments."); $(".orderalert").fadeIn(); $('.placeorder').fadeIn("slow"); $('.userdeliveryloader').css("display", "none"); $('.OrderprocessingPanel').css("display", "none"); return; } } else { var Orderstring = getQueryStrings(); var CustomWebsites = Orderstring["demo"]; if (CustomWebsites == "demo") { var UrlName = '/HOAGIESCafe'; window.location.href = UrlName + '/confirmation?demo=demo'; } else if (parentUrl1 == "") { var UrlName = '/HOAGIESCafe'; window.location.href = UrlName + '/confirmation?GroupId='+GroupId; } else { window.parent.location = parentUrl1 + "?Status=C"; } } } else { if (UId != null) { $('.placeorder').css("display", "inline-block"); if (msg.d[0].Action == "Please verify your Phone Number from My Account -> My Profile screen to use Points") { $(".OrderprocessingPanel").css("display", "none"); $('.userdeliveryloader').css("display", "none"); $(".UserDeliveryPanel").css("display", "none"); if (confirm("Your mobile number was not verified with us. would you like to verify now? Please check your mobile and enter the activation code")) { $.ajax({ type: "POST", url: "Orders.aspx/SendActivationcodetouser", data: "{'UserId': '" + UId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d == "Success") { $(".ActivateMobileconfirm").fadeIn("slow"); $(".placeorderloaderdiv").css("display", "none"); $(".placeorderbtndiv").css("display", "inline-block"); } else { $(".placeorderloaderdiv").css("display", "none"); $(".placeorderbtndiv").css("display", "inline-block"); } } }); } else { $(".placeorderloaderdiv").css("display", "none"); $(".placeorderbtndiv").css("display", "inline-block"); OrderFailed(msg.d[0].Action); $(".OrderprocessingPanel").css("display", "none"); $(".UserDeliveryPanel").css("display", "block"); } } else { OrderFailed(msg.d[0].Action); $(".OrderprocessingPanel").css("display", "none"); $(".UserDeliveryPanel").css("display", "block"); } } else { OrderFailed(msg.d[0].Action); $(".OrderprocessingPanel").css("display", "none"); $(".UserDeliveryPanel").css("display", "block"); } } } else { OrderFailed("Sorry your order failed."); $(".OrderprocessingPanel").css("display", "none"); $(".UserDeliveryPanel").css("display", "block"); } } }); } else { alertify.error("Item(s) in your cart are no longer available for ordering today. Either remove these Order for Later Items or place your order for a future day."); } } } function SelectOptionsforgrouporder(Item) { var OrderType = localStorage.getItem("GroupOrderType"); var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberId; var MemberType; if (Details != null) { MemberId = Details.MemberId; MemberType = Details.MemberType; } var retrievedData = localStorage.getItem("OtherMembersItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { for (var M = 0; M < AddedItems.length; M++) { if (AddedItems[M].Id == MemberId || MemberType == "Admin") { var Id = ($(Item).attr("id")).replace("EditItem", ""); for (var Itemcount = 0; Itemcount < AddedItems[M].GroupItems.length; Itemcount++) { if (AddedItems[M].GroupItems[Itemcount].Id == Id) { document.getElementById('txtinstructions').value = unescape(AddedItems[M].GroupItems[Itemcount].Instructions); if (AddedItems[M].GroupItems[Itemcount].OrderType == OrderType) { document.getElementById("lbldisplayItemPrice").innerHTML = document.getElementById("lblCurrency").innerHTML + AddedItems[M].GroupItems[Itemcount].Price; document.getElementById('txtquantity').value = AddedItems[M].GroupItems[Itemcount].Quantity; } if (OrderType == "Shipping") { for (var j = 0; j < AddedItems[M].GroupItems[Itemcount].Choices.length; j++) { if (AddedItems[M].GroupItems[Itemcount].Choices[j].ShippingOptionId != "") { $('#' + AddedItems[M].GroupItems[Itemcount].Choices[j].ShippingOptionId).attr('checked', true); } } } else { for (var j = 0; j < AddedItems[M].GroupItems[Itemcount].Choices.length; j++) { if (AddedItems[M].GroupItems[Itemcount].Choices[j].id != "") { $('#' + AddedItems[M].GroupItems[Itemcount].Choices[j].id).attr('checked', true); if (document.getElementById(AddedItems[M].GroupItems[Itemcount].Choices[j].id) != null) { var Children = document.getElementById(AddedItems[M].GroupItems[Itemcount].Choices[j].id); BindChildOptionsinGroupOrder(Children, Itemcount); } } else { document.getElementById(AddedItems[M].GroupItems[Itemcount].Choices[j].OptionId).value = unescape(AddedItems[M].GroupItems[Itemcount].Choices[j].ChoiceName); } } ///FreeOptions if (OrderType != "Shipping") { if (AddedItems[M].GroupItems[Itemcount].Variations.length > 0) { for (var v = 0; v < AddedItems[M].GroupItems[Itemcount].Variations.length; v++) { $('#ddlVariation').val(AddedItems[M].GroupItems[Itemcount].Variations[v].Id); } } } } } } } } } else { $("#tblOthersCart").css('opacity', '1'); $(".addcategoryloadingimage2").css("display", "none"); } $("#grditemspanel").fadeIn("slow"); } function BindChildOptionsinGroupOrder(Child, Itemcount) { var ChoiceId = $(Child).attr("id"); var OptionId = $(Child.parentNode.parentNode).attr("id"); if (document.getElementById("childOption" + ChoiceId) != null) { var childExisttr = document.getElementById("childOption" + ChoiceId); $.ajax({ type: "POST", url: "Orders.aspx/GetChildOptions", data: "{'OptionId': '" + OptionId + "','ChoiceId': '" + ChoiceId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById("childOption" + ChoiceId).innerHTML = ""; if (msg.d.length > 0) { var childExisttd = document.createElement("td"); ///////////ChildOptions for (var H = 0; H < msg.d.length; H++) { var tableChildOption = document.createElement("table"); tableChildOption.setAttribute("class", "optionChildRow"); var trChildOption = document.createElement("tr"); trChildOption.setAttribute("style", "font-weight:bold;"); var tdChildOption = document.createElement("td"); setAttributes(tdChildOption, { "class": "Optiontd", "colspan": "3" }); var lblChildOption = document.createElement("span"); lblChildOption.innerHTML += msg.d[H].OptionName; lblChildOption.setAttribute("id", "ChildOption" + msg.d[H].OptionId); tdChildOption.appendChild(lblChildOption); if (msg.d[H].Type == "CheckBoxes") { if (msg.d[H].MaxSize > 0) { if (msg.d[H].MaxSize != 100 && msg.d[H].MaxSize != msg.d[H].Choice.length) { var lblChildOptionSelection = document.createElement("span"); setAttributes(lblChildOptionSelection, { "style": "padding-left:5px;color:red;display:none;" + OptionTextColor, "id": "ItemOptionSelection" + msg.d[H].OptionId }); lblChildOptionSelection.innerHTML += "(Max Selection: " + msg.d[H].MaxSize + ")"; tdChildOption.appendChild(lblChildOptionSelection); } } if (msg.d[H].MinSize > 0) { if (msg.d[H].MinSize != 100 && msg.d[H].MinSize != msg.d[H].Choice.length) { if (document.getElementById("choiceselect").innerHTML == "") { document.getElementById("choiceselect").innerHTML = msg.d[H].OptionId; } else { document.getElementById("choiceselect").innerHTML = document.getElementById("choiceselect").innerHTML + "," + msg.d[H].OptionId } var lblChildOptionSelection = document.createElement("span"); setAttributes(lblChildOptionSelection, { "style": "padding-left:5px;color:red;" + OptionTextColor, "id": "ItemOptionSelectionMin" + msg.d[H].OptionId, "class": "ItemOptionSelectionMin" }); lblChildOptionSelection.innerHTML += "(Min Selection: " + msg.d[H].MinSize + ")"; tdChildOption.appendChild(lblChildOptionSelection); } } } trChildOption.appendChild(tdChildOption); tableChildOption.appendChild(trChildOption); var ChildOption = new Object; ChildOption.Type = msg.d[H].Type; ChildOption.Id = msg.d[H].OptionId; ChildOption.MinSize = msg.d[H].MinSize; ChildOption.MaxSize = msg.d[H].MaxSize; ChildOption.FreeOptions = msg.d[H].FreeOptions; ChildOption.DefaultOptionText = msg.d[H].DefaultOptionText; ChildOption.Name = msg.d[H].OptionName; ChildOption.Choices = new Array(); if (msg.d[H].Type == "Radio Buttons" || msg.d[H].Type == "CheckBoxes") { for (G = 0; G < msg.d[H].Choice.length; G++) { var Choice = new Object; Choice.Id = msg.d[H].Choice[G].Id; Choice.Name = msg.d[H].Choice[G].ChoiceName; Choice.Notify = msg.d[H].Choice[G].Notify; Choice.DefaultVSOption = msg.d[H].Choice[G].DefaultVSOption; Choice.Price = msg.d[H].Choice[G].Price.toFixed(2); Choice.FreeOptions = "No"; Choice.SelectionCount = 0; ChildOption.Choices.push(Choice); var trChildChoice = document.createElement("tr"); setAttributes(trChildChoice, { "class": "optionname", "style": "color:" + OptionTextColor, "id": msg.d[H].OptionId }); var tdChildChoice = document.createElement("td"); setAttributes(tdChildChoice, { "class": "Choicetd", "align": "left" }); var lblChildChoice = document.createElement("label"); lblChildChoice.innerHTML += msg.d[H].Choice[G].ChoiceName; setAttributes(lblChildChoice, { "title": msg.d[H].Choice[G].ChoiceName, "for": ChoiceId + "" + msg.d[H].Choice[G].Id, "style": "cursor:pointer;" }); var Price = 0; if (msg.d[H].Choice[G].Price != Price.toFixed(2)) { lblChildChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + msg.d[H].Choice[G].Price.toFixed(2) + ")"; } var UrlType = document.getElementById('lblurlnametype').innerHTML; if (UrlType == "DineIn") { if (document.getElementById("lblAllowcart").innerHTML == "true") { //setAttributes(lblChildChoice, { "style": "background:none;" }); } else { setAttributes(lblChildChoice, { "style": "background:none;" }); } } if (msg.d[H].Type == "Radio Buttons") { if (tdChildOption.innerHTML.indexOf("Required") != -1) { } else tdChildOption.innerHTML += "<span style='float:right;color:red;'>Required</span>"; var childradio = document.createElement("input"); setAttributes(childradio, { "type": "radio", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); tdChildChoice.appendChild(childradio); } if (msg.d[H].Type == "CheckBoxes") { var childcheckbox = document.createElement("input"); setAttributes(childcheckbox, { "type": "checkbox", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); if (msg.d[H].MaxSize > 0) { childcheckbox.setAttribute("onclick", "LimitChildOptionsSelectioninGroupOrder(this);"); } tdChildChoice.appendChild(childcheckbox); } tdChildChoice.appendChild(lblChildChoice); trChildChoice.appendChild(tdChildChoice); tableChildOption.appendChild(trChildChoice); } } if (msg.d[H].Type == "Dropdown") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var ddlOption = document.createElement("select"); setAttributes(ddlOption, { "style": "width: auto;height: 25px;margin-top:10px;max-width:60%", "id": msg.d[H].OptionId, "class": "ddlChildOption Validate", "onchange": "gettotalprice()" }); for (var S = 0; S < msg.d[H].Choice.length; S++) { var Choice = new Object; Choice.Id = msg.d[H].Choice[S].Id; Choice.Name = msg.d[H].Choice[S].ChoiceName; Choice.Notify = msg.d[H].Choice[S].Notify; Choice.DefaultVSOption = msg.d[H].Choice[S].DefaultVSOption; Choice.Price = msg.d[H].Choice[S].Price.toFixed(2); Choice.FreeOptions = "No"; Choice.SelectionCount = 0; ChildOption.Choices.push(Choice); ddlOption.options.add(new Option(msg.d[H].Choice[S].ChoiceName + " " + document.getElementById("lblCurrency").innerHTML + msg.d[H].Choice[S].Price, msg.d[H].Choice[S].Id)); } tdChoice.appendChild(ddlOption); trChoice.appendChild(tdChoice); tableChildOption.appendChild(trChoice); //Options.push(option); //if (msg.d[i].Choice.length > 0) { // lblrequired.innerHTML += "<span style='float:right;color:red;'>Required</span>"; //} } if (msg.d[H].Type == "Multiline Textbox") { var trChildChoice = document.createElement("tr"); setAttributes(trChildChoice, { "style": "font-weight:bold;" }); var tdChildChoice = document.createElement("td"); setAttributes(tdChildChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var childtextbox = document.createElement("textarea"); setAttributes(childtextbox, { "class": "Choicetext", "id": ChoiceId + msg.d[H].OptionId }); tdChildChoice.appendChild(childtextbox); trChildChoice.appendChild(tdChildChoice); tableChildOption.appendChild(trChildChoice); } childExisttd.appendChild(tableChildOption); var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == OptionId) { for (var D = 0; D < OptionsCheck[J].Choices.length; D++) { if (D == 0) { if (OptionsCheck[J].Choices[D].ChildOptions == undefined) { OptionsCheck[J].Choices[D].ChildOptions = new Array(); } } if (OptionsCheck[J].Choices[D].Id == ChoiceId) { if (OptionsCheck[J].Choices[D].ChildOptions == undefined) { OptionsCheck[J].Choices[D].ChildOptions = new Array(); } OptionsCheck[J].Choices[D].ChildOptions.push(ChildOption); localStorage.setItem("OptionCheck", JSON.stringify(OptionsCheck)); } } } } } } childExisttr.appendChild(childExisttd); } if (document.getElementById("lblItemType").innerHTML == "EditItem") { if (Itemcount != 100) { var retrievedData = localStorage.getItem("OtherMembersItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { for (var F = 0; F < AddedItems[Itemcount].GroupItems.length; F++) { for (var j = 0; j < AddedItems[Itemcount].GroupItems[F].Choices.length; j++) { if (AddedItems[Itemcount].GroupItems[F].Choices[j].Id == ChoiceId) { if (AddedItems[Itemcount].GroupItems[F].Choices[j].ChildChoices != undefined) { for (var k = 0; k < AddedItems[Itemcount].GroupItems[F].Choices[j].ChildChoices.length; k++) { if (AddedItems[Itemcount].GroupItems[F].Choices[j].ChildChoices[k].Id != "") { $('#' + AddedItems[Itemcount].GroupItems[F].Choices[j].Id + AddedItems[Itemcount].GroupItems[F].Choices[j].ChildChoices[k].Id).attr('checked', true); } else { document.getElementById(AddedItems[Itemcount].GroupItems[F].Choices[j].Id + "" + AddedItems[Itemcount].GroupItems[F].Choices[j].ChildChoices[k].OptionId).value = unescape(AddedItems[Itemcount].Choices[j].ChildChoices[k].ChoiceName); } } } } } } } var forID = $("label[for='" + ChoiceId + "']"); if (forID != undefined) { if ($(forID[0].childNodes[1]).attr("src") == "images/childExpand.png") { $(forID[0].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[0].childNodes[1]).attr("alt", "Collapse"); } } } ///FreeOptions FreeOptionCount = 0; var highest = Number.NEGATIVE_INFINITY; var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var F = 0; F < AddedItems[Itemcount].GroupItems.length; F++) { for (var j = 0; j < AddedItems[Itemcount].GroupItems[F].Choices.length; j++) { if (AddedItems[Itemcount].GroupItems[F].Choices[j].ChildChoices != undefined) { for (var W = 0; W < AddedItems[Itemcount].GroupItems[F].Choices[j].ChildChoices.length; W++) { for (var J = 0; J < OptionsCheck.length; J++) { for (var K = 0; K < OptionsCheck[J].Choices.length; K++) { if (OptionsCheck[J].Choices[K].ChildOptions != undefined) { for (var M = 0; M < OptionsCheck[J].Choices[K].ChildOptions.length; M++) { if (OptionsCheck[J].Choices[K].ChildOptions[M].Id == AddedItems[Itemcount].GroupItems[F].Choices[j].ChildChoices[W].OptionId) { for (var U = 0; U < OptionsCheck[J].Choices[K].ChildOptions[M].Choices.length; U++) { if (OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].Id == AddedItems[Itemcount].GroupItems[F].Choices[j].ChildChoices[W].Id) { OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].FreeOptions = AddedItems[Itemcount].GroupItems[F].Choices[j].ChildChoices[W].FreeOptions; OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].SelectionCount = AddedItems[Itemcount].GroupItems[F].Choices[j].ChildChoices[W].SelectionCount; tmp = OptionsCheck[J].Choices[H].SelectionCount; if (tmp > highest) { highest = tmp; } } } } } } } } } } } } if (highest = Number.NEGATIVE_INFINITY) { FreeOptionCount = highest; } localStorage.setItem("OptionCheck", JSON.stringify(OptionsCheck)); ///FreeOptions } } }); } } function LimitChildOptionsSelectioninGroupOrder(ChildOption) { var ChoiceId = $(ChildOption).attr("id"); var OptionId = $(ChildOption.parentNode.parentNode).attr("id"); var p = 0; $("input[name=" + ChildOption.name + "]:checked").each(function () { p++; }); var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var J = 0; J < OptionsCheck.length; J++) { for (var K = 0; K < OptionsCheck[J].Choices.length; K++) { if (OptionsCheck[J].Choices[K].ChildOptions != undefined) { for (var M = 0; M < OptionsCheck[J].Choices[K].ChildOptions.length; M++) { if (OptionsCheck[J].Choices[K].ChildOptions[M].Id == OptionId) { var l = OptionsCheck[J].Choices[K].ChildOptions[M].MaxSize; if (l != "" && l != 0) { if (p > l) { $("#ItemOptionSelection" + ChildOption.name.replace("Choiceradio", "")).css("color", "red"); setTimeout(function () { $("#ItemOptionSelection" + ChildOption.name.replace("Choiceradio", "")).css("color", "grey") }, 2000); ChildOption.checked = false; } else { $("#ItemOptionSelection" + ChildOption.name.replace("Choiceradio", "")).css("color", "grey"); } } } } } } } gettotalprice(); } function LoadgroupItemOptions(Item) { var OrderType = localStorage.getItem("GroupOrderType"); document.getElementById("choiceselect").innerHTML = ""; document.getElementById("additemserror").innerHTML = ""; var ItemId; var UrlType = document.getElementById('lblurlnametype').innerHTML; // var UrlType = "DineIn"; var EnableItemInstruction = ""; var ItemInstructionLabel = ""; if ($("#lbliteminst").text().indexOf("/") != -1) { EnableItemInstruction = $("#lbliteminst").text().split('/')[0]; ItemInstructionLabel = $("#lbliteminst").text().split('/')[1] } if (document.getElementById("lblItemType").innerHTML == "AddItem") { ItemId = $(Item).attr("id"); } else if (document.getElementById("lblItemType").innerHTML == "EditItem") { ItemId = $(Item.parentNode.parentNode).attr("id"); } if (ItemId == undefined) { if (document.getElementById("lblItemId").innerHTML.split('//')[0] != "") { ItemId = document.getElementById("lblItemId").innerHTML.split('//')[0]; } } if (EnableItemInstruction == "True") $("#txtinstructions").css("display", ""); else $("#txtinstructions").css("display", "none"); if (ItemInstructionLabel != "") $("#txtinstructions").attr("placeholder", ItemInstructionLabel); var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.selectedIndex != -1) { var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; if (OrderType != "--Select Order Type--") { document.getElementById("choiceselect").innerHTML = ""; document.getElementById("additemserror").innerHTML = ""; var ItemId; if (document.getElementById("lblItemType").innerHTML == "AddItem") { if (OrderTypevalue != OrderType || OrderTypevalue == document.getElementById("lblPickupname").innerHTML.replace("&", "&")) OrderType = "PickUp"; if (OrderTypevalue == "Shipping") ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; else { ItemId = $(Item).attr("id"); if (ItemId == undefined) ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; document.getElementById('txtinstructions').value = ""; } } else if (document.getElementById("lblItemType").innerHTML == "EditItem") ItemId = $(Item.parentNode.parentNode).attr("id"); if (ItemId == undefined) ItemId = document.getElementById("lbldeliveryItemId").innerHTML; //// code for clearbogooffer when other items/categories selected except Offered Items. //if (document.getElementById("lblItemType").innerHTML != "EditItem") { // if (document.getElementById("lblBogoItemId").innerHTML != "") { // if (document.getElementById("lblBogoGetItemType").innerHTML == "Category") { // var CategoryId = $(Item.parentNode.parentNode).attr("id").replace("ItemsOf", ""); // if (CategoryId != document.getElementById("lblBogoItemId").innerHTML && ItemId != document.getElementById("lblBogoItemId").innerHTML) // ClearBogoOffer(); // } // else { // if (ItemId != document.getElementById("lblBogoItemId").innerHTML) // ClearBogoOffer(); // } // } //} $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + ItemId + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var PnlConfrimation = 0; var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); var deliveryCheck = document.getElementById('checkdelivery').innerHTML; document.getElementById('lblcategoryid').innerHTML = msg.d[0].CategoryId; if (deliveryCheck == "Sucess") { if (AddedItems == null) { if (OrderType == null || OrderType == "" || OrderType == "null") { OpenOrderTypePnl(""); return; } } $("#btnaddtocart").css("display", ""); if ((msg.d[0].PickUp != true && msg.d[0].Delivery != true && msg.d[0].Shipping != true) || (msg.d[0].ViewOnly == true)) { $("#lblorderror").text("This item is View Only"); $(".ordererror").show().delay(3000).fadeOut(); $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#btnaddtocart").css("display", "none"); //return; } // //If item has not Pickup else if (OrderTypevalue == $("#lblPickupname").text() && msg.d[0].PickUp != true) { PnlConfrimation++; $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); if (msg.d[0].Delivery == true && $("#Deliverytxt").text() != "") { alertify.confirm("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + ". Do you want Deliver ?", function (e) { if (e) { OpenOrderTypePnl("Delivery"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Shipping == true && $("#lblShipping").text() != "") { alertify.confirm("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + ". Do you want Shipping ?", function (e) { if (e) { OpenOrderTypePnl("Shipping"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&")); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } // //If item has not Delivery else if (OrderTypevalue == "Delivery" && msg.d[0].Delivery != true) { $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); PnlConfrimation++; if (msg.d[0].PickUp == true && document.getElementById("lblPickup").innerHTML != "") { alertify.confirm("This Item is not available for Delivery. Do you want to " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + " ?", function (e) { if (e) { OpenOrderTypePnl(document.getElementById("lblPickupname").innerHTML.replace("&", "&")); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Shipping == true && $("#lblShipping").text() != "") { alertify.confirm("This Item is not available for Delivery. Do you want Shipping ?", function (e) { if (e) { OpenOrderTypePnl("Shipping"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for Delivery"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } //If item has not shipping else if (OrderTypevalue == "Shipping" && msg.d[0].Shipping != true) { PnlConfrimation++; $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); if (msg.d[0].PickUp == true && document.getElementById("lblPickup").innerHTML != "") { alertify.confirm("This Item is not available for Shipping. Do you want to " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + " ?", function (e) { if (e) { OpenOrderTypePnl(document.getElementById("lblPickupname").innerHTML.replace("&", "&")); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Delivery == true && $("#Deliverytxt").text() != "") { alertify.confirm("This Item is not available for Shipping. Do you want Deliver ?", function (e) { if (e) { OpenOrderTypePnl("Delivery"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for Shipping"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } } if (PnlConfrimation == 0) { var k = 0; document.getElementById("lblMainCategoryId").innerHTML = msg.d[0].MainCategoryId; if (AddedItems != null) { for (var w = 0; w < AddedItems.length; w++) { if (AddedItems[w].MainCategoryId == msg.d[0].MainCategoryId) { k++; } } } //if (k == 0) { // $.ajax({ // type: "POST", // url: "Orders.aspx/DisplayTimings", // data: "{'CategoryId': '" + ItemId + "'}", // dataType: "json", // contentType: "application/json", // success: function (time) { // if (time.d != null && time.d != "") { // $("#lblordsucc").text(time.d); // $(".ordersuccess").show().delay(3000).fadeOut(); // } // } // }); //} if(msg.d[0].ItemFlow == true){ document.getElementById("lblitemflowtype").innerHTML = msg.d[0].ItemFlow; MenuItemOptionsLoad(msg, ItemId, OrderType); } else{ OptionsLoad(msg, ItemId, OrderType);} } } if (PnlConfrimation == 0) { $.ajax({ type: "POST", url: "Orders.aspx/GetItemVariations", data: "{'ItemId': '" + ItemId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById('divVariations').innerHTML = ""; localStorage.removeItem("ItemVariation"); var Variations = new Array(); if (msg.d.length > 0) { var ddlVariation = document.createElement("select"); if (msg.d.length != 1) ddlVariation.options.add(new Option("Select Variation", "")); setAttributes(ddlVariation, { "style": "width: 200px;height: 25px;", "class": "ddlVariation", "id": "ddlVariation", "onchange": "gettotalprice()" }); for (var V = 0; V < msg.d.length; V++) { var Variation = new Object; Variation.Id = msg.d[V].Id; Variation.Name = msg.d[V].Name; Variation.Price = msg.d[V].Price.toFixed(2); Variations.push(Variation); ddlVariation.options.add(new Option(msg.d[V].Name + " " + document.getElementById("lblCurrency").innerHTML + msg.d[V].Price, msg.d[V].Id)); } localStorage.setItem("ItemVariation", JSON.stringify(Variations)); document.getElementById('divVariations').appendChild(ddlVariation); } if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { SelectOptionsforgrouporder(Item); } else { SelectOptions(); } } gettotalprice(); } }); } else $(".addcategoryloadingimage2").fadeOut("fast"); } }); } else { var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberType; if (Details != null) { MemberType = Details.MemberType; } if (MemberType == "Member") { $(".deliveryvalidationpanel").fadeOut("slow"); //DisplayCartingrouporder(Item); } else { $(".deliveryvalidationpanel").fadeIn("slow"); } } $(".btnloaderdiv").css("display", "none"); $(".addtocartdiv").css("display", "block"); } } function CheckCartAvailableTimesinGroupOrder() { var UrlType = document.getElementById('lblurlnametype').innerHTML; var OrderTypevalue = localStorage.getItem("OrderType"); var OrderType = "PickUp"; if (document.getElementById("lblPickupname").innerHTML.replace("&", "&") == OrderTypevalue) OrderType = "PickUp"; else if (document.getElementById("lblDineInname").innerHTML.replace("&", "&") == OrderTypevalue) OrderType = "DineIn"; else if (OrderTypevalue == "Delivery") OrderType = "Delivery"; else if (OrderTypevalue == "Shipping") OrderType = "Shipping"; else OrderType = OrderTypevalue; var LocationId = document.getElementById('lblLId').value; var CurrentTime = document.getElementById("AppLocationTime").innerHTML; var retrievedData = localStorage.getItem("OtherMembersItems"); var AddedItems = JSON.parse(retrievedData); var arr = new Array(); if (AddedItems != null) { for (var S = 0; S < AddedItems.length; S++) { for (var F = 0; F < AddedItems[S].GroupItems.length; F++) { arr[S] = { Id: AddedItems[S].GroupItems[F].Id, MainCategoryId: AddedItems[S].GroupItems[F].MainCategoryId }; } } } if (OrderType != "Shipping") { $("#txtdeliverydate").removeAttr("disabled"); $("#ddlhr").css("display", ""); $(".Estimate").css("display", "none"); $(".Estimate").text(""); $("#lblreducedtime").text(""); if (document.getElementById("lblMileageCharge").style.display == "block") $(".ToggleMileageCharge").fadeIn("slow"); else $(".ToggleMileageCharge").css("display", "none"); var DriverId = ""; DriverId = document.getElementById("lblselecteddriver").innerHTML; document.getElementById("lblUserDeliveryError").innerHTML = ""; var commontime = document.getElementById("lblcommontime").innerHTML; var UId = document.getElementById("UserId").innerHTML; var sDate = new Date(); sDate = document.getElementById('txtdeliverydate').value; var ItemCount = 0; var retrievedData = localStorage.getItem("OtherMembersItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { for (var S = 0; S < AddedItems.length; S++) { ItemCount = AddedItems[S].GroupItems.length; } } var CommonTime = document.getElementById("lblcommontime").innerHTML; var LId = document.getElementById('lblLId').value; var Zone = localStorage.getItem("Zone"); if (OrderType == "PickUp") Zone = null; var selectedDate = new Date(); selectedDate = document.getElementById('txtdeliverydate').value; var CurrentTime = document.getElementById("AppLocationTime").innerHTML; var Aid = document.getElementById('lblAppId1').value; var TimeZoneName = document.getElementById('lbltimezonename').value; var RawOffset = document.getElementById('lblrawoffset').innerHTML; var ExtraMiles = localStorage.getItem("Miles"); var TotalDistance = localStorage.getItem("TotalDistance"); $('.ddlhr').empty(); var ddlhr = document.getElementById("ddlhr"); var ddlOrderType = document.getElementById("ddlOrderType"); var PickupButtonName = ""; if (document.getElementById("lblPickupname") != null) { PickupButtonName = document.getElementById("lblPickupname").innerHTML; } var UsedOrderType = ""; var SelectedOrderType = ""; if (ddlOrderType.options.length > 0) { SelectedOrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; UsedOrderType = ddlOrderType.options[ddlOrderType.selectedIndex].value; } if (UsedOrderType == PickupButtonName) { UsedOrderType = "PickUp"; } if (OrderType == null || OrderType == "") OrderType = UsedOrderType; $.ajax({ type: "POST", url: "Orders.aspx/BindRestaurantHours", data: "{'LId':'" + LId + "','OrderType':'" + OrderType + "','Zone':'" + Zone + "','Date':'" + selectedDate + "','DriverId':'" + DriverId + "','ItemCount':'" + ItemCount + "','TotalDistance':'" + TotalDistance + "','Retrivedata':'" + JSON.stringify(arr) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { document.getElementById('txtdeliverydate').value = msg.d[0].AvailableDate; if (msg.d[0].OrderTimes.length > 0) { var tme = 0; for (var i = 0; i < msg.d[0].OrderTimes.length; i++) { if (document.getElementById("LimitTimestoASAP").innerHTML == "true") { if (msg.d[0].OrderTimes[i].Times == "ASAP") { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); tme = 1; } else { if (tme != 1) { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[0].Times); optmin2.text = time; if(i == 0){ ddlhr.options.add(optmin2); } } } } else { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); } if (msg.d[0].OrderTimes[i].Times == "ASAP") { document.getElementById("lblasaphr").innerHTML = msg.d[0].ASAPTime; $(".Estimate").css("display", "block"); $(".Estimate").text("Estimated " + SelectedOrderType + " time is " + msg.d[0].ASAPTime); } } OpeningOrderSubmitionPnl(); } else if (msg.d[0].NextAvailableDate != null && msg.d[0].NextAvailableDate != "" && msg.d[0].Status != "" && msg.d[0].Status != null) { var Confirmmessage = msg.d[0].Status; const myArr = Confirmmessage.split('.'); var Cmessage = []; for (var i = 0; i < myArr.length; i++) { var vmessage = myArr[i]; Cmessage.push(vmessage); if (i == 0) Cmessage.push(msg.d[0].NextAvailableDate); } var Cmes = Cmessage.toString().split(','); Cmes = Cmes[0] + ". The next available date is " + Cmes[1]; Confirmmessage = Cmes; alertify.set({ labels: { ok: "Continue", cancel: "Cancel" } }); alertify.confirm(Confirmmessage, function (e) { if (e) { document.getElementById('txtdeliverydate').value = msg.d[0].NextAvailableDate; selectedDate = msg.d[0].NextAvailableDate; $.ajax({ type: "POST", url: "Orders.aspx/BindRestaurantHours", data: "{'LId':'" + LId + "','OrderType':'" + OrderType + "','Zone':'" + Zone + "','Date':'" + selectedDate + "','DriverId':'" + DriverId + "','ItemCount':'" + ItemCount + "','TotalDistance':'" + TotalDistance + "','Retrivedata':'" + JSON.stringify(arr) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { document.getElementById('txtdeliverydate').value = msg.d[0].AvailableDate; if (msg.d[0].OrderTimes.length > 0) { var tme = 0; for (var i = 0; i < msg.d[0].OrderTimes.length; i++) { if (document.getElementById("LimitTimestoASAP").innerHTML == "true") { if (msg.d[0].OrderTimes[i].Times == "ASAP") { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); tme = 1; } else { if (tme != 1) { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[0].Times); optmin2.text = time; if(i == 0){ ddlhr.options.add(optmin2); } } } } else { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); } if (msg.d[0].OrderTimes[i].Times == "ASAP") { document.getElementById("lblasaphr").innerHTML = msg.d[0].ASAPTime; $(".Estimate").css("display", "block"); $(".Estimate").text("Estimated " + SelectedOrderType + " time is " + msg.d[0].ASAPTime); } } OpeningOrderSubmitionPnl(); $(".addcategoryloadingimage2").css("display", "none"); } else if (msg.d[0].Status != "" && msg.d[0].Status != null) { alert(msg.d[0].Status); $(".checkbtndiv").css("display", "inline-block"); $(".checkoutloaderdiv").css("display", "none"); $(".addcategoryloadingimage2").css("display", "none"); } } else if (msg.d[0].Status != "" && msg.d[0].Status != null) { alert(msg.d[0].Status); $(".checkbtndiv").css("display", "inline-block"); $(".checkoutloaderdiv").css("display", "none"); $(".addcategoryloadingimage2").css("display", "none"); } $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } }); } else { $(".addcategoryloadingimage2").css("display", "none"); } }); } else if (msg.d[0].NextAvailableDate != null && msg.d[0].NextAvailableDate != "") { var Confirmmessage = "You can place your order now for a future time at " + msg.d[0].NextAvailableDate + ". Is that OK?"; if (confirm(Confirmmessage)) { document.getElementById('txtdeliverydate').value = msg.d[0].NextAvailableDate; selectedDate = msg.d[0].NextAvailableDate; $.ajax({ type: "POST", url: "Orders.aspx/BindRestaurantHours", data: "{'LId':'" + LId + "','OrderType':'" + OrderType + "','Zone':'" + Zone + "','Date':'" + selectedDate + "','DriverId':'" + DriverId + "','ItemCount':'" + ItemCount + "','TotalDistance':'" + TotalDistance + "','Retrivedata':'" + JSON.stringify(arr) + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != null) { document.getElementById('txtdeliverydate').value = msg.d[0].AvailableDate; if (msg.d[0].OrderTimes.length > 0) { var tme = 0; for (var i = 0; i < msg.d[0].OrderTimes.length; i++) { if (document.getElementById("LimitTimestoASAP").innerHTML == "true") { if (msg.d[0].OrderTimes[i].Times == "ASAP") { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); tme = 1; } else { if (tme != 1) { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[0].Times); optmin2.text = time; if(i == 0){ ddlhr.options.add(optmin2); } } } } else { var optmin2 = document.createElement("option"); var time = tConvert(msg.d[0].OrderTimes[i].Times); optmin2.text = time; ddlhr.options.add(optmin2); } if (msg.d[0].OrderTimes[i].Times == "ASAP") { document.getElementById("lblasaphr").innerHTML = msg.d[0].ASAPTime; $(".Estimate").css("display", "block"); $(".Estimate").text("Estimated " + SelectedOrderType + " time is " + msg.d[0].ASAPTime); } } OpeningOrderSubmitionPnl(); $(".addcategoryloadingimage2").css("display", "none"); } else { alert(msg.d[0].Status); $(".checkbtndiv").css("display", "inline-block"); $(".checkoutloaderdiv").css("display", "none"); $(".addcategoryloadingimage2").css("display", "none"); } } } }); } else { $(".addcategoryloadingimage2").css("display", "none"); } } else if (msg.d[0].Status != "" && msg.d[0].Status != null) { alert(msg.d[0].Status); $(".checkbtndiv").css("display", "inline-block"); $(".checkoutloaderdiv").css("display", "none"); $(".addcategoryloadingimage2").css("display", "none"); } $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } } }); } else { var shippingZoneId = localStorage.getItem("ShippingZoneId"); if (shippingZoneId != null && shippingZoneId != undefined) { var ShipmentDays = ""; if (document.getElementById("SpeedId").innerHTML != '') ShipmentDays = $("label[for='Days" + document.getElementById("SpeedId").innerHTML + "']").text(); $.ajax({ type: "POST", url: "Orders.aspx/BindShippingHours", data: "{'LId':'" + LocationId + "','ZoneId':'" + shippingZoneId + "','Time':'" + CurrentTime + "','ShipmentDays':'" + ShipmentDays + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0].ErrorMessage == "") { $("#txtdeliverydate").attr("disabled", "disabled"); $(".Estimate").css("display", "none"); $(".Estimate").text(""); $("#ddlhr").css("display", "none"); $("#txtdeliverydate").css("width", "297px"); if (~msg.d[0].AddDays.indexOf('Days')) { var Adddays = msg.d[0].AddDays.split(' ')[0]; jQuery(function ($) { $(".datepicker").datepicker({ minDate: "+" + Adddays + "D" }); }); } else { var Adddays = msg.d[0].AddDays.split(' ')[0]; jQuery(function ($) { $(".datepicker").datepicker({ minDate: "+" + Adddays + "M" }); }); } $("#txtdeliverydate").val(msg.d[0].ShippingDate); $(".guestpicktitile").text("Shipping Order Submission"); $(".UserDeliveryPanel").css("display", "block"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } if (window.innerWidth > 767) { if ($("#lblMenuTheme").val() == "Grid" || $("#lblMenuTheme").val() == "Grid-no-images" || $("#lblMenuTheme").val() == "New-Grid" || $("#lblMenuTheme").val() == "New-Grid-no-images") { CloseCart(); }else { $(".scrollcart").css("display", "block"); } } $(".DeliveryType").fadeIn("fast"); } else { $("#lblordalert").text(msg.d[0].ErrorMessage); $(".orderalert").fadeIn(); } } else { $("#lblordalert").text("Restaurant doesn't accept Any shipping Orders at this time"); $(".orderalert").fadeIn(); } } }); } } } function LoadItemOptionsinGroupOrder(Item) { var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberId; var MemberType; if (Details != null) { MemberId = Details.MemberId; MemberType = Details.MemberType; } $.ajax({ type: "POST", url: "../GroupOrdering/GroupOrder.aspx/CheckgroupStatusforMemberByMemberId", data: "{'GroupId': '" + GetgroupId() + "','MemberId' : '"+MemberId+"'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { var mes = new Array(); mes = msg.d.split("//"); if (mes[0] != "Completed" && mes[0] != "Placing") { var UrlType = document.getElementById('lblurlnametype').innerHTML; var MemberDetails = localStorage.getItem("GroupMemberType"); var Details = JSON.parse(MemberDetails); var MemberType; if (Details != null) { MemberType = Details.MemberType; } // var UrlType = "DineIn"; var EnableItemInstruction = ""; var ItemInstructionLabel = ""; if ($("#lbliteminst").text().indexOf("/") != -1) { EnableItemInstruction = $("#lbliteminst").text().split('/')[0]; ItemInstructionLabel = $("#lbliteminst").text().split('/')[1] } if (UrlType == "DineIn") { $("#txtinstructions").css("display", "none"); var ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; var OrderType = ""; $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + ItemId + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if(msg.d[0].ItemFlow == true){ document.getElementById("lblitemflowtype").innerHTML = msg.d[0].ItemFlow; MenuItemOptionsLoad(msg, ItemId, OrderType); } else{ OptionsLoad(msg, ItemId, OrderType);} } } }); } else { if (EnableItemInstruction == "True") $("#txtinstructions").css("display", ""); else $("#txtinstructions").css("display", "none"); if (ItemInstructionLabel != "") $("#txtinstructions").attr("placeholder", ItemInstructionLabel); var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.selectedIndex != -1) { var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; if (OrderType == "--Select Order Type--") { //OrderType = localStorage.getItem("OrderSelectionType"); } if (MemberType == "Member") { if (OrderType != "--Select Order Type--") { document.getElementById("choiceselect").innerHTML = ""; document.getElementById("additemserror").innerHTML = ""; var ItemId; if (document.getElementById("lblItemType").innerHTML == "AddItem") { if (OrderTypevalue != OrderType || OrderTypevalue == document.getElementById("lblPickupname").innerHTML.replace("&", "&")) OrderType = "PickUp"; if (OrderTypevalue == "Shipping") ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; else { ItemId = $(Item).attr("id"); if (ItemId == undefined) ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; document.getElementById('txtinstructions').value = ""; } } else if (document.getElementById("lblItemType").innerHTML == "EditItem") ItemId = $(Item.parentNode.parentNode).attr("id"); if (ItemId == undefined) ItemId = document.getElementById("lbldeliveryItemId").innerHTML; $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + ItemId + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var PnlConfrimation = 0; var retrievedData = localStorage.getItem("OtherMembersItems"); var AddedItems = JSON.parse(retrievedData); var deliveryCheck = document.getElementById('checkdelivery').innerHTML; document.getElementById('lblcategoryid').innerHTML = msg.d[0].CategoryId; if (deliveryCheck == "Sucess") { if (AddedItems[0].GroupItems.length < 0) { if (OrderType == null || OrderType == "" || OrderType == "null") { OpenOrderTypePnl(""); return; } } $("#btnaddtocart").css("display", ""); if ((msg.d[0].PickUp != true && msg.d[0].Delivery != true && msg.d[0].Shipping != true) || (msg.d[0].ViewOnly == true)) { $("#lblorderror").text("This item is View Only"); $(".ordererror").show().delay(3000).fadeOut(); $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#btnaddtocart").css("display", "none"); //return; } // //If item has not Pickup else if (OrderTypevalue == $("#lblPickupname").text() && msg.d[0].PickUp != true) { PnlConfrimation++; $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); if (msg.d[0].Delivery == true && $("#Deliverytxt").text() != "") { alertify.confirm("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + ". Do you want Deliver ?", function (e) { if (e) { OpenOrderTypePnl("Delivery"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Shipping == true && $("#lblShipping").text() != "") { alertify.confirm("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + ". Do you want Shipping ?", function (e) { if (e) { OpenOrderTypePnl("Shipping"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&")); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } // //If item has not Delivery else if (OrderTypevalue == "Delivery" && msg.d[0].Delivery != true) { $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); PnlConfrimation++; if (msg.d[0].PickUp == true && document.getElementById("lblPickup").innerHTML != "") { alertify.confirm("This Item is not available for Delivery. Do you want to " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + " ?", function (e) { if (e) { OpenOrderTypePnl(document.getElementById("lblPickupname").innerHTML.replace("&", "&")); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Shipping == true && $("#lblShipping").text() != "") { alertify.confirm("This Item is not available for Delivery. Do you want Shipping ?", function (e) { if (e) { OpenOrderTypePnl("Shipping"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for Delivery"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } //If item has not shipping else if (OrderTypevalue == "Shipping" && msg.d[0].Shipping != true) { PnlConfrimation++; $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); if (msg.d[0].PickUp == true && document.getElementById("lblPickup").innerHTML != "") { alertify.confirm("This Item is not available for Shipping. Do you want to " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + " ?", function (e) { if (e) { OpenOrderTypePnl(document.getElementById("lblPickupname").innerHTML.replace("&", "&")); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Delivery == true && $("#Deliverytxt").text() != "") { alertify.confirm("This Item is not available for Shipping. Do you want Deliver ?", function (e) { if (e) { OpenOrderTypePnl("Delivery"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for Shipping"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } } if (PnlConfrimation == 0) { var k = 0; document.getElementById("lblMainCategoryId").innerHTML = msg.d[0].MainCategoryId; if (AddedItems != null) { for (var w = 0; w < AddedItems.length; w++) { if (AddedItems[w].MainCategoryId == msg.d[0].MainCategoryId) { k++; } } } if(msg.d[0].ItemFlow == true){ document.getElementById("lblitemflowtype").innerHTML = msg.d[0].ItemFlow; MenuItemOptionsLoad(msg, ItemId, OrderType); } else{ OptionsLoad(msg, ItemId, OrderType);} } } if (PnlConfrimation == 0) { $.ajax({ type: "POST", url: "Orders.aspx/GetItemVariations", data: "{'ItemId': '" + ItemId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById('divVariations').innerHTML = ""; localStorage.removeItem("ItemVariation"); var Variations = new Array(); if (msg.d.length > 0) { var ddlVariation = document.createElement("select"); if (msg.d.length != 1) ddlVariation.options.add(new Option("Select Variation", "")); setAttributes(ddlVariation, { "style": "width: 200px;height: 25px;", "class": "ddlVariation", "id": "ddlVariation", "onchange": "gettotalprice()" }); for (var V = 0; V < msg.d.length; V++) { var Variation = new Object; Variation.Id = msg.d[V].Id; Variation.Name = msg.d[V].Name; Variation.Price = msg.d[V].Price.toFixed(2); Variations.push(Variation); ddlVariation.options.add(new Option(msg.d[V].Name + " " + document.getElementById("lblCurrency").innerHTML + msg.d[V].Price, msg.d[V].Id)); } localStorage.setItem("ItemVariation", JSON.stringify(Variations)); document.getElementById('divVariations').appendChild(ddlVariation); } if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { SelectOptionsforgrouporder(Item); } else { SelectOptions(); } } gettotalprice(); } }); } else $(".addcategoryloadingimage2").fadeOut("fast"); } }); } else { if (Details != null) { MemberType = Details.MemberType; } if (MemberType == "Member") { $(".deliveryvalidationpanel").fadeOut("slow"); //DisplayCartingrouporder(Item); } else { $(".deliveryvalidationpanel").fadeIn("slow"); } } } else { if (OrderType != "--Select Order Type--") { document.getElementById("choiceselect").innerHTML = ""; document.getElementById("additemserror").innerHTML = ""; var ItemId; if (document.getElementById("lblItemType").innerHTML == "AddItem") { if (OrderTypevalue != OrderType || OrderTypevalue == document.getElementById("lblPickupname").innerHTML.replace("&", "&")) OrderType = "PickUp"; if (OrderTypevalue == "Shipping") ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; else { ItemId = $(Item).attr("id"); if (ItemId == undefined) ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; document.getElementById('txtinstructions').value = ""; } } else if (document.getElementById("lblItemType").innerHTML == "EditItem") ItemId = $(Item.parentNode.parentNode).attr("id"); if (ItemId == undefined) ItemId = document.getElementById("lbldeliveryItemId").innerHTML; $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + ItemId + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var PnlConfrimation = 0; var retrievedData = localStorage.getItem("OtherMembersItems"); var AddedItems = JSON.parse(retrievedData); var deliveryCheck = document.getElementById('checkdelivery').innerHTML; document.getElementById('lblcategoryid').innerHTML = msg.d[0].CategoryId; if (deliveryCheck == "Sucess") { if (AddedItems[0].GroupItems.length < 0) { if (OrderType == null || OrderType == "" || OrderType == "null") { OpenOrderTypePnl(""); return; } } $("#btnaddtocart").css("display", ""); if ((msg.d[0].PickUp != true && msg.d[0].Delivery != true && msg.d[0].Shipping != true) || (msg.d[0].ViewOnly == true)) { $("#lblorderror").text("This item is View Only"); $(".ordererror").show().delay(3000).fadeOut(); $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#btnaddtocart").css("display", "none"); //return; } // //If item has not Pickup else if (OrderTypevalue == $("#lblPickupname").text() && msg.d[0].PickUp != true) { PnlConfrimation++; $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); if (msg.d[0].Delivery == true && $("#Deliverytxt").text() != "") { alertify.confirm("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + ". Do you want Deliver ?", function (e) { if (e) { OpenOrderTypePnl("Delivery"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Shipping == true && $("#lblShipping").text() != "") { alertify.confirm("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + ". Do you want Shipping ?", function (e) { if (e) { OpenOrderTypePnl("Shipping"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for " + document.getElementById("lblPickupname").innerHTML.replace("&", "&")); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } // //If item has not Delivery else if (OrderTypevalue == "Delivery" && msg.d[0].Delivery != true) { $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); PnlConfrimation++; if (msg.d[0].PickUp == true && document.getElementById("lblPickup").innerHTML != "") { alertify.confirm("This Item is not available for Delivery. Do you want to " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + " ?", function (e) { if (e) { OpenOrderTypePnl(document.getElementById("lblPickupname").innerHTML.replace("&", "&")); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Shipping == true && $("#lblShipping").text() != "") { alertify.confirm("This Item is not available for Delivery. Do you want Shipping ?", function (e) { if (e) { OpenOrderTypePnl("Shipping"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for Delivery"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } //If item has not shipping else if (OrderTypevalue == "Shipping" && msg.d[0].Shipping != true) { PnlConfrimation++; $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage1").css("display", "none"); $("#" + ItemId).css("opacity", "1"); if (msg.d[0].PickUp == true && document.getElementById("lblPickup").innerHTML != "") { alertify.confirm("This Item is not available for Shipping. Do you want to " + document.getElementById("lblPickupname").innerHTML.replace("&", "&") + " ?", function (e) { if (e) { OpenOrderTypePnl(document.getElementById("lblPickupname").innerHTML.replace("&", "&")); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else if (msg.d[0].Delivery == true && $("#Deliverytxt").text() != "") { alertify.confirm("This Item is not available for Shipping. Do you want Deliver ?", function (e) { if (e) { OpenOrderTypePnl("Delivery"); return; } else { document.getElementById("lblItemId").innerHTML = ""; return; } }); } else { $("#lblorderror").text("This Item is not available for Shipping"); $(".ordererror").show().delay(3000).fadeOut(); document.getElementById("lblItemId").innerHTML = ""; return; } } } if (PnlConfrimation == 0) { var k = 0; document.getElementById("lblMainCategoryId").innerHTML = msg.d[0].MainCategoryId; if (AddedItems != null) { for (var w = 0; w < AddedItems.length; w++) { if (AddedItems[w].MainCategoryId == msg.d[0].MainCategoryId) { k++; } } } if(msg.d[0].ItemFlow == true){ document.getElementById("lblitemflowtype").innerHTML = msg.d[0].ItemFlow; MenuItemOptionsLoad(msg, ItemId, OrderType); } else{ OptionsLoad(msg, ItemId, OrderType);} } } if (PnlConfrimation == 0) { $.ajax({ type: "POST", url: "Orders.aspx/GetItemVariations", data: "{'ItemId': '" + ItemId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById('divVariations').innerHTML = ""; localStorage.removeItem("ItemVariation"); var Variations = new Array(); if (msg.d.length > 0) { var ddlVariation = document.createElement("select"); if (msg.d.length != 1) ddlVariation.options.add(new Option("Select Variation", "")); setAttributes(ddlVariation, { "style": "width: 200px;height: 25px;", "class": "ddlVariation", "id": "ddlVariation", "onchange": "gettotalprice()" }); for (var V = 0; V < msg.d.length; V++) { var Variation = new Object; Variation.Id = msg.d[V].Id; Variation.Name = msg.d[V].Name; Variation.Price = msg.d[V].Price.toFixed(2); Variations.push(Variation); ddlVariation.options.add(new Option(msg.d[V].Name + " " + document.getElementById("lblCurrency").innerHTML + msg.d[V].Price, msg.d[V].Id)); } localStorage.setItem("ItemVariation", JSON.stringify(Variations)); document.getElementById('divVariations').appendChild(ddlVariation); } if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { SelectOptionsforgrouporder(Item); } else { SelectOptions(); } } gettotalprice(); } }); } else $(".addcategoryloadingimage2").fadeOut("fast"); } }); } else { if (Details != null) { MemberType = Details.MemberType; } if (MemberType == "Member") { $(".deliveryvalidationpanel").fadeOut("slow"); //DisplayCartingrouporder(Item); } else { $(".deliveryvalidationpanel").fadeIn("slow"); } } } } } } else { $(".addcategoryloadingimage1").css("display", "none"); $(".grouplaceorderplaced").css("display","block"); return; } } } }); } function HideMenu() { $('.OtherPanels').fadeOut("fast"); $(".orderdivw").fadeIn("fast"); $(".itmfxht").css("overflow", "auto"); $(".MenuVisible").fadeOut("fast"); $(".OtherPanels").css("margin-top", "0px"); $(".MenulinkVisible").fadeIn("fast"); } function RemovemarginTop() { $(".OtherPanels").css("margin-top", "0px"); } function InsertOrderValidationinGroupOrder(Emailele, Nameele, Phoneele, dateele, timeele, cardele, cardnoele, ExyMonth, ExyYear, Note, Cardcvv, BZCele, CLine1ele) { var nameexp = /^[a-zA-Z ]*$/; var count = 0; var emailExp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i; var EmailId = Emailele.value; var FirstName = Nameele.value; var phone = Phoneele.value; var deliverdate = dateele.value; var CardName = cardele.value.trim(); var CardNo = cardnoele.value; var DeliveryTime = ""; var CVV = Cardcvv.value; var time = timeele; var CCity, CState, CZip, CLine1, CLine2; CLine1 = document.getElementById("txtcLine1").value; CLine2 = document.getElementById("txtcline2").value; CState = document.getElementById("txtCState").value; CCity = document.getElementById("txtcCity").value; CZip = BZCele.value; var CLastName = document.getElementById("txtClastname").value; if (time.selectedIndex != "-1") DeliveryTime = time.options[time.selectedIndex].text; else DeliveryTime = ""; var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; if (OrderTypevalue == "Delivery" || OrderTypevalue == "Shipping") { var city, state, zip, Line1; Line1 = document.getElementById('txtline1'); city = document.getElementById('txtcity'); state = document.getElementById('txtstate'); zip = document.getElementById('txtZip'); if (city.value != '' && state.value != '' && Line1.value != '') { count++; $(city).removeClass("reqruiredc"); $(state).removeClass("reqruiredc"); $(Line1).removeClass("reqruiredc"); } else if (city.value != '' && state.value != '' && zip.value != '' && Line1.value == '') { $(Line1).focus(); $(city).removeClass("reqruiredc"); $(state).removeClass("reqruiredc"); $(zip).removeClass("reqruiredc"); $(Line1).addClass("reqruiredc"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } else if (city.value != '' && state.value != '' && zip.value == '' && Line1.value == '') { $(Line1).focus(); $(city).removeClass("reqruiredc"); $(state).removeClass("reqruiredc"); $(Line1).addClass("reqruiredc"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } else if (city.value != '' && state.value == '' && zip.value == '' && Line1.value == '') { $(Line1).focus(); $(city).removeClass("reqruiredc"); $(state).addClass("reqruiredc"); $(Line1).addClass("reqruiredc"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } else if (city.value == '' && state.value == '' && zip.value == '' && Line1.value == '') { $(Line1).focus(); $(city).addClass("reqruiredc"); $(state).addClass("reqruiredc"); $(Line1).addClass("reqruiredc"); } else if (city.value != '' && state.value != '' && zip.value == '' && Line1.value != '') { $(city).removeClass("reqruiredc"); $(state).removeClass("reqruiredc"); $(Line1).removeClass("reqruiredc"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } else if (city.value != '' && state.value == '' && zip.value == '' && Line1.value != '') { $(city).removeClass("reqruiredc"); $(state).addClass("reqruiredc"); $(Line1).removeClass("reqruiredc"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } else if (city.value == '' && state.value == '' && zip.value == '' && Line1.value != '') { $(city).addClass("reqruiredc"); $(state).addClass("reqruiredc"); $(Line1).removeClass("reqruiredc"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } } if (document.getElementById("CCBaseURL").innerHTML != "" && document.getElementById("Paytype").innerHTML == "CreditCard") { if (token.length < 60) { var msg = token; var M = JSON.parse(msg); if (M.message == "") { $('.errormsg').text(M.validationError); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else CardNo = M.message; CVV = "1111" document.getElementById('mytoken').value = M.message; } else { $('.errormsg').text("Invalid card details"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } if (document.getElementById("Paytype").innerHTML == "CreditCard") { if (CardName != '' && CardNo != '' && CLastName != '' && CVV != '') { if (!CardName.match(nameexp) || !CLastName.match(nameexp)) { $(cardele).removeClass("reqruiredc"); $(cardnoele).removeClass("reqruiredc"); $('.errormsg').text("Enter valid Card Holder Name"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } if (CVV.length >= 3 && CardName.match(nameexp) && CLastName.match(nameexp) && CardNo.length >= 10) { $(Cardcvv).removeClass("reqruiredc"); var CurrDate = new Date(); var D = new Date(ExyYear.options[ExyYear.selectedIndex].text, ExyMonth.options[ExyMonth.selectedIndex].text, 0, 23, 59, 59); if (CurrDate > D) { $('.errormsg').text("Enter valid expiry date"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { if (document.getElementById("chkcard").checked == true || (OrderTypevalue != "Delivery" && OrderTypevalue != "Shipping")) { if (CZip != '') { if (CZip.length >= 5) { count++; } else { $('.errormsg').text("Billing Zip Code must be 5-6 digits."); $(BZCele).focus(); $(BZCele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } else { if (CZip == '') { $(BZCele).focus(); $(BZCele).addClass("reqruiredc"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); $('.placeorder').css("display", "inline-table"); return; } else { $(BZCele).removeClass("reqruiredc"); } if($('#txtCState').css('display') != 'none'){ if (CState == '') { $("#txtCState").focus(); $("#txtCState").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtCState").removeClass("reqruiredc"); } } if($('#txtcCity').css('display') != 'none'){ if (CCity == '') { $("#txtcCity").focus(); $("#txtcCity").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcCity").removeClass("reqruiredc"); } } if($('#txtcLine1').css('display') != 'none'){ if (CLine1 == '') { $("#txtcLine1").focus(); $("#txtcLine1").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcLine1").removeClass("reqruiredc"); } } } if($('#txtCState').css('display') != 'none'){ if (CState == '') { $("#txtCState").focus(); $("#txtCState").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtCState").removeClass("reqruiredc"); } } if($('#txtcCity').css('display') != 'none'){ if (CCity == '') { $("#txtcCity").focus(); $("#txtcCity").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcCity").removeClass("reqruiredc"); } } if($('#txtcLine1').css('display') != 'none'){ if (CLine1 == '') { $("#txtcLine1").focus(); $("#txtcLine1").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcLine1").removeClass("reqruiredc"); } } } else { count++; } } } else { if (CardNo.length < 10) { $('.errormsg').text("Check card number"); $(CardNo).focus(); $(CardNo).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $('.errormsg').text("Security Code must be 3-4 digits."); $(Cardcvv).focus(); $(Cardcvv).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } } else { if (document.getElementById("chkcard").checked == true) { if (CZip != '') { if (CZip.length >= 5) { } else { $('.errormsg').text("Billing Zip Code must be 5-6 digits."); $(BZCele).focus(); $(BZCele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } else { if (CZip == '') { $(BZCele).focus(); $(BZCele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $(BZCele).removeClass("reqruiredc"); } if($('#txtCState').css('display') != 'none'){ if (CState == '') { $("#txtCState").focus(); $("#txtCState").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtCState").removeClass("reqruiredc"); } } if($('#txtcCity').css('display') != 'none'){ if (CCity == '') { $("#txtcCity").focus(); $("#txtcCity").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcCity").removeClass("reqruiredc"); } } if($('#txtcLine1').css('display') != 'none'){ if (CLine1 == '') { $("#txtcLine1").focus(); $("#txtcLine1").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcLine1").removeClass("reqruiredc"); } } } if($('#txtCState').css('display') != 'none'){ if (CState == '') { $("#txtCState").focus(); $("#txtCState").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtCState").removeClass("reqruiredc"); } } if($('#txtcCity').css('display') != 'none'){ if (CCity == '') { $("#txtcCity").focus(); $("#txtcCity").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcCity").removeClass("reqruiredc"); } } if($('#txtcLine1').css('display') != 'none'){ if (CLine1 == '') { $("#txtcLine1").focus(); $("#txtcLine1").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { $("#txtcLine1").removeClass("reqruiredc"); } } } else { $("#txtcline2").removeClass("reqruiredc"); $("#txtcLine1").removeClass("reqruiredc"); $("#txtcCity").removeClass("reqruiredc"); $("#txtCState").removeClass("reqruiredc"); $(BZCele).removeClass("reqruiredc"); } if (CVV != '') { $(Cardcvv).removeClass("reqruiredc"); } else { $(Cardcvv).focus(); $(Cardcvv).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } if (CardNo != '') { $(cardnoele).removeClass("reqruiredc"); } else { $(cardnoele).focus(); $(cardnoele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } if (CLastName != '') { $("#txtClastname").removeClass("reqruiredc"); if (!CLastName.match(nameexp)) { $("#txtClastname").focus(); $('.errormsg').text("Enter valid Card Holder Name"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } } else { $("#txtClastname").focus(); $("#txtClastname").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } if (CardName != '') { $(cardele).removeClass("reqruiredc"); if (!CardName.match(nameexp)) { $(cardele).focus(); $('.errormsg').text("Enter valid Card Holder Name"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); } } else { $(cardele).focus(); $(cardele).addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } } else { $(cardele).removeClass("reqruiredc"); $(cardnoele).removeClass("reqruiredc"); $(Cardcvv).removeClass("reqruiredc"); $(BZCele).removeClass("reqruiredc"); } count++; if (Note.value != "") { if (Note.value.length > 490) { $('.errormsg').text("Order instructions should be less than 500 characters."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } var AdvancedLabel = document.getElementById("txtAdvancedlbl").value; if (document.getElementById("lblindication").innerHTML == "TextBox to Enter Customer Location" || document.getElementById("lblindication").innerHTML == "CustomerOrderDetails") AdvancedLabel = document.getElementById("txtCustomerOrderDe").value.trim(); if (FirstName != '' && EmailId != '' && phone != '' && deliverdate != '') { var p = 0; if (OrderTypevalue == "Shipping") { } else { if (DeliveryTime != '') { } else { p++; } } if (document.getElementById("AdvancedOption").innerHTML == "true" && OrderTypevalue != OrderType) { var G1 = document.getElementById("ddldropdownoptions"); if (G1.selectedIndex != "-1") AdvancedLabel = G1.options[G1.selectedIndex].value if (AdvancedLabel == "" || AdvancedLabel == "0") { p++; if (document.getElementById("lblindication").innerHTML == "Textbox") { $('.errormsg').text("Please enter " + OrderType); $("#txtAdvancedlbl").addClass("reqruiredc"); } else if (document.getElementById("lblindication").innerHTML == "Dropdown") { $('.errormsg').text("Please select " + OrderType); $("#ddldropdownoptions").addClass("reqruiredc"); } else { $('.errormsg').text("Please enter " + OrderType); $("#txtCustomerOrderDe").addClass("reqruiredc"); } $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { if (document.getElementById("lblindication").innerHTML == "Textbox") { var TextboxRangeFrom = $("#txtRangeFrom").text(); var TextboxRangeTo = $("#txtRangeTo").text(); if (parseInt(TextboxRangeFrom) <= parseInt(AdvancedLabel) && parseInt(TextboxRangeTo) >= parseInt(AdvancedLabel)) { } else { $('.errormsg').text("Please enter " + $(".lblpickuptext").text() + " between " + parseInt(TextboxRangeFrom) + " and " + parseInt(TextboxRangeTo)); $("#txtAdvancedlbl").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } $("#ddldropdownoptions").removeClass("reqruiredc"); $("#txtAdvancedlbl").removeClass("reqruiredc"); $("#txtCustomerOrderDe").removeClass("reqruiredc"); } } if (p == 0) { $(Emailele).removeClass("reqruiredc"); $(Nameele).removeClass("reqruiredc"); $(Phoneele).removeClass("reqruiredc"); $(dateele).removeClass("reqruiredc"); $(timeele).removeClass("reqruiredc"); if (EmailId.match(emailExp) && phone.length == 10) { //if (CardName != '' || CardNo != '' || CLastName != '' || CVV != '' || CLine1 != '' || CState != '' || CCity != '' || CZip != '') { $.ajax({ type: "POST", url: "orders.aspx/CheckMunchemAccount", data: "{'Email':'" + EmailId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var UId = document.getElementById("UserId").innerHTML; if (UId == "") { if (msg.d != "UNRegistered User") { alertify.set({ labels: { cancel: "Cancel", ok: "Ok" } }); alertify.confirm("There is already munchem account with this email. Do you want to Proceed as Guest", function (e) { if (e) { count++; GroupOrderStatus(); OrderSuccessCount(count, OrderTypevalue); } else { $('.placeorder').fadeIn("slow"); $(".placeorderloaderdiv").fadeOut(); $(".placeorderbtndiv").delay(300).fadeIn(); $('.userdeliveryloader').css("display", "none"); return; } }); } else { count++; GroupOrderStatus(); OrderSuccessCount(count, OrderTypevalue); } } else { count++; GroupOrderStatus(); OrderSuccessCount(count, OrderTypevalue); } } }); // } } else if (!EmailId.match(emailExp) && phone.length < 10) { $(Emailele).focus(); $('.errormsg').text("Enter Valid Email and Phone Number."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else if (!EmailId.match(emailExp) && phone.length == 10) { $(Emailele).focus(); $('.errormsg').text("Enter Valid Email."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else if (EmailId.match(emailExp) && phone.length < 10) { $(Phoneele).focus(); $('.errormsg').text("Enter Valid Phone Number."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else if (phone.length != 10) { $(Phoneele).focus(); $('.errormsg').text("Enter Valid Phone Number."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } else { $('.errormsg').text("Select Time."); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } else { if (document.getElementById("AdvancedOption").innerHTML == "true" && OrderTypevalue != OrderType) { var G1 = document.getElementById("ddldropdownoptions"); if (G1.selectedIndex != "-1") { AdvancedLabel = G1.options[G1.selectedIndex].value } if (AdvancedLabel == "" || AdvancedLabel == "0") { if (document.getElementById("lblindication").innerHTML == "Textbox") { $('.errormsg').text("Please enter " + OrderType); $("#txtAdvancedlbl").addClass("reqruiredc"); } else if (document.getElementById("lblindication").innerHTML == "Dropdown") { $('.errormsg').text("Please select " + OrderType); $("#ddldropdownoptions").addClass("reqruiredc"); } else { $('.errormsg').text("Please enter " + OrderType); $("#txtCustomerOrderDe").addClass("reqruiredc"); } $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } else { if (document.getElementById("lblindication").innerHTML == "Textbox") { var TextboxRangeFrom = $("#txtRangeFrom").text(); var TextboxRangeTo = $("#txtRangeTo").text(); if (parseInt(TextboxRangeFrom) <= parseInt(AdvancedLabel) && parseInt(TextboxRangeTo) >= parseInt(AdvancedLabel)) { } else { $('.errormsg').text("Please enter " + $(".lblpickuptext").text() + " between " + parseInt(TextboxRangeFrom) + " and " + parseInt(TextboxRangeTo)); $("#txtAdvancedlbl").addClass("reqruiredc"); $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } $("#ddldropdownoptions").removeClass("reqruiredc"); $("#txtAdvancedlbl").removeClass("reqruiredc"); $("#txtCustomerOrderDe").removeClass("reqruiredc"); } } if (OrderTypevalue == "Shipping") { } else { if (DeliveryTime != '') { $(timeele).removeClass("reqruiredc"); } else { $(timeele).focus(); $(timeele).addClass("reqruiredc"); } } if (deliverdate != '') { $(dateele).removeClass("reqruiredc"); } else { $(dateele).focus(); $(dateele).addClass("reqruiredc"); } $('.placeorder').css("display", "inline-table"); $(".placeorderloaderdiv").delay(3000).fadeOut(); $(".placeorderbtndiv").delay(3000).fadeIn(); return; } } function ShowNextOptionFlow(){ //localStorage.setItem("ScreenId",Screenid); var ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; OptionsFlowValidatingOptionsCheck(); var OrderType = ""; $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + ItemId + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if(msg.d[0].ItemFlow == true){ document.getElementById("lblitemflowtype").innerHTML = msg.d[0].ItemFlow; MenuItemOptionsLoad(msg, ItemId, OrderType); } else{ OptionsLoad(msg, ItemId, OrderType);} } } }); } function YesPlaceOrder() { $(".grouplaceorderalert").css("display","none"); document.getElementById("lblorderfail").innerHTML = "InsertOrder"; BindPricesinGrouporder(); } function NODontPlaceOrder() { document.getElementById("lblorderfail").innerHTML = ""; $(".placeorderloaderdiv").fadeOut(); $(".placeorderbtndiv").fadeIn(); $(".placeorder").fadeIn(); $(".grouplaceorderalert").css("display","none"); return; } function PlaceorderClose(){ document.getElementById("lblorderfail").innerHTML = ""; $(".placeorderloaderdiv").fadeOut(); $(".placeorderbtndiv").fadeIn(); $(".placeorder").fadeIn(); $(".grouplaceorderalert").css("display","none"); return; } function AlreadyOrderPlaced() { $(".grouplaceorderplaced").css("display","none"); } function OptionsFlowAddItemstoCart() { document.getElementById("flowoptbtnerror").innerHTML=""; $(".addtocartdiv").css("display", "none"); $(".btnloaderdiv").css("display", "block"); $("#itemflowcolumns").css("display", "none"); $("#ItemImageDisplay").css("display", "none"); var OrderType = localStorage.getItem("OrderType"); var ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; document.getElementById("additemserror").innerHTML = ""; var DisplayedretrivedOptions = localStorage.getItem("ShowingItemOptions"); var PreviousScreenId = localStorage.getItem("PreviousScreenId"); PreviousScreenId = Number(PreviousScreenId); var DisplayedOptions; if (DisplayedretrivedOptions != null) { DisplayedOptions = JSON.parse(DisplayedretrivedOptions); } var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].ItemId == document.getElementById("lblItemId").innerHTML.split('//')[0]) { } else { var sPath = window.location.pathname; $("#lblordalert").text("Something went wrong"); $(".orderalert").fadeIn(); //$(".btnloaderdiv").delay(3000).fadeOut(); //$(".addtocartdiv").delay(3000).fadeIn(); window.location.href = sPath; } } var retrievedData = localStorage.getItem("TotalItems"); var ItemCount = 0; if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var Itemdetails = document.getElementById("lblItemId").innerHTML.split('//'); if (AddedItems != null) { if (AddedItems.length > 0) { if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Id = document.getElementById("EditItemNum").innerHTML.replace("EditItem", ""); for (var cou = 0; cou < AddedItems.length; cou++) { if (Id != cou) { if (AddedItems[cou].Id == Itemdetails[0]) { ItemCount = parseInt(AddedItems[cou].Quantity) + ItemCount; } } } } else { for (var cou = 0; cou < AddedItems.length; cou++) { if (AddedItems[cou].Id == Itemdetails[0]) { ItemCount = parseInt(AddedItems[cou].Quantity) + ItemCount; } } } } } } var Qu = parseInt(document.getElementById('txtquantity').value); ItemCount = ItemCount + Qu; if (ItemCount > parseInt(localStorage.getItem("ItemAvailability"))) { document.getElementById("additemserror").innerHTML = "Available only " + localStorage.getItem("ItemAvailability") + " item(s)"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } var ddlvariation = $(".ddlVariation"); if (ddlvariation.length > 0) { if (ddlvariation[0].options[ddlvariation[0].selectedIndex].text == "Select Variation") { document.getElementById("additemserror").innerHTML = "Choose Variation"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].MinSize; var H = 0; $("input[name='Choiceradio" + OptionsCheck[J].Id + "']:checked").each(function () { H++; }); var Minval = parseInt(Minvalue) if (H >= Minval) { document.getElementById("additemserror").innerHTML = ""; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].MinSize; var H = 0; $("input[name='Choiceradio" + OptionsCheck[J].Id + "']:checked").each(function () { H++; }); var Minval = parseInt(Minvalue) if (H >= Minval) { document.getElementById("additemserror").innerHTML = ""; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Flow Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify + "/" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Flow Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify + "/" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Dropdown") { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if ($('#' + OptionsCheck[J].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var U = 0; U < OptionsCheck[J].Choices.length; U++) { if (OptionsCheck[J].Choices[U].Id == $('#' + OptionsCheck[J].Id).children("option").filter(":selected").val()) { var NotifyVal = true + "/" + OptionsCheck[J].Choices[U].Notify; } } var text = OptionsCheck[J].Id + "/" + $('#' + OptionsCheck[J].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Id).val(); } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Dropdown") { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if ($('#' + OptionsCheck[J].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var U = 0; U < OptionsCheck[J].Choices.length; U++) { if (OptionsCheck[J].Choices[U].Id == $('#' + OptionsCheck[J].Id).children("option").filter(":selected").val()) { var NotifyVal = true + "/" + OptionsCheck[J].Choices[U].Notify; } } var text = OptionsCheck[J].Id + "/" + $('#' + OptionsCheck[J].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Id).val(); } } } } } } } } var B = 0; for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "") { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #C22727"; document.getElementById("additemserror").innerHTML = "Please enter quantity "; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); B++; } else if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "0") { document.getElementById("additemserror").innerHTML = "Quantity should be greater than zero"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); B++; } else { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #b9bcbe"; } } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "") { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #C22727"; document.getElementById("additemserror").innerHTML = "Please enter quantity "; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); B++; } else if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "0") { document.getElementById("additemserror").innerHTML = "Quantity should be greater than zero"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); B++; } else { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #b9bcbe"; } } } } } } } } } } if (B > 0) { return; } for (var J = 0; J < OptionsCheck.length; J++) { var TotalQuantity = 0; if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value != "") { var quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; TotalQuantity = +quantity + +TotalQuantity; } } } var SelectionQuantity = OptionsCheck[J].QuantitySelection; if (TotalQuantity == SelectionQuantity) { } else { document.getElementById("additemserror").innerHTML = "Quantity doesn't match"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value != "") { var quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; TotalQuantity = +quantity + +TotalQuantity; } } } var SelectionQuantity = OptionsCheck[J].QuantitySelection; if (TotalQuantity == SelectionQuantity) { } else { document.getElementById("additemserror").innerHTML = "Quantity doesn't match"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } } } } } } } } $(".backtooptions").css("display", "block"); $("#itemflowcolumns").css("display", "none"); var Orderstring = getQueryStrings(); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { AddItemstoCartinGrouporder(OptionsCheck); } else { AddItemstoCart(OptionsCheck, ""); } gettotalprice(); } function MenuItemOptionsLoad(msg, ItemId, OrderType) { $(".pricetext").css("display", "block"); $.ajax({ type: "POST", url: "Orders.aspx/CheckScreensbyItemId", data: "{'ItemId': '" + ItemId + "'}", dataType: "json", contentType: "application/json", success: function (msg3) { if (msg3.d != null && msg3.d != "") { if (msg3.d.length > 0) { $("#btnmakeitcombo").css("display", "none"); $(".btncomboloaderdiv").css("display", "none"); $(".ordqntymnlt").css("width", "46%"); localStorage.removeItem("SelectedDropDown"); var AppId = document.getElementById('lblAppId1').value; if (AppId == "db56d720-4a50-4356-9ee8-41f3e78cf49c" || AppId == "3b9b8dea-9ddf-42de-98af-279352efec24") { $("#btnaddtocart").val("Add to bag"); } else { $("#btnaddtocart").val("Add to cart"); } $(".addtocartdiv").css("display", "block"); $(".btnloaderdiv").css("display", "none"); $(".backtooptions").css("display", "block"); $("#btnaddtocart").attr("onclick", "ValidatingOptionsCheck();"); var UrlType = document.getElementById('lblurlnametype').innerHTML; $(".lblitemmesg").text(msg.d[0].OptionName); document.getElementById('PreviewOptionTable').innerHTML = ""; localStorage.setItem("ItemAvailability", msg.d[0].Availability); localStorage.setItem("LoadedItemOptions", JSON.stringify(msg.d)); var Screenid = localStorage.getItem("ScreenId"); $.ajax({ type: "POST", url: "Orders.aspx/GetAllItemOptionsByIdandScreenId", data: "{'ItemId': '" + ItemId + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "','Screenid':'" + Screenid + "'}", dataType: "json", contentType: "application/json", success: function (msg1) { if (msg1.d != null) { if (msg1.d.length > 0) { var OptionFlowScreens = localStorage.setItem("OptionFlowScreens", JSON.stringify(msg1.d)); msg.d = msg1.d; if (msg.d[0].RecipeExist == true) { $(".btnRecipe").fadeIn("fast"); $(".btnRecipe").attr("id", ItemId); } else { $(".btnRecipe").fadeOut("fast"); } if (msg.d[0].ItemImage != null) { $("#ItemImageDisplay").removeAttr("style"); $("#ItemImageDisplay").attr("src", msg.d[0].ItemImage); GetMultipleItemImages(ItemId); $("#ItemImageDisplay").attr("style", "display:block;"); $(".itemdescriptionstyles").attr("style", "min-height: 170px;"); } else { $("#ItemImageDisplay").attr("src", ""); $("#ItemImageDisplay").attr("style", "display:none;"); $(".itemdescriptionstyles").attr("style", ""); if (msg.d[0].RecipeExist == true) { GetMultipleItemImages(ItemId); } } if (msg.d[0].Type != null && msg.d[0].Type != "null" && msg.d[0].Type != "\n") { $(".lbldescription").text(msg.d[0].Type); } else { $(".lbldescription").text(""); } if (msg.d[0].VideoLinkURL != null && msg.d[0].VideoLinkURL != "null" && msg.d[0].VideoLinkURL != "") { if (msg.d[0].RecipeOn == true) { $("#btnVideoURL1").fadeIn("fast"); } else { $("#btnVideoURL1").fadeOut("fast"); } $("#btnVideoURL1").attr("href", msg.d[0].VideoLinkURL); } else { $("#btnVideoURL1").fadeOut("fast"); } if (msg.d[0].DescriptionOn == true) { $(".lbldescription").fadeIn("fast"); } else { $(".lbldescription").fadeOut("fast"); } $(".fcontainer").css("display", "block"); document.getElementById("PriceVal").innerHTML = msg.d[0].Price; if (msg.d[0].PriceType == "Fixed" || msg.d[0].PriceType == "null" || msg.d[0].PriceType == null || msg.d[0].PriceType == "") { document.getElementById("lblunit").innerHTML = ""; //document.getElementById("tdunitPrice").style.display = ""; //document.getElementById("lblunitprice").innerHTML = "Price per " + msg.d[0].UnitType + ":" + document.getElementById("lblCurrency").innerHTML + msg.d[0].Price; } else { document.getElementById("lblunit").innerHTML = msg.d[0].UnitType; // document.getElementById("tdunitPrice").style.display = "none"; } localStorage.setItem("priceType", msg.d[0].PriceType); localStorage.setItem("UnitType", msg.d[0].UnitType); document.getElementById("lbldisplayItemPrice").innerHTML = document.getElementById("lblCurrency").innerHTML + (msg.d[0].Price).toFixed(2); document.getElementById("lblItemId").innerHTML = ItemId + "//" + msg.d[0].OptionName + "//" + msg.d[0].CloverOptionId + "//" + msg.d[0].PosId + ""; document.getElementById("lblItemNoTax").innerHTML = msg.d[0].NoSalesTax; document.getElementById("lblCustomTax").innerHTML = msg.d[0].CustomTax; document.getElementById("lblTaxLabel").innerHTML = escape(msg.d[0].TaxLabel); var s = 0; document.getElementById('OptionTable').innerHTML = ""; var Options = new Array(); if (msg.d[0].ShippingItems.length > 0) { var tableOption = document.createElement("table"); tableOption.setAttribute("class", "optionrow"); tableOption.setAttribute("id", "optionrow" + Screenid); tableOption.setAttribute("style", optionColor); for (var i = 0; i < msg.d[0].ShippingItems.length; i++) { if (i == 0) { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "class": "optionname", "style": "color:" + OptionTextColor, "id": "option" + msg.d[0].ShippingItems[i].Id }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "class": "Choicetd", "align": "left" }); var lblChoice = document.createElement("label"); lblChoice.innerHTML += "Weights"; setAttributes(lblChoice, { "style": "font-weight:bold;font-size:14px;" }); tdChoice.appendChild(lblChoice); trChoice.appendChild(tdChoice); tableOption.appendChild(trChoice); } var trChoice = document.createElement("tr"); setAttributes(trChoice, { "class": "optionname", "style": "color:" + OptionTextColor, "id": "option" + msg.d[0].ShippingItems[i].Id }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "class": "Choicetd", "align": "left" }); var lblChoice = document.createElement("label"); lblChoice.innerHTML += " " + msg.d[0].ShippingItems[i].Weight; lblChoice.innerHTML += " " + msg.d[0].ShippingItems[i].Measurement; setAttributes(lblChoice, { "title": msg.d[0].ShippingItems[i].Weight, "for": msg.d[0].ShippingItems[i].Id, "style": "cursor:pointer;" }); var Price = 0; if (msg.d[0].ShippingItems[i].Price != Price.toFixed(2)) { lblChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + msg.d[0].ShippingItems[i].Price.toFixed(2) + ")"; } if (UrlType != "DineIn") { var radio = document.createElement("input"); setAttributes(radio, { "type": "radio", "Name": "Choiceradio" + msg.d[0].ShippingItems[i].ItemId, "value": msg.d[0].ShippingItems[i].Price.toFixed(2), "id": msg.d[0].ShippingItems[i].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); document.getElementById('OptionTable').style.display = ""; tdChoice.appendChild(radio); } tdChoice.appendChild(lblChoice); trChoice.appendChild(tdChoice); tableOption.appendChild(trChoice); document.getElementById('OptionTable').appendChild(tableOption); } } for (var i = 1; i < msg.d.length; i++) { var ScreenId= "ScreenId1"; if (i == 1) { localStorage.setItem("PreviousScreenId", msg.d[i].ScreenId); localStorage.setItem("ShowingItemOptions", JSON.stringify(msg.d[1])); document.getElementById('OptionTable').style.display = "block"; document.getElementById('PreviewOptionTable').style.display = "none"; var trScreen = document.createElement("tr"); trScreen.setAttribute("Id", "ScreenId" + msg.d[i].ScreenId); ScreenId="ScreenId" + msg.d[i].ScreenId; trScreen.setAttribute("class", "OptionScreens"); trScreen.setAttribute("style", "display:grid;"); var tdScreen = document.createElement("td"); var tableOption = document.createElement("table"); tableOption.setAttribute("class", "optionrow"); tableOption.setAttribute("style", optionColor); var trOption = document.createElement("tr"); trOption.setAttribute("style", "font-weight:bold;"); var tdOption = document.createElement("td"); setAttributes(tdOption, { "class": "Optiontd", "colspan": "3" }); var lblOption = document.createElement("span"); lblOption.innerHTML += msg.d[i].OptionName; lblOption.setAttribute("id", "ItemOption" + msg.d[i].OptionId); lblOption.setAttribute("style", "float:left;"); var lblrequired = document.createElement("span"); lblrequired.setAttribute("style", "float:left;"); tdOption.appendChild(lblOption); tdOption.appendChild(lblrequired); var Collapseimg = document.createElement("span"); Collapseimg.setAttribute("style", "float:left;"); Collapseimg.innerHTML = "<span class='Collapseimg'> <img src='' alt='Collapse' id='Collapseimg" + msg.d[i].OptionId + "' onclick='OverrideCollapse(this)' /> </span>"; tdOption.appendChild(Collapseimg); if (msg.d[i].Type == "CheckBoxes") { if (msg.d[i].MaxSize > 0) { if (msg.d[i].MaxSize != 100 && msg.d[i].MaxSize != msg.d[i].Choice.length) { var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "padding-left:5px;color:red;font-size: 14px;display:none;color:" + OptionTextColor, "id": "ItemOptionSelection" + msg.d[i].OptionId }); lblOptionSelection.innerHTML += "(Max Selection: " + msg.d[i].MaxSize + ")"; tdOption.appendChild(lblOptionSelection); lblrequired.innerHTML = "<span style='float:right;color:Green;padding-left:10px;' class='optionalimg'>(Opt)</span>"; } } if (msg.d[i].MinSize > 0) { if (msg.d[i].MinSize != 100) { if (document.getElementById("choiceselect").innerHTML == "") { document.getElementById("choiceselect").innerHTML = msg.d[i].OptionId; } else { document.getElementById("choiceselect").innerHTML = document.getElementById("choiceselect").innerHTML + "," + msg.d[i].OptionId } var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "padding-left:5px;color:red;font-size: 14px;color:" + OptionTextColor, "id": "ItemOptionSelectionMin" + msg.d[i].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "(Min Selection: " + msg.d[i].MinSize + ")"; tdOption.appendChild(lblOptionSelection); lblrequired.innerHTML = "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; } } if (UrlType != "DineIn") { if (msg.d[i].FreeOptions > 0) { var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "color:red;padding-left:5px;font-size: 14px;", "id": "ItemOptionSelectionMin" + msg.d[i].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "Select " + msg.d[i].OptionName + " with no cost(you have " + msg.d[i].FreeOptions + " free options)"; tdOption.appendChild(lblOptionSelection); } } } trOption.appendChild(tdOption); tableOption.appendChild(trOption); if (msg.d[i].OptionQuantity == true) { var trQuantity = document.createElement("tr"); trQuantity.setAttribute("style", "font-weight:bold;"); var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Optiontd", "colspan": "3", "style": "padding:0 25px;height:auto;border:none" }); var lblQuantity = document.createElement("span"); lblQuantity.setAttribute("style", "font-size:14px;color:red"); lblQuantity.innerHTML += "Please select " + msg.d[i].QuantitySelection + " by quantity"; tdQuantity.appendChild(lblQuantity); trQuantity.appendChild(tdQuantity); tableOption.appendChild(trQuantity); } var option = new Object; option.Type = msg.d[i].Type; option.ItemId = ItemId; option.Id = msg.d[i].OptionId; option.MinSize = msg.d[i].MinSize; option.MaxSize = msg.d[i].MaxSize; option.FreeOptions = msg.d[i].FreeOptions; option.Name = msg.d[i].OptionName; option.OptionQuantity = msg.d[i].OptionQuantity; option.QuantitySelection = msg.d[i].QuantitySelection; option.Collapse = msg.d[i].Collapse; option.DefaultOptionText = msg.d[i].DefaultOptionText; option.Chargable = msg.d[i].Chargable; option.PosId = msg.d[i].PosId; option.Choices = new Array(); if (msg.d[i].Type == "Radio Buttons" || msg.d[i].Type == "CheckBoxes") { if (msg.d[i].FreeOptions > 0) { msg.d[i].Choice.sort(function (a, b) { return parseFloat(a.Price) - parseFloat(b.Price); }); } var AddRow = ""; for (L = 0; L < msg.d[i].Choice.length; L++) { var Choice = new Object; Choice.Id = msg.d[i].Choice[L].Id; Choice.Name = msg.d[i].Choice[L].ChoiceName; Choice.Notify = msg.d[i].Choice[L].Notify; Choice.DefaultVSOption = msg.d[i].Choice[L].DefaultVSOption; Choice.Active = msg.d[i].Choice[L].Active; Choice.Price = msg.d[i].Choice[L].Price.toFixed(2); Choice.Exist = msg.d[i].Choice[L].Exist; Choice.FreeOptions = "No"; Choice.SelectionCount = 0; option.Choices.push(Choice); var trChoice = document.createElement("tr"); setAttributes(trChoice, { "class": "Collapserow" + msg.d[i].OptionId + " optionname", "style": "color:" + OptionTextColor, "id": msg.d[i].OptionId }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "class": "Choicetd", "align": "left" }); var lblChoice = document.createElement("label"); lblChoice.innerHTML += msg.d[i].Choice[L].ChoiceName; setAttributes(lblChoice, { "title": msg.d[i].Choice[L].ChoiceName, "for": msg.d[i].Choice[L].Id, "style": "cursor:pointer;" }); var choicelabel = "<label titel='" + msg.d[i].Choice[L].ChoiceName + "' for='" + msg.d[i].Choice[L].Id + "' style='cursor:pointer'>" + msg.d[i].Choice[L].ChoiceName + "</label>"; if (UrlType == "DineIn") { setAttributes(lblChoice, { "style": "background:none;" }); } var Price = 0; if (msg.d[i].Choice[L].Price != Price.toFixed(2)) { lblChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + msg.d[i].Choice[L].Price.toFixed(2) + ")"; choicelabel += "<label>" + document.getElementById("lblCurrency").innerHTML + msg.d[i].Choice[L].Price.toFixed(2) + "</label>"; } if (msg.d[i].Type == "Radio Buttons") { lblrequired.innerHTML = "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; var radio = document.createElement("input"); if (msg.d[i].Choice[L].DefaultVSOption == true) { setAttributes(radio, { "type": "radio","class":"optcheckedscreenid"+msg.d[i].ScreenId+" Validate","checked": "true", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[L].Price.toFixed(2), "id": msg.d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(radio, { "type": "radio","class":"optcheckedscreenid"+msg.d[i].ScreenId+" Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[L].Price.toFixed(2), "id": msg.d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } tdChoice.appendChild(radio); } if (msg.d[i].Type == "CheckBoxes") { if (lblrequired.innerHTML.indexOf("Required") != -1) { } else lblrequired.innerHTML = "<span style='float:right;color:green;padding-left:10px;' class='optionalimg'>(Opt)</span>"; var checkbox = document.createElement("input"); if (msg.d[i].Choice[L].DefaultVSOption == true) { setAttributes(checkbox, { "type": "checkbox","class":"optcheckedscreenid"+msg.d[i].ScreenId+" Validate","checked": "true", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[L].Price.toFixed(2), "id": msg.d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(checkbox, { "type": "checkbox","class":"optcheckedscreenid"+msg.d[i].ScreenId+" Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[L].Price.toFixed(2), "id": msg.d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } //optionsdiv += "<div><input type='checkbox' Name='Choiceradio" + msg.d[i].OptionId + "' value='" + msg.d[i].Choice[L].Price.toFixed(2) + "' id='" + msg.d[i].Choice[L].Id + "' "; if (msg.d[i].MaxSize > 0) { checkbox.setAttribute("onclick", "LimitOptionsSelection(this);"); } tdChoice.appendChild(checkbox); } if (msg.d[i].Type == "Radio Buttons" || msg.d[i].Type == "CheckBoxes") { if (msg.d[i].Choice[L].ChoiceImageURL != null && msg.d[i].Choice[L].ChoiceImageURL != "") { var lblChoiceimg = document.createElement("label"); setAttributes(lblChoiceimg, { "class": "Choicetdimg","title": msg.d[i].Choice[L].ChoiceName, "for": msg.d[i].Choice[L].Id, "style": "cursor:pointer;" }); lblChoiceimg.innerHTML = "<img class='choiceimage', alt='Choice Image', id='Choiceimg" + msg.d[i].Choice[L].Id + "', title='" + msg.d[i].Choice[L].ChoiceImageURL + "' , src='" + msg.d[i].Choice[L].ChoiceImageURL + "' />"; setAttributes(lblChoice, { "style": "float:left" }); tdChoice.appendChild(lblChoiceimg); } } tdChoice.appendChild(lblChoice); trChoice.appendChild(tdChoice); if (UrlType != "DineIn") { if (msg.d[i].OptionQuantity == true) { var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Choicetd", "align": "left" }); var txtQuantity = document.createElement("input"); setAttributes(txtQuantity, { "id": "Quantity" + msg.d[i].Choice[L].Id, "type": "text", "class": "ChoicesQuantity", "disabled": "disabled", "onchange": "gettotalprice()", "MaxLength": "4" }); tdQuantity.appendChild(txtQuantity); trChoice.appendChild(tdQuantity); } if (msg.d[i].ChoicesQuantity == true) { if (msg.d[i].ChoicesSelection > 0) { var tdddlQuantity = document.createElement("td"); setAttributes(tdddlQuantity, { "class": "Choicetd", "align": "left" }); var ddlQuantity = document.createElement("select"); setAttributes(ddlQuantity, { "id": "ddlQuantity" + msg.d[i].Choice[L].Id, "style": "display:none;", "class": "ChoicesQuantity", "onchange": "gettotalprice()", "MaxLength": "4" }); for (var Q = 1; Q <= msg.d[i].ChoicesSelection; Q++) { ddlQuantity.options.add(new Option(Q, Q)); } tdddlQuantity.appendChild(ddlQuantity); trChoice.appendChild(tdddlQuantity); } } } if (UrlType != "DineIn") { if (msg.d[i].FreeOptions > 0) { if (AddRow == "" && Choice.Price > 0) { var trChoiceFreeOptions = document.createElement("tr"); var tdChoiceFreeOptions = document.createElement("td"); var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "color:red;padding-left:5px;font-weight: bold;font-size: 14px;", "id": "ItemOptionSelectionMin" + msg.d[i].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "Select " + msg.d[i].OptionName + " for additional pricing"; tdChoiceFreeOptions.appendChild(lblOptionSelection); trChoiceFreeOptions.appendChild(tdChoiceFreeOptions); tableOption.appendChild(trChoiceFreeOptions); AddRow = "Exist"; } } } tableOption.appendChild(trChoice); if (msg.d[i].Choice[L].Exist == true) { var childExist = document.createElement("img"); setAttributes(childExist, { "src": "images/childExpand.png", "style": "width: 15px;vertical-align: top; margin-left: 4px;", "alt": "Expand" }); lblChoice.appendChild(childExist); var childExisttr = document.createElement("tr"); setAttributes(childExisttr, { "id": "childOption" + msg.d[i].Choice[L].Id }); setAttributes(childExisttr, { "class": "Collapserow" + msg.d[i].OptionId }); tableOption.appendChild(childExisttr); } } Options.push(option); } else if (msg.d[i].Type == "Dropdown") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); setAttributes(trChoice, { "class": "dropdowncs" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var ddlOption = document.createElement("select"); //ddlOption.options.add(new Option("Select One", "")); setAttributes(ddlOption, { "style": "width: auto;height: 25px;margin-top:10px;max-width:60%", "id": msg.d[i].OptionId, "class": "ddlOption Validate", "onchange": "gettotalprice()" }); for (var S = 0; S < msg.d[i].Choice.length; S++) { var Choice = new Object; Choice.Id = msg.d[i].Choice[S].Id; Choice.Name = msg.d[i].Choice[S].ChoiceName; Choice.Notify = msg.d[i].Choice[S].Notify; Choice.DefaultVSOption = msg.d[i].Choice[S].DefaultVSOption; Choice.Active = msg.d[i].Choice[S].Active; Choice.Price = msg.d[i].Choice[S].Price.toFixed(2); Choice.Exist = msg.d[i].Choice[S].Exist; option.Choices.push(Choice); ddlOption.options.add(new Option(msg.d[i].Choice[S].ChoiceName + " " + document.getElementById("lblCurrency").innerHTML + msg.d[i].Choice[S].Price, msg.d[i].Choice[S].Id)); } tdChoice.appendChild(ddlOption); trChoice.appendChild(tdChoice); tableOption.appendChild(trChoice); Options.push(option); if (msg.d[i].Choice.length > 0) { lblrequired.innerHTML += "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; } } else if (msg.d[i].Type == "Flow Buttons") { var AddRow = ""; for (F = 0; F < msg.d[i].Choice.length; F++) { var Choice = new Object; Choice.Id = msg.d[i].Choice[F].Id; Choice.Name = msg.d[i].Choice[F].ChoiceName; Choice.Notify = msg.d[i].Choice[F].Notify; Choice.DefaultVSOption = msg.d[i].Choice[F].DefaultVSOption; Choice.Active = msg.d[i].Choice[F].Active; Choice.Price = msg.d[i].Choice[F].Price.toFixed(2); Choice.Exist = msg.d[i].Choice[F].Exist; Choice.FreeOptions = "No"; Choice.SelectionCount = 0; option.Choices.push(Choice); var trChoice = document.createElement("tr"); setAttributes(trChoice, { "class": "Collapserow" + msg.d[i].OptionId + " optionname flowbuttons", "style": "color:" + OptionTextColor, "id": msg.d[i].OptionId, "name": "flowbuttons" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "class": "Choicetd", "align": "left", "id": "ScreenId" + msg.d[i].ScreenId }); var lblChoice = document.createElement("label"); lblChoice.innerHTML += msg.d[i].Choice[F].ChoiceName; if (document.getElementById('lblLId').value == "305f3f06-fbb4-437e-8090-db6046a96a7f" || document.getElementById('lblLId').value == "e9354e34-c551-43e2-adda-763bdc86b771") { if (msg.d[i].Choice[F].Active == true) { setAttributes(lblChoice, { "title": msg.d[i].Choice[F].ChoiceName, "for": msg.d[i].Choice[F].Id, "style": ButtonColor, "class": "flowoptbtns" }); } else { setAttributes(lblChoice, { "title": msg.d[i].Choice[F].ChoiceName, "for": msg.d[i].Choice[F].Id, "style": "background: -webkit-gradient(linear,left top,left bottom,color-stop(0.05,lightgrey),color-stop(1,lightgrey)) !important;border: 1px solid lightgrey !important;-webkit-box-shadow: 0 0 2px 0 lightgrey !important;'" + ButtonColor + "'", "class": "flowoptbtns" }); } } else { setAttributes(lblChoice, { "title": msg.d[i].Choice[F].ChoiceName, "for": msg.d[i].Choice[F].Id, "style": ButtonColor, "class": "flowoptbtns" }); } var choicelabel = "<label titel='" + msg.d[i].Choice[F].ChoiceName + "' for='" + msg.d[i].Choice[F].Id + "' style='cursor:pointer'>" + msg.d[i].Choice[F].ChoiceName + "</label>"; if (UrlType == "DineIn") { setAttributes(lblChoice, { "style": "background:none;" }); } var Price = 0; if (msg.d[i].Choice[F].Price != Price.toFixed(2)) { lblChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + msg.d[i].Choice[F].Price.toFixed(2) + ")"; choicelabel += "<label>" + document.getElementById("lblCurrency").innerHTML + msg.d[i].Choice[F].Price.toFixed(2) + "</label>"; } if (msg.d[i].Type == "Flow Buttons") { lblrequired.innerHTML = "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; var radio = document.createElement("input"); if (document.getElementById('lblLId').value == "305f3f06-fbb4-437e-8090-db6046a96a7f" || document.getElementById('lblLId').value == "e9354e34-c551-43e2-adda-763bdc86b771") { if (msg.d[i].Choice[F].Active == true) { if (msg.d[i].Choice[F].Exist == true) { if (msg.d[i].Choice[F].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } else { if (msg.d[i].Choice[F].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } } else { if (msg.d[i].Choice[F].Exist == true) { if (msg.d[i].Choice[F].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } else { if (msg.d[i].Choice[F].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } } } else { if (msg.d[i].Choice[F].Exist == true) { if (msg.d[i].Choice[F].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } else { if (msg.d[i].Choice[F].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } } tdChoice.appendChild(radio); } if (msg.d[i].Type == "CheckBoxes") { if (lblrequired.innerHTML.indexOf("Required") != -1) { } else lblrequired.innerHTML = "<span style='float:right;color:green;padding-left:10px;' class='optionalimg'>(Opt)</span>"; var checkbox = document.createElement("input"); if (msg.d[i].Choice[F].DefaultVSOption == true) { setAttributes(checkbox, { "type": "checkbox", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(checkbox, { "type": "checkbox", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } //optionsdiv += "<div><input type='checkbox' Name='Choiceradio" + msg.d[i].OptionId + "' value='" + msg.d[i].Choice[F].Price.toFixed(2) + "' id='" + msg.d[i].Choice[F].Id + "' "; if (msg.d[i].MaxSize > 0) { checkbox.setAttribute("onclick", "LimitOptionsSelection(this);"); } tdChoice.appendChild(checkbox); } if (msg.d[i].Type != "Flow Buttons") { if (msg.d[i].Choice[F].ChoiceImageURL != null && msg.d[i].Choice[F].ChoiceImageURL != "") { var lblChoiceimg = document.createElement("label"); setAttributes(lblChoiceimg, { "class": "Choicetdimg", "title": msg.d[i].Choice[F].ChoiceName, "for": msg.d[i].Choice[F].Id, "style": "cursor:pointer;" }); lblChoiceimg.innerHTML = "<img class='choiceimage', alt='Choice Image', id='Choiceimg" + msg.d[i].Choice[F].Id + "', title='" + msg.d[i].Choice[F].ChoiceImageURL + "' , src='" + msg.d[i].Choice[F].ChoiceImageURL + "' />"; setAttributes(lblChoice, { "style": "float:left" }); tdChoice.appendChild(lblChoiceimg); } } tdChoice.appendChild(lblChoice); trChoice.appendChild(tdChoice); tableOption.appendChild(trChoice); if (msg.d[i].Choice[F].Exist == true) { if (msg.d[i].Type != "Flow Buttons") { var childExist = document.createElement("img"); setAttributes(childExist, { "src": "images/childExpand.png", "style": "width: 15px;vertical-align: top; margin-left: 4px;", "alt": "Expand" }); lblChoice.appendChild(childExist); } var childExisttr = document.createElement("tr"); setAttributes(childExisttr, { "id": "childOption" + msg.d[i].Choice[F].Id }); setAttributes(childExisttr, { "class": "Collapserow" + msg.d[i].OptionId }); tableOption.appendChild(childExisttr); } } Options.push(option); } if (UrlType != "DineIn") { if (msg.d[i].Type == "Multiline Textbox") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var textbox = document.createElement("textarea"); setAttributes(textbox, { "class": "Choicetext", "id": msg.d[i].OptionId }); tdChoice.appendChild(textbox); trChoice.appendChild(tdChoice); tableOption.appendChild(trChoice); Options.push(option); } } tdScreen.appendChild(tableOption); trScreen.appendChild(tdScreen); document.getElementById('OptionTable').appendChild(trScreen); if (msg.d[i].Type == "CheckBoxes" || msg.d[i].Type == "Radio Buttons") { if (msg.d[i].Collapse == true) { $(".Collapserow" + msg.d[i].OptionId).css("display", "none"); $("#Collapseimg" + msg.d[i].OptionId).attr('src', 'https://orderem.com/images/Sortdown.png') } else { $("#Collapseimg" + msg.d[i].OptionId).attr('src', 'https://orderem.com/images/Sortup.png');; } } else { $("#Collapseimg" + msg.d[i].OptionId).remove(); } if (msg.d[i].MultiplescreenOptions != null) { if (msg.d[i].MultiplescreenOptions.length > 0) { for (var Q = 0; Q < msg.d[i].MultiplescreenOptions.length; Q++) { var tableOption1 = document.createElement("table"); tableOption1.setAttribute("class", "optionrow"); tableOption1.setAttribute("style", optionColor); var trOption1 = document.createElement("tr"); trOption1.setAttribute("style", "font-weight:bold;"); var tdOption1 = document.createElement("td"); setAttributes(tdOption1, { "class": "Optiontd", "colspan": "3" }); var lblOption = document.createElement("span"); lblOption.innerHTML += msg.d[i].MultiplescreenOptions[Q].OptionName; lblOption.setAttribute("id", "ItemOption" + msg.d[i].MultiplescreenOptions[Q].OptionId); lblOption.setAttribute("style", "float:left;"); var lblrequired = document.createElement("span"); lblrequired.setAttribute("style", "float:left;"); tdOption1.appendChild(lblOption); tdOption1.appendChild(lblrequired); var Collapseimg = document.createElement("span"); Collapseimg.setAttribute("style", "float:left;"); Collapseimg.innerHTML = "<span class='Collapseimg'> <img src='' alt='Collapse' id='Collapseimg" + msg.d[i].MultiplescreenOptions[Q].OptionId + "' onclick='OverrideCollapse(this)'/> </span>"; tdOption1.appendChild(Collapseimg); if (msg.d[i].MultiplescreenOptions[Q].Type == "CheckBoxes") { if (msg.d[i].MultiplescreenOptions[Q].MaxSize > 0) { if (msg.d[i].MultiplescreenOptions[Q].MaxSize != 100 && msg.d[i].MultiplescreenOptions[Q].MaxSize != msg.d[i].MultiplescreenOptions[Q].Choice.length) { var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "padding-left:5px;color:red;font-size: 14px;display:none;" + OptionTextColor, "id": "ItemOptionSelection" + msg.d[i].MultiplescreenOptions[Q].OptionId }); lblOptionSelection.innerHTML += "(Max Selection: " + msg.d[i].MultiplescreenOptions[Q].MaxSize + ")"; tdOption1.appendChild(lblOptionSelection); lblrequired.innerHTML = "<span style='float:right;color:Green;padding-left:10px;' class='optionalimg'>(Opt)</span>"; } } if (msg.d[i].MultiplescreenOptions[Q].MinSize > 0) { if (msg.d[i].MultiplescreenOptions[Q].MinSize != 100) { if (document.getElementById("choiceselect").innerHTML == "") { document.getElementById("choiceselect").innerHTML = msg.d[i].MultiplescreenOptions[Q].OptionId; } else { document.getElementById("choiceselect").innerHTML = document.getElementById("choiceselect").innerHTML + "," + msg.d[i].MultiplescreenOptions[Q].OptionId } var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "padding-left:5px;color:red;font-size: 14px;" + OptionTextColor, "id": "ItemOptionSelectionMin" + msg.d[i].MultiplescreenOptions[Q].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "(Min Selection: " + msg.d[i].MultiplescreenOptions[Q].MinSize + ")"; tdOption1.appendChild(lblOptionSelection); lblrequired.innerHTML = "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; } } if (UrlType != "DineIn") { if (msg.d[i].MultiplescreenOptions[Q].FreeOptions > 0) { var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "color:red;padding-left:5px;font-size: 14px;", "id": "ItemOptionSelectionMin" + msg.d[i].MultiplescreenOptions[Q].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "Select " + msg.d[i].MultiplescreenOptions[Q].OptionName + " with no cost(you have " + msg.d[i].MultiplescreenOptions[Q].FreeOptions + " free options)"; tdOption1.appendChild(lblOptionSelection); } } } trOption1.appendChild(tdOption1); tableOption1.appendChild(trOption1); if (msg.d[i].MultiplescreenOptions[Q].OptionQuantity == true) { var trQuantity = document.createElement("tr"); trQuantity.setAttribute("style", "font-weight:bold;"); var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Collapserow" + msg.d[i].MultiplescreenOptions[Q].OptionId + " Optiontd", "colspan": "3", "style": "padding:0 25px;height:auto;border:none" }); var lblQuantity = document.createElement("span"); lblQuantity.setAttribute("style", "font-size:14px;color:red"); lblQuantity.innerHTML += "Please select " + msg.d[i].MultiplescreenOptions[Q].QuantitySelection + " by quantity"; tdQuantity.appendChild(lblQuantity); trQuantity.appendChild(tdQuantity); tableOption1.appendChild(trQuantity); } var option = new Object; option.Type = msg.d[i].MultiplescreenOptions[Q].Type; option.ItemId = ItemId; option.Id = msg.d[i].MultiplescreenOptions[Q].OptionId; option.MinSize = msg.d[i].MultiplescreenOptions[Q].MinSize; option.MaxSize = msg.d[i].MultiplescreenOptions[Q].MaxSize; option.FreeOptions = msg.d[i].MultiplescreenOptions[Q].FreeOptions; option.Name = msg.d[i].MultiplescreenOptions[Q].OptionName; option.OptionQuantity = msg.d[i].MultiplescreenOptions[Q].OptionQuantity; option.QuantitySelection = msg.d[i].MultiplescreenOptions[Q].QuantitySelection; option.Collapse = msg.d[i].MultiplescreenOptions[Q].Collapse; option.DefaultOptionText = msg.d[i].MultiplescreenOptions[Q].DefaultOptionText; option.Chargable = msg.d[i].MultiplescreenOptions[Q].Chargable; option.PosId = msg.d[i].MultiplescreenOptions[Q].PosId; option.Choices = new Array(); if (msg.d[i].MultiplescreenOptions[Q].Type == "Radio Buttons" || msg.d[i].MultiplescreenOptions[Q].Type == "CheckBoxes") { if (msg.d[i].MultiplescreenOptions[Q].FreeOptions > 0) { msg.d[i].MultiplescreenOptions[Q].Choice.sort(function (a, b) { return parseFloat(a.Price) - parseFloat(b.Price); }); } var AddRow = ""; for (L = 0; L < msg.d[i].MultiplescreenOptions[Q].Choice.length; L++) { var Choice = new Object; Choice.Id = msg.d[i].MultiplescreenOptions[Q].Choice[L].Id; Choice.Name = msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceName; Choice.Notify = msg.d[i].MultiplescreenOptions[Q].Choice[L].Notify; Choice.DefaultVSOption = msg.d[i].MultiplescreenOptions[Q].Choice[L].DefaultVSOption; Choice.Active = msg.d[i].MultiplescreenOptions[Q].Choice[L].Active; Choice.Price = msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2); Choice.Exist = msg.d[i].MultiplescreenOptions[Q].Choice[L].Exist; Choice.FreeOptions = "No"; Choice.SelectionCount = 0; option.Choices.push(Choice); var trChoice = document.createElement("tr"); setAttributes(trChoice, { "class": "Collapserow" + msg.d[i].MultiplescreenOptions[Q].OptionId + " optionname", "style": "color:" + OptionTextColor, "id": msg.d[i].MultiplescreenOptions[Q].OptionId }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "class": "Choicetd", "align": "left" }); var lblChoice = document.createElement("label"); lblChoice.innerHTML += msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceName; setAttributes(lblChoice, { "title": msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceName, "for": msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "style": "cursor:pointer;" }); var choicelabel = "<label titel='" + msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceName + "' for='" + msg.d[i].MultiplescreenOptions[Q].Choice[L].Id + "' style='cursor:pointer'>" + msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceName + "</label>"; if (UrlType == "DineIn") { setAttributes(lblChoice, { "style": "background:none;" }); } var Price = 0; if (msg.d[i].MultiplescreenOptions[Q].Choice[L].Price != Price.toFixed(2)) { lblChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2) + ")"; choicelabel += "<label>" + document.getElementById("lblCurrency").innerHTML + msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2) + "</label>"; } if (msg.d[i].MultiplescreenOptions[Q].Type == "Radio Buttons") { lblrequired.innerHTML = "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; var radio = document.createElement("input"); if (msg.d[i].MultiplescreenOptions[Q].Choice[L].DefaultVSOption == true) { setAttributes(radio, { "type": "radio","class":"optcheckedscreenid"+msg.d[i].ScreenId+" Validate","checked": "true", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(radio, { "type": "radio","class":"optcheckedscreenid"+msg.d[i].ScreenId+" Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } tdChoice.appendChild(radio); } if (msg.d[i].MultiplescreenOptions[Q].Type == "CheckBoxes") { if (lblrequired.innerHTML.indexOf("Required") != -1) { } else lblrequired.innerHTML = "<span style='float:right;color:green;padding-left:10px;' class='optionalimg'>(Opt)</span>"; var checkbox = document.createElement("input"); if (msg.d[i].MultiplescreenOptions[Q].Choice[L].DefaultVSOption == true) { setAttributes(checkbox, { "type": "checkbox","class":"optcheckedscreenid"+msg.d[i].ScreenId+" Validate","checked": "true", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(checkbox, { "type": "checkbox","class":"optcheckedscreenid"+msg.d[i].ScreenId+" Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } //optionsdiv += "<div><input type='checkbox' Name='Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId + "' value='" + msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2) + "' id='" + msg.d[i].MultiplescreenOptions[Q].Choice[L].Id + "' "; if (msg.d[i].MultiplescreenOptions[Q].MaxSize > 0) { checkbox.setAttribute("onclick", "LimitOptionsSelection(this);"); } tdChoice.appendChild(checkbox); } if (msg.d[i].MultiplescreenOptions[Q].Type == "Radio Buttons" || msg.d[i].MultiplescreenOptions[Q].Type == "CheckBoxes") { if (msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceImageURL != null && msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceImageURL != "") { var lblChoiceimg = document.createElement("label"); setAttributes(lblChoiceimg, { "class": "Choicetdimg","title": msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceName, "for": msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "style": "cursor:pointer;" }); lblChoiceimg.innerHTML = "<img class='choiceimage', alt='Choice Image', id='Choiceimg" + msg.d[i].MultiplescreenOptions[Q].Choice[L].Id + "', title='" + msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceImageURL + "' , src='" + msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceImageURL + "' />"; setAttributes(lblChoice, { "style": "float:left" }); tdChoice.appendChild(lblChoiceimg); } } tdChoice.appendChild(lblChoice); trChoice.appendChild(tdChoice); if (UrlType != "DineIn") { if (msg.d[i].MultiplescreenOptions[Q].OptionQuantity == true) { var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Choicetd", "align": "left" }); var txtQuantity = document.createElement("input"); setAttributes(txtQuantity, { "id": "Quantity" + msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "type": "text", "class": "ChoicesQuantity", "disabled": "disabled", "onchange": "gettotalprice()", "MaxLength": "4" }); tdQuantity.appendChild(txtQuantity); trChoice.appendChild(tdQuantity); } if (msg.d[i].MultiplescreenOptions[Q].ChoicesQuantity == true) { if (msg.d[i].MultiplescreenOptions[Q].ChoicesSelection > 0) { var tdddlQuantity = document.createElement("td"); setAttributes(tdddlQuantity, { "class": "Choicetd", "align": "left" }); var ddlQuantity = document.createElement("select"); setAttributes(ddlQuantity, { "id": "ddlQuantity" + msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "style": "display:none;", "class": "ChoicesQuantity", "onchange": "gettotalprice()", "MaxLength": "4" }); for (var A = 1; A <= msg.d[i].MultiplescreenOptions[Q].ChoicesSelection; A++) { ddlQuantity.options.add(new Option(A, A)); } tdddlQuantity.appendChild(ddlQuantity); trChoice.appendChild(tdddlQuantity); } } } if (UrlType != "DineIn") { if (msg.d[i].MultiplescreenOptions[Q].FreeOptions > 0) { if (AddRow == "" && Choice.Price > 0) { var trChoiceFreeOptions = document.createElement("tr"); var tdChoiceFreeOptions = document.createElement("td"); var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "color:red;padding-left:5px;font-weight: bold;font-size: 14px;", "id": "ItemOptionSelectionMin" + msg.d[i].MultiplescreenOptions[Q].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "Select " + msg.d[i].MultiplescreenOptions[Q].OptionName + " for additional pricing"; tdChoiceFreeOptions.appendChild(lblOptionSelection); trChoiceFreeOptions.appendChild(tdChoiceFreeOptions); tableOption1.appendChild(trChoiceFreeOptions); AddRow = "Exist"; } } } tableOption1.appendChild(trChoice); if (msg.d[i].MultiplescreenOptions[Q].Choice[L].Exist == true) { var childExist = document.createElement("img"); setAttributes(childExist, { "src": "images/childExpand.png", "style": "width: 15px;vertical-align: top; margin-left: 4px;", "alt": "Expand" }); lblChoice.appendChild(childExist); var childExisttr = document.createElement("tr"); setAttributes(childExisttr, { "id": "childOption" + msg.d[i].MultiplescreenOptions[Q].Choice[L].Id }); setAttributes(childExisttr, { "class": "Collapserow" + msg.d[i].MultiplescreenOptions[Q].OptionId }); tableOption1.appendChild(childExisttr); } } Options.push(option); } else if (msg.d[i].MultiplescreenOptions[Q].Type == "Dropdown") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); setAttributes(trChoice, { "class": "dropdowncs" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var ddlOption = document.createElement("select"); //ddlOption.options.add(new Option("Select One", "")); setAttributes(ddlOption, { "style": "width: auto;height: 25px;margin-top:10px;max-width:60%", "id": msg.d[i].MultiplescreenOptions[Q].OptionId, "class": "ddlOption Validate", "onchange": "gettotalprice()" }); for (var S = 0; S < msg.d[i].MultiplescreenOptions[Q].Choice.length; S++) { var Choice = new Object; Choice.Id = msg.d[i].MultiplescreenOptions[Q].Choice[S].Id; Choice.Name = msg.d[i].MultiplescreenOptions[Q].Choice[S].ChoiceName; Choice.Notify = msg.d[i].MultiplescreenOptions[Q].Choice[S].Notify; Choice.DefaultVSOption = msg.d[i].MultiplescreenOptions[Q].Choice[S].DefaultVSOption; Choice.Active = msg.d[i].MultiplescreenOptions[Q].Choice[S].Active; Choice.Price = msg.d[i].MultiplescreenOptions[Q].Choice[S].Price.toFixed(2); Choice.Exist = msg.d[i].MultiplescreenOptions[Q].Choice[S].Exist; option.Choices.push(Choice); ddlOption.options.add(new Option(msg.d[i].MultiplescreenOptions[Q].Choice[S].ChoiceName + " " + document.getElementById("lblCurrency").innerHTML + msg.d[i].MultiplescreenOptions[Q].Choice[S].Price, msg.d[i].MultiplescreenOptions[Q].Choice[S].Id)); } tdChoice.appendChild(ddlOption); trChoice.appendChild(tdChoice); tableOption1.appendChild(trChoice); Options.push(option); if (msg.d[i].MultiplescreenOptions[Q].Choice.length > 0) { lblrequired.innerHTML += "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; } } else if (msg.d[i].MultiplescreenOptions[Q].Type == "Flow Buttons") { var AddRow = ""; for (A = 0; A < msg.d[i].MultiplescreenOptions[Q].Choice.length; A++) { var Choice = new Object; Choice.Id = msg.d[i].MultiplescreenOptions[Q].Choice[A].Id; Choice.Name = msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName; Choice.Notify = msg.d[i].MultiplescreenOptions[Q].Choice[A].Notify; Choice.DefaultVSOption = msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption; Choice.Active = msg.d[i].MultiplescreenOptions[Q].Choice[A].Active; Choice.Price = msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2); Choice.Exist = msg.d[i].MultiplescreenOptions[Q].Choice[A].Exist; Choice.FreeOptions = "No"; Choice.SelectionCount = 0; option.Choices.push(Choice); var trChoice = document.createElement("tr"); setAttributes(trChoice, { "class": "Collapserow" + msg.d[i].MultiplescreenOptions[Q].OptionId + " optionname flowbuttons", "style": "color:" + OptionTextColor, "id": msg.d[i].MultiplescreenOptions[Q].OptionId, "name": "flowbuttons" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "class": "Choicetd", "align": "left", "id": "ScreenId" + msg.d[i].ScreenId }); var lblChoice = document.createElement("label"); lblChoice.innerHTML += msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName; if (document.getElementById('lblLId').value == "305f3f06-fbb4-437e-8090-db6046a96a7f" || document.getElementById('lblLId').value == "e9354e34-c551-43e2-adda-763bdc86b771") { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].Active == true) { setAttributes(lblChoice, { "title": msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName, "for": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "style": ButtonColor, "class": "flowoptbtns" }); } else { setAttributes(lblChoice, { "title": msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName, "for": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "style": "background: -webkit-gradient(linear,left top,left bottom,color-stop(0.05,lightgrey),color-stop(1,lightgrey)) !important;border: 1px solid lightgrey !important;-webkit-box-shadow: 0 0 2px 0 lightgrey !important;'" + ButtonColor + "'", "class": "flowoptbtns" }); } } else { setAttributes(lblChoice, { "title": msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName, "for": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "style": ButtonColor, "class": "flowoptbtns" }); } var choicelabel = "<label titel='" + msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName + "' for='" + msg.d[i].MultiplescreenOptions[Q].Choice[A].Id + "' style='cursor:pointer'>" + msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName + "</label>"; if (UrlType == "DineIn") { setAttributes(lblChoice, { "style": "background:none;" }); } var Price = 0; if (msg.d[i].MultiplescreenOptions[Q].Choice[A].Price != Price.toFixed(2)) { lblChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2) + ")"; choicelabel += "<label>" + document.getElementById("lblCurrency").innerHTML + msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2) + "</label>"; } if (msg.d[i].MultiplescreenOptions[Q].Type == "Flow Buttons") { lblrequired.innerHTML = "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; var radio = document.createElement("input"); if (document.getElementById('lblLId').value == "305f3f06-fbb4-437e-8090-db6046a96a7f" || document.getElementById('lblLId').value == "e9354e34-c551-43e2-adda-763bdc86b771") { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].Active == true) { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].Exist == true) { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate","Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } else { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } } else { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].Exist == true) { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } else { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } } } else { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].Exist == true) { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } else { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate","Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } } tdChoice.appendChild(radio); } if (msg.d[i].MultiplescreenOptions[Q].Type == "CheckBoxes") { if (lblrequired.innerHTML.indexOf("Required") != -1) { } else lblrequired.innerHTML = "<span style='float:right;color:green;padding-left:10px;' class='optionalimg'>(Opt)</span>"; var checkbox = document.createElement("input"); if (msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption == true) { setAttributes(checkbox, { "type": "checkbox", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(checkbox, { "type": "checkbox", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } //optionsdiv += "<div><input type='checkbox' Name='Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId + "' value='" + msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2) + "' id='" + msg.d[i].MultiplescreenOptions[Q].Choice[A].Id + "' "; if (msg.d[i].MultiplescreenOptions[Q].MaxSize > 0) { checkbox.setAttribute("onclick", "LimitOptionsSelection(this);"); } tdChoice.appendChild(checkbox); } if (msg.d[i].MultiplescreenOptions[Q].Type != "Flow Buttons") { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceImageURL != null && msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceImageURL != "") { var lblChoiceimg = document.createElement("label"); setAttributes(lblChoiceimg, { "class": "Choicetdimg", "title": msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName, "for": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "style": "cursor:pointer;" }); lblChoiceimg.innerHTML = "<img class='choiceimage', alt='Choice Image', id='Choiceimg" + msg.d[i].MultiplescreenOptions[Q].Choice[A].Id + "', title='" + msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceImageURL + "' , src='" + msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceImageURL + "' />"; setAttributes(lblChoice, { "style": "float:left" }); tdChoice.appendChild(lblChoiceimg); } } tdChoice.appendChild(lblChoice); trChoice.appendChild(tdChoice); tableOption1.appendChild(trChoice); if (msg.d[i].MultiplescreenOptions[Q].Choice[A].Exist == true) { if (msg.d[i].MultiplescreenOptions[Q].Type != "Flow Buttons") { var childExist = document.createElement("img"); setAttributes(childExist, { "src": "images/childExpand.png", "style": "width: 15px;vertical-align: top; margin-left: 4px;", "alt": "Expand" }); lblChoice.appendChild(childExist); } var childExisttr = document.createElement("tr"); setAttributes(childExisttr, { "id": "childOption" + msg.d[i].MultiplescreenOptions[Q].Choice[A].Id }); setAttributes(childExisttr, { "class": "Collapserow" + msg.d[i].MultiplescreenOptions[Q].OptionId }); tableOption1.appendChild(childExisttr); } } Options.push(option); } if (UrlType != "DineIn") { if (msg.d[i].MultiplescreenOptions[Q].Type == "Multiline Textbox") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var textbox = document.createElement("textarea"); setAttributes(textbox, { "class": "Choicetext", "id": msg.d[i].MultiplescreenOptions[Q].OptionId }); tdChoice.appendChild(textbox); trChoice.appendChild(tdChoice); tableOption1.appendChild(trChoice); Options.push(option); } } tdScreen.appendChild(tableOption1); trScreen.appendChild(tdScreen); document.getElementById('OptionTable').appendChild(trScreen); if (msg.d[i].MultiplescreenOptions[Q].Type == "CheckBoxes" || msg.d[i].MultiplescreenOptions[Q].Type == "Radio Buttons") { if (msg.d[i].MultiplescreenOptions[Q].Collapse == true) { $(".Collapserow" + msg.d[i].MultiplescreenOptions[Q].OptionId).css("display", "none"); $("#Collapseimg" + msg.d[i].MultiplescreenOptions[Q].OptionId).attr('src', 'https://orderem.com/images/Sortdown.png') } else { $("#Collapseimg" + msg.d[i].MultiplescreenOptions[Q].OptionId).attr('src', 'https://orderem.com/images/Sortup.png');; } } else { $("#Collapseimg" + msg.d[i].MultiplescreenOptions[Q].OptionId).remove(); } } } } localStorage.setItem("OptionCheck", JSON.stringify(Options)); $(".optcheckedscreenid"+msg.d[i].ScreenId).each(function () { if($(".optcheckedscreenid"+msg.d[i].ScreenId).length > 0) { $(".optcheckedscreenid"+msg.d[i].ScreenId).addClass("Validate"); if($(this).attr("checked")) { var itemlist = $(this); LimitOptionsSelection(itemlist[0]); } } }); $(".optcheckedscreenid"+msg.d[i].ScreenId).each(function () { if($(".optcheckedscreenid"+msg.d[i].ScreenId).length > 0) { $(".optcheckedscreenid"+msg.d[i].ScreenId).addClass("Validate"); if($(this).attr("checked")) { var itemlist = $(this); BindForParentRadio(itemlist[0]); } } }); } else { document.getElementById('OptionTable').style.display = "block"; document.getElementById('PreviewOptionTable').style.display = "none"; var trScreen = document.createElement("tr"); trScreen.setAttribute("Id", "ScreenId" + msg.d[i].ScreenId); trScreen.setAttribute("class", "OptionScreens"); trScreen.setAttribute("style", "display:none;"); var tdScreen = document.createElement("td"); var tableOption = document.createElement("table"); tableOption.setAttribute("class", "optionrow"); tableOption.setAttribute("style", optionColor); var trOption = document.createElement("tr"); trOption.setAttribute("style", "font-weight:bold;"); var tdOption = document.createElement("td"); setAttributes(tdOption, { "class": "Optiontd", "colspan": "3" }); var lblOption = document.createElement("span"); lblOption.innerHTML += msg.d[i].OptionName; lblOption.setAttribute("id", "ItemOption" + msg.d[i].OptionId); lblOption.setAttribute("style", "float:left;"); var lblrequired = document.createElement("span"); lblrequired.setAttribute("style", "float:left;"); tdOption.appendChild(lblOption); tdOption.appendChild(lblrequired); var Collapseimg = document.createElement("span"); Collapseimg.setAttribute("style", "float:left;"); Collapseimg.innerHTML = "<span class='Collapseimg'> <img src='' alt='Collapse' id='Collapseimg" + msg.d[i].OptionId + "' onclick='OverrideCollapse(this)'/> </span>"; tdOption.appendChild(Collapseimg); if (msg.d[i].Type == "CheckBoxes") { if (msg.d[i].MaxSize > 0) { if (msg.d[i].MaxSize != 100 && msg.d[i].MaxSize != msg.d[i].Choice.length) { var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "padding-left:5px;color:red;font-size: 14px;display:none;" + OptionTextColor, "id": "ItemOptionSelection" + msg.d[i].OptionId }); lblOptionSelection.innerHTML += "(Max Selection: " + msg.d[i].MaxSize + ")"; tdOption.appendChild(lblOptionSelection); lblrequired.innerHTML = "<span style='float:right;color:Green;padding-left:10px;' class='optionalimg'>(Opt)</span>"; } } if (msg.d[i].MinSize > 0) { if (msg.d[i].MinSize != 100) { if (document.getElementById("choiceselect").innerHTML == "") { document.getElementById("choiceselect").innerHTML = msg.d[i].OptionId; } else { document.getElementById("choiceselect").innerHTML = document.getElementById("choiceselect").innerHTML + "," + msg.d[i].OptionId } var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "padding-left:5px;color:red;font-size: 14px;" + OptionTextColor, "id": "ItemOptionSelectionMin" + msg.d[i].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "(Min Selection: " + msg.d[i].MinSize + ")"; tdOption.appendChild(lblOptionSelection); lblrequired.innerHTML = "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; } } if (UrlType != "DineIn") { if (msg.d[i].FreeOptions > 0) { var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "color:red;padding-left:5px;font-size: 14px;", "id": "ItemOptionSelectionMin" + msg.d[i].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "Select " + msg.d[i].OptionName + " with no cost(you have " + msg.d[i].FreeOptions + " free options)"; tdOption.appendChild(lblOptionSelection); } } } trOption.appendChild(tdOption); tableOption.appendChild(trOption); if (msg.d[i].OptionQuantity == true) { var trQuantity = document.createElement("tr"); trQuantity.setAttribute("style", "font-weight:bold;"); var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Optiontd", "colspan": "3", "style": "padding:0 25px;height:auto;border:none" }); var lblQuantity = document.createElement("span"); lblQuantity.setAttribute("style", "font-size:14px;color:red"); lblQuantity.innerHTML += "Please select " + msg.d[i].QuantitySelection + " by quantity"; tdQuantity.appendChild(lblQuantity); trQuantity.appendChild(tdQuantity); tableOption.appendChild(trQuantity); } var option = new Object; option.Type = msg.d[i].Type; option.ItemId = ItemId; option.Id = msg.d[i].OptionId; option.MinSize = msg.d[i].MinSize; option.MaxSize = msg.d[i].MaxSize; option.FreeOptions = msg.d[i].FreeOptions; option.Name = msg.d[i].OptionName; option.OptionQuantity = msg.d[i].OptionQuantity; option.QuantitySelection = msg.d[i].QuantitySelection; option.Collapse = msg.d[i].Collapse; option.DefaultOptionText = msg.d[i].DefaultOptionText; option.Chargable = msg.d[i].Chargable; option.PosId = msg.d[i].PosId; option.Choices = new Array(); if (msg.d[i].Type == "Radio Buttons" || msg.d[i].Type == "CheckBoxes") { if (msg.d[i].FreeOptions > 0) { msg.d[i].Choice.sort(function (a, b) { return parseFloat(a.Price) - parseFloat(b.Price); }); } var AddRow = ""; for (L = 0; L < msg.d[i].Choice.length; L++) { var Choice = new Object; Choice.Id = msg.d[i].Choice[L].Id; Choice.Name = msg.d[i].Choice[L].ChoiceName; Choice.Notify = msg.d[i].Choice[L].Notify; Choice.DefaultVSOption = msg.d[i].Choice[L].DefaultVSOption; Choice.Active = msg.d[i].Choice[L].Active; Choice.Price = msg.d[i].Choice[L].Price.toFixed(2); Choice.Exist = msg.d[i].Choice[L].Exist; Choice.FreeOptions = "No"; Choice.SelectionCount = 0; option.Choices.push(Choice); var trChoice = document.createElement("tr"); setAttributes(trChoice, { "class": "Collapserow" + msg.d[i].OptionId + " optionname", "style": "color:" + OptionTextColor, "id": msg.d[i].OptionId }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "class": "Choicetd", "align": "left" }); var lblChoice = document.createElement("label"); lblChoice.innerHTML += msg.d[i].Choice[L].ChoiceName; setAttributes(lblChoice, { "title": msg.d[i].Choice[L].ChoiceName, "for": msg.d[i].Choice[L].Id, "style": "cursor:pointer;" }); var choicelabel = "<label titel='" + msg.d[i].Choice[L].ChoiceName + "' for='" + msg.d[i].Choice[L].Id + "' style='cursor:pointer'>" + msg.d[i].Choice[L].ChoiceName + "</label>"; if (UrlType == "DineIn") { setAttributes(lblChoice, { "style": "background:none;" }); } var Price = 0; if (msg.d[i].Choice[L].Price != Price.toFixed(2)) { lblChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + msg.d[i].Choice[L].Price.toFixed(2) + ")"; choicelabel += "<label>" + document.getElementById("lblCurrency").innerHTML + msg.d[i].Choice[L].Price.toFixed(2) + "</label>"; } if (msg.d[i].Type == "Radio Buttons") { lblrequired.innerHTML = "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; var radio = document.createElement("input"); if (msg.d[i].Choice[L].DefaultVSOption == true) { setAttributes(radio, { "type": "radio","class":"optcheckedscreenid"+msg.d[i].ScreenId+"","checked": "true", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[L].Price.toFixed(2), "id": msg.d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(radio, { "type": "radio","class":"optcheckedscreenid"+msg.d[i].ScreenId+"", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[L].Price.toFixed(2), "id": msg.d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } tdChoice.appendChild(radio); } if (msg.d[i].Type == "CheckBoxes") { if (lblrequired.innerHTML.indexOf("Required") != -1) { } else lblrequired.innerHTML = "<span style='float:right;color:green;padding-left:10px;' class='optionalimg'>(Opt)</span>"; var checkbox = document.createElement("input"); if (msg.d[i].Choice[L].DefaultVSOption == true) { setAttributes(checkbox, { "type": "checkbox","class":"optcheckedscreenid"+msg.d[i].ScreenId+"","checked": "true", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[L].Price.toFixed(2), "id": msg.d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(checkbox, { "type": "checkbox","class":"optcheckedscreenid"+msg.d[i].ScreenId+"", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[L].Price.toFixed(2), "id": msg.d[i].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } //optionsdiv += "<div><input type='checkbox' Name='Choiceradio" + msg.d[i].OptionId + "' value='" + msg.d[i].Choice[L].Price.toFixed(2) + "' id='" + msg.d[i].Choice[L].Id + "' "; if (msg.d[i].MaxSize > 0) { checkbox.setAttribute("onclick", "LimitOptionsSelection(this);"); } tdChoice.appendChild(checkbox); } if (msg.d[i].Type == "Radio Buttons" || msg.d[i].Type == "CheckBoxes") { if (msg.d[i].Choice[L].ChoiceImageURL != null && msg.d[i].Choice[L].ChoiceImageURL != "") { var lblChoiceimg = document.createElement("label"); setAttributes(lblChoiceimg, { "class": "Choicetdimg","title": msg.d[i].Choice[L].ChoiceName, "for": msg.d[i].Choice[L].Id, "style": "cursor:pointer;" }); lblChoiceimg.innerHTML = "<img class='choiceimage', alt='Choice Image', id='Choiceimg" + msg.d[i].Choice[L].Id + "', title='" + msg.d[i].Choice[L].ChoiceImageURL + "' , src='" + msg.d[i].Choice[L].ChoiceImageURL + "' />"; setAttributes(lblChoice, { "style": "float:left" }); tdChoice.appendChild(lblChoiceimg); } } tdChoice.appendChild(lblChoice); trChoice.appendChild(tdChoice); if (UrlType != "DineIn") { if (msg.d[i].OptionQuantity == true) { var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Choicetd", "align": "left" }); var txtQuantity = document.createElement("input"); setAttributes(txtQuantity, { "id": "Quantity" + msg.d[i].Choice[L].Id, "type": "text", "class": "ChoicesQuantity", "disabled": "disabled", "onchange": "gettotalprice()", "MaxLength": "4" }); tdQuantity.appendChild(txtQuantity); trChoice.appendChild(tdQuantity); } if (msg.d[i].ChoicesQuantity == true) { if (msg.d[i].ChoicesSelection > 0) { var tdddlQuantity = document.createElement("td"); setAttributes(tdddlQuantity, { "class": "Choicetd", "align": "left" }); var ddlQuantity = document.createElement("select"); setAttributes(ddlQuantity, { "id": "ddlQuantity" + msg.d[i].Choice[L].Id, "style": "display:none;", "class": "ChoicesQuantity", "onchange": "gettotalprice()", "MaxLength": "4" }); for (var Q = 1; Q <= msg.d[i].ChoicesSelection; Q++) { ddlQuantity.options.add(new Option(Q, Q)); } tdddlQuantity.appendChild(ddlQuantity); trChoice.appendChild(tdddlQuantity); } } } if (UrlType != "DineIn") { if (msg.d[i].FreeOptions > 0) { if (AddRow == "" && Choice.Price > 0) { var trChoiceFreeOptions = document.createElement("tr"); var tdChoiceFreeOptions = document.createElement("td"); var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "color:red;padding-left:5px;font-weight: bold;font-size: 14px;", "id": "ItemOptionSelectionMin" + msg.d[i].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "Select " + msg.d[i].OptionName + " for additional pricing"; tdChoiceFreeOptions.appendChild(lblOptionSelection); trChoiceFreeOptions.appendChild(tdChoiceFreeOptions); tableOption.appendChild(trChoiceFreeOptions); AddRow = "Exist"; } } } tableOption.appendChild(trChoice); if (msg.d[i].Choice[L].Exist == true) { var childExist = document.createElement("img"); setAttributes(childExist, { "src": "images/childExpand.png", "style": "width: 15px;vertical-align: top; margin-left: 4px;", "alt": "Expand" }); lblChoice.appendChild(childExist); var childExisttr = document.createElement("tr"); setAttributes(childExisttr, { "id": "childOption" + msg.d[i].Choice[L].Id }); setAttributes(childExisttr, { "class": "Collapserow" + msg.d[i].OptionId }); tableOption.appendChild(childExisttr); } } Options.push(option); } else if (msg.d[i].Type == "Dropdown") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); setAttributes(trChoice, { "class": "dropdowncs" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var ddlOption = document.createElement("select"); //ddlOption.options.add(new Option("Select One", "")); setAttributes(ddlOption, { "style": "width: auto;height: 25px;margin-top:10px;max-width:60%", "id": msg.d[i].OptionId, "class": "ddlOption ddlOptionscreen" + msg.d[i].ScreenId + "", "onchange": "gettotalprice()" }); for (var S = 0; S < msg.d[i].Choice.length; S++) { var Choice = new Object; Choice.Id = msg.d[i].Choice[S].Id; Choice.Name = msg.d[i].Choice[S].ChoiceName; Choice.Notify = msg.d[i].Choice[S].Notify; Choice.DefaultVSOption = msg.d[i].Choice[S].DefaultVSOption; Choice.Active = msg.d[i].Choice[S].Active; Choice.Price = msg.d[i].Choice[S].Price.toFixed(2); Choice.Exist = msg.d[i].Choice[S].Exist; option.Choices.push(Choice); ddlOption.options.add(new Option(msg.d[i].Choice[S].ChoiceName + " " + document.getElementById("lblCurrency").innerHTML + msg.d[i].Choice[S].Price, msg.d[i].Choice[S].Id)); } tdChoice.appendChild(ddlOption); trChoice.appendChild(tdChoice); tableOption.appendChild(trChoice); Options.push(option); if (msg.d[i].Choice.length > 0) { lblrequired.innerHTML += "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; } } else if (msg.d[i].Type == "Flow Buttons") { var AddRow = ""; for (F = 0; F < msg.d[i].Choice.length; F++) { var Choice = new Object; Choice.Id = msg.d[i].Choice[F].Id; Choice.Name = msg.d[i].Choice[F].ChoiceName; Choice.Notify = msg.d[i].Choice[F].Notify; Choice.DefaultVSOption = msg.d[i].Choice[F].DefaultVSOption; Choice.Active = msg.d[i].Choice[F].Active; Choice.Price = msg.d[i].Choice[F].Price.toFixed(2); Choice.Exist = msg.d[i].Choice[F].Exist; Choice.FreeOptions = "No"; Choice.SelectionCount = 0; option.Choices.push(Choice); var trChoice = document.createElement("tr"); setAttributes(trChoice, { "class": "Collapserow" + msg.d[i].OptionId + " optionname flowbuttons", "style": "color:" + OptionTextColor, "id": msg.d[i].OptionId, "name": "flowbuttons" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "class": "Choicetd", "align": "left", "id": "ScreenId" + msg.d[i].ScreenId }); var lblChoice = document.createElement("label"); lblChoice.innerHTML += msg.d[i].Choice[F].ChoiceName; if (document.getElementById('lblLId').value == "305f3f06-fbb4-437e-8090-db6046a96a7f" || document.getElementById('lblLId').value == "e9354e34-c551-43e2-adda-763bdc86b771") { if (msg.d[i].Choice[F].Active == true) { setAttributes(lblChoice, { "title": msg.d[i].Choice[F].ChoiceName, "for": msg.d[i].Choice[F].Id, "style": ButtonColor, "class": "flowoptbtns" }); } else { setAttributes(lblChoice, { "title": msg.d[i].Choice[F].ChoiceName, "for": msg.d[i].Choice[F].Id, "style": "background: -webkit-gradient(linear,left top,left bottom,color-stop(0.05,lightgrey),color-stop(1,lightgrey)) !important;border: 1px solid lightgrey !important;-webkit-box-shadow: 0 0 2px 0 lightgrey !important;'" + ButtonColor + "'", "class": "flowoptbtns" }); } } else { setAttributes(lblChoice, { "title": msg.d[i].Choice[F].ChoiceName, "for": msg.d[i].Choice[F].Id, "style": ButtonColor, "class": "flowoptbtns" }); } var choicelabel = "<label titel='" + msg.d[i].Choice[F].ChoiceName + "' for='" + msg.d[i].Choice[F].Id + "' style='cursor:pointer'>" + msg.d[i].Choice[F].ChoiceName + "</label>"; if (UrlType == "DineIn") { setAttributes(lblChoice, { "style": "background:none;" }); } var Price = 0; if (msg.d[i].Choice[F].Price != Price.toFixed(2)) { lblChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + msg.d[i].Choice[F].Price.toFixed(2) + ")"; choicelabel += "<label>" + document.getElementById("lblCurrency").innerHTML + msg.d[i].Choice[F].Price.toFixed(2) + "</label>"; } if (msg.d[i].Type == "Flow Buttons") { lblrequired.innerHTML = "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; var radio = document.createElement("input"); if (document.getElementById('lblLId').value == "305f3f06-fbb4-437e-8090-db6046a96a7f" || document.getElementById('lblLId').value == "e9354e34-c551-43e2-adda-763bdc86b771") { if (msg.d[i].Choice[F].Active == true) { if (msg.d[i].Choice[F].Exist == true) { if (msg.d[i].Choice[F].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } else { if (msg.d[i].Choice[F].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } } else { if (msg.d[i].Choice[F].Exist == true) { if (msg.d[i].Choice[F].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } else { if (msg.d[i].Choice[F].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } } } else { if (msg.d[i].Choice[F].Exist == true) { if (msg.d[i].Choice[F].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } else { if (msg.d[i].Choice[F].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } } tdChoice.appendChild(radio); } if (msg.d[i].Type == "CheckBoxes") { if (lblrequired.innerHTML.indexOf("Required") != -1) { } else lblrequired.innerHTML = "<span style='float:right;color:green;padding-left:10px;' class='optionalimg'>(Opt)</span>"; var checkbox = document.createElement("input"); if (msg.d[i].Choice[F].DefaultVSOption == true) { setAttributes(checkbox, { "type": "checkbox", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(checkbox, { "type": "checkbox", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].OptionId, "value": msg.d[i].Choice[F].Price.toFixed(2), "id": msg.d[i].Choice[F].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } //optionsdiv += "<div><input type='checkbox' Name='Choiceradio" + msg.d[i].OptionId + "' value='" + msg.d[i].Choice[F].Price.toFixed(2) + "' id='" + msg.d[i].Choice[F].Id + "' "; if (msg.d[i].MaxSize > 0) { checkbox.setAttribute("onclick", "LimitOptionsSelection(this);"); } tdChoice.appendChild(checkbox); } if (msg.d[i].Type != "Flow Buttons") { if (msg.d[i].Choice[F].ChoiceImageURL != null && msg.d[i].Choice[F].ChoiceImageURL != "") { var lblChoiceimg = document.createElement("label"); setAttributes(lblChoiceimg, { "class": "Choicetdimg", "title": msg.d[i].Choice[F].ChoiceName, "for": msg.d[i].Choice[F].Id, "style": "cursor:pointer;" }); lblChoiceimg.innerHTML = "<img class='choiceimage', alt='Choice Image', id='Choiceimg" + msg.d[i].Choice[F].Id + "', title='" + msg.d[i].Choice[F].ChoiceImageURL + "' , src='" + msg.d[i].Choice[F].ChoiceImageURL + "' />"; setAttributes(lblChoice, { "style": "float:left" }); tdChoice.appendChild(lblChoiceimg); } } tdChoice.appendChild(lblChoice); trChoice.appendChild(tdChoice); tableOption.appendChild(trChoice); if (msg.d[i].Choice[F].Exist == true) { if (msg.d[i].Type != "Flow Buttons") { var childExist = document.createElement("img"); setAttributes(childExist, { "src": "images/childExpand.png", "style": "width: 15px;vertical-align: top; margin-left: 4px;", "alt": "Expand" }); lblChoice.appendChild(childExist); } var childExisttr = document.createElement("tr"); setAttributes(childExisttr, { "id": "childOption" + msg.d[i].Choice[F].Id }); setAttributes(childExisttr, { "class": "Collapserow" + msg.d[i].OptionId }); tableOption.appendChild(childExisttr); } } Options.push(option); } if (UrlType != "DineIn") { if (msg.d[i].Type == "Multiline Textbox") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var textbox = document.createElement("textarea"); setAttributes(textbox, { "class": "Choicetext", "id": msg.d[i].OptionId }); tdChoice.appendChild(textbox); trChoice.appendChild(tdChoice); tableOption.appendChild(trChoice); Options.push(option); } } tdScreen.appendChild(tableOption); trScreen.appendChild(tdScreen); document.getElementById('OptionTable').appendChild(trScreen); if (msg.d[i].Type == "CheckBoxes" || msg.d[i].Type == "Radio Buttons") { if (msg.d[i].Collapse == true) { $(".Collapserow" + msg.d[i].OptionId).css("display", "none"); $("#Collapseimg" + msg.d[i].OptionId).attr('src', 'https://orderem.com/images/Sortdown.png') } else { $("#Collapseimg" + msg.d[i].OptionId).attr('src', 'https://orderem.com/images/Sortup.png');; } } else { $("#Collapseimg" + msg.d[i].OptionId).remove(); } if (msg.d[i].MultiplescreenOptions.length > 0) { for (var Q = 0; Q < msg.d[i].MultiplescreenOptions.length; Q++) { var tableOption1 = document.createElement("table"); tableOption1.setAttribute("class", "optionrow"); tableOption1.setAttribute("style", optionColor); var trOption1 = document.createElement("tr"); trOption1.setAttribute("style", "font-weight:bold;"); var tdOption1 = document.createElement("td"); setAttributes(tdOption1, { "class": "Optiontd", "colspan": "3" }); var lblOption = document.createElement("span"); lblOption.innerHTML += msg.d[i].MultiplescreenOptions[Q].OptionName; lblOption.setAttribute("id", "ItemOption" + msg.d[i].MultiplescreenOptions[Q].OptionId); lblOption.setAttribute("style", "float:left;"); var lblrequired = document.createElement("span"); lblrequired.setAttribute("style", "float:left;"); tdOption1.appendChild(lblOption); tdOption1.appendChild(lblrequired); var Collapseimg = document.createElement("span"); Collapseimg.setAttribute("style", "float:left;"); Collapseimg.innerHTML = "<span class='Collapseimg'> <img src='' alt='Collapse' id='Collapseimg" + msg.d[i].MultiplescreenOptions[Q].OptionId + "' onclick='OverrideCollapse(this)'/> </span>"; tdOption1.appendChild(Collapseimg); if (msg.d[i].MultiplescreenOptions[Q].Type == "CheckBoxes") { if (msg.d[i].MultiplescreenOptions[Q].MaxSize > 0) { if (msg.d[i].MultiplescreenOptions[Q].MaxSize != 100 && msg.d[i].MultiplescreenOptions[Q].MaxSize != msg.d[i].MultiplescreenOptions[Q].Choice.length) { var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "padding-left:5px;color:red;font-size: 14px;display:none;" + OptionTextColor, "id": "ItemOptionSelection" + msg.d[i].MultiplescreenOptions[Q].OptionId }); lblOptionSelection.innerHTML += "(Max Selection: " + msg.d[i].MultiplescreenOptions[Q].MaxSize + ")"; tdOption1.appendChild(lblOptionSelection); lblrequired.innerHTML = "<span style='float:right;color:Green;padding-left:10px;' class='optionalimg'>(Opt)</span>"; } } if (msg.d[i].MultiplescreenOptions[Q].MinSize > 0) { if (msg.d[i].MultiplescreenOptions[Q].MinSize != 100) { if (document.getElementById("choiceselect").innerHTML == "") { document.getElementById("choiceselect").innerHTML = msg.d[i].MultiplescreenOptions[Q].OptionId; } else { document.getElementById("choiceselect").innerHTML = document.getElementById("choiceselect").innerHTML + "," + msg.d[i].MultiplescreenOptions[Q].OptionId } var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "padding-left:5px;color:red;font-size: 14px;" + OptionTextColor, "id": "ItemOptionSelectionMin" + msg.d[i].MultiplescreenOptions[Q].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "(Min Selection: " + msg.d[i].MultiplescreenOptions[Q].MinSize + ")"; tdOption1.appendChild(lblOptionSelection); lblrequired.innerHTML = "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; } } if (UrlType != "DineIn") { if (msg.d[i].MultiplescreenOptions[Q].FreeOptions > 0) { var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "color:red;padding-left:5px;font-size: 14px;", "id": "ItemOptionSelectionMin" + msg.d[i].MultiplescreenOptions[Q].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "Select " + msg.d[i].MultiplescreenOptions[Q].OptionName + " with no cost(you have " + msg.d[i].MultiplescreenOptions[Q].FreeOptions + " free options)"; tdOption1.appendChild(lblOptionSelection); } } } trOption1.appendChild(tdOption1); tableOption1.appendChild(trOption1); if (msg.d[i].MultiplescreenOptions[Q].OptionQuantity == true) { var trQuantity = document.createElement("tr"); trQuantity.setAttribute("style", "font-weight:bold;"); var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Optiontd", "colspan": "3", "style": "padding:0 25px;height:auto;border:none" }); var lblQuantity = document.createElement("span"); lblQuantity.setAttribute("style", "font-size:14px;color:red"); lblQuantity.innerHTML += "Please select " + msg.d[i].MultiplescreenOptions[Q].QuantitySelection + " by quantity"; tdQuantity.appendChild(lblQuantity); trQuantity.appendChild(tdQuantity); tableOption1.appendChild(trQuantity); } var option = new Object; option.Type = msg.d[i].MultiplescreenOptions[Q].Type; option.ItemId = ItemId; option.Id = msg.d[i].MultiplescreenOptions[Q].OptionId; option.MinSize = msg.d[i].MultiplescreenOptions[Q].MinSize; option.MaxSize = msg.d[i].MultiplescreenOptions[Q].MaxSize; option.FreeOptions = msg.d[i].MultiplescreenOptions[Q].FreeOptions; option.Name = msg.d[i].MultiplescreenOptions[Q].OptionName; option.OptionQuantity = msg.d[i].MultiplescreenOptions[Q].OptionQuantity; option.QuantitySelection = msg.d[i].MultiplescreenOptions[Q].QuantitySelection; option.Collapse = msg.d[i].MultiplescreenOptions[Q].Collapse; option.DefaultOptionText = msg.d[i].MultiplescreenOptions[Q].DefaultOptionText; option.Chargable = msg.d[i].MultiplescreenOptions[Q].Chargable; option.PosId = msg.d[i].MultiplescreenOptions[Q].PosId; option.Choices = new Array(); if (msg.d[i].MultiplescreenOptions[Q].Type == "Radio Buttons" || msg.d[i].MultiplescreenOptions[Q].Type == "CheckBoxes") { if (msg.d[i].MultiplescreenOptions[Q].FreeOptions > 0) { msg.d[i].MultiplescreenOptions[Q].Choice.sort(function (a, b) { return parseFloat(a.Price) - parseFloat(b.Price); }); } var AddRow = ""; for (L = 0; L < msg.d[i].MultiplescreenOptions[Q].Choice.length; L++) { var Choice = new Object; Choice.Id = msg.d[i].MultiplescreenOptions[Q].Choice[L].Id; Choice.Name = msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceName; Choice.Notify = msg.d[i].MultiplescreenOptions[Q].Choice[L].Notify; Choice.DefaultVSOption = msg.d[i].MultiplescreenOptions[Q].Choice[L].DefaultVSOption; Choice.Active = msg.d[i].MultiplescreenOptions[Q].Choice[L].Active; Choice.Price = msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2); Choice.Exist = msg.d[i].MultiplescreenOptions[Q].Choice[L].Exist; Choice.FreeOptions = "No"; Choice.SelectionCount = 0; option.Choices.push(Choice); var trChoice = document.createElement("tr"); setAttributes(trChoice, { "class": "Collapserow" + msg.d[i].MultiplescreenOptions[Q].OptionId + " optionname", "style": "color:" + OptionTextColor, "id": msg.d[i].MultiplescreenOptions[Q].OptionId }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "class": "Choicetd", "align": "left" }); var lblChoice = document.createElement("label"); lblChoice.innerHTML += msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceName; setAttributes(lblChoice, { "title": msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceName, "for": msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "style": "cursor:pointer;" }); var choicelabel = "<label titel='" + msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceName + "' for='" + msg.d[i].MultiplescreenOptions[Q].Choice[L].Id + "' style='cursor:pointer'>" + msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceName + "</label>"; if (UrlType == "DineIn") { setAttributes(lblChoice, { "style": "background:none;" }); } var Price = 0; if (msg.d[i].MultiplescreenOptions[Q].Choice[L].Price != Price.toFixed(2)) { lblChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2) + ")"; choicelabel += "<label>" + document.getElementById("lblCurrency").innerHTML + msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2) + "</label>"; } if (msg.d[i].MultiplescreenOptions[Q].Type == "Radio Buttons") { lblrequired.innerHTML = "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; var radio = document.createElement("input"); if (msg.d[i].MultiplescreenOptions[Q].Choice[L].DefaultVSOption == true) { setAttributes(radio, { "type": "radio","class":"optcheckedscreenid"+msg.d[i].ScreenId+"","checked": "true", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(radio, { "type": "radio","class":"optcheckedscreenid"+msg.d[i].ScreenId+"", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } tdChoice.appendChild(radio); } if (msg.d[i].MultiplescreenOptions[Q].Type == "CheckBoxes") { if (lblrequired.innerHTML.indexOf("Required") != -1) { } else lblrequired.innerHTML = "<span style='float:right;color:green;padding-left:10px;' class='optionalimg'>(Opt)</span>"; var checkbox = document.createElement("input"); if (msg.d[i].MultiplescreenOptions[Q].Choice[L].DefaultVSOption == true) { setAttributes(checkbox, { "type": "checkbox","class":"optcheckedscreenid"+msg.d[i].ScreenId+"","checked": "true", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(checkbox, { "type": "checkbox","class":"optcheckedscreenid"+msg.d[i].ScreenId+"", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } //optionsdiv += "<div><input type='checkbox' Name='Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId + "' value='" + msg.d[i].MultiplescreenOptions[Q].Choice[L].Price.toFixed(2) + "' id='" + msg.d[i].MultiplescreenOptions[Q].Choice[L].Id + "' "; if (msg.d[i].MultiplescreenOptions[Q].MaxSize > 0) { checkbox.setAttribute("onclick", "LimitOptionsSelection(this);"); } tdChoice.appendChild(checkbox); } if (msg.d[i].MultiplescreenOptions[Q].Type == "Radio Buttons" || msg.d[i].MultiplescreenOptions[Q].Type == "CheckBoxes") { if (msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceImageURL != null && msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceImageURL != "") { var lblChoiceimg = document.createElement("label"); setAttributes(lblChoiceimg, { "class": "Choicetdimg","title": msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceName, "for": msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "style": "cursor:pointer;" }); lblChoiceimg.innerHTML = "<img class='choiceimage', alt='Choice Image', id='Choiceimg" + msg.d[i].MultiplescreenOptions[Q].Choice[L].Id + "', title='" + msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceImageURL + "' , src='" + msg.d[i].MultiplescreenOptions[Q].Choice[L].ChoiceImageURL + "' />"; setAttributes(lblChoice, { "style": "float:left" }); tdChoice.appendChild(lblChoiceimg); } } tdChoice.appendChild(lblChoice); trChoice.appendChild(tdChoice); if (UrlType != "DineIn") { if (msg.d[i].MultiplescreenOptions[Q].OptionQuantity == true) { var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Choicetd", "align": "left" }); var txtQuantity = document.createElement("input"); setAttributes(txtQuantity, { "id": "Quantity" + msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "type": "text", "class": "ChoicesQuantity", "disabled": "disabled", "onchange": "gettotalprice()", "MaxLength": "4" }); tdQuantity.appendChild(txtQuantity); trChoice.appendChild(tdQuantity); } if (msg.d[i].MultiplescreenOptions[Q].ChoicesQuantity == true) { if (msg.d[i].MultiplescreenOptions[Q].ChoicesSelection > 0) { var tdddlQuantity = document.createElement("td"); setAttributes(tdddlQuantity, { "class": "Choicetd", "align": "left" }); var ddlQuantity = document.createElement("select"); setAttributes(ddlQuantity, { "id": "ddlQuantity" + msg.d[i].MultiplescreenOptions[Q].Choice[L].Id, "style": "display:none;", "class": "ChoicesQuantity", "onchange": "gettotalprice()", "MaxLength": "4" }); for (var A = 1; A <= msg.d[i].MultiplescreenOptions[Q].ChoicesSelection; A++) { ddlQuantity.options.add(new Option(A, A)); } tdddlQuantity.appendChild(ddlQuantity); trChoice.appendChild(tdddlQuantity); } } } if (UrlType != "DineIn") { if (msg.d[i].MultiplescreenOptions[Q].FreeOptions > 0) { if (AddRow == "" && Choice.Price > 0) { var trChoiceFreeOptions = document.createElement("tr"); var tdChoiceFreeOptions = document.createElement("td"); var lblOptionSelection = document.createElement("span"); setAttributes(lblOptionSelection, { "style": "color:red;padding-left:5px;font-weight: bold;font-size: 14px;", "id": "ItemOptionSelectionMin" + msg.d[i].MultiplescreenOptions[Q].OptionId, "class": "ItemOptionSelectionMin" }); lblOptionSelection.innerHTML += "Select " + msg.d[i].MultiplescreenOptions[Q].OptionName + " for additional pricing"; tdChoiceFreeOptions.appendChild(lblOptionSelection); trChoiceFreeOptions.appendChild(tdChoiceFreeOptions); tableOption1.appendChild(trChoiceFreeOptions); AddRow = "Exist"; } } } tableOption1.appendChild(trChoice); if (msg.d[i].MultiplescreenOptions[Q].Choice[L].Exist == true) { var childExist = document.createElement("img"); setAttributes(childExist, { "src": "images/childExpand.png", "style": "width: 15px;vertical-align: top; margin-left: 4px;", "alt": "Expand" }); lblChoice.appendChild(childExist); var childExisttr = document.createElement("tr"); setAttributes(childExisttr, { "id": "childOption" + msg.d[i].MultiplescreenOptions[Q].Choice[L].Id }); setAttributes(childExisttr, { "class": "Collapserow" + msg.d[i].MultiplescreenOptions[Q].OptionId }); tableOption1.appendChild(childExisttr); } } Options.push(option); } else if (msg.d[i].MultiplescreenOptions[Q].Type == "Dropdown") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); setAttributes(trChoice, { "class": "dropdowncs" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var ddlOption = document.createElement("select"); //ddlOption.options.add(new Option("Select One", "")); setAttributes(ddlOption, { "style": "width: auto;height: 25px;margin-top:10px;max-width:60%", "id": msg.d[i].MultiplescreenOptions[Q].OptionId, "class": "ddlOption ddlOptionscreen" + msg.d[i].ScreenId + "", "onchange": "gettotalprice()" }); for (var S = 0; S < msg.d[i].MultiplescreenOptions[Q].Choice.length; S++) { var Choice = new Object; Choice.Id = msg.d[i].MultiplescreenOptions[Q].Choice[S].Id; Choice.Name = msg.d[i].MultiplescreenOptions[Q].Choice[S].ChoiceName; Choice.Notify = msg.d[i].MultiplescreenOptions[Q].Choice[S].Notify; Choice.DefaultVSOption = msg.d[i].MultiplescreenOptions[Q].Choice[S].DefaultVSOption; Choice.Active = msg.d[i].MultiplescreenOptions[Q].Choice[S].Active; Choice.Price = msg.d[i].MultiplescreenOptions[Q].Choice[S].Price.toFixed(2); Choice.Exist = msg.d[i].MultiplescreenOptions[Q].Choice[S].Exist; option.Choices.push(Choice); ddlOption.options.add(new Option(msg.d[i].MultiplescreenOptions[Q].Choice[S].ChoiceName + " " + document.getElementById("lblCurrency").innerHTML + msg.d[i].MultiplescreenOptions[Q].Choice[S].Price, msg.d[i].MultiplescreenOptions[Q].Choice[S].Id)); } tdChoice.appendChild(ddlOption); trChoice.appendChild(tdChoice); tableOption1.appendChild(trChoice); Options.push(option); if (msg.d[i].MultiplescreenOptions[Q].Choice.length > 0) { lblrequired.innerHTML += "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; } } else if (msg.d[i].MultiplescreenOptions[Q].Type == "Flow Buttons") { var AddRow = ""; for (A = 0; A < msg.d[i].MultiplescreenOptions[Q].Choice.length; A++) { var Choice = new Object; Choice.Id = msg.d[i].MultiplescreenOptions[Q].Choice[A].Id; Choice.Name = msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName; Choice.Notify = msg.d[i].MultiplescreenOptions[Q].Choice[A].Notify; Choice.DefaultVSOption = msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption; Choice.Active = msg.d[i].MultiplescreenOptions[Q].Choice[A].Active; Choice.Price = msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2); Choice.Exist = msg.d[i].MultiplescreenOptions[Q].Choice[A].Exist; Choice.FreeOptions = "No"; Choice.SelectionCount = 0; option.Choices.push(Choice); var trChoice = document.createElement("tr"); setAttributes(trChoice, { "class": "Collapserow" + msg.d[i].MultiplescreenOptions[Q].OptionId + " optionname flowbuttons", "style": "color:" + OptionTextColor, "id": msg.d[i].MultiplescreenOptions[Q].OptionId, "name": "flowbuttons" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "class": "Choicetd", "align": "left", "id": "ScreenId" + msg.d[i].ScreenId }); var lblChoice = document.createElement("label"); lblChoice.innerHTML += msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName; if (document.getElementById('lblLId').value == "305f3f06-fbb4-437e-8090-db6046a96a7f" || document.getElementById('lblLId').value == "e9354e34-c551-43e2-adda-763bdc86b771") { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].Active == true) { setAttributes(lblChoice, { "title": msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName, "for": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "style": ButtonColor, "class": "flowoptbtns" }); } else { setAttributes(lblChoice, { "title": msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName, "for": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "style": "background: -webkit-gradient(linear,left top,left bottom,color-stop(0.05,lightgrey),color-stop(1,lightgrey)) !important;border: 1px solid lightgrey !important;-webkit-box-shadow: 0 0 2px 0 lightgrey !important;'" + ButtonColor + "'", "class": "flowoptbtns" }); } } else { setAttributes(lblChoice, { "title": msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName, "for": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "style": ButtonColor, "class": "flowoptbtns" }); } var choicelabel = "<label titel='" + msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName + "' for='" + msg.d[i].MultiplescreenOptions[Q].Choice[A].Id + "' style='cursor:pointer'>" + msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName + "</label>"; if (UrlType == "DineIn") { setAttributes(lblChoice, { "style": "background:none;" }); } var Price = 0; if (msg.d[i].MultiplescreenOptions[Q].Choice[A].Price != Price.toFixed(2)) { lblChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2) + ")"; choicelabel += "<label>" + document.getElementById("lblCurrency").innerHTML + msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2) + "</label>"; } if (msg.d[i].MultiplescreenOptions[Q].Type == "Flow Buttons") { lblrequired.innerHTML = "<span style='float:right;color:red;padding-left:10px;' class='requiredimg'>(Req)</span>"; var radio = document.createElement("input"); if (document.getElementById('lblLId').value == "305f3f06-fbb4-437e-8090-db6046a96a7f" || document.getElementById('lblLId').value == "e9354e34-c551-43e2-adda-763bdc86b771") { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].Active == true) { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].Exist == true) { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } else { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } } else { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].Exist == true) { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } else { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "disabled": "true", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } } } else { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].Exist == true) { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } else { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption == true) { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } else { setAttributes(radio, { "type": "radio", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "NoBindForParentRadio(this);", "style": "cursor:pointer;display:none;" }); } } } tdChoice.appendChild(radio); } if (msg.d[i].MultiplescreenOptions[Q].Type == "CheckBoxes") { if (lblrequired.innerHTML.indexOf("Required") != -1) { } else lblrequired.innerHTML = "<span style='float:right;color:green;padding-left:10px;' class='optionalimg'>(Opt)</span>"; var checkbox = document.createElement("input"); if (msg.d[i].MultiplescreenOptions[Q].Choice[A].DefaultVSOption == true) { setAttributes(checkbox, { "type": "checkbox", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } else { setAttributes(checkbox, { "type": "checkbox", "class": "optcheckedscreenid" + msg.d[i].ScreenId + " Validate", "Name": "Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId, "value": msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2), "id": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "onclick": "BindForParentRadio(this);", "style": "cursor:pointer;" }); } //optionsdiv += "<div><input type='checkbox' Name='Choiceradio" + msg.d[i].MultiplescreenOptions[Q].OptionId + "' value='" + msg.d[i].MultiplescreenOptions[Q].Choice[A].Price.toFixed(2) + "' id='" + msg.d[i].MultiplescreenOptions[Q].Choice[A].Id + "' "; if (msg.d[i].MultiplescreenOptions[Q].MaxSize > 0) { checkbox.setAttribute("onclick", "LimitOptionsSelection(this);"); } tdChoice.appendChild(checkbox); } if (msg.d[i].MultiplescreenOptions[Q].Type != "Flow Buttons") { if (msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceImageURL != null && msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceImageURL != "") { var lblChoiceimg = document.createElement("label"); setAttributes(lblChoiceimg, { "class": "Choicetdimg", "title": msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceName, "for": msg.d[i].MultiplescreenOptions[Q].Choice[A].Id, "style": "cursor:pointer;" }); lblChoiceimg.innerHTML = "<img class='choiceimage', alt='Choice Image', id='Choiceimg" + msg.d[i].MultiplescreenOptions[Q].Choice[A].Id + "', title='" + msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceImageURL + "' , src='" + msg.d[i].MultiplescreenOptions[Q].Choice[A].ChoiceImageURL + "' />"; setAttributes(lblChoice, { "style": "float:left" }); tdChoice.appendChild(lblChoiceimg); } } tdChoice.appendChild(lblChoice); trChoice.appendChild(tdChoice); tableOption1.appendChild(trChoice); if (msg.d[i].MultiplescreenOptions[Q].Choice[A].Exist == true) { if (msg.d[i].MultiplescreenOptions[Q].Type != "Flow Buttons") { var childExist = document.createElement("img"); setAttributes(childExist, { "src": "images/childExpand.png", "style": "width: 15px;vertical-align: top; margin-left: 4px;", "alt": "Expand" }); lblChoice.appendChild(childExist); } var childExisttr = document.createElement("tr"); setAttributes(childExisttr, { "id": "childOption" + msg.d[i].MultiplescreenOptions[Q].Choice[A].Id }); setAttributes(childExisttr, { "class": "Collapserow" + msg.d[i].MultiplescreenOptions[Q].OptionId }); tableOption1.appendChild(childExisttr); } } Options.push(option); } if (UrlType != "DineIn") { if (msg.d[i].MultiplescreenOptions[Q].Type == "Multiline Textbox") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var textbox = document.createElement("textarea"); setAttributes(textbox, { "class": "Choicetext", "id": msg.d[i].MultiplescreenOptions[Q].OptionId }); tdChoice.appendChild(textbox); trChoice.appendChild(tdChoice); tableOption1.appendChild(trChoice); Options.push(option); } } tdScreen.appendChild(tableOption1); trScreen.appendChild(tdScreen); document.getElementById('OptionTable').appendChild(trScreen); if (msg.d[i].MultiplescreenOptions[Q].Type == "CheckBoxes" || msg.d[i].MultiplescreenOptions[Q].Type == "Radio Buttons") { if (msg.d[i].MultiplescreenOptions[Q].Collapse == true) { $(".Collapserow" + msg.d[i].MultiplescreenOptions[Q].OptionId).css("display", "none"); $("#Collapseimg" + msg.d[i].MultiplescreenOptions[Q].OptionId).attr('src', 'https://orderem.com/images/Sortdown.png') } else { $("#Collapseimg" + msg.d[i].MultiplescreenOptions[Q].OptionId).attr('src', 'https://orderem.com/images/Sortup.png');; } } else { $("#Collapseimg" + msg.d[i].MultiplescreenOptions[Q].OptionId).remove(); } } } } } $(".Optiontd").css("border-bottom", "none"); if ($(".dropdowncs").length > 0) { $(".dropdowncs td").each(function () { $(this).parent().parent().addClass("dropdowncstable"); }); } if (msg.d[0].ItemImage != "" && msg.d[0].ItemImage != null) { document.getElementById("lblitemimage").src = msg.d[0].ItemImage; GetMultipleItemImages(ItemId); $(".itemflowcolumnsrgt").css("float", "none"); $(".itemflowcolumnslft").css("display", "none"); $("#ItemImageDisplay").css("display", "none"); $(".itemflowcolumnsrgt").css("width", "50%"); } else { $(".itemflowcolumnslft").css("display", "none"); $(".itemflowcolumnsrgt").css("width", "100%"); } var Next = msg.d[1].Next; var Alternate = msg.d[1].Alternate; var FutureAlternateId = msg.d[1].AlternateScreenId; var FutureNextId = msg.d[1].NextScreenId; var GetOptionNames = JSON.parse(localStorage.getItem("LoadedItemOptions")); if (GetOptionNames != null) { for (var Z = 0; Z < GetOptionNames.length; Z++) { if (Next == GetOptionNames[Z].OptionId) { Next = GetOptionNames[Z].OptionName; } } for (var k = 0; k < GetOptionNames.length; k++) { if (Alternate == GetOptionNames[k].OptionId) { Alternate = GetOptionNames[k].OptionName; } } if (Next != "Review" && Next != "Add to cart") { if (FutureNextId != "0") { $("#btnaddtocart").val(Next); $(".addtocartdiv").css("display", "block"); $(".btnloaderdiv").css("display", "none"); $("#btnaddtocart").attr("onclick", "OptionsFlowValidatingOptionsCheck();"); $("#btnaddtocart").attr("name", "ScreenId" + FutureNextId + ""); } else { $("#btnaddtocart").attr("onclick", "OptionsFlowAddItemstoCart();"); var AppId = document.getElementById('lblAppId1').value; if (AppId == "db56d720-4a50-4356-9ee8-41f3e78cf49c" || AppId == "3b9b8dea-9ddf-42de-98af-279352efec24") { $("#btnaddtocart").val("Add to bag"); } else { $("#btnaddtocart").val("Add to cart"); } $(".addtocartdiv").css("display", "block"); $(".btnloaderdiv").css("display", "none"); } } else { if (Next == "Review") { $("#btnaddtocart").val(Next); $("#btnaddtocart").attr("onclick", "ShowReviewOptions();"); if ($("#btnaddtocart").attr("name")) { $("#btnaddtocart").removeAttr("name"); $(".addtocartdiv").css("display", "block"); $(".btnloaderdiv").css("display", "none"); } } else { if(Next == "Add to cart"){ var AppId = document.getElementById('lblAppId1').value; if (AppId == "db56d720-4a50-4356-9ee8-41f3e78cf49c" || AppId == "3b9b8dea-9ddf-42de-98af-279352efec24") { $("#btnaddtocart").val("Add to bag"); } else { $("#btnaddtocart").val(Next); } }else{ $("#btnaddtocart").val(Next); } $(".addtocartdiv").css("display", "block"); $(".btnloaderdiv").css("display", "none"); $("#btnaddtocart").attr("onclick", "OptionsFlowAddItemstoCart();"); } } if (Alternate != "None") { if(Alternate == "Check Out"){ $("#btnmakeitcombo").css("display", "block"); $(".btncomboloaderdiv").css("display", "none"); $("#btnmakeitcombo").val(Alternate); $("#btnmakeitcombo").attr("onclick", "CheckOutItem();"); $("#btnmakeitcombo").attr("name", "ScreenId" + FutureAlternateId + ""); $(".ordqntymnlt").css("width", "auto"); $(".ordqntymnlt").css("margin-left", "15px"); } else{ if (FutureAlternateId != "0") { $("#btnmakeitcombo").css("display", "block"); $(".btncomboloaderdiv").css("display", "none"); $("#btnmakeitcombo").val(Alternate); $("#btnmakeitcombo").attr("onclick", "ComboOptionsFlowValidatingOptionsCheck();"); $("#btnmakeitcombo").attr("name", "ScreenId" + FutureAlternateId + ""); $(".ordqntymnlt").css("width", "auto"); $(".ordqntymnlt").css("margin-left", "15px"); } else { $("#btnmakeitcombo").css("display", "none"); $(".btncomboloaderdiv").css("display", "none"); $(".ordqntymnlt").css("width", "46%"); } } } else { $("#btnmakeitcombo").css("display", "none"); $(".btncomboloaderdiv").css("display", "none"); $(".ordqntymnlt").css("width", "46%"); } var ChildOptionsCount=0; $("#" + ScreenId + " tr").each(function () { var InputId = $(this).find('input').attr('id'); if ($(this).attr('name') == "flowbuttons") { if (InputId != "undefined" && InputId != undefined) { if ($("#childOption" + InputId).length > 0) { ChildOptionsCount++; } } } }); if (ChildOptionsCount == 0) { $(".pricetext").css("display", "block"); } else { $(".pricetext").css("display", "none"); } } FreeOptionCount = 1; localStorage.setItem("OptionCheck", JSON.stringify(Options)); if (document.getElementById("lblItemType").innerHTML == "AddItem") { if (document.getElementById("lblBogoItemId").innerHTML != "") { document.getElementById('txtquantity').value = document.getElementById("lblBogoOfferQ").innerHTML; document.getElementById("lbldisplayItemPrice").innerHTML = document.getElementById("lblCurrency").innerHTML + (parseFloat(document.getElementById("PriceVal").innerHTML) * parseFloat(document.getElementById("lblBogoOfferQ").innerHTML)).toFixed(2); } else { document.getElementById('txtquantity').value = "1"; document.getElementById('txtunitquantity').value = "1"; } if (UrlType == "DineIn") { var rowCount = $('#OptionTable tr').length; if (document.getElementById('OptionTable').innerHTML != "") { $("body").addClass("fullpanel"); if (document.getElementById("lblAllowcart").innerHTML == "true") { if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "none"); $(".fcontainer").css("display", "none"); $(".Ordersmain").css("display", "none"); $(".orderdivr").css("display", "none"); $(".griditemsmodal").css("background-color", "white"); $(".griditemscroll").css("width", "100%"); $(".grditemspanel").fadeIn("slow"); $(".itemimageshow").css("width", "100%"); $(".itemimageshow").css("height", "320px"); $(".itemimageshow").css("object-fit", "cover"); $("#txtinstructions").css("margin-bottom", "100px;"); $(".txtinstructions").addClass("txtinstructionscs"); $("#lblitemmesg").css("display", "none"); $(".itemmain").css("display", "none"); $(".itemnamecs").css("display", "block"); $(".closeitemdiv").css("display", "block"); } else { $(".grditemspanel").fadeIn("slow"); } } else { $(".grditemspanel").fadeIn("slow"); } } else { if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "block"); $(".fcontainer").css("display", "block"); $(".Ordersmain").css("display", "block"); $(".orderdivr").css("display", "block"); $(".griditemscroll").css("width", "90%"); document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".mblcheckbtndiv").css("display", "inline-block"); } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); $(".checkbtndiv").css("display", "inline-block"); } } else { document.getElementById("displayMultipleImages").innerHTML = ""; $(".grditemspanel").fadeOut("slow"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } } } $(".btnloaderdiv").css("display", "none"); $(".addtocartdiv").css("display", "block"); //$(".grditemspanel").fadeIn("slow", function () { // $("body").addClass("fullpanel"); //}); } else { alert("Item haven't any options"); } } else { $("body").addClass("fullpanel"); if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $(".hmheader").css("display", "none"); $(".fcontainer").css("display", "none"); $(".Ordersmain").css("display", "none"); $(".orderdivr").css("display", "none"); $(".griditemsmodal").css("background-color", "white"); $(".griditemscroll").css("width", "100%"); $(".grditemspanel").fadeIn("slow"); $(".itemimageshow").css("width", "100%"); $(".itemimageshow").css("height", "320px"); $(".itemimageshow").css("object-fit", "cover"); $("#txtinstructions").css("margin-bottom", "100px;"); $(".txtinstructions").addClass("txtinstructionscs"); $("#lblitemmesg").css("display", "none"); $(".itemmain").css("display", "none"); $(".itemnamecs").css("display", "block"); $(".closeitemdiv").css("display", "block"); } else { $(".grditemspanel").fadeIn("slow"); } } else { $(".grditemspanel").fadeIn("slow"); } $(".btnloaderdiv").css("display", "none"); $(".addtocartdiv").css("display", "block"); } $(".addcategoryloadingimage1").css("display", "none"); } else if (document.getElementById("lblItemType").innerHTML == "EditItem") { document.getElementById('txtquantity').value = "1"; $(".addcategoryloadingimage1").css("display", "none"); $("#tblCart").css('opacity', '1'); $(".addcategoryloadingimage2").css("display", "none"); } $("#" + ItemId).css("opacity", "1"); var Itempriceqty = "<img id='removeButton' alt = 'Remove' src = 'https://www.munchem.com/images/removeQuantity.png' onclick = 'RemoveQuantity()' style = 'float:left;cursor:pointer' class='Qutyimage' /> <input type='text' id='txtquantity' class='negativeqnty txtcount' readonly='readonly' value='" + document.getElementById('txtquantity').value + "' /> <img id='addButton' alt='Add' src='https://www.munchem.com/images/addQuantity.png' onclick='AddQuantity()' style='cursor:pointer' class='Qutyimage' />"; var ItemFlowPrice = document.getElementById("lbldisplayItemPrice").innerHTML; document.getElementById("itemflowqty").innerHTML = Itempriceqty; document.getElementById("itemflowitemname").innerHTML = msg.d[0].OptionName; document.getElementById("itemflowprice").innerHTML = ItemFlowPrice; document.getElementById("tditempriceqty").innerHTML = ""; document.getElementById('lbldisplayItemPrice').style.display = "none"; document.getElementById('tdordqntymnlt').style.display = "none"; $(".itemflowcolumns").css("display", "block"); if (document.getElementById('lblMenuoptions').value == "Column2") { $(".optionname").addClass("Menuoptionname"); } var ReqImage = document.createElement("img"); setAttributes(ReqImage, { "src": "images/requredimg.png", "style": "width: 15px;margin-top: 5px;", "alt": "required" }); $(".requiredimg").text(''); $(".requiredimg").append(ReqImage); $(".optionalimg").each(function () { $(this).text(''); }); gettotalprice(); } } document.getElementById('backoptionsloader').style.display = "none"; } }); } else { OptionsLoad(msg, ItemId, OrderType); } } else { OptionsLoad(msg, ItemId, OrderType); } } }); } function OptionsFlowValidatingOptionsCheck() { document.getElementById("flowoptbtnerror").innerHTML=""; var Screenid = $("#btnaddtocart").attr("name").replace("ScreenId", ""); localStorage.setItem("ScreenId", Screenid); $(".addtocartdiv").css("display", "none"); $(".btnloaderdiv").css("display", "block"); $("#ItemImageDisplay").css("display", "none"); var OrderType = localStorage.getItem("OrderType"); document.getElementById("additemserror").innerHTML = ""; var DisplayedretrivedOptions = localStorage.getItem("ShowingItemOptions"); var PreviousScreenId = localStorage.getItem("PreviousScreenId"); PreviousScreenId = Number(PreviousScreenId); var DisplayedOptions; if (DisplayedretrivedOptions != null) { DisplayedOptions = JSON.parse(DisplayedretrivedOptions); } var ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; var Options = new Array(); if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].ItemId == document.getElementById("lblItemId").innerHTML.split('//')[0]) { } else { var sPath = window.location.pathname; $("#lblordalert").text("Something went wrong"); $(".orderalert").fadeIn(); //$(".btnloaderdiv").delay(3000).fadeOut(); //$(".addtocartdiv").delay(3000).fadeIn(); window.location.href = sPath; } } var retrievedData = localStorage.getItem("TotalItems"); var ItemCount = 0; if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var Itemdetails = document.getElementById("lblItemId").innerHTML.split('//'); if (AddedItems != null) { if (AddedItems.length > 0) { if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Id = document.getElementById("EditItemNum").innerHTML.replace("EditItem", ""); for (var cou = 0; cou < AddedItems.length; cou++) { if (Id != cou) { if (AddedItems[cou].Id == Itemdetails[0]) { ItemCount = parseInt(AddedItems[cou].Quantity) + ItemCount; } } } } else { for (var cou = 0; cou < AddedItems.length; cou++) { if (AddedItems[cou].Id == Itemdetails[0]) { ItemCount = parseInt(AddedItems[cou].Quantity) + ItemCount; } } } } } } var Qu = parseInt(document.getElementById('txtquantity').value); ItemCount = ItemCount + Qu; if (ItemCount > parseInt(localStorage.getItem("ItemAvailability"))) { document.getElementById("additemserror").innerHTML = "Available only " + localStorage.getItem("ItemAvailability") + " item(s)"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } var ddlvariation = $(".ddlVariation"); if (ddlvariation.length > 0) { if (ddlvariation[0].options[ddlvariation[0].selectedIndex].text == "Select Variation") { document.getElementById("additemserror").innerHTML = "Choose Variation"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].MinSize; var H = 0; $("input[name='Choiceradio" + OptionsCheck[J].Id + "']:checked").each(function () { H++; }); var Minval = parseInt(Minvalue) if (H >= Minval) { document.getElementById("additemserror").innerHTML = ""; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].MinSize; var H = 0; $("input[name='Choiceradio" + OptionsCheck[J].Id + "']:checked").each(function () { H++; }); var Minval = parseInt(Minvalue) if (H >= Minval) { document.getElementById("additemserror").innerHTML = ""; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id==$('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text()+"/"+NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id==$('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text()+"/"+NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Flow Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id==$('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text()+"/"+NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Flow Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if(OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id==$('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text()+"/"+NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Dropdown") { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if ($('#' + OptionsCheck[J].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var U = 0; U < OptionsCheck[J].Choices.length; U++) { if (OptionsCheck[J].Choices[U].Id == $('#' + OptionsCheck[J].Id).children("option").filter(":selected").val()) { var NotifyVal = true + "/" + OptionsCheck[J].Choices[U].Notify; } } var text = OptionsCheck[J].Id + "/" + $('#' + OptionsCheck[J].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Id).val(); } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Dropdown") { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if ($('#' + OptionsCheck[J].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var U = 0; U < OptionsCheck[J].Choices.length; U++) { if (OptionsCheck[J].Choices[U].Id == $('#' + OptionsCheck[J].Id).children("option").filter(":selected").val()) { var NotifyVal = true + "/" + OptionsCheck[J].Choices[U].Notify; } } var text = OptionsCheck[J].Id + "/" + $('#' + OptionsCheck[J].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Id).val(); } } } } } } } } var B = 0; for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "") { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #C22727"; document.getElementById("additemserror").innerHTML = "Please enter quantity "; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); B++; } else if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "0") { document.getElementById("additemserror").innerHTML = "Quantity should be greater than zero"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); B++; } else { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #b9bcbe"; } } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "") { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #C22727"; document.getElementById("additemserror").innerHTML = "Please enter quantity "; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); B++; } else if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "0") { document.getElementById("additemserror").innerHTML = "Quantity should be greater than zero"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); B++; } else { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #b9bcbe"; } } } } } } } } } } if (B > 0) { return; } for (var J = 0; J < OptionsCheck.length; J++) { var TotalQuantity = 0; if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value != "") { var quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; TotalQuantity = +quantity + +TotalQuantity; } } } var SelectionQuantity = OptionsCheck[J].QuantitySelection; if (TotalQuantity == SelectionQuantity) { } else { document.getElementById("additemserror").innerHTML = "Quantity doesn't match"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value != "") { var quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; TotalQuantity = +quantity + +TotalQuantity; } } } var SelectionQuantity = OptionsCheck[J].QuantitySelection; if (TotalQuantity == SelectionQuantity) { } else { document.getElementById("additemserror").innerHTML = "Quantity doesn't match"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } } } } } } } } $(".backtooptions").css("display", "block"); $("#itemflowcolumns").css("display", "none"); //$(".lblitemnamestyles").css("width", "80%"); //$(".lblitemnamestyles").css("float", "left"); var OptionFlowScreens = JSON.parse(localStorage.getItem("OptionFlowScreens")); if (OptionFlowScreens != null) { if (OptionFlowScreens.length > 0) { for (var T = 1; T < OptionFlowScreens.length; T++) { if (Screenid == OptionFlowScreens[T].ScreenId) { localStorage.setItem("PreviousScreenId", OptionFlowScreens[T].ScreenId); $("#ScreenId" + OptionFlowScreens[T].ScreenId).css("display", "grid"); localStorage.setItem("ShowingItemOptions", JSON.stringify(OptionFlowScreens[T])); $("#ScreenId" + OptionFlowScreens[T].ScreenId).each(function () { if($(".ddlOptionscreen"+OptionFlowScreens[T].ScreenId).length > 0) { $(".ddlOptionscreen"+OptionFlowScreens[T].ScreenId).addClass("Validate"); } }); $(".optcheckedscreenid"+OptionFlowScreens[T].ScreenId).each(function () { if($(".optcheckedscreenid"+OptionFlowScreens[T].ScreenId).length > 0) { $(".optcheckedscreenid"+OptionFlowScreens[T].ScreenId).addClass("Validate"); if($(this).attr("checked")) { var itemlist = $(this); LimitOptionsSelection(itemlist[0]); } } }); $(".optcheckedscreenid"+OptionFlowScreens[T].ScreenId).each(function () { if($(".optcheckedscreenid"+OptionFlowScreens[T].ScreenId).length > 0) { $(".optcheckedscreenid"+OptionFlowScreens[T].ScreenId).addClass("Validate"); if($(this).attr("checked")) { var itemlist = $(this); BindForParentRadio(itemlist[0]); } } }); var Next = OptionFlowScreens[T].Next; var Alternate = OptionFlowScreens[T].Alternate; var FutureAlternateId = OptionFlowScreens[T].AlternateScreenId; var FutureNextId = OptionFlowScreens[T].NextScreenId; var GetOptionNames = JSON.parse(localStorage.getItem("LoadedItemOptions")); if (GetOptionNames != null) { for (var O = 0; O < GetOptionNames.length; O++) { if (Next == GetOptionNames[O].OptionId) { Next = GetOptionNames[O].OptionName; } } for (var k = 0; k < GetOptionNames.length; k++) { if (Alternate == GetOptionNames[k].OptionId) { Alternate = GetOptionNames[k].OptionName; } } if (Next != "Review" && Next != "Add to cart") { if (FutureNextId != "0") { $("#btnaddtocart").val(Next); $(".addtocartdiv").css("display", "block"); $(".btnloaderdiv").css("display", "none"); $("#btnaddtocart").attr("onclick", "OptionsFlowValidatingOptionsCheck();"); $("#btnaddtocart").attr("name", "ScreenId" + OptionFlowScreens[T].NextScreenId + ""); } else { $("#btnaddtocart").attr("onclick", "OptionsFlowAddItemstoCart();"); var AppId = document.getElementById('lblAppId1').value; if (AppId == "db56d720-4a50-4356-9ee8-41f3e78cf49c" || AppId == "3b9b8dea-9ddf-42de-98af-279352efec24") { $("#btnaddtocart").val("Add to bag"); } else { $("#btnaddtocart").val("Add to cart"); } $(".addtocartdiv").css("display", "block"); $(".btnloaderdiv").css("display", "none"); } } else { if (Next == "Review") { $("#btnaddtocart").val(Next); $(".addtocartdiv").css("display", "block"); $(".btnloaderdiv").css("display", "none"); $("#btnaddtocart").attr("onclick", "ShowReviewOptions();"); if ($("#btnaddtocart").attr("name")) { $("#btnaddtocart").removeAttr("name"); } } else { if(Next == "Add to cart"){ var AppId = document.getElementById('lblAppId1').value; if (AppId == "db56d720-4a50-4356-9ee8-41f3e78cf49c" || AppId == "3b9b8dea-9ddf-42de-98af-279352efec24") { $("#btnaddtocart").val("Add to bag"); } else { $("#btnaddtocart").val(Next); } }else{ $("#btnaddtocart").val(Next); } //$("#btnaddtocart").val(Next); $(".addtocartdiv").css("display", "block"); $(".btnloaderdiv").css("display", "none"); $("#btnaddtocart").attr("onclick", "OptionsFlowAddItemstoCart();"); } } if (Alternate != "None") { if(Alternate == "Check Out"){ $("#btnmakeitcombo").css("display", "block"); $(".btncomboloaderdiv").css("display", "none"); $("#btnmakeitcombo").val(Alternate); $("#btnmakeitcombo").attr("onclick", "CheckOutItem();"); $("#btnmakeitcombo").attr("name", "ScreenId" + FutureAlternateId + ""); $(".ordqntymnlt").css("width", "auto"); $(".ordqntymnlt").css("margin-left", "15px"); } else{ if (FutureAlternateId != "0") { $("#btnmakeitcombo").css("display", "block"); $("#btnmakeitcombo").val(Alternate); $("#btnmakeitcombo").attr("onclick", "ComboOptionsFlowValidatingOptionsCheck();"); $("#btnmakeitcombo").attr("name", "ScreenId" + FutureAlternateId + ""); $(".ordqntymnlt").css("width", "auto"); $(".ordqntymnlt").css("margin-left", "15px"); } else { $("#btnmakeitcombo").css("display", "none"); $(".btncomboloaderdiv").css("display", "none"); $(".ordqntymnlt").css("width", "46%"); } } } else { $(".btncomboloaderdiv").css("display", "none"); $("#btnmakeitcombo").css("display", "none"); $(".ordqntymnlt").css("width", "46%"); } var ChildOptionsCount=0; $("#ScreenId" + Screenid + " tr").each(function () { var InputId = $(this).find('input').attr('id'); if ($(this).attr('name') == "flowbuttons") { if (InputId != "undefined" && InputId != undefined) { if ($("#childOption" + InputId).length > 0) { ChildOptionsCount++; } } } }); if (ChildOptionsCount == 0) { $(".pricetext").css("display", "block"); } else { $(".pricetext").css("display", "none"); } } } else { $("#ScreenId" + OptionFlowScreens[T].ScreenId).css("display", "none"); } } } } gettotalprice(); } function ComboOptionsFlowValidatingOptionsCheck() { document.getElementById("flowoptbtnerror").innerHTML=""; var Screenid = $("#btnmakeitcombo").attr("name").replace("ScreenId", ""); localStorage.setItem("ScreenId", Screenid); $("#btnmakeitcombo").css("display", "none"); $("#itemflowcolumns").css("display", "none"); $(".btncomboloaderdiv").css("display", "block"); $("#ItemImageDisplay").css("display", "none"); var OrderType = localStorage.getItem("OrderType"); document.getElementById("additemserror").innerHTML = ""; var DisplayedretrivedOptions = localStorage.getItem("ShowingItemOptions"); var PreviousScreenId = localStorage.getItem("PreviousScreenId"); PreviousScreenId = Number(PreviousScreenId); var DisplayedOptions; if (DisplayedretrivedOptions != null) { DisplayedOptions = JSON.parse(DisplayedretrivedOptions); } var ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].ItemId == document.getElementById("lblItemId").innerHTML.split('//')[0]) { } else { var sPath = window.location.pathname; $("#lblordalert").text("Something went wrong"); $(".orderalert").fadeIn(); //$("#btnmakeitcombo").css("display", "none"); //$(".btncomboloaderdiv").css("display", "block"); window.location.href = sPath; } } var retrievedData = localStorage.getItem("TotalItems"); var ItemCount = 0; if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var Itemdetails = document.getElementById("lblItemId").innerHTML.split('//'); if (AddedItems != null) { if (AddedItems.length > 0) { if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Id = document.getElementById("EditItemNum").innerHTML.replace("EditItem", ""); for (var cou = 0; cou < AddedItems.length; cou++) { if (Id != cou) { if (AddedItems[cou].Id == Itemdetails[0]) { ItemCount = parseInt(AddedItems[cou].Quantity) + ItemCount; } } } } else { for (var cou = 0; cou < AddedItems.length; cou++) { if (AddedItems[cou].Id == Itemdetails[0]) { ItemCount = parseInt(AddedItems[cou].Quantity) + ItemCount; } } } } } } var Qu = parseInt(document.getElementById('txtquantity').value); ItemCount = ItemCount + Qu; if (ItemCount > parseInt(localStorage.getItem("ItemAvailability"))) { document.getElementById("additemserror").innerHTML = "Available only " + localStorage.getItem("ItemAvailability") + " item(s)"; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } var ddlvariation = $(".ddlVariation"); if (ddlvariation.length > 0) { if (ddlvariation[0].options[ddlvariation[0].selectedIndex].text == "Select Variation") { document.getElementById("additemserror").innerHTML = "Choose Variation"; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].MinSize; var H = 0; $("input[name='Choiceradio" + OptionsCheck[J].Id + "']:checked").each(function () { H++; }); var Minval = parseInt(Minvalue) if (H >= Minval) { document.getElementById("additemserror").innerHTML = ""; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn();; return false; } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].MinSize; var H = 0; $("input[name='Choiceradio" + OptionsCheck[J].Id + "']:checked").each(function () { H++; }); var Minval = parseInt(Minvalue) if (H >= Minval) { document.getElementById("additemserror").innerHTML = ""; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return false; } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Flow Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify + "/" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Flow Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify + "/" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Dropdown") { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if ($('#' + OptionsCheck[J].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } else { for (var U = 0; U < OptionsCheck[J].Choices.length; U++) { if (OptionsCheck[J].Choices[U].Id == $('#' + OptionsCheck[J].Id).children("option").filter(":selected").val()) { var NotifyVal = true + "/" + OptionsCheck[J].Choices[U].Notify; } } var text = OptionsCheck[J].Id + "/" + $('#' + OptionsCheck[J].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Id).val(); } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Dropdown") { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if ($('#' + OptionsCheck[J].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } else { for (var U = 0; U < OptionsCheck[J].Choices.length; U++) { if (OptionsCheck[J].Choices[U].Id == $('#' + OptionsCheck[J].Id).children("option").filter(":selected").val()) { var NotifyVal = true + "/" + OptionsCheck[J].Choices[U].Notify; } } var text = OptionsCheck[J].Id + "/" + $('#' + OptionsCheck[J].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Id).val(); } } } } } } } } var B = 0; for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "") { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #C22727"; document.getElementById("additemserror").innerHTML = "Please enter quantity "; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); B++; } else if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "0") { document.getElementById("additemserror").innerHTML = "Quantity should be greater than zero"; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); B++; } else { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #b9bcbe"; } } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "") { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #C22727"; document.getElementById("additemserror").innerHTML = "Please enter quantity "; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); B++; } else if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "0") { document.getElementById("additemserror").innerHTML = "Quantity should be greater than zero"; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); B++; } else { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #b9bcbe"; } } } } } } } } } } if (B > 0) { return; } for (var J = 0; J < OptionsCheck.length; J++) { var TotalQuantity = 0; if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value != "") { var quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; TotalQuantity = +quantity + +TotalQuantity; } } } var SelectionQuantity = OptionsCheck[J].QuantitySelection; if (TotalQuantity == SelectionQuantity) { } else { document.getElementById("additemserror").innerHTML = "Quantity doesn't match"; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value != "") { var quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; TotalQuantity = +quantity + +TotalQuantity; } } } var SelectionQuantity = OptionsCheck[J].QuantitySelection; if (TotalQuantity == SelectionQuantity) { } else { document.getElementById("additemserror").innerHTML = "Quantity doesn't match"; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } } } } } } } } $(".backtooptions").css("display", "block"); var OptionFlowScreens = JSON.parse(localStorage.getItem("OptionFlowScreens")); if (OptionFlowScreens != null) { if (OptionFlowScreens.length > 0) { for (var T = 1; T < OptionFlowScreens.length; T++) { if (Screenid == OptionFlowScreens[T].ScreenId) { localStorage.setItem("PreviousScreenId", OptionFlowScreens[T].ScreenId); $("#ScreenId" + OptionFlowScreens[T].ScreenId).css("display", "grid"); localStorage.setItem("ShowingItemOptions", JSON.stringify(OptionFlowScreens[T])); $("#ScreenId" + OptionFlowScreens[T].ScreenId).each(function () { if($(".ddlOptionscreen"+OptionFlowScreens[T].ScreenId).length > 0) { $(".ddlOptionscreen"+OptionFlowScreens[T].ScreenId).addClass("Validate"); } }); $(".optcheckedscreenid"+OptionFlowScreens[T].ScreenId).each(function () { if($(".optcheckedscreenid"+OptionFlowScreens[T].ScreenId).length > 0) { $(".optcheckedscreenid"+OptionFlowScreens[T].ScreenId).addClass("Validate"); if($(this).attr("checked")) { var itemlist = $(this); LimitOptionsSelection(itemlist[0]); } } }); $(".optcheckedscreenid"+OptionFlowScreens[T].ScreenId).each(function () { if($(".optcheckedscreenid"+OptionFlowScreens[T].ScreenId).length > 0) { $(".optcheckedscreenid"+OptionFlowScreens[T].ScreenId).addClass("Validate"); if($(this).attr("checked")) { var itemlist = $(this); BindForParentRadio(itemlist[0]); } } }); var Next = OptionFlowScreens[T].Next; var Alternate = OptionFlowScreens[T].Alternate; var FutureAlternateId = OptionFlowScreens[T].AlternateScreenId; var FutureNextId = OptionFlowScreens[T].NextScreenId; var GetOptionNames = JSON.parse(localStorage.getItem("LoadedItemOptions")); if (GetOptionNames != null) { for (var O = 0; O < GetOptionNames.length; O++) { if (Next == GetOptionNames[O].OptionId) { Next = GetOptionNames[O].OptionName; } } for (var k = 0; k < GetOptionNames.length; k++) { if (Alternate == GetOptionNames[k].OptionId) { Alternate = GetOptionNames[k].OptionName; } } if (Next != "Review" && Next != "Add to cart") { if (FutureNextId != "0" && FutureNextId != 0) { $("#btnaddtocart").val(Next); $(".addtocartdiv").css("display", "block"); $(".btnloaderdiv").css("display", "none"); $("#btnaddtocart").attr("onclick", "OptionsFlowValidatingOptionsCheck();"); $("#btnaddtocart").attr("name", "ScreenId" + OptionFlowScreens[T].NextScreenId + ""); } else { $("#btnaddtocart").attr("onclick", "OptionsFlowAddItemstoCart();"); var AppId = document.getElementById('lblAppId1').value; if (AppId == "db56d720-4a50-4356-9ee8-41f3e78cf49c" || AppId == "3b9b8dea-9ddf-42de-98af-279352efec24") { $("#btnaddtocart").val("Add to bag"); } else { $("#btnaddtocart").val("Add to cart"); } $(".addtocartdiv").css("display", "block"); $(".btnloaderdiv").css("display", "none"); } } else { if (Next == "Review") { $("#btnaddtocart").val(Next); $(".addtocartdiv").css("display", "block"); $(".btnloaderdiv").css("display", "none"); $("#btnaddtocart").attr("onclick", "ShowReviewOptions();"); if ($("#btnaddtocart").attr("name")) { $("#btnaddtocart").removeAttr("name"); } } else { if(Next == "Add to cart"){ var AppId = document.getElementById('lblAppId1').value; if (AppId == "db56d720-4a50-4356-9ee8-41f3e78cf49c" || AppId == "3b9b8dea-9ddf-42de-98af-279352efec24") { $("#btnaddtocart").val("Add to bag"); } else { $("#btnaddtocart").val(Next); } }else{ $("#btnaddtocart").val(Next); } $(".addtocartdiv").css("display", "block"); $(".btnloaderdiv").css("display", "none"); $("#btnaddtocart").attr("onclick", "OptionsFlowAddItemstoCart();"); } } if (Alternate != "None") { if(Alternate == "Check Out"){ $("#btnmakeitcombo").css("display", "block"); $(".btncomboloaderdiv").css("display", "none"); $("#btnmakeitcombo").val(Alternate); $("#btnmakeitcombo").attr("onclick", "CheckOutItem();"); $("#btnmakeitcombo").attr("name", "ScreenId" + FutureAlternateId + ""); $(".ordqntymnlt").css("width", "auto"); $(".ordqntymnlt").css("margin-left", "15px"); } else{ if (FutureAlternateId != "0" && FutureAlternateId != 0) { $("#btnmakeitcombo").css("display", "block"); $(".btncomboloaderdiv").css("display", "none"); $("#btnmakeitcombo").val(Alternate); $("#btnmakeitcombo").attr("onclick", "ComboOptionsFlowValidatingOptionsCheck();"); $("#btnmakeitcombo").attr("name", "ScreenId" + FutureAlternateId + ""); $(".ordqntymnlt").css("width", "auto"); $(".ordqntymnlt").css("margin-left", "15px"); } else { $("#btnmakeitcombo").css("display", "none"); $(".btncomboloaderdiv").css("display", "none"); $(".ordqntymnlt").css("width", "46%"); } } } else { $(".btncomboloaderdiv").css("display", "none"); $("#btnmakeitcombo").css("display", "none"); $(".ordqntymnlt").css("width", "46%"); } var ChildOptionsCount=0; $("#ScreenId" + Screenid + " tr").each(function () { var InputId = $(this).find('input').attr('id'); if ($(this).attr('name') == "flowbuttons") { if (InputId != "undefined" && InputId != undefined) { if ($("#childOption" + InputId).length > 0) { ChildOptionsCount++; } } } }); if (ChildOptionsCount == 0) { $(".pricetext").css("display", "block"); } else { $(".pricetext").css("display", "none"); } } } else { $("#ScreenId" + OptionFlowScreens[T].ScreenId).css("display", "none"); } } } } gettotalprice(); } function ShowReviewOptions() { document.getElementById("flowoptbtnerror").innerHTML=""; $(".addtocartdiv").css("display", "none"); $("#ItemImageDisplay").css("display", "none"); $(".btnloaderdiv").css("display", "block"); var OrderType = localStorage.getItem("OrderType"); var ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; document.getElementById("additemserror").innerHTML = ""; var DisplayedretrivedOptions = localStorage.getItem("ShowingItemOptions"); var PreviousScreenId = localStorage.getItem("PreviousScreenId"); PreviousScreenId = Number(PreviousScreenId); var DisplayedOptions; if (DisplayedretrivedOptions != null) { DisplayedOptions = JSON.parse(DisplayedretrivedOptions); } var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].ItemId == document.getElementById("lblItemId").innerHTML.split('//')[0]) { } else { var sPath = window.location.pathname; $("#lblordalert").text("Something went wrong"); $(".orderalert").fadeIn(); //$(".btnloaderdiv").delay(3000).fadeOut(); //$(".addtocartdiv").delay(3000).fadeIn(); window.location.href = sPath; } } var retrievedData = localStorage.getItem("TotalItems"); var ItemCount = 0; if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var Itemdetails = document.getElementById("lblItemId").innerHTML.split('//'); if (AddedItems != null) { if (AddedItems.length > 0) { if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Id = document.getElementById("EditItemNum").innerHTML.replace("EditItem", ""); for (var cou = 0; cou < AddedItems.length; cou++) { if (Id != cou) { if (AddedItems[cou].Id == Itemdetails[0]) { ItemCount = parseInt(AddedItems[cou].Quantity) + ItemCount; } } } } else { for (var cou = 0; cou < AddedItems.length; cou++) { if (AddedItems[cou].Id == Itemdetails[0]) { ItemCount = parseInt(AddedItems[cou].Quantity) + ItemCount; } } } } } } var Qu = parseInt(document.getElementById('txtquantity').value); ItemCount = ItemCount + Qu; if (ItemCount > parseInt(localStorage.getItem("ItemAvailability"))) { document.getElementById("additemserror").innerHTML = "Available only " + localStorage.getItem("ItemAvailability") + " item(s)"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } var ddlvariation = $(".ddlVariation"); if (ddlvariation.length > 0) { if (ddlvariation[0].options[ddlvariation[0].selectedIndex].text == "Select Variation") { document.getElementById("additemserror").innerHTML = "Choose Variation"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].MinSize; var H = 0; $("input[name='Choiceradio" + OptionsCheck[J].Id + "']:checked").each(function () { H++; }); var Minval = parseInt(Minvalue) if (H >= Minval) { document.getElementById("additemserror").innerHTML = ""; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].MinSize; var H = 0; $("input[name='Choiceradio" + OptionsCheck[J].Id + "']:checked").each(function () { H++; }); var Minval = parseInt(Minvalue) if (H >= Minval) { document.getElementById("additemserror").innerHTML = ""; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify+"/" +OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Flow Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify + "/" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Flow Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify + "/" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Dropdown") { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if ($('#' + OptionsCheck[J].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var U = 0; U < OptionsCheck[J].Choices.length; U++) { if (OptionsCheck[J].Choices[U].Id == $('#' + OptionsCheck[J].Id).children("option").filter(":selected").val()) { var NotifyVal = true + "/" + OptionsCheck[J].Choices[U].Notify; } } var text = OptionsCheck[J].Id + "/" + $('#' + OptionsCheck[J].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Id).val(); } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Dropdown") { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if ($('#' + OptionsCheck[J].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Name; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } else { for (var U = 0; U < OptionsCheck[J].Choices.length; U++) { if (OptionsCheck[J].Choices[U].Id == $('#' + OptionsCheck[J].Id).children("option").filter(":selected").val()) { var NotifyVal = true + "/" + OptionsCheck[J].Choices[U].Notify; } } var text = OptionsCheck[J].Id + "/" + $('#' + OptionsCheck[J].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Id).val(); } } } } } } } } var B = 0; for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "") { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #C22727"; document.getElementById("additemserror").innerHTML = "Please enter quantity "; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); B++; } else if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "0") { document.getElementById("additemserror").innerHTML = "Quantity should be greater than zero"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); B++; } else { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #b9bcbe"; } } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "") { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #C22727"; document.getElementById("additemserror").innerHTML = "Please enter quantity "; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); B++; } else if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "0") { document.getElementById("additemserror").innerHTML = "Quantity should be greater than zero"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); B++; } else { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #b9bcbe"; } } } } } } } } } } if (B > 0) { return; } for (var J = 0; J < OptionsCheck.length; J++) { var TotalQuantity = 0; if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value != "") { var quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; TotalQuantity = +quantity + +TotalQuantity; } } } var SelectionQuantity = OptionsCheck[J].QuantitySelection; if (TotalQuantity == SelectionQuantity) { } else { document.getElementById("additemserror").innerHTML = "Quantity doesn't match"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value != "") { var quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; TotalQuantity = +quantity + +TotalQuantity; } } } var SelectionQuantity = OptionsCheck[J].QuantitySelection; if (TotalQuantity == SelectionQuantity) { } else { document.getElementById("additemserror").innerHTML = "Quantity doesn't match"; $(".btnloaderdiv").delay(3000).fadeOut(); $(".addtocartdiv").delay(3000).fadeIn(); return; } } } } } } } } } $(".backtooptions").css("display", "block"); $("#itemflowcolumns").css("display", "none"); document.getElementById('PreviewOptionTable').innerHTML = ""; var Qty = document.getElementById('txtquantity').value; document.getElementById('OptionTable').style.display = "none"; document.getElementById('PreviewOptionTable').style.display = "block"; var z = 0; var trOptiontable = document.createElement("tr"); trOptiontable.setAttribute("class", "PreviewOptionTabletr"); var tdOptiontable = document.createElement("td"); var tdOptiontableQty = document.createElement("td"); tdOptiontableQty.setAttribute("class", "reviewtxtquantity"); tdOptiontableQty.setAttribute("style", "text-align:center"); var tdOptionHeadspan1 = document.createElement("span"); tdOptionHeadspan1.innerHTML = Qty + "X"; tdOptiontableQty.appendChild(tdOptionHeadspan1); trOptiontable.appendChild(tdOptiontableQty); for (var J = 0; J < OptionsCheck.length; J++) { for (L = 0; L < OptionsCheck[J].Choices.length; L++) { var Optiontable = document.createElement("table"); Optiontable.setAttribute("class", "previewOptions"); Optiontable.setAttribute("id", "previewOptions"+OptionsCheck[J].Id); if ($('#' + OptionsCheck[J].Choices[L].Id).is(':checked')) { if ($('#' + OptionsCheck[J].Choices[L].Id).attr("class").indexOf("Validate") >= 0){ z++; //var Optiontable = document.createElement("table"); //Optiontable.setAttribute("class", "previewOptions"); var trOptionHead = document.createElement("tr"); trOptionHead.setAttribute("class", "previewtitle"); var tdOptionHead = document.createElement("td"); var tdOptionHeadspan = document.createElement("span"); tdOptionHeadspan.innerHTML = OptionsCheck[J].Name; tdOptionHead.appendChild(tdOptionHeadspan); trOptionHead.appendChild(tdOptionHead); Optiontable.appendChild(trOptionHead); var trchoiceHead = document.createElement("tr"); trchoiceHead.setAttribute("class", "previewtdtitle"); trchoiceHead.setAttribute("id", "previewtdtitle" + OptionsCheck[J].Id); for (L = 0; L < OptionsCheck[J].Choices.length; L++) { if(OptionsCheck[J].Choices[L].Notify == true){ if ($('#' + OptionsCheck[J].Choices[L].Id).is(':checked')) { var tdchoiceHead = document.createElement("td"); var tdchoiceHeadspan = document.createElement("span"); if (OptionsCheck[J].Choices[L].Price != "0.00") { tdchoiceHeadspan.innerHTML = OptionsCheck[J].Choices[L].Name + " ( " + OptionsCheck[J].Choices[L].Price + " ) "; } else { tdchoiceHeadspan.innerHTML = OptionsCheck[J].Choices[L].Name; } tdchoiceHead.appendChild(tdchoiceHeadspan); trchoiceHead.appendChild(tdchoiceHead); } } } Optiontable.appendChild(trchoiceHead); for (L = 0; L < OptionsCheck[J].Choices.length; L++) { if ($('#' + OptionsCheck[J].Choices[L].Id).is(':checked')) { if (OptionsCheck[J].Choices[L].ChildOptions != undefined) { for (var M = 0; M < OptionsCheck[J].Choices[L].ChildOptions.length; M++) { if(OptionsCheck[J].Choices[L].Notify== true){ if (OptionsCheck[J].Choices[L].ChildOptions[M].Type != "Dropdown") { var trOptionHead1 = document.createElement("tr"); trOptionHead1.setAttribute("class", "previewtitle"); var tdOptionHead1 = document.createElement("td"); var tdOptionHeadspan1 = document.createElement("span"); tdOptionHeadspan1.innerHTML = OptionsCheck[J].Choices[L].ChildOptions[M].Name; tdOptionHead1.appendChild(tdOptionHeadspan1); trOptionHead1.appendChild(tdOptionHead1); Optiontable.appendChild(trOptionHead1); var trchoiceHead1 = document.createElement("tr"); trchoiceHead1.setAttribute("class", "previewtdtitle"); for (var U = 0; U < OptionsCheck[J].Choices[L].ChildOptions[M].Choices.length; U++) { if(OptionsCheck[J].Choices[L].ChildOptions[M].Choices[U].Notify == true){ var SubChoicesId = OptionsCheck[J].Choices[L].Id + "" + OptionsCheck[J].Choices[L].ChildOptions[M].Choices[U].Id; if ($('#' + SubChoicesId).is(':checked')) { var tdchoiceHead1 = document.createElement("td"); var tdchoiceHeadspan1 = document.createElement("span"); if (OptionsCheck[J].Choices[L].ChildOptions[M].Choices[U].Price != "0.00") { tdchoiceHeadspan1.innerHTML = OptionsCheck[J].Choices[L].ChildOptions[M].Choices[U].Name + " ( " + OptionsCheck[J].Choices[L].ChildOptions[M].Choices[U].Price + " ) "; } else { tdchoiceHeadspan1.innerHTML = OptionsCheck[J].Choices[L].ChildOptions[M].Choices[U].Name; } tdchoiceHead1.appendChild(tdchoiceHeadspan1); trchoiceHead1.appendChild(tdchoiceHead1); } } } Optiontable.appendChild(trchoiceHead1); } } } } } } tdOptiontable.appendChild(Optiontable); trOptiontable.appendChild(tdOptiontable); document.getElementById('PreviewOptionTable').appendChild(trOptiontable); document.getElementById('OptionTable').style.display = "none"; } } } } var DropdownValues = localStorage.getItem("SelectedDropDown"); if (DropdownValues != null && DropdownValues != "") { z++; var ddvalues = DropdownValues.split(","); for (var D = 0; D < ddvalues.length; D++) { var K = 0; var OptionId = ddvalues[D].split("/")[0]; var AllOptions = JSON.parse(localStorage.getItem("OptionCheck")); if(ddvalues[D].split("/")[2] == "true") { if(ddvalues[D].split("/")[3] == "true") { if ($("#ItemOption" + OptionId).length > 0) { var Optiontable2 = document.createElement("table"); Optiontable2.setAttribute("class", "previewOptions"); var trOptionHead2 = document.createElement("tr"); trOptionHead2.setAttribute("class", "previewtitle"); var tdOptionHead2 = document.createElement("td"); var tdOptionHeadspan2 = document.createElement("span"); tdOptionHeadspan2.innerHTML = $("#ItemOption" + OptionId).text(); tdOptionHead2.appendChild(tdOptionHeadspan2); trOptionHead2.appendChild(tdOptionHead2); Optiontable2.appendChild(trOptionHead2); var trchoiceHead2 = document.createElement("tr"); trchoiceHead2.setAttribute("class", "previewtdtitle"); var tdchoiceHead2 = document.createElement("td"); var tdchoiceHeadspan2 = document.createElement("span"); tdchoiceHeadspan2.innerHTML = ddvalues[D].split("/")[1]; tdchoiceHead2.appendChild(tdchoiceHeadspan2); trchoiceHead2.appendChild(tdchoiceHead2); Optiontable2.appendChild(trchoiceHead2); tdOptiontable.appendChild(Optiontable2); trOptiontable.appendChild(tdOptiontable); document.getElementById('PreviewOptionTable').appendChild(trOptiontable); } if ($("#ChildOption" + OptionId).length > 0) { var Optiontable2 = document.createElement("table"); Optiontable2.setAttribute("class", "previewOptions"); var trOptionHead2 = document.createElement("tr"); trOptionHead2.setAttribute("class", "previewtitle"); var tdOptionHead2 = document.createElement("td"); var tdOptionHeadspan2 = document.createElement("span"); tdOptionHeadspan2.innerHTML = $("#ChildOption" + OptionId).text(); tdOptionHead2.appendChild(tdOptionHeadspan2); trOptionHead2.appendChild(tdOptionHead2); Optiontable2.appendChild(trOptionHead2); var trchoiceHead2 = document.createElement("tr"); trchoiceHead2.setAttribute("class", "previewtdtitle"); var tdchoiceHead2 = document.createElement("td"); var tdchoiceHeadspan2 = document.createElement("span"); tdchoiceHeadspan2.innerHTML = ddvalues[D].split("/")[1]; tdchoiceHead2.appendChild(tdchoiceHeadspan2); trchoiceHead2.appendChild(tdchoiceHead2); Optiontable2.appendChild(trchoiceHead2); tdOptiontable.appendChild(Optiontable2); trOptiontable.appendChild(tdOptiontable); document.getElementById('PreviewOptionTable').appendChild(trOptiontable); } } } } } var rowcount=0; $(".previewOptions").each(function () { rowcount++; }); $(".previewtdtitle").each(function () { if ($(this).html() != "" && $(this).html() != null) { } else { var tdrowid = $(this).attr('id'); if( titlerowid != null && titlerowid != "" && titlerowid != undefined && titlerowid != "undefined") { var titlerowid = tdrowid.replace("previewtdtitle", "previewOptions"); $("#" + titlerowid).css("display","none"); } } }); var count = 0; $(".previewOptions").each(function () { if ($(this).css("display")=="none") { count++; } }); if(rowcount== count) { var ItemName = document.getElementById("lblItemId").innerHTML.split("//")[1]; var tditemname = document.createElement("td"); tditemname.setAttribute("class", "itemnamecss"); tditemname.setAttribute("id", "itemnametext"); tditemname.innerHTML = ItemName; trOptiontable.appendChild(tditemname); } $("#OptionTable tr").each(function () { if ($(this).attr('class') == "OptionScreens") { $(this).css("display", "none"); } }); if (z == 0) { document.getElementById("displayMultipleImages").innerHTML = ""; $("#grditemspanel").css("display", "none"); $(".checkoutloaderdiv").css("display", "none"); if (window.innerWidth < 767) { $(".mblcheckbtndiv").css("display", "inline-block"); } else { $(".checkbtndiv").css("display", "inline-block"); } OptionsFlowAddItemstoCart(); } else { var AppId = document.getElementById('lblAppId1').value; if (AppId == "db56d720-4a50-4356-9ee8-41f3e78cf49c" || AppId == "3b9b8dea-9ddf-42de-98af-279352efec24") { $("#btnaddtocart").val("Add to bag"); } else { $("#btnaddtocart").val("Add to cart"); } $(".addtocartdiv").css("display", "block"); $(".btnloaderdiv").css("display", "none"); $(".btncomboloaderdiv").css("display", "none"); $("#btnmakeitcombo").css("display", "none"); $(".ordqntymnlt").css("width", "46%"); $("#btnaddtocart").attr("onclick", "OptionsFlowAddItemstoCart();"); } if (document.getElementById("itemflowqty").innerHTML != "") { var Itempriceqty = "<img id='removeButton' alt = 'Remove' src = 'https://www.munchem.com/images/removeQuantity.png' onclick = 'RemoveQuantity()' style = 'float:left;cursor:pointer' class='Qutyimage' /> <input type='text' id='txtquantity' class='negativeqnty txtcount' readonly='readonly' value='" + document.getElementById('txtquantity').value + "' /> <img id='addButton' alt='Add' src='https://www.munchem.com/images/addQuantity.png' onclick='AddQuantity()' style='cursor:pointer' class='Qutyimage' />"; document.getElementById("tditempriceqty").innerHTML = Itempriceqty; document.getElementById('lbldisplayItemPrice').style.display = "block"; document.getElementById('tdordqntymnlt').style.display = "block"; document.getElementById("itemflowqty").innerHTML = ""; $(".qntysty").css("margin-top", "0"); } gettotalprice(); } function BacktoOptions() { document.getElementById('OptionTable').style.display = "none"; document.getElementById('PreviewOptionTable').style.display = "none"; document.getElementById('backoptionsloader').style.display = "block"; document.getElementById("flowoptbtnerror").innerHTML=""; var ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; var OrderType = ""; $.ajax({ type: "POST", url: "Orders.aspx/GetItemOptions", data: "{'ItemId': '" + ItemId + "','OrderType': '" + OrderType + "','Taxlabel': '" + document.getElementById("Taxeslabel").innerHTML + "','Tax': '" + document.getElementById("Taxes").innerHTML.replace(document.getElementById("lblCurrency").innerHTML, "") + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if (msg.d[0].ItemFlow == true) { document.getElementById("lblitemflowtype").innerHTML = msg.d[0].ItemFlow; MenuItemOptionsLoad(msg, ItemId, OrderType); } else { OptionsLoad(msg, ItemId, OrderType); } } } }); } function BindItemsWithOptionsFlow() { var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; document.getElementById('tblCart').innerHTML = ""; var DropdownValues = localStorage.getItem("SelectedDropDown"); if (AddedItems != null) { var itemnew = ""; for (var g = 0; g < AddedItems.length; g++) { if (AddedItems[g].LId == document.getElementById('lblLId').value) { var itmvaritaions = ""; var itmoptions = ""; var itmtotal = ""; var itminstru = ""; var trItem = document.createElement("tr"); if (AddedItems[g].OfferName != null) { setAttributes(trItem, { "style": "color:#333333;", "class": unescape(AddedItems[g].OfferName.split("/")[1]), "align": "center", "id": AddedItems[g].Id, }); } else { setAttributes(trItem, { "style": "color:#333333;", "align": "center", "id": AddedItems[g].Id, }); } var tdItem = document.createElement("td"); setAttributes(tdItem, { "class": "Order_contnet1", "width": "50%", "id": AddedItems[g].ItemCategoryId, }); var lblItem = document.createElement("span"); setAttributes(lblItem, { "style": "cursor:pointer;", "onclick": "EditItemOptions(this);", "id": "EditItem" + g, "class": "CartItem" }); var UnitType = ""; if (AddedItems[g].PriceType == "Per Unit") { UnitType = " (" + AddedItems[g].ItemUnitQty + " " + AddedItems[g].UnitName + ")"; } if (AddedItems[g].NoSalesTax == "true" || AddedItems[g].CustomTax == "0") lblItem.innerHTML += AddedItems[g].Quantity + UnitType + " " + unescape(AddedItems[g].ItemName) + " (No Tax)"; else lblItem.innerHTML += AddedItems[g].Quantity + UnitType + " " + unescape(AddedItems[g].ItemName) + " (" + unescape(AddedItems[g].TaxLabel) + ": " + AddedItems[g].CustomTax + "%)"; var DeleteItem = document.createElement("img"); setAttributes(DeleteItem, { "src": "images/DeleteCartItem.png", "class": "DeleteBogoItem" + AddedItems[g].Id, "onclick": "DeleteItem(this);", "alt": "DeleteItem" + AddedItems[g].Id, "id": "DeleteItem" + g, "style": "padding-left:6px;cursor:pointer;vertical-align: middle;width: 12px;" }); tdItem.appendChild(lblItem); tdItem.appendChild(DeleteItem); var OrderType = localStorage.getItem("OrderType"); if (AddedItems[g].Variations != null) { if (AddedItems[g].Variations.length > 0) { for (var v = 0; v < AddedItems[g].Variations.length; v++) { var brvariation = document.createElement("br"); tdItem.appendChild(brvariation); var lblVariations = document.createElement("span"); lblVariations.innerHTML = AddedItems[g].Variations[v].Name; tdItem.appendChild(lblVariations); itmvaritaions = AddedItems[g].Variations[v].Name; } } } if (AddedItems[g].Choices != null) { if (AddedItems[g].Choices.length > 0) { var br = document.createElement("br"); tdItem.appendChild(br); var lblOptions = document.createElement("span"); setAttributes(lblOptions, { "style": "font-size:10px;", }); for (var d = 0; d < AddedItems[g].Choices.length; d++) { if(d > 0){ if(lblOptions.innerHTML.indexOf("<br> ",lblOptions.innerHTML.length-34) == -1) lblOptions.innerHTML += "<br> "; } else { lblOptions.innerHTML = " "; } if (AddedItems[g].Choices[d].Type != "Dropdown") { if (AddedItems[g].Choices[d].Notify == true) { if (AddedItems[g].Choices[d].ChoiceName != undefined) { var ChoicesQuantity = AddedItems[g].Choices[d].ChoicesQuantity; var Quantity = AddedItems[g].Choices[d].Quantity; if (Quantity == "0" || Quantity == undefined) Quantity = ""; if (d == 0) lblOptions.innerHTML += unescape(Quantity + " " + AddedItems[g].Choices[d].ChoiceName); else lblOptions.innerHTML += unescape(Quantity + " " + AddedItems[g].Choices[d].ChoiceName); if (ChoicesQuantity == "0" || ChoicesQuantity == undefined) ChoicesQuantity = ""; lblOptions.innerHTML += " " + ChoicesQuantity + "<br> "; var OptionId = ""; if (AddedItems[g].Choices[d].ChildChoices != undefined) { for (var W = 0; W < AddedItems[g].Choices[d].ChildChoices.length; W++) { if (AddedItems[g].Choices[d].ChildChoices[W].Notify == true) { if (AddedItems[g].Choices[d].ChildChoices[W].OptionId != OptionId) { if(lblOptions.innerHTML.indexOf("<br> ",lblOptions.innerHTML.length-34) == -1){ lblOptions.innerHTML += "<br> " + unescape(AddedItems[g].Choices[d].ChildChoices[W].ChoiceName); } else { lblOptions.innerHTML += " " + unescape(AddedItems[g].Choices[d].ChildChoices[W].ChoiceName); } } else{ lblOptions.innerHTML += "<br> " + unescape(AddedItems[g].Choices[d].ChildChoices[W].ChoiceName); } OptionId = AddedItems[g].Choices[d].ChildChoices[W].OptionId; } } } } else { if (AddedItems[g].Choices[d].Measurement != undefined) { if (AddedItems[g].Choices[d].Measurement != "Lbs") lblOptions.innerHTML += unescape(AddedItems[g].Choices[d].Weight * AddedItems[g].Quantity + " " + AddedItems[g].Choices[d].Measurement) + " (" + AddedItems[g].Choices[d].Conversation + ")" + "<br> "; else lblOptions.innerHTML += unescape(AddedItems[g].Choices[d].Weight * AddedItems[g].Quantity + " " + AddedItems[g].Choices[d].Measurement) + "<br> "; } } tdItem.appendChild(lblOptions); itmoptions = lblOptions.innerHTML; } } else if (AddedItems[g].Choices[d].Type == "Dropdown") { if (DropdownValues != null && DropdownValues != "") { var ddvalues = DropdownValues.split(","); for (var D = 0; D < ddvalues.length; D++) { var OptionId = ddvalues[D].split("/")[0]; if (OptionId == AddedItems[g].Choices[d].OptionId) { if (AddedItems[g].Choices[d].Notify == true) { if (AddedItems[g].Choices[d].ChoiceName != undefined) { var ChoicesQuantity = AddedItems[g].Choices[d].ChoicesQuantity; var Quantity = AddedItems[g].Choices[d].Quantity; if (Quantity == "0" || Quantity == undefined) Quantity = ""; if (d == 0) lblOptions.innerHTML += unescape(Quantity + " " + AddedItems[g].Choices[d].ChoiceName); else lblOptions.innerHTML += unescape(Quantity + " " + AddedItems[g].Choices[d].ChoiceName); if (ChoicesQuantity == "0" || ChoicesQuantity == undefined) ChoicesQuantity = ""; lblOptions.innerHTML += " " + ChoicesQuantity + "<br> "; var OptionId = ""; if (AddedItems[g].Choices[d].ChildChoices != undefined) { for (var W = 0; W < AddedItems[g].Choices[d].ChildChoices.length; W++) { if (AddedItems[g].Choices[d].ChildChoices[W].Notify == true) { if (AddedItems[g].Choices[d].ChildChoices[W].OptionId != OptionId) { if(lblOptions.innerHTML.indexOf("<br> ",lblOptions.innerHTML.length-34) == -1){ lblOptions.innerHTML += "<br> " + unescape(AddedItems[g].Choices[d].ChildChoices[W].ChoiceName); }else{ lblOptions.innerHTML += " " + unescape(AddedItems[g].Choices[d].ChildChoices[W].ChoiceName); } } else{ lblOptions.innerHTML += "<br> " + unescape(AddedItems[g].Choices[d].ChildChoices[W].ChoiceName); } OptionId = AddedItems[g].Choices[d].ChildChoices[W].OptionId; } } } } else { if (AddedItems[g].Choices[d].Measurement != undefined) { if (AddedItems[g].Choices[d].Measurement != "Lbs") lblOptions.innerHTML += unescape(AddedItems[g].Choices[d].Weight * AddedItems[g].Quantity + " " + AddedItems[g].Choices[d].Measurement) + " (" + AddedItems[g].Choices[d].Conversation + ")" + "<br> "; else lblOptions.innerHTML += unescape(AddedItems[g].Choices[d].Weight * AddedItems[g].Quantity + " " + AddedItems[g].Choices[d].Measurement) + "<br> "; } } tdItem.appendChild(lblOptions); itmoptions = lblOptions.innerHTML; } } } } } } } } if (AddedItems[g].OfferName != null) { var br = document.createElement("br"); tdItem.appendChild(br); var OfferName = document.createElement("span"); setAttributes(OfferName, { "style": "color:red;", "id": unescape(AddedItems[g].OfferName.split("/")[1]) }); OfferName.innerHTML += unescape(AddedItems[g].OfferName.split("/")[0]); tdItem.appendChild(OfferName); } if (AddedItems[g].Instructions != "") { var br = document.createElement("br"); tdItem.appendChild(br); var lblInstructions = document.createElement("span"); setAttributes(lblInstructions, { "style": "font-size:10.5px;", }); lblInstructions.innerHTML += "Instructions: " + unescape(AddedItems[g].Instructions); tdItem.appendChild(lblInstructions); if (AddedItems[g].Instructions != "Order instruction, suggestions") itminstru = "Instructions: " + unescape(AddedItems[g].Instructions); } trItem.appendChild(tdItem); var tdQuantity = document.createElement("td"); setAttributes(tdQuantity, { "class": "Order_contnet1", "style": "text-align:center;vertical-align:baseline;", "width": "10%" }); var lblQuantity = document.createElement("span"); lblQuantity.innerHTML += AddedItems[g].Quantity; var tdPrice = document.createElement("td"); setAttributes(tdPrice, { "class": "Order_contnet1", "style": "text-align:right;vertical-align:baseline;", "width": "10%" }); var lblPrice = document.createElement("span"); lblPrice.innerHTML += document.getElementById("lblCurrency").innerHTML + AddedItems[g].Price; document.getElementById("lblAlltotalprice").innerHTML = document.getElementById("lblCurrency").innerHTML + AddedItems[g].Price; tdPrice.appendChild(lblPrice); if (AddedItems[g].Choices != null) { if (AddedItems[g].Choices.length > 0) { var br = document.createElement("br"); tdItem.appendChild(br); var lblOptions = document.createElement("span"); setAttributes(lblOptions, { "style": "font-size:10px;", }); for (var d = 0; d < AddedItems[g].Choices.length; d++) { if(lblOptions.innerHTML.indexOf("<br>",lblOptions.innerHTML.length-4) == -1) lblOptions.innerHTML += "<br>"; if (AddedItems[g].Choices[d].Notify == true) { if (AddedItems[g].Choices[d].ChoiceName != undefined) { var ChoicesQuantity = AddedItems[g].Choices[d].ChoicesQuantity; var Quantity = AddedItems[g].Choices[d].Quantity; if (Quantity == "0" || Quantity == undefined) Quantity = ""; if (d == 0) lblOptions.innerHTML += document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].Price; else lblOptions.innerHTML += document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].Price; lblOptions.innerHTML += "<br>"; var OptionId = ""; if (AddedItems[g].Choices[d].ChildChoices != undefined) { for (var W = 0; W < AddedItems[g].Choices[d].ChildChoices.length; W++) { if (AddedItems[g].Choices[d].ChildChoices[W].Notify == true) { if (AddedItems[g].Choices[d].ChildChoices[W].OptionId != OptionId) { if(lblOptions.innerHTML.indexOf("<br>",lblOptions.innerHTML.length-4) == -1){ lblOptions.innerHTML += "<br>"+ document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].ChildChoices[W].Price; }else{ lblOptions.innerHTML += document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].ChildChoices[W].Price; } } else{ lblOptions.innerHTML += "<br>" + document.getElementById("lblCurrency").innerHTML + AddedItems[g].Choices[d].ChildChoices[W].Price; } OptionId = AddedItems[g].Choices[d].ChildChoices[W].OptionId; } } } } tdPrice.appendChild(lblOptions); } } } } itmtotal = lblPrice.innerHTML; document.getElementById("lbltotalamount").innerHTML = itmtotal; if (AddedItems[g].OfferName != null) { var br = document.createElement("br"); tdPrice.appendChild(br); var OfferValue = document.createElement("span"); setAttributes(OfferValue, { "style": "color:red;", "id": unescape(AddedItems[g].OfferName.split("/")[1]) }); OfferValue.innerHTML += document.getElementById("lblCurrency").innerHTML + AddedItems[g].OfferValue; tdPrice.appendChild(OfferValue); } if ($("#lblMenuTheme").val() != "Grid" && $("#lblMenuTheme").val() != "Grid-no-images" && $("#lblMenuTheme").val() != "New-Grid" && $("#lblMenuTheme").val() != "New-Grid-no-images") { trItem.appendChild(tdPrice); document.getElementById('tblCart').appendChild(trItem); } else { itemnew += "<tr id='" + AddedItems[g].Id + "'><td style='padding-left:14px'><span class='mncatfnt'>"; if (AddedItems[g].NoSalesTax == "true" || AddedItems[g].CustomTax == "0") itemnew += unescape(AddedItems[g].ItemName) + " (No Tax)</span>"; else itemnew += unescape(AddedItems[g].ItemName) + " (" + unescape(AddedItems[g].TaxLabel) + ": " + AddedItems[g].CustomTax + "%)</span>"; if (itmvaritaions != "") itemnew += "<div>" + itmvaritaions + "</div>"; if (itmoptions != "") itemnew += "<div>" + itmoptions + "</div>"; if (itminstru != "") itemnew += "<div style='font-size:12px'>" + itminstru + "</div>"; itemnew += "</td><td class='mncatwdth'>" + AddedItems[g].Quantity + UnitType + "</td><td class='mncatwdth1'>" + itmtotal + "</td>"; itemnew += "<td class='mncatwdth'><img src='images/EGreen.png' id='EditItem" + g + "' onclick='EditItemOptions(this)' style='margin-right:10px' /><img src='images/DeleteCartItem.png' alt='DeleteItem" + AddedItems[g].Id + "' id='DeleteItem" + g + "', onclick='DeleteItem(this)' /></td>"; itemnew += "</tr>"; if (AddedItems[g].OfferName != null) { itemnew += "<tr style='color:red'><td colspan='2'>" + unescape(AddedItems[g].OfferName) + "</td><td>" + document.getElementById("lblCurrency").innerHTML + AddedItems[g].OfferValue + "</td><td></td></tr>"; } if (g == AddedItems.length - 1) { document.getElementById('tblCart').innerHTML = itemnew; document.getElementById('itminfonew').innerHTML = ""; $("#itminfonew").removeClass("cartitemh"); document.getElementById('tblCart').innerHTML = "<tr><td style='padding-left:14px'>ITEM</td><td class='mncatwdth'>QTY</td><td>Price</td><td class='mncatwdth'>Edit</td></tr>" + itemnew; } } $(".displayonitem").css("display", "block"); if (localStorage.getItem("OrderType") == "DineInOnly") { // $(".yourordersteststyles").css("display", "none"); } else $(".yourordersteststyles").css("display", "inline-block"); } else { AddedItems.splice(g, 1); g--; } } localStorage["TotalItems"] = JSON.stringify(AddedItems); if (AddedItems.length == 0) { $(".displayonitem").css("display", "none"); localStorage.removeItem("TIntervel"); } if (AddedItems.length > 0) { if (DeliveryServicesCount > 0 && DeliveryService == "Show") { GetDeliveryServices(); } else { document.getElementById('tblDeliveryServices').innerHTML = ""; $(".dlvservices").css("display", "none"); $("#divdeliServicesRight").css("display", "none"); } $('.carright').css("display", "block"); //$(".urscart").css("width", $(".carright").width() + "px"); $(".Emptycart").css("display", "none"); $(".cartitems").css("display", "block"); var paymenttype = document.getElementById('onlinepayment').innerHTML; if (paymenttype == "Online Payment: No") { $(".promocodetext").css("display", "none"); $(".getdealbtn").css("display", "none"); $(".getdealbtn").fadeOut("slow"); $(".bntSubmittip").css("display", "none"); } var OrderType = localStorage.getItem("OrderType"); if (OrderType == "Delivery" || OrderType == "Shipping") { var UId = document.getElementById("UserId").innerHTML; if (UId != "" && UId != null) GetSavedAddress(); } } else { document.getElementById('tblDeliveryServices').innerHTML = ""; $(".dlvservices").css("display", "none"); if (DeliveryServicesCount > 0 && DeliveryService == "Show") { $("#divdeliServicesRight").css("display", "block"); } else { $("#divdeliServicesRight").css("display", "none"); } if ($("#lblMenuTheme").val() == "Grid" || $("#lblMenuTheme").val() == "Grid-no-images" || $("#lblMenuTheme").val() == "New-Grid" || $("#lblMenuTheme").val() == "New-Grid-no-images") { $(".scrollcart").removeClass("mncatnewpopup"); $(".carright").removeClass("mncatnewpopupsub"); $(".scrollcart").css("display", "none"); $("body").removeAttr("style"); $("body").attr("style",PageBackgroundColor); } else { $(".scrollcart").css("display", "block"); $('.carright').css("display", "block"); //$(".urscart").css("width", $(".carright").width() + "px"); $(".Emptycart").css("display", "block"); $(".cartitems").css("display", "none"); } } setQuantitytoCart(); } else { $('.carright').css("display", "block"); //$(".urscart").css("width", $(".carright").width() + "px"); $(".Emptycart").css("display", "block"); $(".cartitems").css("display", "none"); if ($("#lblMenuTheme").val() == "Grid" || $("#lblMenuTheme").val() == "Grid-no-images" || $("#lblMenuTheme").val() == "New-Grid" || $("#lblMenuTheme").val() == "New-Grid-no-images") { $(".scrollcart").removeClass("mncatnewpopup"); $(".carright").removeClass("mncatnewpopupsub"); $(".scrollcart").css("display", "none"); $("body").removeAttr("style"); $("body").attr("style",PageBackgroundColor); } else { $(".scrollcart").css("display", "block"); } document.getElementById("lblitemcount").innerHTML = "0"; document.getElementById("lblcartcount").innerText = "0"; var clength = "0"; $.ajax({ type: "POST", url: "Orders.aspx/SetSession", data: "{'Value': '" + clength + "'}", dataType: "json", contentType: "application/json", success: function (msg) { } }); } //if (window.innerWidth > 767) { // if ($("#lblMenuTheme").val() != "Grid") { // var scrollposition = $(window).scrollTop(); // var cartheight = $(".carright").css("height"); // var cartheight1 = $(".carright").height(); // var carttop = scrollposition - cartheight1; // if (carttop < 0) // carttop = 0; // else // carttop = carttop + 150; // if (window.location !== window.parent.location) { // //$(".carright").css({ "margin-top": "0px" }); // } // else { // if (carttop != 0) // $(".carright").css({ "margin-top": (carttop) + "px" }); // } // //$(".carright").css({ "margin-top": ($(window).scrollTop() / 2) + "px" }); // } // } SetOrderType(); if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); } MobileCArt(); } function OverrideCollapse(Id) { var ImageId = $(Id).attr("id"); var Imagesrc = $("#" + ImageId).attr('src'); var Collapseid = ImageId.replace("Collapseimg", ""); if (Imagesrc == "https://orderem.com/images/Sortdown.png") { $("#" + ImageId).attr('src', 'https://orderem.com/images/Sortup.png'); $(".Collapserow" + Collapseid).css("display", ""); } else { $("#" + ImageId).attr('src', 'https://orderem.com/images/Sortdown.png'); $(".Collapserow" + Collapseid).css("display", "none"); } } function CartDineIn() { var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; var StorageLocationId = ""; var LocationId = document.getElementById('lblLId').value; var SubTotal = 0; if (GroupId != null && GroupId != "" && GroupId != undefined) { retrievedData = localStorage.getItem("OtherMembersItems"); } else { var retrievedData = localStorage.getItem("TotalItems"); } var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { if (AddedItems.length > 0) { if (GroupId != null && GroupId != "" && GroupId != undefined) { if (AddedItems[0].GroupItems.length > 0) { StorageLocationId = AddedItems[0].GroupItems[0].LId; } } else { StorageLocationId = AddedItems[0].LId; } } } if (StorageLocationId == LocationId || StorageLocationId == "") { document.getElementById('tblUserDrivers').innerHTML = ""; document.getElementById('tblDrivers').innerHTML = ""; localStorage.removeItem("OrderType"); localStorage.removeItem("GroupOrderType"); localStorage.setItem("OrderType", $(".rbtdinein").text()); localStorage.setItem("GroupOrderType", $(".rbtdinein").text()); $("#ddlOrderType").val($(".rbtdinein").text()); if (GroupId != null && GroupId != "" && GroupId != undefined) { GetDealinGroupOrder(); } else { GetDeal(); //if (document.getElementById("lblitemflowtype").innerHTML == "true") { BindItemsWithOptionsFlow(); } //else { BindItems(); // } } } else { $("#lblorderror").text("Sorry you are trying to place an order with multiple restaurants. Once refresh the page and try again"); $(".ordererror").show().delay(3000).fadeOut(); $(".userdeliveryloader1").fadeOut("fast"); return; } } function BindDineInUserDetails() { var FirstName = document.getElementById("txtdinefname").value.trim(); var LastName = document.getElementById("txtdinelname").value.trim(); var Email = document.getElementById("txtdineemail").value.trim(); var PhoneNo = document.getElementById("txtdinephn").value.trim(); var TableNo = document.getElementById("txtdinetable").value.trim(); if(FirstName!=""&&LastName!="") document.getElementById("txtguestdeliveryname").value = FirstName + " " + LastName; else if(FirstName != "") document.getElementById("txtguestdeliveryname").value = FirstName; else if(LastName != "") document.getElementById("txtguestdeliveryname").value = LastName; document.getElementById("txtguestdeliveryemail").value = Email; document.getElementById("txtmobilenumber").value = PhoneNo; document.getElementById("dineintableid").value = TableNo; var UrlType = document.getElementById('lblurlnametype').innerHTML; var ddlOrderType = document.getElementById("ddlOrderType"); var OrderType = ddlOrderType.options[ddlOrderType.selectedIndex].text; var OrderTypevalue = ddlOrderType.options[ddlOrderType.selectedIndex].value; if (UrlType == "DineIn" && OrderType == "DineIn"){ RequiredDineInFeilds(); } else { $("#txtguestdeliveryemail").css("display", "block"); $("#txtmobilenumber").css("display", "block"); $("#txtguestdeliveryname").css("display", "block"); $(".advancedineinsettings").css("display", "none"); } } function CheckOutItem() { $("#btnmakeitcombo").css("display", "none"); $("#itemflowcolumns").css("display", "none"); $(".btncomboloaderdiv").css("display", "block"); $("#ItemImageDisplay").css("display", "none"); document.getElementById("flowoptbtnerror").innerHTML=""; var OrderType = localStorage.getItem("OrderType"); var ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; document.getElementById("additemserror").innerHTML = ""; var DisplayedretrivedOptions = localStorage.getItem("ShowingItemOptions"); var PreviousScreenId = localStorage.getItem("PreviousScreenId"); PreviousScreenId = Number(PreviousScreenId); var DisplayedOptions; if (DisplayedretrivedOptions != null) { DisplayedOptions = JSON.parse(DisplayedretrivedOptions); } var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].ItemId == document.getElementById("lblItemId").innerHTML.split('//')[0]) { } else { var sPath = window.location.pathname; $("#lblordalert").text("Something went wrong"); $(".orderalert").fadeIn(); //$(".btnloaderdiv").delay(3000).fadeOut(); //$(".addtocartdiv").delay(3000).fadeIn(); window.location.href = sPath; } } var retrievedData = localStorage.getItem("TotalItems"); var ItemCount = 0; if (retrievedData != "undefined") { var AddedItems = JSON.parse(retrievedData); var Itemdetails = document.getElementById("lblItemId").innerHTML.split('//'); if (AddedItems != null) { if (AddedItems.length > 0) { if (document.getElementById("lblItemType").innerHTML == "EditItem") { var Id = document.getElementById("EditItemNum").innerHTML.replace("EditItem", ""); for (var cou = 0; cou < AddedItems.length; cou++) { if (Id != cou) { if (AddedItems[cou].Id == Itemdetails[0]) { ItemCount = parseInt(AddedItems[cou].Quantity) + ItemCount; } } } } else { for (var cou = 0; cou < AddedItems.length; cou++) { if (AddedItems[cou].Id == Itemdetails[0]) { ItemCount = parseInt(AddedItems[cou].Quantity) + ItemCount; } } } } } } var Qu = parseInt(document.getElementById('txtquantity').value); ItemCount = ItemCount + Qu; if (ItemCount > parseInt(localStorage.getItem("ItemAvailability"))) { document.getElementById("additemserror").innerHTML = "Available only " + localStorage.getItem("ItemAvailability") + " item(s)"; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } var ddlvariation = $(".ddlVariation"); if (ddlvariation.length > 0) { if (ddlvariation[0].options[ddlvariation[0].selectedIndex].text == "Select Variation") { document.getElementById("additemserror").innerHTML = "Choose Variation"; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].MinSize; var H = 0; $("input[name='Choiceradio" + OptionsCheck[J].Id + "']:checked").each(function () { H++; }); var Minval = parseInt(Minvalue) if (H >= Minval) { document.getElementById("additemserror").innerHTML = ""; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify + "/" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return false; } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].MinSize; var H = 0; $("input[name='Choiceradio" + OptionsCheck[J].Id + "']:checked").each(function () { H++; }); var Minval = parseInt(Minvalue) if (H >= Minval) { document.getElementById("additemserror").innerHTML = ""; for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify + "/" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return false; } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify + "/" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify + "/" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Flow Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify + "/" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Flow Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } else { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (OptionsCheck[J].Choices[F].Exist == true) { if (OptionsCheck[J].Choices[F].ChildOptions != null) { for (var L = 0; L < OptionsCheck[J].Choices[F].ChildOptions.length; L++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Radio Buttons") { if ($("input[name=Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "]:checked").val() == undefined) { $(".Addtocartloading").css("display", "none"); document.getElementById("additemserror").innerHTML = "Please select atleast one item from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "CheckBoxes") { var Minvalue = OptionsCheck[J].Choices[F].ChildOptions[L].MinSize; var ChO = 0; $("input[name='Choiceradio" + OptionsCheck[J].Choices[F].Id + "" + OptionsCheck[J].Choices[F].ChildOptions[L].Id + "']:checked").each(function () { ChO++; }); var Minval = parseInt(Minvalue) if (ChO >= Minval) { document.getElementById("additemserror").innerHTML = ""; } else { document.getElementById("additemserror").innerHTML = "Please select atleast " + Minvalue + " item(s) from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return false; } } if (OptionsCheck[J].Choices[F].ChildOptions[L].Type == "Dropdown") { if ($('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Choices[F].ChildOptions[L].Name; return; } else { for (var U = 0; U < OptionsCheck[J].Choices[F].ChildOptions[L].Choices.length; U++) { if (OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Id == $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").val()) { var NotifyVal = OptionsCheck[J].Choices[F].Notify + "/" + OptionsCheck[J].Choices[F].ChildOptions[L].Choices[U].Notify; } } var text = OptionsCheck[J].Choices[F].ChildOptions[L].Id + "/" + $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Choices[F].ChildOptions[L].Id).val(); } } } } } } } } } } } } } } for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Dropdown") { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if ($('#' + OptionsCheck[J].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } else { for (var U = 0; U < OptionsCheck[J].Choices.length; U++) { if (OptionsCheck[J].Choices[U].Id == $('#' + OptionsCheck[J].Id).children("option").filter(":selected").val()) { var NotifyVal = true + "/" + OptionsCheck[J].Choices[U].Notify; } } var text = OptionsCheck[J].Id + "/" + $('#' + OptionsCheck[J].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Id).val(); } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].Type == "Dropdown") { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if ($('#' + OptionsCheck[J].Id).val() == "") { document.getElementById("additemserror").innerHTML = "Please select from " + OptionsCheck[J].Name; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } else { for (var U = 0; U < OptionsCheck[J].Choices.length; U++) { if (OptionsCheck[J].Choices[U].Id == $('#' + OptionsCheck[J].Id).children("option").filter(":selected").val()) { var NotifyVal = true + "/" + OptionsCheck[J].Choices[U].Notify; } } var text = OptionsCheck[J].Id + "/" + $('#' + OptionsCheck[J].Id).children("option").filter(":selected").text() + "/" + NotifyVal; var PreviouSelectedtDropdown = localStorage.getItem("SelectedDropDown"); if (PreviouSelectedtDropdown != null && PreviouSelectedtDropdown != "") { localStorage.setItem("SelectedDropDown", PreviouSelectedtDropdown + "," + text); } else { localStorage.setItem("SelectedDropDown", text); } } $('#' + OptionsCheck[J].Id).val(); } } } } } } } } var B = 0; for (var J = 0; J < OptionsCheck.length; J++) { if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "") { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #C22727"; document.getElementById("additemserror").innerHTML = "Please enter quantity "; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); B++; } else if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "0") { document.getElementById("additemserror").innerHTML = "Quantity should be greater than zero"; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); B++; } else { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #b9bcbe"; } } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "") { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #C22727"; document.getElementById("additemserror").innerHTML = "Please enter quantity "; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); B++; } else if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value == "0") { document.getElementById("additemserror").innerHTML = "Quantity should be greater than zero"; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); B++; } else { document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).style.border = "1px solid #b9bcbe"; } } } } } } } } } } if (B > 0) { return; } for (var J = 0; J < OptionsCheck.length; J++) { var TotalQuantity = 0; if (DisplayedOptions != null) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { if (DisplayedOptions.OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value != "") { var quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; TotalQuantity = +quantity + +TotalQuantity; } } } var SelectionQuantity = OptionsCheck[J].QuantitySelection; if (TotalQuantity == SelectionQuantity) { } else { document.getElementById("additemserror").innerHTML = "Quantity doesn't match"; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } } } if (DisplayedOptions.MultiplescreenOptions != null) { for (var Q = 0; Q < DisplayedOptions.MultiplescreenOptions.length; Q++) { if (DisplayedOptions.MultiplescreenOptions[Q].OptionId == OptionsCheck[J].Id) { if (OptionsCheck[J].OptionQuantity == true) { if ($("#ScreenId" + PreviousScreenId).css('display') != 'none') { for (var F = 0; F < OptionsCheck[J].Choices.length; F++) { if ($('#' + OptionsCheck[J].Choices[F].Id).is(':checked')) { if (document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value != "") { var quantity = document.getElementById("Quantity" + OptionsCheck[J].Choices[F].Id).value; TotalQuantity = +quantity + +TotalQuantity; } } } var SelectionQuantity = OptionsCheck[J].QuantitySelection; if (TotalQuantity == SelectionQuantity) { } else { document.getElementById("additemserror").innerHTML = "Quantity doesn't match"; $(".btncomboloaderdiv").delay(3000).fadeOut(); $("#btnmakeitcombo").delay(3000).fadeIn(); return; } } } } } } } } } $(".backtooptions").css("display", "block"); $("#itemflowcolumns").css("display", "none"); var Orderstring = getQueryStrings(); var Orderstring = getQueryStrings(); var GroupId = Orderstring["GroupId"]; if (GroupId != null && GroupId != "" && GroupId != undefined) { AddItemstoCartinGrouporder(OptionsCheck); } else { AddItemstoCart(OptionsCheck, ""); setTimeout(function () { LoadCrossSellItems(); }, 5000); } gettotalprice(); } $(document).ready(function() { var AppId = document.getElementById('lblAppId1').value; var LocationId = document.getElementById('lblLId').value; if(AppId=="5fdef4ff-59b6-4470-a535-16ecffc4880b") { $(".iframe").css("margin-top", "-30px"); } GetCardSettings(); var QueryString = getQueryStrings(); if(window.self !== window.top){ if(window.location != window.parent.location){ if (QueryString["Login"] == "true") { $.ajax({ type: "POST", url: "Orders.aspx/SessionLogin", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { $("#signinpanel").css("display","none"); $("#btnFbLogin").css("display","block"); $(".fblogindiv").css("display","block"); $(".gmaildiv1").css("display","block"); $("#btngmaillogin").css("display","block"); $(".welback2").css("display","block"); $("#CompanyRegistrepnl").css("margin-top","0px"); $("#lnkbtnaccount1").css("display","none"); $("#lnkbtnaccount").css("display","block"); } else { $("#signinpanel").css("display","block"); $("#lnkbtnaccount1").css("display","table-column"); $("#lnkbtnaccount1").css("height","38px"); $("#lnkbtnaccount1").css("margin-bottom","8px"); $("#lnkbtnaccount").css("display","none"); $("#btnFbLogin").css("display","none"); $(".fblogindiv").css("display","none"); $(".gmaildiv1").css("display","none"); $("#btngmaillogin").css("display","none"); $("#txtEmail").css("margin-bottom","8px"); $("#txtEmail").css("margin-top","5px"); $("#txtPwd").css("margin-bottom","8px"); $("#txtPwd").css("margin-top","5px"); $("#imgpwd").css("margin-top","12px"); $(".welback2").css("display","none"); $("#CompanyRegistrepnl").css("margin-top","70px"); } } }); } } } }); function GotoMyAccount() { var LocationId = document.getElementById("lblLId").value; if (window.self !== window.top) { if (window.parent.location != window.location) { //$(".iframe").attr("src","../MyProfile.aspx?LocationId=" + LocationId); window.location.href = "../MyProfile.aspx?LocationId=" + LocationId; } } } function CloseVehiclePnl(){ $("#addVehicle").css("display","none"); } function VehicleType(ids) { if(ids.id == "Other"){ $("#othervehicletype").css("display","table-cell"); }else { $("#othervehicletype").css("display","none"); } } /* new color picker okay button click action */ var parentBasic = document.getElementsByClassName("basic2"); var popupBasic, popupCustom, popupShared, pickerFixed, popupShadow; for (var i = 0; i < parentBasic.length; i++) { /* Basic example */ popupBasic = new Picker(parentBasic[i]); popupBasic.onDone = function (color) { var Id = localStorage.getItem("OtherVehicleColorId"); var lblid = localStorage.getItem("OtherVehicleTypeColorId"); $("#" + Id).css("background-color", color.hex.substring(0,7)); if (lblid != null && lblid != "") $("#" + lblid).val(color.hex.substring(0,7)); ApplyvehicleColor(); }; } $("#vechicleclrpikr").click(function () { $("#OtherColorType").prop("checked", true); localStorage.removeItem("OtherVehicleColorId"); localStorage.removeItem("OtherVehicleTypeColorId"); localStorage.setItem("OtherVehicleColorId", this.id); localStorage.setItem("OtherVehicleTypeColorId", "hdnvechicleclrpikr"); var parentBasic = document.getElementById("hdnvechicleclrpikr").value; popupBasic = new Picker(parentBasic); popupBasic.openHandler(); var colors = document.getElementById('hdnvechicleclrpikr').value; document.getElementsByClassName("picker_editor input").value = colors; }); function ApplyvehicleColor() { var SectionColor = $("#hdnvechicleclrpikr").val(); $("#vechicleclrpikr").css("background",SectionColor); } function GetAllFeatures() { var AppId = document.getElementById('lblAppId1').value; $(".vehicledetlsdiv").css("display","none"); document.getElementById('lblVehicleDetails').innerHTML = "false"; $.ajax({ type: "POST", url: "Orders.aspx/GetFeatures", data: "", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { for (var i = 0; i < msg.d.length; i++) { if (msg.d[i].FeatureToMerchantsList.length > 0) { for (var k = 0; k < msg.d[i].FeatureToMerchantsList.length; k++) { if (msg.d[i].FeatureToMerchantsList[k].AppId != "00000000-0000-0000-0000-000000000000") { if (AppId == msg.d[i].FeatureToMerchantsList[k].AppId) { if (msg.d[i].FeatureName == "CCP") { $(".vehicledetlsdiv").css("display","block"); document.getElementById('lblVehicleDetails').innerHTML = "true"; } } } else { if (msg.d[i].FeatureName == "CCP") { $(".vehicledetlsdiv").css("display","block"); document.getElementById('lblVehicleDetails').innerHTML = "true"; } } } } } } } }); } function AddVehicle() { $(".savevehicledetaills").css("display","none"); $(".savevehicledtlldr").css("display","block"); var UId = document.getElementById("UserId").innerHTML; var VehicleType = $("input:radio[name=vehicletype]:checked").val(); if (VehicleType == undefined) { document.getElementById("lblvehicleclrerr").innerHTML = "Please select vehicle type"; $("#lblvehicleclrerr").css("display","block"); $(".savevehicledetaills").css("display","block"); $(".savevehicledtlldr").css("display","none"); return; } else { document.getElementById("lblvehicleclrerr").innerHTML = ""; $("#lblvehicleclrerr").css("display","none"); } var Vehiclecolor = $("input:radio[name=vehicleclr]:checked").val(); if (Vehiclecolor == undefined) { document.getElementById("lblvehicleclrerr").innerHTML = "Please select color"; $("#lblvehicleclrerr").css("display","block"); $(".savevehicledetaills").css("display","block"); $(".savevehicledtlldr").css("display","none"); return; } else { document.getElementById("lblvehicleclrerr").innerHTML = ""; $("#lblvehicleclrerr").css("display","none"); } var vehicleclrcode = document.getElementsByName('vehicleclr'); var VehicleColorCode = ""; for(var i = 0; i < vehicleclrcode.length; i++){ if(vehicleclrcode[i].checked){ VehicleColorCode = vehicleclrcode[i].title; } } var VehicleOtherType = ""; if (VehicleType == "Other") { VehicleOtherType = document.getElementById("othervehicletype").value.trim(); if (VehicleOtherType == "") { $("#othervehicletype").css("border","1px solid red"); $(".savevehicledetaills").css("display","block"); $(".savevehicledtlldr").css("display","none"); return; } else { $("#othervehicletype").css("border","1px solid #ccc"); } } var VehicleTypeOther = ""; if (Vehiclecolor == "Other") { VehicleTypeOther = document.getElementById('hdnvechicleclrpikr').value; if (VehicleTypeOther == "") { document.getElementById("lblvehicleclrerr").innerHTML = "Please select color"; $("#lblvehicleclrerr").css("display","block"); $(".savevehicledetaills").css("display","block"); $(".savevehicledtlldr").css("display","none"); return; } else { document.getElementById("lblvehicleclrerr").innerHTML = ""; VehicleColorCode = VehicleTypeOther; $("#lblvehicleclrerr").css("display","none"); } } if (UId != null && UId != "") { $.ajax({ type: "POST", url: "Orders.aspx/InsertVehicleDetails", data: "{'UserId': '" + UId + "','VehicleType':'"+ VehicleType +"','VehicleOtherType': '" + VehicleOtherType + "','Vehiclecolor':'"+ Vehiclecolor +"','VehicleColorCode': '" + VehicleColorCode + "','VehicleTypeOther':'"+ VehicleTypeOther +"'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d != "") { alertify.set({ labels: { ok: "Ok" } }); alertify.alert(msg.d); GetVehicleDetails(); CloseVehiclePnl(); $(".savevehicledetaills").css("display","block"); $(".savevehicledtlldr").css("display","none"); } } }); } else { $(".savevehicledetaills").css("display","block"); $(".savevehicledtlldr").css("display","none"); } } function GetVehicleDetails() { var UId = document.getElementById("UserId").innerHTML; $("#divvehicledtls").css("display","none"); if (UId != null && UId != ""){ $.ajax({ type: "POST", url: "Orders.aspx/GetVehicleDetails", data: "{'UserId': '" + UId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { $("#ddlVehicleDetails").empty(); $("#divvehicledtls").css("display","block"); var ddlVehicleDetails = document.getElementById("ddlVehicleDetails"); var optmin2 = document.createElement("option"); optmin2.value = "--Select Vehicle Details--"; optmin2.text = "--Select Vehicle Details--"; ddlVehicleDetails.options.add(optmin2); for (var l = 0; l < msg.d.length; l++) { var optmin2 = document.createElement("option"); optmin2.value = msg.d[l].VehicleColorCode + '&' + msg.d[l].VehicleType; optmin2.text = msg.d[l].VehicleColorCode + ' ' + msg.d[l].VehicleType; ddlVehicleDetails.options.add(optmin2); } $("#lbladdvehicledtls").css("display","none"); $("#lbladdanothervehicledtls").css("display","block"); document.getElementById("tblAllVehicleDetails").innerHTML = ""; var vhcltype = ""; var tbl = $('<tbody></tbody>'); $.each(msg.d, function (k, v) { if (this.VehicleType.toLowerCase() == "car") { vhcltype = "<div class='ddlcntnrvhcldiv'><div class='subcntnrvhcldiv'><div class='ddlvhcleclrdiv' style='background-color:"+this.VehicleColorCode+";'></div><lable style='text-align:center;padding-top:5px'>"+this.Vehiclecolor+"</lable></div> <span><img src='/images/CAR.png' class='ddlvhicleimg' alt='"+this.VehicleType+"'/></span></div>"; } else if (this.VehicleType.toLowerCase() == "suv") { vhcltype = "<div class='ddlcntnrvhcldiv'><div class='subcntnrvhcldiv'><div class='ddlvhcleclrdiv' style='background-color:"+this.VehicleColorCode+";'></div><lable style='text-align:center;padding-top:5px'>"+this.Vehiclecolor+"</lable></div> <span><img src='/images/SUV.png' class='ddlvhicleimg' alt='"+this.VehicleType+"'/></span></div>"; } else if (this.VehicleType.toLowerCase() == "truck") { vhcltype = "<div class='ddlcntnrvhcldiv'><div class='subcntnrvhcldiv'><div class='ddlvhcleclrdiv' style='background-color:"+this.VehicleColorCode+";'></div><lable style='text-align:center;padding-top:5px'>"+this.Vehiclecolor+"</lable></div> <span><img src='/images/TRUCK.png' class='ddlvhicleimg' alt='"+this.VehicleType+"'/></span></div>"; } else if (this.VehicleType.toLowerCase() == "van") { vhcltype = "<div class='ddlcntnrvhcldiv'><div class='subcntnrvhcldiv'><div class='ddlvhcleclrdiv' style='background-color:"+this.VehicleColorCode+";'></div><lable style='text-align:center;padding-top:5px'>"+this.Vehiclecolor+"</lable></div> <span><img src='/images/VAN.png' class='ddlvhicleimg' alt='"+this.VehicleType+"'/></span></div>"; } else if (this.VehicleType.toLowerCase() == "bike") { vhcltype = "<div class='ddlcntnrvhcldiv'><div class='subcntnrvhcldiv'><div class='ddlvhcleclrdiv' style='background-color:"+this.VehicleColorCode+";'></div><lable style='text-align:center;padding-top:5px'>"+this.Vehiclecolor+"</lable></div> <span><img src='/images/BIKE.png' class='ddlvhicleimg' alt='"+this.VehicleType+"'/></span></div>"; } else if (this.VehicleType.toLowerCase() == "semi") { vhcltype = "<div class='ddlcntnrvhcldiv'><div class='subcntnrvhcldiv'><div class='ddlvhcleclrdiv' style='background-color:"+this.VehicleColorCode+";'></div><lable style='text-align:center;padding-top:5px'>"+this.Vehiclecolor+"</lable></div> <span><img src='/images/SEMI.png' class='ddlvhicleimg' alt='"+this.VehicleType+"'/></span></div>"; } else { vhcltype = "<div class='ddlcntnrvhcldiv'><div class='subcntnrvhcldiv'><div class='ddlvhcleclrdiv' style='background-color:"+this.VehicleColorCode+";'></div><lable style='text-align:center;padding-top:5px'>"+this.Vehiclecolor+"</lable></div> <div class='divvehicletype'>"+this.VehicleType+"</div></div>"; } tbl.append($('<tr></tr>').append($('<td></td>').append($('<input>').attr({ type: 'radio', name: 'rdovhclslct', value: this.VehicleColorCode + '&' +this.VehicleType+ '&' +this.Vehiclecolor, class:'rdovhcltype',onchange:'SelectVehicleType(this)', id:this.Id })).append($('<label>').attr({ for: this.Id }).append((vhcltype))))); }); $("#tblAllVehicleDetails").append(tbl); } else { $("#divvehicledtls").css("display","none"); $("#lbladdvehicledtls").css("display","block"); $("#lbladdanothervehicledtls").css("display","none"); } } }); } } function OpenVehiclepnl() { $("input:radio[name=vehicletype]").attr("checked", false); $("input:radio[name=vehicleclr]").attr("checked", false); $("#hdnvechicleclrpikr").val(''); ApplyvehicleColor(); $("#addVehicle").css("display","block"); $("#addVehicle #modal-behind").css("z-index","1000"); window.parent.scrollTo(0, 0); window.scrollTo(0, 0); } function SelectVehicleType(ids) { var selectedvhcltype = ids.value.split('&'); $("#ddlVehicleDetails").val(selectedvhcltype[0]+'&'+selectedvhcltype[1]).trigger('change').prop('selected', true); $("#vechicledivcontainer").css("display","none"); document.getElementById("divslctvhcldtls").innerHTML = ""; if (selectedvhcltype[1].toLowerCase() == "car") { vhcltype = "<div class='ddlcntnrvhcldiv'><div class='subcntnrvhcldiv'><div class='ddlvhcleclrdiv' style='background-color:"+selectedvhcltype[0]+";'></div><lable style='text-align:center;padding-top:5px'>"+selectedvhcltype[2]+"</lable></div> <span><img src='/images/CAR.png' class='ddlvhicleimg' alt='"+selectedvhcltype[1]+"'/></span></div>"; } else if (selectedvhcltype[1].toLowerCase() == "suv") { vhcltype = "<div class='ddlcntnrvhcldiv'><div class='subcntnrvhcldiv'><div class='ddlvhcleclrdiv' style='background-color:"+selectedvhcltype[0]+";'></div><lable style='text-align:center;padding-top:5px'>"+selectedvhcltype[2]+"</lable></div> <span><img src='/images/SUV.png' class='ddlvhicleimg' alt='"+selectedvhcltype[1]+"'/></span></div>"; } else if (selectedvhcltype[1].toLowerCase() == "truck") { vhcltype = "<div class='ddlcntnrvhcldiv'><div class='subcntnrvhcldiv'><div class='ddlvhcleclrdiv' style='background-color:"+selectedvhcltype[0]+";'></div><lable style='text-align:center;padding-top:5px'>"+selectedvhcltype[2]+"</lable></div> <span><img src='/images/TRUCK.png' class='ddlvhicleimg' alt='"+selectedvhcltype[1]+"'/></span></div>"; } else if (selectedvhcltype[1].toLowerCase() == "van") { vhcltype = "<div class='ddlcntnrvhcldiv'><div class='subcntnrvhcldiv'><div class='ddlvhcleclrdiv' style='background-color:"+selectedvhcltype[0]+";'></div><lable style='text-align:center;padding-top:5px'>"+selectedvhcltype[2]+"</lable></div> <span><img src='/images/VAN.png' class='ddlvhicleimg' alt='"+selectedvhcltype[1]+"'/></span></div>"; } else if (selectedvhcltype[1].toLowerCase() == "bike") { vhcltype = "<div class='ddlcntnrvhcldiv'><div class='subcntnrvhcldiv'><div class='ddlvhcleclrdiv' style='background-color:"+selectedvhcltype[0]+";'></div><lable style='text-align:center;padding-top:5px'>"+selectedvhcltype[2]+"</lable></div> <span><img src='/images/BIKE.png' class='ddlvhicleimg' alt='"+selectedvhcltype[1]+"'/></span></div>"; } else if (selectedvhcltype[1].toLowerCase() == "semi") { vhcltype = "<div class='ddlcntnrvhcldiv'><div class='subcntnrvhcldiv'><div class='ddlvhcleclrdiv' style='background-color:"+selectedvhcltype[0]+";'></div><lable style='text-align:center;padding-top:5px'>"+selectedvhcltype[2]+"</lable></div> <span><img src='/images/SEMI.png' class='ddlvhicleimg' alt='"+selectedvhcltype[1]+"'/></span></div>"; } else { vhcltype = "<div class='ddlcntnrvhcldiv'><div class='subcntnrvhcldiv'><div class='ddlvhcleclrdiv' style='background-color:"+selectedvhcltype[0]+";'></div><lable style='text-align:center;padding-top:5px'>"+selectedvhcltype[2]+"</lable></div> <div class='divvehicletype'>"+selectedvhcltype[1]+"</div></div>"; } document.getElementById("divslctvhcldtls").innerHTML = vhcltype; } var Isclicked = false; function SelectVehicleDetails() { $("#vechicledivcontainer").css("display","block"); Isclicked = true; } $('body').click(function (e) { if (Isclicked == false) { var ck = 0; if ($('.content1').is(':hover')) { ck = 1; } if (ck != 1) { $(".content1").css("display", "none"); Isclicked = true; } } else { Isclicked = false; } }); function NoBindForParentRadio(Id) { //var SelectedId = $(Id).attr("id"); //$("#" + SelectedId).prop('checked', false); document.getElementById("flowoptbtnerror").innerHTML = "Choices not found for this option"; $(".pricetext").css("display", "block"); } function OptionsFlowBindChildOptions(Child, Itemcount) { var ChoiceId = $(Child).attr("id"); var OptionId = $(Child.parentNode.parentNode).attr("id"); var R=0; if (document.getElementById("childOption" + ChoiceId) != null) { var childExisttr = document.getElementById("childOption" + ChoiceId); $.ajax({ type: "POST", url: "Orders.aspx/GetChildOptions", data: "{'OptionId': '" + OptionId + "','ChoiceId': '" + ChoiceId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById("childOption" + ChoiceId).innerHTML = ""; if (msg.d.length > 0) { var childExisttd = document.createElement("td"); ///////////ChildOptions for (var H = 0; H < msg.d.length; H++) { var tableChildOption = document.createElement("table"); tableChildOption.setAttribute("class", "optionChildRow"); var trChildOption = document.createElement("tr"); trChildOption.setAttribute("style", "font-weight:bold;"); var tdChildOption = document.createElement("td"); setAttributes(tdChildOption, { "class": "Optiontd", "colspan": "3" }); var lblChildOption = document.createElement("span"); lblChildOption.setAttribute("style", "float:left;"); lblChildOption.innerHTML += msg.d[H].OptionName; lblChildOption.setAttribute("id", "ChildOption" + msg.d[H].OptionId); tdChildOption.appendChild(lblChildOption); if (msg.d[H].Type == "CheckBoxes") { if (msg.d[H].MaxSize > 0) { if (msg.d[H].MaxSize != 100 && msg.d[H].MaxSize != msg.d[H].Choice.length) { var lblChildOptionSelection = document.createElement("span"); setAttributes(lblChildOptionSelection, { "style": "padding-left:5px;color:red;display:none;" + OptionTextColor, "id": "ItemOptionSelection" + msg.d[H].OptionId }); lblChildOptionSelection.innerHTML += "(Max Selection: " + msg.d[H].MaxSize + ")"; tdChildOption.appendChild(lblChildOptionSelection); } } if (msg.d[H].MinSize > 0) { if (msg.d[H].MinSize != 100 && msg.d[H].MinSize != msg.d[H].Choice.length) { if (document.getElementById("choiceselect").innerHTML == "") { document.getElementById("choiceselect").innerHTML = msg.d[H].OptionId; } else { document.getElementById("choiceselect").innerHTML = document.getElementById("choiceselect").innerHTML + "," + msg.d[H].OptionId } var lblChildOptionSelection = document.createElement("span"); setAttributes(lblChildOptionSelection, { "style": "padding-left:5px;color:red;" + OptionTextColor, "id": "ItemOptionSelectionMin" + msg.d[H].OptionId, "class": "ItemOptionSelectionMin" }); lblChildOptionSelection.innerHTML += "(Min Selection: " + msg.d[H].MinSize + ")"; tdChildOption.appendChild(lblChildOptionSelection); } } } trChildOption.appendChild(tdChildOption); tableChildOption.appendChild(trChildOption); var ChildOption = new Object; ChildOption.Type = msg.d[H].Type; ChildOption.Id = msg.d[H].OptionId; ChildOption.MinSize = msg.d[H].MinSize; ChildOption.MaxSize = msg.d[H].MaxSize; ChildOption.FreeOptions = msg.d[H].FreeOptions; ChildOption.Name = msg.d[H].OptionName; ChildOption.DefaultOptionText = msg.d[H].DefaultOptionText; ChildOption.Choices = new Array(); if (msg.d[H].Type == "Radio Buttons" || msg.d[H].Type == "CheckBoxes") { for (G = 0; G < msg.d[H].Choice.length; G++) { var Choice = new Object; Choice.Id = msg.d[H].Choice[G].Id; Choice.Name = msg.d[H].Choice[G].ChoiceName; Choice.Notify = msg.d[H].Choice[G].Notify; Choice.DefaultVSOption = msg.d[H].Choice[G].DefaultVSOption; Choice.Price = msg.d[H].Choice[G].Price.toFixed(2); Choice.FreeOptions = "No"; Choice.SelectionCount = 0; ChildOption.Choices.push(Choice); var trChildChoice = document.createElement("tr"); setAttributes(trChildChoice, { "class": "optionname", "style": "color:" + OptionTextColor, "id": msg.d[H].OptionId }); var tdChildChoice = document.createElement("td"); setAttributes(tdChildChoice, { "class": "Choicetd", "align": "left" }); var lblChildChoice = document.createElement("label"); lblChildChoice.innerHTML += msg.d[H].Choice[G].ChoiceName; setAttributes(lblChildChoice, { "title": msg.d[H].Choice[G].ChoiceName, "for": ChoiceId + "" + msg.d[H].Choice[G].Id, "style": "cursor:pointer;" }); var Price = 0; if (msg.d[H].Choice[G].Price != Price.toFixed(2)) { lblChildChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + msg.d[H].Choice[G].Price.toFixed(2) + ")"; } var UrlType = document.getElementById('lblurlnametype').innerHTML; if (UrlType == "DineIn") { if (document.getElementById("lblAllowcart").innerHTML == "true") { //setAttributes(lblChildChoice, { "style": "background:none;" }); } else { setAttributes(lblChildChoice, { "style": "background:none;" }); } } if (msg.d[H].Type == "Radio Buttons") { if (tdChildOption.innerHTML.indexOf("Required") != -1) { } else { if(R ==0){ tdChildOption.innerHTML += "<span style='float:left;color:red;padding-left:5px;' class='requiredimg'>(Req)</span>"; R++; } } var childradio = document.createElement("input"); if (msg.d[H].Choice[G].DefaultVSOption == true) { setAttributes(childradio, { "type": "radio", "class": "Validate", "checked": "true", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); } else { setAttributes(childradio, { "type": "radio", "class": "Validate", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); } tdChildChoice.appendChild(childradio); } if (msg.d[H].Type == "CheckBoxes") { var childcheckbox = document.createElement("input"); if (msg.d[H].Choice[G].DefaultVSOption == true) { setAttributes(childcheckbox, { "type": "checkbox", "class": "Validate", "checked": "true", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); } else { setAttributes(childcheckbox, { "type": "checkbox", "class": "Validate", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); } if (msg.d[H].MaxSize > 0) { childcheckbox.setAttribute("onclick", "LimitChildOptionsSelection(this);"); } tdChildChoice.appendChild(childcheckbox); } if (msg.d[H].Type == "Radio Buttons" || msg.d[H].Type == "CheckBoxes") { if (msg.d[H].Choice[G].ChoiceImageURL != null && msg.d[H].Choice[G].ChoiceImageURL != "") { var lblChildChoiceimg = document.createElement("label"); setAttributes(lblChildChoiceimg, { "class": "Choicetdimg", "title": msg.d[H].Choice[G].ChoiceName, "for": ChoiceId + "" + msg.d[H].Choice[G].Id, "style": "cursor:pointer;" }); lblChildChoiceimg.innerHTML = "<img class='choiceimage', alt='Choice Image', id='Choiceimg" + msg.d[H].Choice[G].Id + "', title='" + msg.d[H].Choice[G].ChoiceImageURL + "' , src='" + msg.d[H].Choice[G].ChoiceImageURL + "' />"; setAttributes(lblChildChoice, { "style": "float:left" }); tdChildChoice.appendChild(lblChildChoiceimg); } } tdChildChoice.appendChild(lblChildChoice); trChildChoice.appendChild(tdChildChoice); tableChildOption.appendChild(trChildChoice); } } if (msg.d[H].Type == "Dropdown") { var trChoice = document.createElement("tr"); setAttributes(trChoice, { "style": "font-weight:bold;" }); setAttributes(trChoice, { "class": "dropdowncs" }); var tdChoice = document.createElement("td"); setAttributes(tdChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var ddlOption = document.createElement("select"); setAttributes(ddlOption, { "style": "width: auto;height: 25px;margin-top:10px;max-width:60%", "id": msg.d[H].OptionId, "class": "ddlChildOption Validate", "onchange": "gettotalprice()" }); for (var S = 0; S < msg.d[H].Choice.length; S++) { var Choice = new Object; Choice.Id = msg.d[H].Choice[S].Id; Choice.Name = msg.d[H].Choice[S].ChoiceName; Choice.Notify = msg.d[H].Choice[S].Notify; Choice.DefaultVSOption = msg.d[H].Choice[S].DefaultVSOption; Choice.Price = msg.d[H].Choice[S].Price.toFixed(2); Choice.FreeOptions = "No"; Choice.SelectionCount = 0; ChildOption.Choices.push(Choice); ddlOption.options.add(new Option(msg.d[H].Choice[S].ChoiceName + " " + document.getElementById("lblCurrency").innerHTML + msg.d[H].Choice[S].Price, msg.d[H].Choice[S].Id)); } tdChoice.appendChild(ddlOption); trChoice.appendChild(tdChoice); tableChildOption.appendChild(trChoice); //Options.push(option); //if (msg.d[i].Choice.length > 0) { // lblrequired.innerHTML += "<span style='float:right;color:red;'>Required</span>"; //} } if (msg.d[H].Type == "Flow Buttons") { var ScreenId = localStorage.getItem("ScreenId"); for (G = 0; G < msg.d[H].Choice.length; G++) { var Choice = new Object; Choice.Id = msg.d[H].Choice[G].Id; Choice.Name = msg.d[H].Choice[G].ChoiceName; Choice.Notify = msg.d[H].Choice[G].Notify; Choice.DefaultVSOption = msg.d[H].Choice[G].DefaultVSOption; Choice.Price = msg.d[H].Choice[G].Price.toFixed(2); Choice.FreeOptions = "No"; Choice.SelectionCount = 0; ChildOption.Choices.push(Choice); var trChildChoice = document.createElement("tr"); setAttributes(trChildChoice, { "class": "optionname flowbuttons", "style": "color:" + OptionTextColor, "id": msg.d[H].OptionId, "name": "flowbuttons" }); var tdChildChoice = document.createElement("td"); setAttributes(tdChildChoice, { "class": "Choicetd", "align": "left", "id": "ScreenId" + ScreenId }); var lblChildChoice = document.createElement("label"); lblChildChoice.innerHTML += msg.d[H].Choice[G].ChoiceName; if (document.getElementById('lblLId').value == "305f3f06-fbb4-437e-8090-db6046a96a7f" || document.getElementById('lblLId').value == "e9354e34-c551-43e2-adda-763bdc86b771") { if (msg.d[H].Choice[G].Active == true) { setAttributes(lblChildChoice, { "title": msg.d[H].Choice[G].ChoiceName, "for": ChoiceId + "" + msg.d[H].Choice[G].Id, "style": ButtonColor, "class": "flowoptbtns" }); } else { setAttributes(lblChildChoice, { "title": msg.d[H].Choice[G].ChoiceName, "for": ChoiceId + "" + msg.d[H].Choice[G].Id, "style": "background: -webkit-gradient(linear,left top,left bottom,color-stop(0.05,lightgrey),color-stop(1,lightgrey)) !important;border: 1px solid lightgrey !important;-webkit-box-shadow: 0 0 2px 0 lightgrey !important;'" + ButtonColor + "'", "class": "flowoptbtns" }); } } else { setAttributes(lblChildChoice, { "title": msg.d[H].Choice[G].ChoiceName, "for": ChoiceId + "" + msg.d[H].Choice[G].Id, "style": ButtonColor, "class": "flowoptbtns" }); } var Price = 0; if (msg.d[H].Choice[G].Price != Price.toFixed(2)) { lblChildChoice.innerHTML += " (+" + document.getElementById("lblCurrency").innerHTML + msg.d[H].Choice[G].Price.toFixed(2) + ")"; } var UrlType = document.getElementById('lblurlnametype').innerHTML; if (UrlType == "DineIn") { if (document.getElementById("lblAllowcart").innerHTML == "true") { //setAttributes(lblChildChoice, { "style": "background:none;" }); } else { setAttributes(lblChildChoice, { "style": "background:none;" }); } } if (msg.d[H].Type == "Radio Buttons") { if (tdChildOption.innerHTML.indexOf("Required") != -1) { } else { if(R ==0){ tdChildOption.innerHTML += "<span style='float:left;color:red;padding-left:5px;' class='requiredimg'>(Req)</span>"; R++; } } var childradio = document.createElement("input"); if (msg.d[H].Choice[G].DefaultVSOption == true) { setAttributes(childradio, { "type": "radio", "class": "Validate", "checked": "true", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); } else { setAttributes(childradio, { "type": "radio", "class": "Validate", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); } tdChildChoice.appendChild(childradio); } if (msg.d[H].Type == "Flow Buttons") { if (tdChildOption.innerHTML.indexOf("Required") != -1) { } else { if(R ==0){ tdChildOption.innerHTML += "<span style='float:left;color:red;padding-left:5px;' class='requiredimg'>(Req)</span>"; R++; } } var childradio = document.createElement("input"); if (msg.d[H].Choice[G].DefaultVSOption == true) { setAttributes(childradio, { "type": "radio", "class": "Validate", "checked": "true", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); } else { setAttributes(childradio, { "type": "radio", "class": "Validate", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); } tdChildChoice.appendChild(childradio); } if (msg.d[H].Type == "CheckBoxes") { var childcheckbox = document.createElement("input"); if (msg.d[H].Choice[G].DefaultVSOption == true) { setAttributes(childcheckbox, { "type": "checkbox", "class": "Validate", "checked": "true", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); } else { setAttributes(childcheckbox, { "type": "checkbox", "class": "Validate", "Name": "Choiceradio" + ChoiceId + "" + msg.d[H].OptionId, "value": msg.d[H].Choice[G].Price.toFixed(2), "id": ChoiceId + "" + msg.d[H].Choice[G].Id, "onclick": "gettotalprice();", "style": "cursor:pointer;" }); } if (msg.d[H].MaxSize > 0) { childcheckbox.setAttribute("onclick", "LimitChildOptionsSelection(this);"); } tdChildChoice.appendChild(childcheckbox); } if (msg.d[H].Type != "Flow Buttons") { if (msg.d[H].Choice[G].ChoiceImageURL != null && msg.d[H].Choice[G].ChoiceImageURL != "") { var lblChildChoiceimg = document.createElement("label"); setAttributes(lblChildChoiceimg, { "class": "Choicetdimg", "title": msg.d[H].Choice[G].ChoiceName, "for": ChoiceId + "" + msg.d[H].Choice[G].Id, "style": "cursor:pointer;" }); lblChildChoiceimg.innerHTML = "<img class='choiceimage', alt='Choice Image', id='Choiceimg" + msg.d[H].Choice[G].Id + "', title='" + msg.d[H].Choice[G].ChoiceImageURL + "' , src='" + msg.d[H].Choice[G].ChoiceImageURL + "' />"; setAttributes(lblChildChoice, { "style": "float:left" }); tdChildChoice.appendChild(lblChildChoiceimg); } } tdChildChoice.appendChild(lblChildChoice); trChildChoice.appendChild(tdChildChoice); tableChildOption.appendChild(trChildChoice); } } if (msg.d[H].Type == "Multiline Textbox") { var trChildChoice = document.createElement("tr"); setAttributes(trChildChoice, { "style": "font-weight:bold;" }); var tdChildChoice = document.createElement("td"); setAttributes(tdChildChoice, { "style": "Padding-Bottom:8px;Height:1px;Width:10%;text-align:left;border-top:none;border-right:none;", "align": "left" }); var childtextbox = document.createElement("textarea"); setAttributes(childtextbox, { "class": "Choicetext", "id": ChoiceId + msg.d[H].OptionId }); tdChildChoice.appendChild(childtextbox); trChildChoice.appendChild(tdChildChoice); tableChildOption.appendChild(trChildChoice); } childExisttd.appendChild(tableChildOption); var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); for (var J = 0; J < OptionsCheck.length; J++) { if (OptionsCheck[J].Id == OptionId) { for (var D = 0; D < OptionsCheck[J].Choices.length; D++) { if (D == 0) { if (OptionsCheck[J].Choices[D].ChildOptions == undefined) { OptionsCheck[J].Choices[D].ChildOptions = new Array(); } } if (OptionsCheck[J].Choices[D].Id == ChoiceId) { if (OptionsCheck[J].Choices[D].ChildOptions == undefined) { OptionsCheck[J].Choices[D].ChildOptions = new Array(); } OptionsCheck[J].Choices[D].ChildOptions.push(ChildOption); localStorage.setItem("OptionCheck", JSON.stringify(OptionsCheck)); } } } } } } childExisttr.appendChild(childExisttd); gettotalprice(); var ReqImage = document.createElement("img"); setAttributes(ReqImage, { "src": "images/requredimg.png", "style": "width: 15px;margin-top: 5px;", "alt": "required" }); $(".requiredimg").text(''); $(".requiredimg").append(ReqImage); $(".optionalimg").each(function () { $(this).text(''); }); } if (document.getElementById("lblItemType").innerHTML == "EditItem") { if (Itemcount != 100) { var retrievedData = localStorage.getItem("TotalItems"); var AddedItems = JSON.parse(retrievedData); if (AddedItems != null) { for (var j = 0; j < AddedItems[Itemcount].Choices.length; j++) { if (AddedItems[Itemcount].Choices[j].Id == ChoiceId) { if (AddedItems[Itemcount].Choices[j].ChildChoices != undefined) { for (var k = 0; k < AddedItems[Itemcount].Choices[j].ChildChoices.length; k++) { if (AddedItems[Itemcount].Choices[j].ChildChoices[k].Id != "") { $('#' + AddedItems[Itemcount].Choices[j].Id + AddedItems[Itemcount].Choices[j].ChildChoices[k].Id).attr('checked', true); } else { document.getElementById(AddedItems[Itemcount].Choices[j].Id + "" + AddedItems[Itemcount].Choices[j].ChildChoices[k].OptionId).value = unescape(AddedItems[Itemcount].Choices[j].ChildChoices[k].ChoiceName); } } } } } } var forID = $("label[for='" + ChoiceId + "']"); if (forID != undefined) { if ($("label[for='" + ChoiceId + "']").hasClass("Choicetdimg")) { if ($(forID[1].childNodes[1]).attr("src") == "images/childExpand.png") { $(forID[1].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[1].childNodes[1]).attr("alt", "Collapse"); } } else { if ($(forID[0].childNodes[1]).attr("src") == "images/childExpand.png") { $(forID[0].childNodes[1]).attr("src", "images/childCollapse.png"); $(forID[0].childNodes[1]).attr("alt", "Collapse"); } } } } ///FreeOptions FreeOptionCount = 0; var highest = Number.NEGATIVE_INFINITY; var retrievedOptions = localStorage.getItem("OptionCheck"); var OptionsCheck; if (retrievedOptions != null) { OptionsCheck = JSON.parse(retrievedOptions); } for (var j = 0; j < AddedItems[Itemcount].Choices.length; j++) { if (AddedItems[Itemcount].Choices[j].ChildChoices != undefined) { for (var W = 0; W < AddedItems[Itemcount].Choices[j].ChildChoices.length; W++) { for (var J = 0; J < OptionsCheck.length; J++) { for (var K = 0; K < OptionsCheck[J].Choices.length; K++) { if (OptionsCheck[J].Choices[K].ChildOptions != undefined) { for (var M = 0; M < OptionsCheck[J].Choices[K].ChildOptions.length; M++) { if (OptionsCheck[J].Choices[K].ChildOptions[M].Id == AddedItems[Itemcount].Choices[j].ChildChoices[W].OptionId) { for (var U = 0; U < OptionsCheck[J].Choices[K].ChildOptions[M].Choices.length; U++) { if (OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].Id == AddedItems[Itemcount].Choices[j].ChildChoices[W].Id) { OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].FreeOptions = AddedItems[Itemcount].Choices[j].ChildChoices[W].FreeOptions; OptionsCheck[J].Choices[K].ChildOptions[M].Choices[U].SelectionCount = AddedItems[Itemcount].Choices[j].ChildChoices[W].SelectionCount; tmp = OptionsCheck[J].Choices[H].SelectionCount; if (tmp > highest) { highest = tmp; } } } } } } } } } } } if (highest = Number.NEGATIVE_INFINITY) { FreeOptionCount = highest; } localStorage.setItem("OptionCheck", JSON.stringify(OptionsCheck)); ///FreeOptions } } }); } } function MenuNewDesign1() { var LocationId = document.getElementById('lblLId').value; var AppId = document.getElementById('lblAppId1').value; var UserOrderType = ""; var Orderstring = getQueryStrings(); var Type = Orderstring["Type"]; if (Type != undefined) UserOrderType = Type; var ItemId = Orderstring["ItemId"]; if (ItemId == undefined) { $(".addcategoryloadingimage").css("display", "block"); $.ajax({ type: "POST", url: "Orders.aspx/GetCategoryItemsNamesByCategoryId", data: "{'LocationId': '" + LocationId + "','AppId': '" + AppId + "','OrderType': '" + UserOrderType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var CategoryId; var CatName; document.getElementById('Itemstable').innerHTML = ""; if (msg.d.length > 0) { var maincatdiv = ""; var CName=0;var categoryName = ""; var cstatus = false;var catdesc = ""; for (var i = 0; i < msg.d.length; i++) { maincatdiv +="<div class='menucontainer'>"; if (categoryName != msg.d[i].CategoryName) { categoryName = msg.d[i].CategoryName; var viewonlysty = "display:none"; if (msg.d[i].CategoryViewOnly == true){ cstatus = true; viewonlysty = "display:block"; } if (msg.d[i].CategoryDescription != "") { catdesc = "<br><span class='subcatcdes line-clamp' style='"+CategoryBold+";"+CategoryFontFamily+";"+CategoryTextColor+";"+CategoryBgColor+"'>" + msg.d[i].CategoryDescription + "</span>"; } CName = 0; } else { CName++; } if(CName==0) { maincatdiv += "<div class='catname line-clamp' Status='" + cstatus + "' style= '"+SubMenuColors+"'>" + msg.d[i].CategoryName + "<span class='mncatview' style='"+viewonlysty+"'>View Only</span>"+catdesc+"</div>"; } var sbctdesc =""; if (msg.d[i].Description != "") { sbctdesc = "<br><span class='subcatcdes line-clamp' style='"+CategoryBold+";"+CategoryFontFamily+";"+CategoryTextColor+";"+CategoryBgColor+"'>" + msg.d[i].Description + "</span>"; } // maincatdiv += "<div class='subcatname line-clamp' style='" + SubMenuColors + "' Status='false'>" + msg.d[i].Name + ""+sbctdesc+"</div>"; CatName = msg.d[i].Name; maincatdiv += "<div class='eachsubcategoryrow' id='eachsubcategoryrow"+msg.d[i].Id+"'>"; if(msg.d[i].SubCategoryItems != null){ if(msg.d[i].SubCategoryItems.length >0){ maincatdiv += "<div class='subcatname line-clamp' style='" + SubMenuColors + "' Status='false'>" + msg.d[i].Name + ""+sbctdesc+"</div>"; for (var SubCategoryItems = 0; SubCategoryItems < msg.d[i].SubCategoryItems.length; SubCategoryItems++) { CategoryId = msg.d[i].SubCategoryItems[SubCategoryItems].CategoryId; if (SubCategoryItems <= 3) { maincatdiv += "<div class='eachsubcategoryitems'>"; } else { maincatdiv += "<div class='eachsubcategoryitems allsubcatitems"+msg.d[i].Id+"' id='allsubcatitems"+msg.d[i].Id+"' style='display:none'>"; } if (msg.d[i].SubCategoryItems[SubCategoryItems].ThumbnailURL != null) maincatdiv += "<div class='itemimgdiv'><img class='allitemimage' style='border:none;' alt='" + msg.d[i].SubCategoryItems[SubCategoryItems].Name + "' src='" + msg.d[i].SubCategoryItems[SubCategoryItems].ImageUrl + "' id='" + msg.d[i].SubCategoryItems[SubCategoryItems].Id + "' onclick='GetItemOptions(this);' /></div>"; else maincatdiv += "<div class='itemimgdiv'><img class='allitemimage' style='border:none;' alt='" + msg.d[i].SubCategoryItems[SubCategoryItems].Name + "' src='images/noitemImg.png' id='" + msg.d[i].SubCategoryItems[SubCategoryItems].Id + "' onclick='GetItemOptions(this);' /></div>"; maincatdiv += "<div class='textsdiv'>"; maincatdiv += "<div class='catitemname line-clamp itemnametxt' style='"+ItemNamestyles+"'>" + msg.d[i].SubCategoryItems[SubCategoryItems].Name + "</div>"; maincatdiv += "<div class='catitemprice' style='" + PriceColor + "'>" + document.getElementById("lblCurrency").innerHTML + msg.d[i].SubCategoryItems[SubCategoryItems].VariantPrice + "</div>"; maincatdiv += "<div class='catitemprice'><label id='qty" + msg.d[i].SubCategoryItems[SubCategoryItems].Id + "' style='margin-left:5px;display:none;'>NoQuantity</label></div>"; maincatdiv += "<div class='catitembtn'><input class='itemsbtndiv' style='"+MenuButtonColor+"' name='" + msg.d[i].SubCategoryItems[SubCategoryItems].CategoryName + "' type='button' id='" + msg.d[i].SubCategoryItems[SubCategoryItems].Id + "' value='Select Options' onclick='GetItemOptions(this);'></div>"; maincatdiv += "</div>"; maincatdiv += "</div>"; //if (SubCategoryItems == 3) { // maincatdiv += "</div>"; // maincatdiv += "</div>"; //} } maincatdiv += "</div>"; maincatdiv += "</div>"; if(msg.d[i].SubCategoryItems.length > 4){ var ctdc = ""; if (msg.d[i].Description != null) { ctdc = msg.d[i].Description; } maincatdiv += "<div data-desc-type='"+ctdc+"' class='viewalldiv' id='subcatitemsdiv"+msg.d[i].Id+"'><input class='viewtxtbtn' name='"+CatName+"' type='button' id='" + msg.d[i].Id + "' style='cursor:pointer' value='View All' onclick='ViewAllItems(this);'></div>"; maincatdiv += "<div data-desc-type='"+ctdc+"' class='viewalldiv' id='subcatitemsdivviewless"+msg.d[i].Id+"' style='display:none'><input class='viewtxtbtn' name='"+CatName+"' type='button' id='viewless" + msg.d[i].Id + "' style='cursor:pointer' value='View Less' onclick='ViewLessItems(this);'></div>"; } } } maincatdiv +="</div>"; } document.getElementById('Itemstable').innerHTML += maincatdiv; $(".fcontainer").css("display", "block"); if ($("#lblMenuTheme").val() == "Grid-no-images" || $("#lblMenuTheme").val() == "New-Grid-no-images") { $(".allitemimage").attr('src','images/noitemImg.png'); $(".allitemimage").css('background-color','white'); } $(".addcategoryloadingimage").css("display", "none"); } else { $(".addcategoryloadingimage").css("display", "none"); } } }); } else { $(".addcategoryloadingimage").css("display", "none"); } $("#Itemstable").css("width", "90%"); $("#Itemstable").css("margin", "0 auto"); //$(".addcategoryloadingimage").css("display", "none"); } function ViewAllItems(ids) { $(".allsubcatitems"+ids.id).css("display","block"); $("#subcatitemsdiv"+ids.id).css("display","none"); $("#subcatitemsdivviewless"+ids.id).css("display","block"); } function ViewLessItems(ids) { var catid = ids.id.replace("viewless",""); $(".allsubcatitems"+catid).css("display","none"); $("#subcatitemsdiv"+catid).css("display","block"); $("#subcatitemsdivviewless"+catid).css("display","none"); var id = "#eachsubcategoryrow"+catid; $('html,body').animate({ scrollTop: $(id).offset().top }, 1000); } function GetAllItemsByCategory(id,prntids) { var Id = $(id).attr("id"); var desc = ""; desc = prntids.dataset.descType; var CatName = $(id).attr("name"); var pattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i; var UserOrderType = ""; $(".addcategoryloadingimage").css("display", "block"); $.ajax({ type: "POST", url: "Orders.aspx/GetCategoryItemsByCategoryId", data: "{'CategoryId': '" + Id + "','OrderType': '" + UserOrderType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { document.getElementById('Itemstable').innerHTML = ""; var maincatdiv = ""; if (msg.d.length > 0) { maincatdiv += "<div class='eachcatrow'>"; var sbctdesc =""; if (desc != "") { sbctdesc = "<br><span class='subcatcdes line-clamp' style='"+CategoryBold+";"+CategoryFontFamily+";"+CategoryTextColor+";"+CategoryBgColor+"'>" + desc + "</span>"; } maincatdiv += "<div class='Categorytitle line-clamp' style= '"+SubMenuColors+"'>"+ CatName + ""+sbctdesc+"</div>"; for (var i = 0; i < msg.d.length; i++) { maincatdiv += "<div class='eachcategory'>"; if (msg.d[i].ThumbnailURL != null) maincatdiv += "<div class='itemimgdiv'><img class='allitemimage' alt='"+msg.d[i].Name+"' src='" + msg.d[i].ImageUrl + "' id='" + msg.d[i].Id + "' onclick='GetItemOptions(this);' /></div>"; else maincatdiv += "<div class='itemimgdiv'><img class='allitemimage' alt='"+msg.d[i].Name+"' src='images/noitemImg.png' id='" + msg.d[i].Id + "' onclick='GetItemOptions(this);' /></div>"; maincatdiv += "<div class='textsdiv'>"; maincatdiv += "<div class='catitemname line-clamp itemnametxt' style='"+ItemNamestyles+"'>" + msg.d[i].Name + "</div>"; maincatdiv += "<div class='catitemprice' style='" + PriceColor + "'>" + document.getElementById("lblCurrency").innerHTML + msg.d[i].VariantPrice + "</div>"; maincatdiv += "<div class='catitemprice'><label id='qty" + msg.d[i].Id + "' style='margin-left:5px;display:none;'>NoQuantity</label></div>"; maincatdiv += "<div class='catitembtn'><input class='itemsbtndiv' type='button' id='" + msg.d[i].Id + "' style='"+MenuButtonColor+"' value='Select Options' onclick='GetItemOptions(this);'></div>"; maincatdiv += "</div>"; maincatdiv += "</div>"; } maincatdiv += "</div>"; maincatdiv += "<div class='allcatdivs'><input class='itemsbtndiv' type='button' value='Back To All Categories' onclick='MenuNewDesign1()' style='"+MenuButtonColor+"'></div>"; } document.getElementById('Itemstable').innerHTML = maincatdiv; } }); $("#Itemstable").css("width", "90%"); $("#Itemstable").css("margin", "0 auto"); $(".addcategoryloadingimage").css("display", "none"); } function MenuNewGridDesignSearchItems(msg){ var CatIdList = "";var CategoryId=""; document.getElementById('Itemstable').innerHTML = ""; maincatdiv += "<div class='eachsubcategoryrow'>"; if(msg.d.length > 0){ for (var i = 0; i < msg.d.length; i++){ if (msg.d[i].EntityType == "Category"){ var maincatdiv = ""; var Submaincatdiv = ""; var CategoryName,CatDesc="",viewonly = false; var EntityType = msg.d[i].EntityType; CategoryName = msg.d[i].Name.replace("'S", "S").replace("'s", "s"); CatDesc = msg.d[i].Description; if(msg.d[i].ViewOnly == true) viewonly = true; $.ajax({ type: "POST", url: "Orders.aspx/GetSearchCategoryItemsNamesByCategoryId", data: "{'CategoryId': '" + msg.d[i].Id + "','OrderType': '','CategoryName': '" + CategoryName + "','EntityType': '" + EntityType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var CategoryId; var CatName; if (msg.d.length > 0) { var CName=0; var cstatus = false;var catdesc = ""; if (CatDesc != "") { catdesc = "<br><span class='subcatcdes line-clamp' style='"+CategoryBold+";"+CategoryFontFamily+";"+CategoryTextColor+";"+CategoryBgColor+"'>" + CatDesc + "</span>"; } for (var i = 0; i < msg.d.length; i++) { maincatdiv = "";var viewonlysty = "display:none"; if (viewonly == true){ cstatus = true; viewonlysty = "display:block"; } if(CName==0) { if(msg) maincatdiv += "<div class='catname line-clamp' Status='" + cstatus + "' style= '"+SubMenuColors+"'>" + msg.d[0].CategoryName + "<span class='mncatview' style='"+viewonlysty+"'>View Only</span>"+catdesc+"</div>"; CName++; } var sbctdesc =""; if (msg.d[i].Description != "") { sbctdesc = "<br><span class='subcatcdes line-clamp' style='"+CategoryBold+";"+CategoryFontFamily+";"+CategoryTextColor+";"+CategoryBgColor+"'>" + msg.d[i].Description + "</span>"; } maincatdiv += "<div class='subcatname line-clamp' style='" + SubMenuColors + "' Status='false'>" + msg.d[i].Name + ""+sbctdesc+"</div>"; CategoryId = msg.d[i].Id; CatName = msg.d[i].Name; maincatdiv += "<div class='eachsubcategoryrow' id='eachsubcategoryrow"+ CategoryId +"'>"; if(msg.d[i].SubCategoryItems != null){ if(msg.d[i].SubCategoryItems.length >0){ for (var SubCategoryItems = 0; SubCategoryItems < msg.d[i].SubCategoryItems.length; SubCategoryItems++) { if (SubCategoryItems <= 3) { maincatdiv += "<div class='eachsubcategoryitems'>"; } else { maincatdiv += "<div class='eachsubcategoryitems allsubcatitems"+CategoryId+"' id='allsubcatitems"+CategoryId+"' style='display:none'>"; } if (msg.d[i].SubCategoryItems[SubCategoryItems].ImageUrl != null) maincatdiv += "<div class='itemimgdiv'><img class='allitemimage' style='border:none;' alt='" + msg.d[i].SubCategoryItems[SubCategoryItems].Name + "' src='" + msg.d[i].SubCategoryItems[SubCategoryItems].ImageUrl + "' id='" + msg.d[i].SubCategoryItems[SubCategoryItems].Id + "' onclick='GetItemOptions(this);' /></div>"; else maincatdiv += "<div class='itemimgdiv'><img class='allitemimage' style='border:none;' alt='" + msg.d[i].SubCategoryItems[SubCategoryItems].Name + "' src='images/noitemImg.png' id='" + msg.d[i].SubCategoryItems[SubCategoryItems].Id + "' onclick='GetItemOptions(this);' /></div>"; maincatdiv += "<div class='textsdiv'>"; maincatdiv += "<div class='catitemname line-clamp itemnametxt' style='"+ItemNamestyles+"'>" + msg.d[i].SubCategoryItems[SubCategoryItems].Name + "</div>"; maincatdiv += "<div class='catitemprice' style='" + PriceColor + "'>" + document.getElementById("lblCurrency").innerHTML + msg.d[i].SubCategoryItems[SubCategoryItems].VariantPrice + "</div>"; maincatdiv += "<div class='catitemprice'><label id='qty" + msg.d[i].SubCategoryItems[SubCategoryItems].Id + "' style='margin-left:5px;display:none;'>NoQuantity</label></div>"; maincatdiv += "<div class='catitembtn'><input class='itemsbtndiv' style='"+MenuButtonColor+"' name='" + msg.d[i].SubCategoryItems[SubCategoryItems].CategoryName + "' type='button' id='" + msg.d[i].SubCategoryItems[SubCategoryItems].Id + "' value='Select Options' onclick='GetItemOptions(this);'></div>"; maincatdiv += "</div>"; maincatdiv += "</div>"; } maincatdiv += "</div>"; maincatdiv += "</div>"; if(msg.d[i].SubCategoryItems.length > 4){ var ctdc = ""; if (msg.d[i].Description != null) { ctdc = msg.d[i].Description; } maincatdiv += "<div data-desc-type='"+ctdc+"' class='viewalldiv' id='subcatitemsdiv"+CategoryId+"'><input class='viewtxtbtn' name='"+CatName+"' type='button' id='" + CategoryId + "' style='cursor:pointer' value='View All' onclick='ViewAllItems(this);'></div>"; maincatdiv += "<div data-desc-type='"+ctdc+"' class='viewalldiv' id='subcatitemsdivviewless"+CategoryId+"' style='display:none'><input class='viewtxtbtn' name='"+CatName+"' type='button' id='viewless" + CategoryId + "' style='cursor:pointer' value='View Less' onclick='ViewLessItems(this);'></div>"; } document.getElementById('Itemstable').innerHTML += maincatdiv; } } } } } }); } else if (msg.d[i].EntityType == "SubCategory"){ var maincatdiv = ""; var Submaincatdiv = ""; var CategoryName,CatDesc="",viewonly = false; var EntityType = msg.d[i].EntityType; CategoryName = msg.d[i].Name.replace("'S", "S").replace("'s", "s"); CatDesc = msg.d[i].Description; if(msg.d[i].ViewOnly == true) viewonly = true; $.ajax({ type: "POST", url: "Orders.aspx/GetSearchSubCategoryItemsNamesByCategoryId", data: "{'CategoryId': '" + msg.d[i].Id + "','OrderType': '','CategoryName': '" + CategoryName + "','EntityType': '" + EntityType + "'}", dataType: "json", contentType: "application/json", success: function (msg) { var maincatdiv = ""; if (msg.d.length > 0) { maincatdiv += "<div class='eachcatrow'>"; var sbctdesc =""; if(msg.d != null){ if (CatDesc != "") { sbctdesc = "<br><span class='subcatcdes line-clamp' style='"+CategoryBold+";"+CategoryFontFamily+";"+CategoryTextColor+";"+CategoryBgColor+"'>" + CatDesc + "</span>"; } maincatdiv += "<div class='Categorytitle line-clamp' style= '"+SubMenuColors+"'>"+ msg.d[0].CategoryName + ""+sbctdesc+"</div>"; for (var i = 0; i < msg.d.length; i++) { maincatdiv += "<div class='eachcategory'>"; if (msg.d[i].ImageUrl != null) maincatdiv += "<div class='itemimgdiv'><img class='allitemimage' style='border:none;' alt='"+msg.d[i].Name+"' src='" + msg.d[i].ImageUrl + "' id='" + msg.d[i].Id + "' onclick='GetItemOptions(this);' /></div>"; else maincatdiv += "<div class='itemimgdiv'><img class='allitemimage' style='border:none;' alt='"+msg.d[i].Name+"' src='images/noitemImg.png' id='" + msg.d[0].SubCategoryItems[i].Id + "' onclick='GetItemOptions(this);' /></div>"; maincatdiv += "<div class='textsdiv'>"; maincatdiv += "<div class='catitemname line-clamp itemnametxt' style='"+ItemNamestyles+"'>" + msg.d[i].Name + "</div>"; maincatdiv += "<div class='catitemprice' style='" + PriceColor + "'>" + document.getElementById("lblCurrency").innerHTML + msg.d[i].VariantPrice + "</div>"; maincatdiv += "<div class='catitemprice'><label id='qty" + msg.d[i].Id + "' style='margin-left:5px;display:none;'>NoQuantity</label></div>"; maincatdiv += "<div class='catitembtn'><input class='itemsbtndiv' type='button' id='" + msg.d[i].Id + "' style='"+MenuButtonColor+"' value='Select Options' onclick='GetItemOptions(this);'></div>"; maincatdiv += "</div>"; maincatdiv += "</div>"; } maincatdiv += "</div>"; //maincatdiv += "<div class='allcatdivs'><input class='itemsbtndiv' type='button' value='Back To All Categories' onclick='MenuNewDesign1()' style='"+MenuButtonColor+"'></div>"; } } document.getElementById('Itemstable').innerHTML += maincatdiv; } }); } else if (msg.d[i].EntityType == "SubSubCategory"){ } else{ var maincatdiv=""; //maincatdiv += "<div class='eachcatrow'>"; // CategoryId = msg.d[i].SubCategoryItems[SubCategoryItems].CategoryId; maincatdiv += "<div class='eachsubcategoryitems'>"; if (msg.d[i].ThumbnailURL != null) maincatdiv += "<div class='itemimgdiv'><img class='allitemimage' style='border:none;' alt='" + msg.d[i].Name + "' src='" + msg.d[i].ImageUrl + "' id='" + msg.d[i].Id + "' onclick='GetItemOptions(this);' /></div>"; else maincatdiv += "<div class='itemimgdiv'><img class='allitemimage' style='border:none;' alt='" + msg.d[i].Name + "' src='images/noitemImg.png' id='" + msg.d[i].Id + "' onclick='GetItemOptions(this);' /></div>"; maincatdiv += "<div class='textsdiv'>"; maincatdiv += "<div class='catitemname line-clamp itemnametxt' style='"+ItemNamestyles+"'>" + msg.d[i].Name + "</div>"; maincatdiv += "<div class='catitemprice' style='" + PriceColor + "'>" + document.getElementById("lblCurrency").innerHTML + msg.d[i].VariantPrice + "</div>"; maincatdiv += "<div class='catitemprice'><label id='qty" + msg.d[i].Id + "' style='margin-left:5px;display:none;'>NoQuantity</label></div>"; maincatdiv += "<div class='catitembtn'><input class='itemsbtndiv' style='"+MenuButtonColor+"' name='" + msg.d[i].Name + "' type='button' id='" + msg.d[i].Id + "' value='Select Options' onclick='GetItemOptions(this);'></div>"; maincatdiv += "</div>"; maincatdiv += "</div>"; } //maincatdiv += "</div>"; document.getElementById('Itemstable').innerHTML += maincatdiv; if ($("#lblMenuTheme").val() == "Grid-no-images" || $("#lblMenuTheme").val() == "New-Grid-no-images") { $(".allitemimage").attr('src','images/noitemImg.png'); $(".allitemimage").css('background-color','white'); } } } } $(document).ready(function () { if (document.getElementById('lblAppId1').value == "915594a9-b256-40bb-85c7-643a70c276f7") { if (window.innerWidth < 767) { $('.hmheaderleft').css("width", "70%"); $('.hmhdrt1').css("width", "25%"); $('.hmhdrt1').css("margin-top", "10px"); $('.hmlgimg').css("width", "200px"); $('.hmlgimg').css("height", "auto"); $('.appsclo').css("display", "none"); } else { $('.hmlgimg').css("height", "auto"); $('.hmlgimg').css("width", "260px"); $('.hmheader').css("height", "75px"); $('.appsclo').css("display", "none"); } } }); function GetCardSettings() { var LocationId = document.getElementById('lblLId').value; if(LocationId != null && LocationId != ""){ $.ajax({ type: "POST", url: "Orders.aspx/GetCardSettings", data: "{'LocationId': '" + LocationId + "'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { if(msg.d[0].Line1 == true){ $('#txtcLine1').css("display", "inline-block"); }else{ $('#txtcLine1').css("display", "none"); } if(msg.d[0].Line2 == true){ $('#txtcline2').css("display", "inline-block"); }else{ $('#txtcline2').css("display", "none"); } if(msg.d[0].City == true){ $('#txtcCity').css("display", "inline-block"); $('.helptip').css("display", "inline-block"); }else{ $('#txtcCity').css("display", "none"); $('.helptip').css("display", "none"); } if(msg.d[0].State == true){ $('#txtCState').css("display", "inline-block"); $('#txtBZC').css("width", "80px"); }else{ $('#txtCState').css("display", "none"); $('#txtBZC').css("width", "200px"); } } } }); } } let slideIndex = 1; function GetMultipleItemImages(item) { document.getElementById("displayMultipleImages").innerHTML = ""; var recipe = false; var recipebutton = $(".btnRecipe"); if (recipebutton[0].style.display != "none") { recipe = true; } $("#displayMultipleImages").css("display","none"); var imgsrc = $("#ItemImageDisplay").attr('src'); if(imgsrc != "" && imgsrc != null){ if (item != null && item != "") { $.ajax({ type: "POST", url: "Orders.aspx/GetMultipleItemImages", data: "{'ItemId': '" + item + "','IsVideo':'"+recipe+"'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var multipleimages = "<div class='slideshow-container'><div class='img-columns image-columdiv' id='mltplimgs' style='width:15%;float:left;padding:10px 0px'><div class='divscroll'><div class='mySlides fadeImage bg-show'><img src='"+imgsrc+"' class='itemimageshow1'/></div>"; for (var i = 0; i < msg.d.length; i++) { if (msg.d[i].VideoLinkURL != "" && msg.d[i].VideoLinkURL != null) { if (recipe == true) { multipleimages += "<div class='mySlides fadeImage' style='background-color:#ccc'><img src='images/videothumb.png' class='itemimageshow1' id='"+msg.d[i].VideoLinkURL+"' /></div>"; } } else { if(msg.d[i].ImageUrl != null && msg.d[i].ImageUrl != ""){ multipleimages += "<div class='mySlides fadeImage'><img src='"+msg.d[i].ImageUrl+"' class='itemimageshow1' id='' /></div>"; } } } multipleimages += "</div></div><div class='img-columns' style='width:78%;float:left;padding:10px 0px'><div data-scale='2' data-image='"+imgsrc+"' class='itemimageshow' id='ShowPreviwImage'></div><iframe id='ShowPreviewVideo' style='display:none;' class='itemvideoshow'></iframe></div></div>"; document.getElementById("displayMultipleImages").innerHTML = multipleimages; $("#displayMultipleImages").css("display","inline-block"); $("#ItemImageDisplay").css("display","none"); //showSlides(slideIndex); HovertoEnlargeImage(); zoomitemimage(); }else { var multipleimages = "<div class='slideshow-container'><div class='img-columns image-columdiv' id='mltplimgs' style='width:15%;float:left;padding:10px 0px'><div class='divscroll'><div class='mySlides fadeImage bg-show'><img src='" + imgsrc + "' class='itemimageshow1'/></div>"; multipleimages += "</div></div><div class='img-columns' style='width:78%;float:left;padding:10px 0px;'><div data-scale='2' data-image='" + imgsrc + "' class='itemimageshow' id='ShowPreviwImage'></div><iframe id='ShowPreviewVideo' style='display:none;' class='itemvideoshow'></iframe></div></div>"; document.getElementById("displayMultipleImages").innerHTML = multipleimages; $("#displayMultipleImages").css("display", "inline-block"); $("#ItemImageDisplay").css("display", "none"); //showSlides(slideIndex); HovertoEnlargeImage(); zoomitemimage(); } } }); } } else { if (item != null && item != "") { $.ajax({ type: "POST", url: "Orders.aspx/GetItemVideoContent", data: "{'ItemId': '" + item + "','IsVideo':'"+recipe+"'}", dataType: "json", contentType: "application/json", success: function (msg) { if (msg.d.length > 0) { var multipleimages = "<div class='slideshow-container'><div class='img-columns image-columdiv' id='mltplimgs' style='width:15%;float:left;padding:10px 0px'><div class='divscroll'>"; for (var i = 0; i < msg.d.length; i++) { if (msg.d[i].VideoLinkURL != "" && msg.d[i].VideoLinkURL != null) { if (recipe == true) { multipleimages += "<div class='mySlides fadeImage' style='background-color:#ccc'><img src='images/videothumb.png' class='itemimageshow1' id='"+msg.d[i].VideoLinkURL+"' /></div>"; } } } multipleimages += "</div></div><div class='img-columns' style='width:78%;float:left;padding:10px 0px'><img class='itemimageshow' id='ShowPreviwImage' style='display:none;' /><iframe id='ShowPreviewVideo' src='"+msg.d[0].VideoLinkURL+"' style='display:block;' class='itemvideoshow'></iframe></div></div>"; document.getElementById("displayMultipleImages").innerHTML = multipleimages; $("#displayMultipleImages").css("display","inline-block"); $("#ItemImageDisplay").css("display","none"); //showSlides(slideIndex); HovertoEnlargeImage(); } } }); } } } function AllowNumberForTip(input) { var regx = /^[0-9$. ]+%?$/; if (input.value.match(regx)) { return true; } else { $(input).val("0"); return false; } } function HovertoEnlargeImage() { const links = document.querySelectorAll("#mltplimgs div img"); const bg = document.querySelector("#ShowPreviwImage"); const bg1 = document.querySelector("#ShowPreviewVideo"); const showClass = "bg-show"; for (const link of links) { link.addEventListener("mouseenter", function() { if (link.id != "") { $("#ShowPreviwImage").css("display","none"); $("#ShowPreviewVideo").css("display","block"); $(bg1).removeAttr("src"); var l = link.id; $(bg1).attr("src",l); $("#mltplimgs div").removeClass(showClass); this.parentNode.classList.add(showClass); } else { $(bg1).removeAttr("src"); $("#ShowPreviewVideo").css("display","none"); $("#ShowPreviwImage").css("display","block"); $(bg).removeAttr("style"); var l = link.src+"?"+new Date().getTime(); $(bg).attr("data-image",l); //$(bg).attr("style","background-image: url('"+l+"')"); $("#mltplimgs div").removeClass(showClass); this.parentNode.classList.add(showClass); zoomitemimage(); } //document.body.classList.add(showClass); }); //link.addEventListener("mouseleave", () => { // //this.parentNode.classList.add(showClass); //}); } } function zoomitemimage() { document.getElementById("ShowPreviwImage").innerHTML = ""; $('#ShowPreviwImage') .on('mouseover', function(){ $(this).children('.item-sub-image').css({'transform': 'scale('+ $(this).attr('data-scale') +')'}); }) .on('mouseout', function(){ $(this).children('.item-sub-image').css({'transform': 'scale(1)'}); }) .on('mousemove', function(e){ $(this).children('.item-sub-image').css({'transform-origin': ((e.pageX - $(this).offset().left) / $(this).width()) * 100 + '% ' + ((e.pageY - $(this).offset().top) / $(this).height()) * 100 +'%'}); }) .each(function(){ $(this) .append('<div class="item-sub-image"></div>') .children('.item-sub-image').css({'background-image': 'url('+ $(this).attr('data-image') +')'}); }); } function ChangeView(viewMode) { $("#responsiveview").removeAttr("style"); $("#responsiveview").removeClass("tablet").removeClass("smartphone"); $("#responsiveview div").html(""); $(".desktopview").attr("src", "https://orderem.com/Demo/PizzaEm1/images/desktop.jpg"); $(".mobileview").attr("src", "https://orderem.com/Demo/PizzaEm1/images/mobile.jpg"); if (viewMode == "desktop") { $(".orderswidth").css("display", "block"); $(".desktopview").attr("src", "https://orderem.com/Demo/PizzaEm1/images/desktop1.png"); $(".content").removeAttr("style"); } else if (viewMode == "mobile") { $(".hmheader").css("display", "none"); $(".fcontainer div").css("display", "none"); $("body").css("background-color", "white"); //$(".mobileview").attr("src", "https://orderem.com/Demo/PizzaEm1/images/mobile1.png"); $("#responsiveview").addClass("smartphone"); $('#wrapper').removeClass('wrappercs'); //$('#responsiveview').prev('div').addClass('mobilewebview'); $("#responsiveview").css("display", "block"); $(".orderswidth").css("display", "none"); var MobilePreview = window.location.href.replace("preview", "mobilepreview"); $("#responsiveview div").append('<iframe src="' + MobilePreview + '" id="lblpreviewframe" class="previewframe"></iframe>'); //var Querystring = getQueryStrings(); //var PageName = Querystring["PageName"]; //var TName = Querystring["TName"]; //if (TName == "Template3" || TName == "Template4") { // $(".smartphone .content").css("width", "340px").css("height", "420px"); //} } } $("#shareicon-btn").on('click', function(){ //$(".shareiconsdiv").toggleClass( "highlight" ); var ItemId = document.getElementById("lblItemId").innerHTML.split("//")[0]; var sPath = window.location.href.split('?')[0]; document.getElementById('txtshareItemurl').value = sPath+"/item/"+ItemId; var twwtlnk = document.getElementById('tweet'); //or grab it by tagname etc twwtlnk.href = "https://twitter.com/share?url="+ sPath+"/item/"+ItemId; var fblnk = document.getElementById('facebooklnk'); fblnk.href = "https://www.facebook.com/sharer.php?u="+ sPath+"/item/"+ItemId; var a = document.getElementById('sharelink'); a.href = "https://plus.google.com/share?url="+ document.URL+"/item/"+ItemId; $("#divsharelnk2").attr("style","display:flex;align-items:center;justify-content:center"); $("#divsharelnk1").css("display","none"); $("#sharepanel #modal-behind").css("z-index","1000"); $("#sharepanel").css("display","block"); }); function copytoclipboard() { $("#btncopyURL").removeAttr("value"); $("#btncopyURL").attr("value","Copied!"); var txt = document.getElementById('txtshareItemurl').value; var $temp = $("<input>"); $("body").append($temp); $temp.val(txt).select(); document.execCommand("copy"); $temp.remove(); setTimeout(function () { $("#btncopyURL").removeAttr("value"); $("#btncopyURL").attr("value","Copy URL"); }, 1000); } function copytoclipboard1() { $("#btncopyURL1").removeAttr("value"); $("#btncopyURL1").attr("value","Copied!"); var txt = document.getElementById('txtshareurl').value; var $temp = $("<input>"); $("body").append($temp); $temp.val(txt).select(); document.execCommand("copy"); $temp.remove(); setTimeout(function () { $("#btncopyURL1").removeAttr("value"); $("#btncopyURL1").attr("value","Copy URL"); }, 1000); } function BindAllItemsforItemSearch(msg, id, Status, PickUp, Delivery, Shipping, CustomTypeOrders, h) { var H = 0; if ($("#lblMenuTheme").val() != "Grid" && $("#lblMenuTheme").val() != "Grid-no-images" && $("#lblMenuTheme").val() != "New-Grid" && $("#lblMenuTheme").val() != "New-Grid-no-images") { var MenuTheme = ""; var menustring = getQueryStrings(); var Mt = menustring["Cmd"]; if (Mt != null && Mt != "" && Mt != "undefined") MenuTheme = Mt; else MenuTheme = document.getElementById('lblMenuTheme').value; var MenuItems = ""; var MenuQunatity = document.getElementById("lblshowquantity").innerHTML; for (var I = 0; I < msg.d.length; I++) { if (msg.d[I].EntityType == "SubCategory" || msg.d[I].EntityType == "SubSubCategory") { var SubCategoryTable = ""; var description = ""; if (msg.d[I].Description != "" && msg.d[I].Description != "\n" && msg.d[I].Description != null && msg.d[I].Description != "null") description = "<div class='itemcdes' style= '" + CategoryBold + ";" + CategoryFontFamily + ";" + CategoryTextColor + "'>" + msg.d[I].Description + "</div>"; if (msg.d[I].EntityType == "SubCategory") SubCategoryTable = "<div class= 'SubCatfont' style='" + MenuColors + "' Status='false' id= " + msg.d[I].Id + " onclick='BindCategoryItemsandSubCategories(this);'>"; if (msg.d[I].EntityType == "SubSubCategory") SubCategoryTable = "<div class= 'SubSubCatfont' style='" + MenuColors + "' Status='false' id= " + msg.d[I].Id + " onclick='BindCategoryItemsandSubCategories(this);'>"; if (msg.d[I].ThumbnailURL != null) SubCategoryTable += "<div class='categoryfleft'><img id='img" + msg.d[I].Name + "' src='" + msg.d[I].ThumbnailURL + "' alt='" + msg.d[I].Name + "' /></div><div class='categoryleft1'><span class= 'subcatdes' style='" + SubMenuColors + "' >" + msg.d[I].Name + "</span>" + description + "</div><div class='categoryright'><i class= 'arrow downArrow', style= '" + MenuForeColors + "'></i></div>"; else SubCategoryTable += "<div class='categoryleft'><span class= 'subcatdes' style='" + SubMenuColors + "' >" + msg.d[I].Name + "</span>" + description + "</div><div class='categoryright'><i class= 'arrow downArrow', style= '" + MenuForeColors + "'></i></div>"; if (msg.d[I].EntityType == "SubCategory") SubCategoryTable += "</div><div class='subcatitems' id= 'ItemsOf" + msg.d[I].Id + "' style='" + MenuFont + "'></div>"; else SubCategoryTable += "</div><div class='subsubcatitems' id= 'ItemsOf" + msg.d[I].Id + "' style='" + MenuFont + "'></div>"; if (id == "") document.getElementById('Itemstable').innerHTML += SubCategoryTable; else document.getElementById('ItemsOf' + id).innerHTML += SubCategoryTable; } else if (msg.d[I].EntityType == "Category") { var CategoryTable = ""; var cdesc = ""; var cstatus = false; if (msg.d[I].Description != "" && msg.d[I].Description != "\n" && msg.d[I].Description != null && msg.d[I].Description != "null") cdesc += "<div class='itemcdes' style='" + CategoryBold + ";" + CategoryFontFamily + ";" + CategoryTextColor + "'>" + msg.d[I].Description + "</div>"; if (msg.d[I].ViewOnly == true) cstatus = true; CategoryTable += "<div class='itemfont' id=" + msg.d[I].Id + " onclick= 'BindCategoryItemsandSubCategories(this);' Status= '" + cstatus + "' style='" + MenuColors + "'>"; if (msg.d[I].ThumbnailURL != null) CategoryTable += "<div class='categoryfleft' style= '" + CategoryTextColor + ";" + CategoryBgColor + "'><img id='img" + msg.d[I].Name + "' src='" + msg.d[I].ThumbnailURL + "' alt='" + msg.d[I].Name + "' /></div><div class='categoryleft1' style= '" + CategoryTextColor + "'><span style='" + CategoryBold + ";" + CategoryFontSize + ";" + CategoryFontFamily + "'>" + msg.d[I].Name + "</span>" + cdesc + "</div><div class='categoryright'><i class= 'arrow downArrow' style= '" + MenuForeColors + "'></i></div>"; else CategoryTable += "<div class='categoryleft' style= '" + CategoryTextColor + ";" + CategoryBgColor + "'><span style='" + CategoryBold + ";" + CategoryFontSize + ";" + CategoryFontFamily + "'>" + msg.d[I].Name + "</span>" + cdesc + "</div><div class='categoryright'><i class= 'arrow downArrow' style= '" + MenuForeColors + "'></i></div>"; CategoryTable += "</div><div class='catitems' id= 'ItemsOf" + msg.d[I].Id + "' style='" + MenuFont + "'></div>"; document.getElementById('Itemstable').innerHTML += CategoryTable; var QueryString = getQueryStrings(); var Menuexpand = QueryString["Mcollaps"]; if (msg.d[C].CollapseCategory != null) { if (msg.d[C].CollapseCategory == true) { BindCategoryItemsandSubCategories(msg.d[C].CategoryId); } else { if (Menuexpand != "" && Menuexpand != null && Menuexpand != "undefined") { if (Menuexpand == "No") BindCategoryItemsandSubCategories(msg.d[I].Id); } else if (document.getElementById('lblMenuType').value == "Expand") BindCategoryItemsandSubCategories(msg.d[I].Id); } } } else if (msg.d[I].EntityType == "Item") { var ItemClick = ""; var CategoryTable = ""; H++; if (h == 1) { if (PickUp != "" || Delivery != "" || Shipping != "" || CustomTypeOrders != "") { if (PickUp != false || Delivery != false || Shipping != false || CustomTypeOrders != false) { if (msg.d[I].ViewOnly != true) ItemClick = "GetItemOptions(this);"; else ItemClick = 'DineInOnly("Show", this);'; } } } else { var ddlOrderType = document.getElementById("ddlOrderType"); if (ddlOrderType.selectedIndex != -1) { if (msg.d[I].ViewOnly != true) ItemClick = "GetItemOptions(this);"; } else ItemClick = 'DineInOnly("Show", this);'; } if (Status == "true") ItemClick = 'DineInOnly("Show", this);'; if (MenuQunatity == "Enable") { if (msg.d[I].ItemAvailability == "NoQuantity") { CategoryTable += "<div class='itemfont' id=" + msg.d[I].Id + " onclick= 'BindCategoryItemsandSubCategories(this);' style='" + MenuColors + "'>"; CategoryTable += "<div class='categoryleft' style= '" + CategoryTextColor + ";" + CategoryBgColor + "'><span style='" + CategoryBold + ";" + CategoryFontSize + ";" + CategoryFontFamily + "'>" + msg.d[I].CategoryName + "</span></div>"; //CategoryTable += "<div class='categoryright'><i class= 'arrow downArrow' style= '" + MenuForeColors + "'></i></div>"; CategoryTable += "</div><div class='catitems' id= 'ItemsOf" + msg.d[I].Id + "' style='" + MenuFont + "'></div>"; //document.getElementById('Itemstable').innerHTML += CategoryTable; MenuItems += CategoryTable + "<div id='" + msg.d[I].Id + "' class='itemstyle' onclick='" + ItemClick + "' style='border-color: " + DividerColor + ";'>"; } else { var Quantity = Number(msg.d[I].ItemAvailability); if (Quantity > 0) { CategoryTable += "<div class='itemfont' id=" + msg.d[I].Id + " onclick= 'BindCategoryItemsandSubCategories(this);' style='" + MenuColors + "'>"; CategoryTable += "<div class='categoryleft' style= '" + CategoryTextColor + ";" + CategoryBgColor + "'><span style='" + CategoryBold + ";" + CategoryFontSize + ";" + CategoryFontFamily + "'>" + msg.d[I].CategoryName + "</span></div>"; //CategoryTable += "<div class='categoryright'><i class= 'arrow downArrow' style= '" + MenuForeColors + "'></i></div>"; CategoryTable += "</div><div class='catitems' id= 'ItemsOf" + msg.d[I].Id + "' style='" + MenuFont + "'></div>"; //document.getElementById('Itemstable').innerHTML += CategoryTable; MenuItems += CategoryTable + "<div id='" + msg.d[I].Id + "' class='itemstyle' onclick='" + ItemClick + "' style='border-color: " + DividerColor + ";'>"; } else { CategoryTable += "<div class='itemfont' id=" + msg.d[I].Id + " onclick= 'BindCategoryItemsandSubCategories(this);' style='" + MenuColors + "'>"; CategoryTable += "<div class='categoryleft' style= '" + CategoryTextColor + ";" + CategoryBgColor + "'><span style='" + CategoryBold + ";" + CategoryFontSize + ";" + CategoryFontFamily + "'>" + msg.d[I].CategoryName + "</span></div>"; //CategoryTable += "<div class='categoryright'><i class= 'arrow downArrow' style= '" + MenuForeColors + "'></i></div>"; CategoryTable += "</div><div class='catitems' id= 'ItemsOf" + msg.d[I].Id + "' style='" + MenuFont + "'></div>"; //document.getElementById('Itemstable').innerHTML += CategoryTable; MenuItems += CategoryTable + "<div id='" + msg.d[I].Id + "' class='itemstyle' style='opacity:0.4;' style='border-color: " + DividerColor + ";'>"; } } } else { CategoryTable += "<div class='itemfont' id=" + msg.d[I].Id + " onclick= 'BindCategoryItemsandSubCategories(this);' style='" + MenuColors + "'>"; CategoryTable += "<div class='categoryleft' style= '" + CategoryTextColor + ";" + CategoryBgColor + "'><span style='" + CategoryBold + ";" + CategoryFontSize + ";" + CategoryFontFamily + "'>" + msg.d[I].CategoryName + "</span></div>"; //CategoryTable += "<div class='categoryright'><i class= 'arrow downArrow' style= '" + MenuForeColors + "'></i></div>"; CategoryTable += "</div><div class='catitems' id= 'ItemsOf" + msg.d[I].Id + "' style='" + MenuFont + "'></div>"; //document.getElementById('Itemstable').innerHTML += CategoryTable; MenuItems += CategoryTable + "<div id='" + msg.d[I].Id + "' class='itemstyle' onclick='" + ItemClick + "' style='border-color: " + DividerColor + ";'>"; } if (msg.d[I].ThumbnailURL != null) MenuItems += "<div class='itemleft'><img alt='Item' src='" + msg.d[I].ThumbnailURL + "' class='itemimage' /></div>"; if (msg.d[I].ShowItem == true && msg.d[I].ThumbnailURL != null) { MenuItems += "<div class='itemright' style='display:none;'><div class='itemnamest' id='" + msg.d[I].CategoryId + "' Title='" + msg.d[I].Name + "' style='" + ItemNamestyles + "'>"; } else { MenuItems += "<div class='itemright'><div class='itemnamest' id='" + msg.d[I].CategoryId + "' Title='" + msg.d[I].Name + "' style='" + ItemNamestyles + "'>"; } if (msg.d[I].Calories != null) MenuItems += "<span>" + msg.d[I].Calories + "</span>"; if (msg.d[I].PopularItem == true) MenuItems += "<img src='images/ItemQualitiesSmallPopular.png' alt='Popular' class='Popular itemfclas' />"; if (msg.d[I].SpicyItem == true) MenuItems += "<img src='images/ItemQualitiesSmallSpicy.png' alt='Spicy' class='Spicy itemfclas' />"; if (msg.d[I].Vegetarian == true) MenuItems += "<img src='images/ItemQualitiesSmallVegetarian.png' alt='Vegetarian' class='Vegetarian itemfclas' />"; if (msg.d[I].GlutenFreeItem == true) MenuItems += "<img src='images/ItemQualitiesSmallGlutenFree.png' alt='GlutenFree' class='GlutenFree itemfclas' />"; if (msg.d[I].RawItem == true) MenuItems += "<img src='images/ItemQualitiesSmallRaw.png' alt='Raw' class='Raw itemfclas' />"; MenuItems += "<span>" + msg.d[I].Name + "</span></div><div class='itemquality'>"; if (MenuQunatity == "Enable") { if (msg.d[I].ItemAvailability == "NoQuantity") MenuItems += "<label id='qty" + msg.d[I].Id + "' style='display:none'>" + msg.d[I].ItemAvailability + "</label>"; else MenuItems += "<label id='qty" + msg.d[I].Id + "' style='margin-left:5px'>" + msg.d[I].ItemAvailability + "</label><span> Items left</span>"; } else MenuItems += "<label id='qty" + msg.d[I].Id + "' style='display:none'>NoQuantity</label>"; MenuItems += "</div><div class='itemdesc'>"; if (msg.d[I].Description != "" && msg.d[I].Description != "\n" && msg.d[I].Description != null && msg.d[I].Description != "null") MenuItems += msg.d[I].Description; MenuItems += "</div><div class='itemprice' style='" + PriceColor + "'>" + document.getElementById("lblCurrency").innerHTML + msg.d[I].VariantPrice + "</div>"; MenuItems += "</div></div>"; } } if (id == "Search") document.getElementById('Itemstable').innerHTML += MenuItems; else if (id == "") document.getElementById('Itemstable').innerHTML += MenuItems; else document.getElementById('ItemsOf' + id).innerHTML += "<div class='itemsmain'>" + MenuItems; if (document.getElementById("lblBogoSubCatId").innerHTML != "") { BindCategoryItemsandSubCategories(document.getElementById("lblBogoSubCatId").innerHTML); document.getElementById("lblBogoSubCatId").innerHTML = ""; } if (document.getElementById("lblBogoSubSubId").innerHTML != "") { BindCategoryItemsandSubCategories(document.getElementById("lblBogoSubSubId").innerHTML); document.getElementById("lblBogoSubSubId").innerHTML = ""; } if (MenuTheme == "Column1") { if ($("#lblImageOrientation").val() == "Top") { $(".itemimage").addClass("itemimage1"); } else { $(".itemleft").addClass("itemleft1"); $(".itemright").addClass("itemright1"); } } else if (MenuTheme == "Column2") { if ($("#lblImageOrientation").val() == "Top") { $(".itemstyle").addClass("itemstyletop2"); $(".itemright").addClass("itemrighttop2"); $(".itemimage").addClass("itemimagetop2"); } else { $(".itemstyle").addClass("itemstyle2"); $(".itemleft").addClass("itemleft2"); $(".itemright").addClass("itemright2"); $(".itemimage").addClass("itemimage2"); } } else if (MenuTheme == "Column3") { if ($("#lblImageOrientation").val() == "Top") { $(".itemstyle").addClass("itemstyletop3"); $(".itemright").addClass("itemrighttop3"); } else { $(".itemstyle").addClass("itemstyle3"); $(".itemleft").addClass("itemleft3"); $(".itemright").addClass("itemright3"); } } else if (MenuTheme == "Column1-no-images") { if ($("#lblImageOrientation").val() == "Top") { $(".itemimage").addClass("itemimage1"); } else { $(".itemleft").addClass("itemleft1"); $(".itemright").addClass("itemright1"); $(".itemleft1").css("display", "none"); $(".itemright1").css("display", "block"); $(".categoryfleft").css("display", "none"); } } else if (MenuTheme == "Column2-no-images") { if ($("#lblImageOrientation").val() == "Top") { $(".itemstyle").addClass("itemstyletop2"); $(".itemright").addClass("itemrighttop2"); $(".itemimage").addClass("itemimagetop2"); } else { $(".itemstyle").addClass("itemstyle2"); $(".itemleft").addClass("itemleft2"); $(".itemright").addClass("itemright2"); $(".itemimage").addClass("itemimage2"); $(".itemleft2").css("display", "none"); $(".itemright2").css("display", "block"); $(".categoryfleft").css("display", "none"); } } else if (MenuTheme == "Column3-no-images") { if ($("#lblImageOrientation").val() == "Top") { $(".itemstyle").addClass("itemstyletop3"); $(".itemright").addClass("itemrighttop3"); } else { $(".itemstyle").addClass("itemstyle3"); $(".itemleft").addClass("itemleft3"); $(".itemright").addClass("itemright3"); $(".itemleft3").css("display", "none"); $(".itemright3").css("display", "block"); $(".categoryfleft").css("display", "none"); } } } if (MenuTheme == "Grid-no-images" || MenuTheme == "New-Grid-no-images") { $(".allitemimage").attr('src', 'images/noitemImg.png'); } if ($("#lblImageOrientation").val() == "Right") { $(".itemleft").css("float", "right"); } else { $(".itemleft").css("float", "left"); } if (document.getElementById("lblBogoItemId").innerHTML != "" && id != document.getElementById("lblBogoItemId").innerHTML) $("#" + document.getElementById("lblBogoItemId").innerHTML).trigger("click"); } </script> <script type="text/javascript"> //<![CDATA[ var Page_Validators = new Array(document.getElementById("RequiredFieldValidator11"), document.getElementById("RequiredFieldValidator5"), document.getElementById("RequiredFieldValidator4"), document.getElementById("RequiredFieldValidator3"), document.getElementById("RequiredFieldValidator8"), document.getElementById("RequiredFieldValidator9"), document.getElementById("rq1"), document.getElementById("rq2"), document.getElementById("RegularExpressionValidator4")); //]]> </script> <script type="text/javascript"> //<![CDATA[ var RequiredFieldValidator11 = document.all ? document.all["RequiredFieldValidator11"] : document.getElementById("RequiredFieldValidator11"); RequiredFieldValidator11.controltovalidate = "txtcode"; RequiredFieldValidator11.errormessage = "*"; RequiredFieldValidator11.validationGroup = "Activate"; RequiredFieldValidator11.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid"; RequiredFieldValidator11.initialvalue = ""; var RequiredFieldValidator5 = document.all ? document.all["RequiredFieldValidator5"] : document.getElementById("RequiredFieldValidator5"); RequiredFieldValidator5.controltovalidate = "txtEId"; RequiredFieldValidator5.validationGroup = "pwd"; RequiredFieldValidator5.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid"; RequiredFieldValidator5.initialvalue = ""; var RequiredFieldValidator4 = document.all ? document.all["RequiredFieldValidator4"] : document.getElementById("RequiredFieldValidator4"); RequiredFieldValidator4.controltovalidate = "txtcuptitle"; RequiredFieldValidator4.errormessage = "*"; RequiredFieldValidator4.validationGroup = "Savenewcoupon"; RequiredFieldValidator4.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid"; RequiredFieldValidator4.initialvalue = ""; var RequiredFieldValidator3 = document.all ? document.all["RequiredFieldValidator3"] : document.getElementById("RequiredFieldValidator3"); RequiredFieldValidator3.controltovalidate = "txtcupnlink"; RequiredFieldValidator3.errormessage = "*"; RequiredFieldValidator3.validationGroup = "Savenewcoupon"; RequiredFieldValidator3.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid"; RequiredFieldValidator3.initialvalue = ""; var RequiredFieldValidator8 = document.all ? document.all["RequiredFieldValidator8"] : document.getElementById("RequiredFieldValidator8"); RequiredFieldValidator8.controltovalidate = "txtmobactivate"; RequiredFieldValidator8.errormessage = "*"; RequiredFieldValidator8.validationGroup = "Activate"; RequiredFieldValidator8.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid"; RequiredFieldValidator8.initialvalue = ""; var RequiredFieldValidator9 = document.all ? document.all["RequiredFieldValidator9"] : document.getElementById("RequiredFieldValidator9"); RequiredFieldValidator9.controltovalidate = "txtactivatemobileno"; RequiredFieldValidator9.errormessage = "*"; RequiredFieldValidator9.validationGroup = "enterActivate"; RequiredFieldValidator9.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid"; RequiredFieldValidator9.initialvalue = ""; var rq1 = document.all ? document.all["rq1"] : document.getElementById("rq1"); rq1.controltovalidate = "txtupdatebusnsname"; rq1.errormessage = "*"; rq1.validationGroup = "btnSubmit"; rq1.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid"; rq1.initialvalue = ""; var rq2 = document.all ? document.all["rq2"] : document.getElementById("rq2"); rq2.controltovalidate = "txtaddr1"; rq2.errormessage = "*"; rq2.validationGroup = "btnSubmit"; rq2.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid"; rq2.initialvalue = ""; var RegularExpressionValidator4 = document.all ? document.all["RegularExpressionValidator4"] : document.getElementById("RegularExpressionValidator4"); RegularExpressionValidator4.controltovalidate = "txtAppemail"; RegularExpressionValidator4.errormessage = "Enter Valid Email"; RegularExpressionValidator4.validationGroup = "Create"; RegularExpressionValidator4.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid"; RegularExpressionValidator4.validationexpression = "\\w+([-+.\']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"; //]]> </script> <script type="text/javascript"> //<![CDATA[ var callBackFrameUrl='/WebResource.axd?d=6bvaMdxoJGcczHQrkw0aWIXnfcgS_yurMRzvRi_8PqD15uJWXHBAoglwoRvlzg2Sp0VSZBM-mDGpAqPKo3qU-G9MWfY1&t=638568460745067788'; WebForm_InitCallback();ShowHeader(); var Page_ValidationActive = false; if (typeof(ValidatorOnLoad) == "function") { ValidatorOnLoad(); } function ValidatorOnSubmit() { if (Page_ValidationActive) { return ValidatorCommonOnSubmit(); } else { return true; } } theForm.oldSubmit = theForm.submit; theForm.submit = WebForm_SaveScrollPositionSubmit; theForm.oldOnSubmit = theForm.onsubmit; theForm.onsubmit = WebForm_SaveScrollPositionOnSubmit; Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":13,"ValidChars":". ","id":"FilteredTextBoxExtender3"}, null, null, $get("txtFirstName")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":13,"ValidChars":". ","id":"FilteredTextBoxExtender4"}, null, null, $get("txtLastName")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":3,"ValidChars":"+","id":"FilteredTextBoxExtender7"}, null, null, $get("txtPhonenumber")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":12,"id":"FilteredTextBoxExtender16"}, null, null, $get("txtconname")); }); document.getElementById('RequiredFieldValidator11').dispose = function() { Array.remove(Page_Validators, document.getElementById('RequiredFieldValidator11')); } Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":13,"ValidChars":". ","id":"FilteredTextBoxExtender6"}, null, null, $get("txtguestdeliveryname")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"FilteredTextBoxExtender25"}, null, null, $get("txtZip")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":3,"ValidChars":"+","id":"FilteredTextBoxExtender5"}, null, null, $get("txtmobilenumber")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"FilteredTextBoxExtender1"}, null, null, $get("screentxtAdvancedlbl")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"FilteredTextBoxExtender30"}, null, null, $get("txtAdvancedlbl")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":3,"ValidChars":"+","id":"Filtereddineintableid"}, null, null, $get("dineintableid")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":13,"ValidChars":". ","id":"FilteredTextBoxExtender8"}, null, null, $get("txtDGName")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":3,"ValidChars":"+","id":"FilteredTextBoxExtender26"}, null, null, $get("txtDGPhno")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":15,"ValidChars":" ","id":"FilteredTextBoxExtender18"}, null, null, $get("txtcardname")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":13,"ValidChars":" ","id":"FilteredTextBoxExtender19"}, null, null, $get("txtClastname")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"FilteredTextBoxExtender13"}, null, null, $get("txtcardno")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"FilteredTextBoxExtender24"}, null, null, $get("txtCVV")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":13,"ValidChars":" ","id":"FilteredTextBoxExtender21"}, null, null, $get("txtcCity")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":13,"ValidChars":" ","id":"FilteredTextBoxExtender22"}, null, null, $get("txtCState")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"FilteredTextBoxExtender17"}, null, null, $get("txtBZC")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":13,"ValidChars":" ","id":"FilteredTextBoxExtender9"}, null, null, $get("txtvalidationcity")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":13,"ValidChars":" ","id":"FilteredTextBoxExtender10"}, null, null, $get("txtvalidationstate")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"FilteredTextBoxExtender15"}, null, null, $get("txtvalidationzip")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":13,"ValidChars":" ","id":"FilteredTextBoxExtender28"}, null, null, $get("txtshpcity")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"FilteredTextBoxExtender29"}, null, null, $get("txtshpzip")); }); document.getElementById('RequiredFieldValidator5').dispose = function() { Array.remove(Page_Validators, document.getElementById('RequiredFieldValidator5')); } Sys.Application.add_init(function() { $create(AjaxControlToolkit.RatingBehavior, {"AutoPostBack":false,"CallbackID":"Rating1","ClientStateFieldID":"Rating1_RatingExtender_ClientState","EmptyStarCssClass":"rating_empty","FilledStarCssClass":"rating_filled","StarCssClass":"rating_star","WaitingStarCssClass":"rating_empty","id":"myRBID"}, null, null, $get("Rating1")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.RatingBehavior, {"AutoPostBack":false,"CallbackID":"DeliveryServiceRating","ClientStateFieldID":"DeliveryServiceRating_RatingExtender_ClientState","EmptyStarCssClass":"rating_empty1","FilledStarCssClass":"rating_filled1","StarCssClass":"rating_star1","WaitingStarCssClass":"rating_empty1","id":"myRBID1"}, null, null, $get("DeliveryServiceRating")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.TextBoxWatermarkBehavior, {"ClientStateFieldID":"TextBoxWatermarkExtender3_ClientState","WatermarkCssClass":"coupnwtrtxt","WatermarkText":"Enter coupon title","id":"TextBoxWatermarkExtender3"}, null, null, $get("txtcuptitle")); }); document.getElementById('RequiredFieldValidator4').dispose = function() { Array.remove(Page_Validators, document.getElementById('RequiredFieldValidator4')); } Sys.Application.add_init(function() { $create(AjaxControlToolkit.TextBoxWatermarkBehavior, {"ClientStateFieldID":"txtwatermark_ClientState","WatermarkCssClass":"coupnwtrtxt","WatermarkText":"Enter coupon code","id":"txtwatermark"}, null, null, $get("txtcupnlink")); }); document.getElementById('RequiredFieldValidator3').dispose = function() { Array.remove(Page_Validators, document.getElementById('RequiredFieldValidator3')); } Sys.Application.add_init(function() { $create(AjaxControlToolkit.TextBoxWatermarkBehavior, {"ClientStateFieldID":"TextBoxWatermarkExtender1_ClientState","WatermarkCssClass":"coupnwtrtxt","WatermarkText":"Tell us more about the offer","id":"TextBoxWatermarkExtender1"}, null, null, $get("txtcupnother")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":3,"id":"FilteredTextBoxExtender14"}, null, null, $get("txtcupndst")); }); document.getElementById('RequiredFieldValidator8').dispose = function() { Array.remove(Page_Validators, document.getElementById('RequiredFieldValidator8')); } document.getElementById('RequiredFieldValidator9').dispose = function() { Array.remove(Page_Validators, document.getElementById('RequiredFieldValidator9')); } Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":3,"id":"FilteredTextBoxExtender2"}, null, null, $get("txtactivatemobileno")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":13,"ValidChars":" ","id":"FilteredTextBoxExtender11"}, null, null, $get("txtdinefname")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":13,"ValidChars":" ","id":"FilteredTextBoxExtender31"}, null, null, $get("txtdinelname")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":15,"ValidChars":".,@","id":"FilteredTextBoxExtender12"}, null, null, $get("txtdineemail")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":3,"ValidChars":"+","id":"FilteredTextBoxExtender27"}, null, null, $get("txtdinephn")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":3,"id":"FilteredTextBoxExtender32"}, null, null, $get("txtdinetable")); }); document.getElementById('rq1').dispose = function() { Array.remove(Page_Validators, document.getElementById('rq1')); } document.getElementById('rq2').dispose = function() { Array.remove(Page_Validators, document.getElementById('rq2')); } Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":3,"id":"FilteredTextBoxExtender20"}, null, null, $get("txtzip1")); }); Sys.Application.add_init(function() { $create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":3,"ValidChars":"+","id":"FilteredTextBoxExtender23"}, null, null, $get("txtphone")); }); document.getElementById('RegularExpressionValidator4').dispose = function() { Array.remove(Page_Validators, document.getElementById('RegularExpressionValidator4')); } //]]> </script> </form> </body> </html>