Error executing template "Designs/Rapido/eCom7/CartV2/Step/StepOneCart.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_5b38f815bc574a0d928d1e5b39df0a2d.<RenderCartOrderlineTemplateCustom>b__64_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\TCOG\pronails.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\StepOneCart.cshtml:line 3002
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_5b38f815bc574a0d928d1e5b39df0a2d.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\TCOG\pronails.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\StepOneCart.cshtml:line 189
   at CompiledRazorTemplates.Dynamic.RazorEngine_5b38f815bc574a0d928d1e5b39df0a2d.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\TCOG\pronails.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\StepOneCart.cshtml:line 99
   at CompiledRazorTemplates.Dynamic.RazorEngine_5b38f815bc574a0d928d1e5b39df0a2d.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\TCOG\pronails.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\StepOneCart.cshtml:line 222
   at CompiledRazorTemplates.Dynamic.RazorEngine_5b38f815bc574a0d928d1e5b39df0a2d.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\TCOG\pronails.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\StepOneCart.cshtml:line 99
   at CompiledRazorTemplates.Dynamic.RazorEngine_5b38f815bc574a0d928d1e5b39df0a2d.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\TCOG\pronails.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\StepOneCart.cshtml:line 222
   at CompiledRazorTemplates.Dynamic.RazorEngine_5b38f815bc574a0d928d1e5b39df0a2d.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\TCOG\pronails.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\StepOneCart.cshtml:line 99
   at CompiledRazorTemplates.Dynamic.RazorEngine_5b38f815bc574a0d928d1e5b39df0a2d.Execute() in D:\dynamicweb.net\Solutions\TCOG\pronails.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\StepOneCart.cshtml:line 4016
   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.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Content 5 @using Dynamicweb.Ecommerce.Orders 6 @using Dynamicweb.Core 7 @using System 8 @using System.IO 9 @using Dynamicweb.Rapido.Blocks 10 11 12 @functions{ 13 BlocksPage checkoutPage = BlocksPage.GetBlockPage("CheckoutPage"); 14 string checkoutPageType = "multistep"; 15 } 16 17 @{ 18 string pageId = GetGlobalValue("Global:Page.ID"); 19 int cartOrderlinesFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); 20 int quotesCartPageId = GetPageIdByNavigationTag("QuotesCartPage"); 21 22 Block checkoutTopSnippets = new Block() 23 { 24 Id = "CheckoutTopSnippets", 25 SortId = 10 26 }; 27 checkoutPage.Add(checkoutTopSnippets); 28 29 Block checkoutForm = new Block 30 { 31 Id = "CheckoutForm", 32 SortId = 20, 33 Template = RenderCheckoutForm(), 34 SkipRenderBlocksList = true, 35 BlocksList = new List<Block> 36 { 37 new Block() 38 { 39 Id = "OrderContainer", 40 SortId = 30, 41 Design = new Design 42 { 43 RenderType = RenderType.Column, 44 Size = "12", 45 HidePadding = true 46 }, 47 BlocksList = new List<Block> { 48 new Block() 49 { 50 Id = "OrderContainerRow", 51 SortId = 10, 52 Design = new Design 53 { 54 RenderType = RenderType.Row 55 } 56 } 57 } 58 } 59 } 60 }; 61 62 checkoutPage.Add(checkoutForm); 63 64 Block checkoutBottomSnippets = new Block() 65 { 66 Id = "CheckoutBottomSnippets", 67 SortId = 40 68 }; 69 checkoutPage.Add(checkoutBottomSnippets); 70 } 71 72 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 73 @using System.Text.RegularExpressions 74 @using System.Collections.Generic 75 @using System.Reflection 76 @using System.Web 77 @using System.Web.UI.HtmlControls 78 @using Dynamicweb.Rapido.Blocks.Components 79 @using Dynamicweb.Rapido.Blocks.Components.Articles 80 @using Dynamicweb.Rapido.Blocks.Components.Documentation 81 @using Dynamicweb.Rapido.Blocks 82 83 84 @*--- START: Base block renderers ---*@ 85 86 @helper RenderBlockList(List<Block> blocks) 87 { 88 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 89 blocks = blocks.OrderBy(item => item.SortId).ToList(); 90 91 foreach (Block item in blocks) 92 { 93 if (debug) { 94 <!-- Block START: @item.Id --> 95 } 96 97 if (item.Design == null) 98 { 99 @RenderBlock(item) 100 } 101 else if (item.Design.RenderType == RenderType.None) { 102 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 103 104 <div class="@cssClass dw-mod"> 105 @RenderBlock(item) 106 </div> 107 } 108 else if (item.Design.RenderType != RenderType.Hide) 109 { 110 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 111 112 if (!item.SkipRenderBlocksList) { 113 if (item.Design.RenderType == RenderType.Row) 114 { 115 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> 116 @RenderBlock(item) 117 </div> 118 } 119 120 if (item.Design.RenderType == RenderType.Column) 121 { 122 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 123 string size = item.Design.Size ?? "12"; 124 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 125 126 <div class="grid__col-lg-@item.Design.Size grid__col-md-@item.Design.Size grid__col-sm-12 grid__col-xs-12 @hidePadding @cssClass dw-mod" id="Block__@item.Id"> 127 @RenderBlock(item) 128 </div> 129 } 130 131 if (item.Design.RenderType == RenderType.Table) 132 { 133 <table class="table @cssClass dw-mod" id="Block__@item.Id"> 134 @RenderBlock(item) 135 </table> 136 } 137 138 if (item.Design.RenderType == RenderType.TableRow) 139 { 140 <tr class="@cssClass dw-mod" id="Block__@item.Id"> 141 @RenderBlock(item) 142 </tr> 143 } 144 145 if (item.Design.RenderType == RenderType.TableColumn) 146 { 147 <td class="@cssClass dw-mod" id="Block__@item.Id"> 148 @RenderBlock(item) 149 </td> 150 } 151 152 if (item.Design.RenderType == RenderType.CardHeader) 153 { 154 <div class="card-header @cssClass dw-mod"> 155 @RenderBlock(item) 156 </div> 157 } 158 159 if (item.Design.RenderType == RenderType.CardBody) 160 { 161 <div class="card @cssClass dw-mod"> 162 @RenderBlock(item) 163 </div> 164 } 165 166 if (item.Design.RenderType == RenderType.CardFooter) 167 { 168 <div class="card-footer @cssClass dw-mod"> 169 @RenderBlock(item) 170 </div> 171 } 172 } 173 else 174 { 175 @RenderBlock(item) 176 } 177 } 178 179 if (debug) { 180 <!-- Block END: @item.Id --> 181 } 182 } 183 } 184 185 @helper RenderBlock(Block item) 186 { 187 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 188 189 if (item.Template != null) 190 { 191 @BlocksPage.RenderTemplate(item.Template) 192 } 193 194 if (item.Component != null) 195 { 196 string customSufix = "Custom"; 197 string methodName = item.Component.HelperName; 198 199 ComponentBase[] methodParameters = new ComponentBase[1]; 200 methodParameters[0] = item.Component; 201 Type methodType = this.GetType(); 202 203 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix); 204 MethodInfo generalMethod = methodType.GetMethod(methodName); 205 206 try { 207 if (debug) { 208 <!-- Component: @methodName.Replace("Render", "") --> 209 } 210 @customMethod.Invoke(this, methodParameters).ToString(); 211 } catch { 212 try { 213 @generalMethod.Invoke(this, methodParameters).ToString(); 214 } catch(Exception ex) { 215 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex); 216 } 217 } 218 } 219 220 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 221 { 222 @RenderBlockList(item.BlocksList) 223 } 224 } 225 226 @*--- END: Base block renderers ---*@ 227 228 @using Dynamicweb.Rapido.Blocks.Components 229 @using Dynamicweb.Rapido.Blocks.Components.General 230 @using Dynamicweb.Rapido.Blocks 231 @using System.IO 232 233 @* Required *@ 234 @using Dynamicweb.Rapido.Blocks.Components 235 @using Dynamicweb.Rapido.Blocks.Components.General 236 @using Dynamicweb.Rapido.Blocks 237 238 239 @helper Render(ComponentBase component) 240 { 241 if (component != null) 242 { 243 @component.Render(this) 244 } 245 } 246 247 248 @* Components *@ 249 @using System.Reflection 250 @using Dynamicweb.Rapido.Blocks.Components.General 251 252 253 @* Component *@ 254 255 @helper RenderIcon(Icon settings) 256 { 257 if (settings != null) 258 { 259 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 260 261 if (settings.Name != null) 262 { 263 if (string.IsNullOrEmpty(settings.Label)) 264 { 265 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 266 } 267 else 268 { 269 if (settings.LabelPosition == IconLabelPosition.Before) 270 { 271 <span>@settings.Label <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i></span> 272 } 273 else 274 { 275 <span><i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> @settings.Label</span> 276 } 277 } 278 } 279 else if (!string.IsNullOrEmpty(settings.Label)) 280 { 281 @settings.Label 282 } 283 } 284 } 285 @using System.Reflection 286 @using Dynamicweb.Rapido.Blocks.Components.General 287 @using Dynamicweb.Rapido.Blocks.Components 288 @using Dynamicweb.Core 289 290 @* Component *@ 291 292 @helper RenderButton(Button settings) 293 { 294 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 295 { 296 Dictionary<string, string> attributes = new Dictionary<string, string>(); 297 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 298 if (settings.Disabled) { 299 attributes.Add("disabled", "true"); 300 classList.Add("disabled"); 301 } 302 303 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle)) 304 { 305 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 306 @RenderConfirmDialog(settings); 307 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true"; 308 } 309 310 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 311 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 312 if (!string.IsNullOrEmpty(settings.AltText)) 313 { 314 attributes.Add("title", settings.AltText); 315 } 316 else if (!string.IsNullOrEmpty(settings.Title)) 317 { 318 attributes.Add("title", settings.Title); 319 } 320 321 var onClickEvents = new List<string>(); 322 if (!string.IsNullOrEmpty(settings.OnClick)) 323 { 324 onClickEvents.Add(settings.OnClick); 325 } 326 if (!string.IsNullOrEmpty(settings.Href)) 327 { 328 onClickEvents.Add("location.href='" + settings.Href + "'"); 329 } 330 if (onClickEvents.Count > 0) 331 { 332 attributes.Add("onClick", string.Join(";", onClickEvents)); 333 } 334 335 if (settings.ButtonLayout != ButtonLayout.None) 336 { 337 classList.Add("btn"); 338 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 339 if (btnLayout == "linkclean") 340 { 341 btnLayout = "link-clean"; //fix 342 } 343 classList.Add("btn--" + btnLayout); 344 } 345 346 if (settings.Icon == null) 347 { 348 settings.Icon = new Icon(); 349 } 350 settings.Icon.Label = settings.Title; 351 352 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower()); 353 354 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button> 355 } 356 } 357 358 @helper RenderConfirmDialog(Button settings) 359 { 360 Modal confirmDialog = new Modal { 361 Id = settings.Id, 362 Width = ModalWidth.Sm, 363 Heading = new Heading 364 { 365 Level = 2, 366 Title = settings.ConfirmTitle 367 }, 368 BodyText = settings.ConfirmText 369 }; 370 371 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"}); 372 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick }); 373 374 @Render(confirmDialog) 375 } 376 @using Dynamicweb.Rapido.Blocks.Components.General 377 @using Dynamicweb.Rapido.Blocks.Components 378 @using Dynamicweb.Core 379 380 @helper RenderDashboard(Dashboard settings) 381 { 382 var widgets = settings.GetWidgets(); 383 384 if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor)) 385 { 386 //set bg color for them 387 388 System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor); 389 int r = Convert.ToInt16(color.R); 390 int g = Convert.ToInt16(color.G); 391 int b = Convert.ToInt16(color.B); 392 393 var count = widgets.Length; 394 var max = Math.Max(r, Math.Max(g, b)); 395 double step = 255.0 / (max * count); 396 var i = 0; 397 foreach (var widget in widgets) 398 { 399 i++; 400 401 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")"; 402 widget.BackgroundColor = shade; 403 } 404 } 405 406 <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 407 @foreach (var widget in widgets) 408 { 409 <div class="dashboard__widget"> 410 @Render(widget) 411 </div> 412 } 413 </div> 414 } 415 @using Dynamicweb.Rapido.Blocks.Components.General 416 @using Dynamicweb.Rapido.Blocks.Components 417 418 @helper RenderDashboardWidgetLink(DashboardWidgetLink settings) 419 { 420 if (!string.IsNullOrEmpty(settings.Link)) 421 { 422 var backgroundStyles = ""; 423 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 424 { 425 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\""; 426 } 427 428 <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 429 <div class="u-center-middle u-color-light"> 430 @if (settings.Icon != null) 431 { 432 settings.Icon.CssClass += "widget__icon"; 433 @Render(settings.Icon) 434 } 435 <div class="widget__title">@settings.Title</div> 436 </div> 437 </a> 438 } 439 } 440 @using Dynamicweb.Rapido.Blocks.Components.General 441 @using Dynamicweb.Rapido.Blocks.Components 442 443 @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings) 444 { 445 var backgroundStyles = ""; 446 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 447 { 448 backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'"; 449 } 450 451 <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 452 <div class="u-center-middle u-color-light"> 453 @if (settings.Icon != null) 454 { 455 settings.Icon.CssClass += "widget__icon"; 456 @Render(settings.Icon) 457 } 458 <div class="widget__counter">@settings.Count</div> 459 <div class="widget__title">@settings.Title</div> 460 </div> 461 </div> 462 } 463 @using System.Reflection 464 @using Dynamicweb.Rapido.Blocks.Components.General 465 @using Dynamicweb.Rapido.Blocks.Components 466 @using Dynamicweb.Core 467 468 @* Component *@ 469 470 @helper RenderLink(Link settings) 471 { 472 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 473 { 474 Dictionary<string, string> attributes = new Dictionary<string, string>(); 475 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 476 if (settings.Disabled) 477 { 478 attributes.Add("disabled", "true"); 479 classList.Add("disabled"); 480 } 481 482 if (!string.IsNullOrEmpty(settings.AltText)) 483 { 484 attributes.Add("title", settings.AltText); 485 } 486 else if (!string.IsNullOrEmpty(settings.Title)) 487 { 488 attributes.Add("title", settings.Title); 489 } 490 491 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 492 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 493 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); } 494 attributes.Add("href", settings.Href); 495 496 if (settings.ButtonLayout != ButtonLayout.None) 497 { 498 classList.Add("btn"); 499 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 500 if (btnLayout == "linkclean") 501 { 502 btnLayout = "link-clean"; //fix 503 } 504 classList.Add("btn--" + btnLayout); 505 } 506 507 if (settings.Icon == null) 508 { 509 settings.Icon = new Icon(); 510 } 511 settings.Icon.Label = settings.Title; 512 513 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None) 514 { 515 settings.Rel = LinkRelType.Noopener; 516 } 517 if (settings.Target != LinkTargetType.None) 518 { 519 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower()); 520 } 521 if (settings.Download) 522 { 523 attributes.Add("download", "true"); 524 } 525 if (settings.Rel != LinkRelType.None) 526 { 527 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower()); 528 } 529 530 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a> 531 } 532 } 533 @using System.Reflection 534 @using Dynamicweb.Rapido.Blocks.Components 535 @using Dynamicweb.Rapido.Blocks.Components.General 536 @using Dynamicweb.Rapido.Blocks 537 538 539 @* Component *@ 540 541 @helper RenderRating(Rating settings) 542 { 543 if (settings.Score > 0) 544 { 545 int rating = settings.Score; 546 string iconType = "fa-star"; 547 548 switch (settings.Type.ToString()) { 549 case "Stars": 550 iconType = "fa-star"; 551 break; 552 case "Hearts": 553 iconType = "fa-heart"; 554 break; 555 case "Lemons": 556 iconType = "fa-lemon"; 557 break; 558 case "Bombs": 559 iconType = "fa-bomb"; 560 break; 561 } 562 563 <div class="u-ta-right"> 564 @for (int i = 0; i < settings.OutOf; i++) 565 { 566 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 567 } 568 </div> 569 } 570 } 571 @using System.Reflection 572 @using Dynamicweb.Rapido.Blocks.Components.General 573 @using Dynamicweb.Rapido.Blocks.Components 574 575 576 @* Component *@ 577 578 @helper RenderSelectFieldOption(SelectFieldOption settings) 579 { 580 Dictionary<string, string> attributes = new Dictionary<string, string>(); 581 if (settings.Checked) { attributes.Add("selected", "true"); } 582 if (settings.Disabled) { attributes.Add("disabled", "true"); } 583 if (settings.Value != null) { attributes.Add("value", settings.Value); } 584 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 585 586 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option> 587 } 588 @using System.Reflection 589 @using Dynamicweb.Rapido.Blocks.Components.General 590 @using Dynamicweb.Rapido.Blocks.Components 591 592 593 @* Component *@ 594 595 @helper RenderNavigation(Navigation settings) { 596 @RenderNavigation(new 597 { 598 id = settings.Id, 599 cssclass = settings.CssClass, 600 startLevel = settings.StartLevel, 601 endlevel = settings.EndLevel, 602 expandmode = settings.Expandmode, 603 sitemapmode = settings.SitemapMode, 604 template = settings.Template 605 }) 606 } 607 @using Dynamicweb.Rapido.Blocks.Components.General 608 @using Dynamicweb.Rapido.Blocks.Components 609 610 611 @* Component *@ 612 613 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 614 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 615 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 616 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 617 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 618 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 619 settings.SitemapMode = false; 620 621 @RenderNavigation(settings) 622 } 623 @using Dynamicweb.Rapido.Blocks.Components.General 624 @using Dynamicweb.Rapido.Blocks.Components 625 626 627 @* Component *@ 628 629 @helper RenderLeftNavigation(LeftNavigation settings) { 630 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 631 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 632 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 633 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 634 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 635 636 <div class="grid__cell"> 637 @RenderNavigation(settings) 638 </div> 639 } 640 @using System.Reflection 641 @using Dynamicweb.Rapido.Blocks.Components.General 642 @using Dynamicweb.Core 643 644 @* Component *@ 645 646 @helper RenderHeading(Heading settings) 647 { 648 if (settings != null && !string.IsNullOrEmpty(settings.Title)) 649 { 650 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 651 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div"; 652 653 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">") 654 if (!string.IsNullOrEmpty(settings.Link)) 655 { 656 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None }) 657 } 658 else 659 { 660 if (settings.Icon == null) 661 { 662 settings.Icon = new Icon(); 663 } 664 settings.Icon.Label = settings.Title; 665 @Render(settings.Icon) 666 } 667 @("</" + tagName + ">"); 668 } 669 } 670 @using Dynamicweb.Rapido.Blocks.Components 671 @using Dynamicweb.Rapido.Blocks.Components.General 672 @using Dynamicweb.Rapido.Blocks 673 674 675 @* Component *@ 676 677 @helper RenderImage(Image settings) 678 { 679 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None) 680 { 681 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 682 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); } 683 684 if (settings.Caption != null) 685 { 686 @:<div> 687 } 688 689 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower(); 690 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower(); 691 692 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)> 693 <div class="image-filter image-filter--@secondaryFilterClass dw-mod"> 694 @if (settings.Link != null) 695 { 696 <a href="@settings.Link"> 697 @RenderTheImage(settings) 698 </a> 699 } 700 else 701 { 702 @RenderTheImage(settings) 703 } 704 </div> 705 </div> 706 707 if (settings.Caption != null) 708 { 709 <span class="image-caption dw-mod">@settings.Caption</span> 710 @:</div> 711 } 712 } 713 else 714 { 715 if (settings.Caption != null) 716 { 717 @:<div> 718 } 719 if (!string.IsNullOrEmpty(settings.Link)) 720 { 721 <a href="@settings.Link"> 722 @RenderTheImage(settings) 723 </a> 724 } 725 else 726 { 727 @RenderTheImage(settings) 728 } 729 730 if (settings.Caption != null) 731 { 732 <span class="image-caption dw-mod">@settings.Caption</span> 733 @:</div> 734 } 735 } 736 } 737 738 @helper RenderTheImage(Image settings) 739 { 740 if (settings != null) 741 { 742 string placeholderImage = "/Files/Images/placeholder.gif"; 743 string imageEngine = "/Admin/Public/GetImage.ashx?"; 744 745 string imageStyle = ""; 746 747 switch (settings.Style) 748 { 749 case ImageStyle.Ball: 750 imageStyle = "grid__cell-img--ball"; 751 break; 752 } 753 754 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle) 755 { 756 if (settings.ImageDefault != null) 757 { 758 settings.ImageDefault.Height = settings.ImageDefault.Width; 759 } 760 if (settings.ImageMedium != null) 761 { 762 settings.ImageMedium.Height = settings.ImageMedium.Width; 763 } 764 if (settings.ImageSmall != null) 765 { 766 settings.ImageSmall.Height = settings.ImageSmall.Width; 767 } 768 } 769 770 string defaultImage = imageEngine; 771 string imageSmall = ""; 772 string imageMedium = ""; 773 774 if (settings.DisableImageEngine) 775 { 776 defaultImage = settings.Path; 777 } 778 else 779 { 780 if (settings.ImageDefault != null) 781 { 782 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault); 783 784 if (settings.Path.GetType() != typeof(string)) 785 { 786 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 787 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 788 } 789 else 790 { 791 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 792 } 793 } 794 795 if (settings.ImageSmall != null) 796 { 797 imageSmall = "data-src-small=\"" + imageEngine; 798 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall); 799 800 if (settings.Path.GetType() != typeof(string)) 801 { 802 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 803 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 804 } 805 else 806 { 807 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 808 } 809 810 imageSmall += "\""; 811 } 812 813 if (settings.ImageMedium != null) 814 { 815 imageMedium = "data-src-medium=\"" + imageEngine; 816 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium); 817 818 if (settings.Path.GetType() != typeof(string)) 819 { 820 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 821 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 822 } 823 else 824 { 825 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 826 } 827 828 imageMedium += "\""; 829 } 830 } 831 832 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 833 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 834 if (!string.IsNullOrEmpty(settings.Title)) 835 { 836 optionalAttributes.Add("alt", settings.Title); 837 optionalAttributes.Add("title", settings.Title); 838 } 839 840 if (settings.DisableLazyLoad) 841 { 842 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 843 } 844 else 845 { 846 <img id="@settings.Id" class="b-lazy @imageStyle @settings.CssClass dw-mod" src="@placeholderImage" data-src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 847 } 848 } 849 } 850 @using System.Reflection 851 @using Dynamicweb.Rapido.Blocks.Components.General 852 @using Dynamicweb.Rapido.Blocks.Components 853 854 @* Component *@ 855 856 @helper RenderFileField(FileField settings) 857 { 858 var attributes = new Dictionary<string, string>(); 859 if (string.IsNullOrEmpty(settings.Id)) 860 { 861 settings.Id = Guid.NewGuid().ToString("N"); 862 } 863 864 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 865 if (settings.Disabled) { attributes.Add("disabled", "true"); } 866 if (settings.Required) { attributes.Add("required", "true"); } 867 if (settings.Multiple) { attributes.Add("multiple", "true"); } 868 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 869 if (string.IsNullOrEmpty(settings.ChooseFileText)) 870 { 871 settings.ChooseFileText = Translate("Choose file"); 872 } 873 if (string.IsNullOrEmpty(settings.NoFilesChosenText)) 874 { 875 settings.NoFilesChosenText = Translate("No files chosen..."); 876 } 877 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 878 879 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)"; 880 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : "")); 881 882 attributes.Add("type", "file"); 883 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 884 settings.CssClass = "u-full-width " + settings.CssClass; 885 886 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 887 888 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 889 @if (!string.IsNullOrEmpty(settings.Label)) 890 { 891 <label for="@settings.Id">@settings.Label</label> 892 } 893 @if (!string.IsNullOrEmpty(settings.HelpText)) 894 { 895 <small class="form__help-text">@settings.HelpText</small> 896 } 897 898 <div class="form__field-combi file-input u-no-margin dw-mod"> 899 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" /> 900 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label> 901 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label> 902 @if (settings.UploadButton != null) 903 { 904 settings.UploadButton.CssClass += " btn--condensed u-no-margin"; 905 @Render(settings.UploadButton) 906 } 907 </div> 908 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 909 </div> 910 } 911 @using System.Reflection 912 @using Dynamicweb.Rapido.Blocks.Components.General 913 @using Dynamicweb.Rapido.Blocks.Components 914 @using Dynamicweb.Core 915 @using System.Linq 916 917 @* Component *@ 918 919 @helper RenderDateTimeField(DateTimeField settings) 920 { 921 if (string.IsNullOrEmpty(settings.Id)) 922 { 923 settings.Id = Guid.NewGuid().ToString("N"); 924 } 925 926 var textField = new TextField { 927 Name = settings.Name, 928 Id = settings.Id, 929 Label = settings.Label, 930 HelpText = settings.HelpText, 931 Value = settings.Value, 932 Disabled = settings.Disabled, 933 Required = settings.Required, 934 ErrorMessage = settings.ErrorMessage, 935 CssClass = settings.CssClass, 936 WrapperCssClass = settings.WrapperCssClass, 937 OnChange = settings.OnChange, 938 OnClick = settings.OnClick, 939 ExtraAttributes = settings.ExtraAttributes, 940 // 941 Placeholder = settings.Placeholder 942 }; 943 944 @Render(textField) 945 946 List<string> jsAttributes = new List<string>(); 947 948 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); 949 950 if (!string.IsNullOrEmpty(settings.DateFormat)) 951 { 952 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); 953 } 954 if (!string.IsNullOrEmpty(settings.MinDate)) 955 { 956 jsAttributes.Add("minDate: '" + settings.MinDate + "'"); 957 } 958 if (!string.IsNullOrEmpty(settings.MaxDate)) 959 { 960 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); 961 } 962 if (settings.IsInline) 963 { 964 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); 965 } 966 if (settings.EnableTime) 967 { 968 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); 969 } 970 if (settings.EnableWeekNumbers) 971 { 972 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); 973 } 974 975 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); 976 977 <script> 978 document.addEventListener("DOMContentLoaded", function () { 979 flatpickr("#@textField.Id", { 980 @string.Join(",", jsAttributes) 981 }); 982 }); 983 </script> 984 } 985 @using System.Reflection 986 @using Dynamicweb.Rapido.Blocks.Components.General 987 @using Dynamicweb.Rapido.Blocks.Components 988 989 @* Component *@ 990 991 @helper RenderTextField(TextField settings) 992 { 993 var attributes = new Dictionary<string, string>(); 994 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 995 { 996 settings.Id = Guid.NewGuid().ToString("N"); 997 } 998 999 /*base settings*/ 1000 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1001 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1002 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1003 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1004 if (settings.Required) { attributes.Add("required", "true"); } 1005 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1006 /*end*/ 1007 1008 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1009 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1010 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1011 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1012 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1013 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1014 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower()); 1015 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); }; 1016 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 1017 settings.CssClass = "u-full-width " + settings.CssClass; 1018 1019 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1020 1021 string noMargin = "u-no-margin"; 1022 if (!settings.ReadOnly) { 1023 noMargin = ""; 1024 } 1025 1026 <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod"> 1027 @if (!string.IsNullOrEmpty(settings.Label)) 1028 { 1029 <label for="@settings.Id" id="label_@settings.Id">@settings.Label</label> 1030 } 1031 @if (!string.IsNullOrEmpty(settings.HelpText)) 1032 { 1033 <small class="form__help-text">@settings.HelpText</small> 1034 } 1035 1036 @if (settings.ActionButton != null) 1037 { 1038 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1039 <div class="form__field-combi u-no-margin dw-mod"> 1040 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1041 @Render(settings.ActionButton) 1042 </div> 1043 } 1044 else 1045 { 1046 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1047 } 1048 1049 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1050 </div> 1051 } 1052 @using System.Reflection 1053 @using Dynamicweb.Rapido.Blocks.Components.General 1054 @using Dynamicweb.Rapido.Blocks.Components 1055 1056 @* Component *@ 1057 1058 @helper RenderNumberField(NumberField settings) 1059 { 1060 var attributes = new Dictionary<string, string>(); 1061 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1062 { 1063 settings.Id = Guid.NewGuid().ToString("N"); 1064 } 1065 1066 /*base settings*/ 1067 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1068 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1069 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1070 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1071 if (settings.Required) { attributes.Add("required", "true"); } 1072 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1073 /*end*/ 1074 1075 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1076 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1077 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1078 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1079 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 1080 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); } 1081 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); } 1082 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); } 1083 attributes.Add("type", "number"); 1084 1085 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1086 1087 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1088 @if (!string.IsNullOrEmpty(settings.Label)) 1089 { 1090 <label for="@settings.Id">@settings.Label</label> 1091 } 1092 @if (!string.IsNullOrEmpty(settings.HelpText)) 1093 { 1094 <small class="form__help-text">@settings.HelpText</small> 1095 } 1096 1097 @if (settings.ActionButton != null) 1098 { 1099 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1100 <div class="form__field-combi u-no-margin dw-mod"> 1101 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1102 @Render(settings.ActionButton) 1103 </div> 1104 } 1105 else 1106 { 1107 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1108 } 1109 1110 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1111 </div> 1112 } 1113 @using System.Reflection 1114 @using Dynamicweb.Rapido.Blocks.Components.General 1115 @using Dynamicweb.Rapido.Blocks.Components 1116 1117 1118 @* Component *@ 1119 1120 @helper RenderTextareaField(TextareaField settings) 1121 { 1122 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1123 string id = settings.Id; 1124 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id)) 1125 { 1126 id = Guid.NewGuid().ToString("N"); 1127 } 1128 1129 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); } 1130 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1131 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1132 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1133 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1134 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1135 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1136 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1137 if (settings.Required) { attributes.Add("required", "true"); } 1138 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1139 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1140 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); } 1141 attributes.Add("name", settings.Name); 1142 1143 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1144 @if (!string.IsNullOrEmpty(settings.Label)) 1145 { 1146 <label for="@id">@settings.Label</label> 1147 } 1148 @if (!string.IsNullOrEmpty(settings.HelpText)) 1149 { 1150 <small class="form__help-text">@settings.HelpText</small> 1151 } 1152 1153 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea> 1154 1155 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1156 </div> 1157 } 1158 @using System.Reflection 1159 @using Dynamicweb.Rapido.Blocks.Components.General 1160 @using Dynamicweb.Rapido.Blocks.Components 1161 1162 1163 @* Component *@ 1164 1165 @helper RenderHiddenField(HiddenField settings) { 1166 var attributes = new Dictionary<string, string>(); 1167 attributes.Add("type", "hidden"); 1168 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1169 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 1170 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1171 1172 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 1173 } 1174 @using System.Reflection 1175 @using Dynamicweb.Rapido.Blocks.Components.General 1176 @using Dynamicweb.Rapido.Blocks.Components 1177 1178 @* Component *@ 1179 1180 @helper RenderCheckboxField(CheckboxField settings) 1181 { 1182 var attributes = new Dictionary<string, string>(); 1183 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1184 { 1185 settings.Id = Guid.NewGuid().ToString("N"); 1186 } 1187 1188 /*base settings*/ 1189 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1190 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1191 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1192 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1193 if (settings.Required) { attributes.Add("required", "true"); } 1194 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1195 /*end*/ 1196 1197 attributes.Add("type", "checkbox"); 1198 if (settings.Checked) { attributes.Add("checked", "true"); } 1199 settings.CssClass = "form__control " + settings.CssClass; 1200 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 1201 1202 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1203 1204 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1205 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1206 @if (!string.IsNullOrEmpty(settings.Label)) 1207 { 1208 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1209 } 1210 @if (!string.IsNullOrEmpty(settings.HelpText)) 1211 { 1212 <small class="form__help-text">@settings.HelpText</small> 1213 } 1214 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1215 </div> 1216 } 1217 @using System.Reflection 1218 @using Dynamicweb.Rapido.Blocks.Components.General 1219 @using Dynamicweb.Rapido.Blocks.Components 1220 1221 1222 @* Component *@ 1223 1224 @helper RenderCheckboxListField(CheckboxListField settings) 1225 { 1226 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1227 @if (!string.IsNullOrEmpty(settings.Label)) 1228 { 1229 <label>@settings.Label</label> 1230 } 1231 @if (!string.IsNullOrEmpty(settings.HelpText)) 1232 { 1233 <small class="form__help-text">@settings.HelpText</small> 1234 } 1235 1236 @foreach (var item in settings.Options) 1237 { 1238 if (settings.Required) 1239 { 1240 item.Required = true; 1241 } 1242 if (settings.Disabled) 1243 { 1244 item.Disabled = true; 1245 } 1246 if (!string.IsNullOrEmpty(settings.Name)) 1247 { 1248 item.Name = settings.Name; 1249 } 1250 if (!string.IsNullOrEmpty(settings.CssClass)) 1251 { 1252 item.CssClass += settings.CssClass; 1253 } 1254 1255 /* value is not supported */ 1256 1257 if (!string.IsNullOrEmpty(settings.OnClick)) 1258 { 1259 item.OnClick += settings.OnClick; 1260 } 1261 if (!string.IsNullOrEmpty(settings.OnChange)) 1262 { 1263 item.OnChange += settings.OnChange; 1264 } 1265 @Render(item) 1266 } 1267 1268 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1269 </div> 1270 } 1271 @using System.Reflection 1272 @using Dynamicweb.Rapido.Blocks.Components.General 1273 @using Dynamicweb.Rapido.Blocks.Components 1274 1275 1276 @* Component *@ 1277 1278 @helper RenderSelectField(SelectField settings) 1279 { 1280 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1281 { 1282 settings.Id = Guid.NewGuid().ToString("N"); 1283 } 1284 1285 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1286 @if (!string.IsNullOrEmpty(settings.Label)) 1287 { 1288 <label for="@settings.Id">@settings.Label</label> 1289 } 1290 @if (!string.IsNullOrEmpty(settings.HelpText)) 1291 { 1292 <small class="form__help-text">@settings.HelpText</small> 1293 } 1294 1295 @if (settings.ActionButton != null) 1296 { 1297 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1298 <div class="form__field-combi u-no-margin dw-mod"> 1299 @RenderSelectBase(settings) 1300 @Render(settings.ActionButton) 1301 </div> 1302 } 1303 else 1304 { 1305 @RenderSelectBase(settings) 1306 } 1307 1308 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1309 </div> 1310 } 1311 1312 @helper RenderSelectBase(SelectField settings) 1313 { 1314 var attributes = new Dictionary<string, string>(); 1315 1316 /*base settings*/ 1317 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1318 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1319 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1320 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1321 if (settings.Required) { attributes.Add("required", "true"); } 1322 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1323 /*end*/ 1324 1325 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1326 1327 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod"> 1328 @if (settings.Default != null) 1329 { 1330 @Render(settings.Default) 1331 } 1332 1333 @foreach (var item in settings.Options) 1334 { 1335 if (!string.IsNullOrEmpty(settings.Value)) { 1336 item.Checked = item.Value == settings.Value; 1337 } 1338 @Render(item) 1339 } 1340 </select> 1341 } 1342 @using System.Reflection 1343 @using Dynamicweb.Rapido.Blocks.Components.General 1344 @using Dynamicweb.Rapido.Blocks.Components 1345 1346 @* Component *@ 1347 1348 @helper RenderRadioButtonField(RadioButtonField settings) 1349 { 1350 var attributes = new Dictionary<string, string>(); 1351 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1352 { 1353 settings.Id = Guid.NewGuid().ToString("N"); 1354 } 1355 1356 /*base settings*/ 1357 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1358 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1359 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1360 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1361 if (settings.Required) { attributes.Add("required", "true"); } 1362 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1363 /*end*/ 1364 1365 attributes.Add("type", "radio"); 1366 if (settings.Checked) { attributes.Add("checked", "true"); } 1367 settings.CssClass = "form__control " + settings.CssClass; 1368 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 1369 1370 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1371 1372 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1373 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1374 @if (!string.IsNullOrEmpty(settings.Label)) 1375 { 1376 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1377 } 1378 @if (!string.IsNullOrEmpty(settings.HelpText)) 1379 { 1380 <small class="form__help-text">@settings.HelpText</small> 1381 } 1382 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1383 </div> 1384 } 1385 @using System.Reflection 1386 @using Dynamicweb.Rapido.Blocks.Components.General 1387 @using Dynamicweb.Rapido.Blocks.Components 1388 1389 1390 @* Component *@ 1391 1392 @helper RenderRadioButtonListField(RadioButtonListField settings) 1393 { 1394 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1395 @if (!string.IsNullOrEmpty(settings.Label)) 1396 { 1397 <label>@settings.Label</label> 1398 } 1399 @if (!string.IsNullOrEmpty(settings.HelpText)) 1400 { 1401 <small class="form__help-text">@settings.HelpText</small> 1402 } 1403 1404 @foreach (var item in settings.Options) 1405 { 1406 if (settings.Required) 1407 { 1408 item.Required = true; 1409 } 1410 if (settings.Disabled) 1411 { 1412 item.Disabled = true; 1413 } 1414 if (!string.IsNullOrEmpty(settings.Name)) 1415 { 1416 item.Name = settings.Name; 1417 } 1418 if (!string.IsNullOrEmpty(settings.Value) && settings.Value == item.Value) 1419 { 1420 item.Checked = true; 1421 } 1422 if (!string.IsNullOrEmpty(settings.OnClick)) 1423 { 1424 item.OnClick += settings.OnClick; 1425 } 1426 if (!string.IsNullOrEmpty(settings.OnChange)) 1427 { 1428 item.OnChange += settings.OnChange; 1429 } 1430 if (!string.IsNullOrEmpty(settings.CssClass)) 1431 { 1432 item.CssClass += settings.CssClass; 1433 } 1434 @Render(item) 1435 } 1436 1437 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1438 </div> 1439 } 1440 @using System.Reflection 1441 @using Dynamicweb.Rapido.Blocks.Components.General 1442 @using Dynamicweb.Rapido.Blocks.Components 1443 1444 1445 @* Component *@ 1446 1447 @helper RenderNotificationMessage(NotificationMessage settings) 1448 { 1449 if (!string.IsNullOrEmpty(settings.Message)) 1450 { 1451 var attributes = new Dictionary<string, string>(); 1452 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1453 1454 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower(); 1455 <div class="field-@messageTypeClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)>@settings.Message</div> 1456 } 1457 } 1458 @using Dynamicweb.Rapido.Blocks.Components.General 1459 1460 1461 @* Component *@ 1462 1463 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1464 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 1465 1466 <div class="@settings.CssClass dw-mod js-handlebars-root" id="@settings.Id" data-template="@settings.ScriptTemplate" data-json-feed="@settings.FeedUrl" data-init-onload="@settings.InitOnLoad.ToString()" data-preloader="@settings.Preloader" @preRender> 1467 @if (settings.SubBlocks != null) { 1468 @RenderBlockList(settings.SubBlocks) 1469 } 1470 </div> 1471 } 1472 @using System.Reflection 1473 @using Dynamicweb.Rapido.Blocks.Components.General 1474 @using Dynamicweb.Rapido.Blocks.Components 1475 @using System.Text.RegularExpressions 1476 1477 1478 @* Component *@ 1479 1480 @helper RenderSticker(Sticker settings) { 1481 if (!String.IsNullOrEmpty(settings.Title)) { 1482 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1483 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 1484 1485 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1486 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1487 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1488 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1489 optionalAttributes.Add("style", styleTag); 1490 } 1491 1492 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1493 } 1494 } 1495 1496 @using System.Reflection 1497 @using Dynamicweb.Rapido.Blocks.Components.General 1498 @using Dynamicweb.Rapido.Blocks.Components 1499 1500 1501 @* Component *@ 1502 1503 @helper RenderStickersCollection(StickersCollection settings) 1504 { 1505 if (settings.Stickers.Count > 0) 1506 { 1507 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower(); 1508 1509 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1510 @foreach (Sticker sticker in settings.Stickers) 1511 { 1512 @Render(sticker) 1513 } 1514 </div> 1515 } 1516 } 1517 1518 @using Dynamicweb.Rapido.Blocks.Components.General 1519 1520 1521 @* Component *@ 1522 1523 @helper RenderForm(Form settings) { 1524 if (settings != null) 1525 { 1526 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 1527 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); }; 1528 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); }; 1529 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); }; 1530 var enctypes = new Dictionary<string, string> 1531 { 1532 { "multipart", "multipart/form-data" }, 1533 { "text", "text/plain" }, 1534 { "application", "application/x-www-form-urlencoded" } 1535 }; 1536 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); }; 1537 optionalAttributes.Add("method", settings.Method.ToString()); 1538 1539 if (!string.IsNullOrEmpty(settings.FormStartMarkup)) 1540 { 1541 @settings.FormStartMarkup 1542 } 1543 else 1544 { 1545 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1546 } 1547 1548 foreach (var field in settings.GetFields()) 1549 { 1550 @Render(field) 1551 } 1552 1553 @:</form> 1554 } 1555 } 1556 @using System.Reflection 1557 @using Dynamicweb.Rapido.Blocks.Components.General 1558 @using Dynamicweb.Rapido.Blocks.Components 1559 1560 1561 @* Component *@ 1562 1563 @helper RenderText(Text settings) 1564 { 1565 @settings.Content 1566 } 1567 @using System.Reflection 1568 @using Dynamicweb.Rapido.Blocks.Components.General 1569 @using Dynamicweb.Rapido.Blocks.Components 1570 1571 1572 @* Component *@ 1573 1574 @helper RenderContentModule(ContentModule settings) { 1575 if (!string.IsNullOrEmpty(settings.Content)) 1576 { 1577 @settings.Content 1578 } 1579 } 1580 @using System.Reflection 1581 @using Dynamicweb.Rapido.Blocks.Components.General 1582 @using Dynamicweb.Rapido.Blocks.Components 1583 1584 1585 @* Component *@ 1586 1587 @helper RenderModal(Modal settings) { 1588 if (settings != null) 1589 { 1590 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 1591 1592 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : ""; 1593 1594 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange /> 1595 1596 <div class="modal-container"> 1597 @if (!settings.DisableDarkOverlay) 1598 { 1599 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label> 1600 } 1601 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal"> 1602 @if (settings.Heading != null) 1603 { 1604 if (!string.IsNullOrEmpty(settings.Heading.Title)) 1605 { 1606 <div class="modal__header"> 1607 @Render(settings.Heading) 1608 </div> 1609 } 1610 } 1611 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")"> 1612 @if (!string.IsNullOrEmpty(settings.BodyText)) 1613 { 1614 @settings.BodyText 1615 } 1616 @if (settings.BodyTemplate != null) 1617 { 1618 @settings.BodyTemplate 1619 } 1620 @{ 1621 var actions = settings.GetActions(); 1622 } 1623 </div> 1624 @if (actions.Length > 0) 1625 { 1626 <div class="modal__footer"> 1627 @foreach (var action in actions) 1628 { 1629 action.CssClass += " u-no-margin"; 1630 @Render(action) 1631 } 1632 </div> 1633 } 1634 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label> 1635 </div> 1636 </div> 1637 } 1638 } 1639 @using Dynamicweb.Rapido.Blocks.Components.General 1640 1641 @* Component *@ 1642 1643 @helper RenderMediaListItem(MediaListItem settings) 1644 { 1645 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")> 1646 @if (!string.IsNullOrEmpty(settings.Label)) 1647 { 1648 if (!string.IsNullOrEmpty(settings.Link)) 1649 { 1650 @Render(new Link 1651 { 1652 Href = settings.Link, 1653 CssClass = "media-list-item__sticker dw-mod", 1654 ButtonLayout = ButtonLayout.None, 1655 Title = settings.Label, 1656 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1657 }) 1658 } 1659 else if (!string.IsNullOrEmpty(settings.OnClick)) 1660 { 1661 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)"> 1662 <span class="u-uppercase">@settings.Label</span> 1663 </span> 1664 } 1665 else 1666 { 1667 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod"> 1668 <span class="u-uppercase">@settings.Label</span> 1669 </span> 1670 } 1671 } 1672 <div class="media-list-item__wrap"> 1673 <div class="media-list-item__info dw-mod"> 1674 <div class="media-list-item__header dw-mod"> 1675 @if (!string.IsNullOrEmpty(settings.Title)) 1676 { 1677 if (!string.IsNullOrEmpty(settings.Link)) 1678 { 1679 @Render(new Link 1680 { 1681 Href = settings.Link, 1682 CssClass = "media-list-item__name dw-mod", 1683 ButtonLayout = ButtonLayout.None, 1684 Title = settings.Title, 1685 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1686 }) 1687 } 1688 else if (!string.IsNullOrEmpty(settings.OnClick)) 1689 { 1690 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span> 1691 } 1692 else 1693 { 1694 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span> 1695 } 1696 } 1697 1698 @if (!string.IsNullOrEmpty(settings.Status)) 1699 { 1700 <div class="media-list-item__state dw-mod">@settings.Status</div> 1701 } 1702 </div> 1703 @{ 1704 settings.InfoTable.CssClass += " media-list-item__parameters-table"; 1705 } 1706 1707 @Render(settings.InfoTable) 1708 </div> 1709 <div class="media-list-item__actions dw-mod"> 1710 <div class="media-list-item__actions-list dw-mod"> 1711 @{ 1712 var actions = settings.GetActions(); 1713 1714 foreach (ButtonBase action in actions) 1715 { 1716 action.ButtonLayout = ButtonLayout.None; 1717 action.CssClass += " media-list-item__action link"; 1718 1719 @Render(action) 1720 } 1721 } 1722 </div> 1723 1724 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title)) 1725 { 1726 settings.SelectButton.CssClass += " u-no-margin"; 1727 1728 <div class="media-list-item__action-button"> 1729 @Render(settings.SelectButton) 1730 </div> 1731 } 1732 </div> 1733 </div> 1734 </div> 1735 } 1736 @using Dynamicweb.Rapido.Blocks.Components.General 1737 @using Dynamicweb.Rapido.Blocks.Components 1738 1739 @helper RenderTable(Table settings) 1740 { 1741 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1742 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1743 1744 var enumToClasses = new Dictionary<TableDesign, string> 1745 { 1746 { TableDesign.Clean, "table--clean" }, 1747 { TableDesign.Bordered, "table--bordered" }, 1748 { TableDesign.Striped, "table--striped" }, 1749 { TableDesign.Hover, "table--hover" }, 1750 { TableDesign.Compact, "table--compact" }, 1751 { TableDesign.Condensed, "table--condensed" }, 1752 { TableDesign.NoTopBorder, "table--no-top-border" } 1753 }; 1754 string tableDesignClass = ""; 1755 if (settings.Design != TableDesign.None) 1756 { 1757 tableDesignClass = enumToClasses[settings.Design]; 1758 } 1759 1760 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); } 1761 1762 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 1763 1764 <table @ComponentMethods.AddAttributes(resultAttributes)> 1765 @if (settings.Header != null) 1766 { 1767 <thead> 1768 @Render(settings.Header) 1769 </thead> 1770 } 1771 <tbody> 1772 @foreach (var row in settings.Rows) 1773 { 1774 @Render(row) 1775 } 1776 </tbody> 1777 @if (settings.Footer != null) 1778 { 1779 <tfoot> 1780 @Render(settings.Footer) 1781 </tfoot> 1782 } 1783 </table> 1784 } 1785 @using Dynamicweb.Rapido.Blocks.Components.General 1786 @using Dynamicweb.Rapido.Blocks.Components 1787 1788 @helper RenderTableRow(TableRow settings) 1789 { 1790 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1791 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1792 1793 var enumToClasses = new Dictionary<TableRowDesign, string> 1794 { 1795 { TableRowDesign.NoBorder, "table__row--no-border" }, 1796 { TableRowDesign.Border, "table__row--border" }, 1797 { TableRowDesign.TopBorder, "table__row--top-line" }, 1798 { TableRowDesign.BottomBorder, "table__row--bottom-line" }, 1799 { TableRowDesign.Solid, "table__row--solid" } 1800 }; 1801 1802 string tableRowDesignClass = ""; 1803 if (settings.Design != TableRowDesign.None) 1804 { 1805 tableRowDesignClass = enumToClasses[settings.Design]; 1806 } 1807 1808 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); } 1809 1810 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 1811 1812 <tr @ComponentMethods.AddAttributes(resultAttributes)> 1813 @foreach (var cell in settings.Cells) 1814 { 1815 if (settings.IsHeaderRow) 1816 { 1817 cell.IsHeader = true; 1818 } 1819 @Render(cell) 1820 } 1821 </tr> 1822 } 1823 @using Dynamicweb.Rapido.Blocks.Components.General 1824 @using Dynamicweb.Rapido.Blocks.Components 1825 @using Dynamicweb.Core 1826 1827 @helper RenderTableCell(TableCell settings) 1828 { 1829 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1830 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1831 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); } 1832 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); } 1833 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); } 1834 1835 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 1836 1837 string tagName = settings.IsHeader ? "th" : "td"; 1838 1839 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + " title="+ settings.Content.Replace(" ", "&nbsp;") + ">") 1840 1841 @settings.Content 1842 @("</" + tagName + ">"); 1843 } 1844 @using System.Linq 1845 @using Dynamicweb.Rapido.Blocks.Components.General 1846 1847 @* Component *@ 1848 1849 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings) 1850 { 1851 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter 1852 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring 1853 1854 if (settings.NumberOfPages > 1) 1855 { 1856 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx"; 1857 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation"); 1858 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings); 1859 1860 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel"> 1861 @if (settings.ShowPagingInfo) 1862 { 1863 <div class="pager__info dw-mod"> 1864 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages 1865 </div> 1866 } 1867 <ul class="pager__list dw-mod"> 1868 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls) 1869 { 1870 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon }) 1871 } 1872 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls) 1873 { 1874 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon }) 1875 } 1876 @if (settings.GetPages().Any()) 1877 { 1878 foreach (var page in settings.GetPages()) 1879 { 1880 @Render(page) 1881 } 1882 } 1883 else 1884 { 1885 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++) 1886 { 1887 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString()); 1888 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) }); 1889 } 1890 } 1891 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls) 1892 { 1893 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon }) 1894 } 1895 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls) 1896 { 1897 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon }) 1898 } 1899 </ul> 1900 </div> 1901 } 1902 } 1903 1904 @helper RenderPaginationItem(PaginationItem settings) 1905 { 1906 if (settings.Icon == null) 1907 { 1908 settings.Icon = new Icon(); 1909 } 1910 1911 settings.Icon.Label = settings.Label; 1912 <li class="pager__btn dw-mod"> 1913 @if (settings.IsActive) 1914 { 1915 <span class="pager__num pager__num--current dw-mod"> 1916 @Render(settings.Icon) 1917 </span> 1918 } 1919 else 1920 { 1921 <a href="@settings.Link" class="pager__num dw-mod"> 1922 @Render(settings.Icon) 1923 </a> 1924 } 1925 </li> 1926 } 1927 1928 1929 @using Dynamicweb.Rapido.Blocks.Components.General 1930 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 1931 1932 1933 1934 @* Include the Blocks for the page *@ 1935 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 1936 @using Dynamicweb.Core 1937 @using System 1938 @using System.Web 1939 @using System.Collections.Generic 1940 @using Dynamicweb.Rapido.Blocks 1941 1942 @{ 1943 BlocksPage stepBarCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); 1944 1945 Block checkoutSteps = new Block() 1946 { 1947 Id = "StepBar", 1948 SortId = 10, 1949 Template = RenderStepBar(), 1950 Design = new Design { 1951 RenderType = RenderType.Column, 1952 Size = "12" 1953 } 1954 }; 1955 stepBarCheckoutPage.Add("CheckoutForm", checkoutSteps); 1956 } 1957 1958 @helper RenderStepBar() 1959 { 1960 string stepNumber = ""; 1961 1962 <div class="step-bar dw-mod"> 1963 @foreach (LoopItem step in GetLoop("StepButtons")) 1964 { 1965 if (step.GetString("Step.Name").ToLower() != "checkout") 1966 { 1967 string activeStep = step.GetBoolean("Step.Current") ? "step-bar__step--active" : ""; 1968 1969 if (GetLoop("StepButtons").Count > 2) 1970 { 1971 stepNumber = step.GetString("Step.Number") + "."; 1972 } 1973 1974 <div class="step-bar__step @activeStep dw-mod"> 1975 @stepNumber @Translate(step.GetString("Step.Name")) 1976 </div> 1977 } 1978 } 1979 </div> 1980 } 1981 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 1982 @using Dynamicweb 1983 @using Dynamicweb.Core 1984 @using System 1985 @using System.Web 1986 @using System.Collections.Generic 1987 @using Dynamicweb.Rapido.Blocks 1988 @using Dynamicweb.Rapido.Blocks.Components 1989 @using Dynamicweb.Rapido.Blocks.Components.General 1990 1991 @functions{ 1992 BlocksPage reviewOrderCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); 1993 string cartFeedPageId; 1994 bool canCompleteOrder = true; 1995 } 1996 1997 @{ 1998 string reviewOrderType = checkoutPageType ?? "onestep"; //The "checkoutPageType" comes from the main template for the cart page 1999 2000 cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed").ToString(); 2001 2002 if (!String.IsNullOrWhiteSpace(GetString("Ecom:OrderContext.ID"))) 2003 { 2004 cartFeedPageId += "&OrderContext=" + GetString("Ecom:OrderContext.ID"); 2005 } 2006 2007 2008 var paymentCountryCode = GetString("Ecom:Order.Customer.Country.Code"); 2009 var shippingCountryCode = GetString("Ecom:Order.Delivery.Country.Code"); 2010 var paymentCountryIsSupported = string.IsNullOrEmpty(paymentCountryCode) || GetLoop("Countries").Any(country => (country.GetString("Ecom:Country.Code2") == paymentCountryCode)); 2011 var shippingCountryIsSupported = string.IsNullOrEmpty(shippingCountryCode) ? paymentCountryIsSupported : GetLoop("Countries").Any(country => (country.GetString("Ecom:Country.Code2") == shippingCountryCode)); 2012 2013 canCompleteOrder = paymentCountryIsSupported && shippingCountryIsSupported; 2014 2015 Block reviewOrderBlock = new Block() 2016 { 2017 Id = "ReviewOrder", 2018 SortId = 50, 2019 SkipRenderBlocksList = true, 2020 Template = RenderReviewOrder() 2021 }; 2022 reviewOrderCheckoutPage.Add("OrderContainerRow", reviewOrderBlock); 2023 2024 if (reviewOrderType == "onestep") 2025 { 2026 Block inlineAcceptanceBlock = new Block() 2027 { 2028 Id = "Acceptance", 2029 SortId = 10, 2030 Template = RenderInlineAcceptance() 2031 }; 2032 reviewOrderCheckoutPage.Add("ReviewOrder", inlineAcceptanceBlock); 2033 2034 Block reviewOrderFooterBlock = new Block() 2035 { 2036 Id = "ReviewOrderFooter", 2037 SortId = 20, 2038 Template = RenderReviewOrderFooter() 2039 }; 2040 reviewOrderCheckoutPage.Add("ReviewOrder", reviewOrderFooterBlock); 2041 } 2042 2043 if (reviewOrderType == "quote") 2044 { 2045 Block reviewOrderFooterBlock = new Block() 2046 { 2047 Id = "ReviewOrderFooter", 2048 SortId = 20, 2049 Template = RenderReviewOrderFooterQuote() 2050 }; 2051 reviewOrderCheckoutPage.Add("ReviewOrder", reviewOrderFooterBlock); 2052 } 2053 2054 Block reviewOrderScriptTemplates = new Block() 2055 { 2056 Id = "ReviewOrderScriptTempaltes", 2057 SortId = 30, 2058 BlocksList = new List<Block> { 2059 new Block { 2060 Id = "CartContentTemplate", 2061 SortId = 10, 2062 Template = RenderCartContentTemplate() 2063 }, 2064 new Block { 2065 Id = "CartOrderlineTemplate", 2066 SortId = 20, 2067 Template = RenderCartOrderlineTemplate() 2068 }, 2069 new Block { 2070 Id = "CartOrderlineMobileTemplate", 2071 SortId = 30, 2072 Template = RenderCartOrderlineMobileTemplate() 2073 }, 2074 new Block { 2075 Id = "CartOrderlineDiscountTemplate", 2076 SortId = 40, 2077 Template = RenderCartOrderlineDiscountTemplate() 2078 }, 2079 new Block { 2080 Id = "EmptyCartTemplate", 2081 SortId = 50, 2082 Template = RenderEmptyCartTemplate() 2083 }, 2084 new Block 2085 { 2086 Id = "EmptyCartObserver", 2087 SortId = 60, 2088 Template = RenderEmptyCartObserver() 2089 } 2090 } 2091 }; 2092 reviewOrderCheckoutPage.Add("CheckoutBottomSnippets", reviewOrderScriptTemplates); 2093 2094 Block reviewOrderScripts = new Block() 2095 { 2096 Id = "ReviewOrderScripts", 2097 SortId = 40, 2098 Template = RenderOrderScripts() 2099 }; 2100 reviewOrderCheckoutPage.Add("CheckoutBottomSnippets", reviewOrderScripts); 2101 } 2102 2103 @helper RenderReviewOrder() 2104 { 2105 <div class="grid__col-12"> 2106 <div class="js-handlebars-root" id="Cart" data-template="CartContent" data-cart-id="@cartFeedPageId" data-json-feed="/Default.aspx?ID=@cartFeedPageId" data-preloader="overlay"></div> 2107 </div> 2108 } 2109 2110 @helper RenderCartContentTemplate() 2111 { 2112 List<Block> subBlocks = reviewOrderCheckoutPage.GetBlockListById("ReviewOrder").OrderBy(item => item.SortId).ToList(); 2113 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 2114 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2115 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(GetString("Ecom:Order.ID")); 2116 bool isPricesWithVATEnabled = Converter.ToBoolean(Pageview.Area.EcomPricesWithVat); 2117 2118 <script id="CartContent" type="text/x-template"> 2119 {{#.}} 2120 @if (useGoogleTagManager) 2121 { 2122 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 2123 } 2124 <div class="card-header u-color-light--bg dw-mod"> 2125 @Render(new Heading { Title = Translate("Review order") + "({{numberofproducts}})", Level = 3, Icon = new Icon { Prefix = "fas", Name = "fa-list-ul", LabelPosition = IconLabelPosition.After } }) 2126 </div> 2127 <div class="card u-color-light--bg u-no-padding--xs dw-mod"> 2128 {{#unless isEmpty}} 2129 <table class="table cart-table dw-mod"> 2130 <tbody id="OrderLines"> 2131 {{#OrderLines}} 2132 {{> (lookup . 'template') }} 2133 {{/OrderLines}} 2134 </tbody> 2135 </table> 2136 {{/unless}} 2137 <div class="grid u-border-top"> 2138 <div class="grid__col-sm-6"> 2139 @if (Dynamicweb.Security.Licensing.LicenseManager.LicenseHasFeature("LoyaltyPoints") && !string.IsNullOrWhiteSpace(GetGlobalValue("Global:Extranet.UserName"))) 2140 { 2141 <text> 2142 {{#if userPoints}} 2143 <div class="u-border u-border-color--loyalty-points u-padding--lg u-full-height"> 2144 @Render(new Heading { Title = Translate("Your point balance"), Level = 3 }) 2145 <div class="u-font-size--lg u-margin-bottom"> 2146 <span class="u-color--loyalty-points">{{userPoints}}</span> @Translate("points") 2147 </div> 2148 <div>@Translate("On this order you will use"): <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points")</div> 2149 </div> 2150 {{/if}} 2151 </text> 2152 } 2153 </div> 2154 2155 <div class="grid__col-sm-6"> 2156 @if (!pointShop) 2157 { 2158 <text> 2159 {{#unless hideSubTotal}} 2160 <div> 2161 <div class="cart-summary__subtotals dw-mod">@Translate("Subtotal")</div> 2162 <div class="cart-summary__subtotals u-pull--right dw-mod"> 2163 @if (hasTaxSettings) 2164 { 2165 <text>{{subtotalpricewithouttaxes}}</text> 2166 } 2167 else 2168 { 2169 <text>{{subtotalprice}}</text> 2170 } 2171 </div> 2172 </div> 2173 {{/unless}} 2174 </text> 2175 <text> 2176 {{#unless hidePaymentfee}} 2177 <div> 2178 <div class="cart-summary__info dw-mod">@Render(new Icon { Prefix = "fas", Name = "fa-credit-card", Label = "{{paymentmethod}}", LabelPosition = IconLabelPosition.After })</div> 2179 <div class="cart-summary__info u-pull--right dw-mod">{{paymentfee}}</div> 2180 </div> 2181 {{/unless}} 2182 </text> 2183 } 2184 {{#unless hideShippingfee}} 2185 <div> 2186 <div class="cart-summary__info dw-mod">@Render(new Icon { Prefix = "fas", Name = "fa-truck", Label = "{{shippingmethod}}", LabelPosition = IconLabelPosition.After })</div> 2187 <div class="cart-summary__info u-pull--right dw-mod">{{shippingfee}}</div> 2188 </div> 2189 {{/unless}} 2190 {{#if hasTaxSettings}} 2191 <div> 2192 <div class="cart-summary__info dw-mod">@Render(new Icon { Prefix = "fas", Name = "fa-hand-holding-usd", Label = Translate("Sales Tax"), LabelPosition = IconLabelPosition.After })</div> 2193 <div class="cart-summary__info u-pull--right dw-mod">{{totaltaxes}}</div> 2194 </div> 2195 {{/if}} 2196 @if (Pageview.User != null && Dynamicweb.Security.Licensing.LicenseManager.LicenseHasFeature("LoyaltyPoints")) 2197 { 2198 <text> 2199 {{#if earnings}} 2200 <div> 2201 <div class="cart-summary__info dw-mod">@Translate("Earnings")</div> 2202 <div class="cart-summary__info u-pull--right dw-mod"><span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")</div> 2203 </div> 2204 {{/if}} 2205 </text> 2206 } 2207 <div class="cart-summary__totals-container dw-mod"> 2208 <div class="cart-summary__totals dw-mod">@Translate("Total")</div> 2209 <div class="cart-summary__totals u-pull--right dw-mod"> 2210 @if (pointShop) 2211 { 2212 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points") 2213 } 2214 else 2215 { 2216 <text>{{totalprice}}</text> 2217 } 2218 </div> 2219 </div> 2220 @if (!pointShop && !hasTaxSettings) 2221 { 2222 <div class="u-ta-right"> 2223 <small class="cart-summary__info dw-mod">@Translate("VAT"):</small> 2224 <small class="cart-summary__info dw-mod">{{totalvat}}</small> 2225 </div> 2226 2227 if (isPricesWithVATEnabled) 2228 { 2229 <div class="u-ta-right"> 2230 <small class="cart-summary__info dw-mod">@Translate("Total price without VAT"):</small> 2231 <small class="cart-summary__info dw-mod">{{totalPriceWithoutVat}}</small> 2232 </div> 2233 } 2234 else 2235 { 2236 <div class="u-ta-right"> 2237 <small class="cart-summary__info dw-mod">@Translate("Total price with VAT"):</small> 2238 <small class="cart-summary__info dw-mod">{{totalPriceWithVat}}</small> 2239 </div> 2240 } 2241 } 2242 {{#if showCheckoutDisclaimer}} 2243 <div class="u-ta-right"> 2244 <small>{{checkoutDisclaimer}}</small> 2245 </div> 2246 {{/if}} 2247 </div> 2248 </div> 2249 2250 <div class="grid"> 2251 <div class="grid__col-12 grid__col--line-top"></div> 2252 </div> 2253 2254 {{#unless hideComment}} 2255 <div class="grid__cell u-padding--xs"> 2256 @Render(new TextareaField { Rows = 3, Placeholder = Translate("Enter comment"), Name = "EcomOrderCustomerComment", Id = "EcomOrderCustomerComment", Value = "{{comment}}" }) 2257 </div> 2258 {{/unless}} 2259 <div class="u-margin-bottom--lg"> 2260 @foreach (LoopItem error in GetLoop("ValidationErrors")) 2261 { 2262 @Render(new NotificationMessage { Message = error.GetString("Ecom:Cart.ValidationError.ErrorMessage"), MessageType = NotificationMessageType.Error }) 2263 } 2264 </div> 2265 2266 @RenderBlockList(subBlocks) 2267 </div> 2268 {{/.}} 2269 </script> 2270 } 2271 2272 @helper RenderCartOrderlineTemplate() 2273 { 2274 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 2275 int quotesCartPageId = GetPageIdByNavigationTag("QuotesCartPage"); 2276 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2277 2278 @* Template for the orderlines *@ 2279 <script id="CartOrderline" type="text/x-template"> 2280 {{#unless isEmpty}} 2281 <tr id="Orderline{{id}}" class="cart-orderline"> 2282 <td class="cart-orderline__cell cart-table__image u-hidden-xs u-hidden-xxs dw-mod"> 2283 <div class="cart-orderline__cell__block {{hideimage}} dw-mod"> 2284 @Render(new Image { Path = "{{image}}", Title = "{{name}} {{variantname}}", ImageDefault = new ImageSettings { Width = 60, Height = 60, Crop = 5 } }) 2285 </div> 2286 </td> 2287 <td class="cart-orderline__cell u-va-middle dw-mod" title="{{name}} {{variantname}}"> 2288 <a href="{{link}}" class="u-color-inherit cart-orderline__name">{{name}}</a> 2289 {{#if productnumber}} 2290 <div class="cart-orderline__cell__block item-number dw-mod">#{{productnumber}}</div> 2291 {{/if}} 2292 {{#if variantname}} 2293 <div class="cart-orderline__cell__block item-number dw-mod">{{variantname}}</div> 2294 {{/if}} 2295 {{#if unitname}} 2296 <div class="cart-orderline__cell__block item-number dw-mod">{{unitname}}</div> 2297 {{/if}} 2298 </td> 2299 <td class="cart-orderline__cell u-ta-right u-hidden-xs u-hidden-xxs dw-mod" width="120"> 2300 {{#if pointsTotal}} 2301 <span class="u-color--loyalty-points">{{pointPrice}}</span> @Translate("points") 2302 {{else}} 2303 {{unitprice}} 2304 {{/if}} 2305 </td> 2306 2307 @if (!Dynamicweb.Ecommerce.Common.Context.Cart.IsQuote) 2308 { 2309 <td class="cart-orderline__cell u-ta-right dw-mod" colspan="2"> 2310 @Render(new NumberField 2311 { 2312 Id = "Quantity_{{orderLineId}}", 2313 Min = 1, 2314 OnChange = "Cart.ChangeQuantity('" + cartFeedPageId + "', '{{orderLineId}}', this.value)", 2315 Name = "QuantityOrderLine{{orderLineId}}", 2316 Value = "{{quantity}}", 2317 CssClass = "u-w80px", 2318 ActionButton = new Button 2319 { 2320 ButtonType = ButtonType.Button, 2321 ButtonLayout = ButtonLayout.Clean, 2322 OnClick = "{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}} Cart.UpdateCart(null, '/Default.aspx?ID=" + cartFeedPageId + "', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);", 2323 Icon = new Icon { Prefix = "fas", Name = "fa-times", LabelPosition = IconLabelPosition.After } 2324 } 2325 }) 2326 </td> 2327 } 2328 else 2329 { 2330 <td class="cart-orderline__cell u-ta-right dw-mod" colspan="2"> 2331 @Render(new HiddenField { Id = "Quantity_{{orderLineId}}", Name = "QuantityOrderLine{{orderLineId}}", Value = "{{quantity}}" }) 2332 <div class="u-w80px u-no-margin">{{quantity}}</div> 2333 </td> 2334 } 2335 2336 <td class="cart-orderline__cell u-ta-right dw-mod"> 2337 {{#if pointsTotal}} 2338 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 2339 {{else}} 2340 <div>{{totalprice}}</div> 2341 {{/if}} 2342 @if (!Dynamicweb.Ecommerce.Common.Context.Cart.IsQuote) 2343 { 2344 <text> 2345 {{#if canBePurchasedWithPoints}} 2346 @Render(new Button { Title = Translate("Use") + " {{pointPrice}} " + Translate("points"), ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.None, CssClass = "btn btn--loyalty-points btn--sm u-no-margin", OnClick = "Cart.BuyForPoints('" + GetGlobalValue("Global:Page.ID") + "', '" + cartFeedPageId + "', '{{orderLineId}}', '{{id}}', '{{variantId}}');", Icon = new Icon { Prefix = "far", Name = "fa-tag", LabelPosition = IconLabelPosition.After } }) 2347 {{/if}} 2348 </text> 2349 } 2350 </td> 2351 </tr> 2352 {{/unless}} 2353 <tr class="{{hideBomItems}}"> 2354 <td class="cart-table__image u-hidden-xs u-hidden-xxs dw-mod"><div class="{{hideimage}}"></div></td> 2355 <td colspan="5" class="u-no-padding"> 2356 <table class="u-no-margin u-color-light-gray--bg"> 2357 <tbody> 2358 {{#BomItems}} 2359 <tr> 2360 <td class="cart-table__image u-hidden-xs u-hidden-xxs dw-mod"> 2361 @Render(new Image { Path = "{{image}}", Title = "{{name}} {{variantname}}", ImageDefault = new ImageSettings { Width = 60, Height = 60, Crop = 5 } }) 2362 </td> 2363 <td title="{{name}} {{variantname}}"> 2364 <a href="{{link}}" class="u-color-inherit dw-mod">{{name}}</a> 2365 {{#if productnumber}} 2366 <div class="item-number dw-mod">#{{productnumber}}</div> 2367 {{/if}} 2368 {{#if variantname}} 2369 <div class="item-number dw-mod">{{variantname}}</div> 2370 {{/if}} 2371 {{#if unitname}} 2372 <div class="item-number dw-mod">{{unitname}}</div> 2373 {{/if}} 2374 </td> 2375 <td class="u-hidden-xs u-hidden-xxs">&nbsp;</td> 2376 <td>{{quantity}}</td> 2377 <td>&nbsp;</td> 2378 <td class="cart-table__price u-ta-right dw-mod">&nbsp;</td> 2379 </tr> 2380 {{/BomItems}} 2381 </tbody> 2382 </table> 2383 </td> 2384 </tr> 2385 </script> 2386 } 2387 2388 @helper RenderCartOrderlineMobileTemplate() 2389 { 2390 <script id="CartOrderlineMobile" type="text/x-template"> 2391 {{#unless isEmpty}} 2392 <tr id="Orderline{{id}}"> 2393 <td class="cart-table__image dw-mod"> 2394 <div class="{{hideimage}}"> 2395 @Render(new Image { Path = "{{image}}", Title = "{{name}} {{variantname}}", ImageDefault = new ImageSettings { Width = 60, Height = 60, Crop = 5 } }) 2396 </div> 2397 </td> 2398 <td title="{{name}} {{variantname}}" colspan="4"> 2399 <a href="{{link}}" class="u-color-inherit">{{name}}</a> 2400 {{#if productnumber}} 2401 <div>#{{productnumber}}</div> 2402 {{/if}} 2403 {{#if variantname}} 2404 <div>{{variantname}}</div> 2405 {{/if}} 2406 {{#if unitname}} 2407 <div>{{unitname}}</div> 2408 {{/if}} 2409 </td> 2410 </tr> 2411 <tr class="table__row--no-border"> 2412 <td class="cart-table__image dw-mod"></td> 2413 <td colspan="4"> 2414 <div class="u-pull--left"> 2415 @Render(new NumberField 2416 { 2417 Id = "Quantity_{{orderLineId}}", 2418 Min = 1, 2419 OnChange = "Cart.ChangeQuantity('" + cartFeedPageId + "', '{{orderLineId}}', this.value)", 2420 Name = "QuantityOrderLine{{orderLineId}}", 2421 Value = "{{quantity}}", 2422 CssClass = "u-w80px", 2423 ActionButton = new Button 2424 { 2425 ButtonType = ButtonType.Button, 2426 ButtonLayout = ButtonLayout.Clean, 2427 OnClick = "{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}} Cart.UpdateCart(null, '/Default.aspx?ID=" + cartFeedPageId + "', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);", 2428 Icon = new Icon { Prefix = "fas", Name = "fa-times", LabelPosition = IconLabelPosition.After } 2429 } 2430 }) 2431 </div> 2432 <div class="u-pull--right u-ta-right"> 2433 {{#if pointsTotal}} 2434 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 2435 {{else}} 2436 <div>{{totalprice}}</div> 2437 {{/if}} 2438 {{#if canBePurchasedWithPoints}} 2439 @Render(new Button { Title = Translate("Use") + "{{pointPrice}}" + Translate("points"), ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.LinkClean, CssClass = "btn--loyalty-points btn--sm u-no-margin u-margin-top", OnClick = "Cart.BuyForPoints('" + GetGlobalValue("Global:Page.ID") + "', '" + cartFeedPageId + "', '{{orderLineId}}', '{{id}}', '{{variantId}}');", Icon = new Icon { Prefix = "far", Name = "fa-tag", LabelPosition = IconLabelPosition.After } }) 2440 {{/if}} 2441 </div> 2442 </td> 2443 </tr> 2444 {{/unless}} 2445 <tr class="{{hideBomItems}}"> 2446 <td colspan="6" class="u-no-padding"> 2447 <table class="u-no-margin u-color-light-gray--bg"> 2448 <tbody> 2449 {{#BomItems}} 2450 <tr> 2451 <td class="cart-table__image u-hidden-xs u-hidden-xxs dw-mod"> 2452 @Render(new Image { Path = "{{image}}", Title = "{{name}} {{variantname}}", ImageDefault = new ImageSettings { Width = 60, Height = 60, Crop = 5 } }) 2453 </td> 2454 <td title="{{name}} {{variantname}}"> 2455 <a href="{{link}}" title="{{name}} {{variantname}}">{{name}}</a> 2456 {{#if productnumber}} 2457 <div>#{{productnumber}}</div> 2458 {{/if}} 2459 {{#if variantname}} 2460 <div>{{variantname}}</div> 2461 {{/if}} 2462 {{#if unitname}} 2463 <div>{{unitname}}</div> 2464 {{/if}} 2465 </td> 2466 <td class="u-hidden-xs u-hidden-xxs">&nbsp;</td> 2467 <td>{{quantity}}</td> 2468 <td>&nbsp;</td> 2469 <td class="cart-table__price u-ta-right dw-mod">&nbsp;</td> 2470 </tr> 2471 {{/BomItems}} 2472 </tbody> 2473 </table> 2474 </td> 2475 </tr> 2476 </script> 2477 } 2478 2479 @helper RenderCartOrderlineDiscountTemplate() 2480 { 2481 <script id="CartOrderlineDiscount" type="text/x-template"> 2482 <tr class="table__row--no-border"> 2483 <td class="cart-table__image dw-mod">&nbsp;</td> 2484 <td colspan="3">{{name}}</td> 2485 <td class="u-hidden-xs u-hidden-xxs">&nbsp;</td> 2486 <td class="cart-table__price u-ta-right dw-mod">{{totalprice}}</td> 2487 </tr> 2488 </script> 2489 } 2490 2491 @helper RenderEmptyCartTemplate() 2492 { 2493 <script id="EmptyCart" type="text/x-template"> 2494 @Translate("You have no items in the cart") 2495 </script> 2496 } 2497 2498 @helper RenderInlineAcceptance() 2499 { 2500 <div class="grid__cell u-padding--xs"> 2501 @if (GetBoolean("Ecom:Cart.UseNewsletterSubscription")) 2502 { 2503 @Render(new HiddenField { Name = "EcomOrderSubscribeToNewsletter" }) 2504 @Render(new CheckboxField { Name = "EcomOrderSubscribeToNewsletter", Id = "EcomOrderSubscribeToNewsletter", Label = Translate("Subscribe to newsletter") }) 2505 } 2506 2507 @if (Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideTermsAndConditions")) 2508 { 2509 @Render(new HiddenField { Name = "EcomOrderCustomerAccepted", Id = "EcomOrderCustomerAccepted", Value = "1" }) 2510 } 2511 else 2512 { 2513 string termsPageIt = GetPageIdByNavigationTag("TermsAndConditions").ToString(); 2514 @Render(new CheckboxField 2515 { 2516 Name = "EcomOrderCustomerAccepted", 2517 Id = "EcomOrderCustomerAccepted", 2518 OnChange = canCompleteOrder ? "Cart.EnableCheckoutButton()" : "", 2519 Label = Translate("I accept the") + " <a href=\"/Default.aspx?ID=" + termsPageIt + "\">" + Translate("terms and conditions") + "</a>", 2520 ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderCustomerAccepted.ErrorMessage") 2521 }) 2522 } 2523 </div> 2524 } 2525 2526 @helper RenderReviewOrderFooter() 2527 { 2528 int quotesCartPageId = GetPageIdByNavigationTag("QuotesCartPage"); 2529 2530 <div class="grid"> 2531 <div class="grid__col-12 grid__col--line-top"></div> 2532 </div> 2533 2534 <div class="grid__cell-footer"> 2535 <div class="grid__cell u-padding--xs"> 2536 <div class="u-pull--right"> 2537 @Render(new Button 2538 { 2539 ButtonType = ButtonType.Submit, 2540 ButtonLayout = ButtonLayout.Primary, 2541 CssClass = "btn--condensed u-pull--right u-no-margin", 2542 Title = Translate("Go to checkout"), 2543 Id = GetString("CartV2.NextStepButtonName"), 2544 OnClick = "Buttons.LockButton(event, true)", 2545 Disabled = !canCompleteOrder || !Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideTermsAndConditions"), 2546 Name = GetString("CartV2.NextStepButtonName") 2547 }) 2548 </div> 2549 <div class="u-pull--left"> 2550 @Render(new Button { ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.Secondary, CssClass = "btn--condensed u-pull--left u-no-margin", Title = Translate("Empty cart"), OnClick = "googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);" }) 2551 </div> 2552 @if (!Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideQuotesCartLink") && !string.IsNullOrWhiteSpace(GetGlobalValue("Global:Extranet.UserName"))) 2553 { 2554 <div class="u-pull--right"> 2555 @Render(new Link { Href = "/Default.aspx?ID=" + quotesCartPageId, ButtonLayout = ButtonLayout.Link, CssClass = "btn--condensed u-no-margin u-margin-right--lg u-no-margin--xs", Title = Translate("Create quote request") }) 2556 </div> 2557 } 2558 </div> 2559 </div> 2560 } 2561 2562 @helper RenderReviewOrderFooterQuote() 2563 { 2564 string submitButtonTitle = Pageview.Device.ToString() == "Mobile" ? Translate("Submit") : Translate("Submit quote request"); 2565 2566 <div class="grid"> 2567 <div class="grid__col-12 grid__col--line-top"></div> 2568 </div> 2569 2570 <div class="grid__cell-footer"> 2571 <div class="grid__cell u-padding--xs"> 2572 <div class="u-pull--right"> 2573 @Render(new Button 2574 { 2575 ButtonType = ButtonType.Submit, 2576 ButtonLayout = ButtonLayout.Primary, 2577 CssClass = "btn--condensed u-pull--right u-no-margin", 2578 Title = submitButtonTitle, 2579 Id = GetString("CartV2.NextStepButtonName"), 2580 OnClick = "Buttons.LockButton(event, true)", 2581 Name = GetString("CartV2.NextStepButtonName") 2582 }) 2583 </div> 2584 <div class="u-pull--left"> 2585 @Render(new Button { ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.Secondary, CssClass = "btn--condensed u-pull--left u-no-margin", OnClick = "googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);", Title = Translate("Empty cart") }) 2586 </div> 2587 </div> 2588 </div> 2589 } 2590 2591 @helper RenderOrderScripts() 2592 { 2593 if (!string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"))) 2594 { 2595 <script> 2596 fbq('track', 'InitiateCheckout', { 2597 currency: '@GetString("Ecom:Order.Price.Currency.Code")', 2598 value: @GetDouble("Ecom:Order.Price.Price"), 2599 num_items: "@GetInteger("Ecom:Order.OrderLines.TotalProductQuantity")" 2600 }); 2601 </script> 2602 } 2603 } 2604 2605 @helper RenderEmptyCartObserver() 2606 { 2607 <script> 2608 document.addEventListener("cartUpdated", function(event) { 2609 let data = event.detail.data[0]; 2610 if (data.numberofproducts == 0) { 2611 location.reload(); 2612 } else { 2613 HandlebarsBolt.CreateItemsFromJson(data, "Cart"); 2614 } 2615 }); 2616 </script> 2617 } 2618 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2619 @using Dynamicweb.Core 2620 @using System 2621 @using System.Web 2622 @using System.Collections.Generic 2623 @using Dynamicweb.Rapido.Blocks 2624 2625 @{ 2626 BlocksPage stepNavigationCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); 2627 2628 Block checkoutStepNavigation = new Block() 2629 { 2630 Id = "StepNavigation", 2631 SortId = 50, 2632 Template = RenderStepNavigation(), 2633 Design = new Design { 2634 RenderType = RenderType.Column, 2635 Size = "12" 2636 } 2637 }; 2638 stepNavigationCheckoutPage.Add("CheckoutForm", checkoutStepNavigation); 2639 } 2640 2641 @helper RenderStepNavigation() 2642 { 2643 var paymentCountryCode = GetString("Ecom:Order.Customer.Country.Code"); 2644 var shippingCountryCode = GetString("Ecom:Order.Delivery.Country.Code"); 2645 var paymentCountryIsSupported = string.IsNullOrEmpty(paymentCountryCode) || GetLoop("Countries").Any(country => (country.GetString("Ecom:Country.Code2") == paymentCountryCode)); 2646 var shippingCountryIsSupported = string.IsNullOrEmpty(shippingCountryCode) ? paymentCountryIsSupported : GetLoop("Countries").Any(country => (country.GetString("Ecom:Country.Code2") == shippingCountryCode)); 2647 2648 var canCompleteOrder = paymentCountryIsSupported && shippingCountryIsSupported; 2649 2650 2651 int quotesCartPageId = GetPageIdByNavigationTag("QuotesCartPage"); 2652 int currentStep = 1; 2653 string disableNextButton = ""; 2654 string nextButtonName = Translate("Next"); 2655 2656 foreach (LoopItem step in GetLoop("StepButtons")) 2657 { 2658 if (step.GetBoolean("Step.Current")) 2659 { 2660 currentStep = step.GetInteger("Step.Number"); 2661 } 2662 2663 if (step.GetInteger("Step.Number") == currentStep + 1) 2664 { 2665 if (Pageview.Device.ToString() != "Mobile" ) { 2666 nextButtonName = Translate("Go to") + " " + step.GetString("Step.Name"); 2667 } else { 2668 nextButtonName = step.GetString("Step.Name"); 2669 } 2670 } 2671 } 2672 2673 if (currentStep == GetLoop("StepButtons").Count - 1) 2674 { 2675 disableNextButton = Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideTermsAndConditions") ? "" : "disabled"; //not disable button if terms are hidden 2676 nextButtonName = Translate("Confirm order"); 2677 } 2678 2679 if (currentStep > 1 && !canCompleteOrder) 2680 { 2681 disableNextButton = "disabled"; 2682 } 2683 2684 <div class="card u-color-light--bg dw-mod"> 2685 @if (currentStep == 1) 2686 { 2687 <div class="u-pull--left"> 2688 <button type="button" class="btn btn--secondary btn--condensed dw-mod u-pull--left u-no-margin" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);">@Translate("Empty cart")</button> 2689 </div> 2690 } 2691 else 2692 { 2693 <div class="u-pull--left"> 2694 <button type="submit" class="btn btn--secondary btn--condensed dw-mod u-pull--right u-no-margin" name="@GetString("CartV2.PreviousStepButtonName")" id="@GetString("CartV2.PreviousStepButtonName")"><i class="fas fa-angle-left"></i> @Translate("Back")</button> 2695 </div> 2696 } 2697 2698 <div class="u-pull--right"> 2699 <button type="submit" class="btn btn--primary btn--condensed dw-mod u-pull--right u-no-margin @disableNextButton" name="@GetString("CartV2.NextStepButtonName")" id="@GetString("CartV2.NextStepButtonName")" @disableNextButton>@nextButtonName <i class="fas fa-angle-right"></i></button> 2700 </div> 2701 2702 @if (!Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideQuotesCartLink") && !string.IsNullOrWhiteSpace(GetGlobalValue("Global:Extranet.UserName"))) 2703 { 2704 <div class="u-pull--right"> 2705 <a href="/Default.aspx?ID=@quotesCartPageId" class="btn btn--condensed btn--link dw-mod u-no-margin u-margin-right--lg u-no-margin--xs">@Translate("Create quote request")</a> 2706 </div> 2707 } 2708 </div> 2709 } 2710 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2711 @using Dynamicweb.Core 2712 @using System 2713 @using System.Web 2714 @using System.Collections.Generic 2715 @using Dynamicweb.Rapido.Blocks 2716 2717 @{ 2718 BlocksPage snippetsCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); 2719 2720 snippetsCheckoutPage.Add("CheckoutBottomSnippets", new Block 2721 { 2722 Id = "CartAddressesJavascript", 2723 SortId = 50, 2724 Template = RenderCartAddressesJavascript() 2725 }); 2726 } 2727 2728 @helper RenderCartAddressesJavascript() 2729 { 2730 <script> 2731 function resetStateField(stateFieldId) { 2732 let stateField = document.getElementById(stateFieldId); 2733 if (stateField) { 2734 stateField.value = ""; 2735 let disabledOption = stateField.querySelector("option:checked"); 2736 if (disabledOption) { 2737 disabledOption.disabled = false; 2738 disabledOption.removeAttribute("disabled"); 2739 } 2740 } 2741 } 2742 2743 document.addEventListener("DOMContentLoaded", function () { 2744 regionLabels.InitDictionary({ 2745 "CA": "@Translate("Province")", 2746 "US": "@Translate("State")" 2747 }); 2748 regionLabels.LocalizeRegionLabels("EcomOrderCustomerRegion", "EcomOrderCustomerCountry"); 2749 regionLabels.LocalizeRegionLabels("EcomOrderDeliveryRegion", "EcomOrderDeliveryCountry"); 2750 }); 2751 </script> 2752 } 2753 2754 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2755 @using Dynamicweb.Core 2756 @using System 2757 @using System.Web 2758 @using System.Collections.Generic 2759 @using Dynamicweb.Rapido.Blocks 2760 @using Dynamicweb.Ecommerce.Orders 2761 2762 @{ 2763 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2764 2765 BlocksPage googleImpressionsPage = BlocksPage.GetBlockPage("CheckoutPage"); 2766 2767 Block googleImpressionsBlock = new Block() 2768 { 2769 Id = "GoogleImpressionsBlock", 2770 SortId = 10, 2771 Template = RenderScript() 2772 }; 2773 2774 if (useGoogleTagManager) 2775 { 2776 googleImpressionsPage.Add("CheckoutBottomSnippets", googleImpressionsBlock); 2777 } 2778 } 2779 2780 @helper RenderScript() 2781 { 2782 var currentStep = 1; 2783 2784 foreach (LoopItem step in GetLoop("StepButtons")) 2785 { 2786 if (step.GetBoolean("Step.Current")) 2787 { 2788 currentStep = step.GetInteger("Step.Number"); 2789 break; 2790 } 2791 } 2792 <script> 2793 dataLayer.push({ 2794 "event": "checkout", 2795 "ecommerce": { 2796 "currencyCode": "@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code", 2797 "checkout": { 2798 "actionField": {"step": @currentStep}, 2799 "products": [ 2800 @foreach (LoopItem orderline in GetLoop("OrderLines").Where(o => o.GetBoolean("Ecom:Order:OrderLine.IsProduct") == true).ToList()) 2801 { 2802 var groupObject = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(orderline.GetString("Ecom:Product.PrimaryOrFirstGroupID")); 2803 <text> 2804 { 2805 "name": "@orderline.GetString("Ecom:Order:OrderLine.ProductName")", 2806 "id": "@orderline.GetString("Ecom:Product.ID")", 2807 "price": "@orderline.GetDouble("Ecom:Order:OrderLine.UnitPrice.Price")", 2808 "brand": "@orderline.GetString("Ecom:Product:Field.brand.Value")", 2809 "category": "@(groupObject != null ? groupObject.Name : "")", 2810 "variant": "@orderline.GetString("Ecom:Order:OrderLine.ProductVariantID")", 2811 "quantity": @orderline.GetInteger("Ecom:Order:OrderLine.Quantity") 2812 }, 2813 </text> 2814 } 2815 ] 2816 } 2817 } 2818 }); 2819 </script> 2820 } 2821 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2822 @using Dynamicweb.Core 2823 @using System 2824 @using System.Web 2825 @using System.Collections.Generic 2826 @using Dynamicweb.Rapido.Blocks 2827 2828 @{ 2829 var DistributorOrderRouter = GetString("DistributorOrderRouter"); 2830 } 2831 2832 @{ 2833 BlocksPage customBlocksPage = BlocksPage.GetBlockPage("CheckoutPage"); 2834 Block CustomOrderline = new Block() 2835 { 2836 Id = "CartOrderlineTemplate", 2837 SortId = 20, 2838 Template = RenderCartOrderlineTemplateCustom() 2839 }; 2840 customBlocksPage.ReplaceBlock(CustomOrderline); 2841 2842 var ShippingAddressBody = customBlocksPage.GetBlockById("ShippingAddressBody"); 2843 if (ShippingAddressBody != null) 2844 { 2845 if (checkoutPageType != "multistep") 2846 { 2847 2848 Block CommentCustom = new Block() 2849 { 2850 Id = "CommentTemplate", 2851 SortId = 50, 2852 Template = RenderCartComment() 2853 }; 2854 2855 2856 customBlocksPage.Add("ShippingAddressBody", CommentCustom); 2857 } 2858 if (checkoutPageType == "multistep") 2859 { 2860 if (GetString("CartV2.CurrentStepButtonName") == "CartV2.GotoStep1") 2861 { 2862 Block CommentCustom = new Block() 2863 { 2864 Id = "CommentTemplate", 2865 SortId = 50, 2866 Template = RenderCartComment() 2867 }; 2868 customBlocksPage.Add("ShippingAddressBody", CommentCustom); 2869 } 2870 2871 } 2872 2873 } 2874 2875 2876 Block CustomContent = new Block() 2877 { 2878 Id = "CartContentTemplate", 2879 SortId = 20, 2880 Template = RenderCartContentTemplateCustom() 2881 }; 2882 customBlocksPage.ReplaceBlock(CustomContent); 2883 2884 2885 2886 2887 Block CustomDiscount = new Block() 2888 { 2889 Id = "CartOrderlineDiscountTemplate", 2890 SortId = 20, 2891 Template = RenderCartOrderlineDiscountTemplateCustom() 2892 }; 2893 customBlocksPage.ReplaceBlock(CustomDiscount); 2894 2895 Block acceptanceBlockCustom = new Block() 2896 { 2897 Id = "Acceptance", 2898 SortId = 10, 2899 Design = new Design 2900 { 2901 RenderType = RenderType.Column, 2902 Size = "12" 2903 }, 2904 BlocksList = new List<Block> 2905 { 2906 new Block { 2907 Id = "AcceptanceBody", 2908 SortId = 10, 2909 Template = RenderAcceptanceCustom() 2910 } 2911 } 2912 }; 2913 customBlocksPage.ReplaceBlock(acceptanceBlockCustom); 2914 2915 Block reviewOrderFooterBlockCustom = new Block() 2916 { 2917 Id = "ReviewOrderFooter", 2918 SortId = 20, 2919 Template = RenderReviewOrderFooterCustom() 2920 }; 2921 customBlocksPage.ReplaceBlock(reviewOrderFooterBlockCustom); 2922 if (checkoutPageType == "quote") 2923 { 2924 Block reviewOrderFooterBlockCustomQuote = new Block() 2925 { 2926 Id = "ReviewOrderFooter", 2927 SortId = 20, 2928 Template = RenderReviewOrderFooterQuoteCustom() 2929 }; 2930 customBlocksPage.ReplaceBlock(reviewOrderFooterBlockCustomQuote); 2931 } 2932 2933 2934 } 2935 2936 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2937 @using Dynamicweb 2938 @using Dynamicweb.Core 2939 @using System.Collections; 2940 @using System 2941 @using System.Web 2942 @using System.Linq; 2943 @using System.Collections.Generic 2944 @using Dynamicweb.Rapido.Blocks 2945 @using Dynamicweb.Rapido.Blocks.Components 2946 @using Dynamicweb.Rapido.Blocks.Components.General 2947 2948 @helper RenderCartOrderlineTemplateCustom() 2949 { 2950 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 2951 int quotesCartPageId = GetPageIdByNavigationTag("QuotesCartPage"); 2952 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2953 string pageUrlN = GetPageIdByNavigationTag("GetUserInfo").ToString(); 2954 string feedFullUrlN = "Default.aspx?ID=" + pageUrlN; 2955 var userCode = GetString("UserManagement:User.Item.Code"); 2956 var errorLoopCount = GetLoop("ValidationErrors").Where(x => x.GetString("Ecom:Cart.ValidationError.FieldName") == "OrderlineError").Count(); 2957 DateTime userExpireDate = GetDate("UserManagement:User.Item.CodeExpire"); 2958 var exDate = userExpireDate.ToString("yyyy-MM-dd"); 2959 var date = GetGlobalValue("Global:Server.Date.GeneralDate"); 2960 DateTime dt = Convert.ToDateTime(date); 2961 var currentday = dt.ToString("yyyy-MM-dd"); 2962 var currentUser = GetInteger("UserManagement:User.ID").ToString(); 2963 string cartFeedPageIdCustom = GetPageIdByNavigationTag("MiniCartFeed").ToString(); 2964 if (!string.IsNullOrWhiteSpace(GetString("Ecom:OrderContext.ID"))) 2965 { 2966 cartFeedPageIdCustom += "&OrderContext=" + GetString("Ecom:OrderContext.ID"); 2967 } 2968 2969 @* Template for the orderlines *@ 2970 2971 <script id="CartOrderline" type="text/x-template"> 2972 2973 {{#unless isEmpty}} 2974 <tr id="Orderline{{id}}" class="cart-orderline"> 2975 <td class="cart-orderline__cell cart-table__image u-hidden-xs u-hidden-xxs dw-mod"> 2976 <div class="cart-orderline__cell__block {{hideimage}} dw-mod"> 2977 @Render(new Image { Path = "{{image}}", Title = "{{name}} {{variantname}}", ImageDefault = new ImageSettings { Width = 60, Height = 60, Crop = 5 } }) 2978 </div> 2979 </td> 2980 <td class="cart-orderline__cell u-va-middle dw-mod" title="{{name}} {{variantname}}"> 2981 <a href="{{link}}" class="u-color-inherit cart-orderline__name">{{name}}</a> 2982 {{#if productnumber}} 2983 <div class="cart-orderline__cell__block item-number dw-mod">#{{productnumber}}</div> 2984 {{/if}} 2985 {{#if variantname}} 2986 <div class="cart-orderline__cell__block item-number dw-mod">{{variantname}}</div> 2987 {{/if}} 2988 {{#if unitname}} 2989 <div class="cart-orderline__cell__block item-number dw-mod">{{unitname}}</div> 2990 {{/if}} 2991 2992 2993 </td> 2994 <td class="cart-orderline__cell u-ta-right u-hidden-xs u-hidden-xxs dw-mod" width="120"> 2995 {{#if pointsTotal}} 2996 <span class="u-color--loyalty-points">{{pointPrice}}</span> @Translate("points") 2997 {{else}} 2998 {{unitprice}} 2999 {{/if}} 3000 </td> 3001 3002 @if (!Dynamicweb.Ecommerce.Common.Context.Cart.IsQuote) 3003 { 3004 <td class="cart-orderline__cell u-ta-right dw-mod" colspan="2"> 3005 @Render(new NumberField 3006 { 3007 Id = "Quantity_{{orderLineId}}", 3008 Min = 1, 3009 OnChange = "Cart.ChangeQuantity('" + cartFeedPageIdCustom + "', '{{orderLineId}}', this.value)", 3010 Name = "QuantityOrderLine{{orderLineId}}", 3011 Value = "{{quantity}}", 3012 CssClass = "u-w80px", 3013 ActionButton = new Button 3014 { 3015 ButtonType = ButtonType.Button, 3016 ButtonLayout = ButtonLayout.Clean, 3017 OnClick = "{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}} Cart.UpdateCart(null, '/Default.aspx?ID=" + cartFeedPageIdCustom + "', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);", 3018 Icon = new Icon { Prefix = "fas", Name = "fa-times", LabelPosition = IconLabelPosition.After } 3019 } 3020 }) 3021 </td> 3022 } 3023 else 3024 { 3025 <td class="cart-orderline__cell u-ta-right dw-mod" colspan="2"> 3026 @Render(new HiddenField { Id = "Quantity_{{orderLineId}}", Name = "QuantityOrderLine{{orderLineId}}", Value = "{{quantity}}" }) 3027 <div class="u-w80px u-no-margin">{{quantity}}</div> 3028 </td> 3029 } 3030 3031 <td class="cart-orderline__cell u-ta-right dw-mod"> 3032 {{#if pointsTotal}} 3033 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 3034 {{else}} 3035 <div>{{totalprice}}</div> 3036 {{/if}} 3037 @if (!Dynamicweb.Ecommerce.Common.Context.Cart.IsQuote) 3038 { 3039 <text> 3040 {{#if canBePurchasedWithPoints}} 3041 @Render(new Button { Title = Translate("Use") + " {{pointPrice}} " + Translate("points"), ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.None, CssClass = "btn btn--loyalty-points btn--sm u-no-margin", OnClick = "Cart.BuyForPoints('" + GetGlobalValue("Global:Page.ID") + "', '" + cartFeedPageIdCustom + "', '{{orderLineId}}', '{{id}}', '{{variantId}}');", Icon = new Icon { Prefix = "far", Name = "fa-tag", LabelPosition = IconLabelPosition.After } }) 3042 {{/if}} 3043 </text> 3044 } 3045 </td> 3046 </tr> 3047 {{/unless}} 3048 <tr class="{{hideBomItems}}"> 3049 <td class="cart-table__image u-hidden-xs u-hidden-xxs dw-mod"><div class="{{hideimage}}"></div></td> 3050 <td colspan="5" class="u-no-padding"> 3051 <table class="u-no-margin u-color-light-gray--bg"> 3052 <tbody> 3053 {{#BomItems}} 3054 <tr> 3055 <td class="cart-table__image u-hidden-xs u-hidden-xxs dw-mod"> 3056 @Render(new Image { Path = "{{image}}", Title = "{{name}} {{variantname}}", ImageDefault = new ImageSettings { Width = 60, Height = 60, Crop = 5 } }) 3057 </td> 3058 <td title="{{name}} {{variantname}}"> 3059 <a href="{{link}}" class="u-color-inherit dw-mod">{{name}}</a> 3060 {{#if productnumber}} 3061 <div class="item-number dw-mod">#{{productnumber}}</div> 3062 {{/if}} 3063 {{#if variantname}} 3064 <div class="item-number dw-mod">{{variantname}}</div> 3065 {{/if}} 3066 {{#if unitname}} 3067 <div class="item-number dw-mod">{{unitname}}</div> 3068 {{/if}} 3069 </td> 3070 <td class="u-hidden-xs u-hidden-xxs">&nbsp;</td> 3071 <td>{{quantity}}</td> 3072 <td>&nbsp;</td> 3073 <td class="cart-table__price u-ta-right dw-mod">&nbsp;</td> 3074 </tr> 3075 {{/BomItems}} 3076 </tbody> 3077 </table> 3078 </td> 3079 </tr> 3080 </script> 3081 3082 } 3083 @helper RenderCartContentTemplateCustom() 3084 { 3085 BlocksPage customBlocksPageOrder = BlocksPage.GetBlockPage("CheckoutPage"); 3086 List<Block> subBlocksCustom = customBlocksPageOrder.GetBlockListById("ReviewOrder").OrderBy(item => item.SortId).ToList(); 3087 3088 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 3089 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 3090 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(GetString("Ecom:Order.ID")); 3091 bool isPricesWithVATEnabled = Converter.ToBoolean(Pageview.Area.EcomPricesWithVat); 3092 int cartFeedPageIdCustom; 3093 cartFeedPageIdCustom = GetPageIdByNavigationTag("MiniCartFeed"); 3094 3095 <script id="CartContent" type="text/x-template"> 3096 3097 {{#.}} 3098 @if (useGoogleTagManager) 3099 { 3100 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 3101 } 3102 3103 <div class="card-header u-color-light--bg dw-mod"> 3104 @Render(new Heading { Title = Translate("Review order") + "({{numberofproducts}})", Level = 3, Icon = new Icon { Prefix = "fas", Name = "fa-list-ul", LabelPosition = IconLabelPosition.After } }) 3105 </div> 3106 3107 <div class="card u-color-light--bg u-no-padding--xs dw-mod"> 3108 3109 {{#unless orderIsAuthenticatedClean}} 3110 <input type="text" id="OrderIsAuthenticated" name="OrderIsAuthenticated" value="no" style="display:none"> 3111 <input type="checkbox" id="isAuthenticated" name="OrderIsAuthenticated" style="display:none"> 3112 {{else}} 3113 <input type="text" id="OrderIsAuthenticated" name="OrderIsAuthenticated" value="yes" style="display:none"> 3114 <input type="checkbox" id="isAuthenticated" checked="checked" name="OrderIsAuthenticated" style="display:none"> 3115 {{/unless}} 3116 {{#unless isEmpty}} 3117 {{#unless notRequireAuthorization}} 3118 {{#unless orderIsAuthenticatedClean}} 3119 <div class="grid "> 3120 <div class="grid__col-xs-12 grid__col-sm-6 autorization-code"> 3121 <div class="alert-box u-color-danger txt-small u-margin-bottom">{{orderIsAuthenticatedError}}</div> 3122 <input id="{{AuthorizationCodeName}}" name="{{AuthorizationCodeName}}" class="u-full-width dw-mod" value="{{AuthorizationCode}}" placeholder=" @Translate("Enter your code")"/> 3123 </div> 3124 </div> 3125 {{/unless}} 3126 {{/unless}} 3127 <table class="table cart-table dw-mod"> 3128 <tbody id="OrderLines"> 3129 {{#OrderLines}} 3130 {{> (lookup . 'template') }} 3131 {{/OrderLines}} 3132 </tbody> 3133 </table> 3134 {{/unless}} 3135 <div class="grid u-border-top"> 3136 <div class="grid__col-sm-6"> 3137 @if (Dynamicweb.Security.Licensing.LicenseManager.LicenseHasFeature("LoyaltyPoints") && !string.IsNullOrWhiteSpace(GetGlobalValue("Global:Extranet.UserName"))) 3138 { 3139 <text> 3140 {{#if userPoints}} 3141 <div class="u-border u-border-color--loyalty-points u-padding--lg u-full-height"> 3142 @Render(new Heading { Title = Translate("Your point balance"), Level = 3 }) 3143 <div class="u-font-size--lg u-margin-bottom"> 3144 <span class="u-color--loyalty-points">{{userPoints}}</span> @Translate("points") 3145 </div> 3146 <div>@Translate("On this order you will use"): <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points")</div> 3147 </div> 3148 {{/if}} 3149 </text> 3150 } 3151 </div> 3152 3153 <div class="grid__col-sm-6"> 3154 @if (GetLoop("DWExtranetSecondaryUsers").Count > 0 || !string.IsNullOrWhiteSpace(GetGlobalValue("Global:Extranet.SecondaryUser.UserID"))) 3155 { 3156 <div class="grid"> 3157 <div class="grid__col-xs-12 alert-box u-color-danger txt-small u-hidden" id="error-discount">@Translate("Allowing only decimals numbers")</div> 3158 <input type="text" onchange="isDecimalsThis(this)" onkeyup="isDecimalsThis(this);" id="OrderDiscountPercentage" name="OrderDiscountPercentage" class="orderDiscount u-no-margin u-margin-top grid__col-lg-3 grid__col-md-3 grid__col-sm-3 grid__col-xs-5" value="" /> 3159 <select id="discountSelect" name="discountSelect" class="u-no-margin grid__col-lg-5 u-margin-top grid__col-md-5 grid__col-sm-5 grid__col-xs-6-auto u-no-padding " onchange="changeDiscount(this)"> 3160 <option value="OrderDiscountPercentage">@Translate("Percentage")</option> 3161 <option value="OrderDiscount">@Translate("Fixed Price")</option> 3162 <select> 3163 <button id="discountBtn" onclick="HandlebarsBolt.UpdateContent('Cart', '/Default.aspx?ID=@cartFeedPageIdCustom&CartCmd=setdiscount&OrderDiscountPercentage='+ document.getElementById('OrderDiscountPercentage').value);return false;" class="u-margin-top grid__col-lg-3 grid__col-md-3 grid__col-sm-3 grid__col-xs-12-auto btn--condensed u-no-margin btn btn--primary dw-mod u-pull--right disabled" id="addDiscount">@Translate("Add discount")</button> 3164 </div> 3165 3166 } 3167 3168 @if (!pointShop) 3169 { 3170 <text> 3171 {{#unless hideSubTotal}} 3172 <div> 3173 <div class="cart-summary__subtotals dw-mod">@Translate("Subtotal")</div> 3174 <div class="cart-summary__subtotals u-pull--right dw-mod"> 3175 @if (hasTaxSettings) 3176 { 3177 <text>{{subtotalpricewithouttaxes}}</text> 3178 } 3179 else 3180 { 3181 <text>{{subtotalprice}}</text> 3182 } 3183 </div> 3184 </div> 3185 {{/unless}} 3186 </text> 3187 <text> 3188 {{#unless hidePaymentfee}} 3189 <div> 3190 <div class="cart-summary__info dw-mod">@Render(new Icon { Prefix = "fas", Name = "fa-credit-card", Label = "{{paymentmethod}}", LabelPosition = IconLabelPosition.After })</div> 3191 <div class="cart-summary__info u-pull--right dw-mod">{{paymentfee}}</div> 3192 </div> 3193 {{/unless}} 3194 </text> 3195 } 3196 {{#unless hideShippingfee}} 3197 <div> 3198 <div class="cart-summary__info dw-mod">@Render(new Icon { Prefix = "fas", Name = "fa-truck", Label = "{{shippingmethod}}", LabelPosition = IconLabelPosition.After })</div> 3199 <div class="cart-summary__info u-pull--right dw-mod">{{shippingfee}}</div> 3200 </div> 3201 {{#unless notTxtForShippingFree}} 3202 <div> 3203 <div class="cart-summary__info dw-mod"><span class="txt-small">@Translate("Free shipping - Buy for additional") {{aditionalPriceForFreeShipping}}</span> </div> 3204 <div class="cart-summary__info u-pull--right dw-mod"></div> 3205 </div> 3206 {{/unless}} 3207 {{/unless}} 3208 {{#if hasTaxSettings}} 3209 <div> 3210 <div class="cart-summary__info dw-mod">@Render(new Icon { Prefix = "fas", Name = "fa-hand-holding-usd", Label = Translate("Sales Tax"), LabelPosition = IconLabelPosition.After })</div> 3211 <div class="cart-summary__info u-pull--right dw-mod">{{totaltaxes}}</div> 3212 </div> 3213 {{/if}} 3214 @if (Pageview.User != null && Dynamicweb.Security.Licensing.LicenseManager.LicenseHasFeature("LoyaltyPoints")) 3215 { 3216 <text> 3217 {{#if earnings}} 3218 <div> 3219 <div class="cart-summary__info dw-mod">@Translate("Earnings")</div> 3220 <div class="cart-summary__info u-pull--right dw-mod"><span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")</div> 3221 </div> 3222 {{/if}} 3223 </text> 3224 } 3225 <div class="cart-summary__totals-container dw-mod"> 3226 <div class="cart-summary__totals dw-mod">@Translate("Total")</div> 3227 <div class="cart-summary__totals u-pull--right dw-mod"> 3228 @if (pointShop) 3229 { 3230 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points") 3231 } 3232 else 3233 { 3234 <text>{{totalprice}}</text> 3235 } 3236 </div> 3237 </div> 3238 @if (!pointShop && !hasTaxSettings) 3239 { 3240 <div class="u-ta-right"> 3241 <small class="cart-summary__info dw-mod">@Translate("VAT"):</small> 3242 <small class="cart-summary__info dw-mod">{{totalvat}}</small> 3243 </div> 3244 3245 if (isPricesWithVATEnabled) 3246 { 3247 <div class="u-ta-right"> 3248 <small class="cart-summary__info dw-mod">@Translate("Total price without VAT"):</small> 3249 <small class="cart-summary__info dw-mod">{{totalPriceWithoutVat}}</small> 3250 </div> 3251 } 3252 else 3253 { 3254 <div class="u-ta-right"> 3255 <small class="cart-summary__info dw-mod">@Translate("Total price with VAT"):</small> 3256 <small class="cart-summary__info dw-mod">{{totalPriceWithVat}}</small> 3257 </div> 3258 } 3259 } 3260 {{#if showCheckoutDisclaimer}} 3261 <div class="u-ta-right"> 3262 <small>{{checkoutDisclaimer}}</small> 3263 </div> 3264 {{/if}} 3265 </div> 3266 </div> 3267 3268 <div class="u-margin-bottom--lg"> 3269 <div id="errorCode"> 3270 3271 </div> 3272 @foreach (LoopItem error in GetLoop("ValidationErrors")) 3273 { 3274 @Render(new NotificationMessage { Message = error.GetString("Ecom:Cart.ValidationError.ErrorMessage"), MessageType = NotificationMessageType.Error }) 3275 } 3276 </div> 3277 </div> 3278 {{/.}} 3279 </script> 3280 3281 } 3282 @helper RenderCartOrderlineDiscountTemplateCustom() 3283 { 3284 <script id="CartOrderlineDiscount" type="text/x-template"> 3285 <tr class="table__row--no-border discount-row"> 3286 <td class="cart-table__image dw-mod"> 3287 {{#unless notDiscountImage}} 3288 <img src="{{{image}}}"> 3289 {{/unless}} 3290 </td> 3291 <td colspan="3">{{name}}</td> 3292 <td class="u-hidden-xs u-hidden-xxs">&nbsp;</td> 3293 <td class="cart-table__price u-ta-right dw-mod">{{totalprice}}</td> 3294 </tr> 3295 </script> 3296 } 3297 @helper RenderCartComment() 3298 { 3299 var cartFeedPageIdCustom = GetPageIdByNavigationTag("MiniCartFeed"); 3300 <div class="grid__col-12"> 3301 <div class="js-handlebars-root" id="CartComment" data-template="CartCommentCustom" data-json-feed="/Default.aspx?ID=@cartFeedPageIdCustom"></div> 3302 </div> 3303 3304 <script id="CartCommentCustom" type="text/x-template"> 3305 {{#.}} 3306 <div class=""> 3307 <div class="grid"> 3308 <div class="grid__col-12 grid__col--line-top"></div> 3309 </div> 3310 {{#unless hideComment}} 3311 <div class="grid__cell u-padding--xs"> 3312 @Render(new TextareaField { Rows = 3, Placeholder = Translate("Enter comment"), Name = "EcomOrderCustomerComment", Id = "EcomOrderCustomerComment", Value = "{{comment}}" }) 3313 </div> 3314 {{/unless}} 3315 </div> 3316 {{/.}} 3317 </script> 3318 } 3319 @helper RenderReviewOrderFooterCustom() 3320 { 3321 int quotesCartPageId = GetPageIdByNavigationTag("QuotesCartPage"); 3322 var emptyOrContinueBtn = Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetList("CheckoutPage") != null ? Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetList("CheckoutPage").SelectedValue : "empty"; 3323 string reviewOrderType = checkoutPageType ?? "onestep"; //The "checkoutPageType" comes from the main template for the cart page 3324 int cartFeedPageIdCustom = GetPageIdByNavigationTag("MiniCartFeed"); 3325 var paymentCountryCode = GetString("Ecom:Order.Customer.Country.Code"); 3326 var shippingCountryCode = GetString("Ecom:Order.Delivery.Country.Code"); 3327 var paymentCountryIsSupported = string.IsNullOrEmpty(paymentCountryCode) || GetLoop("Countries").Any(country => (country.GetString("Ecom:Country.Code2") == paymentCountryCode)); 3328 var shippingCountryIsSupported = string.IsNullOrEmpty(shippingCountryCode) ? paymentCountryIsSupported : GetLoop("Countries").Any(country => (country.GetString("Ecom:Country.Code2") == shippingCountryCode)); 3329 3330 bool canCompleteOrderCustom = paymentCountryIsSupported && shippingCountryIsSupported; 3331 <div class="grid"> 3332 <div class="grid__col-12 grid__col--line-top"></div> 3333 </div> 3334 3335 <div class="grid__cell-footer"> 3336 <div class="grid__cell u-padding--xs"> 3337 <div class="u-pull--right"> 3338 @Render(new Button 3339 { 3340 ButtonType = ButtonType.Submit, 3341 ButtonLayout = ButtonLayout.Primary, 3342 CssClass = "btn--condensed u-pull--right u-no-margin", 3343 Title = Translate("Go to checkout"), 3344 Id = GetString("CartV2.NextStepButtonName"), 3345 OnClick = "Buttons.LockButton(event, true)", 3346 Disabled = !canCompleteOrderCustom || !Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideTermsAndConditions"), 3347 Name = GetString("CartV2.NextStepButtonName") 3348 }) 3349 </div> 3350 <div class="u-pull--left"> 3351 @if (emptyOrContinueBtn == "empty") 3352 { 3353 @Render(new Button { ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.Secondary, CssClass = "btn--condensed u-pull--left u-no-margin", Title = Translate("Empty cart"), OnClick = "googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);" }) 3354 3355 } 3356 else 3357 { 3358 @Render(new Button { ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.Secondary, CssClass = "btn--condensed u-pull--left u-no-margin", Title = Translate("Continue shopping"), OnClick = "GoToProductPage();" }) 3359 3360 } 3361 </div> 3362 @if (!Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideQuotesCartLink") && !string.IsNullOrWhiteSpace(GetGlobalValue("Global:Extranet.UserName"))) 3363 { 3364 <div class="u-pull--right"> 3365 @Render(new Link { Href = "/Default.aspx?ID=" + quotesCartPageId, ButtonLayout = ButtonLayout.Link, CssClass = "btn--condensed u-no-margin u-margin-right--lg u-no-margin--xs", Title = Translate("Create quote request") }) 3366 </div> 3367 } 3368 </div> 3369 </div> 3370 3371 3372 3373 } 3374 3375 @helper RenderReviewOrderFooterQuoteCustom() 3376 { 3377 string submitButtonTitle = Pageview.Device.ToString() == "Mobile" ? Translate("Submit") : Translate("Submit quote request"); 3378 3379 <div class="grid"> 3380 <div class="grid__col-12 grid__col--line-top"></div> 3381 </div> 3382 3383 <div class="grid__cell-footer"> 3384 <div class="grid__cell u-padding--xs"> 3385 <div class="u-pull--right"> 3386 @Render(new Button 3387 { 3388 ButtonType = ButtonType.Submit, 3389 ButtonLayout = ButtonLayout.Primary, 3390 CssClass = "btn--condensed u-pull--right u-no-margin", 3391 Title = submitButtonTitle, 3392 Id = GetString("CartV2.NextStepButtonName"), 3393 OnClick = "Buttons.LockButton(event, true)", 3394 Name = GetString("CartV2.NextStepButtonName") 3395 }) 3396 </div> 3397 <div class="u-pull--left"> 3398 @Render(new Button { ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.Secondary, CssClass = "btn--condensed u-pull--left u-no-margin", OnClick = "googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);", Title = Translate("Empty cart") }) 3399 </div> 3400 </div> 3401 </div> 3402 } 3403 <script type="text/javascript"> 3404 function getCook(cookiename) { 3405 // Get name followed by anything except a semicolon 3406 var cookiestring = RegExp(cookiename + "=[^;]+").exec(document.cookie); 3407 // Return everything after the equal sign, or an empty string if the cookie name not found 3408 return decodeURIComponent(!!cookiestring ? cookiestring.toString().replace(/^[^=]+./, "") : ""); 3409 } 3410 function GoToProductPage() { 3411 var cookieValue = getCook('ProductLink'); 3412 if (document.cookie.indexOf("ProductLink=") >= 0) { 3413 location.href = cookieValue; 3414 3415 } 3416 else{ 3417 location.href = "/Default.aspx?ID=@GetPageIdByNavigationTag("ProductsPage")"; 3418 } 3419 3420 } 3421 </script> 3422 <script type="text/javascript"> 3423 isDecimalsThis=function(input){ 3424 let str = input.value 3425 const regExp = /^\d*(\.)?(\d{0,2})?$/ 3426 status = regExp.test(str) ? 'valid' : 'invalid' 3427 if (status === "valid") { 3428 document.getElementById("discountBtn").classList.remove("disabled") 3429 document.getElementById("error-discount").classList.add("u-hidden"); 3430 } 3431 else { 3432 document.getElementById("discountBtn").classList.add("disabled"); 3433 document.getElementById("error-discount").classList.remove("u-hidden"); 3434 } 3435 3436 console.log(status + ' : ' + input.value) 3437 3438 } 3439 changeDiscount = function (l) { 3440 let discoutnBtn = document.getElementById("discountBtn"); 3441 let selectElement = l.value; 3442 let inputElement = document.getElementsByClassName("orderDiscount")[0]; 3443 inputElement.setAttribute("id", selectElement); 3444 inputElement.setAttribute("name", selectElement); 3445 discoutnBtn.setAttribute("onclick", "HandlebarsBolt.UpdateContent('Cart', '/Default.aspx?ID=@GetPageIdByNavigationTag("MiniCartFeed")&CartCmd=setdiscount&" + selectElement + "='+ document.getElementById('" + selectElement+"').value);return false;") 3446 3447 } 3448 var getJSON = function (url, callback) { 3449 var xhr = new XMLHttpRequest(); 3450 xhr.open('GET', url, true); 3451 xhr.responseType = 'json'; 3452 xhr.onload = function () { 3453 var status = xhr.status; 3454 if (status === 200) { 3455 callback(null, xhr.response); 3456 } else { 3457 callback(status, xhr.response); 3458 } 3459 }; 3460 xhr.send(); 3461 }; 3462 3463 ValidationCode = function (l, e, id) { 3464 l.preventDefault() 3465 var selectForm = document.getElementById("OrderSubmit"); // Select the form by ID. 3466 3467 let elementname = e; 3468 let elementvalue = id; 3469 clearTimeout(updateDelay); 3470 3471 updateDelay = setTimeout(function () { 3472 const XHR = new XMLHttpRequest(), 3473 FD = new FormData(); 3474 FD.append(elementname, elementvalue); 3475 XHR.addEventListener('load', function (event) { 3476 //Success 3477 }); 3478 // Define what happens in case of error 3479 XHR.addEventListener(' error', function (event) { 3480 //Error 3481 }); 3482 XHR.open('POST', 'Default.aspx?ID=@GetPageIdByNavigationTag("MiniCartFeed")'); 3483 XHR.send(FD); 3484 3485 getJSON('/Default.aspx?ID=@GetPageIdByNavigationTag("MiniCartFeed")', 3486 function (err, data) { 3487 if (err !== null) { 3488 console.log('Something went wrong: ' + err); 3489 } else { 3490 3491 if (data[0].orderIsAuthenticatedClean === false) { 3492 HandlebarsBolt.UpdateContent('Cart', 3493 '/Default.aspx?ID=@GetPageIdByNavigationTag("MiniCartFeed")' + '&redirect=false', 3494 '/Default.aspx?ID=@GetPageIdByNavigationTag("MiniCartFeed")' + '&redirect=false', 3495 'CartContent', 'minimal'); 3496 } 3497 else { 3498 document.getElementById('OrderSubmit').dispatchEvent(new Event('submit')); 3499 document.getElementById('OrderSubmit').submit(); 3500 } 3501 } 3502 }) 3503 3504 3505 }, 100); 3506 3507 }; 3508 3509 3510 </script> 3511 3512 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3513 @using Dynamicweb 3514 @using Dynamicweb.Core 3515 @using System.Collections; 3516 @using System 3517 @using System.Web 3518 @using System.Linq; 3519 @using System.Collections.Generic 3520 @using Dynamicweb.Rapido.Blocks 3521 @using Dynamicweb.Rapido.Blocks.Components 3522 @using Dynamicweb.Rapido.Blocks.Components.General 3523 3524 3525 @helper RenderAcceptanceCustom() 3526 { 3527 if (GetBoolean("Ecom:Cart.UseNewsletterSubscription")) 3528 { 3529 @Render(new HiddenField { Name = "EcomOrderSubscribeToNewsletter" }) 3530 @Render(new CheckboxField { Name = "EcomOrderSubscribeToNewsletter", Id = "EcomOrderSubscribeToNewsletter", Label = Translate("Subscribe to newsletter") }) 3531 } 3532 3533 if (Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideTermsAndConditions")) 3534 { 3535 @Render(new HiddenField { Name = "EcomOrderCustomerAccepted", Id = "EcomOrderCustomerAccepted", Value = "1" }) 3536 } 3537 else 3538 { 3539 string termsPageIt = GetPageIdByNavigationTag("TermsAndConditions").ToString(); 3540 @Render(new CheckboxField { Name = "EcomOrderCustomerAccepted", Id = "EcomOrderCustomerAccepted", OnChange = "EnableCheckoutButton()", Label = Translate("I accept") + " <a href=\"/Default.aspx?ID=" + termsPageIt + "\">" + Translate("the terms and conditions") + "</a>", ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderCustomerAccepted.ErrorMessage") }) 3541 } 3542 <script type="text/javascript"> 3543 function EnableCheckoutButton() { 3544 var stepButtonId = document.getElementById("CartV2.GotoStep3") ? "CartV2.GotoStep3" : "CartV2.GotoStep1"; 3545 var stepButton = document.getElementById(stepButtonId); 3546 let isValid = true; 3547 3548 if (isValid) { 3549 if (document.getElementById("EcomOrderCustomerAccepted").checked) { 3550 3551 var elements = document.getElementsByClassName('error-input'); 3552 var i; 3553 for (i = 0; i < elements.length; i++) { 3554 var error = elements[i].dataset.error; 3555 var value = elements[i].value; 3556 if (value != "ok" || value == "") { 3557 isValid = false; 3558 console.log(elements[i].dataset.error) 3559 document.getElementById("errorCode").innerHTML += "<div class='field-error u-full-width dw-mod'>" + error + "</div>"; 3560 document.getElementById("EcomOrderCustomerAccepted").checked = true 3561 3562 } 3563 3564 3565 } 3566 3567 3568 if (isValid) { 3569 stepButton.disabled = false; 3570 stepButton.classList.remove('disabled'); 3571 } 3572 3573 } 3574 else { 3575 if (document.getElementById("errorCode")) { 3576 document.getElementById("errorCode").innerHTML = ""; 3577 } 3578 3579 stepButton.disabled = true; 3580 stepButton.classList.add('disabled'); 3581 } 3582 } 3583 3584 3585 3586 } 3587 3588 </script> 3589 } 3590 @if (checkoutPageType == "multistep") 3591 { 3592 3593 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3594 @using Dynamicweb.Core 3595 @using System 3596 @using System.Web 3597 @using System.Collections.Generic 3598 @using Dynamicweb.Rapido.Blocks 3599 3600 @{ 3601 BlocksPage stepNavigationCheckoutPageCustom = BlocksPage.GetBlockPage("CheckoutPage"); 3602 3603 Block checkoutStepNavigationCustom = new Block() 3604 { 3605 Id = "StepNavigation", 3606 SortId = 50, 3607 Template = RenderStepNavigationCustom(), 3608 Design = new Design 3609 { 3610 RenderType = RenderType.Column, 3611 Size = "12" 3612 } 3613 3614 }; 3615 stepNavigationCheckoutPageCustom.ReplaceBlock(checkoutStepNavigationCustom); 3616 } 3617 3618 @helper RenderStepNavigationCustom() 3619 { 3620 var paymentCountryCode = GetString("Ecom:Order.Customer.Country.Code"); 3621 var shippingCountryCode = GetString("Ecom:Order.Delivery.Country.Code"); 3622 var paymentCountryIsSupported = string.IsNullOrEmpty(paymentCountryCode) || GetLoop("Countries").Any(country => (country.GetString("Ecom:Country.Code2") == paymentCountryCode)); 3623 var shippingCountryIsSupported = string.IsNullOrEmpty(shippingCountryCode) ? paymentCountryIsSupported : GetLoop("Countries").Any(country => (country.GetString("Ecom:Country.Code2") == shippingCountryCode)); 3624 var emptyOrContinueBtn = Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetList("CheckoutPage") != null ? Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetList("CheckoutPage").SelectedValue : "empty"; 3625 3626 var canCompleteOrder = paymentCountryIsSupported && shippingCountryIsSupported; 3627 3628 3629 int quotesCartPageId = GetPageIdByNavigationTag("QuotesCartPage"); 3630 int currentStep = 1; 3631 string disableNextButton = ""; 3632 string nextButtonName = Translate("Next"); 3633 3634 foreach (LoopItem step in GetLoop("StepButtons")) 3635 { 3636 if (step.GetBoolean("Step.Current")) 3637 { 3638 currentStep = step.GetInteger("Step.Number"); 3639 } 3640 3641 if (step.GetInteger("Step.Number") == currentStep + 1) 3642 { 3643 if (Pageview.Device.ToString() != "Mobile") 3644 { 3645 nextButtonName = Translate("Go to") + " " + step.GetString("Step.Name"); 3646 } 3647 else 3648 { 3649 nextButtonName = step.GetString("Step.Name"); 3650 } 3651 } 3652 } 3653 3654 if (currentStep == GetLoop("StepButtons").Count - 1) 3655 { 3656 disableNextButton = Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideTermsAndConditions") ? "" : "disabled"; //not disable button if terms are hidden 3657 nextButtonName = Translate("Confirm order"); 3658 } 3659 3660 if (currentStep > 1 && !canCompleteOrder) 3661 { 3662 disableNextButton = "disabled"; 3663 } 3664 bool RequireAuthorization = GetLoop("OrderLines").Any(x => x.GetBoolean("Ecom:Product:Field.RequireAuthorization")); 3665 <div class="card u-color-light--bg dw-mod"> 3666 @if (currentStep == 1) 3667 { 3668 <div class="u-pull--left"> 3669 @if (emptyOrContinueBtn == "empty") 3670 { 3671 @Render(new Button { ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.Secondary, CssClass = "btn--condensed u-pull--left u-no-margin", Title = Translate("Empty cart"), OnClick = "googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);" }) 3672 3673 } 3674 else 3675 { 3676 @Render(new Button { ButtonType = ButtonType.Button, ButtonLayout = ButtonLayout.Secondary, CssClass = "btn--condensed u-pull--left u-no-margin", Title = Translate("Continue shopping"), OnClick = "GoToProductPage();" }) 3677 3678 } 3679 </div> 3680 3681 } 3682 else 3683 { 3684 <div class="u-pull--left"> 3685 3686 <button type="submit" class="btn btn--secondary btn--condensed dw-mod u-pull--right u-no-margin" name="@GetString("CartV2.PreviousStepButtonName")" id="@GetString("CartV2.PreviousStepButtonName")"><i class="fas fa-angle-left"></i> @Translate("Back")</button> 3687 </div> 3688 } 3689 3690 <div class="u-pull--right"> 3691 @if (RequireAuthorization) 3692 { 3693 <button type="submit" class="btn btn--primary btn--condensed dw-mod u-pull--right u-no-margin @disableNextButton" name="@GetString("CartV2.NextStepButtonName")" id="@GetString("CartV2.NextStepButtonName")" @disableNextButton onclick="ValidationCode(event,'AuthorizationCode', document.getElementById('AuthorizationCode').value)">@nextButtonName <i class="fas fa-angle-right"></i></button> 3694 } 3695 else 3696 { 3697 <button type="submit" class="btn btn--primary btn--condensed dw-mod u-pull--right u-no-margin @disableNextButton" name="@GetString("CartV2.NextStepButtonName")" id="@GetString("CartV2.NextStepButtonName")" @disableNextButton >@nextButtonName <i class="fas fa-angle-right"></i></button> 3698 3699 } 3700 </div> 3701 3702 @if (!Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideQuotesCartLink") && !string.IsNullOrWhiteSpace(GetGlobalValue("Global:Extranet.UserName"))) 3703 { 3704 <div class="u-pull--right"> 3705 <a href="/Default.aspx?ID=@quotesCartPageId" class="btn btn--condensed btn--link dw-mod u-no-margin u-margin-right--lg u-no-margin--xs">@Translate("Create quote request")</a> 3706 </div> 3707 } 3708 </div> 3709 } 3710 <script type="text/javascript"> 3711 function getCook(cookiename) { 3712 // Get name followed by anything except a semicolon 3713 var cookiestring = RegExp(cookiename + "=[^;]+").exec(document.cookie); 3714 // Return everything after the equal sign, or an empty string if the cookie name not found 3715 return decodeURIComponent(!!cookiestring ? cookiestring.toString().replace(/^[^=]+./, "") : ""); 3716 } 3717 function GoToProductPage() { 3718 var cookieValue = getCook('ProductLink'); 3719 if (document.cookie.indexOf("ProductLink=") >= 0) { 3720 location.href = cookieValue; 3721 3722 } 3723 else{ 3724 location.href = "/Default.aspx?ID=@GetPageIdByNavigationTag("ProductsPage")"; 3725 } 3726 3727 } 3728 </script></text> 3729 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3730 @using Dynamicweb.Core 3731 @using System 3732 @using System.Web 3733 @using System.Linq 3734 @using System.Collections.Generic 3735 @using System.Text.RegularExpressions 3736 @using Dynamicweb.Extensibility 3737 @using Dynamicweb.Content 3738 @using Dynamicweb.Core 3739 @using Dynamicweb.Ecommerce.Orders 3740 @using Dynamicweb.Ecommerce.Orders.SalesDiscounts 3741 @using Dynamicweb.Rapido.Blocks 3742 @using Dynamicweb.Rapido.Blocks.Components 3743 @using Dynamicweb.Rapido.Blocks.Components.General 3744 3745 @{ 3746 BlocksPage staticSummaryCheckoutPageCustom = BlocksPage.GetBlockPage("CheckoutPage"); 3747 3748 Block staticSummaryCustom = new Block() 3749 { 3750 Id = "StaticSummary", 3751 SortId = 20, 3752 Design = new Design 3753 { 3754 RenderType = RenderType.Column, 3755 Size = "12" 3756 }, 3757 BlocksList = new List<Block> { 3758 new Block { 3759 Id = "StaticSummaryHeader", 3760 SortId = 10, 3761 Component = new Heading { Level = 3, Title = Translate("Summary") + " (" + GetString("Ecom:Order.OrderLines.TotalProductQuantity") + ")", Icon = new Icon { Prefix = "fas", Name = "fa-list-ul", LabelPosition = IconLabelPosition.After } }, 3762 Design = new Design { 3763 RenderType = RenderType.CardHeader, 3764 CssClass = "u-color-light--bg" 3765 } 3766 }, 3767 new Block { 3768 Id = "StaticSummaryBody", 3769 SortId = 20, 3770 Template = RenderStaticSummaryCustom(), 3771 Design = new Design { 3772 RenderType = RenderType.CardBody, 3773 CssClass = "u-color-light--bg u-no-padding--xs" 3774 } 3775 } 3776 } 3777 }; 3778 staticSummaryCheckoutPageCustom.ReplaceBlock(staticSummaryCustom); 3779 } 3780 3781 3782 @helper RenderStaticSummaryCustom() 3783 { 3784 int productCatalog = GetPageIdByNavigationTag("ProductsPage"); 3785 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(GetString("Ecom:Order.ID")); 3786 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 3787 bool isPricesWithVATEnabled = Converter.ToBoolean(Pageview.Area.EcomPricesWithVat); 3788 double shippingFeePrice = GetDouble("Ecom:Order.ShippingFee.Price"); 3789 double minPriceForFree = 0; 3790 double minPriceForFreeShip = 0; 3791 double aditionalPriceForFreeShipping = 0; 3792 double totalPriceWithoutFormated = GetDouble("Ecom:Order.Price.Price"); 3793 var shippingMethods = GetLoop("Shippingmethods"); 3794 var currency = Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency(); 3795 foreach (LoopItem shipping in shippingMethods) 3796 { 3797 3798 if (shipping.GetString("Ecom:Cart.Shippingmethod.Name") == GetString("Ecom:Order.ShippingMethod")) 3799 { 3800 minPriceForFree = shipping.GetDouble("Ecom:Cart.Shippingmethod.MinimumPriceForFreeFee.Price"); 3801 minPriceForFreeShip = minPriceForFree; 3802 if (shipping.GetDouble("Ecom:Cart.Shippingmethod.MinimumPriceForFreeFee.Price") > (totalPriceWithoutFormated - shippingFeePrice)) 3803 { 3804 aditionalPriceForFreeShipping = minPriceForFree - (totalPriceWithoutFormated - shippingFeePrice); 3805 3806 } 3807 3808 } 3809 } 3810 string cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed").ToString(); 3811 if (!String.IsNullOrWhiteSpace(GetString("Ecom:OrderContext.ID"))) 3812 { 3813 cartFeedPageId += "&OrderContext=" + GetString("Ecom:OrderContext.ID"); 3814 } 3815 <div class="js-handlebars-root" id="SummaryCart" data-template="CartOrderlineSummary" data-cart-id="@cartFeedPageId" data-json-feed="/Default.aspx?ID=@cartFeedPageId" data-preloader="minimal"> 3816 3817 3818 </div> 3819 <script id="CartOrderlineSummary" type="text/x-template"> 3820 {{#.}} 3821 <table class="table cart-table u-margin-bottom u-border-bottom dw-mod"> 3822 <tbody> 3823 {{#OrderLines}} 3824 {{> (lookup . 'template') }} 3825 {{/OrderLines}} 3826 3827 3828 </tbody> 3829 3830 </table> 3831 @if (!pointShop) 3832 { 3833 <text> 3834 {{#unless hideSubTotal}} 3835 <div class="u-padding-bottom u-padding-x"> 3836 <div class="cart-summary__subtotals dw-mod">@Translate("Subtotal") </div> 3837 <div class="cart-summary__subtotals u-pull--right dw-mod"> 3838 @if (hasTaxSettings) 3839 { 3840 <text> 3841 {{subtotalpricewithouttaxes}} 3842 </text> 3843 3844 } 3845 else 3846 { 3847 <text> 3848 {{subtotalprice}} 3849 </text> 3850 3851 } 3852 </div> 3853 </div> 3854 {{/unless}} 3855 </text> 3856 <text> 3857 {{#unless hidePaymentfee}} 3858 <div class="u-padding-bottom u-padding-x"> 3859 <div class="cart-summary__info dw-mod">@Render(new Icon { Prefix = "fas", Name = "fa-credit-card", Label = "{{paymentmethod}}", LabelPosition = IconLabelPosition.After })</div> 3860 <div class="cart-summary__info u-pull--right dw-mod">{{paymentfee}}</div> 3861 </div> 3862 {{/unless}} 3863 </text> 3864 } 3865 3866 {{#unless hideShippingfee}} 3867 <div class="u-padding-bottom u-padding-x"> 3868 <div class="cart-summary__info dw-mod">@Render(new Icon { Prefix = "fas", Name = "fa-truck", Label = "{{shippingmethod}}", LabelPosition = IconLabelPosition.After })</div> 3869 <div class="cart-summary__info u-pull--right dw-mod">{{shippingfee}}</div> 3870 </div> 3871 {{#unless notTxtForShippingFree}} 3872 <div class="u-padding-bottom u-padding-x"> 3873 <div class="cart-summary__info dw-mod"><span class="txt-small">@Translate("Free shipping - Buy for additional") {{aditionalPriceForFreeShipping}}</span> </div> 3874 <div class="cart-summary__info u-pull--right dw-mod"></div> 3875 </div> 3876 {{/unless}} 3877 {{/unless}} 3878 3879 3880 3881 {{#if hasTaxSettings}} 3882 <div class="u-padding-bottom u-padding-x"> 3883 <div class="cart-summary__info dw-mod">@Render(new Icon { Prefix = "fas", Name = "fa-hand-holding-usd", Label = Translate("Sales Tax"), LabelPosition = IconLabelPosition.After })</div> 3884 <div class="cart-summary__info u-pull--right dw-mod">{{totaltaxes}}</div> 3885 </div> 3886 3887 3888 {{/if}} 3889 3890 @if (Pageview.User != null && Dynamicweb.Security.Licensing.LicenseManager.LicenseHasFeature("LoyaltyPoints") && GetDouble("Ecom:Order.RewardTotalPoints") > 0) 3891 { 3892 <text> 3893 {{#if earnings}} 3894 <div class="u-padding-bottom u-padding-x"> 3895 <div class="cart-summary__info dw-mod">@Translate("Earnings")</div> 3896 <div class="cart-summary__info u-pull--right dw-mod"><span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")</div> 3897 </div> 3898 {{/if}} 3899 </text> 3900 3901 } 3902 3903 <div class="u-padding u-border-top"> 3904 <div class="cart-summary__totals dw-mod">@Translate("Total")</div> 3905 <div class="cart-summary__totals u-pull--right dw-mod">{{totalprice}}</div> 3906 </div> 3907 3908 @if (!pointShop && !hasTaxSettings) 3909 { 3910 <div class="u-ta-right u-padding-x"> 3911 <small class="cart-summary__info dw-mod">@Translate("VAT"):</small> 3912 <small class="cart-summary__info dw-mod">{{totalvat}}</small> 3913 </div> 3914 3915 if (isPricesWithVATEnabled) 3916 { 3917 <div class="u-ta-right u-padding-x"> 3918 <small class="cart-summary__info dw-mod">@Translate("Total price without VAT"):</small> 3919 <small class="cart-summary__info dw-mod">{{totalPriceWithoutVat}}</small> 3920 </div> 3921 } 3922 else 3923 { 3924 <div class="u-ta-right u-padding-x"> 3925 <small class="cart-summary__info dw-mod">@Translate("Total price with VAT"):</small> 3926 <small class="cart-summary__info dw-mod">{{totalPriceWithVat}}</small> 3927 </div> 3928 } 3929 } 3930 3931 {{#if showCheckoutDisclaimer}} 3932 <div class="u-ta-right"> 3933 <small class="u-full-width">{{checkoutDisclaimer}}</small> 3934 </div> 3935 {{/if}} 3936 3937 {{/.}} 3938 </script> 3939 <script id="CartOrderline" type="text/x-template"> 3940 {{#unless isEmpty}} 3941 <tr> 3942 <td class="u-w60px"> 3943 {{quantity}} x 3944 </td> 3945 <td title="{{name}} {{variantname}}"> 3946 <a href="{{link}}" class="u-color-inherit">{{name}}</a> 3947 <div>{{{variantname}}}</div> 3948 <div>{{unitname}}</div> 3949 </td> 3950 {{#if pointsTotal}} 3951 <td class="u-ta-right u-w120px"> 3952 <span class="u-color--loyalty-points">{{pointPrice}}</span> @Translate("points") 3953 </td> 3954 {{else}} 3955 3956 <td class="u-ta-right u-w120px">{{totalprice}}</td> 3957 {{/if}} 3958 </tr> 3959 <tr class="{{hideBomItems}}"> 3960 <td colspan="3" class="u-no-padding"> 3961 <table class="u-no-margin u-color-light-gray--bg"> 3962 <tbody> 3963 {{#BomItems}} 3964 <tr> 3965 <td class="u-w60px">{{quantity}} x</td> 3966 <td title="{{name}} {{variantname}}"> 3967 <a href="{{link}}">{{name}}</a> 3968 <div>{{variantname}}</div> 3969 <div>{{unitname}}</div> 3970 </td> 3971 </tr> 3972 {{/BomItems}} 3973 </tbody> 3974 </table> 3975 </td> 3976 </tr> 3977 {{/unless}} 3978 </script> 3979 <script id="CartOrderlineDiscount" type="text/x-template"> 3980 <tr class="table__row--no-border"> 3981 <td class="u-w60px"> 3982 {{#unless notDiscountImage}} 3983 <img src="{{{image}}}"> 3984 {{/unless}} 3985 </td> 3986 <td>{{name}}</td> 3987 <td class="cart-table__price u-ta-right dw-mod">{{totalprice}}</td> 3988 </tr> 3989 </script> 3990 3991 } 3992 </text> 3993 3994 } 3995 3996 3997 @helper RenderCheckoutForm() 3998 { 3999 List<Block> subBlocks = checkoutPage.GetBlockListById("CheckoutForm").OrderBy(item => item.SortId).ToList(); 4000 string pageId = GetGlobalValue("Global:Page.ID"); 4001 4002 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width"> 4003 <div class="center-container center-container--with-background-image dw-mod"> 4004 <div class="paragraph-container u-padding"> 4005 <form name="ordersubmit" id="OrderSubmit" method="post" action="/Default.aspx?ID=@pageId" autocomplete="off"> 4006 <div class="grid grid--external-bleed-x"> 4007 @RenderBlockList(subBlocks) 4008 </div> 4009 </form> 4010 </div> 4011 </div> 4012 </section> 4013 } 4014 4015 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 4016 @RenderBlockList(checkoutPage.BlocksRoot.BlocksList)
Cookies

This website uses cookies to track your behavior and to improve your experience on the site.