Cart

Error executing template "Designs/Rapido/eCom7/CartV2/Step/Custom__Cart.cshtml"
System.InvalidOperationException: Sequence contains no elements
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at CompiledRazorTemplates.Dynamic.RazorEngine_fea92431a4e5480a855a8df3908e1767.b__49_0(TextWriter __razor_helper_writer) in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\Custom__Cart.cshtml:line 2265
   at CompiledRazorTemplates.Dynamic.RazorEngine_fea92431a4e5480a855a8df3908e1767.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\Custom__Cart.cshtml:line 237
   at CompiledRazorTemplates.Dynamic.RazorEngine_fea92431a4e5480a855a8df3908e1767.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\Custom__Cart.cshtml:line 173
   at CompiledRazorTemplates.Dynamic.RazorEngine_fea92431a4e5480a855a8df3908e1767.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\Custom__Cart.cshtml:line 268
   at CompiledRazorTemplates.Dynamic.RazorEngine_fea92431a4e5480a855a8df3908e1767.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\Custom__Cart.cshtml:line 162
   at CompiledRazorTemplates.Dynamic.RazorEngine_fea92431a4e5480a855a8df3908e1767.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\Custom__Cart.cshtml:line 268
   at CompiledRazorTemplates.Dynamic.RazorEngine_fea92431a4e5480a855a8df3908e1767.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\Custom__Cart.cshtml:line 173
   at CompiledRazorTemplates.Dynamic.RazorEngine_fea92431a4e5480a855a8df3908e1767.Execute() in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\Custom__Cart.cshtml:line 3175
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Content 5 @using Dynamicweb.Core 6 @using Dynamicweb.Ecommerce.Orders 7 @using Dynamicweb.Ecommerce.Orders.SalesDiscounts 8 @using System 9 @using System.IO 10 @using Dynamicweb.Rapido.Blocks 11 12 13 @functions{ 14 BlocksPage checkoutPage = BlocksPage.GetBlockPage("CheckoutPage"); 15 string checkoutPageType = "onestep"; 16 } 17 18 @{ 19 string pageId = GetGlobalValue("Global:Page.ID"); 20 21 Block checkoutTopSnippets = new Block() 22 { 23 Id = "CheckoutTopSnippets", 24 SortId = 10 25 }; 26 checkoutPage.Add(checkoutTopSnippets); 27 28 Block checkoutForm = new Block 29 { 30 Id = "CheckoutForm", 31 SortId = 20, 32 SkipRenderBlocksList = true, 33 BlocksList = new List<Block> 34 { 35 new Block() 36 { 37 Id = "OrderContainer", 38 SortId = 30, 39 Design = new Design 40 { 41 RenderType = RenderType.Column, 42 Size = "12", 43 HidePadding = true 44 }, 45 BlocksList = new List<Block> { 46 new Block() 47 { 48 Id = "OrderContainerRow", 49 SortId = 10, 50 Design = new Design 51 { 52 RenderType = RenderType.Row 53 } 54 } 55 } 56 } 57 } 58 }; 59 60 checkoutPage.Add(checkoutForm); 61 62 Block addressContainer = new Block() 63 { 64 Id = "AddressContainer", 65 SortId = 20, 66 Design = new Design 67 { 68 RenderType = RenderType.Column, 69 Size = "9", 70 HidePadding = true 71 }, 72 BlocksList = new List<Block> { 73 new Block() 74 { 75 Id = "AddressContainerRow", 76 SortId = 10, 77 Design = new Design 78 { 79 RenderType = RenderType.Row 80 } 81 } 82 } 83 }; 84 checkoutPage.Add(addressContainer); 85 86 Block orderContainer = new Block() 87 { 88 Id = "OrderContainer", 89 SortId = 30, 90 Design = new Design 91 { 92 RenderType = RenderType.Column, 93 Size = "3", 94 HidePadding = true 95 }, 96 BlocksList = new List<Block> { 97 new Block() 98 { 99 Id = "SummaryContainerRow", 100 SortId = 10, 101 Design = new Design 102 { 103 RenderType = RenderType.Row 104 } 105 } 106 } 107 }; 108 checkoutPage.Add(orderContainer); 109 110 Block checkoutBottomSnippets = new Block() 111 { 112 Id = "CheckoutBottomSnippets", 113 SortId = 50 114 }; 115 checkoutPage.Add(checkoutBottomSnippets); 116 } 117 118 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 119 @using System.Text.RegularExpressions 120 @using System.Collections.Generic 121 @using System.Reflection 122 @using System.Web 123 @using System.Web.UI.HtmlControls 124 @using Dynamicweb.Rapido.Blocks.Components 125 @using Dynamicweb.Rapido.Blocks.Components.Articles 126 @using Dynamicweb.Rapido.Blocks.Components.Documentation 127 @using Dynamicweb.Rapido.Blocks 128 129 130 @*--- START: Base block renderers ---*@ 131 132 @helper RenderBlockList(List<Block> blocks) 133 { 134 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 135 blocks = blocks.OrderBy(item => item.SortId).ToList(); 136 137 foreach (Block item in blocks) 138 { 139 if (debug) { 140 <!-- Block START: @item.Id --> 141 } 142 143 if (item.Design == null) 144 { 145 @RenderBlock(item) 146 } 147 else if (item.Design.RenderType == RenderType.None) { 148 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 149 150 <div class="@cssClass dw-mod"> 151 @RenderBlock(item) 152 </div> 153 } 154 else if (item.Design.RenderType != RenderType.Hide) 155 { 156 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 157 158 if (!item.SkipRenderBlocksList) { 159 if (item.Design.RenderType == RenderType.Row) 160 { 161 <div class="grid grid--align-content-start @cssClass dw-mod" id="[email protected]"> 162 @RenderBlock(item) 163 </div> 164 } 165 166 if (item.Design.RenderType == RenderType.Column) 167 { 168 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 169 string size = item.Design.Size ?? "12"; 170 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 171 172 <div class="[email protected] [email protected] grid__col-sm-12 grid__col-xs-12 @hidePadding @cssClass dw-mod" id="[email protected]"> 173 @RenderBlock(item) 174 </div> 175 } 176 177 if (item.Design.RenderType == RenderType.Table) 178 { 179 <table class="table @cssClass dw-mod" id="[email protected]"> 180 @RenderBlock(item) 181 </table> 182 } 183 184 if (item.Design.RenderType == RenderType.TableRow) 185 { 186 <tr class="@cssClass dw-mod" id="[email protected]"> 187 @RenderBlock(item) 188 </tr> 189 } 190 191 if (item.Design.RenderType == RenderType.TableColumn) 192 { 193 <td class="@cssClass dw-mod" id="[email protected]"> 194 @RenderBlock(item) 195 </td> 196 } 197 198 if (item.Design.RenderType == RenderType.CardHeader) 199 { 200 <div class="card-header @cssClass dw-mod"> 201 @RenderBlock(item) 202 </div> 203 } 204 205 if (item.Design.RenderType == RenderType.CardBody) 206 { 207 <div class="card @cssClass dw-mod"> 208 @RenderBlock(item) 209 </div> 210 } 211 212 if (item.Design.RenderType == RenderType.CardFooter) 213 { 214 <div class="card-footer @cssClass dw-mod"> 215 @RenderBlock(item) 216 </div> 217 } 218 } 219 else 220 { 221 @RenderBlock(item) 222 } 223 } 224 225 if (debug) { 226 <!-- Block END: @item.Id --> 227 } 228 } 229 } 230 231 @helper RenderBlock(Block item) 232 { 233 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 234 235 if (item.Template != null) 236 { 237 @BlocksPage.RenderTemplate(item.Template) 238 } 239 240 if (item.Component != null) 241 { 242 string customSufix = "Custom"; 243 string methodName = item.Component.HelperName; 244 245 ComponentBase[] methodParameters = new ComponentBase[1]; 246 methodParameters[0] = item.Component; 247 Type methodType = this.GetType(); 248 249 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix); 250 MethodInfo generalMethod = methodType.GetMethod(methodName); 251 252 try { 253 if (debug) { 254 <!-- Component: @methodName.Replace("Render", "") --> 255 } 256 @customMethod.Invoke(this, methodParameters).ToString(); 257 } catch { 258 try { 259 @generalMethod.Invoke(this, methodParameters).ToString(); 260 } catch(Exception ex) { 261 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex); 262 } 263 } 264 } 265 266 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 267 { 268 @RenderBlockList(item.BlocksList) 269 } 270 } 271 272 @*--- END: Base block renderers ---*@ 273 274 275 @* Include the Blocks for the page *@ 276 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 277 @using Dynamicweb.Core 278 @using System 279 @using System.Web 280 @using System.Collections.Generic 281 @using System.Linq 282 @using Dynamicweb.Frontend.Devices 283 @using Dynamicweb.Rapido.Blocks 284 @using Dynamicweb.Rapido.Blocks.Components.General 285 @using Dynamicweb.UI.Elements.Html 286 @using Dynamicweb.Rendering; 287 288 @{ 289 BlocksPage billingAddressCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); 290 291 Block shippingAddressBlock = new Block() 292 { 293 Id = "ShippingAddress", 294 SortId = 10, 295 Template = RenderCustomerAddress(), 296 BlocksList = new List<Block> { 297 new Block() 298 { 299 Id = "BillingAddress", 300 SortId = 20, 301 Template = RenderBillingAddressCustom() 302 }, 303 new Block() 304 { 305 Id = "AdditionalInformation", 306 SortId = 30, 307 Template = RenderAdditionalInformationCustom() 308 } 309 310 }, 311 Design = new Design 312 { 313 RenderType = RenderType.Column, 314 Size = "12" 315 } 316 }; 317 billingAddressCheckoutPage.Add("AddressContainerRow", shippingAddressBlock); 318 } 319 320 @using Dynamicweb.Rapido.Blocks.Components 321 @using Dynamicweb.Rapido.Blocks.Components.General 322 @using Dynamicweb.Rapido.Blocks 323 @using System.IO 324 325 @* Required *@ 326 @using Dynamicweb.Rapido.Blocks.Components 327 @using Dynamicweb.Rapido.Blocks.Components.General 328 @using Dynamicweb.Rapido.Blocks 329 330 331 @helper Render(ComponentBase component) 332 { 333 if (component != null) 334 { 335 @component.Render(this) 336 } 337 } 338 339 340 @* Components *@ 341 @using System.Reflection 342 @using Dynamicweb.Rapido.Blocks.Components.General 343 344 345 @* Component *@ 346 347 @helper RenderIcon(Icon settings) 348 { 349 if (settings != null) 350 { 351 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 352 353 if (settings.Name != null) 354 { 355 if (string.IsNullOrEmpty(settings.Label)) 356 { 357 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 358 } 359 else 360 { 361 if (settings.LabelPosition == IconLabelPosition.Before) 362 { 363 <span>@settings.Label <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i></span> 364 } 365 else 366 { 367 <span><i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> @settings.Label</span> 368 } 369 } 370 } 371 else if (!string.IsNullOrEmpty(settings.Label)) 372 { 373 @settings.Label 374 } 375 } 376 } 377 @using System.Reflection 378 @using Dynamicweb.Rapido.Blocks.Components.General 379 @using Dynamicweb.Rapido.Blocks.Components 380 @using Dynamicweb.Core 381 382 @* Component *@ 383 384 @helper RenderButton(Button settings) 385 { 386 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 387 { 388 Dictionary<string, string> attributes = new Dictionary<string, string>(); 389 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 390 if (settings.Disabled) { 391 attributes.Add("disabled", "true"); 392 classList.Add("disabled"); 393 } 394 395 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle)) 396 { 397 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 398 @RenderConfirmDialog(settings); 399 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true"; 400 } 401 402 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 403 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 404 if (!string.IsNullOrEmpty(settings.AltText)) 405 { 406 attributes.Add("aria-label", settings.AltText); 407 } 408 409 var onClickEvents = new List<string>(); 410 if (!string.IsNullOrEmpty(settings.OnClick)) 411 { 412 onClickEvents.Add(settings.OnClick); 413 } 414 if (!string.IsNullOrEmpty(settings.Href)) 415 { 416 onClickEvents.Add("location.href='" + settings.Href + "'"); 417 } 418 if (onClickEvents.Count > 0) 419 { 420 attributes.Add("onClick", string.Join(";", onClickEvents)); 421 } 422 423 if (settings.ButtonLayout != ButtonLayout.None) 424 { 425 classList.Add("btn"); 426 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 427 if (btnLayout == "linkclean") 428 { 429 btnLayout = "link-clean"; //fix 430 } 431 classList.Add("btn--" + btnLayout); 432 } 433 434 if (settings.Icon == null) 435 { 436 settings.Icon = new Icon(); 437 } 438 settings.Icon.Label = settings.Title; 439 440 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower()); 441 442 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button> 443 } 444 } 445 446 @helper RenderConfirmDialog(Button settings) 447 { 448 Modal confirmDialog = new Modal { 449 Id = settings.Id, 450 Width = ModalWidth.Sm, 451 Heading = new Heading 452 { 453 Level = 2, 454 Title = settings.ConfirmTitle 455 }, 456 BodyText = settings.ConfirmText 457 }; 458 459 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"}); 460 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick }); 461 462 @Render(confirmDialog) 463 } 464 @using Dynamicweb.Rapido.Blocks.Components.General 465 @using Dynamicweb.Rapido.Blocks.Components 466 @using Dynamicweb.Core 467 468 @helper RenderDashboard(Dashboard settings) 469 { 470 var widgets = settings.GetWidgets(); 471 472 if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor)) 473 { 474 //set bg color for them 475 476 System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor); 477 int r = Convert.ToInt16(color.R); 478 int g = Convert.ToInt16(color.G); 479 int b = Convert.ToInt16(color.B); 480 481 var count = widgets.Length; 482 var max = Math.Max(r, Math.Max(g, b)); 483 double step = 255.0 / (max * count); 484 var i = 0; 485 foreach (var widget in widgets) 486 { 487 i++; 488 489 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")"; 490 widget.BackgroundColor = shade; 491 } 492 } 493 494 <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 495 @foreach (var widget in widgets) 496 { 497 <div class="dashboard__widget"> 498 @Render(widget) 499 </div> 500 } 501 </div> 502 } 503 @using Dynamicweb.Rapido.Blocks.Components.General 504 @using Dynamicweb.Rapido.Blocks.Components 505 506 @helper RenderDashboardWidgetLink(DashboardWidgetLink settings) 507 { 508 if (!string.IsNullOrEmpty(settings.Link)) 509 { 510 var backgroundStyles = ""; 511 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 512 { 513 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\""; 514 } 515 516 <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 517 <div class="u-center-middle u-color-light"> 518 @if (settings.Icon != null) 519 { 520 settings.Icon.CssClass += "widget__icon"; 521 @Render(settings.Icon) 522 } 523 <div class="widget__title">@settings.Title</div> 524 </div> 525 </a> 526 } 527 } 528 @using Dynamicweb.Rapido.Blocks.Components.General 529 @using Dynamicweb.Rapido.Blocks.Components 530 531 @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings) 532 { 533 var backgroundStyles = ""; 534 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 535 { 536 backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'"; 537 } 538 539 <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 540 <div class="u-center-middle u-color-light"> 541 @if (settings.Icon != null) 542 { 543 settings.Icon.CssClass += "widget__icon"; 544 @Render(settings.Icon) 545 } 546 <div class="widget__counter">@settings.Count</div> 547 <div class="widget__title">@settings.Title</div> 548 </div> 549 </div> 550 } 551 @using System.Reflection 552 @using Dynamicweb.Rapido.Blocks.Components.General 553 @using Dynamicweb.Rapido.Blocks.Components 554 @using Dynamicweb.Core 555 556 @* Component *@ 557 558 @helper RenderLink(Link settings) 559 { 560 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 561 { 562 Dictionary<string, string> attributes = new Dictionary<string, string>(); 563 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 564 if (settings.Disabled) 565 { 566 attributes.Add("disabled", "true"); 567 classList.Add("disabled"); 568 } 569 570 if (!string.IsNullOrEmpty(settings.AltText)) 571 { 572 attributes.Add("aria-label", settings.AltText); 573 } 574 575 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 576 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 577 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); } 578 attributes.Add("href", settings.Href); 579 580 if (settings.ButtonLayout != ButtonLayout.None) 581 { 582 classList.Add("btn"); 583 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 584 if (btnLayout == "linkclean") 585 { 586 btnLayout = "link-clean"; //fix 587 } 588 classList.Add("btn--" + btnLayout); 589 } 590 591 if (settings.Icon == null) 592 { 593 settings.Icon = new Icon(); 594 } 595 settings.Icon.Label = settings.Title; 596 597 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None) 598 { 599 settings.Rel = LinkRelType.Noopener; 600 } 601 if (settings.Target != LinkTargetType.None) 602 { 603 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower()); 604 } 605 if (settings.Download) 606 { 607 attributes.Add("download", "true"); 608 } 609 if (settings.Rel != LinkRelType.None) 610 { 611 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower()); 612 } 613 614 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a> 615 } 616 } 617 @using System.Reflection 618 @using Dynamicweb.Rapido.Blocks.Components 619 @using Dynamicweb.Rapido.Blocks.Components.General 620 @using Dynamicweb.Rapido.Blocks 621 622 623 @* Component *@ 624 625 @helper RenderRating(Rating settings) 626 { 627 if (settings.Score > 0) 628 { 629 int rating = settings.Score; 630 string iconType = "fa-star"; 631 632 switch (settings.Type.ToString()) { 633 case "Stars": 634 iconType = "fa-star"; 635 break; 636 case "Hearts": 637 iconType = "fa-heart"; 638 break; 639 case "Lemons": 640 iconType = "fa-lemon"; 641 break; 642 case "Bombs": 643 iconType = "fa-bomb"; 644 break; 645 } 646 647 <div class="u-ta-right"> 648 @for (int i = 0; i < settings.OutOf; i++) 649 { 650 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 651 } 652 </div> 653 } 654 } 655 @using System.Reflection 656 @using Dynamicweb.Rapido.Blocks.Components.General 657 @using Dynamicweb.Rapido.Blocks.Components 658 659 660 @* Component *@ 661 662 @helper RenderSelectFieldOption(SelectFieldOption settings) 663 { 664 Dictionary<string, string> attributes = new Dictionary<string, string>(); 665 if (settings.Checked) { attributes.Add("selected", "true"); } 666 if (settings.Disabled) { attributes.Add("disabled", "true"); } 667 if (settings.Value != null) { attributes.Add("value", settings.Value); } 668 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 669 670 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option> 671 } 672 @using System.Reflection 673 @using Dynamicweb.Rapido.Blocks.Components.General 674 @using Dynamicweb.Rapido.Blocks.Components 675 676 677 @* Component *@ 678 679 @helper RenderNavigation(Navigation settings) { 680 @RenderNavigation(new 681 { 682 id = settings.Id, 683 cssclass = settings.CssClass, 684 startLevel = settings.StartLevel, 685 endlevel = settings.EndLevel, 686 expandmode = settings.Expandmode, 687 sitemapmode = settings.SitemapMode, 688 template = settings.Template 689 }) 690 } 691 @using Dynamicweb.Rapido.Blocks.Components.General 692 @using Dynamicweb.Rapido.Blocks.Components 693 694 695 @* Component *@ 696 697 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 698 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 699 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 700 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 701 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 702 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 703 settings.SitemapMode = false; 704 705 @RenderNavigation(settings) 706 } 707 @using Dynamicweb.Rapido.Blocks.Components.General 708 @using Dynamicweb.Rapido.Blocks.Components 709 710 711 @* Component *@ 712 713 @helper RenderLeftNavigation(LeftNavigation settings) { 714 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 715 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 716 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 717 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 718 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 719 720 <div class="grid__cell"> 721 @RenderNavigation(settings) 722 </div> 723 } 724 @using System.Reflection 725 @using Dynamicweb.Rapido.Blocks.Components.General 726 @using Dynamicweb.Core 727 728 @* Component *@ 729 730 @helper RenderHeading(Heading settings) 731 { 732 if (settings != null && !string.IsNullOrEmpty(settings.Title)) 733 { 734 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 735 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div"; 736 737 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">") 738 if (!string.IsNullOrEmpty(settings.Link)) 739 { 740 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None }) 741 } 742 else 743 { 744 if (settings.Icon == null) 745 { 746 settings.Icon = new Icon(); 747 } 748 settings.Icon.Label = settings.Title; 749 @Render(settings.Icon) 750 } 751 @("</" + tagName + ">"); 752 } 753 } 754 @using Dynamicweb.Rapido.Blocks.Components 755 @using Dynamicweb.Rapido.Blocks.Components.General 756 @using Dynamicweb.Rapido.Blocks 757 758 759 @* Component *@ 760 761 @helper RenderImage(Image settings) 762 { 763 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None) 764 { 765 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 766 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); } 767 768 if (settings.Caption != null) 769 { 770 @:<div> 771 } 772 773 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower(); 774 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower(); 775 776 <div class="image-filter [email protected] u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)> 777 <div class="image-filter [email protected] dw-mod"> 778 @if (settings.Link != null) 779 { 780 <a href="@settings.Link" tabindex="-1"> 781 @RenderTheImage(settings) 782 </a> 783 } 784 else 785 { 786 @RenderTheImage(settings) 787 } 788 </div> 789 </div> 790 791 if (settings.Caption != null) 792 { 793 <span class="image-caption dw-mod">@settings.Caption</span> 794 @:</div> 795 } 796 } 797 else 798 { 799 if (settings.Caption != null) 800 { 801 @:<div> 802 } 803 if (!string.IsNullOrEmpty(settings.Link)) 804 { 805 <a href="@settings.Link" tabindex="-1"> 806 @RenderTheImage(settings) 807 </a> 808 } 809 else 810 { 811 @RenderTheImage(settings) 812 } 813 814 if (settings.Caption != null) 815 { 816 <span class="image-caption dw-mod">@settings.Caption</span> 817 @:</div> 818 } 819 } 820 } 821 822 @helper RenderTheImage(Image settings) 823 { 824 if (settings != null) 825 { 826 string placeholderImage = "/Files/Images/placeholder.gif"; 827 string imageEngine = "/Admin/Public/GetImage.ashx?Format=jpg&"; 828 829 string imageStyle = ""; 830 831 switch (settings.Style) 832 { 833 case ImageStyle.Ball: 834 imageStyle = "grid__cell-img--ball"; 835 break; 836 } 837 838 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle) 839 { 840 if (settings.ImageDefault != null) 841 { 842 settings.ImageDefault.Height = settings.ImageDefault.Width; 843 } 844 if (settings.ImageMedium != null) 845 { 846 settings.ImageMedium.Height = settings.ImageMedium.Width; 847 } 848 if (settings.ImageSmall != null) 849 { 850 settings.ImageSmall.Height = settings.ImageSmall.Width; 851 } 852 } 853 854 string defaultImage = imageEngine; 855 string imageSmall = ""; 856 string imageMedium = ""; 857 858 if (settings.DisableImageEngine) 859 { 860 defaultImage = settings.Path; 861 } 862 else 863 { 864 if (settings.ImageDefault != null) 865 { 866 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault); 867 868 if (settings.Path.GetType() != typeof(string)) 869 { 870 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 871 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 872 } 873 else 874 { 875 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 876 } 877 } 878 879 if (settings.ImageSmall != null) 880 { 881 imageSmall = "data-src-small=\"" + imageEngine; 882 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall); 883 884 if (settings.Path.GetType() != typeof(string)) 885 { 886 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 887 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 888 } 889 else 890 { 891 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 892 } 893 894 imageSmall += "\""; 895 } 896 897 if (settings.ImageMedium != null) 898 { 899 imageMedium = "data-src-medium=\"" + imageEngine; 900 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium); 901 902 if (settings.Path.GetType() != typeof(string)) 903 { 904 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 905 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 906 } 907 else 908 { 909 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 910 } 911 912 imageMedium += "\""; 913 } 914 } 915 916 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 917 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 918 if (!string.IsNullOrEmpty(settings.Title)) 919 { 920 optionalAttributes.Add("alt", settings.Title); 921 } 922 else 923 { 924 optionalAttributes.Add("alt", ""); 925 } 926 927 if (settings.DisableLazyLoad) 928 { 929 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 930 } 931 else 932 { 933 <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) /> 934 } 935 } 936 } 937 @using System.Reflection 938 @using Dynamicweb.Rapido.Blocks.Components.General 939 @using Dynamicweb.Rapido.Blocks.Components 940 941 @* Component *@ 942 943 @helper RenderFileField(FileField settings) 944 { 945 var attributes = new Dictionary<string, string>(); 946 if (string.IsNullOrEmpty(settings.Id)) 947 { 948 settings.Id = Guid.NewGuid().ToString("N"); 949 } 950 951 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 952 if (settings.Disabled) { attributes.Add("disabled", "true"); } 953 if (settings.Required) { attributes.Add("required", "true"); } 954 if (settings.Multiple) { attributes.Add("multiple", "true"); } 955 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 956 if (string.IsNullOrEmpty(settings.ChooseFileText)) 957 { 958 settings.ChooseFileText = Translate("Choose file"); 959 } 960 if (string.IsNullOrEmpty(settings.NoFilesChosenText)) 961 { 962 settings.NoFilesChosenText = Translate("No files chosen..."); 963 } 964 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 965 966 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)"; 967 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : "")); 968 969 attributes.Add("type", "file"); 970 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 971 settings.CssClass = "u-full-width " + settings.CssClass; 972 973 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 974 975 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 976 @if (!string.IsNullOrEmpty(settings.Label)) 977 { 978 <label for="@settings.Id">@settings.Label</label> 979 } 980 @if (!string.IsNullOrEmpty(settings.HelpText)) 981 { 982 <small class="form__help-text">@settings.HelpText</small> 983 } 984 985 <div class="form__field-combi file-input u-no-margin dw-mod"> 986 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" /> 987 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label> 988 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label> 989 @if (settings.UploadButton != null) 990 { 991 settings.UploadButton.CssClass += " btn--condensed u-no-margin"; 992 @Render(settings.UploadButton) 993 } 994 </div> 995 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 996 </div> 997 } 998 @using System.Reflection 999 @using Dynamicweb.Rapido.Blocks.Components.General 1000 @using Dynamicweb.Rapido.Blocks.Components 1001 @using Dynamicweb.Core 1002 @using System.Linq 1003 1004 @* Component *@ 1005 1006 @helper RenderDateTimeField(DateTimeField settings) 1007 { 1008 if (string.IsNullOrEmpty(settings.Id)) 1009 { 1010 settings.Id = Guid.NewGuid().ToString("N"); 1011 } 1012 1013 var textField = new TextField { 1014 Name = settings.Name, 1015 Id = settings.Id, 1016 Label = settings.Label, 1017 HelpText = settings.HelpText, 1018 Value = settings.Value, 1019 Disabled = settings.Disabled, 1020 Required = settings.Required, 1021 ErrorMessage = settings.ErrorMessage, 1022 CssClass = settings.CssClass, 1023 WrapperCssClass = settings.WrapperCssClass, 1024 OnChange = settings.OnChange, 1025 OnClick = settings.OnClick, 1026 ExtraAttributes = settings.ExtraAttributes, 1027 // 1028 Placeholder = settings.Placeholder 1029 }; 1030 1031 @Render(textField) 1032 1033 List<string> jsAttributes = new List<string>(); 1034 1035 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); 1036 1037 if (!string.IsNullOrEmpty(settings.DateFormat)) 1038 { 1039 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); 1040 } 1041 if (!string.IsNullOrEmpty(settings.MinDate)) 1042 { 1043 jsAttributes.Add("minDate: '" + settings.MinDate + "'"); 1044 } 1045 if (!string.IsNullOrEmpty(settings.MaxDate)) 1046 { 1047 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); 1048 } 1049 if (settings.IsInline) 1050 { 1051 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); 1052 } 1053 if (settings.EnableTime) 1054 { 1055 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); 1056 } 1057 if (settings.EnableWeekNumbers) 1058 { 1059 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); 1060 } 1061 1062 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); 1063 1064 <script> 1065 document.addEventListener("DOMContentLoaded", function () { 1066 flatpickr("#@textField.Id", { 1067 @string.Join(",", jsAttributes) 1068 }); 1069 }); 1070 </script> 1071 } 1072 @using System.Reflection 1073 @using Dynamicweb.Rapido.Blocks.Components.General 1074 @using Dynamicweb.Rapido.Blocks.Components 1075 1076 @* Component *@ 1077 1078 @helper RenderTextField(TextField settings) 1079 { 1080 var attributes = new Dictionary<string, string>(); 1081 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1082 { 1083 settings.Id = Guid.NewGuid().ToString("N"); 1084 } 1085 1086 /*base settings*/ 1087 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1088 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1089 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1090 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1091 if (settings.Required) { attributes.Add("required", "true"); } 1092 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1093 /*end*/ 1094 1095 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1096 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1097 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1098 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1099 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1100 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1101 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower()); 1102 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); }; 1103 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 1104 settings.CssClass = "u-full-width " + settings.CssClass; 1105 1106 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1107 1108 string noMargin = "u-no-margin"; 1109 if (!settings.ReadOnly) { 1110 noMargin = ""; 1111 } 1112 1113 <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod"> 1114 @if (!string.IsNullOrEmpty(settings.Label)) 1115 { 1116 <label for="@settings.Id">@settings.Label</label> 1117 } 1118 @if (!string.IsNullOrEmpty(settings.HelpText)) 1119 { 1120 <small class="form__help-text">@settings.HelpText</small> 1121 } 1122 1123 @if (settings.ActionButton != null) 1124 { 1125 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1126 <div class="form__field-combi u-no-margin dw-mod"> 1127 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1128 @Render(settings.ActionButton) 1129 </div> 1130 } 1131 else 1132 { 1133 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1134 } 1135 1136 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1137 </div> 1138 } 1139 @using System.Reflection 1140 @using Dynamicweb.Rapido.Blocks.Components.General 1141 @using Dynamicweb.Rapido.Blocks.Components 1142 1143 @* Component *@ 1144 1145 @helper RenderNumberField(NumberField settings) 1146 { 1147 var attributes = new Dictionary<string, string>(); 1148 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1149 { 1150 settings.Id = Guid.NewGuid().ToString("N"); 1151 } 1152 1153 /*base settings*/ 1154 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1155 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1156 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1157 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1158 if (settings.Required) { attributes.Add("required", "true"); } 1159 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1160 /*end*/ 1161 1162 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1163 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1164 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1165 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1166 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 1167 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); } 1168 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); } 1169 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); } 1170 attributes.Add("type", "number"); 1171 1172 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1173 1174 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1175 @if (!string.IsNullOrEmpty(settings.Label)) 1176 { 1177 <label for="@settings.Id">@settings.Label</label> 1178 } 1179 @if (!string.IsNullOrEmpty(settings.HelpText)) 1180 { 1181 <small class="form__help-text">@settings.HelpText</small> 1182 } 1183 1184 @if (settings.ActionButton != null) 1185 { 1186 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1187 <div class="form__field-combi u-no-margin dw-mod"> 1188 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1189 @Render(settings.ActionButton) 1190 </div> 1191 } 1192 else 1193 { 1194 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1195 } 1196 1197 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1198 </div> 1199 } 1200 @using System.Reflection 1201 @using Dynamicweb.Rapido.Blocks.Components.General 1202 @using Dynamicweb.Rapido.Blocks.Components 1203 1204 1205 @* Component *@ 1206 1207 @helper RenderTextareaField(TextareaField settings) 1208 { 1209 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1210 string id = settings.Id; 1211 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id)) 1212 { 1213 id = Guid.NewGuid().ToString("N"); 1214 } 1215 1216 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); } 1217 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1218 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1219 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1220 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1221 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1222 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1223 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1224 if (settings.Required) { attributes.Add("required", "true"); } 1225 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1226 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1227 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); } 1228 attributes.Add("name", settings.Name); 1229 1230 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1231 @if (!string.IsNullOrEmpty(settings.Label)) 1232 { 1233 <label for="@id">@settings.Label</label> 1234 } 1235 @if (!string.IsNullOrEmpty(settings.HelpText)) 1236 { 1237 <small class="form__help-text">@settings.HelpText</small> 1238 } 1239 1240 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea> 1241 1242 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1243 </div> 1244 } 1245 @using System.Reflection 1246 @using Dynamicweb.Rapido.Blocks.Components.General 1247 @using Dynamicweb.Rapido.Blocks.Components 1248 1249 1250 @* Component *@ 1251 1252 @helper RenderHiddenField(HiddenField settings) { 1253 var attributes = new Dictionary<string, string>(); 1254 attributes.Add("type", "hidden"); 1255 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1256 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 1257 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1258 1259 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 1260 } 1261 @using System.Reflection 1262 @using Dynamicweb.Rapido.Blocks.Components.General 1263 @using Dynamicweb.Rapido.Blocks.Components 1264 1265 @* Component *@ 1266 1267 @helper RenderCheckboxField(CheckboxField settings) 1268 { 1269 var attributes = new Dictionary<string, string>(); 1270 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1271 { 1272 settings.Id = Guid.NewGuid().ToString("N"); 1273 } 1274 1275 /*base settings*/ 1276 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1277 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1278 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1279 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1280 if (settings.Required) { attributes.Add("required", "true"); } 1281 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1282 /*end*/ 1283 1284 attributes.Add("type", "checkbox"); 1285 if (settings.Checked) { attributes.Add("checked", "true"); } 1286 settings.CssClass = "form__control " + settings.CssClass; 1287 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 1288 1289 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1290 1291 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1292 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1293 @if (!string.IsNullOrEmpty(settings.Label)) 1294 { 1295 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1296 } 1297 @if (!string.IsNullOrEmpty(settings.HelpText)) 1298 { 1299 <small class="form__help-text">@settings.HelpText</small> 1300 } 1301 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1302 </div> 1303 } 1304 @using System.Reflection 1305 @using Dynamicweb.Rapido.Blocks.Components.General 1306 @using Dynamicweb.Rapido.Blocks.Components 1307 1308 1309 @* Component *@ 1310 1311 @helper RenderCheckboxListField(CheckboxListField settings) 1312 { 1313 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1314 @if (!string.IsNullOrEmpty(settings.Label)) 1315 { 1316 <label>@settings.Label</label> 1317 } 1318 @if (!string.IsNullOrEmpty(settings.HelpText)) 1319 { 1320 <small class="form__help-text">@settings.HelpText</small> 1321 } 1322 1323 @foreach (var item in settings.Options) 1324 { 1325 if (settings.Required) 1326 { 1327 item.Required = true; 1328 } 1329 if (settings.Disabled) 1330 { 1331 item.Disabled = true; 1332 } 1333 if (!string.IsNullOrEmpty(settings.Name)) 1334 { 1335 item.Name = settings.Name; 1336 } 1337 if (!string.IsNullOrEmpty(settings.CssClass)) 1338 { 1339 item.CssClass += settings.CssClass; 1340 } 1341 1342 /* value is not supported */ 1343 1344 if (!string.IsNullOrEmpty(settings.OnClick)) 1345 { 1346 item.OnClick += settings.OnClick; 1347 } 1348 if (!string.IsNullOrEmpty(settings.OnChange)) 1349 { 1350 item.OnChange += settings.OnChange; 1351 } 1352 @Render(item) 1353 } 1354 1355 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1356 </div> 1357 } 1358 @using System.Reflection 1359 @using Dynamicweb.Rapido.Blocks.Components.General 1360 @using Dynamicweb.Rapido.Blocks.Components 1361 1362 1363 @* Component *@ 1364 1365 @helper RenderSelectField(SelectField settings) 1366 { 1367 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1368 { 1369 settings.Id = Guid.NewGuid().ToString("N"); 1370 } 1371 1372 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1373 @if (!string.IsNullOrEmpty(settings.Label)) 1374 { 1375 <label for="@settings.Id">@settings.Label</label> 1376 } 1377 @if (!string.IsNullOrEmpty(settings.HelpText)) 1378 { 1379 <small class="form__help-text">@settings.HelpText</small> 1380 } 1381 1382 @if (settings.ActionButton != null) 1383 { 1384 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1385 <div class="form__field-combi u-no-margin dw-mod"> 1386 @RenderSelectBase(settings) 1387 @Render(settings.ActionButton) 1388 </div> 1389 } 1390 else 1391 { 1392 @RenderSelectBase(settings) 1393 } 1394 1395 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1396 </div> 1397 } 1398 1399 @helper RenderSelectBase(SelectField settings) 1400 { 1401 var attributes = new Dictionary<string, string>(); 1402 1403 /*base settings*/ 1404 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1405 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1406 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1407 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1408 if (settings.Required) { attributes.Add("required", "true"); } 1409 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1410 /*end*/ 1411 1412 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1413 1414 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod"> 1415 @if (settings.Default != null) 1416 { 1417 @Render(settings.Default) 1418 } 1419 1420 @foreach (var item in settings.Options) 1421 { 1422 if (!string.IsNullOrEmpty(settings.Value)) { 1423 item.Checked = item.Value == settings.Value; 1424 } 1425 @Render(item) 1426 } 1427 </select> 1428 } 1429 @using System.Reflection 1430 @using Dynamicweb.Rapido.Blocks.Components.General 1431 @using Dynamicweb.Rapido.Blocks.Components 1432 1433 @* Component *@ 1434 1435 @helper RenderRadioButtonField(RadioButtonField settings) 1436 { 1437 var attributes = new Dictionary<string, string>(); 1438 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1439 { 1440 settings.Id = Guid.NewGuid().ToString("N"); 1441 } 1442 1443 /*base settings*/ 1444 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1445 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1446 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1447 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1448 if (settings.Required) { attributes.Add("required", "true"); } 1449 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1450 /*end*/ 1451 1452 attributes.Add("type", "radio"); 1453 if (settings.Checked) { attributes.Add("checked", "true"); } 1454 settings.CssClass = "form__control " + settings.CssClass; 1455 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 1456 1457 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1458 1459 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1460 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1461 @if (!string.IsNullOrEmpty(settings.Label)) 1462 { 1463 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1464 } 1465 @if (!string.IsNullOrEmpty(settings.HelpText)) 1466 { 1467 <small class="form__help-text">@settings.HelpText</small> 1468 } 1469 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1470 </div> 1471 } 1472 @using System.Reflection 1473 @using Dynamicweb.Rapido.Blocks.Components.General 1474 @using Dynamicweb.Rapido.Blocks.Components 1475 1476 1477 @* Component *@ 1478 1479 @helper RenderRadioButtonListField(RadioButtonListField settings) 1480 { 1481 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1482 @if (!string.IsNullOrEmpty(settings.Label)) 1483 { 1484 <label>@settings.Label</label> 1485 } 1486 @if (!string.IsNullOrEmpty(settings.HelpText)) 1487 { 1488 <small class="form__help-text">@settings.HelpText</small> 1489 } 1490 1491 @foreach (var item in settings.Options) 1492 { 1493 if (settings.Required) 1494 { 1495 item.Required = true; 1496 } 1497 if (settings.Disabled) 1498 { 1499 item.Disabled = true; 1500 } 1501 if (!string.IsNullOrEmpty(settings.Name)) 1502 { 1503 item.Name = settings.Name; 1504 } 1505 if (!string.IsNullOrEmpty(settings.Value) && settings.Value == item.Value) 1506 { 1507 item.Checked = true; 1508 } 1509 if (!string.IsNullOrEmpty(settings.OnClick)) 1510 { 1511 item.OnClick += settings.OnClick; 1512 } 1513 if (!string.IsNullOrEmpty(settings.OnChange)) 1514 { 1515 item.OnChange += settings.OnChange; 1516 } 1517 if (!string.IsNullOrEmpty(settings.CssClass)) 1518 { 1519 item.CssClass += settings.CssClass; 1520 } 1521 @Render(item) 1522 } 1523 1524 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1525 </div> 1526 } 1527 @using System.Reflection 1528 @using Dynamicweb.Rapido.Blocks.Components.General 1529 @using Dynamicweb.Rapido.Blocks.Components 1530 1531 1532 @* Component *@ 1533 1534 @helper RenderNotificationMessage(NotificationMessage settings) 1535 { 1536 if (!string.IsNullOrEmpty(settings.Message)) 1537 { 1538 var attributes = new Dictionary<string, string>(); 1539 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1540 1541 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower(); 1542 <div class="[email protected] @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)>@settings.Message</div> 1543 } 1544 } 1545 @using Dynamicweb.Rapido.Blocks.Components.General 1546 1547 1548 @* Component *@ 1549 1550 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1551 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 1552 1553 <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> 1554 @if (settings.SubBlocks != null) { 1555 @RenderBlockList(settings.SubBlocks) 1556 } 1557 </div> 1558 } 1559 @using System.Reflection 1560 @using Dynamicweb.Rapido.Blocks.Components.General 1561 @using Dynamicweb.Rapido.Blocks.Components 1562 @using System.Text.RegularExpressions 1563 1564 1565 @* Component *@ 1566 1567 @helper RenderSticker(Sticker settings) { 1568 if (!String.IsNullOrEmpty(settings.Title)) { 1569 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1570 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 1571 1572 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1573 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1574 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1575 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1576 optionalAttributes.Add("style", styleTag); 1577 } 1578 1579 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1580 } 1581 } 1582 1583 @using System.Reflection 1584 @using Dynamicweb.Rapido.Blocks.Components.General 1585 @using Dynamicweb.Rapido.Blocks.Components 1586 1587 1588 @* Component *@ 1589 1590 @helper RenderStickersCollection(StickersCollection settings) 1591 { 1592 if (settings.Stickers.Count > 0) 1593 { 1594 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower(); 1595 1596 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1597 @foreach (Sticker sticker in settings.Stickers) 1598 { 1599 @Render(sticker) 1600 } 1601 </div> 1602 } 1603 } 1604 1605 @using Dynamicweb.Rapido.Blocks.Components.General 1606 1607 1608 @* Component *@ 1609 1610 @helper RenderForm(Form settings) { 1611 if (settings != null) 1612 { 1613 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 1614 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); }; 1615 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); }; 1616 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); }; 1617 var enctypes = new Dictionary<string, string> 1618 { 1619 { "multipart", "multipart/form-data" }, 1620 { "text", "text/plain" }, 1621 { "application", "application/x-www-form-urlencoded" } 1622 }; 1623 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); }; 1624 optionalAttributes.Add("method", settings.Method.ToString()); 1625 1626 if (!string.IsNullOrEmpty(settings.FormStartMarkup)) 1627 { 1628 @settings.FormStartMarkup 1629 } 1630 else 1631 { 1632 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1633 } 1634 1635 foreach (var field in settings.GetFields()) 1636 { 1637 @Render(field) 1638 } 1639 1640 @:</form> 1641 } 1642 } 1643 @using System.Reflection 1644 @using Dynamicweb.Rapido.Blocks.Components.General 1645 @using Dynamicweb.Rapido.Blocks.Components 1646 1647 1648 @* Component *@ 1649 1650 @helper RenderText(Text settings) 1651 { 1652 @settings.Content 1653 } 1654 @using System.Reflection 1655 @using Dynamicweb.Rapido.Blocks.Components.General 1656 @using Dynamicweb.Rapido.Blocks.Components 1657 1658 1659 @* Component *@ 1660 1661 @helper RenderContentModule(ContentModule settings) { 1662 if (!string.IsNullOrEmpty(settings.Content)) 1663 { 1664 @settings.Content 1665 } 1666 } 1667 @using System.Reflection 1668 @using Dynamicweb.Rapido.Blocks.Components.General 1669 @using Dynamicweb.Rapido.Blocks.Components 1670 1671 1672 @* Component *@ 1673 1674 @helper RenderModal(Modal settings) { 1675 if (settings != null) 1676 { 1677 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 1678 1679 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : ""; 1680 1681 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange /> 1682 1683 <div class="modal-container"> 1684 @if (!settings.DisableDarkOverlay) 1685 { 1686 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label> 1687 } 1688 <div class="modal [email protected]().ToLower() [email protected]().ToLower()" id="@(modalId)Modal"> 1689 @if (settings.Heading != null) 1690 { 1691 if (!string.IsNullOrEmpty(settings.Heading.Title)) 1692 { 1693 <div class="modal__header"> 1694 @Render(settings.Heading) 1695 </div> 1696 } 1697 } 1698 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")"> 1699 @if (!string.IsNullOrEmpty(settings.BodyText)) 1700 { 1701 @settings.BodyText 1702 } 1703 @if (settings.BodyTemplate != null) 1704 { 1705 @settings.BodyTemplate 1706 } 1707 @{ 1708 var actions = settings.GetActions(); 1709 } 1710 </div> 1711 @if (actions.Length > 0) 1712 { 1713 <div class="modal__footer"> 1714 @foreach (var action in actions) 1715 { 1716 action.CssClass += " u-no-margin"; 1717 @Render(action) 1718 } 1719 </div> 1720 } 1721 <label class="modal__close-btn" for="@(modalId)ModalTrigger" tabindex="0" onkeypress="fakeClickWithEnterKey(event, this)"><span class="u-sr-only">@Translate("Close Modal Window")</span></label> 1722 </div> 1723 </div> 1724 } 1725 } 1726 @using Dynamicweb.Rapido.Blocks.Components.General 1727 1728 @* Component *@ 1729 1730 @helper RenderMediaListItem(MediaListItem settings) 1731 { 1732 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")> 1733 @if (!string.IsNullOrEmpty(settings.Label)) 1734 { 1735 if (!string.IsNullOrEmpty(settings.Link)) 1736 { 1737 @Render(new Link 1738 { 1739 Href = settings.Link, 1740 CssClass = "media-list-item__sticker dw-mod", 1741 ButtonLayout = ButtonLayout.None, 1742 Title = settings.Label, 1743 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1744 }) 1745 } 1746 else if (!string.IsNullOrEmpty(settings.OnClick)) 1747 { 1748 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)"> 1749 <span class="u-uppercase">@settings.Label</span> 1750 </span> 1751 } 1752 else 1753 { 1754 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod"> 1755 <span class="u-uppercase">@settings.Label</span> 1756 </span> 1757 } 1758 } 1759 <div class="media-list-item__wrap"> 1760 <div class="media-list-item__info dw-mod"> 1761 <div class="media-list-item__header dw-mod"> 1762 @if (!string.IsNullOrEmpty(settings.Title)) 1763 { 1764 if (!string.IsNullOrEmpty(settings.Link)) 1765 { 1766 @Render(new Link 1767 { 1768 Href = settings.Link, 1769 CssClass = "media-list-item__name dw-mod", 1770 ButtonLayout = ButtonLayout.None, 1771 Title = settings.Title, 1772 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1773 }) 1774 } 1775 else if (!string.IsNullOrEmpty(settings.OnClick)) 1776 { 1777 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span> 1778 } 1779 else 1780 { 1781 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span> 1782 } 1783 } 1784 1785 @if (!string.IsNullOrEmpty(settings.Status)) 1786 { 1787 <div class="media-list-item__state dw-mod">@settings.Status</div> 1788 } 1789 </div> 1790 @{ 1791 settings.InfoTable.CssClass += " media-list-item__parameters-table"; 1792 } 1793 1794 @Render(settings.InfoTable) 1795 </div> 1796 <div class="media-list-item__actions dw-mod"> 1797 <div class="media-list-item__actions-list dw-mod"> 1798 @{ 1799 var actions = settings.GetActions(); 1800 1801 foreach (ButtonBase action in actions) 1802 { 1803 action.ButtonLayout = ButtonLayout.None; 1804 action.CssClass += " media-list-item__action link"; 1805 1806 @Render(action) 1807 } 1808 } 1809 </div> 1810 1811 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title)) 1812 { 1813 settings.SelectButton.CssClass += " u-no-margin"; 1814 1815 <div class="media-list-item__action-button"> 1816 @Render(settings.SelectButton) 1817 </div> 1818 } 1819 </div> 1820 </div> 1821 </div> 1822 } 1823 @using Dynamicweb.Rapido.Blocks.Components.General 1824 @using Dynamicweb.Rapido.Blocks.Components 1825 1826 @helper RenderTable(Table settings) 1827 { 1828 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1829 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1830 1831 var enumToClasses = new Dictionary<TableDesign, string> 1832 { 1833 { TableDesign.Clean, "table--clean" }, 1834 { TableDesign.Bordered, "table--bordered" }, 1835 { TableDesign.Striped, "table--striped" }, 1836 { TableDesign.Hover, "table--hover" }, 1837 { TableDesign.Compact, "table--compact" }, 1838 { TableDesign.Condensed, "table--condensed" }, 1839 { TableDesign.NoTopBorder, "table--no-top-border" } 1840 }; 1841 string tableDesignClass = ""; 1842 if (settings.Design != TableDesign.None) 1843 { 1844 tableDesignClass = enumToClasses[settings.Design]; 1845 } 1846 1847 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); } 1848 1849 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 1850 1851 <table @ComponentMethods.AddAttributes(resultAttributes)> 1852 @if (settings.Header != null) 1853 { 1854 <thead> 1855 @Render(settings.Header) 1856 </thead> 1857 } 1858 <tbody> 1859 @foreach (var row in settings.Rows) 1860 { 1861 @Render(row) 1862 } 1863 </tbody> 1864 @if (settings.Footer != null) 1865 { 1866 <tfoot> 1867 @Render(settings.Footer) 1868 </tfoot> 1869 } 1870 </table> 1871 } 1872 @using Dynamicweb.Rapido.Blocks.Components.General 1873 @using Dynamicweb.Rapido.Blocks.Components 1874 1875 @helper RenderTableRow(TableRow settings) 1876 { 1877 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1878 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1879 1880 var enumToClasses = new Dictionary<TableRowDesign, string> 1881 { 1882 { TableRowDesign.NoBorder, "table__row--no-border" }, 1883 { TableRowDesign.Border, "table__row--border" }, 1884 { TableRowDesign.TopBorder, "table__row--top-line" }, 1885 { TableRowDesign.BottomBorder, "table__row--bottom-line" }, 1886 { TableRowDesign.Solid, "table__row--solid" } 1887 }; 1888 1889 string tableRowDesignClass = ""; 1890 if (settings.Design != TableRowDesign.None) 1891 { 1892 tableRowDesignClass = enumToClasses[settings.Design]; 1893 } 1894 1895 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); } 1896 1897 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 1898 1899 <tr @ComponentMethods.AddAttributes(resultAttributes)> 1900 @foreach (var cell in settings.Cells) 1901 { 1902 if (settings.IsHeaderRow) 1903 { 1904 cell.IsHeader = true; 1905 } 1906 @Render(cell) 1907 } 1908 </tr> 1909 } 1910 @using Dynamicweb.Rapido.Blocks.Components.General 1911 @using Dynamicweb.Rapido.Blocks.Components 1912 @using Dynamicweb.Core 1913 1914 @helper RenderTableCell(TableCell settings) 1915 { 1916 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1917 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1918 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); } 1919 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); } 1920 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); } 1921 1922 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 1923 1924 string tagName = settings.IsHeader ? "th" : "td"; 1925 1926 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">") 1927 @settings.Content 1928 @("</" + tagName + ">"); 1929 } 1930 @using System.Linq 1931 @using Dynamicweb.Rapido.Blocks.Components.General 1932 1933 @* Component *@ 1934 1935 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings) 1936 { 1937 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter 1938 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring 1939 1940 if (settings.NumberOfPages > 1) 1941 { 1942 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx"; 1943 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Pagination"); 1944 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings); 1945 1946 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel"> 1947 @if (settings.ShowPagingInfo) 1948 { 1949 <div class="pager__info dw-mod"> 1950 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages 1951 </div> 1952 } 1953 <ul class="pager__list dw-mod" role="navigation" aria-label='@Translate("Pagination")'> 1954 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls) 1955 { 1956 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon }) 1957 } 1958 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls) 1959 { 1960 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon, HelperName = "Prev"}) 1961 } 1962 @if (settings.GetPages().Any()) 1963 { 1964 foreach (var page in settings.GetPages()) 1965 { 1966 @Render(page) 1967 } 1968 } 1969 else 1970 { 1971 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++) 1972 { 1973 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString()); 1974 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) }); 1975 } 1976 } 1977 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls) 1978 { 1979 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon, HelperName = "Next" }) 1980 } 1981 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls) 1982 { 1983 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon }) 1984 } 1985 </ul> 1986 </div> 1987 } 1988 } 1989 1990 @helper RenderPaginationItem(PaginationItem settings) 1991 { 1992 var ariaLabel = settings.HelperName == "Prev" ? Translate("Go to Previous page") : settings.HelperName == "Next" ? Translate("Go to Next page") : $"{Translate("Go to page")} {settings.Label}"; 1993 1994 if (settings.Icon == null) 1995 { 1996 settings.Icon = new Icon(); 1997 } 1998 1999 settings.Icon.Label = settings.Label; 2000 <li class="pager__btn dw-mod"> 2001 @if (settings.IsActive) 2002 { 2003 <span class="pager__num pager__num--current dw-mod"> 2004 <span class="u-sr-only">@Translate("Current page")</span> 2005 @Render(settings.Icon) 2006 </span> 2007 } 2008 else 2009 { 2010 <a href="@settings.Link" class="pager__num dw-mod" aria-label="@ariaLabel"> 2011 @Render(settings.Icon) 2012 </a> 2013 } 2014 </li> 2015 } 2016 2017 2018 @using System 2019 @using Dynamicweb.Rapido.Blocks.Components.General 2020 @using Dynamicweb.Rapido.Blocks.Components.Articles 2021 2022 2023 2024 2025 @using System.Reflection 2026 @using Dynamicweb.Rapido.Blocks.Components.General 2027 @using Dynamicweb.Rapido.Blocks.Components 2028 2029 @* Component *@ 2030 2031 @helper RenderFileFieldCustom(FileField settings) 2032 { 2033 var attributes = new Dictionary<string, string>(); 2034 if (string.IsNullOrEmpty(settings.Id)) 2035 { 2036 settings.Id = Guid.NewGuid().ToString("N"); 2037 } 2038 2039 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2040 if (settings.Disabled) { attributes.Add("disabled", "true"); } 2041 if (settings.Required) { attributes.Add("required", "true"); } 2042 if (settings.Multiple) { attributes.Add("multiple", "true"); } 2043 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 2044 if (string.IsNullOrEmpty(settings.ChooseFileText)) 2045 { 2046 settings.ChooseFileText = Translate("Choose file"); 2047 } 2048 if (string.IsNullOrEmpty(settings.NoFilesChosenText)) 2049 { 2050 settings.NoFilesChosenText = Translate("No files chosen..."); 2051 } 2052 2053 attributes.Add("type", "file"); 2054 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 2055 settings.CssClass = "u-full-width " + settings.CssClass; 2056 2057 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 2058 var filesListId = settings.Id + "_wgoFilesList"; 2059 2060 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 2061 @if (!string.IsNullOrEmpty(settings.Label)) 2062 { 2063 <label for="@settings.Id">@settings.Label</label> 2064 } 2065 @if (!string.IsNullOrEmpty(settings.HelpText)) 2066 { 2067 <small class="form__help-text">@settings.HelpText</small> 2068 } 2069 2070 <div class="form__field-combi file-input u-no-margin dw-mod wgo-file-input u-ta-center"> 2071 <input aria-label="@settings.ChooseFileText" aria-labelledby="@filesListId" @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" /> 2072 2073 <div id="@filesListId" class="@settings.CssClass dw-mod wgo-file-input-files-list">@settings.NoFilesChosenText</div> 2074 <div> 2075 <button type="button" class="file-input__btn btn--secondary btn dw-mod wgo-file-input-clear">Clear</button> 2076 <button type="button" class="file-input__btn btn--secondary btn dw-mod wgo-file-input-add">@settings.ChooseFileText</button> 2077 </div> 2078 @if (settings.UploadButton != null) 2079 { 2080 settings.UploadButton.CssClass += " btn--condensed u-no-margin"; 2081 @Render(settings.UploadButton) 2082 } 2083 </div> 2084 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 2085 </div> 2086 } 2087 2088 @helper RenderArticleBannerCustom(ArticleHeader settings) 2089 { 2090 string filterClasses = "image-filter image-filter--darken"; 2091 settings.Layout = ArticleHeaderLayout.Banner; 2092 2093 if (settings.Image != null) 2094 { 2095 if (settings.Image.Path != null) 2096 { 2097 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 2098 <div class="background-image @filterClasses dw-mod"> 2099 <div class="background-image__wrapper @filterClasses dw-mod"> 2100 @{ 2101 settings.Image.CssClass += "background-image__cover dw-mod"; 2102 } 2103 @Render(settings.Image) 2104 </div> 2105 </div> 2106 <div class="center-container dw-mod"> 2107 <div class="grid"> 2108 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg"> 2109 <div class="u-left-middle"> 2110 <div> 2111 <div class="article--date--and--category u-flex grid--align-center grid--justify-center"> 2112 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2113 { 2114 <div class="article__post-info dw-mod item" style="color: @settings.TextColor">@settings.Author @settings.Date</div> 2115 } 2116 @if (!String.IsNullOrEmpty(settings.Category)) 2117 { 2118 <div class="item"> 2119 <div class="article__category dw-mod">@settings.Category</div> 2120 </div> 2121 } 2122 </div> 2123 @if (!String.IsNullOrEmpty(settings.Heading)) 2124 { 2125 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 2126 } 2127 @if (!String.IsNullOrEmpty(settings.Subheading)) 2128 { 2129 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 2130 } 2131 @if (!String.IsNullOrEmpty(settings.Link)) 2132 { 2133 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 2134 } 2135 @if (!String.IsNullOrEmpty(settings.Link)) 2136 { 2137 <div class="grid__cell"> 2138 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2139 </div> 2140 } 2141 </div> 2142 </div> 2143 </div> 2144 @if (settings.ExternalParagraphId != 0) 2145 { 2146 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod"> 2147 <div class="u-color-light-gray--bg u-color-dark dw-mod"> 2148 @RenderParagraphContent(settings.ExternalParagraphId) 2149 </div> 2150 </div> 2151 } 2152 2153 </div> 2154 </div> 2155 </section> 2156 if (!String.IsNullOrEmpty(settings.Image.Caption)) 2157 { 2158 <div class="image-caption dw-mod">@settings.Image.Caption</div> 2159 } 2160 } 2161 else 2162 { 2163 settings.Layout = ArticleHeaderLayout.Clean; 2164 @RenderArticleCleanHeaderCustom(settings); 2165 } 2166 } 2167 else 2168 { 2169 settings.Layout = ArticleHeaderLayout.Clean; 2170 @RenderArticleCleanHeaderCustom(settings); 2171 } 2172 } 2173 2174 @helper RenderArticleCleanHeaderCustom(ArticleHeader settings) 2175 { 2176 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 2177 2178 <div class="grid grid--align-content-start grid--justify-start"> 2179 <div class="[email protected] grid__col-sm-12 u-padding--lg dw-mod"> 2180 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 2181 { 2182 <div class="article--date--and--category u-flex grid--align-center grid--justify-center"> 2183 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2184 { 2185 <div class="article__post-info dw-mod item" style="color: @settings.TextColor">@settings.Author @settings.Date</div> 2186 } 2187 @if (!String.IsNullOrEmpty(settings.Category)) 2188 { 2189 <div class="item"> 2190 <div class="article__category dw-mod">@settings.Category</div> 2191 </div> 2192 } 2193 </div> 2194 } 2195 2196 <div class="grid__cell"> 2197 @if (!String.IsNullOrEmpty(settings.Heading)) 2198 { 2199 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 2200 } 2201 @if (settings.Image != null) 2202 { 2203 if (settings.Image.Path != null) 2204 { 2205 <div class="u-padding-bottom--lg"> 2206 @Render(settings.Image) 2207 </div> 2208 } 2209 } 2210 @if (!String.IsNullOrEmpty(settings.Subheading)) 2211 { 2212 <div class="article__leadtext dw-mod">@settings.Subheading</div> 2213 } 2214 @if (!String.IsNullOrEmpty(settings.Link)) 2215 { 2216 <div class="grid__cell"> 2217 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2218 </div> 2219 } 2220 </div> 2221 </div> 2222 @if (settings.ExternalParagraphId != 0) 2223 { 2224 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 2225 @RenderParagraphContent(settings.ExternalParagraphId) 2226 </div> 2227 } 2228 </div> 2229 } 2230 2231 @foreach (LoopItem country in GetLoop("Countries")) 2232 { 2233 <div class="country u-hidden" country-name="@country.GetString("Ecom:Country.Name")" country-code="@country.GetString("Ecom:Country.Code2")"> 2234 @foreach (LoopItem region in country.GetLoop("Regions")) 2235 { 2236 <span class="region" region-name="@region.GetString("Ecom:Region.Name")" region-code="@region.GetString("Ecom:Region.RegionCode")"></span> 2237 } 2238 </div> 2239 } 2240 2241 @helper RenderCustomerAddress() { 2242 var _countriesLoop = GetLoop("Countries"); 2243 var _customerRegionsLoop = GetLoop("CustomerRegions"); 2244 var displayBlockOnMobile = Pageview.Device == DeviceType.Mobile ? "u-block" : string.Empty; 2245 <div class="card-header u-color-light--bg dw-mod"> 2246 <h3>@Translate("Customer Information")</h3> 2247 </div> 2248 2249 <div class="card u-color-light--bg dw-mod customer-info-wrapper" data-error="@Translate("One or more customer information fields are missing value")" data-phone-length="@Translate("Phone number should have at least 10 digits")" data-invalid-email="@Translate("Invalid email")"> 2250 @if (!Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName")) || GetLoop("ValidationErrors").Any()) 2251 { 2252 <div class="form__field-group dw-mod"> 2253 @Render(new TextField 2254 { 2255 Label = Translate("Name"), 2256 Id = "EcomOrderDeliveryName", 2257 Name = "EcomOrderDeliveryName", 2258 Value = GetString("Ecom:Order.Delivery.Name"), 2259 Required = true, 2260 ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryName.ErrorMessage"), 2261 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryName.ErrorMessage")) ? "error-field" : "" 2262 }) 2263 </div> 2264 @* used First() because there will always be only one orderline in the cart *@ 2265 var isMembershipRenewal = GetLoop("OrderLines").First().GetBoolean("Ecom:Product:Field.IsMemberShipRenewal"); 2266 if (isMembershipRenewal) 2267 { 2268 <div class="form__field-group dw-mod"> 2269 @Render(new TextField 2270 { 2271 Label = Translate("WIT Number"), 2272 Id = "WITNumber", 2273 Name = "WITNumber", 2274 Value = GetString("WITNumber.Clean"), 2275 ErrorMessage = GetString("Ecom:Cart.ValidationError.WITNumber.ErrorMessage"), 2276 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.WITNumber.ErrorMessage")) ? "error-field" : "" 2277 }) 2278 </div> 2279 } 2280 2281 <div class="form__field-group dw-mod"> 2282 @Render(new TextField 2283 { 2284 Label = Translate("RV Serial Number or VIN"), 2285 Id = "RVSerialNumber", 2286 Name = "RVSerialNumber", 2287 Value = GetString("RVSerialNumber.Clean"), 2288 Required = true, 2289 ErrorMessage = GetString("Ecom:Cart.ValidationError.RVSerialNumber.ErrorMessage"), 2290 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.RVSerialNumber.ErrorMessage")) ? "error-field" : "", 2291 ExtraAttributes = new Dictionary<string, string> {{"maxlength", "17" }} 2292 }) 2293 <p class="font-size-075em u-margin-bottom">(@Translate("Motorized Vehicles begin with 10, 15, 70, or 80 and have 11 or 12 digits").)</p> 2294 <p class="font-size-075em">(@Translate("Towables can have up to 17 digits").)</p> 2295 </div> 2296 2297 <div class="form__fields-collection form__fields-collection--3-3 @displayBlockOnMobile"> 2298 <div class="form__field-group dw-mod"> 2299 @if (GetBoolean("Ecom:Cart.CreateUserInCheckout") && string.IsNullOrWhiteSpace(GetGlobalValue("Global:Extranet.UserName"))) 2300 { 2301 @Render(new TextField 2302 { 2303 Label = Translate("Email"), 2304 Id = "EcomOrderDeliveryEmail", 2305 Name = "EcomOrderDeliveryEmail", 2306 Value = GetString("Ecom:Order.Delivery.Email"), 2307 ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryEmail.ErrorMessage"), 2308 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryEmail.ErrorMessage")) ? "error-field u-full-width" : "u-full-width", 2309 ExtraAttributes = new Dictionary<string, string> {{ "onchange", "document.getElementById('EcomUserCreateUserName').value = this.value;" }} 2310 }) 2311 @Render(new HiddenField {Id = "EcomUserCreateUserName" , Value = @GetString("Ecom:Order.Customer.Email")}) 2312 @Render(new HiddenField {Id = "EcomUserCreateNew" , Value = "True"}) 2313 string pass = Guid.NewGuid().ToString(); 2314 @Render(new HiddenField {Id = "EcomUserCreatePassword" , Value = @pass}) 2315 @Render(new HiddenField {Id = "EcomUserCreateConfirmPassword" , Value = @pass}) 2316 } 2317 else 2318 { 2319 @Render(new TextField 2320 { 2321 Label = Translate("Email"), 2322 Id = "EcomOrderDeliveryEmail", 2323 Name = "EcomOrderDeliveryEmail", 2324 Value = GetString("Ecom:Order.Delivery.Email"), 2325 Required = true, 2326 ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryEmail.ErrorMessage"), 2327 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryEmail.ErrorMessage")) ? "error-field u-full-width" : "u-full-width" 2328 }) 2329 2330 } 2331 </div> 2332 2333 <div class="form__field-group dw-mod"> 2334 @Render(new TextField 2335 { 2336 Label = Translate("Cell Phone"), 2337 Id = "EcomOrderDeliveryPhone", 2338 Name = "EcomOrderDeliveryPhone", 2339 Value = GetString("Ecom:Order.Delivery.Phone"), 2340 Required = true, 2341 ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryPhone.ErrorMessage"), 2342 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryPhone.ErrorMessage")) ? "error-field" : "" 2343 }) 2344 </div> 2345 </div> 2346 2347 <div class="form__fields-collection form__fields-collection--3-2 @displayBlockOnMobile"> 2348 <div class="form__field-group dw-mod"> 2349 @Render(new TextField 2350 { 2351 Label = Translate("Home Address"), 2352 Id = "EcomOrderDeliveryAddress", 2353 Name = "EcomOrderDeliveryAddress", 2354 Value = GetString("Ecom:Order.Delivery.Address"), 2355 Required = true, 2356 ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryAddress.ErrorMessage"), 2357 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryAddress.ErrorMessage")) ? "error-field" : "" 2358 }) 2359 </div> 2360 2361 <div class="form__field-group dw-mod"> 2362 @Render(new TextField 2363 { 2364 Label = Translate("Apt/Suite"), 2365 Id = "Apt", 2366 Name = "Apt", 2367 Value = GetString("Apt.Clean"), 2368 ErrorMessage = GetString("Ecom:Cart.ValidationError.Apt.ErrorMessage"), 2369 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.Apt.ErrorMessage")) ? "error-field" : "" 2370 }) 2371 </div> 2372 </div> 2373 2374 <div class="form__fields-collection form__fields-collection--3-2 @displayBlockOnMobile"> 2375 <div class="form__field-group dw-mod"> 2376 @{ 2377 var EcomOrderDeliveryCountry = new SelectField 2378 { 2379 Id = "EcomOrderDeliveryCountry", 2380 Name = "EcomOrderDeliveryCountry", 2381 Label = Translate("Country"), 2382 OnChange = "countryChangeHandler(event)", 2383 ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryCountry.ErrorMessage"), 2384 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryCountry.ErrorMessage")) ? "error-field" : "custom-select u-hidden", 2385 ExtraAttributes = new Dictionary<string, string> {{ "name", "EcomOrderDeliveryCountry" }} 2386 }; 2387 2388 foreach (LoopItem country2 in _countriesLoop) 2389 { 2390 bool selected = GetString("Ecom:Order.Customer.Country.Code") == country2.GetString("Ecom:Country.Code2"); 2391 if (selected) 2392 { 2393 EcomOrderDeliveryCountry.Options.Add(new SelectFieldOption {ExtraAttributes = new Dictionary<string, string> {{ "selected", "true" }} , Label = country2.GetString("Ecom:Country.Name"), Value = country2.GetString("Ecom:Country.Code2")}); 2394 } 2395 else 2396 { 2397 EcomOrderDeliveryCountry.Options.Add(new SelectFieldOption {Label = country2.GetString("Ecom:Country.Name"), Value = country2.GetString("Ecom:Country.Code2")}); 2398 } 2399 } 2400 } 2401 @Render(EcomOrderDeliveryCountry) 2402 </div> 2403 2404 <div class="form__field-group dw-mod"> 2405 @Render(new TextField 2406 { 2407 Label = Translate("City"), 2408 Id = "EcomOrderDeliveryCity", 2409 Name = "EcomOrderDeliveryCity", 2410 Value = GetString("Ecom:Order.Delivery.City"), 2411 Required = true, 2412 ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryCity.ErrorMessage"), 2413 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryCity.ErrorMessage")) ? "error-field" : "" 2414 }) 2415 </div> 2416 2417 <div class="form__field-group dw-mod"> 2418 @{ 2419 var EcomDeliveryRegionSelect = new SelectField 2420 { 2421 Id = "EcomOrderDeliveryRegion", 2422 Name = "EcomOrderDeliveryRegion", 2423 Label = Translate("State/Region"), 2424 ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryRegion.ErrorMessage"), 2425 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryRegion.ErrorMessage")) ? "error-field" : "custom-select u-hidden", 2426 ExtraAttributes = new Dictionary<string, string> {{"name", "EcomOrderDeliveryRegion"}} 2427 }; 2428 2429 foreach (LoopItem state in _customerRegionsLoop) 2430 { 2431 EcomDeliveryRegionSelect.Options.Add(new SelectFieldOption {Label = state.GetString("Ecom:CustomerRegion.Name"), Value = state.GetString("Ecom:CustomerRegion.Name")}); 2432 } 2433 } 2434 @Render(EcomDeliveryRegionSelect) 2435 </div> 2436 2437 <div class="form__field-group dw-mod"> 2438 @Render(new TextField 2439 { 2440 Label = Translate("Zip"), 2441 Id = "EcomOrderDeliveryZip", 2442 Name = "EcomOrderDeliveryZip", 2443 Value = GetString("Ecom:Order.Delivery.Zip"), 2444 Required = true, 2445 ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryZip.ErrorMessage"), 2446 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryZip.ErrorMessage")) ? "error-field" : "" 2447 }) 2448 </div> 2449 </div> 2450 } 2451 else 2452 { 2453 var customerRegionsLoop = GetLoop("CustomerRegions"); 2454 var selectedStateName = ""; 2455 if (customerRegionsLoop.Any()) 2456 { 2457 2458 foreach (LoopItem state in customerRegionsLoop) 2459 { 2460 if (GetString("Ecom:Order.Customer.Region") == state.GetString("Ecom:CustomerRegion.Name")) { 2461 selectedStateName = state.GetString("Ecom:CustomerRegion.Name"); 2462 } 2463 } 2464 } 2465 2466 //When the user is signed in, show static address fields 2467 @Render(new Table { 2468 Design = TableDesign.Clean, 2469 CssClass = "table--compact", 2470 Rows = new List<TableRow> { 2471 new TableRow ( 2472 new TableCell { Content = Translate("Company")}, 2473 new TableCell { Content = Converter.ToString(Render(new TextField 2474 { 2475 CssClass = "u-full-width u-truncate-text", 2476 Name = "EcomOrderCustomerCompany", 2477 Id = "EcomOrderCustomerCompany", 2478 Value = GetString("Ecom:Order.Customer.Company"), 2479 ExtraAttributes = new Dictionary<string, string> {{"readonly", "true"}} 2480 }))} 2481 ), 2482 new TableRow ( 2483 new TableCell { Content = Translate("Name") }, 2484 new TableCell { Content = Converter.ToString(Render(new TextField 2485 { 2486 CssClass = "u-full-width u-truncate-text", 2487 Name = "EcomOrderCustomerName", 2488 Id = "EcomOrderCustomerName", 2489 Value = GetString("Ecom:Order.Customer.Name"), 2490 ExtraAttributes = new Dictionary<string, string> {{"readonly", "true"}} 2491 })) } 2492 ), 2493 new TableRow ( 2494 new TableCell { Content = Translate("Phone") }, 2495 new TableCell { Content = Converter.ToString(Render(new TextField 2496 { 2497 CssClass = "u-full-width u-truncate-text", 2498 Name = "EcomOrderCustomerPhone", 2499 Id = "EcomOrderCustomerPhone", 2500 Value = GetString("Ecom:Order.Customer.Phone"), 2501 ExtraAttributes = new Dictionary<string, string> {{"readonly", "true"}} 2502 })) } 2503 ), 2504 new TableRow ( 2505 new TableCell { Content = Translate("Email") }, 2506 new TableCell { Content = Converter.ToString(Render(new TextField 2507 { 2508 CssClass = "u-full-width u-truncate-text", 2509 Name = "EcomOrderCustomerEmail", 2510 Id = "EcomOrderCustomerEmail", 2511 Value = GetString("Ecom:Order.Customer.Email"), 2512 ExtraAttributes = new Dictionary<string, string> {{"readonly", "true"}} 2513 })) } 2514 ), 2515 new TableRow ( 2516 new TableCell { Content = Translate("Address")}, 2517 new TableCell { Content = Converter.ToString(Render(new TextField 2518 { 2519 CssClass = "u-full-width u-truncate-text", 2520 Name = "EcomOrderCustomerAddress", 2521 Id = "EcomOrderCustomerAddress", 2522 Value = GetString("Ecom:Order.Customer.Address"), 2523 ExtraAttributes = new Dictionary<string, string> {{"readonly", "true"}} 2524 })) } 2525 ), 2526 new TableRow ( 2527 new TableCell { Content = Translate("Zip code")}, 2528 new TableCell { Content = Converter.ToString(Render(new TextField 2529 { 2530 CssClass = "u-full-width u-truncate-text", 2531 Name = "EcomOrderCustomerZip", 2532 Id = "EcomOrderCustomerZip", 2533 Value = GetString("Ecom:Order.Customer.Zip"), 2534 ExtraAttributes = new Dictionary<string, string> {{"readonly", "true"}} 2535 })) } 2536 ), 2537 new TableRow ( 2538 new TableCell { Content = Translate("City")}, 2539 new TableCell { Content = Converter.ToString(Render(new TextField 2540 { 2541 CssClass = "u-full-width u-truncate-text", 2542 Name = "EcomOrderCustomerCity", 2543 Id = "EcomOrderCustomerCity", 2544 Value = GetString("Ecom:Order.Customer.City"), 2545 ExtraAttributes = new Dictionary<string, string> {{"readonly", "true"}} 2546 }))} 2547 ), 2548 new TableRow ( 2549 new TableCell { Content = Translate("State/Region")}, 2550 new TableCell { Content = Converter.ToString(Render(new TextField 2551 { 2552 CssClass = "u-full-width u-truncate-text", 2553 Name = "EcomOrderCustomerRegion", 2554 Id = "EcomOrderCustomerRegion", 2555 Value = selectedStateName, 2556 ExtraAttributes = new Dictionary<string, string> {{"readonly", "true"}} 2557 }))} 2558 ), 2559 new TableRow ( 2560 new TableCell { Content = Translate("Country")}, 2561 new TableCell { Content = Converter.ToString(Render(new TextField 2562 { 2563 CssClass = "u-full-width u-truncate-text", 2564 Name = "EcomOrderCustomerCountry", 2565 Id = "EcomOrderCustomerCountry", 2566 Value = GetString("Ecom:Order.Customer.Country"), 2567 ExtraAttributes = new Dictionary<string, string> {{"readonly", "true"}} 2568 }))} 2569 ), 2570 } 2571 }); 2572 } 2573 </div> 2574 } 2575 2576 @helper RenderNextButtonCustom() 2577 { 2578 <div class="u-pull--right"> 2579 @Render(new Button 2580 { 2581 ButtonType = ButtonType.Submit, 2582 ButtonLayout = ButtonLayout.Primary, 2583 CssClass = "u-no-margin u-pull--right", 2584 Name = GetString("CartV2.NextStepButtonName"), 2585 Title = Translate("Next"), 2586 Id = GetString("CartV2.NextStepButtonName") 2587 }) 2588 </div> 2589 } 2590 2591 2592 @helper RenderBillingAddressCustom() 2593 { 2594 <div class="card-header u-color-light--bg dw-mod"> 2595 <h3>@Translate("Billing Address")</h3> 2596 </div> 2597 <div class="card u-color-light--bg dw-mod billing-address-area" data-error="@Translate("One or more billing information fields are missing value")"> 2598 2599 2600 <div class="form__field-group dw-mod"> 2601 @Render(new CheckboxField 2602 { 2603 Label = Translate("Billing address is the same as home address"), 2604 Checked = true, 2605 CssClass = "billing-same-as-home-address" 2606 }) 2607 </div> 2608 2609 <div class="billing-address-wrapper u-hidden"> 2610 <div class="form__fields-collection form__fields-collection--3-2"> 2611 <div class="form__field-group dw-mod u-hidden"> 2612 @Render(new HiddenField 2613 { 2614 Id = "EcomOrderCustomerName", 2615 Name = "EcomOrderCustomerName", 2616 Value = GetString("Ecom:Order.Customer.Name") 2617 }) 2618 </div> 2619 2620 <div class="form__field-group dw-mod u-hidden"> 2621 @Render(new HiddenField 2622 { 2623 Id = "EcomOrderCustomerEmail", 2624 Name = "EcomOrderCustomerEmail", 2625 Value = GetString("Ecom:Order.Customer.Email") 2626 }) 2627 </div> 2628 2629 <div class="form__field-group dw-mod u-hidden"> 2630 @Render(new HiddenField 2631 { 2632 Id = "EcomOrderCustomerPhone", 2633 Name = "EcomOrderCustomerPhone", 2634 Value = GetString("Ecom:Order.Customer.Phone") 2635 }) 2636 </div> 2637 2638 <div class="form__field-group dw-mod"> 2639 @Render(new TextField 2640 { 2641 Label = Translate("Address"), 2642 Id = "EcomOrderCustomerAddress", 2643 Name = "EcomOrderCustomerAddress", 2644 Value = GetString("Ecom:Order.Customer.Address"), 2645 Required = true, 2646 ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryAddress.ErrorMessage"), 2647 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryAddress.ErrorMessage")) ? "error-field" : "" 2648 }) 2649 </div> 2650 2651 <div class="form__field-group dw-mod"> 2652 @Render(new TextField 2653 { 2654 Label = Translate("Apt/Suite"), 2655 Id = "AptCustomer", 2656 Name = "AptCustomer", 2657 Value = GetString("AptCustomer.Clean"), 2658 ErrorMessage = GetString("Ecom:Cart.ValidationError.AptCustomer.ErrorMessage"), 2659 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.AptCustomer.ErrorMessage")) ? "error-field" : "" 2660 }) 2661 </div> 2662 </div> 2663 2664 <div class="form__fields-collection form__fields-collection--3-2"> 2665 <div class="form__field-group dw-mod"> 2666 @{ 2667 var EcomOrderCustomerCountry = new SelectField 2668 { 2669 Id = "EcomOrderCustomerCountry", 2670 Name = "EcomOrderCustomerCountry", 2671 Label = Translate("Country"), 2672 OnChange = "countryChangeHandler(event)", 2673 ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderCustomerCountry.ErrorMessage"), 2674 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.EcomOrderCustomerCountry.ErrorMessage")) ? "error-field" : "custom-select u-hidden", 2675 ExtraAttributes = new Dictionary<string, string> {{ "name", "EcomOrderCustomerCountry" }} 2676 }; 2677 2678 foreach (LoopItem country2 in GetLoop("Countries")) 2679 { 2680 bool selected = GetString("Ecom:Order.Customer.Country.Code") == country2.GetString("Ecom:Country.Code2"); 2681 if (selected) 2682 { 2683 EcomOrderCustomerCountry.Options.Add(new SelectFieldOption {ExtraAttributes = new Dictionary<string, string> {{ "selected", "selected" }} , Label = country2.GetString("Ecom:Country.Name"), Value = country2.GetString("Ecom:Country.Code2")}); 2684 } 2685 else 2686 { 2687 EcomOrderCustomerCountry.Options.Add(new SelectFieldOption {Label = country2.GetString("Ecom:Country.Name"), Value = country2.GetString("Ecom:Country.Code2")}); 2688 } 2689 2690 } 2691 } 2692 @Render(EcomOrderCustomerCountry) 2693 </div> 2694 2695 <div class="form__field-group dw-mod"> 2696 @Render(new TextField 2697 { 2698 Label = Translate("City"), 2699 Id = "EcomOrderCustomerCity", 2700 Name = "EcomOrderCustomerCity", 2701 Value = GetString("Ecom:Order.Customer.City"), 2702 Required = true, 2703 ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderCustomerCity.ErrorMessage"), 2704 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.EcomOrderCustomerCity.ErrorMessage")) ? "error-field" : "" 2705 }) 2706 </div> 2707 2708 <div class="form__field-group dw-mod"> 2709 @{ 2710 var EcomOrderCustomerRegion = new SelectField 2711 { 2712 Id = "EcomOrderCustomerRegion", 2713 Name = "EcomOrderCustomerRegion", 2714 Label = Translate("State/Region"), 2715 ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderCustomerRegion.ErrorMessage"), 2716 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.EcomOrderCustomerRegion.ErrorMessage")) ? "error-field" : "custom-select u-hidden", 2717 ExtraAttributes = new Dictionary<string, string> {{"name", "EcomOrderCustomerRegion"}} 2718 }; 2719 2720 foreach (LoopItem state in GetLoop("CustomerRegions")) 2721 { 2722 EcomOrderCustomerRegion.Options.Add(new SelectFieldOption {Label = state.GetString("Ecom:CustomerRegion.Name"), Value = state.GetString("Ecom:CustomerRegion.Name")}); 2723 } 2724 } 2725 2726 2727 @Render(EcomOrderCustomerRegion) 2728 </div> 2729 2730 <div class="form__field-group dw-mod"> 2731 @Render(new TextField 2732 { 2733 Label = Translate("Zip"), 2734 Id = "EcomOrderCustomerZip", 2735 Name = "EcomOrderCustomerZip", 2736 Value = GetString("Ecom:Order.Customer.Zip"), 2737 Required = true, 2738 ErrorMessage = GetString("Ecom:Cart.ValidationError.EcomOrderCustomerZip.ErrorMessage"), 2739 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.EcomOrderCustomerZip.ErrorMessage")) ? "error-field" : "" 2740 }) 2741 </div> 2742 </div> 2743 </div> 2744 </div> 2745 } 2746 2747 @helper RenderAdditionalInformationCustom() 2748 { 2749 var productIsGNR = Dynamicweb.Ecommerce.Services.Products.GetProductById(GetString("Ecom:LastAddedProduct.ID"), "", true).ProductFieldValues.GetProductFieldValue("IsGNR").Value; 2750 if (productIsGNR.ToString() == "True") 2751 { 2752 <div class="card-header u-color-light--bg dw-mod"> 2753 <h3>@Translate("Additional Information")</h3> 2754 </div> 2755 2756 2757 <div class="card u-color-light--bg dw-mod additional-info-wrapper" data-error="@Translate("One or more additional information fields are missing value")"> 2758 2759 2760 <div class="form__field-group dw-mod"> 2761 @Render(new TextField 2762 { 2763 Label = Translate("Co-Pilot Name"), 2764 Id = "CoPilotName", 2765 Name = "CoPilotName", 2766 Value = GetString("CoPilotName.Clean"), 2767 Required = true, 2768 ErrorMessage = GetString("Ecom:Cart.ValidationError.CoPilotName.ErrorMessage"), 2769 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.CoPilotName.ErrorMessage")) ? "error-field" : "" 2770 }) 2771 </div> 2772 2773 2774 <div class="form__field-group form__field--inline dw-mod" data-first-time-translate="@Translate("Please choose an option on first time attending")"> 2775 <div class="card-header u-color-light--bg dw-mod u-no-border-bottom u-padding-y-025"> 2776 <label class="required-label">@Translate("First Time Attending GNR")</label> 2777 </div> 2778 @{ 2779 var firstTimeAttendingGNRYes = new RadioButtonField 2780 { 2781 Name = "FirstTimeAttendingGNR", 2782 Label = Translate("Yes"), 2783 Value = "Yes", 2784 Id = "FirstTimeAttendingGNRYes", 2785 ErrorMessage = GetString("Ecom:Cart.ValidationError.FirstTimeAttendingGNR.ErrorMessage"), 2786 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.FirstTimeAttendingGNR.ErrorMessage")) ? "error-field" : "" 2787 }; 2788 @Render(firstTimeAttendingGNRYes) 2789 var firstTimeAttendingGNRNo = new RadioButtonField 2790 { 2791 Name = "FirstTimeAttendingGNR", 2792 Label = Translate("No"), 2793 Value = "No", 2794 Id = "FirstTimeAttendingGNRNo", 2795 ErrorMessage = GetString("Ecom:Cart.ValidationError.FirstTimeAttendingGNR.ErrorMessage"), 2796 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.FirstTimeAttendingGNR.ErrorMessage")) ? "error-field" : "" 2797 }; 2798 @Render(firstTimeAttendingGNRNo) 2799 } 2800 </div> 2801 2802 <div class="form__field-group dw-mod"> 2803 @Render(new TextField 2804 { 2805 Label = Translate("RV Model Name"), 2806 Id = "RVModelName", 2807 Name = "RVModelName", 2808 Value = GetString("RVModelName.Clean"), 2809 Required = true, 2810 ErrorMessage = GetString("Ecom:Cart.ValidationError.RVModelName.ErrorMessage"), 2811 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.RVModelName.ErrorMessage")) ? "error-field" : "" 2812 }) 2813 </div> 2814 2815 2816 <div class="form__field-group form__field--inline dw-mod" data-my-unit-is-translate="@Translate("Please choose an option on my unit is")"> 2817 <div class="card-header u-color-light--bg dw-mod u-no-border-bottom u-padding-y-025"> 2818 <label class="required-label">@Translate("My Unit Is: ")</label> 2819 </div> 2820 @{ 2821 var myUnitIs30 = new RadioButtonField 2822 { 2823 Name = "MyUnitIs", 2824 Label = Translate("30 Amp"), 2825 Value = "30Amp", 2826 Id = "MyUnitIs30Amp", 2827 ErrorMessage = GetString("Ecom:Cart.ValidationError.MyUnitIs.ErrorMessage"), 2828 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.MyUnitIs.ErrorMessage")) ? "error-field" : "" 2829 }; 2830 @Render(myUnitIs30) 2831 var myUnitIs50 = new RadioButtonField 2832 { 2833 Name = "MyUnitIs", 2834 Label = Translate("50 Amp"), 2835 Value = "50Amp", 2836 Id = "MyUnitIs50Amp", 2837 ErrorMessage = GetString("Ecom:Cart.ValidationError.MyUnitIs.ErrorMessage"), 2838 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.MyUnitIs.ErrorMessage")) ? "error-field" : "" 2839 }; 2840 @Render(myUnitIs50) 2841 } 2842 </div> 2843 2844 <div class="form__field-group dw-mod"> 2845 @Render(new TextField 2846 { 2847 Label = Translate("Length of RV, including permanent attachments (not including tow bar)"), 2848 Id = "LengthOfRV", 2849 Name = "LengthOfRV", 2850 Value = GetString("LengthOfRV.Clean"), 2851 Required = true, 2852 ErrorMessage = GetString("Ecom:Cart.ValidationError.LengthOfRV.ErrorMessage"), 2853 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.LengthOfRV.ErrorMessage")) ? "error-field" : "" 2854 }) 2855 </div> 2856 2857 2858 <div class="form__field-group dw-mod"> 2859 2860 @Render(new TextField 2861 { 2862 Label = Translate("Emergency Contact Name and Phone Number (non-attending)"), 2863 Id = "EmergencyContactNameAndPhoneNumber", 2864 Name = "EmergencyContactNameAndPhoneNumber", 2865 Value = GetString("EmergencyContactNameAndPhoneNumber.Clean"), 2866 Required = true, 2867 ErrorMessage = GetString("Ecom:Cart.ValidationError.EmergencyContactNameAndPhoneNumber.ErrorMessage"), 2868 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.EmergencyContactNameAndPhoneNumber.ErrorMessage")) ? "error-field" : "" 2869 }) 2870 </div> 2871 2872 2873 <div class="form__field-group dw-mod"> 2874 @Render(new TextareaField 2875 { 2876 Label = Translate("Please list all Guest Name(s) as you would like them to appear on name badges.<br>Guests must be staying in your RV for admittance to GNR"), 2877 Id = "AllGuestsNames", 2878 Name = "AllGuestsNames", 2879 Value = GetString("AllGuestsNames.Clean"), 2880 Required = true, 2881 ErrorMessage = GetString("Ecom:Cart.ValidationError.AllGuestsNames.ErrorMessage"), 2882 CssClass = !string.IsNullOrEmpty(GetString("Ecom:Cart.ValidationError.AllGuestsNames.ErrorMessage")) ? "error-field" : "" 2883 }) 2884 </div> 2885 </div> 2886 } 2887 @RenderDataPolicyDisclaimer() 2888 @RenderNextButtonCustom() 2889 } 2890 2891 @helper RenderDataPolicyDisclaimer() 2892 { 2893 <div class="card u-color-light--bg dw-mod"> 2894 <small class="form__help-text">@Translate("I accept that Winnebago may store my data and send me newsletters as described in the ") 2895 <span class="font-size-115em u-ta-underline u-custom-data-policy"> 2896 @Render(new Link 2897 { 2898 Href = "/Default.aspx?ID=" + GetPageIdByNavigationTag("PrivacyPolicy"), CssClass = "u-no-padding", Title = Translate("Privacy Policy."), ButtonLayout = ButtonLayout.None 2899 }) 2900 </span> 2901 </small> 2902 </div> 2903 } 2904 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2905 @using Dynamicweb.Core 2906 @using System 2907 @using System.Web 2908 @using System.Collections.Generic 2909 @using Dynamicweb.Rapido.Blocks 2910 2911 @{ 2912 BlocksPage stepBarCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); 2913 2914 Block checkoutSteps = new Block() 2915 { 2916 Id = "StepBar", 2917 SortId = 10, 2918 Template = RenderStepBar(), 2919 Design = new Design { 2920 RenderType = RenderType.Column, 2921 Size = "12" 2922 } 2923 }; 2924 stepBarCheckoutPage.Add("CheckoutForm", checkoutSteps); 2925 } 2926 2927 @helper RenderStepBar() 2928 { 2929 string stepNumber = ""; 2930 2931 <div class="step-bar dw-mod"> 2932 @foreach (LoopItem step in GetLoop("StepButtons")) 2933 { 2934 if (step.GetString("Step.Name").ToLower() != "checkout") 2935 { 2936 string activeStep = step.GetBoolean("Step.Current") ? "step-bar__step--active" : ""; 2937 2938 if (GetLoop("StepButtons").Count > 2) 2939 { 2940 stepNumber = step.GetString("Step.Number") + "."; 2941 } 2942 2943 <div class="step-bar__step @activeStep dw-mod"> 2944 @stepNumber @Translate(step.GetString("Step.Name")) 2945 </div> 2946 } 2947 } 2948 </div> 2949 } 2950 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2951 @using Dynamicweb.Core 2952 @using System 2953 @using System.Web 2954 @using System.Collections.Generic 2955 @using System.Text.RegularExpressions 2956 @using Dynamicweb.Extensibility 2957 @using Dynamicweb.Content 2958 @using Dynamicweb.Core 2959 @using Dynamicweb.Ecommerce.Orders 2960 @using Dynamicweb.Ecommerce.Orders.SalesDiscounts 2961 @using Dynamicweb.Rapido.Blocks 2962 2963 @{ 2964 BlocksPage staticSummaryCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); 2965 2966 Block staticSummaryCustom = new Block() 2967 { 2968 Id = "StaticSummary", 2969 SortId = 20, 2970 Template = RenderStaticSummaryCustom(), 2971 Design = new Design 2972 { 2973 RenderType = RenderType.Column, 2974 Size = "12" 2975 } 2976 }; 2977 staticSummaryCheckoutPage.Add("SummaryContainerRow", staticSummaryCustom); 2978 } 2979 2980 2981 @helper RenderStaticSummaryCustom() 2982 { 2983 int productCatalog = GetPageIdByNavigationTag("ProductsPage"); 2984 var hideSummaryInPaymentStep = GetString("CartV2.CurrentStepButtonName") == "CartV2.GotoStep1" ? "u-hidden" : ""; 2985 <div class="card-header u-bg-color-gray dw-mod @hideSummaryInPaymentStep"> 2986 <h3>@Translate("Order Summary")</h3> 2987 </div> 2988 2989 <div class="card-header dw-mod u-no-padding u-bg-color-white @hideSummaryInPaymentStep"> 2990 <span class="u-margin-left--lg registration-type">@Translate("Registration Type")</span> 2991 </div> 2992 2993 <div class="card u-color-light--bg u-no-padding--xs dw-mod @hideSummaryInPaymentStep"> 2994 <table class="table cart-table u-margin-bottom dw-mod"> 2995 <tbody> 2996 @foreach (LoopItem orderline in GetLoop("OrderLines")) 2997 { 2998 if (orderline.GetBoolean("Ecom:Order:OrderLine.IsProduct")) 2999 { 3000 string productLink = "/" + Regex.Replace(orderline.GetString("Ecom:Product.LinkGroup.Clean"), @"\?ID=\d*\&", "?ID=" + productCatalog + "&"); 3001 productLink += !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.ProductVariantID")) ? "&VariantID=" + orderline.GetString("Ecom:Order:OrderLine.ProductVariantID") : ""; 3002 var productName = orderline.GetString("Ecom:Product:Field.ParentProductName.Value") != "" ? orderline.GetString("Ecom:Product:Field.ParentProductName.Value") + " - " + orderline.GetString("Ecom:Order:OrderLine.ProductName") : orderline.GetString("Ecom:Order:OrderLine.ProductName"); 3003 3004 3005 <tr> 3006 <td class="u-w60px u-hidden"> 3007 @orderline.GetString("Ecom:Order:OrderLine.Quantity") x 3008 </td> 3009 <td title="@productName"> 3010 <a class="u-color-inherit">@productName</a> 3011 <div>@GetString("Ecom:Order:OrderLine.ProductVariantText")</div> 3012 <div>@orderline.GetString("Ecom:Order:OrderLine.UnitName")</div> 3013 </td> 3014 <td class="u-ta-right u-w120px">@orderline.GetString("Ecom:Order:OrderLine.Price")</td> 3015 </tr> 3016 3017 if (orderline.GetLoop("BOMItems").Count > 0) 3018 { 3019 <tr> 3020 <td colspan="3" class="u-no-padding"> 3021 <table class="u-no-margin u-color-light-gray--bg"> 3022 <tbody> 3023 @foreach (LoopItem bomitem in orderline.GetLoop("BOMItems")) 3024 { 3025 string bomItemLink = "/" + Regex.Replace(bomitem.GetString("Ecom:Product.LinkGroup.Clean"), @"\?ID=\d*\&", "?ID=" + productCatalog + "&"); 3026 3027 <tr> 3028 <td class="u-w60px">@bomitem.GetString("Ecom:Order:OrderLine.Quantity") x</td> 3029 <td title="{@bomitem.GetString("Ecom:Order:OrderLine.ProductName") @bomitem.GetString("Ecom:Order:OrderLine.ProductVariantText")"> 3030 <a href="@bomItemLink">@bomitem.GetString("Ecom:Order:OrderLine.ProductName")</a> 3031 <div>@bomitem.GetString("Ecom:Order:OrderLine.ProductVariantText")</div> 3032 <div>@bomitem.GetString("Ecom:Order:OrderLine.UnitName")</div> 3033 </td> 3034 <td class="u-hidden-xs u-hidden-xxs">&nbsp;</td> 3035 <td>&nbsp;</td> 3036 <td class="cart-table__price u-ta-right dw-mod">&nbsp;</td> 3037 </tr> 3038 } 3039 </tbody> 3040 </table> 3041 </td> 3042 </tr> 3043 } 3044 } 3045 else 3046 { 3047 <tr class="table__row--no-border"> 3048 <td class="u-w60px">&nbsp;</td> 3049 <td>@orderline.GetString("Ecom:Order:OrderLine.ProductName")</td> 3050 <td class="cart-table__price u-ta-right dw-mod">@orderline.GetString("Ecom:Order:OrderLine.Price")</td> 3051 </tr> 3052 } 3053 } 3054 </tbody> 3055 </table> 3056 </div> 3057 <div class="u-padding-05-1em u-bg-color-gray @hideSummaryInPaymentStep"> 3058 <div class="cart-summary__totals dw-mod">@Translate("Total")</div> 3059 <div class="cart-summary__totals u-pull--right dw-mod">@GetString("Ecom:Order.OrderLines.Total.Price")</div> 3060 </div> 3061 } 3062 3063 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3064 @using Dynamicweb.Core 3065 @using System 3066 @using System.Web 3067 @using System.Collections.Generic 3068 @using Dynamicweb.Rapido.Blocks 3069 @using Dynamicweb.Ecommerce.Orders 3070 3071 @{ 3072 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 3073 3074 BlocksPage googleImpressionsPage = BlocksPage.GetBlockPage("CheckoutPage"); 3075 3076 Block googleImpressionsBlock = new Block() 3077 { 3078 Id = "GoogleImpressionsBlock", 3079 SortId = 10, 3080 Template = RenderScript() 3081 }; 3082 3083 if (useGoogleTagManager) 3084 { 3085 googleImpressionsPage.Add("CheckoutBottomSnippets", googleImpressionsBlock); 3086 } 3087 } 3088 3089 @helper RenderScript() 3090 { 3091 <script> 3092 /** 3093 * A function to handle a click on a checkout button. This function uses the eventCallback 3094 * data layer variable to handle navigation after the ecommerce data has been sent to Google Analytics. 3095 */ 3096 dataLayer.push({ 3097 'event': 'checkout', 3098 'ecommerce': { 3099 'checkout': { 3100 'actionField': {'step': 1}, 3101 'products': [ 3102 @foreach (LoopItem orderline in GetLoop("OrderLines").Where(o => o.GetInteger("Ecom:Order:OrderLine.Type") != (int)OrderLineType.Tax).ToList()) 3103 { 3104 var groupObject = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(orderline.GetString("Ecom:Product.PrimaryOrFirstGroupID")); 3105 <text> 3106 { 3107 'name': "@orderline.GetString("Ecom:Order:OrderLine.ProductName")", 3108 'id': "@orderline.GetString("Ecom:Product.ID")", 3109 'price': "@orderline.GetDouble("Ecom:Order:OrderLine.UnitPrice.Price")", 3110 'brand': "@orderline.GetString("Ecom:Product:Field.brand.Value")", 3111 'category': "@(groupObject != null ? groupObject.Name : "")", 3112 'variant': "@orderline.GetString("Ecom:Order:OrderLine.ProductVariantID")", 3113 'quantity': @orderline.GetInteger("Ecom:Order:OrderLine.Quantity") 3114 }, 3115 </text> 3116 } 3117 ] 3118 } 3119 } 3120 }); 3121 </script> 3122 } 3123 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3124 @using Dynamicweb.Core 3125 @using System 3126 @using System.Web 3127 @using System.Collections.Generic 3128 @using Dynamicweb.Rapido.Blocks 3129 3130 @{ 3131 BlocksPage snippetsCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); 3132 3133 snippetsCheckoutPage.Add("CheckoutBottomSnippets", new Block 3134 { 3135 Id = "CartAddressesJavascript", 3136 SortId = 50, 3137 Template = RenderCartAddressesJavascript() 3138 }); 3139 } 3140 3141 @helper RenderCartAddressesJavascript() 3142 { 3143 <script> 3144 function resetStateField(stateFieldId) { 3145 let stateField = document.getElementById(stateFieldId); 3146 if (stateField) { 3147 stateField.value = ""; 3148 let disabledOption = stateField.querySelector("option:checked"); 3149 if (disabledOption) { 3150 disabledOption.disabled = false; 3151 disabledOption.removeAttribute("disabled"); 3152 } 3153 } 3154 } 3155 3156 document.addEventListener("DOMContentLoaded", function () { 3157 regionLabels.InitDictionary({ 3158 "CA": "@Translate("State/Province")", 3159 "US": "@Translate("State/Province")" 3160 }); 3161 regionLabels.LocalizeRegionLabels("EcomOrderCustomerRegion", "EcomOrderCustomerCountry"); 3162 regionLabels.LocalizeRegionLabels("EcomOrderDeliveryRegion", "EcomOrderDeliveryCountry"); 3163 }); 3164 </script> 3165 } 3166 3167 3168 3169 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width"> 3170 <div class="center-container center-container--with-background-image dw-mod"> 3171 <div class="paragraph-container u-padding"> 3172 <form novalidate name="ordersubmit" id="OrderSubmit" method="post" action="/[email protected]" autocomplete="off"> 3173 <div class="grid"> 3174 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 3175 @RenderBlockList(checkoutPage.BlocksRoot.BlocksList) 3176 </div> 3177 </form> 3178 </div> 3179 </div> 3180 </section>