{"version":3,"file":"signupStore.min.js","sources":["scripts/signupStore.min.js"],"sourcesContent":["/**************************************************************************\nName: signupStore.js\nDescription: Account sign up select a store scripting\nDate Created: 07/01/2024 by Jenna Hart\nModified: \n**************************************************************************/\njQuery.noConflict();\n\nvar skipGeo=false;\n\njQuery(document).ready( function(){\n jQuery(\".openSignupStoreModal\").on(\"focus\", function(){\n //Opens the store selection modal\n openStoreModal(skipGeo, 'signupStoreModal');\n skipGeo = true;\n });\n\n jQuery('body').on('click', '.signupStoreModal .storeSearch .storeBtn', function(e){\n //Update the store field when a store is selected in the store modal\n e.preventDefault();\n let storeName = jQuery(this).attr('title');\n accountSignupSetStore(storeName);\n });\n\n jQuery('body').on('click', '.signupStoreModal .storeLocation .button.left', function(e){\n //Update the store field when confirming the initial suggestion from the store modal\n e.preventDefault();\n let storeName = jQuery(this).attr('data-storeName');\n accountSignupSetStore(storeName);\n });\n});\n\nfunction accountSignupSetStore(storeName){\n //Sets the user's store via an AJAX request, updates the store field, and focuses on the next field\n let storeNum = storeName.split(\" - \")[0];\n storeNum = (storeNum.length > 0)? storeNum : \"0\";\n //Send the request to set the user's store on the back end\n jQuery.ajax({\n type: \"GET\",\n url: \"/cfcs/accountDAO.cfc\",\n dataType: \"json\",\n data: {method: \"setStoreSessionAJAX\", storeNum: storeNum},\n cache: false,\n success: function(res){\n //Store is now set in the session, update the values on the front end\n jQuery(\"#store\").val(storeName).addClass(\"valid\").removeClass(\"error\");\t//Update the store field\n jQuery(\"#id_business_type\").focus();\t//Focus on the next field\n //Enable or disable the form submission\n setSubmitInteraction();\n\n //Update the store indicator links in the header\n jQuery(\".layHeader .header-container .store-address-link\")[0].outerHTML = res.LINK;\t//Desktop link\n jQuery(\".layHeader .header-location-row .store-address-link\")[0].outerHTML = res.LINK;\t//Mobile link\n\n //Update the specials header links\n jQuery(\"#header_specials #specials a\").remove();\n jQuery.ajax({\n type: \"GET\",\n url: \"/cfcs/hotSheetGW.cfc\",\n dataType: \"JSON\",\n data: {method: \"getSToreHotsheetsAJAX\", sid: res.ID},\n success: function(data){\n //Parse data into JS objects\n let betterData = [];\n for(let i=0; i`);\n //Set the hotsheet title on the new link, preferring PUBLIC_TITLE if it exists\n hotSheetAnchorTag.text((betterData[i].PUBLIC_TITLE.length > 0)? betterData[i].PUBLIC_TITLE : betterData[i].TITLE);\n jQuery(\"#specials\").append(hotSheetAnchorTag);\n }\n },\n failure: function(){},\n complete: function(){\n //Add the TPR link to the header, if applicable\n if(res.HASTPRS){\n jQuery(\"#specials\").append(\"Temporary Price Reductions\");\n }\n }\n });\n\n //Add or remove the product search forms if needed\n let searchBarExists = jQuery(\"#globalKeywords\").length > 0;\n if(res.HASINVENTORY === 1 && !searchBarExists){\n //Add product search forms\n jQuery(\"nav .nav .primary\").prepend(`#variables.mobileSearchForm#`);\n jQuery(`#variables.desktopSearchForm#`).insertAfter(\".layHeader .logo\");\n //Add the event listeners\n setSearchListeners();\t//Function from search.js\n }\n else if(res.HASINVENTORY === 0 && searchBarExists){\n //Remove the search bars\n jQuery(\".layHeader .header-search-container\").remove();\t//Desktop\n jQuery(\".layHeader .mobileSearch\").remove();\t//Mobile\n }\n\n //Disable the search forms\n jQuery(\".globalSearchForm input, .globalSearchForm button\").attr(\"disabled\",true);\n //Import the new product files\n let dataOptions = {\n ajaxAsync: true,\n callback: function(){\n //Re-enable the search forms once the search data is loaded\n jQuery(\".globalSearchForm input, .globalSearchForm button\").removeAttr(\"disabled\");\n }\n };\n setSearchData(false, storeNum, options=dataOptions);\t//Function from search.js\n },\n failure: function(){}\n });\n}"],"names":["jQuery","noConflict","skipGeo","accountSignupSetStore","storeName","let","storeNum","split","length","ajax","type","url","dataType","data","method","cache","success","res","val","addClass","removeClass","focus","setSubmitInteraction","outerHTML","LINK","remove","sid","ID","betterData","i","DATA","hotSheetObject","j","COLUMNS","push","hotSheetAnchorTag","HID","text","PUBLIC_TITLE","TITLE","append","failure","complete","HASTPRS","searchBarExists","dataOptions","HASINVENTORY","prepend","insertAfter","setSearchListeners","attr","ajaxAsync","callback","removeAttr","setSearchData","options","document","ready","on","openStoreModal","e","preventDefault","this"],"mappings":"AAMAA,OAAOC,WAAW,EAElB,IAAIC,QAAQ,CAAA,EAwBZ,SAASC,sBAAsBC,GAE3BC,IAAIC,EAAWF,EAAUG,MAAM,KAAK,EAAE,GACtCD,EAA8B,EAAlBA,EAASE,OAAaF,EAAW,IAE7CN,OAAOS,KAAK,CACRC,KAAM,MACNC,IAAK,uBACLC,SAAU,OACVC,KAAM,CAACC,OAAQ,sBAAuBR,SAAUA,CAAQ,EACxDS,MAAO,CAAA,EACPC,QAAS,SAASC,GAEdjB,OAAO,QAAQ,EAAEkB,IAAId,CAAS,EAAEe,SAAS,OAAO,EAAEC,YAAY,OAAO,EACrEpB,OAAO,mBAAmB,EAAEqB,MAAM,EAElCC,qBAAqB,EAGrBtB,OAAO,kDAAkD,EAAE,GAAGuB,UAAYN,EAAIO,KAC9ExB,OAAO,qDAAqD,EAAE,GAAGuB,UAAYN,EAAIO,KAGjFxB,OAAO,8BAA8B,EAAEyB,OAAO,EAC9CzB,OAAOS,KAAK,CACRC,KAAM,MACNC,IAAK,uBACLC,SAAU,OACVC,KAAM,CAACC,OAAQ,wBAAyBY,IAAKT,EAAIU,EAAE,EACnDX,QAAS,SAASH,GAEdR,IAAIuB,EAAa,GACjB,IAAIvB,IAAIwB,EAAE,EAAGA,EAAEhB,EAAKiB,KAAKtB,OAAQqB,CAAC,GAAG,CACjCxB,IAAI0B,EAAiB,GACrB,IAAI1B,IAAI2B,EAAE,EAAGA,EAAEnB,EAAKoB,QAAQzB,OAAQwB,CAAC,GACjCD,EAAelB,EAAKoB,QAAQD,IAAMnB,EAAKiB,KAAKD,GAAGG,GAEnDJ,EAAWM,KAAKH,CAAc,CAClC,CAEA,IAAI1B,IAAIwB,EAAE,EAAGA,EAAED,EAAWpB,OAAQqB,CAAC,GAAG,CAClCxB,IAAI8B,EAAoBnC,qCAAqCiB,EAAIU,MAAMC,EAAWC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