Error executing template "/Designs/Warmtethuis/Paragraph/HeatpumpAssembly.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_3f52a8c053d0468fad04fcd13d2f62f7.Execute() in D:\inetpub\wwwroot\www.warmgarant.nl\Files\Templates\Designs\Warmtethuis\Paragraph\HeatpumpAssembly.cshtml:line 1052
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @using Warmgarant.Shop.Models.Constants 2 @using Warmgarant.Shop.Models.Enumerations 3 @using Warmgarant.Shop.Repository.Helpers 4 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5 @{ 6 7 // dependencies 8 var orderService = new Dynamicweb.Ecommerce.Orders.OrderService(); 9 var productService = new Dynamicweb.Ecommerce.Products.ProductService(); 10 var orderLineService = new Dynamicweb.Ecommerce.Orders.OrderLineService(); 11 var pageService = new Dynamicweb.Content.PageService(); 12 var orderType = OrderType.Unknown; 13 14 15 /// config 16 var areaId = Dynamicweb.Frontend.PageView.Current().AreaID; 17 var assetsDirectory = "./files/templates/designs/warmtethuis/styleguide/assets/"; 18 var iconsDirectory = "./files/templates/designs/warmtethuis/images/icons/"; 19 var isComparePage = false; 20 var cartUrl = default(string); 21 var currentOrder = OrderHelper.GetCurrentOrder(orderService, "", areaId); 22 23 var selectedHeatpump = OrderHelper.GetProductFromOrder(currentOrder, ProductType.HeatPump); 24 var heatpumpSelected = currentOrder != null && selectedHeatpump != null; 25 if (heatpumpSelected) 26 { 27 ProductHelper.ClearProductPriceCache(selectedHeatpump); 28 } 29 30 // quotation data 31 var quotationParagraphId = AreaHelper.GetAreaItemIntValueBySystemName(StringConstants.WebsiteConfiguration.QuotationRequestHeatpumpParagraphId); 32 33 // heat pump info 34 var seriesName = default(string); 35 var productName = default(string); 36 var productId = default(string); 37 var variantId = default(string); 38 var productPrice = default(string); 39 var productGroupName = default(string); 40 var productMobile = default(string); 41 var productPriceDouble = default(double); 42 var productImage = default(string); 43 var productLongDescription = default(string); 44 var productBadge = default(string); 45 var isActionPrice = false; 46 var priceBeforeDiscount = default(string); 47 //var interests = default(string); 48 var heatpumpIsForSale = false; 49 var isNew = false; 50 var priceBefore = default(string); 51 var priceAfter = default(string); 52 var usps = new List<string>(); 53 var subtitle = GetString("Item.SubTitle.Value"); 54 var thermostatTitle = GetString("Item.ThermostatTitle.Value"); 55 var modalCloseImage = string.Format("<img src=\"{0}{1}\" title=\"{2}\" class=\"white-svg\" />", iconsDirectory, "x-close-white.svg", Translate("Close", "Close").JsEncode()); 56 var moreInfoImage = string.Format("<img src=\"{0}{1}\" title=\"{2}\" class=\"blue-svg\" /> <span>{3}</span>", iconsDirectory, "Plus.svg", Translate("MoreInformation", "More information").JsEncode(), Translate("Info", "Info")); 57 58 // thermostat product info 59 Dynamicweb.Ecommerce.Products.Product selectedThermostat = null; 60 List<Dynamicweb.Ecommerce.Products.Product> thermostatOptions = null; 61 var thermostatIntro = GetString("Item.ThermostatIntroText.Value"); 62 63 // service subscriptipn info 64 var serviceSubscriptionTitle = GetString("Item.ServiceSubscriptionTitle.Value"); 65 var serviceSubscriptionIntro = GetString("Item.ServiceSubscriptionIntroText.Value"); 66 var serviceSubscriptionInfo = default(string); 67 Dynamicweb.Ecommerce.Products.Product selectedServiceSubscription = null; 68 List<Dynamicweb.Ecommerce.Products.Product> serviceSubscriptionOptions = null; 69 70 // installation info 71 var installationTitle = GetString("Item.InstallationTitle.Value"); 72 var installationInfo = GetString("Item.InstallationTitleInformation.Value"); 73 var installationIntro = GetString("Item.InstallationIntroText.Value"); 74 var selectedInstallation = (Dynamicweb.Ecommerce.Products.Product)null; 75 var installationOption = (Dynamicweb.Ecommerce.Products.Product)null; 76 var installationExtraInfo = default(string); 77 78 // disclaimer info 79 var disclaimerTitle = GetString("Item.DisclaimerTitle.Value"); 80 var disclaimerText = GetString("Item.DisclaimerIntroText.Value"); 81 82 if (heatpumpSelected) 83 { 84 // if the heatpump is for sale it can be purchased directly, else you request an advise home visit from a Warmtethuis consultant. 85 heatpumpIsForSale = ProductHelper.GetProductFieldValue<bool>(productService, selectedHeatpump, StringConstants.ProductFieldValueSystemNames.IsForSale); 86 87 // order info 88 Enum.TryParse((string)currentOrder.OrderFieldValues.GetOrderFieldValue(StringConstants.OrderFields.OrderType).Value, out orderType); 89 90 // set session variable 91 SessionHelper.SetLastAddedProductSessionValue(selectedHeatpump.Id, orderType); 92 93 // order price info 94 var orderPriceRaw = currentOrder.Price.Price; 95 var orderPrice = orderPriceRaw.WarmgarantMoneyFormat(true, true); 96 97 // advice info 98 productLongDescription = selectedHeatpump.LongDescription; 99 productId = selectedHeatpump.Id; 100 variantId = selectedHeatpump.VariantId; 101 seriesName = selectedHeatpump.Name; 102 productName = ProductHelper.CreateProductName(selectedHeatpump.Name, selectedHeatpump.Manufacturer); 103 productImage = selectedHeatpump.ImageSmall; 104 if (!string.IsNullOrWhiteSpace(productImage) && productImage.Length > 10) 105 { 106 productImage = string.Format("/Files{0}", productImage); 107 } 108 productBadge = ProductHelper.GetProductFieldValue<string>(productService, selectedHeatpump, "ExtraIcon").Replace("../", "./Files/"); 109 if (!string.IsNullOrWhiteSpace(productBadge) && !productBadge.ToLower().Contains("/files/")) 110 { 111 // for some reason "/Files/Images/Cons-logo_2017.png" can be "Cons-logo_2017.png" when collected by ProductHelper.GetProductFieldValue<string>() 112 productBadge = string.Format("./Files/Images/{0}", productBadge); 113 } 114 115 // get price 116 productPriceDouble = ProductHelper.GetProductPrice(selectedHeatpump).Price; 117 productPrice = productPriceDouble.WarmgarantMoneyFormat(false, false); 118 productMobile = productPriceDouble.WarmgarantMoneyFormat(true, false); 119 isActionPrice = ProductHelper.ProductHasDiscount(selectedHeatpump); 120 if (isActionPrice) 121 { 122 priceBeforeDiscount = productPriceDouble.ToString(); 123 var heatpumpDiscountPriceDouble = ProductHelper.GetProductDiscountPrice(selectedHeatpump).Price; 124 productPrice = heatpumpDiscountPriceDouble.WarmgarantMoneyFormat(false, false); 125 } 126 127 // go to cart URL 128 var cartPageId = AreaHelper.GetAreaItemStringValueBySystemName(StringConstants.WebsiteConfiguration.PumpsSalesCartPageId); 129 if (!string.IsNullOrWhiteSpace(cartPageId)) 130 { 131 cartUrl = string.Format("/Default.aspx?ID={0}", cartPageId); 132 } 133 134 // thermostat info 135 selectedThermostat = OrderHelper.GetProductFromOrder(currentOrder, ProductType.Thermostat); 136 thermostatOptions = OrderHelper.GetThermostats(selectedHeatpump, orderType); 137 138 // service subscription info 139 selectedServiceSubscription = OrderHelper.GetProductFromOrder(currentOrder, ProductType.ServiceSubscription); 140 serviceSubscriptionOptions = OrderHelper.GetServiceSubscriptions(orderType, ProductType.HeatPump, areaId); 141 if (serviceSubscriptionOptions != null && serviceSubscriptionOptions.Any()) 142 { 143 serviceSubscriptionInfo = serviceSubscriptionOptions?.First()?.LongDescription ?? ""; 144 } 145 146 // installation info 147 selectedInstallation = OrderHelper.GetProductFromOrder(currentOrder, ProductType.Installation); 148 installationOption = OrderHelper.GetInstallation(orderType, ProductType.HeatPump, areaId, selectedHeatpump); 149 if (installationOption != null) 150 { 151 installationExtraInfo = installationOption.LongDescription; 152 } 153 154 // unique selling points 155 var usp1 = ProductHelper.GetProductFieldValue<string>(productService, selectedHeatpump, StringConstants.ProductFieldValueSystemNames.Usp1); 156 if (!string.IsNullOrWhiteSpace(usp1)) 157 { 158 usps.Add(usp1); 159 } 160 var usp2 = ProductHelper.GetProductFieldValue<string>(productService, selectedHeatpump, StringConstants.ProductFieldValueSystemNames.Usp2); 161 if (!string.IsNullOrWhiteSpace(usp2)) 162 { 163 usps.Add(usp2); 164 } 165 var usp3 = ProductHelper.GetProductFieldValue<string>(productService, selectedHeatpump, StringConstants.ProductFieldValueSystemNames.Usp3); 166 if (!string.IsNullOrWhiteSpace(usp3)) 167 { 168 usps.Add(usp3); 169 } 170 171 // add defaults 172 var setDefaults = heatpumpIsForSale && 173 ( 174 (selectedThermostat == null && thermostatOptions != null) || 175 (selectedServiceSubscription == null && (serviceSubscriptionOptions != null && serviceSubscriptionOptions.Any())) || 176 (selectedInstallation == null && installationOption != null) 177 ); 178 if (setDefaults) 179 { 180 181 OrderHelper.AddHeatpumpDefaults( 182 currentOrder, 183 orderService, 184 orderLineService, 185 productService, 186 selectedHeatpump, 187 selectedThermostat, 188 thermostatOptions, 189 null, 190 null, 191 selectedServiceSubscription, 192 serviceSubscriptionOptions, 193 selectedInstallation, 194 installationOption, 195 Warmgarant.Shop.Models.Enumerations.OrderType.Buy, 196 areaId 197 ); 198 199 selectedThermostat = OrderHelper.GetProductFromOrder(currentOrder, ProductType.Thermostat); 200 selectedServiceSubscription = OrderHelper.GetProductFromOrder(currentOrder, ProductType.ServiceSubscription); 201 selectedInstallation = OrderHelper.GetProductFromOrder(currentOrder, ProductType.Installation); 202 } 203 } 204 205 // SEO: VirtualPageView 206 var seoPage = SeoHelper.GetVirtualPageviewAssemblyPage( 207 GetGlobalValue("Global:Request.Scheme"), 208 GetGlobalValue("Global:Request.Host"), 209 GetGlobalValue("Global:Pageview.Url"), 210 productName); 211 212 var seoPageQuotation = string.Format("{0}/{1}", seoPage, Translate("SEO_VirtualPageviewHeatpumpAssemblyQuotationForm", "quotation-form-heatpump")); 213 var serviceSubscriptionImage = ""; 214 var installationImage = ""; 215 216 var groupId = ProductHelper.GetProductPrimaryGroupId(selectedHeatpump); 217 if (!string.IsNullOrWhiteSpace(groupId)) { 218 var group = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(groupId); 219 productGroupName = group.Name; 220 } 221 222 if (!string.IsNullOrWhiteSpace(seoPage)) 223 { 224 <Text> 225 <script> 226 SEO.trackPageView("@seoPage", '@GetGlobalValue("Global:CookieOptInLevel").ToLower()' === 'functional'); 227 </script> 228 </Text> 229 } 230 231 <div id="heatpumpassembly"> 232 @NavigationHelper.GetBreadCrumb(productService, GetGlobalValue("Global:Area.LongLang")) 233 234 <div class="row"> 235 <div class="col s10 push-s1 l12"> 236 <h1>@GetString("ParagraphHeader") @GetString("Item.ParagraphHeader.Value")</h1> 237 </div> 238 </div> 239 <div class="row"> 240 @if (heatpumpSelected) 241 { 242 if (selectedServiceSubscription != null) { 243 priceAfter = $"+{ProductHelper.GetProductPrice(selectedServiceSubscription).Price.WarmgarantMoneyFormat()} {Translate("PerMonthShort", "p/m")}"; 244 } 245 246 <div class="col s12 l3 hide-on-med-and-down"> 247 <div class="row"> 248 <div class="col s12"> 249 250 <div class="heatpump-image"> 251 <div class="contents"> 252 @using Warmgarant.Shop.Repository.Helpers 253 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 254 255 @if (productPriceDouble > 0) 256 { 257 var priceColorClass = "anthracite"; 258 if (isActionPrice) 259 { 260 priceColorClass = "red-gradient"; 261 } 262 263 <div class="action-square medium @priceColorClass valign-wrapper"> 264 <div class="action-container"> 265 <div @if (!string.IsNullOrWhiteSpace(priceBefore)) { <text> data-before="@priceBefore" </text> } @if (!string.IsNullOrWhiteSpace(priceAfter)) { <text> data-after="@priceAfter" </text> }>@productPrice</div> 266 </div> 267 </div> 268 } 269 270 @if (isActionPrice) 271 { 272 <div class="action-corner"> 273 <div class="action-corner-wrapper"> 274 @SvgHelper.GetSvgContent(string.Format("{0}images/svg/action-corner.svg", assetsDirectory), title: Translate("Action", "Action").JsEncode()) 275 <div class="action-corner-container"> 276 <span>@Translate("Action", "Action")</span> 277 </div> 278 </div> 279 </div> 280 } 281 282 @if (!string.IsNullOrWhiteSpace(productBadge)) 283 { 284 <div class="ribbons"> 285 <div class="ribbon"> 286 <img src="@productBadge" alt="@Translate("ProductBadge", "Product badge").JsEncode()" width="135"> 287 </div> 288 </div> 289 } 290 else if (isNew) 291 { 292 <div class="action-circle medium special"> 293 <div class="action-container"> 294 @SvgHelper.GetSvgContent(string.Format("{0}images/svg/action-circle-new.svg", assetsDirectory), "brown-svg", Translate("New", "New").JsEncode()) 295 <span>@Translate("New", "New")</span> 296 </div> 297 </div> 298 } 299 300 @if (isActionPrice && !string.IsNullOrWhiteSpace(priceBeforeDiscount)) 301 { 302 <div class="original-price"> 303 <div class="contents text-small brown-wg-text darken-2"> 304 @Translate("Of", "Van").ToLower() <span class="strikethrough">@priceBeforeDiscount</span> 305 <br /> 306 <b>@Translate("For", "Voor").ToLower()</b> 307 </div> 308 </div> 309 } 310 311 @if (!isComparePage) 312 { 313 <div class="information hide-on-med-and-down"> 314 <div class="mask"></div> 315 <div class="contents"> 316 <a href="javascript:void(0)" class="show-info"> 317 @SvgHelper.GetSvgContent(string.Format("{0}images/icons/plus.svg", GetString("Template:DesignBaseUrl")), title: Translate("Info", "Info").JsEncode()) 318 @Translate("Info", "Info") 319 </a> 320 </div> 321 </div> 322 } 323 324 <div class="image" style="background-image: url(@productImage);"></div> 325 </div> 326 </div> 327 328 @if (selectedHeatpump.Manufacturer.Name.Equals("Remeha")) 329 { 330 <div class="remeha-logo"> 331 <img src="/Files/Templates/Designs/Warmtethuis/Images/Logo_Remeha.png" /> 332 </div> 333 } 334 335 @using Warmgarant.Shop.Repository.Helpers 336 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 337 @{ 338 @*NOTE: Javascript initialize of this element should be done in the parent, because the default settings can differ per page!*@ 339 int adviceParagraphId = Warmgarant.Shop.Repository.Helpers.AreaHelper.GetAreaItemIntValueBySystemName(Warmgarant.Shop.Models.Constants.StringConstants.WebsiteConfiguration.AdviceParagraphId); 340 int contactParagraphId = Warmgarant.Shop.Repository.Helpers.AreaHelper.GetAreaItemIntValueBySystemName(Warmgarant.Shop.Models.Constants.StringConstants.WebsiteConfiguration.ContactParagraphId); 341 342 // alleen gevuld als Advice_Contact itemtype gebruikt wordt en de custom velden zijn gevuld: 343 var customContactText = GetString("Item.CustomContactText.Value"); 344 var customAdviceText = GetString("Item.CustomAdviceText.Value"); 345 346 if (adviceParagraphId > 0 && contactParagraphId > 0) 347 { 348 var callMeBackConsentText = StringHelper.GetConsentLabel(Translate("CallMeBackConsentLabel", "I agree with the Warmgarant privacy statement as shown on the {0}privacy page{1}"), 349 Translate("ConsentPrivacyPageUrl", "https://www.warmtethuis.nl/privacy"), 350 "callmeback-consent-link"); 351 352 <div id="advice-contact"> 353 <div class="tabs-wrapper tabs-blue" id="tabs-advice-contact"> 354 @*TABS: default (a with active class) is set on parent, can differ per page*@ 355 <ul class="tabs"> 356 <li class="tab"><a href="#tab-content-advice" id="advice-tab">@Translate("Our Advice", "Ons advies")</a></li> 357 <li class="tab"><a href="#tab-content-contact" id="contact-tab" class="active">@Translate("Contact")</a></li> 358 </ul> 359 @*ADVICE*@ 360 <div id="tab-content-advice" class="col s12 tabs-content" style="display: none;"> 361 <div class="tabs-content-wrapper"> 362 @if (!string.IsNullOrWhiteSpace(customAdviceText)) 363 { 364 <div class="pictogram pictogram-small"> 365 @SvgHelper.GetSvgContent(string.Format("{0}images/svg/pictograms/apostrophe.svg", assetsDirectory), classNames: "orange-svg", title: Translate("Apostrophe", "Apostrophe")) 366 </div> 367 368 @customAdviceText 369 } 370 else 371 { 372 @RenderParagraphContent(adviceParagraphId) 373 } 374 </div> 375 </div> 376 @*CONTACT*@ 377 <div id="tab-content-contact" class="col s12 tabs-content general-wg-text active"> 378 @*CONTACT CONTENT OPEN/CLOSED*@ 379 <div class="tabs-content-wrapper"> 380 @if (!string.IsNullOrWhiteSpace(customContactText)) 381 { 382 <div class="pictogram pictogram-small"> 383 @SvgHelper.GetSvgContent(string.Format("{0}images/svg/pictograms/apostrophe.svg", assetsDirectory), classNames: "orange-svg", title: Translate("Apostrophe", "Apostrophe")) 384 </div> 385 386 @customContactText 387 } 388 else 389 { 390 @RenderParagraphContent(contactParagraphId) 391 } 392 </div> 393 @*CALL ME BACK FORM*@ 394 <div class="tabs-content-overlay tabs-content-overlay-hidden" id="call-me-back-container"> 395 <div class="overlay-toggle overlay-toggle-top"> 396 <div class="pictogram pictogram-x-small" data-toggle="call-me-back-container"> 397 @SvgHelper.GetSvgContent(string.Format("{0}images/svg/pictograms/x-close.svg", assetsDirectory), classNames: "general-svg", title: Translate("Close", "Close").JsEncode()) 398 </div> 399 </div> 400 <div class="pictogram pictogram-small"> 401 @SvgHelper.GetSvgContent(string.Format("{0}images/svg/pictograms/apostrophe.svg", assetsDirectory), classNames: "orange-svg", title: Translate("Apostrophe", "Apostrophe").JsEncode()) 402 </div> 403 <h7>@Translate("CallBackForm_Intro", "Call me back request")</h7> 404 405 @*Note: translate tags within form need to be surrounded by single quotes, or the pageheatpumpinfo page will crash! *@ 406 407 <form name="call-back-request-form" id="call-back-request-form" method="post"> 408 <div class="row"> 409 <div class="col s12"> 410 <input type="text" name="CallMeBack_Name" id="CallMeBack_Name" required="required" class="validate" placeholder='@Translate("CallBackForm_Name", "Your name").JsEncode()' /> 411 </div> 412 </div> 413 <div class="row"> 414 <div class="col s12"> 415 <textarea name="CallMeBack_Address" id="CallMeBack_Address" required="required" class="materialize-textarea validate" placeholder='@Translate("CallBackForm_Address", "Your address")'></textarea> 416 </div> 417 </div> 418 <div class="row"> 419 <div class="col s12"> 420 <input type="tel" name="CallMeBack_Telephone" id="CallMeBack_Telephone" required="required" class="validate" maxlength="10" placeholder='@Translate("CallBackForm_Telephone", "Your telephone number")' /> 421 </div> 422 </div> 423 <div class="row"> 424 <div class="col s12"> 425 <label class="checkbox consent blue-content-link cmb"> 426 <input type="checkbox" value="true" name="CallMeBack_Consent" id="CallMeBack_Consent" required="required" /> 427 @callMeBackConsentText 428 </label> 429 </div> 430 </div> 431 <div class="row"> 432 <div class="input-field col s12"> 433 <input type="button" name="CallMeBack_Submit" id="CallMeBack_Submit" value='@Translate("CallBackForm_ButtonText", "Submit")' class="btn btn-brown" /> 434 </div> 435 </div> 436 </form> 437 438 <div id="feedback-success" class="hide"> 439 <p class="general-wg-text">@Translate("CallBackForm_FeedbackSuccess", "Thanks for your call back request. We will contact you as soon as possible.")</p> 440 </div> 441 <div id="feedback-failure" class="hide"> 442 <p class="general-wg-text">@Translate("CallBackForm_FeedbackFailure", "An error has occurred while sending the request.")</p> 443 </div> 444 </div> 445 @{ 446 @*CHAT ICOON*@ 447 if (AreaHelper.OfficeIsOpen().Item1 && 448 IntercomHelper.IntercomIsActive() & 449 !string.IsNullOrWhiteSpace(Warmgarant.Shop.Models.Config.ExtraConfig.ExtraConfiguration.IntercomMessengerSettings.InboundEmail)) 450 { 451 <div class="overlay-toggle"> 452 <div class="pictogram pictogram-small general-wg"> 453 <a href="javascript:void(0);" class="openIntercom">@SvgHelper.GetSvgContent(string.Format("{0}images/svg/pictograms/chat2.svg", assetsDirectory), classNames: "brown-svg darken-4", title: Translate("Chat", "Chat").JsEncode())</a> 454 </div> 455 </div> 456 } 457 } 458 </div> 459 </div> 460 </div> 461 462 @SnippetStart("JavaScriptBottom") 463 <script> 464 465 function onBeforeCallMeBack() { 466 $("#call-back-request-form").removeClass("hide"); 467 $("#feedback-failure").addClass("hide"); 468 $("#feedback-success").addClass("hide"); 469 ResetCallBackRequestForm(); 470 } 471 472 function callMeBackFormSent() { 473 $("#call-back-request-form").addClass("hide"); 474 $("#feedback-failure").addClass("hide"); 475 $("#feedback-success").removeClass("hide"); 476 477 SEO.trackEvent( 478 '@Translate("SEO_Event_CallMeBack", "call-me-back")', 479 '@Translate("SEO_Event_CallMeBack_Sent", "success")', 480 $("#CallMeBack_Telephone").val(), 481 ''); 482 483 ResetCallBackRequestForm(); 484 } 485 486 function callMeBackFormNotSent() { 487 $("#call-back-request-form").addClass("hide"); 488 $("#feedback-success").addClass("hide"); 489 $("#feedback-failure").removeClass("hide"); 490 ResetCallBackRequestForm(); 491 } 492 493 function ResetCallBackRequestForm() { 494 $("#CallMeBack_Name", "#call-back-request-form").val(""); 495 $("#CallMeBack_Address", "#call-back-request-form").val(""); 496 $("#CallMeBack_Telephone", "#call-back-request-form").val(""); 497 $("#CallMeBack_Submit", "#call-back-request-form").removeClass("btn-yellow").addClass("btn-gray"); 498 499 // Only numbers in telephone field 500 $("#CallMeBack_Telephone", "#call-back-request-form").numeric(); 501 502 // Initialize consent checkbox 503 $("label.checkbox.consent.cmb", "#call-back-request-form").innovadisCheckbox({ 504 onAfterChange: validateCallBackForm(true) 505 }); 506 $("#CallMeBack_Consent", "#call-back-request-form").prop("checked", false); 507 508 // Enable link in general conditions label 509 $("#callmeback-consent-link", "#call-back-request-form").off("click").on("click", function (e) { 510 e.stopPropagation(); 511 e.preventDefault(); 512 window.open($(this).attr('href'), $(this).attr('target')); 513 return false; 514 }); 515 516 $("input, textarea", "#call-back-request-form").off("change").on("change", function () { 517 if ($(this).val() !== "") { 518 $(this).removeClass("error"); 519 } 520 }); 521 522 } 523 524 function validateCallBackForm(changeButton) { 525 526 $("input,textarea", "#call-back-request-form").removeClass("error"); 527 528 var isValid = true; 529 var name = $("#CallMeBack_Name", "#call-back-request-form").val(); 530 var address = $("#CallMeBack_Address", "#call-back-request-form").val(); 531 var telephone = $("#CallMeBack_Telephone", "#call-back-request-form").val(); 532 var callbackConsent = $("#CallMeBack_Consent", "#call-back-request-form").prop("checked"); 533 534 if (name.length == 0) { 535 isValid = false; 536 $("#CallMeBack_Name", "#call-back-request-form").addClass("error"); 537 } 538 539 if (address.length == 0) { 540 isValid = false; 541 $("#CallMeBack_Address", "#call-back-request-form").addClass("error"); 542 } 543 544 if (telephone.length != 10 || !telephone.startsWith("0")) { 545 isValid = false; 546 $("#CallMeBack_Telephone", "#call-back-request-form").addClass("error"); 547 } 548 549 if (!callbackConsent) { 550 isValid = false; 551 } 552 553 if (changeButton) { 554 if (isValid) { 555 $("#CallMeBack_Submit").removeClass("btn-gray").addClass("btn-yellow"); 556 557 } else { 558 $("#CallMeBack_Submit").removeClass("btn-yellow").addClass("btn-gray"); 559 } 560 } 561 562 return isValid; 563 } 564 565 566 // submit form 567 $("#CallMeBack_Submit", "#call-back-request-form") 568 .off("click") 569 .on("click", function() { 570 571 if (!validateCallBackForm(false)) { 572 return false; 573 } 574 575 var name = $("#CallMeBack_Name", "#call-back-request-form").val(); 576 var address = $("#CallMeBack_Address", "#call-back-request-form").val(); 577 var telephone = $("#CallMeBack_Telephone", "#call-back-request-form").val(); 578 579 var callbackRequestApiUrl = "/@Warmgarant.Shop.Models.Constants.StringConstants.ApplicationVariables.WebApiName/form/callbackrequestsubmit"; 580 581 var formvalues = { 582 areaId: @Warmgarant.Shop.Repository.Helpers.AreaHelper.GetCurrentAreaId(), 583 culture: '@GetGlobalValue("Global:Area.LongLang")', 584 name: name.trim(), 585 address: address.trim(), 586 telephonenumber: telephone.trim() 587 } 588 589 // ajax post 590 $.ajax({ 591 type: "POST", 592 data: JSON.stringify(formvalues), 593 url: callbackRequestApiUrl, 594 contentType: "application/json" 595 }).done(function(sentSuccessfully, status, metaData) { 596 if (sentSuccessfully) { 597 callMeBackFormSent(); 598 } else { //show error message 599 callMeBackFormNotSent(); 600 } 601 }).fail(function(jqxhr, textStatus, error) { 602 var err = textStatus + ", " + error; 603 console.error("Request:", callbackRequestApiUrl, " failed:", err); 604 callMeBackFormNotSent(); 605 }); 606 607 }); 608 609 </script> 610 @SnippetEnd("JavaScriptBottom") 611 } 612 } 613 </div> 614 </div> 615 </div> 616 } 617 <div class="col s12 l9"> 618 <div class="row" id="contentrow"> 619 <div class="col s10 l8 push-s1"> 620 <div class="row"> 621 @if (!heatpumpSelected) 622 { 623 <div class="col s12"> 624 <p>@Translate("FirstSelectAHeatpump", "First select a heatpump.")</p> 625 </div> 626 } 627 else if (!heatpumpIsForSale) 628 { 629 <div class="col s12"> 630 <p>@Translate("HeatPumpNotFor Sale", "This heatpump is not for sale.")</p> 631 @{ 632 var listPage = pageService.GetPageByNavigationTag(areaId, Warmgarant.Shop.Models.Constants.StringConstants.Navigation.HeatpumpListPage); 633 if (listPage != null) 634 { 635 <p> 636 <a id="back-to-list" class="btn btn-yellow" href="/Default.aspx?ID=@listPage.ID">@Translate("BackToList")</a> 637 </p> 638 } 639 } 640 </div> 641 } 642 else 643 { 644 var productPageId = 0; 645 if (orderType.Equals(OrderType.Buy)) 646 { 647 productPageId = AreaHelper.GetAreaItemIntValueBySystemName(StringConstants.WebsiteConfiguration.PumpsSalesListPageId); 648 649 } 650 <div class="col s12"> 651 <div class="row"> 652 <div class="col s12"> 653 <h3>@productName</h3> 654 </div> 655 <div class="col s12"> 656 <div id="price-holder"></div> 657 @if (usps.Any()) 658 { 659 <div id="usps"> 660 <ul> 661 @foreach (var usp in usps) 662 { 663 <li>@usp</li> 664 } 665 </ul> 666 </div> 667 } 668 </div> 669 <div class="col s12 hide-on-med-and-down rich-text-editor-content assembly-intro"> 670 @selectedHeatpump.ShortDescription 671 </div> 672 <div class="col s12 hide-on-med-and-down"> 673 <div class="specsArea"> 674 @RenderSnippet("ActionLinks") 675 </div> 676 </div> 677 @if (!string.IsNullOrWhiteSpace(productImage)) 678 { 679 <div class="col s4 hide-on-large-only mobile-image"> 680 <img src="@productImage" /> 681 </div> 682 } 683 <div class="col s8 hide-on-large-only"> 684 @RenderSnippet("ActionLinks") 685 </div> 686 </div> 687 </div> 688 <div class="col s12"> 689 <h4 class="subtitle">@subtitle.Replace("{currentHeatpump}", productName)</h4> 690 </div> 691 if (thermostatOptions != null && thermostatOptions.Any()) 692 { 693 <div class="col s12 thermostats"> 694 <div class="row"> 695 <div class="col"> 696 <h5 class="optiontitle thermostatselector"> 697 @thermostatTitle 698 <span class="pictogram info-btn" id="thermostat-choose-infobtn"> 699 @moreInfoImage 700 </span> 701 </h5> 702 </div> 703 <div class="col">@thermostatIntro</div> 704 <div class="option-selector-container col s12" id="opt-container1"> 705 <div class="row"> 706 @foreach (var thermostatOption in thermostatOptions) 707 { 708 var thermostatProductId = thermostatOption.Id; 709 var thermostat = ProductHelper.CreateProductName(thermostatOption.Name, thermostatOption.Manufacturer); 710 ProductHelper.ClearProductPriceCache(thermostatOption); 711 var thermostatPriceRaw = ProductHelper.GetProductPrice(thermostatOption).Price; 712 var thermostatPrice = Math.Abs(thermostatPriceRaw).WarmgarantMoneyFormat(false, false, true); // no negative prices, add discount or rent credit prefixes, show free text when 0 713 if (thermostatPriceRaw < 0) 714 { 715 var prefix = orderType.Equals(OrderType.Buy) ? Translate("Discount") : Translate("RentCredit"); 716 thermostatPrice = string.Format("<span class=\"price-prefix\">{0}:</span> {1}", prefix, thermostatPrice); 717 } 718 var thermostatImage = thermostatOption.ImageSmall; 719 <div class="col s12 m6"> 720 <div class="option-panel horizontal large" data-value="@thermostatProductId" data-productid="@thermostatProductId" data-productType="@ProductType.Thermostat"> 721 @if (!string.IsNullOrWhiteSpace(thermostatImage)) 722 { 723 thermostatImage = string.Format("/Files{0}", thermostatImage); 724 <div class="left-column"> 725 <img src="@thermostatImage" alt="@Translate("Thermostat", "Thermostat").JsEncode(): @thermostat.JsEncode()" /> 726 </div> 727 <div class="right-column"> 728 <div class="text">@thermostat</div> 729 <div class="price opensans-bold">@thermostatPrice</div> 730 </div> 731 } 732 else 733 { 734 <div class="full-column"> 735 <div class="text">@thermostat</div> 736 <div class="price">@thermostatPrice</div> 737 </div> 738 } 739 </div> 740 </div> 741 } 742 </div> 743 </div> 744 </div> 745 </div> 746 } 747 748 if (serviceSubscriptionOptions != null && serviceSubscriptionOptions.Any()) 749 { 750 <div class="col s12 service-subscription"> 751 <div class="row"> 752 <div class="col s12"> 753 <h5 class="optiontitle"> 754 @serviceSubscriptionTitle 755 @if (!string.IsNullOrWhiteSpace(serviceSubscriptionInfo)) 756 { 757 <span class="pictogram info-btn" id="service-subscription-infobtn"> 758 @moreInfoImage 759 </span> 760 } 761 </h5> 762 </div> 763 <div class="col s12"> 764 @serviceSubscriptionIntro 765 </div> 766 <div class="col s12 option-selector-container" id="opt-container2"> 767 @foreach (var serviceSubscriptionOption in serviceSubscriptionOptions) 768 { 769 var serviceSubscriptionProductId = serviceSubscriptionOption.Id; 770 var serviceSubscription = serviceSubscriptionOption.Name; 771 ProductHelper.ClearProductPriceCache(serviceSubscriptionOption); 772 var serviceSubscriptionPriceRaw = ProductHelper.GetProductPrice(serviceSubscriptionOption).Price; 773 var serviceSubscriptionPrice = serviceSubscriptionPriceRaw.WarmgarantMoneyFormat(true, false); 774 serviceSubscriptionImage = string.Format("{0}calendar-black.svg", iconsDirectory); 775 <div class="row"> 776 <div class="col s12 m6"> 777 <div class="option-panel vertical large" data-value="serviceSubscription1" data-productid="@serviceSubscriptionProductId" data-productType="@ProductType.ServiceSubscription"> 778 <div class="left-column"> 779 @SvgHelper.GetSvgContent(serviceSubscriptionImage, "black-svg") 780 </div> 781 <div class="right-column"> 782 <div class="text">@serviceSubscription.Replace(" (per maand)", "")</div> 783 @if (serviceSubscriptionPriceRaw > 0) 784 { 785 <div class="price">@Translate("AssemblyServicePriceText", "(monthly {price})").Replace("{price}", serviceSubscriptionPrice)</div> 786 } 787 </div> 788 </div> 789 </div> 790 </div> 791 } 792 </div> 793 </div> 794 </div> 795 } 796 797 if (installationOption != null) 798 { 799 <div class="col s12 installation"> 800 <div class="row"> 801 <div class="col s12"> 802 <h5 class="optiontitle"> 803 @installationTitle 804 @if (!string.IsNullOrWhiteSpace(installationExtraInfo)) 805 { 806 <span class="pictogram info-btn" id="installation-infobtn"> 807 @moreInfoImage 808 </span> 809 } 810 else 811 { 812 @SvgHelper.CreateInfoIcon(installationInfo, Translate("Information", "Information"), assetPath: assetsDirectory) 813 } 814 </h5> 815 </div> 816 <div class="col s12"> 817 @installationIntro 818 </div> 819 <div class="col s12 option-selector-container" id="opt-container3"> 820 @if (installationOption != null) 821 { 822 var installationProductId = installationOption.Id; 823 var installation = installationOption.Name; 824 ProductHelper.ClearProductPriceCache(installationOption); 825 var installationPriceRaw = ProductHelper.GetProductPrice(installationOption).Price; 826 var installationPrice = installationPriceRaw.WarmgarantMoneyFormat(true, true); 827 installationImage = string.Format("{0}installation-black.svg", iconsDirectory); 828 <div class="row"> 829 <div class="col s12 m6"> 830 <div class="option-panel vertical large" data-value="boiler1" data-productid="@installationProductId" data-productType="@ProductType.Installation"> 831 <div class="left-column"> 832 @SvgHelper.GetSvgContent(installationImage, "brown-svg") 833 </div> 834 <div class="right-column"> 835 <div class="text">@installation</div> 836 @if (installationPriceRaw > 0) 837 { 838 <div class="price">@installationPrice</div> 839 } 840 </div> 841 </div> 842 </div> 843 </div> 844 } 845 </div> 846 </div> 847 </div> 848 } 849 850 851 852 <div class="col s12"> 853 854 <h5>@disclaimerTitle</h5> 855 856 @disclaimerText 857 858 <label class="checkbox terms"> 859 <input type="checkbox" name="agree-terms" id="agree-terms" required="required"> 860 @Translate("AssemblyDisclaimerAgreeTermsText", "Ik begrijp het en ga akkoord") 861 </label> 862 863 @if (!string.IsNullOrWhiteSpace(cartUrl)) 864 { 865 <p>&nbsp;</p> 866 if (heatpumpIsForSale) 867 { 868 <p><a class="btn btn-blue disabled-link" id="orderlink" href="@cartUrl">@Translate("Order", "Order")</a></p> 869 } 870 } 871 </div> 872 873 // MODAL THERMOSTATS 874 if (thermostatOptions != null && thermostatOptions.Any()) 875 { 876 <div id="ThermostatsModal" class="modal modal-large slider-modal"> 877 <div class="modal-header"> 878 <h3>@Translate("ThermostatsModalHeader", "Compare thermostats")</h3> 879 <div class="modal-action modal-close"> 880 @modalCloseImage 881 </div> 882 </div> 883 <div class="modal-content"> 884 <div class="slider-control slider-control-left"> 885 <div class="slider-control-wrapper"> 886 <div class="slider-arrow waves-effect"> 887 @SvgHelper.GetSvgContent(string.Format("{0}images/svg/arrow.svg", assetsDirectory), classNames: "general-svg", title: "Slider Control Left") 888 </div> 889 </div> 890 </div> 891 <div class="slider-container"> 892 @foreach (var thermostatOption in thermostatOptions) 893 { 894 var thermostatProductId = thermostatOption.Id; 895 var thermostat = ProductHelper.CreateProductName(thermostatOption.Name, thermostatOption.Manufacturer); 896 ProductHelper.ClearProductPriceCache(thermostatOption); 897 var thermostatPriceRaw = ProductHelper.GetProductPrice(thermostatOption).Price; 898 var thermostatPrice = thermostatPriceRaw.WarmgarantMoneyFormat(false, false, true, true); 899 var thermostatPriceColorClass = thermostatPriceRaw > 0 ? "blue-gradient" : "green-gradient"; 900 var thermostatImage = thermostatOption.ImageSmall; 901 var thermostatMobileDescription = thermostatOption.ShortDescription; 902 var thermostatDescription = thermostatOption.LongDescription; 903 904 <div class="slider-slide" data-productid="@thermostatProductId" data-productType="@ProductType.Thermostat" style="height: 100%"> 905 <div class="slider-content"> 906 <div class="content-header"> 907 @if (!string.IsNullOrWhiteSpace(thermostatImage)) 908 { 909 thermostatImage = string.Format("/Files{0}", thermostatImage); 910 <img src="@thermostatImage" 911 alt="@Translate("Thermostat", "Thermostat").JsEncode(): @thermostat.JsEncode()" /> 912 } 913 </div> 914 <div class="content-description ul-list rich-text-editor-content text-small hide-on-large-only">@thermostatMobileDescription</div> 915 <div class="content-description ul-list rich-text-editor-content text-small hide-on-med-and-down">@thermostatDescription</div> 916 <div class="choose-button"> 917 <a class="btn btn-blue">@Translate("Choose", "Kies")</a> 918 </div> 919 </div> 920 </div> 921 } 922 </div> 923 <div class="slider-control slider-control-right"> 924 <div class="slider-control-wrapper"> 925 <div class="slider-arrow waves-effect"> 926 @SvgHelper.GetSvgContent(string.Format("{0}images/svg/arrow.svg", assetsDirectory), classNames: "general-svg", title: "Slider Control Right") 927 </div> 928 </div> 929 </div> 930 </div> 931 </div> 932 } 933 934 // MODAL SERVICE SUBSCRIPTION 935 if (!string.IsNullOrWhiteSpace(serviceSubscriptionInfo)) 936 { 937 <div id="ServiceSubscriptionModal" class="modal modal-medium icon-modal service-subscription-detail"> 938 <div class="modal-header"> 939 <h3>@Translate("ServiceSubscriptionModalHeader", "Service subscription")</h3> 940 <div class="modal-action modal-close"> 941 @modalCloseImage 942 </div> 943 </div> 944 <div class="modal-content rich-text-editor-content"> 945 @serviceSubscriptionInfo 946 </div> 947 </div> 948 } 949 950 // MODAL INSTALLATION INFO 951 if (!string.IsNullOrWhiteSpace(installationExtraInfo)) 952 { 953 <div id="InstallationInfoModal" class="modal modal-medium icon-modal installation-detail"> 954 <div class="modal-header"> 955 <h3>@Translate("InstallationInfoModalHeader", "Installation info")</h3> 956 <div class="modal-action modal-close"> 957 @modalCloseImage 958 </div> 959 </div> 960 <div class="modal-content rich-text-editor-content"> 961 @installationExtraInfo 962 </div> 963 </div> 964 } 965 966 // MODAL MORE INFO 967 if (!string.IsNullOrWhiteSpace(productLongDescription) && productLongDescription.Length > 10) 968 { 969 <div id="MoreInfoModal" class="modal modal-medium icon-modal more-info"> 970 <div class="modal-header"> 971 <h3>@Translate("MoreInformation", "More info")</h3> 972 <div class="modal-action modal-close"> 973 @modalCloseImage 974 </div> 975 </div> 976 <div class="modal-content rich-text-editor-content"> 977 @productLongDescription 978 </div> 979 </div> 980 } 981 } 982 </div> 983 </div> 984 <div class="col s10 l4 push-s1"> 985 @if (heatpumpSelected) 986 { 987 <div id="receipt"> 988 <div class="preloader-wrapper small active"> 989 <div class="spinner-layer spinner-orange-only"> 990 <div class="circle-clipper left"> 991 <div class="circle"></div> 992 </div> 993 <div class="gap-patch"> 994 <div class="circle"></div> 995 </div> 996 <div class="circle-clipper right"> 997 <div class="circle"></div> 998 </div> 999 </div> 1000 </div> 1001 </div> 1002 } 1003 </div> 1004 </div> 1005 </div> 1006 </div> 1007 @if (quotationParagraphId > 0) 1008 { 1009 <div id="QuotationRequestModal" class="modal modal-large quotation-request-modal"> 1010 <div class="modal-header"> 1011 <h3>@Translate("QuotationRequests_Modal_Header", "Quotation request")</h3> 1012 <div class="modal-action modal-close"> 1013 @SvgHelper.GetSvgContent(string.Format("{0}images/svg/pictograms/x-close.svg", assetsDirectory), classNames: "brown-svg darken-3", title: Translate("Close", "Close").JsEncode()) 1014 </div> 1015 </div> 1016 <div class="modal-content rich-text-editor-content"> 1017 @RenderParagraphContent(quotationParagraphId) 1018 </div> 1019 </div> 1020 } 1021 </div> 1022 1023 @SnippetStart("ActionLinks") 1024 var arrow = "<img class=\"icon\" src=\"/Files/Templates/Designs/Warmtethuis/Images/icons/Arrow-anthracite-small.svg\">"; 1025 1026 <div class="ul-list action-list"> 1027 <ul> 1028 @if (!string.IsNullOrWhiteSpace(productLongDescription) && productLongDescription.Length > 10) 1029 { 1030 <li><a href="#" class="more-infobtn">@arrow @Translate("MoreInformation", "More info")</a></li> 1031 } 1032 @*@if (!string.IsNullOrWhiteSpace(techSpecsPageUrl)) 1033 { 1034 <li class="hide-on-small-and-down"><a href="#" class="techspecs-desktop">@arrow @Translate("TechnicalSpecifications", "Technical specs")</a></li> 1035 <li class="hide-on-med-and-up"><a href="#" class="techspecs-mobile">@arrow @Translate("TechnicalSpecifications", "Technical specs")</a></li> 1036 }*@ 1037 @*tijdelijk uitgezet, tot er een account is aangemaakt <li><a href="https://www.kiyoh.nl/warmtethuis_nl/" target="_blank">@arrow @Translate("CustomerExperiences", "Klantervaringen")</a></li>*@ 1038 @*<li> 1039 <a class="btn btn-yellow hide-on-design-and-up quotation-button" href="@cartUrl" id="quotation-button-small">@Translate("Button_Send_Quotation_Small", "Quotation")</a> 1040 <a class="btn btn-yellow hide-on-design-and-down quotation-button" href="@cartUrl" id="quotation-button-large">@Translate("Button_Send_Quotation", "Send me a quotation")</a> 1041 </li>*@ 1042 </ul> 1043 </div> 1044 @SnippetEnd("ActionLinks") 1045 1046 1047 if (!string.IsNullOrWhiteSpace(seoPage)) 1048 { 1049 <Text> 1050 <script> 1051 SEO.trackPageView("@seoPage", '@GetGlobalValue("Global:CookieOptInLevel").ToLower()' === 'functional'); 1052 SEO.trackAddToCart('@selectedHeatpump.Id', '@selectedHeatpump.Name.JsEncode()', '@productPriceDouble.GoogleMoneyFormat()', '@selectedHeatpump.Manufacturer.Name.JsEncode()', '@(orderType.Equals(OrderType.Rent) ? "Huur" : "Koop")', '@productGroupName.JsEncode()', 1); 1053 </script> 1054 </Text> 1055 } 1056 1057 1058 @SnippetStart("JavaScriptBottom") 1059 <script> // product click 1060 function productSelected(element) { 1061 1062 var clickedProduct = $(element); 1063 var productId = clickedProduct.attr("data-productid"); 1064 1065 var productTypeData = clickedProduct.attr("data-productType"); 1066 var productType = null; 1067 var areaId = @Dynamicweb.Frontend.PageView.Current().AreaID; 1068 switch (productTypeData) { 1069 case "Thermostat": productType = ProductType.Thermostat; 1070 break; 1071 case "ServiceSubscription": productType = ProductType.ServiceSubscription; 1072 break; 1073 default: return; 1074 break; 1075 } 1076 if (productType != null) { 1077 Cart.AddOption(productType, productId, 1, areaId, OptionChangeSucceeded, OptionChangeFailed); 1078 } else { 1079 OptionChangeFailed(); 1080 } 1081 }; 1082 1083 function OptionChangeSucceeded(newProductId) { 1084 // reload receipt 1085 var areaId = @Dynamicweb.Frontend.PageView.Current().AreaID; 1086 Cart.ReloadReceipt('@GetGlobalValue("Global:Area.LongLang")', "", areaId, scrollAbleReceipt); 1087 }; 1088 1089 function OptionChangeFailed() { 1090 alert("selection failed"); 1091 }; 1092 1093 function termsClick(event) { 1094 var checkbox = $(event.target.firstElementChild); // clicked checkbox 1095 var checked = checkbox.is(":checked"); // clicked checkbox is checked 1096 if (checked) { 1097 $("#orderlink").removeClass("disabled-link"); 1098 } else { 1099 $("#orderlink").addClass("disabled-link"); 1100 } 1101 }; 1102 1103 function movePriceFromProductCardToContent() { 1104 var price = $(".heatpump-image .action-square")[0]; 1105 var priceholder = $("#price-holder"); 1106 if (typeof price !== 'undefined' && typeof priceholder !== 'undefined') { 1107 $(".heatpump-image .action-square").prependTo("#price-holder"); 1108 } 1109 } 1110 1111 var initReceiptScroll = function (element) { 1112 var $this = $(element); 1113 var $target = $('#contentrow'); 1114 $this.pushpin({ 1115 top: $target.offset().top + 10, 1116 bottom: $target.offset().top + $target.outerHeight() - $this.height(), 1117 offset: $target.offset().top - 130 1118 }); 1119 }; 1120 1121 var initChatAgentScroll = function (element) { 1122 var $this = $(element); 1123 var $target = $('#contentrow'); 1124 $this.pushpin({ 1125 top: $target.offset().top + 440, 1126 bottom: $target.offset().top + $target.outerHeight() - $this.height(), 1127 offset: $target.offset().top - 130 1128 }); 1129 }; 1130 1131 var scrollAbleReceipt = function () { 1132 $('html.screen-lg-up').find('#receipt').each(function () { 1133 $(this).pushpin('remove'); 1134 initReceiptScroll(this); 1135 resizeToParentWidth(this); 1136 }); 1137 }; 1138 1139 var openQuotationRequestModal = function () { 1140 $('#QuotationRequestModal').innovadisModal().modal('open'); 1141 }; 1142 1143 var initThermostatButtons = function () { 1144 $('#ThermostatsModal .choose-button').off('click').on('click', function () { 1145 $('#opt-container1').trigger("option-click", $(this).closest(".slider-slide").data('productid')); 1146 $('#ThermostatsModal').modal('close'); 1147 }); 1148 }; 1149 1150 var initSliderButtons = function (slick) { 1151 if (slick.slideCount > slick.options.slidesToShow) { 1152 $('.slider-arrow').show() 1153 1154 } else { 1155 $('.slider-arrow').hide() 1156 } 1157 }; 1158 1159 $(function () { 1160 1161 // Initialize checkbox in quotation layover 1162 $("label.checkbox", "#quotation-request-form").innovadisCheckbox({}); 1163 1164 // Initialize term checkbox 1165 $("label.checkbox.terms").innovadisCheckbox({ 1166 onAfterChange: termsClick 1167 }); 1168 1169 // move price 1170 movePriceFromProductCardToContent(); 1171 1172 // Init modal listeners 1173 $('#thermostat-choose-infobtn').off("click").on("click", function () { 1174 1175 $('#ThermostatsModal').innovadisModal({ 1176 slick: { 1177 slidesToShow: 4, 1178 responsive: [ 1179 { 1180 breakpoint: 992, 1181 settings: { 1182 slidesToShow: 2, 1183 dots: true 1184 } 1185 1186 }, { 1187 breakpoint: 600, 1188 settings: { 1189 slidesToShow: 1, 1190 dots: true 1191 } 1192 1193 }] 1194 } 1195 }).modal('open'); 1196 1197 }); 1198 1199 $('#ThermostatsModal').on('init breakpoint', function (event, slick, direction) { 1200 initThermostatButtons(); 1201 initSliderButtons(slick); 1202 }); 1203 1204 $('#service-subscription-infobtn').off("click").on("click", function () { 1205 $('#ServiceSubscriptionModal').innovadisModal().modal('open'); 1206 }); 1207 1208 $('#installation-infobtn').off("click").on("click", function () { 1209 $('#InstallationInfoModal').innovadisModal().modal('open'); 1210 }); 1211 1212 $('.more-infobtn').off("click").on("click", function (e) { 1213 e.preventDefault(); 1214 $('#MoreInfoModal').innovadisModal().modal('open'); 1215 return false; 1216 }); 1217 1218 // show technical specifications for desktop click 1219 $('.techspecs-desktop').off("click").on("click", function (e) { 1220 e.preventDefault(); 1221 $('#TechSpecsModalDesktop').innovadisModal().modal('open'); 1222 return false; 1223 }); 1224 1225 // show technical specifications for mobile click 1226 $('.techspecs-mobile').off("click").on("click", function (e) { 1227 e.preventDefault(); 1228 $('#TechSpecsModalMobile').innovadisModal().modal('open'); 1229 return false; 1230 }); 1231 1232 // Init modal quotation request 1233 $('.quotation-button').off("click").on("click", function (e) { 1234 e.preventDefault(); 1235 openQuotationRequestModal(); 1236 SEO.trackPageView("@seoPageQuotation", '@GetGlobalValue("Global:CookieOptInLevel").ToLower()' === 'functional'); 1237 return false; 1238 }); 1239 1240 // Initialize advice & contact plugin 1241 if ($('#tabs-advice-contact')[0]) { 1242 1243 function handleTabOnbefore(event) { 1244 1245 var $element = $(event.currentTarget); 1246 var $target = $element.data("toggle"); 1247 1248 // reset call me back form before showing 1249 if ($target === "call-me-back-container" && typeof onBeforeCallMeBack !== 'undefined') { 1250 onBeforeCallMeBack(); 1251 } 1252 1253 } 1254 1255 // set advice as default 1256 $('[data-toggle]').innovadisToggleClass({ 1257 target: $('#tabs-advice-contact'), // Target which will receive "className" 1258 className: 'overlay-active', // Class to add as active class 1259 subTarget: true, // Use data-attribute value as target ID, target will receive active class 1260 onBefore: handleTabOnbefore // Call a function before toggling 1261 }); 1262 $('ul.tabs', "#tabs-advice-contact").tabs('select_tab', 'contact-tab'); 1263 $("#advice-tab").parent().addClass("hide"); // hide advice tab 1264 } 1265 1266 // initialize modals 1267 $('.modal').modal(); 1268 1269 // Initialize option panels 1270 $('#opt-container1').innovadisOptionSelector({ inputName: 'select_product', callback: productSelected }); 1271 $('#opt-container2').innovadisOptionSelector({ inputName: 'select_product', callback: productSelected }); 1272 $('#opt-container3').innovadisOptionSelector({ inputName: 'select_installation', callback: productSelected }); 1273 1274 // Initial load receipt 1275 var areaId = @Dynamicweb.Frontend.PageView.Current().AreaID; 1276 Cart.ReloadReceipt('@GetGlobalValue("Global:Area.LongLang")', "", areaId, scrollAbleReceipt); 1277 1278 $(window) 1279 .resize(function () { 1280 resizeToParentWidth('#receipt'); 1281 resizeToParentWidth('#advice-contact'); 1282 }) 1283 .trigger('resize'); 1284 1285 scrollAbleReceipt(); 1286 1287 $('html.screen-lg-up').find('#advice-contact').each(function () { 1288 initChatAgentScroll(this); 1289 }); 1290 1291 $('html').on('classChange', function (event, eventClass) { 1292 if (eventClass === 'screen-md-down') { 1293 $('#receipt').pushpin('remove'); 1294 $('#advice-contact').pushpin('remove'); 1295 } 1296 if (eventClass === 'screen-md-down-removed') { 1297 initReceiptScroll('#receipt'); 1298 initChatAgentScroll('#advice-contact'); 1299 } 1300 }); 1301 }); 1302 </script> 1303 @SnippetEnd("JavaScriptBottom") 1304 } 1305