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