Træsko Flex Tøffel str.43 ED

7007673

Robust og praktisk træsko uden hælkappe, med behagelig polstret vrist.

Kontakt altid butikken for at høre den aktuelle lagerstatus for et produkt.

PU/finer træsko uden hælkappe. Glat, vandafvisende og kraftigt kvalitetsskind med polstret vrist. Fodformet, slidstærk og stødabsorberende bundsål bestående af polyurethan sål med indlæg af finér.
Mærke No Brand
EAN/GLN nummer 5703374118672
Vægt (kg) 1
Køn Unisex
Error executing template "Designs/Rapido/ContentPage/Paragraph/RaptorIntegration.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at RaptorIntegration.DwAdapter.RaptorItemType.GetParameters(Settings settings, String urlName, Order cart, String cookieId, String productId, String categoryId, String languageId, String brandId) in D:\agent\_work\8\s\DanishAgroEcomMaster\RaptorIntegration\DwAdapter\RaptorItemType.cs:line 25
   at CompiledRazorTemplates.Dynamic.RazorEngine_a8522cf288c64568903dab213502882e.<>c__DisplayClass1_0.<RenderRaptorProducts>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\danishagroshoppen.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\ContentPage\Paragraph\RaptorIntegration.cshtml:line 91
   at CompiledRazorTemplates.Dynamic.RazorEngine_a8522cf288c64568903dab213502882e.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\danishagroshoppen.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\ContentPage\Paragraph\RaptorIntegration.cshtml:line 53
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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