PageSourceSearch

https://firatsplace.co.uk/allergy

html firatsplace.co.uk collected 2026-10-02 16:14:39 UTC 117,977 bytes, 3,211 lines download raw bytes

1
2
3<!DOCTYPE html>
4<html lang="en" class="wide wow-animation   desktop landscape rd-navbar-static-linked">
5<head>
6 
7  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8  <title>Pizza &amp; Kebab Delivery in Yate, Bristol | Order Online  | Firat Place   </title>
9  <meta name="format-detection" content="telephone=no" />
10<meta name="description" content="Order pizza &amp;amp; kebab in Yate, Bristol from Firat Place. Fast delivery and collection available.">
11<script type="application/ld+json">
12{"@context":"https://schema.org","@type":"FastFoodRestaurant","name":"Firat Place","url":"https://firatsplace.co.uk","hasMenu":"https://firatsplace.co.uk/menu","image":"https://firatsplace.co.uk/sitelogo/sitelogo.png","telephone":"01454 324 695","servesCuisine":"Pizza & Kebab","address":{"@type":"PostalAddress","streetAddress":"No 3 Heron Way, Chipping Sodbury","addressLocality":"Yate, Bristol","postalCode":"BS37 6XW","addressCountry":"GB"},"geo":{"@type":"GeoCoordinates","latitude":"51.530780","longitude":"-2.406100"},"openingHoursSpecification":[{"@type":"OpeningHoursSpecification","dayOfWeek":"https://schema.org/Sunday","opens":"17","closes":"21:45"},{"@type":"OpeningHoursSpecification","dayOfWeek":"https://schema.org/Monday","opens":"17","closes":"22:45"},{"@type":"OpeningHoursSpecification","dayOfWeek":"https://schema.org/Tuesday","opens":"17","closes":"22:45"},{"@type":"OpeningHoursSpecification","dayOfWeek":"https://schema.org/Wednesday","opens":"17","closes":"22:45"},{"@type":"OpeningHoursSpecification","dayOfWeek":"https://schema.org/Thursday","opens":"17","closes":"22:45"},{"@type":"OpeningHoursSpecification","dayOfWeek":"https://schema.org/Friday","opens":"17","closes":"22:45"},{"@type":"OpeningHoursSpecification","dayOfWeek":"https://schema.org/Saturday","opens":"17","closes":"22:45"}]}
13</script>
13
14
15
16  <meta name="viewport" content="width=device-width, initial-scale=1">
17  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
18  <meta name="theme-color">
19  <link rel="icon" href="data:;base64,=">
20  <meta charset="utf-8" />
21  <link rel="stylesheet" type="text/css" href="css/style.css" />
22  <link href="css/theme.css?v=5" rel="stylesheet">
23  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,300,100">
24 
25  <meta name="appleid-signin-client-id" content="com.boostit.appleSignIn">
26  <meta name="appleid-signin-scope" content="name email">
27  <meta name="appleid-signin-redirect-uri" content="https://firatsplace.co.uk/auth/apple/callback">
28  <meta name="appleid-signin-state" content="origin:web">
29  <meta name="appleid-signin-use-popup" content="true">
30
31  <style>
32
33
34.rowff .col-xs-6{
35width: 50% !important;
36}
37
38.rowff .col-xs-12{
39text-align:center;
40}
41
42    #appleid-signin{
43      width: 235px;
44        height: 50px;
45        text-align: center;
46        display: inline-block;
47
48        width: 235px;
49    height: 51px;
50    text-align: center;
51    display: inline-block;
52    background: black;
53    line-height: 50px;
54    display: -webkit-inline-box;
55    /* margin-top: -10px; */
56    padding: 5px 0px;
57    border-radius: 8px;
58    
59    }
60
61    
62
63    
64    .appleid-signin{
65      width: 235px;
66        height: 50px;
67        text-align: center;
68        display: inline-block;
69
70        width: 235px;
71    height: 51px;
72    text-align: center;
73    display: inline-block;
74    background: black;
75    line-height: 50px;
76    display: -webkit-inline-box;
77    /* margin-top: -10px; */
78    padding: 5px 0px;
79    border-radius: 8px;
80    
81    }
82
83    .appleButton {
84      width: 245px;
85    height: 56px;
86    background: black;
87    border: none;
88    border-radius: 8px;
89    padding: 5px 0;
90    cursor: pointer;
91    display: inline-flex;
92    justify-content: center;
93    align-items: center;
94}
95
96.appleButton img {
97       width: auto;
98    /* height: 58px; */
99    display: block;
100    transform: scale(1.35);
101}
102.s2x1y1{
103  overflow-x: hidden;
104}
105 
106.s2x1y1ios{
107  overflow-x: hidden;
108}
109
110 
111 
112    
113    
114    .social-btn .btn {
115        border: none;
116        margin: 10px 3px 0;
117        opacity: 1;
118        width: 45%;
119        height: 47px;
120        padding: 12px 27px;
121        font-size: 14px;
122        border-radius: 9px;
123    }
124    
125    </style>
126
127</head>
128
129<body>
130
131  <div id="modalArea"></div>
132  <div id="modalArea3"></div>
133 
134 
135  <div class="page">
136    <div class="page-loader" style="background:black;">
137      <div class="page-loader-body">
138        <div class="cssload-container">
139           <img src="/sitelogo/sitelogo.png" style="margin-top:-150px;  ">
140        </div>
141      </div>
142    </div>
143  </div>
144  <header class="page-head">
145    <div class="rd-navbar-wrap rd-navbar-minimal">
146      <nav data-layout="rd-navbar-fixed" data-sm-layout="rd-navbar-fixed" data-md-device-layout="rd-navbar-fixed"
147        data-lg-layout="rd-navbar-static" data-lg-device-layout="rd-navbar-static" data-stick-up-clone="false"
148        data-md-stick-up-offset="100px" data-lg-stick-up-offset="100px" class="rd-navbar">
149        <div class="shell shell-fluid">
150          <div class="rd-navbar-inner">
151            <!-- RD Navbar Panel-->
152            <div class="rd-navbar-panel">
153              <!-- RD Navbar Toggle-->
154              <button data-rd-navbar-toggle=".rd-navbar-nav-wrap" class="rd-navbar-toggle">
155                <span></span>
156              </button>
157              <a href="/menu" class="rd-navbar-brand brand" id="menuhxy">
158                <div class="brand-logo"  > 
159                   <img src="/sitelogo/sitelogo.png" height="90" style="     width: 52px; height: 41px;" alt="">
160                </div>
161              </a>
162              <div class=" rd-navbar-brand brand" id="cartdivision" onclick="enableCart();">
163                <div class="shop-cardt">
164                      <!-- <i class="thin-icon-cartShop icon-basket-general"></i> -->
165
166     <svg width="30" height="30" viewBox="0 0 24 24" fill="" stroke="green" stroke-width="2.0" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" style="margin-right:4px;">
167  <circle cx="9" cy="21" r="1"></circle>
168  <circle cx="20" cy="21" r="1"></circle>
169  <path d="M1 1h4l2.7 13.4a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.4L23 6H6"></path>
170</svg>
171
172
173 <!-- <svg class="nav-iconx" viewBox="0 0 24 24" aria-hidden="true">
174  <path d="M3 6h18M3 12h18M3 18h18"
175        stroke="currentColor"
176        stroke-width="2.5"
177        stroke-linecap="round"/>
178</svg> -->
179
180
181                    <a id="basketShow" class="basketClass basketxyz" style="display:inline;">0 Items </a>
182                </div>
183              </div> 
184            </div>
185            <div class="rd-navbar-nav-wrap">
186              <ul class="rd-navbar-nav">
187               <li id="menlink">
188  <a href="/menu" class="navbar-iconx">
189    
190<svg class="nav-iconx" viewBox="0 0 24 24" aria-hidden="true">
191  <path d="M6 2v8M9 2v8M6 6h3M7.5 10v12" 
192        stroke="currentColor" 
193        stroke-width="1.8" 
194        stroke-linecap="round"/>
195
196  <path d="M14 2c0 4 4 4 4 8v12" 
197        stroke="currentColor" 
198        stroke-width="1.8" 
199        stroke-linecap="round"/>
200</svg>
201    <span>MENU</span>
202    
203  </a>
204</li>
205               <li>
206 
207
208 
209
210<a href="/checkout" class="navbar-iconx">
211  <span class="checkout-svg-wrap">
212   <svg class="nav-iconx" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
213    <circle cx="9" cy="21" r="1"></circle>
214    <circle cx="20" cy="21" r="1"></circle>
215    <path d="M1 1h4l2.7 13.4a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.4L23 6H6"></path>
216  </svg>
217  </span>
218  <span class="checkout-text">CHECKOUT</span>
219</a>
220
221  
222</li>
223                
224                <li>
225                  <a class="navbar-icon thin-icon-key" data-toggle="modal" data-target="#loginModal">Login </a>
226                </li>
227                <li>
228                  <a class="navbar-icon thin-icon-layers" data-toggle="modal" data-target="#registerModal">Register </a>
229                </li>
230                
231 
232                 
233                 <li>
234  <a href="/contact" class="navbar-iconx">
235    <span class="checkout-svg-wrap">
236      <svg class="nav-iconx" viewBox="0 0 24 24">
237        <rect x="3" y="5" width="18" height="14" stroke="currentColor" stroke-width="1.8" fill="none"/>
238        <path d="M3 7l9 6 9-6" stroke="currentColor" stroke-width="1.8" fill="none"/>
239      </svg>
240    </span>
241    <span class="checkout-text">Contact</span>
242  </a>
243</li>
244              
245
246 
247                 <li>
248  <a class="navbar-iconx" href="tel:01454 324 695">
249    <span class="checkout-svg-wrap">
250      <svg class="nav-iconx" viewBox="0 0 24 24">
251        <path d="M22 16.9v3a2 2 0 0 1-2.2 2
252                 19.8 19.8 0 0 1-8.6-3.1
253                 19.5 19.5 0 0 1-6-6
254                 19.8 19.8 0 0 1-3.1-8.7A2 2 0 0 1 4.1 2h3
255                 a2 2 0 0 1 2 1.7c.1.8.3 1.5.6 2.2
256                 a2 2 0 0 1-.5 2.1L8 9
257                 a16 16 0 0 0 6 6l1-1.2
258                 a2 2 0 0 1 2.1-.5c.7.3 1.4.5 2.2.6
259                 a2 2 0 0 1 1.7 2z"
260              stroke="currentColor" stroke-width="1.8" fill="none"/>
261      </svg>
262    </span>
263    <span class="checkout-text">01454 324 695</span>
264  </a>
265</li>
266                
267                
268                
269              </ul>
270            </div>
271          </div>
272        </div>
273      </nav>
274    </div>
275  </header>
276 
277 
278
279<main class="bo-legal-page">
280  
281  <style>
282    body { background:#f4f4f5; }
283    .bo-legal-page { width:min(calc(100% - 24px),820px); margin:28px auto; padding:28px; border:1px solid #ddd; border-radius:14px; background:#fff; color:#292733; font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; line-height:1.55; box-shadow:0 3px 14px rgba(0,0,0,.1); }
284    .bo-legal-copy h1 { margin:0 0 8px; color:#dc4c46; font-size:clamp(1.7rem,5vw,2.3rem); }
285    .bo-legal-copy p { height:auto; margin:10px 0; font-size:16px; text-align:left; }
286    .bo-legal-back { display:inline-flex; margin-top:18px; color:#08799b; font-weight:700; }
287    @media(max-width:560px){.bo-legal-page{width:calc(100% - 12px);margin:8px auto;padding:20px 16px;border-radius:11px}.bo-legal-copy p{font-size:15px}}
288  </style>
289  
290  <article class="bo-legal-copy">
291    <h1>Allergy Notice</h1>
292    <p>Effective date: March 01, 2019</p>
293    <p><strong>Firat Place</strong></p>
294    <p>Management advises that food prepared here may contain or have come in contact with peanuts, tree nuts, soybeans, milk, eggs, wheat, shellfish or fish. Please ask a member of staff about ingredients in your meal before placing your order.</p>
295  </article>
296  <a class="bo-legal-back" href="/menu">Return to menu</a>
297</main>
298
299 
300<footer id="footer">
301  <div class="footer-part     text-center"   >
302    <span>
303      <a onclick="window.open('/allergy', '_blank', 'location=no,height=570,width=320,scrollbars=yes,status=yes')" style="color:#fff;">Allergen Information</a>
304    </span>
305      
306    <h6 style="color:red">Open 7 Days A Week</h6>
307 
308    <h6 style="color:white; font-size:16px; font-weight: 400;">Download our applications or use our webpage to place order.</h6>
309<div class="rowff">
310      <div class="col-xs-12"> <a class="btn btn-burnt-sienna btn-md btn-shape-circle offset-top-20 addButton navbar-icon thin-icon-house website" href="/menu">Menu</a> </div><div class="col-xs-6" style="text-align: right;">  <a href="https://play.google.com/store/apps/details?id=com.boost_it.firatsplace"><img src="https://rookcala.sirv.com/playStore.png"  style="height:43px;"></a></div><div class="col-xs-6" style="text-align: left;">  <a href="https://apps.apple.com/us/app/firats-place-pizzas-kebabs/id1435486524"><img src="https://rookcala.sirv.com/appStore.png"  style="height:43px;"></a></div>  
311</div>
312    <div class="container">
313      <div class="footer-inner">
314        <div class="footer-info">
315          <div class="brand-logo" style="margin-top:10px; margin-bottom:10px;">
316              <img src="/sitelogo/sitelogo.png" height="60px" style="margin-bottom:6px;">
317          </div>
318          <p>No 3 Heron Way, Chipping Sodbury,Yate,BS37 6XW</p>
319          <p>
320            <a href="tel:01454 324 695" style="font-size:14px;" id="shopTel">01454 324 695</a>
321          </p>
322        </div>
323      </div>
324      <div class="copy-right">
325        <div class="row">
326          <div class="col-md-12 col-sm-12 col-xs-12  text-center ">
327            <span>
328              <a onclick="window.open('/copyright', '_blank', 'location=no,height=570,width=320,scrollbars=yes,status=yes')">Copyright Firat Place All Rights Reserved.</a>
329            </span>
330            <br>
331            <span>
332              <a onclick="window.open('/terms', '_blank', 'location=no,height=570,width=320,scrollbars=yes,status=yes')" style="color:#fff;">Terms &amp; Conditions</a>
333            </span><br>
334            <span>
335              <a onclick="window.open('/disclaimer', '_blank', 'location=no,height=570,width=320,scrollbars=yes,status=yes')" style="color:#fff;">Service Disclaimer</a>
336            </span>
337          </div>
338        </div>
339      </div>
340    </div>
341  </div>
342  <div id="cookieConsent" style="position: fixed; bottom: 45px; background-color:  #272626; width: 100%; text-align: center; color:#fff;   font-weight: 400; display:none;"> 
343    This website is using cookies for better browsing experience.<button class="cookieConsentOK"  style=" background: #822222; border: none; border-radius: 5px;">I agree.</button>
344    <h>Click here for our  <a href="/terms">Cookie Policy</a></h>
345</div>
346</footer>
347
348  <div class="modal fade " id="popupModal" tabindex="-1" role="dialog" aria-labelledby="popupModal">
349  <div class="modal-dialog modal-sm popupxx" role="dialog">
350    <div class="modal-content" style="margin-top: 5%;  overflow: hidden;">
351      <div class="modal-body modal-bodyxx popupbodyxx" style="background:white;">
352        <button type="button" class="close_new2x" data-dismiss="modal" aria-label="Close" style="top: 10px;">  × </button>
353        <div class="table-title" style="margin-bottom: 0px; margin-top:8px;">
354          <h2 class="cartclass">Shopping Cart </h2>
355
356          <div class="cartwrap">  
357         <svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke="green" stroke-width="2.0" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" style="margin-right:4px;">
358  <circle cx="9" cy="21" r="1"></circle>
359  <circle cx="20" cy="21" r="1"></circle>
360  <path d="M1 1h4l2.7 13.4a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.4L23 6H6"></path>
361</svg>
362          <p id="basketShow2"   class="basketxyz"> </p>
363        </div>
364        </div>
365        <div class="cart-wdrap" id="cart-blogs" style="margin-top:10px;">
366          <div class="cart-blog row " id="cartPopUp" >
367            <div class="cart-btn  col-xs-12" style=" margin-bottom: 20px;  width:100%;">
368              <!-- <a href="javascript:;" onclick="clearCarts();" class="btn-black cartMainButtons"  >Clear Cart</a> -->
369
370
371      
372  <a href="/checkout"  class="btn-main cartMainButtons"> CHECK OUT  <span class="arrow">➜</span></a> 
373
374
375            </div>
376              <div class="cartpopupitems popupxyz" id="cartPopUpx"></div>
377            </div>
378        </div>
379      </div>
380    </div>
381  </div>
382</div>
383
384 
385 
386<div class="modal fade " id="optionmodal" tabindex="-1" role="dialog" aria-labelledby="optionmodal" style="z-index: 99999999999 !important;">
387  <div class="modal-dialog modal-sm" role="dialog">
388    <div class="modal-content" style="margin-top: 5%; padding:46px; background:transparent; border:none;">
389      <div class="modal-body" style="background:white; margin-top: 3px !important;">
390        <div class="cart-wdrap" id="optionsmenu">
391        </div>
392      </div>
393    </div>
394  </div>
395</div>
396
397<div class="modal fade " id="loginModal" tabindex="-1" role="dialog" aria-labelledby="loginModal">
398  <div class="modal-dialog modal-sm loginModalx" role="dialog">
399    <div class="modal-content modal-contentx" style="margin-top: 30%;">
400      <div class="modal-body modal-bodyx modal-logx" style=" padding: 2px 3px 3px 3px;">
401        <button type="button" class="close_new fa fa-close" data-dismiss="modal" aria-label="Close"> </button>
402        <div class="table-title">
403          <h2 class="headersLog">Login</h2>
404          <h6 class="heade-xs btn lpassword" onclick="lostPassword();" style="color:red; margin-bottom: -15px;" id="lostPasswordOpen">Lost your password ? Click Here</h6>
405        </div>
406        <form class="form" id="loginForms">
407          <div class="row" id="loginForm">
408
409
410           <div class="col-md-12 col-sm-12 col-xs-12" style="position:relative;">
411
412  <span class="icony">
413    <svg viewBox="0 0 24 24">
414      <rect x="3" y="5" width="18" height="14"></rect>
415      <path d="M3 7l9 6 9-6"></path>
416    </svg>
417  </span>
418
419  <input type="text"
420         name="username"
421         placeholder="Your E-Mail"
422         class="input-fields with-icon"
423         id="username2"
424         style="text-transform: lowercase;">
425
426</div>
427
428
429      <div class="col-md-12 col-sm-12 col-xs-12" style="position:relative;">
430
431  <!-- LOCK ICON -->
432  <span class="icony">
433    <svg viewBox="0 0 24 24">
434      <rect x="5" y="11" width="14" height="9"></rect>
435      <path d="M8 11V8a4 4 0 0 1 8 0v3"></path>
436    </svg>
437  </span>
438
439  <!-- INPUT -->
440  <input type="text"
441         name="search"
442         placeholder="Password"
443         class="input-fields with-icon passfield"
444         id="password2"
445         onfocus="this.type='password'"
446         autocorrect="off"
447         autocapitalize="none">
448
449  <!-- EYE ICON -->
450  <span class="eye-toggle" onclick="togglePasswordField(this)">
451    <svg viewBox="0 0 24 24">
452      <path d="M1 12s4-6 11-6 11 6 11 6-4 6-11 6-11-6-11-6z"/>
453      <circle cx="12" cy="12" r="3"/>
454    </svg>
455  </span>
456
457</div>
458
459
460
461            
462            <div class="or-left"></div><div class="or-right"></div>
463            <div class="col-md-12 col-sm-12 col-xs-12" style="margin-top:8px;">
464              <input type="submit" name="submit" class="btn-main submitButtons" value="Login" style=" width:100%; margin-bottom:18px;" id="loginButton1">
465            </div>
466
467            <div class="or-seperatorx1" style="  margin: 16px 20px 0 20px !important; font-size:14px;"><i>New Customer? </i></div>
468      
469    
470            <div class="col-xs-12  "  >
471                  <a class="btn  registerB" href="#"  style="font-size:16px; margin-bottom:4px;" onclick="regModal();">  Register</a>
472            </div>
473
474            
475            <div class="col-md-12 col-sm-12 col-xs-12" id="socialLoginsx">
476            <div class="or-seperator" style="margin-top:14px !important;"><i>or</i></div>
477            <p class="text-center xxc" style="height:27px !important;">Login with your social media account</p>
478            <div class="text-center social-btn">
479              <div class="fb-login-button" data-width="" data-size="large" data-button-type="continue_with" data-layout="default" data-auto-logout-link="false" data-use-continue-as="false"></div>
480
481              
482             <div id="appleid-signin" data-color="black" data-border="true" data-type="sign in"></div>
483              
483<script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>
483 
484              
485
486                <a href="/auth/facebook" class="btn btn-primary"><i class="fa fa-facebook"></i>&nbsp; Facebook</a>
487                <a href="/auth/google" class="btn btn-danger"><i class="fa fa-google-plus"></i>&nbsp; Google</a>
488            </div>
489
490            <h1 class="terms" style="margin-top:10px;"> By logging via social platforms you accept the  <a onclick="termsconditions();">terms &amp; conditions</a></h1>
491    
492          </div>
493          
494          <!--  -->
495          </div>
496        </form>
497      </div>
498    </div>
499  </div>
500</div>
501
502<div class="modal fade " id="fgModal" tabindex="-1" role="dialog" aria-labelledby="fgModal">
503  <div class="modal-dialog modal-sm modal-dialogx" role="dialog">
504    <div class="modal-content modal-contentx" style="margin-top: 30%;">
505      <div class="modal-body modal-bodyx" style=" padding: 2px 3px 3px 3px;">
506        <button type="button" class="close_new fa fa-close" data-dismiss="modal" aria-label="Close"> </button>
507        <form class="form" id="sendForgottenForm">
508          <h2 class="heade-xs2">Please enter your email and follow the instructions</h2>
509
510          <div id="lostPassword">
511
512            <div class="col-md-12 col-sm-12 col-xs-12">
513              <span class="icony">
514    <svg viewBox="0 0 24 24">
515      <rect x="3" y="5" width="18" height="14"></rect>
516      <path d="M3 7l9 6 9-6"></path>
517    </svg>
518  </span> 
519  
520  
521  <input type="text" name="email" placeholder="Your E-Mail" class="input-fields" id="forgetEmail">
522            </div>
523
524
525            <div class="col-md-12 col-sm-12 col-xs-12">
526              <input type="submit" name="submit" class="btn-main submitButtons" value="Send Reset Link" style="width:100%;" id="resetlinkbutton">
527            </div>
528        </form>
529        <form class="form" id="changefpassword">
530          <div class="col-md-12 col-sm-12 col-xs-12">
531            <h2 class="headersLogx">Enter the code sent to you by email or follow the link in the email to change your password</h2>
532          </div>
533          <div class="col-md-12 col-sm-12 col-xs-12">
534                     <span class="icony">
535    <svg viewBox="0 0 24 24">
536      <rect x="3" y="5" width="18" height="14"></rect>
537      <path d="M3 7l9 6 9-6"></path>
538    </svg>
539  </span> <input type="text" name="email" placeholder="Your E-Mail" class="input-fields" id="forgetEmailxx" required>
540          </div>
541          <div class="col-md-12 col-sm-12 col-xs-12">
542            
543           <span class="icony">
544  <svg viewBox="0 0 24 24">
545    <path d="M10 3L8 21"></path>
546    <path d="M16 3L14 21"></path>
547    <path d="M4 9h17"></path>
548    <path d="M3 15h17"></path>
549  </svg>
550</span>
551            
552            <input type="text" name="number" placeholder="Reset Code" class="input-fields" id="resetcode" required>
553          </div>
554          <div class="col-md-12 col-sm-12 col-xs-12">
555
556
557              <span class="icony">
558    <svg viewBox="0 0 24 24">
559      <rect x="5" y="11" width="14" height="9"></rect>
560      <path d="M8 11V8a4 4 0 0 1 8 0v3"></path>
561    </svg>
562  </span>
563            
564            <input type="text" name="search" placeholder="Password" class="input-fields passfield" id="password1xx" onfocus="this.type='password'" autocorrect="off" autocapitalize="none" required> 
565            
566              <span class="eye-toggle" onclick="togglePasswordField(this)">
567    <svg viewBox="0 0 24 24">
568      <path d="M1 12s4-6 11-6 11 6 11 6-4 6-11 6-11-6-11-6z"/>
569      <circle cx="12" cy="12" r="3"/>
570    </svg>
571  </span>
572          </div>
573          <div class="col-md-12 col-sm-12 col-xs-12">
574             <span class="icony">
575    <svg viewBox="0 0 24 24">
576      <rect x="5" y="11" width="14" height="9"></rect>
577      <path d="M8 11V8a4 4 0 0 1 8 0v3"></path>
578    </svg>
579  </span>
580            
581            
582            <input type="text" name="search" placeholder="Confirm Password" class="input-fields passfield" id="verifypassword1xx" onfocus="this.type='password'" autocorrect="off" autocapitalize="none" required> 
583            
584             <span class="eye-toggle" onclick="togglePasswordField(this)">
585    <svg viewBox="0 0 24 24">
586      <path d="M1 12s4-6 11-6 11 6 11 6-4 6-11 6-11-6-11-6z"/>
587      <circle cx="12" cy="12" r="3"/>
588    </svg>
589  </span>
590
591          </div>
592          <div class="col-md-12 col-sm-12 col-xs-12" style="padding-bottom:20px;">
593            <input type="submit" name="submit" class="btn-main submitButtons" value="Change Password" style="width:100%;" onclik="changefpassword();">
594          </div>
595        </form>
596      </div>
597    </div>
598  </div>
599</div>
600</div>
601
602<div class="modal fade" id="appAlert" tabindex="-1" role="dialog" aria-labelledby="appAlert">
603  <div class="modal-dialog modal-sm" role="dialog">
604    <div class="modal-content" style="background: transparent; border: none;">
605      <div class="modal-body" style="padding: 4px;">
606        <div class="yes-no" style="min-height: 130px;">
607          <h2 class="coolal-title" id="appAlertTitle"></h2>
608          <p class="coolal-text" id="appAlertText"></p>
609
610          <div id="appAlertFooter" class="coolal-btnWrapper">
611            <a href="javascript:;" class="coolal-yes" data-dismiss="modal">OK</a>
612          </div>
613        </div>
614      </div>
615    </div>
616  </div>
617</div>
618
619 
620<div class="modal fade " id="iosAlert" tabindex="-1" role="dialog" aria-labelledby="iosAlert"> 
621  <div class="modal-dialog modal-sm" role="dialog">
622    <div class="modal-content" style="background: transparent; border:none;">
623      <div class="modal-body" style=" padding: 2px 3px 3px 3px;  ">
624        <div id="coolal" class="yes-no" style="height: 154px; opacity: 1; top: 0px;">
625          <h2 class="coolal-title"id="titlex1"></h2>
626          <p class="coolal-text" id="textx1">
627          </p>
628          <div id="coolal-btnWrapper" data-dismiss="modal" aria-label="Close"><a id="coolal-btn" class="coolal-yes-no coolal-yes" href="#" class="close_new fa fa-close" data-dismiss="modal" aria-label="Close">OK</a> </div>
629        </div>
630      </div>
631    </div>
632  </div>
633</div>
634
635<div class="modal fade " id="iosAlertx" tabindex="-1" role="dialog" aria-labelledby="iosAlertx">
636  <div class="modal-dialog modal-sm modal-dialogx" role="dialog">
637    <div class="modal-content modal-contentx" style="background: transparent;">
638      <div class="modal-body modal-bodyx" style=" padding: 2px 3px 3px 3px;">
639        <div id="coolal" class="yes-no" style="height: 135px; opacity: 1; top: 0px;  height: max-content !important;">
640          <h2 class="coolal-title" id="titlex"></h2>
641          <p class="coolal-text" id="textx"></p>
642          <div id="coolal-btnWrapperx">
643            
644          </div>
645        </div>
646      </div>
647    </div>
648  </div>
649</div>
650
651      
652
653
654<div class="modal fade " id="telephoneModal" tabindex="-1" role="dialog" aria-labelledby="telephoneModal">
655  <div class="modal-dialog modal-sm modal-dialogx profileModalxx" role="dialog">
656    <div class="modal-content modal-contentx contentxx">
657      <div class="modal-body modal-bodyx modal-telx" style=" padding: 2px 3px 3px 3px;">
658        <button type="button" class="close_new fa fa-close" data-dismiss="modal" aria-label="Close"> </button>
659        <form id="telephoneForm">
660          <div class="row">
661
662      
663
664            <div class="col-md-12 col-sm-12 table-titlex">
665              <h6 class="heade-xs2" id="profilxtel">Please update your phone number and name in case we need to contact you regarding to your order</h6>
666              <h6 class="heade-xs2" id="telxtel" style="display:none;">Update your phone number</h6>
667            </div>
668
669            
670 
671
672
673            <div class="col-md-12 col-sm-12 col-xs-12" id="telephoneModalName">
674               <label for="contactName3x" class="field-label">Name</label>
675              <i class="fa fa-icon-name1 icon-classes-general"></i> <input type="text" name="contactName3x" placeholder="Name" class="input-fields" id="contactName3x" required>
676              </div>
677              <div class="col-md-12 col-sm-12 col-xs-12" style="margin-bottom:30px;">
678                 <label for="telephone3x" class="field-label">Telephone</label>
679                <i class="fa fa-icon-telephone1 icon-classes-general"></i> 
680              <input type="tel" name="number3x" placeholder="Telephone (e.g. 07761 111111)" class="input-fields" id="telephone3x"  inputmode="tel" required >
681              </div>
682              <div class="col-md-12 col-sm-12 col-xs-12" style="margin-bottom:15px; margin-top:5px;">
683                <input type="submit" name="submit" class="btn-main submitButtons" value="Save Changes" style="width:100%;"   required>
684                <span class="validity"></span>
685              </div>
686            </div>
687          
688        </form>
689      </div>
690      </div>
691    </div>
692  </div>
693 
694
695 
696 
697
698<div class="modal fade " id="passChangeModal" tabindex="-1" role="dialog" aria-labelledby="passChangeModal">
699  <div class="modal-dialog modal-sm modal-dialogx" role="dialog">
700    <div class="modal-content modal-contentx">
701      <div class="modal-body modal-bodyx" style=" padding: 2px 3px 3px 3px;">
702        <button type="button" class="close_new fa fa-close" data-dismiss="modal" aria-label="Close"> </button>
703        <div class="table-title">
704          <h6 class="heade-xs2">Change your password</h6>
705        </div>
706        <form id="changePassForm">
707          <div class="row">
708            <div class="col-md-12 col-sm-12 col-xs-12">
709              <div class="col-md-12 col-sm-12 col-xs-12">
710                <label for="password3x" class="form-label form-label-outside chpassword">New Password </label>
711                <input id="password3x" type="search" name="password" required pattern=".{5,30}" title="Min 5, Max 30 Characters" class="form-control"  autocomplete="off" onfocus="this.type='password'" autocorrect="off" autocapitalize="none">
712              </div>
713              <div class="col-md-12 col-sm-12 col-xs-12">
714                <label for="retypex" class="form-label form-label-outside chpassword">Re-Type New Password </label>
715                <input id="retypex" type="search" name="password" required pattern=".{5,30}" title="Min 5, Max 30 Characters" class="form-control" onfocus="this.type='password'" autocorrect="off" autocapitalize="none">
716              </div>
717              <div class="col-md-12 col-sm-12 col-xs-12" style="margin-bottom:25px; margin-top:20px;">
718                <input type="submit" name="submit" class="btn-main submitButtons" value="Change Password" style="width:100%;" id="changesPassword" required>
719                <span class="validity"></span>
720              </div>
721            </div>
722          </div>
723        </form>
724      </div>
725    </div>
726  </div>
727</div>
728 
729
730<div class="modal fade " id="aboutUs" tabindex="-1" role="dialog" aria-labelledby="aboutUs">
731  <div class="modal-dialog modal-sm modal-dialogx" role="dialog">
732    <div class="modal-content modal-contentx">
733      <div class="modal-body modal-bodyx" style=" padding: 2px 3px 3px 3px;">
734        <button type="button" class="close_new fa fa-close" data-dismiss="modal" aria-label="Close"> </button>
735        <div class="table-title">
736          <h6 class="heade-xs2"></h6>
737          <h6 class="heade-xs2">If you have any questions or inqueries please contact us.</h6>
738        </div>
739        <div class="row">
740          <div class="col-md-12 col-sm-12 col-xs-12">
741            <h6 class="heade-xs23">Opening Days</h6>
742            <h6 class="heade-xs24" id="openingDays"> </h6>
743          </div>
744          <div class="col-md-12 col-sm-12 col-xs-12">
745            <h6 class="heade-xs23">Phone</h6>
746            <h6 class="heade-xs24" id="phoneShop">
747              <li class="navbar-icon thin-icon-phonenav"></li> <a class="telclaz" href="callto:01454 324 695 ">
748                01454 324 695
749              </a>
750            </h6>
751          </div>
752          <div class="col-md-12 col-sm-12 col-xs-12">
753            <h6 class="heade-xs23">Address</h6>
754            <h6 class="heade-xs24" id="shopAddressx"> </h6>
755          </div>
756          <div class="col-md-12 col-sm-12 col-xs-12" style="margin-bottom:20px;">
757            <h6 class="heade-xs23">Promotions</h6>
758            <h6 class="heade-xs24" id="promotions"> </h6>
759          </div>
760        </div>
761      </div>
762    </div>
763  </div>
764</div>
765
766<div class="modal fade " id="addressModal" tabindex="-1" role="dialog" aria-labelledby="addressModal">
767  <div class="modal-dialog modal-sm modal-dialogx profileModalxx" role="dialog">
768    <div class="modal-content modal-contentx contentxx">
769      <div class="modal-body modal-bodyx modal-telx" style=" padding: 2px 3px 3px 3px;">
770        <button type="button" class="close_new fa fa-close" data-dismiss="modal" aria-label="Close"> </button>
771        <form id="addressForm3x">
772          <div class="row">
773            <div class="col-md-12 col-sm-12 table-titlex">
774              <h6 class="heade-xs2">Please update your address and postcode for delivery</h6>
775            </div>
776             
777            <div class="col-md-12 col-sm-12 col-xs-12">
778              <i class="fa fa-icon-name1 icon-classes-general"></i> <input type="text" name="contactName2x" placeholder="Name" class="input-fields" id="contactName2x" required>
779              </div>
780              <div class="col-md-12 col-sm-12 col-xs-12">
781                <i class="fa fa-icon-telephone1 icon-classes-general"></i>
782
783<input
784  type="tel"
785  name="number2x"
786  placeholder="Telephone (e.g. 07761 111111)"
787  class="input-fields"
788  id="telephone2x"
789  inputmode="tel"
790  required
791>
792              </div>
793              <div class="row" style="margin:0;" id="postcodeUpdate">
794              <div class="col-md-12 col-sm-12 col-xs-12">
795                <i class="fa fa-icon-address1 icon-classes-general"></i> <input type="text" name="address2x" placeholder="Address" class="input-fields" id="address2x" title="Between 2 -55 charachters" pattern=".{2,75}" required  oninvalid="this.setCustomValidity('Between 2-55 charachters')"
796                onchange="try{setCustomValidity('')}catch(e){}">
797              </div>
798              
799              <div class="col-md-12 col-sm-12 col-xs-12"  >
800                <i class="fa fa-icon-postcode1 icon-classes-general"></i> <input type="text" name="postcode2x" placeholder="Postcode" class="input-fields" id="postcode2x" required   oninvalid="this.setCustomValidity('Use a valid postcode')"
801                onchange="try{setCustomValidity('')}catch(e){}">
802              </div>
803              </div>
804              <div class="col-md-12 col-sm-12 col-xs-12" style="margin-bottom:15px; margin-top:5px;">
805                <input type="submit" name="submit" class="btn-main submitButtons" value="Save Changes" style="width:100%;" required>
806                <span class="validity"></span>
807              </div>
808          
809          </div>
810        </form>
811      </div>
812    </div>
813  </div>
814</div>
815
816
817<div class="modal fade " id="profileModal" tabindex="-1" role="dialog" aria-labelledby="profileModal">
818  <div class="modal-dialog modal-sm modal-dialogx profileModalxx" role="dialog">
819    <div class="modal-content modal-contentx contentxx">
820      <div class="modal-body modal-bodyx" style=" padding: 2px 3px 3px 3px;">
821        <button type="button" class="close_new fa fa-close" data-dismiss="modal" aria-label="Close"> </button>
822        <div class="table-title">
823          <h6 class="heade-xs2">View or change your details</h6>
824          <h6 class="heade-xs2 " style="display:none;" id="addressWarning">Your delivery address seems incomplete. Please add your house/flat number or house name, then save your details.
825</h6>
826          <div class="col-md-12 col-sm-12 col-xs-12" style="margin-bottom:8px;" id="deleteAccountDiv">
827            <input type="submit" name="submit" class="btn-main submitButtons" value="Delete my Account"   id="deleteAccount" onclick="deleteAccount();">
828            <span class="validity"></span>
829          </div>
830          <h6 class="heade-xs2" id="email-xs2">Please use a valid email address if you would like to get order notifications</h6>
831        </div>
832   <form id="myProfileForm">
833    <input type="hidden" id="profileAddressConfirmed" value="no">
834  <div class="row">
835    <div class="col-md-12 col-sm-12 col-xs-12">
836
837     <!-- NAME -->
838<div class="col-md-12 col-sm-12 col-xs-12" id="profileModalName">
839  <label for="name1x" class="field-label">Name</label>
840
841  <span class="iconx">
842    <svg viewBox="0 0 24 24">
843      <circle cx="12" cy="8" r="4"></circle>
844      <path d="M4 20c0-4 4-6 8-6s8 2 8 6"></path>
845    </svg>
846  </span>
847
848  <input type="text" name="name" placeholder="Name"
849         class="input-fields with-icon" id="name1x" required>
850</div>
851
852<!-- EMAIL -->
853<div class="col-md-12 col-sm-12 col-xs-12" id="profileModalEmail">
854  <label for="email1x" class="field-label">Email</label>
855
856  <span class="iconx">
857    <svg viewBox="0 0 24 24">
858      <rect x="3" y="5" width="18" height="14"></rect>
859      <path d="M3 7l9 6 9-6"></path>
860    </svg>
861  </span>
862
863  <input type="email" name="emails"
864         placeholder="Your E-Mail ( [email protected] )"
865         class="input-fields with-icon" id="email1x" required>
866</div>
867
868<!-- TELEPHONE -->
869<div class="col-md-12 col-sm-12 col-xs-12" id="profileModalTelephone">
870  <label for="telephone1x" class="field-label">Telephone</label>
871
872  <span class="iconx">
873    <svg viewBox="0 0 24 24">
874    <path d="M22 16.9v3a2 2 0 0 1-2.2 2
875                 19.8 19.8 0 0 1-8.6-3.1
876                 19.5 19.5 0 0 1-6-6
877                 19.8 19.8 0 0 1-3.1-8.7A2 2 0 0 1 4.1 2h3
878                 a2 2 0 0 1 2 1.7c.1.8.3 1.5.6 2.2
879                 a2 2 0 0 1-.5 2.1L8 9
880                 a16 16 0 0 0 6 6l1-1.2
881                 a2 2 0 0 1 2.1-.5c.7.3 1.4.5 2.2.6
882                 a2 2 0 0 1 1.7 2z"></path>
883    </svg>
884  </span>
885
886<input
887  type="tel"
888  name="number"
889  placeholder="Telephone (e.g. 07761 111111)"
890  class="input-fields with-icon"
891  id="telephone1x"
892  inputmode="tel"
893  required
894>
895</div>
896
897<!-- ADDRESS + POSTCODE -->
898<div class="row" style="margin:0;" id="postcodeUpdate2">
899
900  <!-- ADDRESS -->
901  <div class="col-md-12 col-sm-12 col-xs-12">
902    <label for="address1x" class="field-label">Address</label>
903
904    <span class="iconx">
905      <svg viewBox="0 0 24 24">
906        <path d="M12 21s6-5.5 6-10a6 6 0 0 0-12 0c0 4.5 6 10 6 10z"></path>
907        <circle cx="12" cy="11" r="2"></circle>
908      </svg>
909    </span>
910
911    <input type="text" name="address"
912           placeholder="Address"
913           class="input-fields with-icon"
914           id="address1x"
915           pattern=".{2,85}" required>
916  </div>
917
918  <!-- POSTCODE -->
919  <div class="col-md-12 col-sm-12 col-xs-12">
920    <label for="postcode1x" class="field-label">Postcode</label>
921
922    <span class="iconx">
923       <svg viewBox="0 0 24 24">
924    <path d="M10 3L8 21"></path>
925    <path d="M16 3L14 21"></path>
926    <path d="M4 9h17"></path>
927    <path d="M3 15h17"></path>
928  </svg>
929    </span>
930
931    <input type="text" name="postcode"
932           placeholder="Postcode"
933           class="input-fields with-icon"
934           id="postcode1x" required>
935  </div>
936
937</div>
938
939      <!-- EMAIL NOTIFICATIONS SWITCH (unchanged) -->
940      <div class="col-md-12 col-sm-12 col-xs-12" style=" margin-top:15px;" id="profileModalNotifications">
941        <label class="form-switch switchlabel">
942          <input type="checkbox" id="emailswitch">
943          <i></i>
944          Email Notifications
945        </label>
946      </div>
947
948      <!-- SAVE BUTTON (unchanged) -->
949      <div class="col-md-12 col-sm-12 col-xs-12" style="margin-bottom:15px;" id="saveChangesMyProfile">
950        <input type="submit"
951               name="submit"
952               class="btn-main submitButtons"
953               value="Save Changes"
954               style="width:100%;"
955               id="saveChanges"
956               required>
957        <span class="validity"></span>
958      </div>
959
960    </div>
961  </div>
962</form>
963
964      </div>
965    </div>
966  </div>
967</div>
968
969<div class="modal fade " id="contactModalx" tabindex="-1" role="dialog" aria-labelledby="contactModalx">
970  <div class="modal-dialog modal-sm modal-dialogx" role="dialog">
971    <div class="modal-content modal-contentx">
972      <div class="modal-body modal-bodyx">
973        <button type="button" class="close_new fa fa-close" data-dismiss="modal" aria-label="Close"> </button>
974        <div class="table-title" style="padding:35px;">
975          <h6 class="heade-xs2" style="font-size:18px;">If you have a problem or question about your order please call the shop</h6> 
976          <h6 class="heade-xs2" style="font-size:20px; color:red;"> 01454 324 695 </h6>
977 
978        </div>
979        <!-- <form id="contactForms">
980          <div class="row">
981            <div class="col-md-12 col-sm-12 col-xs-12">
982              <h5 class="formInputsx">About*</h5> 
983            </div>
984            <div class="col-md-12 col-sm-12 col-xs-12">
985              <i class="fa fa-icon-arrow-right icon-classes-general" style="top: 14px;"></i>
986              <select class="timeSelectx input-fields" id="contactTitle" name="subject"  required>
987              </select>
988            </div>
989            <div class="col-md-12 col-sm-12 col-xs-12">
990              <i class="fa fa-icon-name1 icon-classes-general"></i> <input type="text" name="contactName" placeholder="Name" class="input-fields" id="contactName" required>
991            </div>
992            <div class="col-md-12 col-sm-12 col-xs-12">
993              <i class="fa fa-icon-mailLog icon-classes-general"></i> <input type="email" name="email" placeholder="Your E-Mail ( [email protected])" class="input-fields" id="contactEmail" required>
994            </div>
995            <div class="col-md-12 col-sm-12 col-xs-12">
996              <i class="fa fa-icon-telephone1 icon-classes-general"></i> <input type="tel" name="phone" placeholder="Telephone Ex(:0776 111 11 11)" class="input-fields" id="contactTelephone">
997            </div>
998            <div class="col-md-12 col-sm-12 col-xs-12" style="margin-top:10px;">
999              <textarea placeholder="Your Message" id="messageCustomerx" name="message" required></textarea>
1000            </div>
1001            <div class="col-md-12 col-sm-12 col-xs-12" style="margin:16px 0;">
1002              <input type="submit" name="submit" class="btn-main submitButtons" value="Submit Message" style="width:100%;" id="saveChanges" required>
1003              <span class="validity"></span>
1004            </div>
1005            <input type="text" placeholder="Phone" name="address" class="inputlabels" value="" id="csAddress" style="display:none;" readonly>
1006            <input type="text" placeholder="Phone" name="postcode" class="inputlabels" value="" id="csPostcode" style="display:none;" readonly>
1007          </div>
1008        </form> -->
1009      </div>
1010    </div>
1011  </div>
1012</div>
1013
1014<div class="modal fade " id="messageModal" tabindex="-1" role="dialog" aria-labelledby="messageModal">
1015  <div class="modal-dialog modal-sm" role="dialog">
1016    <div class="modal-content" style="margin-top: 5%; max-width: 470px; overflow: hidden;">
1017      <div class="modal-body" style="background:white;">
1018        <button type="button" class="close_new fa fa-close" data-dismiss="modal" aria-label="Close"> </button>
1019        <div class="table-title" style="margin-bottom: 0px;">
1020          <div id="situation"></div>
1021          <div id="yourMessage"> </div>
1022          <div id="shopReply"></div>
1023          <div id="generic"></div>
1024        </div>
1025      </div>
1026    </div>
1027  </div>
1028</div>
1029
1030<div class="modal fade " id="termsModal" tabindex="-1" role="dialog" aria-labelledby="termsModal">
1031  <div class="modal-dialog modal-sm registerModalx termModalx" role="dialog">
1032    <div class="modal-content modal-contentx term-contentx">
1033      <div class="modal-body modal-bodyx" style=" padding: 2px 3px 3px 3px;">
1034        <button type="button" class="close_new fa fa-close" data-dismiss="modal" aria-label="Close"> </button>
1035        <div class="table-title">
1036          <h2 class="termsHeader" id="termheader"> </h2>
1037        </div>
1038          <div class="row" id="termsModalBody">
1039          </div>
1040      </div>
1041    </div>
1042  </div>
1043</div>
1044
1045
1046  
1047
1048<div class="modal fade " id="registerModal" tabindex="-1" role="dialog" aria-labelledby="registerModal">
1049  <div class="modal-dialog modal-sm registerModalx" role="dialog">
1050    <div class="modal-content modal-contentx">
1051      <div class="modal-body modal-bodyx" style=" padding: 2px 3px 3px 3px;">
1052        <button type="button" class="close_new fa fa-close" data-dismiss="modal" aria-label="Close"> </button>
1053        <div class="table-title">
1054          <h2 class="headersLog">Register</h2>
1055          <h6 class="heade-xs">Use a valid email and telephone number</h6>
1056        </div>
1057        <form id="registerForm">
1058          <div class="row">
1059              <div class="col-md-12 col-sm-12 col-xs-12">
1060                 <label for="name1" class="field-label">Name</label>
1061              <span class="iconr">
1062    <svg viewBox="0 0 24 24">
1063      <rect x="3" y="5" width="18" height="14"></rect>
1064      <path d="M3 7l9 6 9-6"></path>
1065    </svg>
1066  </span> <input type="text" name="name" placeholder="Name" class="input-fields" id="name1" required>
1067              </div>
1068
1069              <div class="col-md-12 col-sm-12 col-xs-12">
1070                 <label for="email1" class="field-label">Email</label>
1071               <span class="iconr">
1072    <svg viewBox="0 0 24 24">
1073      <rect x="3" y="5" width="18" height="14"></rect>
1074      <path d="M3 7l9 6 9-6"></path>
1075    </svg>
1076  </span><input type="email" name="emails" placeholder="Your E-Mail ( [email protected])" class="input-fields" id="email1" required>
1077              </div>
1078              <div class="col-md-12 col-sm-12 col-xs-12">
1079                 <label for="telephone1" class="field-label">Telephone</label>
1080
1081 <span class="iconr">  
1082                 <svg viewBox="0 0 24 24">
1083        <path d="M22 16.9v3a2 2 0 0 1-2.2 2
1084                 19.8 19.8 0 0 1-8.6-3.1
1085                 19.5 19.5 0 0 1-6-6
1086                 19.8 19.8 0 0 1-3.1-8.7A2 2 0 0 1 4.1 2h3
1087                 a2 2 0 0 1 2 1.7c.1.8.3 1.5.6 2.2
1088                 a2 2 0 0 1-.5 2.1L8 9
1089                 a16 16 0 0 0 6 6l1-1.2
1090                 a2 2 0 0 1 2.1-.5c.7.3 1.4.5 2.2.6
1091                 a2 2 0 0 1 1.7 2z"  ></path>
1092      </svg>
1093</span>
1094                
1095                
1096                
1097                <input type="tel" name="number" placeholder="Telephone Ex(:0776 111 11 11)" class="input-fields" id="telephone1"    required>
1098              </div>
1099              <div class="col-md-12 col-sm-12 col-xs-12">
1100    <label for="address1" class="field-label">Address</label>
1101    <i class="fa fa-icon-address1 icon-classes-general"></i> <input type="text" name="address" placeholder="Address" class="input-fields" id="address1" title="Between 2 -35 charachters" minlength="2" maxlength="35">
1102  </div>
1103  <div class="col-md-12 col-sm-12 col-xs-12">
1104    <label for="postcode1" class="field-label">Postcode</label>
1105    <i class="fa fa-icon-postcode1 icon-classes-general"></i> <input type="text" name="postcode" placeholder="Postcode" class="input-fields" id="postcode1">
1106  </div> 
1107              <div class="col-md-12 col-sm-12 col-xs-12">
1108                 <label for="password1" class="field-label">Password</label>
1109
1110
1111                <span class="iconr">
1112    <svg viewBox="0 0 24 24">
1113      <rect x="5" y="11" width="14" height="9"></rect>
1114      <path d="M8 11V8a4 4 0 0 1 8 0v3"></path>
1115    </svg>
1116  </span>
1117                
1118                <input type="text" name="search" placeholder="password" class="input-fields passfield" id="password1" onfocus="this.type='password'" autocorrect="off" autocapitalize="none" required> <span class="eye-toggler" onclick="togglePasswordField(this)">
1119    <svg viewBox="0 0 24 24">
1120      <path d="M1 12s4-6 11-6 11 6 11 6-4 6-11 6-11-6-11-6z"></path>
1121      <circle cx="12" cy="12" r="3"></circle>
1122    </svg>
1123  </span>
1124              </div>
1125              <div class="col-md-12 col-sm-12 col-xs-12" style="margin-bottom:27px;">
1126                 <label for="verifypassword1" class="field-label">Re-type Password</label>
1127              
1128     <span class="iconr">
1129    <svg viewBox="0 0 24 24">
1130      <rect x="5" y="11" width="14" height="9"></rect>
1131      <path d="M8 11V8a4 4 0 0 1 8 0v3"></path>
1132    </svg>
1133  </span>
1134  <input type="text" name="search" placeholder="confirm password" class="input-fields passfield" id="verifypassword1" onfocus="this.type='password'" autocorrect="off" autocapitalize="none" required> <span class="eye-toggler" onclick="togglePasswordField(this)">
1135    <svg viewBox="0 0 24 24">
1136      <path d="M1 12s4-6 11-6 11 6 11 6-4 6-11 6-11-6-11-6z"></path>
1137      <circle cx="12" cy="12" r="3"></circle>
1138    </svg>
1139  </span>
1140              </div>
1141              <div class="col-md-12 col-sm-12 col-xs-12"  >
1142                <input type="submit" name="submit" class="btn-main submitButtons" value="Register Now" style="width:100%;" id="registerButton" required>
1143                <span class="validity"></span>
1144              </div>
1145
1146              <div class="col-md-12 col-sm-12 col-xs-12" id="privacy">
1147              <!-- <h1 class="terms"> By registering you accept the <a onclick="window.open('/terms', '_blank', 'location=no,height=570,width=320,scrollbars=yes,status=yes')">terms &amp; conditions</a></h1> -->
1148                <h1 class="terms"> By registering you accept the  <a onclick="termsconditions();">terms &amp; conditions</a></h1></h1>
1149              </div>
1150          </div>
1151        </form>
1152      </div>
1153    </div>
1154  </div>
1155</div>
1156
1157
1158 
1159<!-- End Register -->
1160
1161  <div class="bottomAndroidFix" style="    background-color: black;
1162display: -webkit-flex;
1163display: flex;
1164position: fixed;
1165left: 0;
1166/* top: 0; */
1167right: 0;
1168padding: 4px 0px;
1169height: 56px;
1170color: #2b2c2f;
1171z-index: 999;
1172bottom: 4%; display:none; " id="bottomAndroidFix">
1173
1174    <div class="row" style="margin-left:-7px;">
1175      <div class="col-xs-3 mycolxs3"><button class="btn btn-success btn-menu" onclick="location.href='/apphome?ios=android';">Home</button> </div>
1176      <div class="col-xs-3 mycolxs3"><button class="btn btn-success btn-menu" onclick="location.href='/menu?ios=android';">Menu</button> </div>
1177      <div class="col-xs-3 mycolxs3"><button class="btn btn-success btn-menu" onclick="location.href='/checkout?ios=android';">Checkout</button></div>
1178      <div class="col-xs-3 mycolxs3"> <button class="btn btn-success btn-menu" onclick="location.href='/myprofile?ios=android';">Orders</button></div>
1179    </div>
1180  </div>
1181
1182
1183
1184  
1184<script src="https://cdn.trackjs.com/agent/v3/latest/t.js"></script>
1184
1185  
1185<script>
1186
1187    var ete = 0;
1188    window.TrackJS && TrackJS.install({
1189      token: "b611dee257d8438a80caa0c4dc74fa7d",
1190      application: "my-app-prod"
1191    });
1192  </script>
1192
1193
1194  
1194<script src="js/utils/core.min.js"></script>
1194
1195  
1195<script src="js/utils/scripts.js"></script>
1195
1196
1197
1198  <a href="#" class="top-arrow"></a>
1199
1200  
1200<script>
1201
1202    window.addEventListener('load', function () {
1203      try {
1204
1205  window.TrackJS && TrackJS.addMetadata("userx", "none");
1206
1207
1208  } catch (e) {
1209        // swallow – never let this kill the page
1210        console.log('TrackJS/init error', e);
1211      }
1212    });
1213
1214    function checkCookieConsent() {
1215      try {
1216        if (window.sessionStorage && sessionStorage.getItem('999') !== 'Cookies Ok') {
1217          $("#cookieConsent").show();
1218        }
1219      } catch (e) {
1220        // Storage not available – safest is just show banner and move on
1221        $("#cookieConsent").show();
1222      }
1223    }
1224
1225    function regModal() {
1226      $('#loginModal').modal('hide');
1227      $('#registerModal').modal('show');
1228    }
1229
1230    function ajaxHandler(typeA, urlA, sendData, callback) {
1231      $.ajax({
1232        type: typeA,
1233        url: urlA,
1234        data: sendData,
1235        error: function (response) { endEvent(); callback(response); },
1236        success: function (response) { },
1237        complete: function (response) { callback(response); }
1238      });
1239    }
1240
1241    $("#loginButton1x").click(function (e) {
1242      stopForm(e);
1243      var sendUrl = "/logMeIn2"; var sendData = {};
1244      sendData.username = ($("#username2y").val()).toLowerCase().trim();
1245      sendData.password = $("#passworda3y").val();
1246      ajaxHandler("POST", sendUrl, sendData, function (response) {
1247        if (response.responseText == "ACCESS") { window.location.reload(); }
1248        else if (response.responseText == "Password or Username is Wrong") { endEvent(); alertUser("Your password or email is wrong. Please try again or use forget password link."); }
1249        else { endEvent(); alertUser("There has been a problem. Please try again later."); }
1250      });
1251    });
1252
1253    $("#loginForms").submit(function (e) {
1254      stopForm(e);
1255      var sendUrl = "/logMeIn2"; var sendData = {};
1256      sendData.username = ($("#username2").val()).toLowerCase().trim();
1257      sendData.password = $("#password2").val();
1258      ajaxHandler("POST", sendUrl, sendData, function (response) {
1259        if (response.responseText == "ACCESS") { window.location.reload(); }
1260        else if (response.responseText == "Password or Username is Wrong") { endEvent(); alertUser("Your password or email is wrong. Please try again or use forget password link."); }
1261        else { endEvent(); alertUser("There has been a problem. Please try again later."); }
1262      });
1263    });
1264
1265    $(".icon-classes-generalx").click(function (e) {
1266      var pinput = $(this).parent().find('.passfield');
1267      //var pinput= $(this).next().find('.passfield');
1268      if ($(pinput).attr('type') == "password") {
1269        $(pinput).attr('type', 'text');
1270      }
1271      else {
1272        $(pinput).attr('type', 'password');
1273      }
1274    });
1275
1276    function appAlert(options) {
1277 
1278
1279  $('#appAlertTitle').text(options.title || '');
1280  $('#appAlertText').text(options.text || '');
1281
1282  var footerHtml = '';
1283
1284  if (options.buttons && options.buttons.length) {
1285    options.buttons.forEach(function (btn, i) {
1286      footerHtml += `
1287        <a href="javascript:;" 
1288           class="${btn.class || 'coolal-yes'}"
1289           data-btn-index="${i}">
1290           ${btn.text}
1291        </a>
1292      `;
1293    });
1294  } else {
1295    footerHtml = `<a href="javascript:;" class="coolal-yes" data-dismiss="modal">OK</a>`;
1296  }
1297
1298  $('#appAlertFooter').html(footerHtml);
1299
1300  // Attach actions
1301  $('#appAlertFooter a').off('click').on('click', function () {
1302    var index = $(this).data('btn-index');
1303    var btn = options.buttons && options.buttons[index];
1304
1305    $('#appAlert').modal('hide');
1306
1307    if (btn && typeof btn.action === 'function') {
1308      setTimeout(btn.action, 150);
1309    }
1310  });
1311
1312  $('#appAlert').modal('show');
1313}
1314
1315
1316  function deleteAccount() {
1317  appAlert({
1318    title: 'Delete Account',
1319    text: 'Are you sure you would like to proceed?',
1320    buttons: [
1321      {
1322        text: 'Cancel',
1323        class: 'coolal-nox'
1324      },
1325      {
1326        text: 'Remove',
1327        class: 'coolal-yesx',
1328        action: function () {
1329          deleteAccountx();
1330        }
1331      }
1332    ]
1333  });
1334}
1335
1336    function deleteAccountx() {
1337      var sendUrl = "/deleteAccount"; var sendData = {};
1338      //$('#iosAlertx').modal('hide');
1339
1340      ajaxHandler("GET", sendUrl, "", function (response) {
1341        if (response.responseText == "error") { alertUser("An error occured. Please try again."); }
1342
1343        else if (response.responseText == "neworder") {
1344          alertUser("You have recently placed an order, you can not delete your account until you have a live order. Wait until it is completed by the shop. Thanks");
1345          return;
1346        }
1347        else {
1348          alertUser("Your account has been deleted however we have to keep some data for legal requirements related to your account for a certain period time. We would like to remind you that we do not share, sell or use your data for any purposes with any 3rd party.");
1349          setTimeout(function () {
1350            window.location.reload();
1351          }, 3000);
1352        }
1353      });
1354    }
1355    $("#contactForms").submit(function (e) {
1356      stopForm(e);
1357      var fields = $(this).serializeArray();
1358      var sendUrl = "/contact";
1359      ajaxHandler("POST", sendUrl, fields, function (response) {
1360        if (response.responseText == "Sent") { $('#mainWrapper').html("<h1 style='font-size:16px; padding:80px; 35px; height:500px;'>Your message has been sent.We aim to reply you within 24 hours.If it is an urgent issue please call shop. </h1>"); alertIos("Sent", "Your message has been successfully sent. Check your email or here for replies."); $('#contactModalx').modal('hide'); endEvent(); }
1361        else if (response.responseText == "Too Early") { alertUser("You have sent a message recently. You can only send one message in every 5 minutes"); endEvent(); }
1362        else { endEvent(); alertUser("There has been a problem. Please try again later."); }
1363      });
1364    });
1365
1366    $("#formPasswordReset").submit(function (e) {
1367      stopForm(e);
1368      var sendData = {};
1369      var sendUrl = '/resetPassword';
1370      sendData.password = $("#password3").val();
1371      sendData.verifypassword = $("#retype").val();
1372      sendData.username = $("#userEmail").val();
1373      sendData.token = $("#token").val();
1374      if (sendData.password != sendData.verifypassword) {
1375        $("#ajaxMessage3").text("Passwords do not match").fadeIn("slow").delay(1500).fadeOut("slow");
1376        document.getElementById("retype").style.background = "red";
1377        endEvent();
1378        return;
1379      }
1380      ajaxHandler("POST", sendUrl, sendData, function (response) {
1381        if (response.responseText == "success") { window.location.href = "/"; }
1382        else if (response.responseText == "Expired") { alertUser("Your Token Has Been Expired, Please demand a new one."); }
1383        else { alertUser("An error occured please try again;"); }
1384        endEvent();
1385      });
1386    });
1387
1388    $("#sendForgottenForm").submit(function (e) {
1389      stopForm(e);
1390      var sendData = {}; sendData.email = $("#forgetEmail").val().toLowerCase();
1391      var sendUrl = "/forgetPassword";
1392      ajaxHandler("POST", sendUrl, sendData, function (response) {
1393        if (response.responseText == "successfull") {
1394          $("#forgotPass2").html("Please check your email for further instructions. Also check your spam folder.").show().css('color', 'green');
1395          $('#resetlinkbutton').val("Email Sent").css('background', 'green');
1396          alertUser("<h1 style='margin-bottom:-70px;'>Success</h1> <h2 style='color:green; font-size: 20px; padding: 0 25px;'>Password reset email is sent to the registered email address. Please check your email for instructions. Please also check your spam folder as well</h2>");
1397        }
1398        else {
1399          alertUser("The email you entered  does not exist or you need to wait 6 minutes between each email request");
1400          $('#resetlinkbutton').val("Send Reset Link").css('background', '#DC4C46');
1401          endEvent(e);
1402        }
1403      });
1404    });
1405
1406    function checkEmail(emailValue) {
1407      var sendUrl = "/checkEmail";
1408      var sendData = {}; sendData.email = emailValue;
1409      ajaxHandler("POST", sendUrl, sendData, function (response) {
1410        if (response.responseText == 'exist') { alertUser("This email is used before,use a different one"); }
1411      });
1412    }
1413
1414    function isSuspiciousAddress(address, postcode) {
1415  if (!address) return true;
1416
1417  var cleanAddr = address.trim().toUpperCase();
1418  var cleanPc = (postcode || "")
1419    .trim()
1420    .toUpperCase()
1421    .replace(/\s+/g, "");
1422
1423  var compactAddr = cleanAddr.replace(/\s+/g, "");
1424  var hasDigit = /\d/.test(cleanAddr);
1425  var containsPostcode =
1426    cleanPc && compactAddr.indexOf(cleanPc) !== -1;
1427
1428  return !hasDigit || containsPostcode;
1429}
1430
1431
1432
1433    function sendRegisterAjax(data) {
1434      var sendUrl = "/register";
1435      ajaxHandler("POST", sendUrl, data, function (response) {
1436        if (response.status == 429) {
1437          alertNow("You have created too many accounts from this ip, please try again after an hour", endEvent);
1438          return;
1439        }
1440
1441        if (response.responseText == 'success') {
1442          alertNow("You have successfully registered", function () {
1443            window.location.reload();
1444          });
1445        }
1446        else if (response.responseText == "Email used before") {
1447          alertNow("Your email is registered before. Please use forget password link or try different email.", endEvent);
1448        }
1449        else {
1450          alertNow("There has been a problem. Please try again later.", endEvent);
1451        }
1452      });
1453    }
1454
1455    function validateProfilePostcodeAndAddressThenUpdate(data) {
1456      var rawPostcode = (data.postcode || "").trim();
1457
1458      if (!rawPostcode) {
1459        alertUser("Please enter your postcode");
1460        endEvent();
1461        return;
1462      }
1463
1464      var roughPattern = /^[A-Z]{1,2}\d[A-Z\d]?\s*\d[A-Z]{2}$/i;
1465      if (!roughPattern.test(rawPostcode)) {
1466        alertUser("Your postcode doesn't look right. Please check it.");
1467        endEvent();
1468        return;
1469      }
1470
1471      var url = "https://api.postcodes.io/postcodes/" + encodeURIComponent(rawPostcode);
1472
1473      $.ajax({
1474        url: url,
1475        method: "GET",
1476        dataType: "json",
1477        timeout: 7000
1478      })
1479
1480        // ---------- 200 OK ----------
1481        .done(function (resp, status, xhr) {
1482          if (resp && resp.status === 200 && resp.result && resp.result.postcode) {
1483            var formattedPc = resp.result.postcode;
1484            data.postcode = formattedPc;
1485            $('#postcode1x').val(formattedPc);
1486
1487            if (data.addressConfirmed) {
1488              $('#addressConfirmed').val("1");
1489              sendProfileUpdateAjax(data);
1490              return;
1491            }
1492
1493            if (isSuspiciousAddress(data.address, formattedPc)) {
1494              var typedAddr = data.address || "";
1495   fetchAddressSuggestionsFromServer(formattedPc, typedAddr, function (suggestions) {
1496  showAddressIssueModal(
1497    "YOUR ADDRESS IS INCOMPLETE.\n\n" +
1498    "We cannot deliver your order without a house/flat number or house name and postcode.\n\n" +
1499    "Please select your complete address below or press Edit address.",
1500
1501    suggestions,
1502
1503    function onPick(addr) {
1504
1505      const parts = addr.split(',').map(p => p.trim());
1506      const shortAddress = parts.slice(0, 2).join(', ');
1507
1508      $('#address1x').val(shortAddress);
1509      $('#profileAddressConfirmed').val('yes');
1510
1511      data.address = shortAddress;
1512      data.addressConfirmed = true;
1513
1514      sendProfileUpdateAjax(data);
1515    },
1516
1517    null, // Do not allow an incomplete address to be used
1518
1519    function onEdit() {
1520      $('#address1x').focus();
1521      endEvent();
1522    }
1523  );
1524});
1525            } else {
1526              sendProfileUpdateAjax(data);
1527            }
1528            return;
1529          }
1530          sendProfileUpdateAjax(data);
1531        })
1532
1533        // ---------- FAIL (404 / 0 / others) ----------
1534        .fail(function (xhr, status, error) {
1535          if (xhr.status === 404) {
1536            var typedPc = rawPostcode;
1537            var typedAddr = data.address || "";
1538
1539            fetchAddressSuggestionsFromServer(typedPc, typedAddr, function (suggestions) {
1540              showAddressIssueModal(
1541                "We couldn't find this postcode.\n\n" +
1542                "Please pick a suggested address below or edit your address.",
1543                suggestions,
1544            function onPick(addr) {
1545  const parts = addr.split(',').map(p => p.trim());
1546  const shortAddress = parts.slice(0, 2).join(', ');
1547
1548  $('#address1x').val(shortAddress);
1549  $('#profileAddressConfirmed').val('yes');
1550
1551  data.address = shortAddress;
1552  data.addressConfirmed = true;
1553
1554  sendProfileUpdateAjax(data);
1555},
1556                function onUseTyped() {
1557                  $('#profileAddressConfirmed').val('yes');
1558                  data.addressConfirmed = true;
1559                  sendProfileUpdateAjax(data);
1560                },
1561                function onEdit() {
1562                  $('#address1x').focus();
1563                  endEvent();
1564                }
1565              );
1566            });
1567            return;
1568          }
1569
1570          // 0 – network
1571          if (xhr.status === 0) {
1572            if (isSuspiciousAddress(data.address, data.postcode) && !data.addressConfirmed) {
1573              showAddressIssueModal(
1574                "This address looks incomplete (e.g. missing house/flat number).\n\n" +
1575                "Please edit or continue with what you typed.",
1576                [],
1577                function onPick() {
1578                  sendProfileUpdateAjax(data);
1579                },
1580                function onUseTyped() {
1581                  $('#profileAddressConfirmed').val('yes');
1582                  data.addressConfirmed = true;
1583                  sendProfileUpdateAjax(data);
1584                },
1585                function onEdit() {
1586                  $('#address1x').focus();
1587                  endEvent();
1588                }
1589              );
1590            } else {
1591              sendProfileUpdateAjax(data);
1592            }
1593            return;
1594          }
1595          sendProfileUpdateAjax(data);
1596        });
1597    }
1598
1599//profile update
1600    function sendProfileUpdateAjax(data) {
1601      var sendUrl = "/updateInformation";
1602      ajaxHandler("POST", sendUrl, data, function (response) {
1603        if (response.responseText == "Email Same") {
1604          alertUser("Your email  is registered before. Please use forget password link or try  different email.");
1605          endEvent();
1606          return;
1607        }
1608        else if (response.responseText == "error") {
1609          endEvent();
1610          alertUser("There has been a problem. Please try again later.");
1611          return;
1612        }
1613        try {
1614          var y = response.responseJSON;
1615          $('#getDistance').val(y.distance);
1616          $('#profileModal').modal('hide');
1617          alertIos("Success", "You have updated your information");
1618          updateC(data);
1619          endEvent();
1620          return;
1621        } catch (e) {
1622          endEvent();
1623          alertUser("There has been a problem. Please try again later.");
1624          return;
1625        }
1626      });
1627    }
1628
1629     
1630    $('#address1x, #postcode1x').on('input', function () {
1631      $('#profileAddressConfirmed').val('no');
1632    });
1633
1634    function getValidTelephone(inputSelector) {
1635
1636      console.log("input selector",inputSelector);
1637  var telephone = ($(inputSelector).val() || '').trim();
1638
1639  // Remove spaces, brackets, dots and hyphens
1640  telephone = telephone.replace(/[\s().-]/g, '');
1641
1642  // Convert 00 international prefix into +
1643  if (telephone.indexOf('00') === 0) {
1644    telephone = '+' + telephone.substring(2);
1645  }
1646
1647  // Convert UK +44 into leading 0
1648  if (telephone.indexOf('+44') === 0) {
1649    telephone = '0' + telephone.substring(3);
1650  }
1651
1652  var validUkNumber = /^0\d{10}$/.test(telephone);
1653  var validInternationalNumber =
1654    /^\+[1-9]\d{7,14}$/.test(telephone);
1655
1656  if (!validUkNumber && !validInternationalNumber) {
1657    alertUser(
1658      'Please enter an 11-digit UK number (e.g. 07761111111), or an international number including the country code (e.g. +447761111111).'
1659    );
1660
1661    $(inputSelector).focus();
1662    endEvent();
1663
1664    return false;
1665  }
1666
1667  return telephone;
1668}
1669
1670    $("#myProfileForm").submit(function (e) {
1671      stopForm(e);
1672      var data = {};
1673      data.name = $('#name1x').val();
1674      data.email = ($('#email1x').val() || "").toLowerCase();
1675      data.address = $('#address1x').val();
1676      data.postcode = $('#postcode1x').val();
1677      data.telephone = getValidTelephone('#telephone1x');
1678if (!data.telephone) {
1679  endEvent();
1680  return;
1681}
1682      data.addressConfirmed = ($('#profileAddressConfirmed').val() === 'yes');
1683
1684      if (!data.address || data.address.length < 2) {
1685        alertUser("Your address should have more than  2 characters");
1686        endEvent();
1687        return;
1688      }
1689      if (!data.postcode || data.postcode.length < 4) {
1690        alertUser("Your postcode should have more than  4 characters");
1691        endEvent();
1692        return;
1693      }
1694      var emailMe = $('#emailswitch').prop("checked");
1695      data.emailOrder = emailMe ? 1 : 0;
1696      validateProfilePostcodeAndAddressThenUpdate(data);
1697    });
1698
1699    function validatePostcodeAndAddressThenRegister(data) {
1700
1701      console.log("test");
1702      var rawPostcode = (data.postcode || "").trim();
1703      if (!rawPostcode) {
1704        alertNow("Please enter your postcode", endEvent);
1705        return;
1706      }
1707      var roughPattern = /^[A-Z]{1,2}\d[A-Z\d]?\s*\d[A-Z]{2}$/i;
1708      if (!roughPattern.test(rawPostcode)) {
1709        alertNow("Your postcode doesn't look right. Please check it.", endEvent);
1710        return;
1711      }
1712
1713      var url = "https://api.postcodes.io/postcodes/" + encodeURIComponent(rawPostcode);
1714      $.ajax({
1715        url: url,
1716        method: "GET",
1717        dataType: "json",
1718        timeout: 5000
1719      })
1720        .done(function (resp, status, xhr) {
1721          if (resp && resp.status === 200 && resp.result && resp.result.postcode) {
1722            var formattedPc = resp.result.postcode;
1723            data.postcode = formattedPc;
1724            $('#postcode1').val(formattedPc);
1725            if (data.addressConfirmed) {
1726              sendRegisterAjax(data);
1727              return;
1728            }
1729            if (isSuspiciousAddress(data.address, formattedPc)) {
1730              var typedAddr = data.address || "";
1731              fetchAddressSuggestionsFromServer(formattedPc, typedAddr, function (suggestions) {
1732                showAddressIssueModal(
1733                  "This address looks incomplete (e.g. missing house/flat number).\n\n" +
1734                  "Please pick one of the suggestions below or edit your address.",
1735                  suggestions,
1736                  function onPick(addr) {
1737
1738                        const parts = addr.split(',').map(p => p.trim());
1739      const shortAddress = parts.slice(0, 2).join(', ');
1740                    $('#address1').val(shortAddress);
1741                    data.address = shortAddress;
1742                    sendRegisterAjax(data);
1743                  },
1744                  function onUseTyped() {
1745                    sendRegisterAjax(data);
1746                  },
1747                  function onEdit() {
1748                    $('#address1').focus();
1749                    endEvent();
1750                  }
1751                );
1752              });
1753            } else {
1754              sendRegisterAjax(data);
1755            }
1756            return;
1757          }
1758          sendRegisterAjax(data);
1759        })
1760
1761        .fail(function (xhr, status, error) {
1762          if (xhr.status === 404) {
1763            var typedPc = rawPostcode;
1764            var typedAddr = data.address || "";
1765
1766            fetchAddressSuggestionsFromServer(typedPc, typedAddr, function (suggestions) {
1767              showAddressIssueModal(
1768                "We couldn't find this postcode.\n\n" +
1769                "Please pick a suggested address below or edit your address.",
1770                suggestions,
1771                function onPick(addr) {
1772
1773                   const parts = addr.split(',').map(p => p.trim());
1774      const shortAddress = parts.slice(0, 2).join(', ');
1775
1776
1777                  $('#address1').val(shortAddress);
1778                  data.address = shortAddress;
1779                  sendRegisterAjax(data);
1780                },
1781                function onUseTyped() {
1782                  sendRegisterAjax(data);
1783                },
1784                function onEdit() {
1785                  $('#address1').focus();
1786                  endEvent();
1787                }
1788              );
1789            });
1790            return;
1791          }
1792
1793          if (xhr.status === 0) {
1794            if (isSuspiciousAddress(data.address, data.postcode)) {
1795              showAddressIssueModal(
1796                "This address looks incomplete (e.g. missing house/flat number).\n\n" +
1797                "Please edit or continue with what you typed.",
1798                [],
1799                function onPick() {
1800                  sendRegisterAjax(data);
1801                },
1802                function onUseTyped() {
1803                  sendRegisterAjax(data);
1804                },
1805                function onEdit() {
1806                  $('#address1').focus();
1807                  endEvent();
1808                }
1809              );
1810            } else {
1811              sendRegisterAjax(data);
1812            }
1813            return;
1814          }
1815          sendRegisterAjax(data);
1816        });
1817    }
1818function togglePasswordField(el) {
1819  var input = $(el).siblings('input').first();
1820
1821  if (!input.length) return;
1822
1823  if (input.attr('type') === 'password') {
1824    input.attr('type', 'text');
1825  } else {
1826    input.attr('type', 'password');
1827  }
1828}
1829    function fetchAddressSuggestionsFromServer(postcode, typedAddress, cb) {
1830      $.getJSON('/address-suggestions', {
1831        postcode: postcode,
1832        address: typedAddress
1833      })
1834        .done(function (res) {
1835          if (res && Array.isArray(res.suggestions)) {
1836            cb(res.suggestions);
1837          } else {
1838            cb([]);
1839          }
1840        })
1841        .fail(function (xhr, status, error) {
1842          cb([]);
1843        });
1844    }
1845
1846    $("#registerForm").submit(function (e) {
1847      stopForm(e);
1848
1849      var data = {};
1850      data.name = $('#name1').val();
1851      data.username = ($('#email1').val() || "").toLowerCase();
1852      data.password = $('#password1').val();
1853      data.verifypassword = $('#verifypassword1').val();
1854      data.address = $('#address1').val();
1855      data.postcode = $('#postcode1').val();
1856      
1857      data.telephone = getValidTelephone('#telephone1');
1858if (!data.telephone) {
1859  endEvent();
1860  return;
1861}
1862
1863$('#telephone1').val(data.telephone);
1864
1865
1866
1867      if (data.password.length < 5) {
1868        alertNow("Your password can not be lower than 5 characters", endEvent);
1869        return;
1870      }
1871
1872      if (data.password != data.verifypassword) {
1873        alertNow("Passwords don't match", endEvent);
1874        return;
1875      }
1876
1877      if (!data.address || data.address.length < 2) {
1878        alertNow("Your address should have more than 2 characters", endEvent);
1879        return;
1880      }
1881      validatePostcodeAndAddressThenRegister(data);
1882    });
1883
1884    function updateC(data) {
1885      $('#customerName').val(data.name);
1886      $('#emailCustomer').val(data.email);
1887      $('#telCustomer').val(data.telephone);
1888      $('#addressCustomer').val(data.address);
1889      $('#postcodeCustomer').val(data.postcode);
1890    }
1891
1892$("#telephoneModal").submit(function (e) {
1893  stopForm(e);
1894
1895  var data = {};
1896
1897  data.telephone = ($('#telephone3x').val() || '').trim();
1898  data.name = $('#contactName3x').val();
1899
1900   data.telephone = getValidTelephone('#telephone3x');
1901
1902if (!data.telephone) {
1903  endEvent();
1904  return;
1905}
1906
1907  var sendUrl = "/updatePhone";
1908
1909  ajaxHandler("POST", sendUrl, data, function (response) {
1910    if (response.responseText == 'Success') {
1911      $('#telephoneModal').modal('hide');
1912      alertUser("You have updated your information");
1913
1914      // Uses the cleaned number
1915      $('#telCustomer').val(data.telephone);
1916
1917      endEvent();
1918      return;
1919    }
1920
1921    endEvent();
1922    alertUser("There has been a problem. Please try again later.");
1923  });
1924});
1925
1926    $("#addressModal").submit(function (e) {
1927      
1928      stopForm(e);
1929      var data = {};
1930      data.telephone = $('#telephone2x').val();
1931      data.name = $('#contactName2x').val();
1932      data.address = $('#address2x').val();
1933      data.postcode = $('#postcode2x').val();
1934      if (data.address == "" || (data.address).length < 2) { alertUser("Your address should have more than  2 characters"); endEvent(); return; }
1935      if (data.postcode == "" || (data.postcode).length < 4) { alertUser("Your postcode should have more than  4 characters"); endEvent(); return; }
1936
1937data.telephone = getValidTelephone('#telephone2x');
1938
1939if (!data.telephone) {
1940  endEvent();
1941  return;
1942}
1943
1944      var sendUrl = "/updateAddress";
1945      ajaxHandler("POST", sendUrl, data, function (response) {
1946
1947        if (response.responseText == 'error') {
1948          endEvent(); alertUser("There has been a problem. Please try again later."); return;
1949        }
1950        else {
1951          try { var y = response.responseJSON; } catch (e) { endEvent(); alertUser("There has been a problem. Please try again later."); return; }
1952          $('#addressModal').modal('hide'); alertUser("You have updated your information");
1953          $('#addressCustomer').val(data.address);
1954          $('#postcodeCustomer').val(data.postcode);
1955          $('#telCustomer').val(data.telephone);
1956          if (y.distance != "not found") {
1957            $('#getDistance').val(y.distance);
1958          }
1959          else {
1960            alert("Your postcode could not be found. Please make sure you enter a correct UK postcode");
1961          }
1962          endEvent(); return;
1963        }
1964      });
1965    });
1966
1967    $("#changePassForm").submit(function (e) {
1968      stopForm(e);
1969      var data = {};
1970      data.password = $('#password3x').val();
1971      data.verifypassword = $('#retypex').val();
1972      if (data.password.length < 5) { alertUser("Your password can not be lower than 5 characters"); endEvent(); return; }
1973      if (data.password != data.verifypassword) { alertUser("Passwords don't match"); endEvent(); return; }
1974      var sendUrl = "/passwordChange";
1975      ajaxHandler("POST", sendUrl, data, function (response) {
1976        if (response.responseText == 'Successfully Updated') { alertUser("You have successfully updated your password"); endEvent(); $('#passChangeModal').modal('hide'); return; }
1977        else { endEvent(); alertUser("There has been a problem. Please try again later."); }
1978      });
1979    });
1980
1981    $("#changefpassword").submit(function (e) {
1982      stopForm(e);
1983      var data = {};
1984      data.password = $('#password1xx').val();
1985      data.verifypassword = $('#verifypassword1xx').val();
1986      data.reset = $('#resetcode').val();
1987      data.username = $('#forgetEmailxx').val().toLowerCase();
1988      if (data.password.length < 5) { alertUser("Your password can not be lower than 5 characters"); endEvent(); return; }
1989      if (data.password != data.verifypassword) { alertUser("Passwords don't match"); endEvent(); return; }
1990      var sendUrl = "/resetPasswordCode";
1991      ajaxHandler("POST", sendUrl, data, function (response) {
1992        if (response.responseText == 'success') { window.location.reload(); }
1993        else if (response.responseText == "Expired") {
1994          endEvent(); alertIos("Expired", "Your reset code expired. Please visit send reset link again");
1995          return;
1996        }
1997        else {
1998          endEvent(); alertIos("Unsuccessfull", "Please check the reset code or email address and try again.");
1999          return;
2000        }
2001      });
2002    });
2003
2004    function triggerIosCheckout() {
2005      try { window.webkit.messageHandlers["scriptHandler"].postMessage("go checkout"); } catch (e) { window.location.href = "/xx12"; }
2006      $('#popupModal').modal('hide');
2007    }
2008
2009    function alertIos(title, text) {
2010      $('#titlex1').text(title);
2011      $('#textx1').text(text);
2012      $('#iosAlert').modal('show');
2013    }
2014
2015    function alertIosx(title, text, footer) {
2016      $('#titlex').text(title);
2017      $('#textx').text(text);
2018      $('#coolal-btnWrapperx').html(footer);
2019      $('#iosAlertx').modal('show');
2020    }
2021
2022
2023    function iosFbLog() {
2024      try { window.webkit.messageHandlers["scriptHandler"].postMessage("fblog"); } catch (e) { }
2025    }
2026
2027    function iosGLog() {
2028      try { window.webkit.messageHandlers["scriptHandler"].postMessage("glog"); } catch (e) { }
2029    }
2030
2031    function iosAsign() {
2032      try { window.webkit.messageHandlers["scriptHandler"].postMessage("asign"); } catch (e) { }
2033    }
2034
2035
2036    function appleSign(sign) {
2037      var sendUrl = '/auth/apple/callback?id_token=' + sign.id_token;
2038      ajaxHandler("GET", sendUrl, "data", function (response) {
2039        if (response.responseText == "access") {
2040          window.location.reload();
2041        }
2042        else {
2043          alertUser("There has been a problem, please try again or use a different login method");
2044        }
2045      });
2046    }
2047
2048    function faSign(sign) { faSignF(sign.access_token); }
2049    function faSignG(sign) { faSignF(sign); }
2050
2051    function faSignF(sign) {
2052      var sendUrl = '/fsign?access_token=' + sign;
2053      ajaxHandler("GET", sendUrl, "", function (response) {
2054        if (response.responseText == "access") {
2055          window.location.reload();
2056        }
2057        else {
2058          alertUser("There has been a problem, please try again or use a different login method");
2059        }
2060      });
2061    }
2062
2063        function ffmessage(messagex) {
2064      var sendUrl = '/ffmessage?id_token=' + messagex;
2065      ajaxHandler("GET", sendUrl, "data", function (response) {
2066        if (response.responseText == "error") {
2067          alertUser("There has been a problem, please try again or use a different login method");
2068        }
2069      });
2070    }
2071
2072    function ggSign(sign) { gSignG(sign); }
2073    function gaSign(sign) { gSignG(sign.id_token); }
2074
2075 
2076    function gSignG(sign) {
2077      var sendUrl = '/gsign?id_token=' + sign;
2078      ajaxHandler("GET", sendUrl, "data", function (response) {
2079        if (response.responseText == "access") {
2080          try { window.webkit.messageHandlers["scriptHandler"].postMessage("refresh"); } catch (e) { window.location.reload(); }
2081        }
2082        else {
2083          alertUser("There has been a problem, please try again or use a different login method");
2084        }
2085      });
2086    }
2087
2088    document.addEventListener('AppleIDSignInOnSuccess', (event) => {
2089
2090    //       console.log("APPLE SUCCESS EVENT", event);
2091
2092    // alert(
2093    //     "APPLE SUCCESS EVENT\n\n" +
2094    //     "Has code: " +
2095    //     !!event?.detail?.authorization?.code
2096    // );
2097
2098      var sendUrl = '/auth/apple/callback?code=' + event.detail.authorization.code;
2099      ajaxHandler("GET", sendUrl, "", function (response) {
2100        if (response.responseText == "access") {
2101          window.location.reload();
2102        }
2103        else {
2104          alertUser("There has been a problem, please try again or use a different login method");
2105          endEvent();
2106        }
2107      });
2108    });
2109
2110//     document.addEventListener("click", function (event) {
2111//     if (event.target.closest("#appleid-signin")) {
2112//         alert(
2113//     "APPLE BUTTON COUNT:" +document.querySelectorAll("#appleid-signin").length
2114// );
2115//     }
2116// });
2117
2118      function startAppleLogin() {
2119        
2120    var btn = document.querySelector("#appleid-signin");
2121
2122    if (btn) {
2123        btn.click();
2124    }
2125}
2126
2127//  document.addEventListener("AppleIDSignInOnSuccess", function (event) {
2128//     alert(
2129//         "APPLE SUCCESS EVENT\n\n" +
2130//         JSON.stringify(event.detail, null, 2)
2131//     );
2132
2133//     if (
2134//         !event.detail ||
2135//         !event.detail.authorization ||
2136//         !event.detail.authorization.code
2137//     ) {
2138//         alert("Apple success event fired, but no code was returned.");
2139//         return;
2140//     }
2141
2142//     var sendUrl =
2143//         "/auth/apple/callback?code=" +
2144//         encodeURIComponent(event.detail.authorization.code);
2145
2146//     ajaxHandler("GET", sendUrl, "", function (response) {
2147//         alert(
2148//             "APPLE AJAX FINISHED\n\n" +
2149//             "Status: " + response.status + "\n" +
2150//             "ReadyState: " + response.readyState + "\n" +
2151//             "Response: " + response.responseText
2152//         );
2153
2154//         if (response.responseText === "access") {
2155//             window.location.reload();
2156//         } else {
2157//             alertUser(
2158//                 "There has been a problem, please try again or use a different login method"
2159//             );
2160//             endEvent();
2161//         }
2162//     });
2163// });
2164
2165// document.addEventListener("AppleIDSignInOnFailure", function (event) {
2166//     alert(
2167//         "APPLE FAILURE EVENT\n\n" +
2168//         JSON.stringify(event.detail, null, 2)
2169//     );
2170// });
2171
2172// (function watchAppleSignIn() {
2173//     var timer = setInterval(function () {
2174//         if (
2175//             window.AppleID &&
2176//             AppleID.auth &&
2177//             typeof AppleID.auth.signIn === "function" &&
2178//             !AppleID.auth.signIn.__watched
2179//         ) {
2180//             clearInterval(timer);
2181
2182//             var originalAppleSignIn = AppleID.auth.signIn.bind(AppleID.auth);
2183
2184//             function watchedAppleSignIn() {
2185//                 alert(
2186//                     "APPLE SIGN-IN CALLED\n\n" +
2187//                     "Time: " + new Date().toISOString() + "\n\n" +
2188//                     "Stack:\n" + new Error().stack
2189//                 );
2190
2191//                 return originalAppleSignIn.apply(null, arguments);
2192//             }
2193
2194//             watchedAppleSignIn.__watched = true;
2195//             AppleID.auth.signIn = watchedAppleSignIn;
2196//         }
2197//     }, 100);
2198// })();
2199
2200// document.addEventListener("click", function (event) {
2201//     var appleButton = event.target.closest(
2202//         "#appleid-signin, .appleid-signin, [data-appleid-signin]"
2203//     );
2204
2205//     if (!appleButton) {
2206//         return;
2207//     }
2208
2209//     alert(
2210//         "APPLE BUTTON CLICK\n\n" +
2211//         "Time: " + new Date().toISOString() + "\n" +
2212//         "Target: " + event.target.tagName + "\n" +
2213//         "Button ID: " + appleButton.id + "\n" +
2214//         "Button class: " + appleButton.className
2215//     );
2216// }, true);
2217
2218// setTimeout(function () {
2219//     var buttons = document.querySelectorAll(
2220//         "#appleid-signin, .appleid-signin, [data-appleid-signin]"
2221//     );
2222
2223//     alert(
2224//         "APPLE BUTTON COUNT: " + buttons.length + "\n\n" +
2225//         Array.from(buttons).map(function (button, index) {
2226//             return (
2227//                 (index + 1) + ": " +
2228//                 button.outerHTML.substring(0, 300)
2229//             );
2230//         }).join("\n\n")
2231//     );
2232// }, 1500); 
2233
2234    document.addEventListener('AppleIDSignInOnFailure', (event) => {
2235      alertUser("An error occured  while signing in with AppleId")
2236    });
2237
2238    function myProfile() {
2239      var sendUrl = "/profilx"; var sendData = {};
2240      ajaxHandler("GET", sendUrl, "", function (response) {
2241        if (response.responseText == "error") { alertUser("An error occured while loading your information from server. Please try again."); }
2242        else {
2243          try { var y = response.responseJSON; } catch (e) { alertUser("An error occured while loading your information from server. Please try again."); return; }
2244          $('#email1x').val(y.email);
2245          $('#name1x').val(y.name);
2246          $('#telephone1x').val(y.telephone);
2247          $('#address1x').val(y.address);
2248          $('#postcode1x').val(y.postcode);
2249          if (y.emailOrder == 1) {
2250            $('#emailswitch').prop('checked', true);
2251          }
2252          $('#profileModal').modal('show');
2253        }
2254      });
2255    }
2256
2257    $("#addressModal").submit(function (e) {
2258  
2259      stopForm(e);
2260      var data = {};
2261      data.name = $('#contactName2x').val();
2262      data.telephone = $('#telephone2x').val();
2263      data.address = $('#address2x').val();
2264      data.postcode = $('#postcode2x').val();
2265      if (data.address == "" || (data.address).length < 2) { alertUser("Your address should have more than  2 characters"); endEvent(); return; }
2266      if (data.postcode == "" || (data.postcode).length < 4) { alertUser("Please enter a valid postcode"); endEvent(); return; }
2267 
2268
2269     data.telephone = getValidTelephone('#telephone2x');
2270
2271if (!data.telephone) {
2272  endEvent();
2273  return;
2274}
2275
2276
2277      var sendUrl = "/updateAddress";
2278      ajaxHandler("POST", sendUrl, data, function (response) {
2279        if (response.responseText == 'Success') {
2280          $('#addressModal').modal('hide'); alertUser("You have updated your information");
2281          $('#addressCustomer').val(data.address);
2282          $('#postcodeCustomer').val(data.postcode);
2283          $('#telCustomer').val(data.telephone);
2284          $('#customerName').val(data.name);
2285          endEvent(); return;
2286        }
2287        else { endEvent(); alertUser("There has been a problem. Please try again later."); }
2288      });
2289    });
2290
2291    function lostPassword() {
2292      $('#loginModal').modal('hide');
2293      $('#fgModal').modal('show');
2294    }
2295
2296    function loginFormOpen() {
2297      $("#lostPassword").hide();
2298      $("#lostPasswordOpen").show();
2299      $("#loginFormOpen").hide();
2300      $("#loginForm").show();
2301      $('#loginHeader').text("Login");
2302      $("#forgotPass2").hide();
2303    }
2304
2305    function showMessage(cmessage, subject, situation, reply) {
2306      var shopTel = $('#shopTel').text();
2307      $('#situation').text(situation);
2308      $('#yourMessage').html("<h1 class='yourMessage'>Your Message</h1>" + "<h1 class='yourMessagex'>" + cmessage + "</h1>");
2309      if (reply) {
2310        $('#shopReply').html("<h1 class='shopReply'>Shop's Reply</h1>" + "<h1 class='shopReplyx'>" + reply + "</h1>");
2311        $('#generic').html("<h1 class='shopGeneric'>If this reply did not satisfy you please  give us a call.  <span style='color:red; width: 100%;'>" + shopTel + "</span></h1>");
2312      }
2313      else {
2314        $('#shopReply').html("<h1 class='shopGeneric'>Your message hos not been replied by shop. Please allow us some time or give us a call</h1>");
2315      }
2316      $('#messageModal').modal('show');
2317    }
2318
2319    $(".cookieConsentOK").on("click", function () {
2320      $("#cookieConsent").css("display", "none");
2321      sessionStorage.setItem("999", "Cookies Ok");
2322      var sendUrl = "/cookie";
2323      ajaxHandler("GET", sendUrl, "noData", function (response) {
2324        if (response.responseText == 'success') { }
2325        else { endEvent(); }
2326      });
2327    });
2328
2329    function repeatOrder(orderId, rtype) {
2330      var sendUrl = '/repeatOrder' + '?id=' + orderId + '&rtype=' + rtype;
2331      ajaxHandler("GET", sendUrl, "noData", function (response) {
2332        if (response.responseText == 'error') { alertUser("Order Could Not be Found"); }
2333        else {
2334          var y = response.responseJSON; var currentLength = "", itemInfo = "";
2335          for (var i = 0; i < y.length; ++i) {
2336            currentLength = localStorage.length + 1; while (localStorage.getItem(currentLength) != null) { ++currentLength; }
2337            y[i].basePrice = parseFloat(y[i].basePrice);
2338            y[i].fullPrice = parseFloat(y[i].fullPrice);
2339            if (y[i].availability == 0) {
2340                  console.log("yi ney",y[i]);
2341              if(y[i].basePrice!=0){
2342 alertUser(y[i].name + " is not available at the moment. The remainder of  your order is added to your basket");
2343              }
2344              
2345            }
2346            else {
2347              localStorage.setItem(currentLength, JSON.stringify(y[i])); 
2348              
2349            }
2350          }
2351           loadPopUp(); 
2352          $('#popupModal').modal('show');
2353        }
2354      });
2355    }
2356
2357    function stopForm(event) {
2358      event.preventDefault();
2359      event.stopPropagation();
2360      event.stopImmediatePropagation();
2361      $('.submitButtons').prop('disabled', true);
2362    }
2363
2364
2365    $("#formAddress").submit(function (e) {
2366      stopForm(e);
2367      var sendData = {};
2368      var sendUrl = '/addressChange';
2369      sendData.address = $('#addressChange1').val();
2370      sendData.postcode = $('#postChange1').val();
2371      ajaxHandler("POST", sendUrl, sendData, function (response) {
2372        if (response.responseText == "Successfully Updated") {
2373          $("#ajaxMessage3").text("Your Address Successfully Updated");
2374          alertUser("Your Address Successfully Updated");
2375        }
2376        else { $("#ajaxMessage3").text("An error occured please try later"); }
2377        endEvent();
2378      });
2379    });
2380
2381    $("#formPassword").submit(function (e) {
2382      stopForm(e);
2383      var sendData = {};
2384      var sendUrl = '/passwordChange';
2385      sendData.password = $("#password3").val();
2386      sendData.verifypassword = $("#retype").val();
2387      if (sendData.password != sendData.verifypassword) {
2388        $("#ajaxMessage2").text("Passwords do not match").fadeIn("slow").delay(1500).fadeOut("slow");
2389        endEvent();
2390        return;
2391      }
2392      ajaxHandler("POST", sendUrl, sendData, function (response) {
2393        if (response.responseText == "Successfully Updated") { alertUser("Your password is updated"); }
2394        else { alertUser("An error occured"); }
2395        endEvent();
2396      });
2397    });
2398
2399    $("#formDetails").submit(function (e) {
2400      stopForm(e);
2401      var sendData = {};
2402      var sendUrl = '/profileUpdate';
2403      var sendData = {};
2404      sendData.name = $("#nameC").val();
2405      sendData.email = $("#emailC").val();
2406      sendData.telephone = $("#telephoneC").val();
2407      var emailMe = document.getElementById("emailPreferences").checked;
2408      if (emailMe == false) { sendData.emailPreferences = 0; } else { sendData.emailPreferences = 1; }
2409      ajaxHandler("POST", sendUrl, sendData, function (response) {
2410        if (response.responseText == "Successfully Updated") {
2411          $("#ajaxMessage1").html('Your Details Successfully Updated');
2412          alertUser("Your details successfully updated");
2413        }
2414        else { $("#ajaxMessage1").html('This Email is Used By Another User.'); }
2415        endEvent();
2416      });
2417    });
2418
2419    function termsconditions() {
2420      $('#termsModalBody').load('/terms?q=pop');
2421      $('#termsModal').modal('show');
2422      $('#termheader').text('Terms and privacy policy  for our applications and website');
2423    }
2424
2425    function allergy() {
2426      $('#termsModalBody').load('/allergy?q=pop');
2427      $('#termsModal').modal('show');
2428      $('#termheader').text('Allergen Information');
2429    }
2430
2431
2432    function triggerAlert(message) { alertUser(message + ' can not be empty.'); }
2433    function endEvent() { $('.submitButtons').removeAttr('disabled'); }
2434
2435    function stripeTokenHandler(token) { var sendData = {}; var form = document.getElementById('payment-form'); var hiddenInput = document.createElement('input'); hiddenInput.setAttribute('type', 'hidden'); hiddenInput.setAttribute('name', 'stripeToken'); hiddenInput.setAttribute('value', token.id); form.appendChild(hiddenInput); form.submit(); $("payment-form").trigger("reset"); }
2436
2437    function clearCarts() {
2438      localStorage.clear();
2439      loadPopUp();
2440      $('.cart-item').remove();
2441      fullPriceTotal = 0;
2442      try { window.location.reload(); } catch (e) { }
2443    }
2444
2445    function modalHide() {
2446      setTimeout(function () {
2447        $('#alertUser').modal('hide');
2448        $('.modal-backdrop').remove();
2449      }, 60);
2450    }
2451
2452    $('#alertUser').on('hidden.bs.modal', function () {
2453      //remove the backdrop
2454      $('.modal-backdrop').remove();
2455    })
2456
2457    function alertUser(message) {
2458      if (message.length < 1) { return; }
2459      var body = '';
2460      body += '<div class="modal fade " id="alertUser" tabindex="-1" role="dialog" aria-labelledby="alertUser" style="z-index: 99999;" ><div class="modal-dialog modal-sm" role="dialog" style="text-align: center;   top: 17%;"><div class="modal-content" style="margin-top: 2%; background: #f4f2ed; border:none;"> <button type="button" class="close_new2x" data-backdrop="" data-dismiss="modal" aria-label="Close" onclick="modalHide();"> × </button><div class="modal-body modal-alertxx" >' + message + '</div> </div></div></div>';
2461      document.getElementById("modalArea3").innerHTML = body;
2462      $('#alertUser').modal('show');
2463    }
2464    $(document).on('hidden.bs.modal', '.modal', function () {
2465      $('.modal:visible').length && $(document.body).addClass('modal-open');
2466    });
2467    document.addEventListener('touchmove', function (event) {
2468      if (event.scale !== 1) { event.preventDefault(); }
2469    }, false);
2470
2471    function enableCart() {
2472      $('#popupModal').modal('show');
2473    }
2474
2475    function notavailable() {
2476      alertUser("Sorry this item is out of stock for today.");
2477    }
2478
2479 
2480     
2481    $(window).ready(function () { loadPopUp(); });
2482 
2483
2484function getCartKeys() {
2485  return Object.keys(localStorage)
2486    .filter(k => /^\d+$/.test(k))               // ONLY numeric keys are cart items
2487    .sort((a, b) => Number(a) - Number(b));
2488}
2489 
2490function normalizeItem(raw) {
2491 
2492  //const item = raw && typeof raw === 'object' ? raw : {};
2493  const item = (raw && typeof raw === 'object' && !Array.isArray(raw)) ? raw : {};
2494  if (!item.rName) item.rName = item.name || '';
2495  item.customization = item.customization || {};
2496  item.customization.additions = item.customization.additions || '';
2497  item.customization.features = item.customization.features || '';
2498  item.customization.extraxyz = item.customization.extraxyz || '';
2499
2500  item.amount = Number(item.amount || 1);
2501  item.basePrice = Number(item.basePrice || 0);
2502  item.fullPrice = Number(item.fullPrice || item.basePrice || 0);
2503
2504  // Keep your existing BOGO model fields stable
2505
2506  if (item.rPrice == null) {
2507  item.rPrice = Number(item.basePrice || item.fullPrice || 0);
2508}
2509
2510  //if (item.rPrice == null) item.rPrice = item.basePrice;
2511  if (item.ePrice == null) {
2512    // extra cost = full - base (never negative)
2513    const ep = Number(item.fullPrice) - Number(item.basePrice);
2514    item.ePrice = ep > 0 ? ep : 0;
2515  }
2516
2517  // Normalize typex
2518  if (item.typex == null) item.typex = 'no';
2519
2520  return item;
2521}
2522
2523// Apply BOGO pricing to items in storage (only if needed)
2524// function applyBogoPricingIfNeeded() {
2525//   const keys = getCartKeys();
2526//   if (!keys.length) return;
2527
2528//   const items = [];
2529//   const rest = [];
2530//   const groupedUnits = {};
2531//   let hasBogo = false;
2532
2533//   for (const key of keys) {
2534//     const raw = localStorage.getItem(key);
2535//     if (!raw) { localStorage.removeItem(key); continue; }
2536
2537//     let temp;
2538//     try { temp = JSON.parse(raw); }
2539//     catch (e) { localStorage.removeItem(key); continue; }
2540
2541//     temp = normalizeItem(temp);
2542//     temp._key = key;
2543
2544//     if (isBogoEligibleClient(temp)) {
2545//       hasBogo = true;
2546//       items.push(temp);
2547
2548//       const groupKey = getPromoGroupKeyClient(temp);
2549//       if (!groupedUnits[groupKey]) groupedUnits[groupKey] = [];
2550
2551//       const amount = parseInt(temp.amount, 10) || 1;
2552//       for (let q = 0; q < amount; q++) {
2553//         groupedUnits[groupKey].push({
2554//           key: key,
2555//           basePrice: Number(temp.rPrice || temp.basePrice || 0)
2556//         });
2557//       }
2558//     } else {
2559//       rest.push(temp);
2560//     }
2561//   }
2562
2563//   if (!hasBogo) return;
2564
2565//   const discountedCounts = {};
2566
2567//   for (const groupKey in groupedUnits) {
2568//     const units = groupedUnits[groupKey];
2569//     units.sort((a, b) => a.basePrice - b.basePrice);
2570
2571//     let divider = parseInt(groupKey.split("|")[0], 10);
2572//     if (!isFinite(divider) || divider <= 0) divider = 2;
2573
2574//     const discountCount = Math.floor(units.length / divider);
2575
2576//     for (let i = 0; i < discountCount; i++) {
2577//       discountedCounts[units[i].key] = (discountedCounts[units[i].key] || 0) + 1;
2578//     }
2579//   }
2580
2581//   for (let i = 0; i < items.length; i++) {
2582//     const it = items[i];
2583
2584//     const amount = parseInt(it.amount, 10) || 1;
2585//     let discountedCount = discountedCounts[it._key] || 0;
2586//     if (discountedCount > amount) discountedCount = amount;
2587
2588//     const normalCount = amount - discountedCount;
2589
2590//     const rawTypex = String(it.typex || '').trim().toLowerCase();
2591//     const pct = Math.max(0, Math.min(100, parseFloat(rawTypex) || 0));
2592
2593//     const normalBase = Number(it.rPrice || it.basePrice || 0);
2594//     const extra = Number(it.ePrice || 0);
2595//     const discountedBase = getDiscountedBaseClient(it);
2596
2597//     it.basePrice = Number(((normalCount * normalBase) + (discountedCount * discountedBase)).toFixed(2));
2598//     it.fullPrice = Number((it.basePrice + (extra * amount)).toFixed(2));
2599
2600//     const originalName = it.rName || it.name || '';
2601//     it.displayName = originalName;
2602//     it.name = originalName;
2603
2604//     if (discountedCount > 0) {
2605//       if (rawTypex === "0") {
2606//         it.displayName = originalName + " (FREE)";
2607//         it.name = originalName + " (FREE)";
2608//       } else if (rawTypex.indexOf("fixed_") === 0) {
2609//         const fixedPrice = getFixedPriceFromTypexClient(it.typex, it.portion);
2610//         if (fixedPrice !== null) {
2611//           it.displayName = originalName + " (£" + fixedPrice.toFixed(2) + ")";
2612//           it.name = originalName + " (£" + fixedPrice.toFixed(2) + ")";
2613//         }
2614//       } else if (pct < 100) {
2615//         it.displayName = originalName + " (" + pct + "% OFF)";
2616//         it.name = originalName + " (" + pct + "% OFF)";
2617//       }
2618//     }
2619//   }
2620
2621//   const all = items.concat(rest).sort((a, b) => Number(a.fullPrice) - Number(b.fullPrice));
2622
2623//   for (const k of keys) localStorage.removeItem(k);
2624
2625//   for (let i = 0; i < all.length; i++) {
2626//     delete all[i]._key;
2627//     localStorage.setItem(String(i + 1), JSON.stringify(all[i]));
2628//   }
2629// }
2630
2631function applyBogoPricingIfNeeded() {
2632  const keys = getCartKeys();
2633  if (!keys.length) return;
2634
2635  const items = [];
2636  const rest = [];
2637  const groupedUnits = {};
2638  let hasBogo = false;
2639
2640  for (const key of keys) {
2641    const raw = localStorage.getItem(key);
2642    if (!raw) { localStorage.removeItem(key); continue; }
2643
2644    let temp;
2645    try { temp = JSON.parse(raw); }
2646    catch (e) { localStorage.removeItem(key); continue; }
2647
2648    temp = normalizeItem(temp);
2649    temp._key = key;
2650
2651    if (isBogoEligibleClient(temp)) {
2652      hasBogo = true;
2653      items.push(temp);
2654
2655      const groupKey = getPromoGroupKeyClient(temp);
2656      if (!groupedUnits[groupKey]) groupedUnits[groupKey] = [];
2657
2658      const amount = parseInt(temp.amount, 10) || 1;
2659      for (let q = 0; q < amount; q++) {
2660        groupedUnits[groupKey].push({
2661          key: key,
2662          basePrice: Number(temp.rPrice || temp.basePrice || 0)
2663        });
2664      }
2665    } else {
2666      rest.push(temp);
2667    }
2668  }
2669
2670  if (!hasBogo) return;
2671
2672const discountedCounts = {};
2673
2674for (const groupKey in groupedUnits) {
2675  const units = groupedUnits[groupKey];
2676
2677 
2678  units.sort((a, b) => b.basePrice - a.basePrice);
2679
2680  let divider = parseInt(groupKey.split("|")[0], 10);
2681  if (!isFinite(divider) || divider <= 0) divider = 2;
2682 
2683  for (let i = divider - 1; i < units.length; i += divider) {
2684    discountedCounts[units[i].key] =
2685      (discountedCounts[units[i].key] || 0) + 1;
2686  }
2687}
2688
2689  for (let i = 0; i < items.length; i++) {
2690    const it = items[i];
2691
2692    const amount = parseInt(it.amount, 10) || 1;
2693    let discountedCount = discountedCounts[it._key] || 0;
2694    if (discountedCount > amount) discountedCount = amount;
2695
2696    const normalCount = amount - discountedCount;
2697
2698    const rawTypex = String(it.typex || '').trim().toLowerCase();
2699    const pct = Math.max(0, Math.min(100, parseFloat(rawTypex) || 0));
2700
2701    const normalBase = Number(it.rPrice || it.basePrice || 0);
2702    const extra = Number(it.ePrice || 0);
2703    const discountedBase = getDiscountedBaseClient(it);
2704
2705    it.basePrice = Number(((normalCount * normalBase) + (discountedCount * discountedBase)).toFixed(2));
2706    it.fullPrice = Number((it.basePrice + (extra * amount)).toFixed(2));
2707
2708    const originalName = it.rName || it.name || '';
2709    it.displayName = originalName;
2710    it.name = originalName;
2711
2712    if (discountedCount > 0) {
2713      if (rawTypex === "0") {
2714        it.displayName = originalName + " (FREE)";
2715        it.name = originalName + " (FREE)";
2716      } else if (rawTypex.indexOf("fixed_") === 0) {
2717        const fixedPrice = getFixedPriceFromTypexClient(it.typex, it.portion);
2718        if (fixedPrice !== null) {
2719          it.displayName = originalName + " (£" + fixedPrice.toFixed(2) + ")";
2720          it.name = originalName + " (£" + fixedPrice.toFixed(2) + ")";
2721        }
2722      } else if (pct < 100) {
2723        it.displayName = originalName + " (" + pct + "% OFF)";
2724        it.name = originalName + " (" + pct + "% OFF)";
2725      }
2726    }
2727  }
2728
2729  const all = items.concat(rest).sort((a, b) => Number(a.fullPrice) - Number(b.fullPrice));
2730
2731  for (const k of keys) localStorage.removeItem(k);
2732
2733  for (let i = 0; i < all.length; i++) {
2734    delete all[i]._key;
2735    localStorage.setItem(String(i + 1), JSON.stringify(all[i]));
2736  }
2737}
2738
2739 
2740
2741function popupNumber() {
2742  const count = getCartKeys().length; // numeric cart keys only
2743  const total = (Number(fullPriceTotal) || 0).toFixed(2);
2744
2745  $('.basketxyz').html(` ${count} Items - £${total}`);
2746   try { window.webkit.messageHandlers["scriptHandler"].postMessage((getCartKeys().length).toString()); } catch (e) { }
2747}
2748
2749
2750// Single entry point: rebuild prices (BOGO if needed) then render from scratch
2751function loadPopUp() {
2752  // clear UI + totals so no duplicates ever
2753
2754    fullPriceTotal = 0;
2755
2756  // clear ALL possible render targets (pick the ones you actually use)
2757  try { $('.popupxyz').html(''); } catch (e) {}
2758 
2759 
2760 
2761
2762  // adjust prices if BOGO items exist
2763  applyBogoPricingIfNeeded();
2764
2765  // render all cart items
2766  const keys = getCartKeys();
2767  for (const key of keys) {
2768    popupCart(key);
2769  }
2770
2771  if (keys.length <= 0) {
2772    $('.basketxyz').html('  0 Items');
2773  } else {
2774    popupNumber();
2775  }
2776}
2777
2778// Remove: simplest + correct for BOGO (full redraw)
2779function removePopUp(removeId, priceId) {
2780  localStorage.removeItem(String(removeId));
2781  loadPopUp();
2782  try { lcheckout(); } catch (e) { }
2783}
2784
2785// Core render for one item (defensive) — based on your normal version :contentReference[oaicite:2]{index=2}
2786var fullPriceTotal = 0;
2787
2788function popupCart(sessionKey) {
2789  const raw = localStorage.getItem(sessionKey);
2790  if (!raw) return;
2791
2792  let itemInfo;
2793  try {
2794    itemInfo = JSON.parse(raw);
2795  } catch (e) {
2796    localStorage.removeItem(sessionKey);
2797    return;
2798  }
2799
2800  itemInfo = normalizeItem(itemInfo);
2801  const itemFeatures = itemInfo.customization;
2802  const additions = itemFeatures.additions || '';
2803  const features = itemFeatures.features || '';
2804
2805  const portion = itemInfo.portion || '';
2806  const amount = Number(itemInfo.amount) || 0;
2807  const fullPrice = Number(itemInfo.fullPrice) || 0;
2808  const image = itemInfo.image || '';
2809  //const name = itemInfo.name || '';
2810  const name = itemInfo.displayName || itemInfo.name || '';
2811
2812
2813  let popupBody = '';
2814
2815  popupBody += '<div class="cart-item col-xs-8 popupId' + sessionKey + '">';
2816  popupBody += '  <div class="cart-item-left">
2816<img src="' + image + '" class="cartItemImages"></div>';
2817  popupBody += '  <div class="cart-item-right">';
2818  popupBody += '    <h6 class="cartItemNames">' + amount + ' x ' + portion + ' - ' + name;
2819  
2820  popupBody += '      <button type="button" class="close_new2" ' +
2821               '              onclick="removePopUp(' + sessionKey + ',' + fullPrice + ')" ' +
2822               '              data-json="' + sessionKey + '" data-pricefull="' + fullPrice + '">' +
2823               ' <svg viewBox="0 0 24 24" class="close_new3 cart-remove-icon"><path d="M3 6h18"></path><path d="M8 6V4h8v2"></path><path d="M6 6l1 15h10l1-15"></path><path d="M10 10v7"></path><path d="M14 10v7"></path></svg>     </button>';
2824  popupBody += '    </h6>';
2825
2826  popupBody += additions + features;
2827
2828  popupBody += '    <h6 class="ptotal">Product Total' +
2829               '      <span style="float:right; right:0; position:absolute; color:black;">' +
2830               '        £' + fullPrice.toFixed(2) +
2831               '      </span>' +
2832               '    </h6>';
2833  popupBody += '  </div>';
2834  popupBody += '</div>';
2835 
2836  // If you also use .popupxyz container in some templates
2837 var el1 = document.getElementById("cartPopUpx");
2838if (el1) el1.innerHTML += popupBody;
2839else { try { $('.popupxyz').append(popupBody); } catch (e) {} }
2840
2841
2842  fullPriceTotal += fullPrice;
2843  fullPriceTotal = Math.round(fullPriceTotal * 100) / 100;
2844}
2845
2846function cartChanged() {
2847  loadPopUp();     // recalculates BOGO + redraws + updates basketxyz
2848  try { lcheckout(); } catch(e) {}
2849}
2850
2851
2852    
2853
2854    
2855
2856      // Core modal builder
2857      window.showBoostModal = function (opts) {
2858        opts = opts || {};
2859        var id = 'boost-generic-modal-overlay';
2860
2861        // Avoid duplicates
2862        var existing = document.getElementById(id);
2863        if (existing) existing.remove();
2864
2865        var overlay = document.createElement('div');
2866        overlay.id = id;
2867        overlay.style.position = 'fixed';
2868        overlay.style.inset = '0';
2869        overlay.style.background = 'rgba(0, 0, 0, 0.6)';
2870        overlay.style.zIndex = '999999';
2871        overlay.style.display = 'flex';
2872        overlay.style.alignItems = 'center';
2873        overlay.style.justifyContent = 'center';
2874
2875        var box = document.createElement('div');
2876        box.style.background = '#ffffff';
2877        box.style.borderRadius = '10px';
2878        box.style.padding = '18px 16px';
2879        box.style.maxWidth = '320px';
2880        box.style.width = '80%';
2881        box.style.boxShadow = '0 8px 20px rgba(0,0,0,0.3)';
2882        box.style.textAlign = 'center';
2883        box.style.fontFamily = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';
2884
2885        var title = document.createElement('div');
2886        title.textContent = opts.title || 'Notice';
2887        title.style.fontWeight = '700';
2888        title.style.fontSize = '18px';
2889        title.style.marginBottom = '8px';
2890
2891        var msg = document.createElement('div');
2892        msg.textContent = opts.message || '';
2893        msg.style.fontSize = '14px';
2894        msg.style.marginBottom = '14px';
2895        msg.style.whiteSpace = 'pre-line';
2896
2897        var buttonsWrap = document.createElement('div');
2898        buttonsWrap.style.display = 'flex';
2899        buttonsWrap.style.justifyContent = opts.showCancel ? 'space-between' : 'center';
2900        buttonsWrap.style.gap = '10px';
2901
2902        function close(result) {
2903          overlay.remove();
2904          if (typeof opts.onResult === 'function') {
2905            opts.onResult(result);
2906          }
2907        }
2908
2909        // OK button
2910        var okBtn = document.createElement('button');
2911        okBtn.textContent = opts.okText || 'OK';
2912        okBtn.style.border = 'none';
2913        okBtn.style.borderRadius = '999px';
2914        okBtn.style.padding = '8px 20px';
2915        okBtn.style.fontSize = '14px';
2916        okBtn.style.fontWeight = '600';
2917        okBtn.style.cursor = 'pointer';
2918        okBtn.style.background = '#e53935';
2919        okBtn.style.color = '#fff';
2920        okBtn.style.flex = '1';
2921        okBtn.onclick = function () { close(true); };
2922
2923        buttonsWrap.appendChild(okBtn);
2924
2925        // Cancel button (for confirm)
2926        if (opts.showCancel) {
2927          var cancelBtn = document.createElement('button');
2928          cancelBtn.textContent = opts.cancelText || 'Cancel';
2929          cancelBtn.style.border = '1px solid #ccc';
2930          cancelBtn.style.borderRadius = '999px';
2931          cancelBtn.style.padding = '8px 20px';
2932          cancelBtn.style.fontSize = '14px';
2933          cancelBtn.style.fontWeight = '500';
2934          cancelBtn.style.cursor = 'pointer';
2935          cancelBtn.style.background = '#f5f5f5';
2936          cancelBtn.style.color = '#333';
2937          cancelBtn.style.flex = '1';
2938          cancelBtn.onclick = function () { close(false); };
2939          buttonsWrap.appendChild(cancelBtn);
2940        }
2941
2942        box.appendChild(title);
2943        box.appendChild(msg);
2944        box.appendChild(buttonsWrap);
2945        overlay.appendChild(box);
2946        document.body.appendChild(overlay);
2947      };
2948
2949    // Simple alert: one button
2950    window.alertNow = function (message, cb) {
2951      window.showBoostModal({
2952        title: 'Notice',
2953        message: message,
2954        showCancel: false,
2955        okText: 'OK',
2956        onResult: function () {
2957          if (typeof cb === 'function') cb();
2958        }
2959      });
2960    };
2961
2962    // Confirm-style: two buttons, callback(true/false)
2963    window.confirmNow = function (message, cb) {
2964      window.showBoostModal({
2965        title: 'Please confirm',
2966        message: message,
2967        showCancel: true,
2968        okText: 'Yes',
2969        cancelText: 'No',
2970        onResult: function (result) {
2971          if (typeof cb === 'function') cb(result);
2972        }
2973      });
2974    };
2975
2976
2977    window.showAddressIssueModal = function (message, suggestions, onPick, onUseTyped, onEdit) {
2978      var id = 'boost-address-issue-overlay';
2979      var existing = document.getElementById(id);
2980      if (existing) existing.remove();
2981
2982      var overlay = document.createElement('div');
2983      overlay.id = id;
2984      overlay.style.position = 'fixed';
2985      overlay.style.inset = '0';
2986      overlay.style.background = 'rgba(0, 0, 0, 0.6)';
2987      overlay.style.zIndex = '999999';
2988      overlay.style.display = 'flex';
2989      overlay.style.alignItems = 'center';
2990      overlay.style.justifyContent = 'center';
2991      overlay.style.color = 'red';
2992
2993      var box = document.createElement('div');
2994      box.style.background = '#ffffff';
2995      box.style.borderRadius = '10px';
2996      box.style.padding = '18px 20px';
2997      box.style.maxWidth = '340px';
2998      box.style.width = '90%';
2999      box.style.boxShadow = '0 8px 20px rgba(0,0,0,0.3)';
3000      box.style.fontFamily = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';
3001
3002      var title = document.createElement('div');
3003      title.textContent = 'Address check';
3004      title.style.fontWeight = '700';
3005      title.style.fontSize = '18px';
3006      title.style.marginBottom = '8px';
3007
3008      var msg = document.createElement('div');
3009      msg.textContent = message || 'We could not confirm this address.';
3010      msg.style.fontSize = '14px';
3011      msg.style.marginBottom = '10px';
3012      msg.style.whiteSpace = 'pre-line';
3013
3014      box.appendChild(title);
3015      box.appendChild(msg);
3016
3017
3018      if (suggestions && suggestions.length) {
3019        var listWrap = document.createElement('div');
3020        listWrap.style.maxHeight = '180px';
3021        listWrap.style.overflowY = 'auto';
3022        listWrap.style.marginBottom = '10px';
3023
3024        suggestions.forEach(function (addr) {
3025          var item = document.createElement('button');
3026          item.textContent = addr;
3027          item.style.display = 'block';
3028          item.style.width = '100%';
3029          item.style.textAlign = 'left';
3030          item.style.marginBottom = '6px';
3031          item.style.border = '1px solid #ddd';
3032          item.style.borderRadius = '6px';
3033          item.style.padding = '6px 8px';
3034          item.style.fontSize = '13px';
3035          item.style.cursor = 'pointer';
3036          item.style.background = '#f7f7f7';
3037
3038          item.onclick = function () {
3039            overlay.remove();
3040            if (typeof onPick === 'function') onPick(addr);
3041          };
3042
3043          listWrap.appendChild(item);
3044        });
3045
3046        box.appendChild(listWrap);
3047      }
3048var buttonsWrap = document.createElement('div');
3049buttonsWrap.style.display = 'flex';
3050buttonsWrap.style.justifyContent = 'space-between';
3051buttonsWrap.style.gap = '10px';
3052
3053var hasSuggestions = suggestions && suggestions.length > 0;
3054
3055// Edit button
3056var editBtn = document.createElement('button');
3057editBtn.textContent = 'Edit address';
3058editBtn.style.flex = '1';
3059editBtn.style.border = 'none';
3060editBtn.style.borderRadius = '999px';
3061editBtn.style.padding = '8px 10px';
3062editBtn.style.fontSize = '13px';
3063editBtn.style.cursor = 'pointer';
3064editBtn.style.background = '#e53935';
3065editBtn.style.color = '#fff';
3066
3067editBtn.onclick = function () {
3068  overlay.remove();
3069
3070  if (typeof onEdit === 'function') {
3071    onEdit();
3072  }
3073};
3074
3075buttonsWrap.appendChild(editBtn);
3076
3077// Only allow the typed address when no suggestions were found
3078if (!hasSuggestions) {
3079  var useTypedBtn = document.createElement('button');
3080
3081  useTypedBtn.textContent = 'Use address I typed';
3082  useTypedBtn.style.flex = '1';
3083  useTypedBtn.style.border = '1px solid #ccc';
3084  useTypedBtn.style.borderRadius = '999px';
3085  useTypedBtn.style.padding = '8px 10px';
3086  useTypedBtn.style.fontSize = '13px';
3087  useTypedBtn.style.cursor = 'pointer';
3088  useTypedBtn.style.background = '#f5f5f5';
3089
3090  useTypedBtn.onclick = function () {
3091    overlay.remove();
3092
3093    if (typeof onUseTyped === 'function') {
3094      onUseTyped();
3095    }
3096  };
3097
3098  buttonsWrap.appendChild(useTypedBtn);
3099}
3100
3101var editNote = document.createElement('div');
3102
3103editNote.textContent = hasSuggestions
3104  ? 'Only edit your address if you cannot find it in the list above.'
3105  : 'No matching address was found. Check your details or continue with the address you entered.';
3106
3107editNote.style.fontSize = '13px';
3108editNote.style.fontWeight = '600';
3109editNote.style.textAlign = 'center';
3110editNote.style.color = hasSuggestions ? '#3044c5' : '#e53935';
3111editNote.style.margin = '8px 0';
3112
3113box.appendChild(editNote);
3114box.appendChild(buttonsWrap);
3115      overlay.appendChild(box);
3116      document.body.appendChild(overlay);
3117    };
3118
3119    function getFixedPriceFromTypexClient(typex, portion) {
3120  var rawTypex = String(typex || "").trim().toLowerCase();
3121  var rawPortion = String(portion || "").toLowerCase();
3122
3123  if (rawTypex.indexOf("fixed_") !== 0) return null;
3124
3125  var config = rawTypex.slice(6);
3126
3127  // fixed_1.99
3128  if (config.indexOf(":") === -1 && config.indexOf("|") === -1) {
3129    var fixedOne = parseFloat(config);
3130    if (isFinite(fixedOne)) return +fixedOne.toFixed(2);
3131  }
3132
3133  // fixed_9:1.99|12:2.99
3134  var portionMatch = rawPortion.match(/\d+(\.\d+)?/);
3135  if (!portionMatch) return null;
3136
3137  var portionNumber = portionMatch[0];
3138  var pairs = config.split("|");
3139
3140  for (var i = 0; i < pairs.length; i++) {
3141    var parts = pairs[i].split(":");
3142    if (parts.length !== 2) continue;
3143
3144    var sizeKey = String(parts[0]).trim().toLowerCase();
3145    var price = parseFloat(parts[1]);
3146
3147    if (sizeKey === portionNumber && isFinite(price)) {
3148      return +price.toFixed(2);
3149    }
3150  }
3151
3152  return null;
3153}
3154
3155function isBogoEligibleClient(item) {
3156  if (!item) return false;
3157  if (item.name === "Delivery Fee") return false;
3158  if (item.typex == null) return false;
3159
3160  const rawTypex = String(item.typex).trim().toLowerCase();
3161  if (rawTypex === "" || rawTypex === "no") return false;
3162  if (rawTypex.indexOf("fixed_") === 0) return true;
3163
3164  const pct = parseFloat(rawTypex);
3165  return isFinite(pct) && pct >= 0 && pct <= 100;
3166}
3167
3168// function getPromoGroupKeyClient(item) {
3169//   let divider = parseInt(item.divider, 10);
3170//   if (!isFinite(divider) || divider <= 0) divider = 2;
3171
3172//   const portion = String(item.portion || "").trim().toLowerCase();
3173
3174//   return divider + "|" + portion;
3175// }
3176
3177function getPromoGroupKeyClient(item) {
3178  let divider = parseInt(item.divider, 10);
3179  if (!isFinite(divider) || divider <= 0) divider = 2;
3180
3181  const rawTypex = String(item.typex || "").trim().toLowerCase();
3182  const portion = String(item.portion || "").trim().toLowerCase();
3183
3184  if (rawTypex.indexOf("fixed_") === 0 && rawTypex.indexOf(":") !== -1) {
3185    return divider + "|" + rawTypex + "|" + portion;
3186  }
3187
3188
3189  return divider + "|" + rawTypex;
3190}
3191
3192 
3193
3194function getDiscountedBaseClient(item) {
3195  const rawTypex = String(item.typex || "").trim().toLowerCase();
3196
3197  if (rawTypex.indexOf("fixed_") === 0) {
3198    const fixedPrice = getFixedPriceFromTypexClient(item.typex, item.portion);
3199    if (fixedPrice !== null) return fixedPrice;
3200
3201    return Number(item.rPrice || item.basePrice || 0);
3202  }
3203
3204  const pct = parseFloat(rawTypex);
3205  if (!isFinite(pct)) return Number(item.rPrice || item.basePrice || 0);
3206
3207  return Number((Number(item.rPrice || item.basePrice || 0) * (pct / 100)).toFixed(2));
3208}
3209
3210  </script>
vendor: 1 bytes, line 3210
3210
3211<script type="module" src="https://static.cloudflareinsights.com/beacon.min.js/v31edd6df95cf4e85bb4c19e7a9bdbcba1788362987495" integrity="sha512-iIg7k2xntmwu6/uSb5tpc/hySgZc4eoL31yB29W6tJFo2akwjPWcEqnCEdJvGexCL0KEQwVYv5BlowfhVz26hg==" data-cf-beacon='{"version":"2024.11.0","token":"1691483e965a48588e86ad27ada8a385","r":1,"spa":2}' crossorigin="anonymous"></script>
vendor: 1 bytes, line 3211
3211

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.