Error executing template "Designs/Rapido/_parsed/ContentPage.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_59c802c797cb416b86d5f74ba4fb95bc.<RenderMasterMetadata>b__230_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 9564
at RazorEngine.Templating.TemplateWriter.ToString()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at CompiledRazorTemplates.Dynamic.RazorEngine_59c802c797cb416b86d5f74ba4fb95bc.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 279
at CompiledRazorTemplates.Dynamic.RazorEngine_59c802c797cb416b86d5f74ba4fb95bc.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 189
at CompiledRazorTemplates.Dynamic.RazorEngine_59c802c797cb416b86d5f74ba4fb95bc.<RenderMasterHead>b__229_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 9492
at RazorEngine.Templating.TemplateWriter.ToString()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at CompiledRazorTemplates.Dynamic.RazorEngine_59c802c797cb416b86d5f74ba4fb95bc.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 279
at CompiledRazorTemplates.Dynamic.RazorEngine_59c802c797cb416b86d5f74ba4fb95bc.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 189
at CompiledRazorTemplates.Dynamic.RazorEngine_59c802c797cb416b86d5f74ba4fb95bc.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 312
at CompiledRazorTemplates.Dynamic.RazorEngine_59c802c797cb416b86d5f74ba4fb95bc.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 189
at CompiledRazorTemplates.Dynamic.RazorEngine_59c802c797cb416b86d5f74ba4fb95bc.Execute() in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 9482
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.PageViewModel>
2
3 @using System.Web;
4 @using Dynamicweb.Frontend
5 @using Dynamicweb.Frontend.Devices
6 @using Dynamicweb.Extensibility
7 @using Dynamicweb.Content
8 @using Dynamicweb.Security
9 @using Dynamicweb.Core
10 @using System
11 @using System.Web
12 @using System.IO
13 @using Dynamicweb.Rapido.Blocks
14 @using System.Net
15
16 @{
17 var activateMaintananceMode = Pageview.AreaSettings.GetItem("Custom").GetBoolean("ActivateMaintenanceMode");
18 var maintananceUrlTemplate = Pageview.AreaSettings.GetItem("Custom").GetFile("MaintananceURLTemplate")?.Path ?? "";
19 var endMaintanance = Pageview.AreaSettings.GetItem("Custom").GetDateTime("EndMaintenance");
20 var now = DateTime.Now;
21 var isStillInMaintenance = endMaintanance == DateTime.MinValue || endMaintanance >= now;
22
23 if (activateMaintananceMode && isStillInMaintenance && !string.IsNullOrEmpty(maintananceUrlTemplate) )
24 {
25 Dynamicweb.Context.Current.Response.Redirect(maintananceUrlTemplate, true);
26 }
27 }
28
29 @functions {
30 BlocksPage masterPage = BlocksPage.GetBlockPage("Master");
31
32 string getFontFamily(params string[] items)
33 {
34 var itemParent = Pageview.AreaSettings;
35 foreach (var item in items)
36 {
37 itemParent = itemParent.GetItem(item);
38 if (itemParent == null)
39 {
40 return null;
41 }
42 }
43
44 var googleFont = itemParent.GetGoogleFont("FontFamily");
45 if (googleFont == null)
46 {
47 return null;
48 }
49 return googleFont.Family.Replace(" ", "+");
50 }
51 }
52
53 @{
54 int currentPageId = Dynamicweb.Frontend.PageView.Current().Page.ID;
55 int contactPageId = GetPageIdByNavigationTag("ContactPage");
56 int homePageId = GetPageIdByNavigationTag("Frontpage");
57 var businessName = !string.IsNullOrEmpty(Model.Area.Item.GetString("BusinessName")) ? Model.Area.Item.GetString("BusinessName") : "";
58
59
60 //set custom canonical
61 string host = Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host;
62 string pageID = Pageview.Page.ID.ToString();
63 string productsPageId = GetPageIdByNavigationTag("ProductsPage").ToString();
64 string canonicalURL = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=" + pageID);
65 var firstPageId = Model.Area.FirstActivePage.ID.ToString();
66 canonicalURL = firstPageId == pageID ? "" : canonicalURL ;
67
68 if (pageID != productsPageId) {
69 Pageview.Meta.AddTag("customCan", "<link rel=\"canonical\" href=\"" + host + canonicalURL + "\">");
70 }
71 /*if(HttpContext.Current.Request.QueryString.Get("GroupID") == null || productsPageId != "") {
72 Pageview.Meta.AddTag("customCan", "<link rel=\"canonical\" href=\"" + host + canonicalURL + "\">");
73 }*/
74
75 Block root = new Block
76 {
77 Id = "Root",
78 SortId = 10,
79 BlocksList = new List<Block>
80 {
81 new Block {
82 Id = "Head",
83 SortId = 10,
84 SkipRenderBlocksList = true,
85 Template = RenderMasterHead(),
86 BlocksList = new List<Block>
87 {
88 new Block {
89 Id = "HeadMetadata",
90 SortId = 10,
91 Template = RenderMasterMetadata(),
92 },
93 new Block {
94 Id = "HeadCss",
95 SortId = 20,
96 Template = RenderMasterCss(),
97 },
98 new Block {
99 Id = "HeadManifest",
100 SortId = 30,
101 Template = RenderMasterManifest(),
102 }
103 }
104 },
105 new Block {
106 Id = "Body",
107 SortId = 20,
108 SkipRenderBlocksList = true,
109 Template = RenderMasterBody(),
110 BlocksList = new List<Block>
111 {
112 new Block()
113 {
114 Id = "Master",
115 SortId = 10,
116 BlocksList = new List<Block> {
117 new Block {
118 Id = "MasterTopSnippets",
119 SortId = 10
120 },
121 new Block {
122 Id = "MasterMain",
123 SortId = 20,
124 Template = RenderMain(),
125 SkipRenderBlocksList = true,
126 BlocksList = new List<Block> {
127 new Block {
128 Id = "MasterHeader",
129 SortId = 10,
130 Template = RenderMasterHeader(),
131 SkipRenderBlocksList = true
132 },
133 new Block {
134 Id = "MasterPageContent",
135 SortId = 20,
136 Template = RenderPageContent()
137 }
138 }
139 },
140 new Block {
141 Id = "MasterFooter",
142 SortId = 30
143 },
144 new Block {
145 Id = "MasterReferences",
146 SortId = 40
147 },
148 new Block {
149 Id = "MasterBottomSnippets",
150 SortId = 50
151 }
152 }
153 }
154 }
155 }
156 }
157 };
158
159 masterPage.Add(root);
160 }
161
162 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@
163 @using System.Text.RegularExpressions
164 @using System.Collections.Generic
165 @using System.Reflection
166 @using System.Web
167 @using System.Web.UI.HtmlControls
168 @using Dynamicweb.Rapido.Blocks.Components
169 @using Dynamicweb.Rapido.Blocks.Components.Articles
170 @using Dynamicweb.Rapido.Blocks.Components.Documentation
171 @using Dynamicweb.Rapido.Blocks
172
173
174 @*--- START: Base block renderers ---*@
175
176 @helper RenderBlockList(List<Block> blocks)
177 {
178 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false;
179 blocks = blocks.OrderBy(item => item.SortId).ToList();
180
181 foreach (Block item in blocks)
182 {
183 if (debug) {
184 <!-- Block START: @item.Id -->
185 }
186
187 if (item.Design == null)
188 {
189 @RenderBlock(item)
190 }
191 else if (item.Design.RenderType == RenderType.None) {
192 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";
193
194 <div class="@cssClass dw-mod">
195 @RenderBlock(item)
196 </div>
197 }
198 else if (item.Design.RenderType != RenderType.Hide)
199 {
200 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";
201
202 if (!item.SkipRenderBlocksList) {
203 if (item.Design.RenderType == RenderType.Row)
204 {
205 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id">
206 @RenderBlock(item)
207 </div>
208 }
209
210 if (item.Design.RenderType == RenderType.Column)
211 {
212 string hidePadding = item.Design.HidePadding ? "u-no-padding" : "";
213 string size = item.Design.Size ?? "12";
214 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size;
215
216 <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">
217 @RenderBlock(item)
218 </div>
219 }
220
221 if (item.Design.RenderType == RenderType.Table)
222 {
223 <table class="table @cssClass dw-mod" id="Block__@item.Id">
224 @RenderBlock(item)
225 </table>
226 }
227
228 if (item.Design.RenderType == RenderType.TableRow)
229 {
230 <tr class="@cssClass dw-mod" id="Block__@item.Id">
231 @RenderBlock(item)
232 </tr>
233 }
234
235 if (item.Design.RenderType == RenderType.TableColumn)
236 {
237 <td class="@cssClass dw-mod" id="Block__@item.Id">
238 @RenderBlock(item)
239 </td>
240 }
241
242 if (item.Design.RenderType == RenderType.CardHeader)
243 {
244 <div class="card-header @cssClass dw-mod">
245 @RenderBlock(item)
246 </div>
247 }
248
249 if (item.Design.RenderType == RenderType.CardBody)
250 {
251 <div class="card @cssClass dw-mod">
252 @RenderBlock(item)
253 </div>
254 }
255
256 if (item.Design.RenderType == RenderType.CardFooter)
257 {
258 <div class="card-footer @cssClass dw-mod">
259 @RenderBlock(item)
260 </div>
261 }
262 }
263 else
264 {
265 @RenderBlock(item)
266 }
267 }
268
269 if (debug) {
270 <!-- Block END: @item.Id -->
271 }
272 }
273 }
274
275 @helper RenderBlock(Block item)
276 {
277 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false;
278
279 if (item.Template != null)
280 {
281 @BlocksPage.RenderTemplate(item.Template)
282 }
283
284 if (item.Component != null)
285 {
286 string customSufix = "Custom";
287 string methodName = item.Component.HelperName;
288
289 ComponentBase[] methodParameters = new ComponentBase[1];
290 methodParameters[0] = item.Component;
291 Type methodType = this.GetType();
292
293 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix);
294 MethodInfo generalMethod = methodType.GetMethod(methodName);
295
296 try {
297 if (debug) {
298 <!-- Component: @methodName.Replace("Render", "") -->
299 }
300 @customMethod.Invoke(this, methodParameters).ToString();
301 } catch {
302 try {
303 @generalMethod.Invoke(this, methodParameters).ToString();
304 } catch(Exception ex) {
305 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex);
306 }
307 }
308 }
309
310 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList)
311 {
312 @RenderBlockList(item.BlocksList)
313 }
314 }
315
316 @*--- END: Base block renderers ---*@
317
318
319 @* Include the components *@
320 @using Dynamicweb.Rapido.Blocks.Components
321 @using Dynamicweb.Rapido.Blocks.Components.General
322 @using Dynamicweb.Rapido.Blocks
323 @using System.IO
324
325 @* Required *@
326 @using Dynamicweb.Rapido.Blocks.Components
327 @using Dynamicweb.Rapido.Blocks.Components.General
328 @using Dynamicweb.Rapido.Blocks
329
330
331 @helper Render(ComponentBase component)
332 {
333 if (component != null)
334 {
335 @component.Render(this)
336 }
337 }
338
339 @* Components *@
340 @using System.Reflection
341 @using Dynamicweb.Rapido.Blocks.Components.General
342
343
344 @* Component *@
345
346 @helper RenderIcon(Icon settings)
347 {
348 if (settings != null)
349 {
350 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";
351
352 if (settings.Name != null)
353 {
354 if (string.IsNullOrEmpty(settings.Label))
355 {
356 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i>
357 }
358 else
359 {
360 if (settings.LabelPosition == IconLabelPosition.Before)
361 {
362 <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>
363 }
364 else
365 {
366 <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>
367 }
368 }
369 }
370 else if (!string.IsNullOrEmpty(settings.Label))
371 {
372 @settings.Label
373 }
374 }
375 }
376 @using System.Reflection
377 @using Dynamicweb.Rapido.Blocks.Components.General
378 @using Dynamicweb.Rapido.Blocks.Components
379 @using Dynamicweb.Core
380
381 @* Component *@
382
383 @helper RenderButton(Button settings)
384 {
385 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null))
386 {
387 Dictionary<string, string> attributes = new Dictionary<string, string>();
388 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>();
389 if (settings.Disabled) {
390 attributes.Add("disabled", "true");
391 classList.Add("disabled");
392 }
393
394 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle))
395 {
396 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N");
397 @RenderConfirmDialog(settings);
398 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true";
399 }
400
401 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
402 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
403 if (!string.IsNullOrEmpty(settings.AltText))
404 {
405 attributes.Add("title", settings.AltText);
406 }
407 else if (!string.IsNullOrEmpty(settings.Title))
408 {
409 string cleanTitle = Regex.Replace(settings.Title, "<.*?>", String.Empty);
410 cleanTitle = cleanTitle.Replace(" ", " ");
411 attributes.Add("title", cleanTitle);
412 }
413
414 var onClickEvents = new List<string>();
415 if (!string.IsNullOrEmpty(settings.OnClick))
416 {
417 onClickEvents.Add(settings.OnClick);
418 }
419 if (!string.IsNullOrEmpty(settings.Href))
420 {
421 onClickEvents.Add("location.href='" + settings.Href + "'");
422 }
423 if (onClickEvents.Count > 0)
424 {
425 attributes.Add("onClick", string.Join(";", onClickEvents));
426 }
427
428 if (settings.ButtonLayout != ButtonLayout.None)
429 {
430 classList.Add("btn");
431 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower();
432 if (btnLayout == "linkclean")
433 {
434 btnLayout = "link-clean"; //fix
435 }
436 classList.Add("btn--" + btnLayout);
437 }
438
439 if (settings.Icon == null)
440 {
441 settings.Icon = new Icon();
442 }
443
444 settings.Icon.CssClass += Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower() != "linkclean" ? " u-flex--align-center" : "";
445 settings.Icon.Label = settings.Title;
446
447 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower());
448
449 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button>
450 }
451 }
452
453 @helper RenderConfirmDialog(Button settings)
454 {
455 Modal confirmDialog = new Modal {
456 Id = settings.Id,
457 Width = ModalWidth.Sm,
458 Heading = new Heading
459 {
460 Level = 2,
461 Title = settings.ConfirmTitle
462 },
463 BodyText = settings.ConfirmText
464 };
465
466 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"});
467 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick });
468
469 @Render(confirmDialog)
470 }
471 @using Dynamicweb.Rapido.Blocks.Components.General
472 @using Dynamicweb.Rapido.Blocks.Components
473 @using Dynamicweb.Core
474
475 @helper RenderDashboard(Dashboard settings)
476 {
477 var widgets = settings.GetWidgets();
478
479 if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor))
480 {
481 //set bg color for them
482
483 System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor);
484 int r = Convert.ToInt16(color.R);
485 int g = Convert.ToInt16(color.G);
486 int b = Convert.ToInt16(color.B);
487
488 var count = widgets.Length;
489 var max = Math.Max(r, Math.Max(g, b));
490 double step = 255.0 / (max * count);
491 var i = 0;
492 foreach (var widget in widgets)
493 {
494 i++;
495
496 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")";
497 widget.BackgroundColor = shade;
498 }
499 }
500
501 <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
502 @foreach (var widget in widgets)
503 {
504 <div class="dashboard__widget">
505 @Render(widget)
506 </div>
507 }
508 </div>
509 }
510 @using Dynamicweb.Rapido.Blocks.Components.General
511 @using Dynamicweb.Rapido.Blocks.Components
512
513 @helper RenderDashboardWidgetLink(DashboardWidgetLink settings)
514 {
515 if (!string.IsNullOrEmpty(settings.Link))
516 {
517 var backgroundStyles = "";
518 if (!string.IsNullOrEmpty(settings.BackgroundColor))
519 {
520 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\"";
521 }
522
523 <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
524 <div class="u-center-middle u-color-light">
525 @if (settings.Icon != null)
526 {
527 settings.Icon.CssClass += "widget__icon";
528 @Render(settings.Icon)
529 }
530 <div class="widget__title">@settings.Title</div>
531 </div>
532 </a>
533 }
534 }
535 @using Dynamicweb.Rapido.Blocks.Components.General
536 @using Dynamicweb.Rapido.Blocks.Components
537
538 @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings)
539 {
540 var backgroundStyles = "";
541 if (!string.IsNullOrEmpty(settings.BackgroundColor))
542 {
543 backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'";
544 }
545
546 <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
547 <div class="u-center-middle u-color-light">
548 @if (settings.Icon != null)
549 {
550 settings.Icon.CssClass += "widget__icon";
551 @Render(settings.Icon)
552 }
553 <div class="widget__counter">@settings.Count</div>
554 <div class="widget__title">@settings.Title</div>
555 </div>
556 </div>
557 }
558 @using System.Reflection
559 @using Dynamicweb.Rapido.Blocks.Components.General
560 @using Dynamicweb.Rapido.Blocks.Components
561 @using Dynamicweb.Core
562
563 @* Component *@
564
565 @helper RenderLink(Link settings)
566 {
567 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null))
568 {
569 Dictionary<string, string> attributes = new Dictionary<string, string>();
570 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>();
571 if (settings.Disabled)
572 {
573 attributes.Add("disabled", "true");
574 classList.Add("disabled");
575 }
576
577 if (!string.IsNullOrEmpty(settings.AltText))
578 {
579 attributes.Add("title", settings.AltText);
580 }
581 else if (!string.IsNullOrEmpty(settings.Title))
582 {
583 attributes.Add("title", settings.Title);
584 }
585
586 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
587 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
588 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); }
589 attributes.Add("href", settings.Href);
590
591 if (settings.ButtonLayout != ButtonLayout.None)
592 {
593 classList.Add("btn");
594 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower();
595 if (btnLayout == "linkclean")
596 {
597 btnLayout = "link-clean"; //fix
598 }
599 classList.Add("btn--" + btnLayout);
600 }
601
602 if (settings.Icon == null)
603 {
604 settings.Icon = new Icon();
605 }
606 settings.Icon.Label = settings.Title;
607
608 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None)
609 {
610 settings.Rel = LinkRelType.Noopener;
611 }
612 if (settings.Target != LinkTargetType.None)
613 {
614 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower());
615 }
616 if (settings.Download)
617 {
618 attributes.Add("download", "true");
619 }
620 if (settings.Rel != LinkRelType.None)
621 {
622 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower());
623 }
624
625 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a>
626 }
627 }
628 @using System.Reflection
629 @using Dynamicweb.Rapido.Blocks.Components
630 @using Dynamicweb.Rapido.Blocks.Components.General
631 @using Dynamicweb.Rapido.Blocks
632
633
634 @* Component *@
635
636 @helper RenderRating(Rating settings)
637 {
638 if (settings.Score > 0)
639 {
640 int rating = settings.Score;
641 string iconType = "fa-star";
642
643 switch (settings.Type.ToString()) {
644 case "Stars":
645 iconType = "fa-star";
646 break;
647 case "Hearts":
648 iconType = "fa-heart";
649 break;
650 case "Lemons":
651 iconType = "fa-lemon";
652 break;
653 case "Bombs":
654 iconType = "fa-bomb";
655 break;
656 }
657
658 <div class="u-ta-right">
659 @for (int i = 0; i < settings.OutOf; i++)
660 {
661 <i class="@(rating > i ? "fas" : "far") @iconType"></i>
662 }
663 </div>
664 }
665 }
666 @using System.Reflection
667 @using Dynamicweb.Rapido.Blocks.Components.General
668 @using Dynamicweb.Rapido.Blocks.Components
669
670
671 @* Component *@
672
673 @helper RenderSelectFieldOption(SelectFieldOption settings)
674 {
675 Dictionary<string, string> attributes = new Dictionary<string, string>();
676 if (settings.Checked) { attributes.Add("selected", "true"); }
677 if (settings.Disabled) { attributes.Add("disabled", "true"); }
678 if (settings.Value != null) { attributes.Add("value", settings.Value); }
679 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
680
681 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option>
682 }
683 @using System.Reflection
684 @using Dynamicweb.Rapido.Blocks.Components.General
685 @using Dynamicweb.Rapido.Blocks.Components
686
687
688 @* Component *@
689
690 @helper RenderNavigation(Navigation settings) {
691 @RenderNavigation(new
692 {
693 id = settings.Id,
694 cssclass = settings.CssClass,
695 startLevel = settings.StartLevel,
696 endlevel = settings.EndLevel,
697 expandmode = settings.Expandmode,
698 sitemapmode = settings.SitemapMode,
699 template = settings.Template
700 })
701 }
702 @using Dynamicweb.Rapido.Blocks.Components.General
703 @using Dynamicweb.Rapido.Blocks.Components
704
705
706 @* Component *@
707
708 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) {
709 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;
710 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;
711 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;
712 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;
713 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;
714 settings.SitemapMode = false;
715
716 @RenderNavigation(settings)
717 }
718 @using Dynamicweb.Rapido.Blocks.Components.General
719 @using Dynamicweb.Rapido.Blocks.Components
720
721
722 @* Component *@
723
724 @helper RenderLeftNavigation(LeftNavigation settings) {
725 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id;
726 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template;
727 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel;
728 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel;
729 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode;
730
731 <div class="grid__cell">
732 @RenderNavigation(settings)
733 </div>
734 }
735 @using System.Reflection
736 @using Dynamicweb.Rapido.Blocks.Components.General
737 @using Dynamicweb.Core
738
739 @* Component *@
740
741 @helper RenderHeading(Heading settings)
742 {
743 if (settings != null && !string.IsNullOrEmpty(settings.Title))
744 {
745 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : "";
746 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div";
747
748 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">")
749 if (!string.IsNullOrEmpty(settings.Link))
750 {
751 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None })
752 }
753 else
754 {
755 if (settings.Icon == null)
756 {
757 settings.Icon = new Icon();
758 }
759 settings.Icon.Label = settings.Title;
760 @Render(settings.Icon)
761 }
762 @("</" + tagName + ">");
763 }
764 }
765 @using Dynamicweb.Rapido.Blocks.Components
766 @using Dynamicweb.Rapido.Blocks.Components.General
767 @using Dynamicweb.Rapido.Blocks
768
769
770 @* Component *@
771
772 @helper RenderImage(Image settings)
773 {
774 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None)
775 {
776 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
777 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); }
778
779 if (settings.Caption != null)
780 {
781 @:<div>
782 }
783
784 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower();
785 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower();
786
787 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)>
788 <div class="image-filter image-filter--@secondaryFilterClass dw-mod">
789 @if (settings.Link != null)
790 {
791 <a href="@settings.Link">
792 @RenderTheImage(settings)
793 </a>
794 }
795 else
796 {
797 @RenderTheImage(settings)
798 }
799 </div>
800 </div>
801
802 if (settings.Caption != null)
803 {
804 <span class="image-caption dw-mod">@settings.Caption</span>
805 @:</div>
806 }
807 }
808 else
809 {
810 if (settings.Caption != null)
811 {
812 @:<div>
813 }
814 if (!string.IsNullOrEmpty(settings.Link))
815 {
816 <a href="@settings.Link">
817 @RenderTheImage(settings)
818 </a>
819 }
820 else
821 {
822 @RenderTheImage(settings)
823 }
824
825 if (settings.Caption != null)
826 {
827 <span class="image-caption dw-mod">@settings.Caption</span>
828 @:</div>
829 }
830 }
831 }
832
833 @helper RenderTheImage(Image settings)
834 {
835 if (settings != null)
836 {
837 string alternativeImage = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("AlternativeImage")) ? Pageview.AreaSettings.GetItem("Settings").GetFile("AlternativeImage").PathUrlEncoded : "/Images/missing_image.jpg";
838 string placeholderImage = "/Files/Images/placeholder.gif";
839 string imageEngine = "/Admin/Public/GetImage.ashx?";
840
841 string imageStyle = "";
842
843 switch (settings.Style)
844 {
845 case ImageStyle.Ball:
846 imageStyle = "grid__cell-img--ball";
847 break;
848
849 case ImageStyle.Triangle:
850 imageStyle = "grid__cell-img--triangle";
851 break;
852 }
853
854 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle || settings.Style == ImageStyle.Triangle)
855 {
856 settings.ImageDefault.Crop = settings.ImageDefault.Crop == 5 ? settings.ImageDefault.Crop = 0 : settings.ImageDefault.Crop;
857
858 if (settings.ImageDefault != null)
859 {
860 settings.ImageDefault.Height = settings.ImageDefault.Width;
861 }
862 if (settings.ImageMedium != null)
863 {
864 settings.ImageMedium.Height = settings.ImageMedium.Width;
865 }
866 if (settings.ImageSmall != null)
867 {
868 settings.ImageSmall.Height = settings.ImageSmall.Width;
869 }
870 }
871
872 string defaultImage = imageEngine;
873 string imageSmall = "";
874 string imageMedium = "";
875
876 if (settings.DisableImageEngine)
877 {
878 defaultImage = settings.Path;
879 }
880 else
881 {
882 if (settings.ImageDefault != null)
883 {
884 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault);
885
886 if (settings.Path.GetType() != typeof(string))
887 {
888 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
889 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
890 }
891 else
892 {
893 defaultImage += settings.Path != null ? "Image=" + settings.Path : "";
894 }
895
896 defaultImage += "&AlternativeImage=" + alternativeImage;
897 }
898
899 if (settings.ImageSmall != null)
900 {
901 imageSmall = "data-src-small=\"" + imageEngine;
902 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall);
903
904 if (settings.Path.GetType() != typeof(string))
905 {
906 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
907 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
908 }
909 else
910 {
911 imageSmall += settings.Path != null ? "Image=" + settings.Path : "";
912 }
913
914 imageSmall += "&alternativeImage=" + alternativeImage;
915
916 imageSmall += "\"";
917 }
918
919 if (settings.ImageMedium != null)
920 {
921 imageMedium = "data-src-medium=\"" + imageEngine;
922 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium);
923
924 if (settings.Path.GetType() != typeof(string))
925 {
926 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : "";
927 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : "";
928 }
929 else
930 {
931 imageMedium += settings.Path != null ? "Image=" + settings.Path : "";
932 }
933
934 imageMedium += "&alternativeImage=" + alternativeImage;
935
936 imageMedium += "\"";
937 }
938 }
939
940 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
941 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); }
942 if (!string.IsNullOrEmpty(settings.Title))
943 {
944 optionalAttributes.Add("alt", settings.Title);
945 optionalAttributes.Add("title", settings.Title);
946 }
947
948 if(Pageview.Device.ToString() != "Mobile") {
949 if (settings.DisableLazyLoad)
950 {
951 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
952 }
953 else
954 {
955 <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) />
956 }
957 } else {
958
959 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) />
960 }
961 }
962 }
963 @using System.Reflection
964 @using Dynamicweb.Rapido.Blocks.Components.General
965 @using Dynamicweb.Rapido.Blocks.Components
966
967 @* Component *@
968
969 @helper RenderFileField(FileField settings)
970 {
971 var attributes = new Dictionary<string, string>();
972 if (string.IsNullOrEmpty(settings.Id))
973 {
974 settings.Id = Guid.NewGuid().ToString("N");
975 }
976
977 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
978 if (settings.Disabled) { attributes.Add("disabled", "true"); }
979 if (settings.Required) { attributes.Add("required", "true"); }
980 if (settings.Multiple) { attributes.Add("multiple", "true"); }
981 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
982 if (string.IsNullOrEmpty(settings.ChooseFileText))
983 {
984 settings.ChooseFileText = Translate("Choose file");
985 }
986 if (string.IsNullOrEmpty(settings.NoFilesChosenText))
987 {
988 settings.NoFilesChosenText = Translate("No files chosen...");
989 }
990 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
991
992 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
993
994 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)";
995 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : ""));
996
997 attributes.Add("type", "file");
998 if (settings.Value != null) { attributes.Add("value", settings.Value); }
999 settings.CssClass = "u-full-width " + settings.CssClass;
1000
1001 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1002
1003 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
1004 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1005 {
1006 <div class="u-full-width">
1007 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1008 @if (settings.Link != null) {
1009 <div class="u-pull--right">
1010 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1011 @Render(settings.Link)
1012 </div>
1013 }
1014 </div>
1015
1016 }
1017
1018 @if (!string.IsNullOrEmpty(settings.HelpText))
1019 {
1020 <small class="form__help-text">@settings.HelpText</small>
1021 }
1022
1023 <div class="form__field-combi file-input u-no-margin dw-mod">
1024 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" />
1025 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label>
1026 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label>
1027 @if (settings.UploadButton != null)
1028 {
1029 settings.UploadButton.CssClass += " btn--condensed u-no-margin";
1030 @Render(settings.UploadButton)
1031 }
1032 </div>
1033 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1034 </div>
1035 }
1036 @using System.Reflection
1037 @using Dynamicweb.Rapido.Blocks.Components.General
1038 @using Dynamicweb.Rapido.Blocks.Components
1039 @using Dynamicweb.Core
1040 @using System.Linq
1041
1042 @* Component *@
1043
1044 @helper RenderDateTimeField(DateTimeField settings)
1045 {
1046 if (string.IsNullOrEmpty(settings.Id))
1047 {
1048 settings.Id = Guid.NewGuid().ToString("N");
1049 }
1050
1051 var textField = new TextField {
1052 Name = settings.Name,
1053 Id = settings.Id,
1054 Label = settings.Label,
1055 HelpText = settings.HelpText,
1056 Value = settings.Value,
1057 Disabled = settings.Disabled,
1058 Required = settings.Required,
1059 ErrorMessage = settings.ErrorMessage,
1060 CssClass = settings.CssClass,
1061 WrapperCssClass = settings.WrapperCssClass,
1062 OnChange = settings.OnChange,
1063 OnClick = settings.OnClick,
1064 Link = settings.Link,
1065 ExtraAttributes = settings.ExtraAttributes,
1066 //
1067 Placeholder = settings.Placeholder
1068 };
1069
1070 @Render(textField)
1071
1072 List<string> jsAttributes = new List<string>();
1073
1074 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'");
1075
1076 if (!string.IsNullOrEmpty(settings.DateFormat))
1077 {
1078 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'");
1079 }
1080 if (!string.IsNullOrEmpty(settings.MinDate))
1081 {
1082 jsAttributes.Add("minDate: '" + settings.MinDate + "'");
1083 }
1084 if (!string.IsNullOrEmpty(settings.MaxDate))
1085 {
1086 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'");
1087 }
1088 if (settings.IsInline)
1089 {
1090 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower());
1091 }
1092 if (settings.EnableTime)
1093 {
1094 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower());
1095 }
1096 if (settings.EnableWeekNumbers)
1097 {
1098 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower());
1099 }
1100
1101 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value));
1102
1103 <script>
1104 document.addEventListener("DOMContentLoaded", function () {
1105 flatpickr("#@textField.Id", {
1106 @string.Join(",", jsAttributes)
1107 });
1108 });
1109 </script>
1110 }
1111 @using System.Reflection
1112 @using Dynamicweb.Rapido.Blocks.Components.General
1113 @using Dynamicweb.Rapido.Blocks.Components
1114
1115 @* Component *@
1116
1117 @helper RenderTextField(TextField settings)
1118 {
1119 var attributes = new Dictionary<string, string>();
1120 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1121 {
1122 settings.Id = Guid.NewGuid().ToString("N");
1123 }
1124
1125 /*base settings*/
1126 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1127 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1128 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1129 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1130 if (settings.Required) { attributes.Add("required", "true"); }
1131 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1132 /*end*/
1133
1134 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1135 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1136 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1137 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1138 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); }
1139 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); }
1140 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower());
1141 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); };
1142 if (settings.Value != null) { attributes.Add("value", settings.Value); }
1143
1144 settings.CssClass = "u-full-width " + settings.CssClass;
1145
1146 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
1147
1148 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1149
1150 string noMargin = "u-no-margin";
1151 if (!settings.ReadOnly) {
1152 noMargin = "";
1153 }
1154
1155 <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod">
1156 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1157 {
1158 <div class="u-full-width">
1159 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1160 @if (settings.Link != null) {
1161 settings.Link.ButtonLayout = ButtonLayout.LinkClean;
1162
1163 <div class="u-pull--right">
1164 @Render(settings.Link)
1165 </div>
1166 }
1167 </div>
1168
1169 }
1170
1171 @if (!string.IsNullOrEmpty(settings.HelpText))
1172 {
1173 <small class="form__help-text">@settings.HelpText</small>
1174 }
1175
1176 @if (settings.ActionButton != null)
1177 {
1178 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1179 <div class="form__field-combi u-no-margin dw-mod">
1180 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1181 @Render(settings.ActionButton)
1182 </div>
1183 }
1184 else
1185 {
1186 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1187 }
1188
1189 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1190 </div>
1191 }
1192 @using System.Reflection
1193 @using Dynamicweb.Rapido.Blocks.Components.General
1194 @using Dynamicweb.Rapido.Blocks.Components
1195
1196 @* Component *@
1197
1198 @helper RenderNumberField(NumberField settings)
1199 {
1200 var attributes = new Dictionary<string, string>();
1201 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1202 {
1203 settings.Id = Guid.NewGuid().ToString("N");
1204 }
1205
1206 /*base settings*/
1207 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1208 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1209 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1210 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1211 if (settings.Required) { attributes.Add("required", "true"); }
1212 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1213 /*end*/
1214
1215 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1216 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1217 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1218 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1219 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); }
1220 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); }
1221 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); }
1222 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); }
1223 attributes.Add("type", "number");
1224
1225 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1226
1227 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
1228 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1229 {
1230 <div class="u-full-width">
1231 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1232 @if (settings.Link != null) {
1233 <div class="u-pull--right">
1234 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1235 @Render(settings.Link)
1236 </div>
1237 }
1238 </div>
1239
1240 }
1241
1242 @if (!string.IsNullOrEmpty(settings.HelpText))
1243 {
1244 <small class="form__help-text">@settings.HelpText</small>
1245 }
1246
1247 @if (settings.ActionButton != null)
1248 {
1249 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1250 <div class="form__field-combi u-no-margin dw-mod">
1251 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1252 @Render(settings.ActionButton)
1253 </div>
1254 }
1255 else
1256 {
1257 <div class="form__field-combi u-no-margin dw-mod">
1258 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1259 </div>
1260 }
1261
1262 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1263 </div>
1264 }
1265 @using System.Reflection
1266 @using Dynamicweb.Rapido.Blocks.Components.General
1267 @using Dynamicweb.Rapido.Blocks.Components
1268
1269
1270 @* Component *@
1271
1272 @helper RenderTextareaField(TextareaField settings)
1273 {
1274 Dictionary<string, string> attributes = new Dictionary<string, string>();
1275 string id = settings.Id;
1276 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id))
1277 {
1278 id = Guid.NewGuid().ToString("N");
1279 }
1280
1281 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); }
1282 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1283 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
1284 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
1285 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
1286 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1287 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); }
1288 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1289 if (settings.Required) { attributes.Add("required", "true"); }
1290 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
1291 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); }
1292 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); }
1293 attributes.Add("name", settings.Name);
1294
1295 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
1296
1297 <div class="form__field-group @settings.WrapperCssClass dw-mod">
1298 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1299 {
1300 <div class="u-full-width">
1301 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1302 @if (settings.Link != null) {
1303 <div class="u-pull--right">
1304 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1305 @Render(settings.Link)
1306 </div>
1307 }
1308 </div>
1309 }
1310
1311 @if (!string.IsNullOrEmpty(settings.HelpText))
1312 {
1313 <small class="form__help-text">@settings.HelpText</small>
1314 }
1315
1316 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea>
1317
1318 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1319 </div>
1320 }
1321 @using System.Reflection
1322 @using Dynamicweb.Rapido.Blocks.Components.General
1323 @using Dynamicweb.Rapido.Blocks.Components
1324
1325
1326 @* Component *@
1327
1328 @helper RenderHiddenField(HiddenField settings) {
1329 var attributes = new Dictionary<string, string>();
1330 attributes.Add("type", "hidden");
1331 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1332 if (settings.Value != null) { attributes.Add("value", settings.Value); }
1333 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1334
1335 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/>
1336 }
1337 @using System.Reflection
1338 @using Dynamicweb.Rapido.Blocks.Components.General
1339 @using Dynamicweb.Rapido.Blocks.Components
1340
1341 @* Component *@
1342
1343 @helper RenderCheckboxField(CheckboxField settings)
1344 {
1345 var attributes = new Dictionary<string, string>();
1346 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1347 {
1348 settings.Id = Guid.NewGuid().ToString("N");
1349 }
1350
1351 /*base settings*/
1352 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1353 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1354 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1355 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1356 if (settings.Required) { attributes.Add("required", "true"); }
1357 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1358 /*end*/
1359
1360 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
1361
1362 attributes.Add("type", "checkbox");
1363 if (settings.Checked) { attributes.Add("checked", "true"); }
1364 settings.CssClass = "form__control " + settings.CssClass;
1365 if (settings.Value != null) { attributes.Add("value", settings.Value); }
1366
1367 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1368
1369 <div class="form__field-group @settings.WrapperCssClass dw-mod">
1370 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1371 @if (!string.IsNullOrEmpty(settings.Label))
1372 {
1373 <label for="@settings.Id" class="dw-mod">@settings.Label</label>
1374 }
1375
1376 @if (settings.Link != null) {
1377 <span>
1378 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1379 @Render(settings.Link)
1380 </span>
1381 }
1382
1383 @if (!string.IsNullOrEmpty(settings.HelpText))
1384 {
1385 <small class="form__help-text checkbox-help dw-mod">@settings.HelpText</small>
1386 }
1387 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1388 </div>
1389 }
1390 @using System.Reflection
1391 @using Dynamicweb.Rapido.Blocks.Components.General
1392 @using Dynamicweb.Rapido.Blocks.Components
1393
1394
1395 @* Component *@
1396
1397 @helper RenderCheckboxListField(CheckboxListField settings)
1398 {
1399 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1400 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1401 {
1402 <div class="u-full-width">
1403 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1404 @if (settings.Link != null) {
1405 <div class="u-pull--right">
1406 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1407 @Render(settings.Link)
1408 </div>
1409 }
1410 </div>
1411
1412 }
1413
1414 <div class="u-pull--left">
1415 @if (!string.IsNullOrEmpty(settings.HelpText))
1416 {
1417 <small class="form__help-text">@settings.HelpText</small>
1418 }
1419
1420 @foreach (var item in settings.Options)
1421 {
1422 if (settings.Required)
1423 {
1424 item.Required = true;
1425 }
1426 if (settings.Disabled)
1427 {
1428 item.Disabled = true;
1429 }
1430 if (!string.IsNullOrEmpty(settings.Name))
1431 {
1432 item.Name = settings.Name;
1433 }
1434 if (!string.IsNullOrEmpty(settings.CssClass))
1435 {
1436 item.CssClass += settings.CssClass;
1437 }
1438
1439 /* value is not supported */
1440
1441 if (!string.IsNullOrEmpty(settings.OnClick))
1442 {
1443 item.OnClick += settings.OnClick;
1444 }
1445 if (!string.IsNullOrEmpty(settings.OnChange))
1446 {
1447 item.OnChange += settings.OnChange;
1448 }
1449 @Render(item)
1450 }
1451
1452 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1453 </div>
1454
1455 </div>
1456 }
1457 @using Dynamicweb.Rapido.Blocks.Components.General
1458
1459 @* Component *@
1460
1461 @helper RenderSearch(Search settings)
1462 {
1463 var searchValue = HttpContext.Current.Request.QueryString.Get(settings.SearchParameter) ?? "";
1464 var groupValue = HttpContext.Current.Request.QueryString.Get(settings.GroupsParameter) ?? "";
1465
1466 if (string.IsNullOrEmpty(settings.Id))
1467 {
1468 settings.Id = Guid.NewGuid().ToString("N");
1469 }
1470
1471 var resultAttributes = new Dictionary<string, string>();
1472
1473 if (settings.PageSize != 0)
1474 {
1475 resultAttributes.Add("data-page-size", settings.PageSize.ToString());
1476 }
1477 if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl))
1478 {
1479 resultAttributes.Add("data-groups-feed-url", settings.GroupItemsFeedUrl);
1480 if (!string.IsNullOrEmpty(groupValue))
1481 {
1482 resultAttributes.Add("data-selected-group", groupValue);
1483 }
1484 if (!string.IsNullOrEmpty(settings.GroupsParameter))
1485 {
1486 resultAttributes.Add("data-groups-parameter", settings.GroupsParameter);
1487 }
1488 }
1489 resultAttributes.Add("data-force-init", "true");
1490 if (settings.GoToFirstSearchResultOnEnter)
1491 {
1492 resultAttributes.Add("data-go-to-first-search-result-on-enter", settings.GoToFirstSearchResultOnEnter.ToString().ToLower());
1493 }
1494 if (!string.IsNullOrEmpty(settings.SearchParameter))
1495 {
1496 resultAttributes.Add("data-search-parameter", settings.SearchParameter);
1497 }
1498 resultAttributes.Add("data-search-feed-url", settings.SearchData.SearchFeedUrl);
1499 resultAttributes.Add("data-results-template-id", settings.SearchData.ResultsTemplateId);
1500
1501 if (settings.SecondSearchData != null)
1502 {
1503 resultAttributes.Add("data-second-search-feed-url", settings.SecondSearchData.SearchFeedUrl);
1504 resultAttributes.Add("data-second-results-template-id", settings.SecondSearchData.ResultsTemplateId);
1505 }
1506 if (!string.IsNullOrEmpty(settings.ResultsPageUrl))
1507 {
1508 resultAttributes.Add("data-results-page-url", settings.ResultsPageUrl);
1509 }
1510
1511 resultAttributes = resultAttributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1512
1513 string searchFieldCss = (settings.SearchButton == null) ? "search--with-icon" : "";
1514
1515 <div class="search @settings.CssClass @searchFieldCss js-search-data-source dw-mod" id="@settings.Id" @ComponentMethods.AddAttributes(resultAttributes)>
1516 @if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl))
1517 {
1518 <button type="button" class="search__groups-btn dw-mod js-search-groups-btn">@Translate("All")</button>
1519 <ul class="dropdown dropdown--absolute-position dw-mod search__groups-results js-search-groups-list"></ul>
1520 }
1521
1522 <input type="text" class="search__field dw-mod js-search-field" placeholder="@settings.Placeholder" value="@searchValue">
1523
1524 <div class="dropdown dropdown--absolute-position search__results dw-mod js-search-results @(settings.SecondSearchData != null ? "search__results--combined" : "")">
1525 @if (settings.SecondSearchData != null)
1526 {
1527 <div class="search__column search__column--products dw-mod">
1528 <div class="search__column-header dw-mod">@Translate("Products")</div>
1529 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul>
1530 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl))
1531 {
1532 @Render(new Link {
1533 Title = Translate("View all"),
1534 CssClass = "js-view-all-button u-margin",
1535 Href = settings.SearchData.ResultsPageUrl
1536 });
1537 }
1538 </div>
1539 <div class="search__column search__column--pages dw-mod">
1540 <div class="search__column-header">@Translate("Pages")</div>
1541 <ul class="search__results-list dw-mod js-search-results-second-list" id="@(settings.Id)_SecondResultsList"></ul>
1542 @if (!string.IsNullOrEmpty(settings.SecondSearchData.ResultsPageUrl))
1543 {
1544 @Render(new Link
1545 {
1546 Title = Translate("View all"),
1547 CssClass = "js-view-all-button u-margin",
1548 Href = settings.SecondSearchData.ResultsPageUrl
1549 });
1550 }
1551 </div>
1552 }
1553 else
1554 {
1555 <div class="search__column search__column--only dw-mod">
1556 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul>
1557 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl))
1558 {
1559 @Render(new Link {
1560 Title = Translate("View all"),
1561 CssClass = "js-view-all-button u-margin",
1562 Href = settings.SearchData.ResultsPageUrl
1563 });
1564 }
1565 </div>
1566 }
1567 </div>
1568
1569 @if (settings.SearchButton != null)
1570 {
1571 settings.SearchButton.CssClass += " search__btn js-search-btn";
1572 if (settings.RenderDefaultSearchIcon)
1573 {
1574 settings.SearchButton.Icon = new Icon { Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue };
1575 }
1576 @Render(settings.SearchButton);
1577 }
1578 </div>
1579 }
1580 @using System.Reflection
1581 @using Dynamicweb.Rapido.Blocks.Components.General
1582 @using Dynamicweb.Rapido.Blocks.Components
1583
1584
1585 @* Component *@
1586
1587 @helper RenderSelectField(SelectField settings)
1588 {
1589 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1590 {
1591 settings.Id = Guid.NewGuid().ToString("N");
1592 }
1593
1594 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod">
1595 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null )
1596 {
1597 <div class="u-full-width">
1598 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> }
1599 @if (settings.Link != null) {
1600 <div class="u-pull--right">
1601 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; }
1602 @Render(settings.Link)
1603 </div>
1604 }
1605 </div>
1606 }
1607
1608 @if (!string.IsNullOrEmpty(settings.HelpText))
1609 {
1610 <small class="form__help-text">@settings.HelpText</small>
1611 }
1612
1613 @if (settings.ActionButton != null)
1614 {
1615 settings.ActionButton.CssClass += " btn--condensed u-no-margin";
1616 <div class="form__field-combi u-no-margin dw-mod">
1617 @RenderSelectBase(settings)
1618 @Render(settings.ActionButton)
1619 </div>
1620 }
1621 else
1622 {
1623 @RenderSelectBase(settings)
1624 }
1625
1626 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1627 </div>
1628 }
1629
1630 @helper RenderSelectBase(SelectField settings)
1631 {
1632 var attributes = new Dictionary<string, string>();
1633
1634 /*base settings*/
1635 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1636 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1637 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1638 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1639 if (settings.Required) { attributes.Add("required", "true"); }
1640 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1641 /*end*/
1642
1643 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1644
1645 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod">
1646 @if (settings.Default != null)
1647 {
1648 @Render(settings.Default)
1649 }
1650
1651 @foreach (var item in settings.Options)
1652 {
1653 if (settings.Value != null) {
1654 item.Checked = item.Value == settings.Value;
1655 }
1656 @Render(item)
1657 }
1658 </select>
1659 }
1660 @using System.Reflection
1661 @using Dynamicweb.Rapido.Blocks.Components.General
1662 @using Dynamicweb.Rapido.Blocks.Components
1663
1664 @* Component *@
1665
1666 @helper RenderRadioButtonField(RadioButtonField settings)
1667 {
1668 var attributes = new Dictionary<string, string>();
1669 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id))
1670 {
1671 settings.Id = Guid.NewGuid().ToString("N");
1672 }
1673
1674 /*base settings*/
1675 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1676 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
1677 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
1678 if (settings.Disabled) { attributes.Add("disabled", "true"); }
1679 if (settings.Required) { attributes.Add("required", "true"); }
1680 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
1681 /*end*/
1682
1683 attributes.Add("type", "radio");
1684 if (settings.Checked) { attributes.Add("checked", "true"); }
1685 settings.CssClass = "form__control " + settings.CssClass;
1686 if (settings.Value != null) { attributes.Add("value", settings.Value); }
1687
1688 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
1689
1690 <div class="form__field-group @settings.WrapperCssClass dw-mod">
1691 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
1692 @if (!string.IsNullOrEmpty(settings.Label))
1693 {
1694 <label for="@settings.Id" class="dw-mod">@settings.Label</label>
1695 }
1696 @if (!string.IsNullOrEmpty(settings.HelpText))
1697 {
1698 <small class="form__help-text">@settings.HelpText</small>
1699 }
1700 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1701 </div>
1702 }
1703 @using System.Reflection
1704 @using Dynamicweb.Rapido.Blocks.Components.General
1705 @using Dynamicweb.Rapido.Blocks.Components
1706
1707
1708 @* Component *@
1709
1710 @helper RenderRadioButtonListField(RadioButtonListField settings)
1711 {
1712 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; }
1713
1714 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1715 @if (!string.IsNullOrEmpty(settings.Label))
1716 {
1717 <label>@settings.Label</label>
1718 }
1719 @if (!string.IsNullOrEmpty(settings.HelpText))
1720 {
1721 <small class="form__help-text">@settings.HelpText</small>
1722 }
1723
1724 @foreach (var item in settings.Options)
1725 {
1726 if (settings.Required)
1727 {
1728 item.Required = true;
1729 }
1730 if (settings.Disabled)
1731 {
1732 item.Disabled = true;
1733 }
1734 if (!string.IsNullOrEmpty(settings.Name))
1735 {
1736 item.Name = settings.Name;
1737 }
1738 if (settings.Value != null && settings.Value == item.Value)
1739 {
1740 item.Checked = true;
1741 }
1742 if (!string.IsNullOrEmpty(settings.OnClick))
1743 {
1744 item.OnClick += settings.OnClick;
1745 }
1746 if (!string.IsNullOrEmpty(settings.OnChange))
1747 {
1748 item.OnChange += settings.OnChange;
1749 }
1750 if (!string.IsNullOrEmpty(settings.CssClass))
1751 {
1752 item.CssClass += settings.CssClass;
1753 }
1754 @Render(item)
1755 }
1756
1757 @Render(new NotificationMessage { Message = settings.ErrorMessage })
1758 </div>
1759 }
1760 @using System.Reflection
1761 @using Dynamicweb.Rapido.Blocks.Components.General
1762 @using Dynamicweb.Rapido.Blocks.Components
1763
1764
1765 @* Component *@
1766
1767 @helper RenderNotificationMessage(NotificationMessage settings)
1768 {
1769 if (!string.IsNullOrEmpty(settings.Message))
1770 {
1771 var attributes = new Dictionary<string, string>();
1772 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
1773
1774 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower();
1775 string messageLayoutClass = Enum.GetName(typeof(NotificationMessageLayout), settings.MessageLayout).ToLower();
1776 string minHeightClass = settings.Icon != null ? "u-min-h70px" : "";
1777
1778 <div class="notification-message-@messageTypeClass notification-message-@messageLayoutClass @messageLayoutClass @minHeightClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)>
1779 @if (settings.Icon != null) {
1780 settings.Icon.Label = !string.IsNullOrEmpty(settings.Icon.Label) ? settings.Message + settings.Icon.Label : settings.Message;
1781 @Render(settings.Icon)
1782 } else {
1783 @settings.Message
1784 }
1785 </div>
1786 }
1787 }
1788 @using Dynamicweb.Rapido.Blocks.Components.General
1789
1790
1791 @* Component *@
1792
1793 @helper RenderHandlebarsRoot(HandlebarsRoot settings) {
1794 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : "";
1795
1796 <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>
1797 @if (settings.SubBlocks != null) {
1798 @RenderBlockList(settings.SubBlocks)
1799 }
1800 </div>
1801 }
1802 @using System.Reflection
1803 @using Dynamicweb.Rapido.Blocks.Components.General
1804 @using Dynamicweb.Rapido.Blocks.Components
1805 @using System.Text.RegularExpressions
1806
1807
1808 @* Component *@
1809
1810 @helper RenderSticker(Sticker settings) {
1811 if (!String.IsNullOrEmpty(settings.Title)) {
1812 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : "";
1813 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : "";
1814
1815 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>();
1816 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) {
1817 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : "";
1818 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : "";
1819 optionalAttributes.Add("style", styleTag);
1820 }
1821
1822 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div>
1823 }
1824 }
1825
1826 @using System.Reflection
1827 @using Dynamicweb.Rapido.Blocks.Components.General
1828 @using Dynamicweb.Rapido.Blocks.Components
1829
1830
1831 @* Component *@
1832
1833 @helper RenderStickersCollection(StickersCollection settings)
1834 {
1835 if (settings.Stickers.Count > 0)
1836 {
1837 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower();
1838
1839 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1840 @foreach (Sticker sticker in settings.Stickers)
1841 {
1842 @Render(sticker)
1843 }
1844 </div>
1845 }
1846 }
1847
1848 @using Dynamicweb.Rapido.Blocks.Components.General
1849
1850
1851 @* Component *@
1852
1853 @helper RenderForm(Form settings) {
1854 if (settings != null)
1855 {
1856 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>();
1857 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); };
1858 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); };
1859 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); };
1860 var enctypes = new Dictionary<string, string>
1861 {
1862 { "multipart", "multipart/form-data" },
1863 { "text", "text/plain" },
1864 { "application", "application/x-www-form-urlencoded" }
1865 };
1866 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); };
1867 optionalAttributes.Add("method", settings.Method.ToString());
1868
1869 if (!string.IsNullOrEmpty(settings.FormStartMarkup))
1870 {
1871 @settings.FormStartMarkup
1872 }
1873 else
1874 {
1875 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
1876 }
1877
1878 foreach (var field in settings.GetFields())
1879 {
1880 @Render(field)
1881 }
1882
1883 @:</form>
1884 }
1885 }
1886 @using System.Reflection
1887 @using Dynamicweb.Rapido.Blocks.Components.General
1888 @using Dynamicweb.Rapido.Blocks.Components
1889
1890
1891 @* Component *@
1892
1893 @helper RenderText(Text settings)
1894 {
1895 @settings.Content
1896 }
1897 @using System.Reflection
1898 @using Dynamicweb.Rapido.Blocks.Components.General
1899 @using Dynamicweb.Rapido.Blocks.Components
1900
1901
1902 @* Component *@
1903
1904 @helper RenderContentModule(ContentModule settings) {
1905 if (!string.IsNullOrEmpty(settings.Content))
1906 {
1907 @settings.Content
1908 }
1909 }
1910 @using System.Reflection
1911 @using Dynamicweb.Rapido.Blocks.Components.General
1912 @using Dynamicweb.Rapido.Blocks.Components
1913
1914
1915 @* Component *@
1916
1917 @helper RenderModal(Modal settings) {
1918 if (settings != null)
1919 {
1920 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N");
1921
1922 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : "";
1923
1924 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange />
1925
1926 <div class="modal-container">
1927 @if (!settings.DisableDarkOverlay)
1928 {
1929 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label>
1930 }
1931 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal">
1932 @if (settings.Heading != null)
1933 {
1934 if (!string.IsNullOrEmpty(settings.Heading.Title))
1935 {
1936 <div class="modal__header">
1937 @Render(settings.Heading)
1938 </div>
1939 }
1940 }
1941 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")">
1942 @if (!string.IsNullOrEmpty(settings.BodyText))
1943 {
1944 @settings.BodyText
1945 }
1946 @if (settings.BodyTemplate != null)
1947 {
1948 @settings.BodyTemplate
1949 }
1950 @{
1951 var actions = settings.GetActions();
1952 }
1953 </div>
1954 @if (actions.Length > 0)
1955 {
1956 <div class="modal__footer">
1957 @foreach (var action in actions)
1958 {
1959 if (Pageview.Device.ToString() != "Mobile") {
1960 action.CssClass += " u-no-margin";
1961 } else {
1962 action.CssClass += " u-full-width u-margin-bottom";
1963 }
1964
1965 @Render(action)
1966 }
1967 </div>
1968 }
1969 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label>
1970 </div>
1971 </div>
1972 }
1973 }
1974 @using Dynamicweb.Rapido.Blocks.Components.General
1975
1976 @* Component *@
1977
1978 @helper RenderMediaListItem(MediaListItem settings)
1979 {
1980 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")>
1981 @if (!string.IsNullOrEmpty(settings.Label))
1982 {
1983 if (!string.IsNullOrEmpty(settings.Link))
1984 {
1985 @Render(new Link
1986 {
1987 Href = settings.Link,
1988 CssClass = "media-list-item__sticker dw-mod",
1989 ButtonLayout = ButtonLayout.None,
1990 Title = settings.Label,
1991 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""
1992 })
1993 }
1994 else if (!string.IsNullOrEmpty(settings.OnClick))
1995 {
1996 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)">
1997 <span class="u-uppercase">@settings.Label</span>
1998 </span>
1999 }
2000 else
2001 {
2002 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod">
2003 <span class="u-uppercase">@settings.Label</span>
2004 </span>
2005 }
2006 }
2007 <div class="media-list-item__wrap">
2008 <div class="media-list-item__info dw-mod">
2009 <div class="media-list-item__header dw-mod">
2010 @if (!string.IsNullOrEmpty(settings.Title))
2011 {
2012 if (!string.IsNullOrEmpty(settings.Link))
2013 {
2014 @Render(new Link
2015 {
2016 Href = settings.Link,
2017 CssClass = "media-list-item__name dw-mod",
2018 ButtonLayout = ButtonLayout.None,
2019 Title = settings.Title,
2020 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : ""
2021 })
2022 }
2023 else if (!string.IsNullOrEmpty(settings.OnClick))
2024 {
2025 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span>
2026 }
2027 else
2028 {
2029 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span>
2030 }
2031 }
2032
2033 @if (!string.IsNullOrEmpty(settings.Status))
2034 {
2035 <div class="media-list-item__state dw-mod">@settings.Status</div>
2036 }
2037 </div>
2038 @{
2039 settings.InfoTable.CssClass += " media-list-item__parameters-table";
2040 }
2041
2042 @Render(settings.InfoTable)
2043 </div>
2044 <div class="media-list-item__actions dw-mod">
2045 <div class="media-list-item__actions-list dw-mod">
2046 @{
2047 var actions = settings.GetActions();
2048
2049 foreach (ButtonBase action in actions)
2050 {
2051 action.ButtonLayout = ButtonLayout.None;
2052 action.CssClass += " media-list-item__action link";
2053
2054 @Render(action)
2055 }
2056 }
2057 </div>
2058
2059 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title))
2060 {
2061 settings.SelectButton.CssClass += " u-no-margin";
2062
2063 <div class="media-list-item__action-button">
2064 @Render(settings.SelectButton)
2065 </div>
2066 }
2067 </div>
2068 </div>
2069 </div>
2070 }
2071 @using Dynamicweb.Rapido.Blocks.Components.General
2072 @using Dynamicweb.Rapido.Blocks.Components
2073
2074 @helper RenderTable(Table settings)
2075 {
2076 Dictionary<string, string> attributes = new Dictionary<string, string>();
2077 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
2078
2079 var enumToClasses = new Dictionary<TableDesign, string>
2080 {
2081 { TableDesign.Clean, "table--clean" },
2082 { TableDesign.Bordered, "table--bordered" },
2083 { TableDesign.Striped, "table--striped" },
2084 { TableDesign.Hover, "table--hover" },
2085 { TableDesign.Compact, "table--compact" },
2086 { TableDesign.Condensed, "table--condensed" },
2087 { TableDesign.NoTopBorder, "table--no-top-border" }
2088 };
2089 string tableDesignClass = "";
2090 if (settings.Design != TableDesign.None)
2091 {
2092 tableDesignClass = enumToClasses[settings.Design];
2093 }
2094
2095 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); }
2096
2097 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
2098
2099 <table @ComponentMethods.AddAttributes(resultAttributes)>
2100 @if (settings.Header != null)
2101 {
2102 <thead>
2103 @Render(settings.Header)
2104 </thead>
2105 }
2106 <tbody>
2107 @foreach (var row in settings.Rows)
2108 {
2109 @Render(row)
2110 }
2111 </tbody>
2112 @if (settings.Footer != null)
2113 {
2114 <tfoot>
2115 @Render(settings.Footer)
2116 </tfoot>
2117 }
2118 </table>
2119 }
2120 @using Dynamicweb.Rapido.Blocks.Components.General
2121 @using Dynamicweb.Rapido.Blocks.Components
2122
2123 @helper RenderTableRow(TableRow settings)
2124 {
2125 Dictionary<string, string> attributes = new Dictionary<string, string>();
2126 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
2127
2128 var enumToClasses = new Dictionary<TableRowDesign, string>
2129 {
2130 { TableRowDesign.NoBorder, "table__row--no-border" },
2131 { TableRowDesign.Border, "table__row--border" },
2132 { TableRowDesign.TopBorder, "table__row--top-line" },
2133 { TableRowDesign.BottomBorder, "table__row--bottom-line" },
2134 { TableRowDesign.Solid, "table__row--solid" }
2135 };
2136
2137 string tableRowDesignClass = "";
2138 if (settings.Design != TableRowDesign.None)
2139 {
2140 tableRowDesignClass = enumToClasses[settings.Design];
2141 }
2142
2143 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); }
2144
2145 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
2146
2147 <tr @ComponentMethods.AddAttributes(resultAttributes)>
2148 @foreach (var cell in settings.Cells)
2149 {
2150 if (settings.IsHeaderRow)
2151 {
2152 cell.IsHeader = true;
2153 }
2154 @Render(cell)
2155 }
2156 </tr>
2157 }
2158 @using Dynamicweb.Rapido.Blocks.Components.General
2159 @using Dynamicweb.Rapido.Blocks.Components
2160 @using Dynamicweb.Core
2161
2162 @helper RenderTableCell(TableCell settings)
2163 {
2164 Dictionary<string, string> attributes = new Dictionary<string, string>();
2165 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
2166 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); }
2167 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); }
2168 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); }
2169
2170 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value);
2171
2172 string tagName = settings.IsHeader ? "th" : "td";
2173
2174 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">")
2175 @settings.Content
2176 @("</" + tagName + ">");
2177 }
2178 @using System.Linq
2179 @using Dynamicweb.Rapido.Blocks.Components.General
2180
2181 @functions {
2182 public class PaginationItemExtended:PaginationItem {
2183 public string Rel { get; set; }
2184 }
2185 }
2186 @* Component *@
2187
2188 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings)
2189 {
2190 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter
2191 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring
2192
2193 if (settings.NumberOfPages > 1)
2194 {
2195 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx";
2196 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation");
2197 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings);
2198
2199 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel">
2200 @if (settings.ShowPagingInfo)
2201 {
2202 <div class="pager__info dw-mod">
2203 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages
2204 </div>
2205 }
2206 <ul class="pager__list dw-mod">
2207 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls)
2208 {
2209 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon })
2210 }
2211 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls && settings.PreviousPageUrl != "#")
2212 {
2213 @Render(new PaginationItemExtended { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon, Rel = "prev" })
2214 }
2215 @if (settings.GetPages().Any())
2216 {
2217 foreach (var page in settings.GetPages())
2218 {
2219 @Render(page)
2220 }
2221 }
2222 else
2223 {
2224 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++)
2225 {
2226 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString());
2227 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) })
2228 ;
2229 }
2230 }
2231 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls && settings.NextPageUrl != "#")
2232 {
2233 @Render(new PaginationItemExtended { Link = settings.NextPageUrl, Icon = settings.NextIcon, Rel = "next" })
2234 }
2235
2236 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls)
2237 {
2238 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon })
2239 }
2240 </ul>
2241 </div>
2242 }
2243 }
2244
2245
2246 @helper RenderPaginationItem(PaginationItem settings)
2247 {
2248 var settingsExtended = settings as PaginationItemExtended;
2249 if (settings.Icon == null)
2250 {
2251 settings.Icon = new Icon();
2252 }
2253 var rel = settingsExtended?.Rel == null ? "" : $"rel='{settingsExtended?.Rel}'";
2254
2255 settings.Icon.Label = settings.Label;
2256 <li class="pager__btn dw-mod">
2257 @if (settings.IsActive)
2258 {
2259 <span class="pager__num pager__num--current dw-mod">
2260 @Render(settings.Icon)
2261 </span>
2262 }
2263 else
2264 {
2265 <a href="@settings.Link" class="pager__num dw-mod" @rel>
2266 @Render(settings.Icon)
2267 </a>
2268 }
2269 </li>
2270 }
2271
2272
2273 @using Dynamicweb.Rapido.Blocks.Components.General
2274 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
2275
2276 @functions{
2277 public class DF_AddToCartButton : ComponentBase
2278 {
2279 public string Title {get; set;}
2280 public bool HideTitle {get; set;}
2281 public Icon Icon {get; set;}
2282 public bool BuyForPoints {get; set;}
2283 public string OnClick {get; set;}
2284 public string ProductId {get; set;}
2285 public string VariantId {get; set;}
2286 public string UnitId {get; set;}
2287 public string ProductInfo {get; set;}
2288 public string QuantitySelectorId {get; set;}
2289 public Dictionary<string, string> ExtraAttributes { get; set; } = new Dictionary<string, string>();
2290 public string CssClass {get; set;}
2291 public string OnePlusOne {get; set;}
2292 public bool Disabled { get; set; }
2293 }
2294
2295 public class DF_AddToCart : ComponentBase
2296 {
2297 public string WrapperCssClass { get; set; }
2298 public Dictionary<string, string> ExtraAttributes { get; set; } = new Dictionary<string, string>();
2299 public DF_AddToCartButton AddButton = new DF_AddToCartButton();
2300 public QuantitySelector QuantitySelector;
2301 public UnitSelector UnitSelector;
2302 public bool Disabled { get; set; }
2303 }
2304 }
2305
2306 @helper RenderDF_AddToCartButton(DF_AddToCartButton settings) {
2307
2308 if (!settings.HideTitle)
2309 {
2310 if (string.IsNullOrEmpty(settings.Title))
2311 {
2312 if (settings.BuyForPoints)
2313 {
2314 settings.Title = Translate("Buy with points");
2315 }
2316 else
2317 {
2318 settings.Title = Translate("Add to cart");
2319 }
2320 }
2321 }
2322 else
2323 {
2324 settings.Title = "";
2325 }
2326
2327 if (settings.Icon == null)
2328 {
2329 settings.Icon = new Icon();
2330 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After;
2331 }
2332
2333 if (string.IsNullOrEmpty(settings.Icon.Name))
2334 {
2335 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue;
2336 }
2337
2338 var addToCartBtn = new AddToCartButton();
2339 addToCartBtn.Title = settings.Title;
2340 addToCartBtn.HideTitle = settings.HideTitle;
2341 addToCartBtn.Icon = settings.Icon;
2342 addToCartBtn.BuyForPoints = settings.BuyForPoints;
2343 addToCartBtn.OnClick = settings.OnClick;
2344 addToCartBtn.ProductId = settings.ProductId;
2345 addToCartBtn.VariantId = settings.VariantId;
2346 addToCartBtn.UnitId = settings.UnitId;
2347 addToCartBtn.ProductInfo = settings.ProductInfo;
2348 addToCartBtn.QuantitySelectorId = settings.QuantitySelectorId;
2349 addToCartBtn.ExtraAttributes = settings.ExtraAttributes;
2350 addToCartBtn.CssClass = settings.CssClass;
2351
2352
2353 var multiplier = settings.OnePlusOne != "" ? "2" : "1";
2354
2355 addToCartBtn.OnClick = "Cart.AddToCart(event, { " +
2356 "id: '" + settings.ProductId + "'," +
2357 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") +
2358 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") +
2359 (settings.BuyForPoints ? "buyForPoints: true," : "") +
2360 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") +
2361
2362 // handles 1+1 promotion
2363 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value * ##)") +
2364
2365 "});" + settings.OnClick;
2366 @RenderButton(addToCartBtn)
2367 }
2368
2369
2370 @helper RenderDF_AddToCart(DF_AddToCart settings) {
2371 //set Id for quantity selector to get it's value from button
2372 if (settings.QuantitySelector != null)
2373 {
2374 if (string.IsNullOrEmpty(settings.QuantitySelector.Id))
2375 {
2376 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N");
2377 }
2378
2379 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id;
2380
2381 if (settings.Disabled)
2382 {
2383 settings.QuantitySelector.Disabled = true;
2384 }
2385
2386 if (string.IsNullOrEmpty(settings.QuantitySelector.Name))
2387 {
2388 settings.QuantitySelector.Name = settings.QuantitySelector.Id;
2389 }
2390 }
2391
2392 if (settings.Disabled)
2393 {
2394 settings.AddButton.Disabled = true;
2395 }
2396
2397 settings.AddButton.CssClass += " btn--condensed";
2398
2399 //unitsSelector
2400 if (settings.UnitSelector != null)
2401 {
2402 if (settings.Disabled)
2403 {
2404 settings.QuantitySelector.Disabled = true;
2405 }
2406 }
2407
2408 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
2409 @if (settings.UnitSelector != null)
2410 {
2411 @Render(settings.UnitSelector)
2412 }
2413 @if (settings.QuantitySelector != null)
2414 {
2415 @Render(settings.QuantitySelector)
2416 }
2417 @Render(settings.AddButton)
2418 </div>
2419 }
2420 @using Dynamicweb.Frontend
2421 @using System.Reflection
2422 @using Dynamicweb.Content.Items
2423 @using System.Web.UI.HtmlControls
2424 @using Dynamicweb.Rapido.Blocks.Components
2425 @using Dynamicweb.Rapido.Blocks
2426 @using Dynamicweb.Rapido.Blocks.Components.Articles
2427
2428 @* Components for the articles *@
2429 @using System.Reflection
2430 @using Dynamicweb.Rapido.Blocks.Components.Articles
2431
2432
2433 @* Component for the articles *@
2434
2435 @helper RenderArticleBanner(dynamic settings) {
2436 string filterClasses = "image-filter image-filter--darken";
2437 settings.Layout = ArticleHeaderLayout.Banner;
2438
2439 if (settings.Image != null)
2440 {
2441 if (settings.Image.Path != null)
2442 {
2443 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">
2444 <div class="background-image @filterClasses dw-mod">
2445 <div class="background-image__wrapper @filterClasses dw-mod">
2446 @{
2447 settings.Image.CssClass += "background-image__cover dw-mod";
2448 }
2449 @Render(settings.Image)
2450 </div>
2451 </div>
2452 <div class="center-container dw-mod">
2453 <div class="grid">
2454 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg">
2455 <div class="u-left-middle">
2456 <div>
2457 @if (!String.IsNullOrEmpty(settings.Heading))
2458 {
2459 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>
2460 }
2461 @if (!String.IsNullOrEmpty(settings.Subheading))
2462 {
2463 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>
2464 }
2465 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2466 {
2467 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>
2468 }
2469 @if (!String.IsNullOrEmpty(settings.Link)) {
2470 <div class="grid__cell">
2471 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2472 </div>
2473 }
2474 </div>
2475 </div>
2476 </div>
2477 @if (settings.ExternalParagraphId != 0)
2478 {
2479 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod">
2480 <div class="u-color-light-gray--bg u-color-dark dw-mod">
2481 @RenderParagraphContent(settings.ExternalParagraphId)
2482 </div>
2483 </div>
2484 }
2485
2486 </div>
2487 </div>
2488 </section>
2489 if (!String.IsNullOrEmpty(settings.Image.Caption)) {
2490 <div class="image-caption dw-mod">@settings.Image.Caption</div>
2491 }
2492 }
2493 else
2494 {
2495 settings.Layout = ArticleHeaderLayout.Clean;
2496 @RenderArticleCleanHeader(settings);
2497 }
2498 }
2499 else
2500 {
2501 settings.Layout = ArticleHeaderLayout.Clean;
2502 @RenderArticleCleanHeader(settings);
2503 }
2504 }
2505 @using System.Reflection
2506 @using Dynamicweb.Rapido.Blocks.Components
2507 @using Dynamicweb.Rapido.Blocks.Components.General
2508 @using Dynamicweb.Rapido.Blocks.Components.Articles
2509 @using Dynamicweb.Rapido.Blocks
2510
2511
2512 @* Component for the articles *@
2513
2514 @helper RenderArticleHeader(ArticleHeader settings) {
2515 dynamic[] methodParameters = new dynamic[1];
2516 methodParameters[0] = settings;
2517 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom");
2518
2519 if (customMethod != null)
2520 {
2521 @customMethod.Invoke(this, methodParameters).ToString();
2522 } else {
2523 switch (settings.Layout)
2524 {
2525 case ArticleHeaderLayout.Clean:
2526 @RenderArticleCleanHeader(settings);
2527 break;
2528 case ArticleHeaderLayout.Split:
2529 @RenderArticleSplitHeader(settings);
2530 break;
2531 case ArticleHeaderLayout.Banner:
2532 @RenderArticleBannerHeader(settings);
2533 break;
2534 case ArticleHeaderLayout.Overlay:
2535 @RenderArticleOverlayHeader(settings);
2536 break;
2537 default:
2538 @RenderArticleCleanHeader(settings);
2539 break;
2540 }
2541 }
2542 }
2543
2544 @helper RenderArticleCleanHeader(ArticleHeader settings) {
2545 dynamic[] methodParameters = new dynamic[1];
2546 methodParameters[0] = settings;
2547 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom");
2548
2549 if (customMethod != null)
2550 {
2551 @customMethod.Invoke(this, methodParameters).ToString();
2552 }
2553 else
2554 {
2555 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";
2556
2557 <div class="grid grid--align-content-start grid--justify-start">
2558 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod">
2559 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0)
2560 {
2561 <div class="u-border-bottom u-padding-bottom">
2562 @if (!String.IsNullOrEmpty(settings.Category))
2563 {
2564 <div class="u-pull--left">
2565 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>
2566 </div>
2567 }
2568 <div class="u-pull--right">
2569 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2570 {
2571 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small>
2572 }
2573 @if (settings.RatingOutOf != 0)
2574 {
2575 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2576 }
2577 </div>
2578 </div>
2579 }
2580
2581 <div class="grid__cell">
2582 @if (!String.IsNullOrEmpty(settings.Heading))
2583 {
2584 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>
2585 }
2586 @if (settings.Image != null)
2587 {
2588 if (settings.Image.Path != null)
2589 {
2590 <div class="u-padding-bottom--lg">
2591 @Render(settings.Image)
2592 </div>
2593 }
2594 }
2595 @if (!String.IsNullOrEmpty(settings.Subheading))
2596 {
2597 <div class="article__leadtext dw-mod">@settings.Subheading</div>
2598 }
2599 @if (!String.IsNullOrEmpty(settings.Link))
2600 {
2601 <div class="grid__cell">
2602 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2603 </div>
2604 }
2605 </div>
2606 </div>
2607 @if (settings.ExternalParagraphId != 0)
2608 {
2609 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod">
2610 @RenderParagraphContent(settings.ExternalParagraphId)
2611 </div>
2612 }
2613 </div>
2614 }
2615 }
2616
2617 @helper RenderArticleSplitHeader(ArticleHeader settings) {
2618 dynamic[] methodParameters = new dynamic[1];
2619 methodParameters[0] = settings;
2620 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom");
2621
2622 if (customMethod != null)
2623 {
2624 @customMethod.Invoke(this, methodParameters).ToString();
2625 }
2626 else
2627 {
2628 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6";
2629
2630 if (settings.Image != null)
2631 {
2632 if (settings.Image.Path != null)
2633 {
2634 <section class="multiple-paragraphs-container paragraph-container--full-width">
2635 <div class="grid">
2636 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod">
2637 <div class="u-left-middle u-padding--lg">
2638 <div>
2639 @if (!String.IsNullOrEmpty(settings.Category))
2640 {
2641 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div>
2642 }
2643 @if (!String.IsNullOrEmpty(settings.Heading))
2644 {
2645 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1>
2646 }
2647 @if (!String.IsNullOrEmpty(settings.Subheading))
2648 {
2649 <div class="article__leadtext dw-mod">@settings.Subheading</div>
2650 }
2651 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2652 {
2653 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small>
2654 }
2655 @if (settings.RatingOutOf != 0)
2656 {
2657 <div class="u-pull--right">
2658 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2659 </div>
2660 }
2661 @if (!String.IsNullOrEmpty(settings.Link)) {
2662 <div class="u-full-width u-pull--left u-margin-top">
2663 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2664 </div>
2665 }
2666 </div>
2667 </div>
2668 </div>
2669 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod" style="background-image:url(/Admin/Public/GetImage.ashx?width=1800&height=1100&crop=0&Quality=99&Format=WebPamp;DoNotUpscale=true&image=@settings.Image.Path); background-position: center center; background-size: cover;"></div>
2670 @if (settings.ExternalParagraphId != 0)
2671 {
2672 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto u-color-light-gray--bg dw-mod">
2673 @RenderParagraphContent(settings.ExternalParagraphId)
2674 </div>
2675 }
2676 </div>
2677 </section>
2678 }
2679 }
2680 else
2681 {
2682 @RenderArticleCleanHeader(settings);
2683 }
2684 }
2685 }
2686
2687 @helper RenderArticleOverlayHeader(ArticleHeader settings) {
2688 dynamic[] methodParameters = new dynamic[1];
2689 methodParameters[0] = settings;
2690 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom");
2691
2692 if (customMethod != null)
2693 {
2694 @customMethod.Invoke(this, methodParameters).ToString();
2695 }
2696 else
2697 {
2698 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12";
2699 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : "";
2700
2701 if (settings.Image != null)
2702 {
2703 if (settings.Image.Path != null)
2704 {
2705 if (settings.ExternalParagraphId == 0)
2706 {
2707 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width">
2708 <div class="background-image image-filter image-filter--darken dw-mod">
2709 <div class="background-image__wrapper image-filter image-filter--darken dw-mod">
2710 @{
2711 settings.Image.CssClass += "background-image__cover dw-mod";
2712 }
2713 @Render(settings.Image)
2714 </div>
2715 </div>
2716 <div class="center-container dw-mod">
2717 <div class="grid @contentAlignment">
2718 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod">
2719 @if (!String.IsNullOrEmpty(settings.Heading))
2720 {
2721 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1>
2722 }
2723 @if (!String.IsNullOrEmpty(settings.Subheading))
2724 {
2725 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div>
2726 }
2727 <div class="u-margin-top">
2728 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date))
2729 {
2730 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small>
2731 }
2732 @if (settings.RatingOutOf != 0)
2733 {
2734 <div class="u-pull--right">
2735 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf })
2736 </div>
2737 }
2738 </div>
2739 @if (!String.IsNullOrEmpty(settings.Link))
2740 {
2741 <div class="grid__cell">
2742 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout })
2743 </div>
2744 }
2745 </div>
2746 </div>
2747 </div>
2748 </section>
2749 }
2750 else
2751 {
2752 @RenderArticleBanner(settings);
2753 }
2754 }
2755 }
2756 else
2757 {
2758 @RenderArticleCleanHeader(settings);
2759 }
2760 }
2761 }
2762
2763 @helper RenderArticleBannerHeader(dynamic settings) {
2764 dynamic[] methodParameters = new dynamic[1];
2765 methodParameters[0] = settings;
2766 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom");
2767
2768 if (customMethod != null)
2769 {
2770 @customMethod.Invoke(this, methodParameters).ToString();
2771 }
2772 else
2773 {
2774 @RenderArticleBanner(settings);
2775 }
2776 }
2777 @using System.Reflection
2778 @using System.Text.RegularExpressions;
2779 @using Dynamicweb.Frontend
2780 @using Dynamicweb.Content.Items
2781 @using Dynamicweb.Rapido.Blocks.Components
2782 @using Dynamicweb.Rapido.Blocks.Components.Articles
2783 @using Dynamicweb.Rapido.Blocks
2784
2785 @* Component for the articles *@
2786
2787 @helper RenderArticleBodyRow(ArticleBodyRow settings)
2788 {
2789 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : "";
2790 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : "";
2791
2792 <div class="grid grid--align-content-start @contentAlignment @position dw-mod">
2793 @RenderBlockList(settings.SubBlocks)
2794 </div>
2795 }
2796 @using System.Reflection
2797 @using Dynamicweb.Rapido.Blocks.Components
2798 @using Dynamicweb.Rapido.Blocks.Components.General
2799 @using Dynamicweb.Rapido.Blocks.Components.Articles
2800 @using Dynamicweb.Rapido.Blocks
2801
2802 @* Component for the articles *@
2803
2804 @helper RenderArticleImage(ArticleImage settings)
2805 {
2806 if (settings.Image != null)
2807 {
2808 if (settings.Image.Path != null)
2809 {
2810 <div class="u-margin-bottom--lg">
2811 @Render(settings.Image)
2812 </div>
2813 }
2814 }
2815 }
2816 @using System.Reflection
2817 @using Dynamicweb.Rapido.Blocks.Components
2818 @using Dynamicweb.Rapido.Blocks.Components.Articles
2819
2820
2821 @* Component for the articles *@
2822
2823 @helper RenderArticleSubHeader(ArticleSubHeader settings)
2824 {
2825 if (!String.IsNullOrEmpty(settings.Title))
2826 {
2827 <h2 class="article__header">@settings.Title</h2>
2828 }
2829 }
2830 @using System.Reflection
2831 @using Dynamicweb.Rapido.Blocks.Components
2832 @using Dynamicweb.Rapido.Blocks.Components.Articles
2833 @using Dynamicweb.Rapido.Blocks
2834
2835
2836 @* Component for the articles *@
2837
2838 @helper RenderArticleText(ArticleText settings)
2839 {
2840 if (!String.IsNullOrEmpty(settings.Text))
2841 {
2842 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : "";
2843
2844 <div class="article__paragraph @greatTextClass dw-mod">
2845 @settings.Text
2846 </div>
2847 }
2848 }
2849 @using System.Reflection
2850 @using Dynamicweb.Rapido.Blocks.Components
2851 @using Dynamicweb.Rapido.Blocks.Components.Articles
2852 @using Dynamicweb.Rapido.Blocks
2853
2854
2855 @* Component for the articles *@
2856
2857 @helper RenderArticleQuote(ArticleQuote settings)
2858 {
2859 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty);
2860
2861 <div class="grid u-padding-bottom--lg">
2862 @if (settings.Image != null)
2863 {
2864 if (settings.Image.Path != null) {
2865 <div class="grid__col-3">
2866 <div class="grid__cell-img">
2867 @{
2868 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author;
2869 settings.Image.CssClass += " article__image article__image--ball";
2870 settings.Image.ImageDefault.Width = 200;
2871 settings.Image.ImageDefault.Height = 200;
2872 }
2873 @Render(settings.Image)
2874 </div>
2875 </div>
2876 }
2877 }
2878 <div class="grid__col-auto">
2879 @if (!String.IsNullOrEmpty(settings.Text))
2880 {
2881 <div class="article__quote dw-mod">
2882 <i class="fas fa-quote-right u-margin-bottom--lg"></i>
2883 @settings.Text
2884 <i class="fas fa-quote-right"></i>
2885 </div>
2886 }
2887 @if (!String.IsNullOrEmpty(settings.Author))
2888 {
2889 <div class="article__quote-author dw-mod">
2890 - @settings.Author
2891 </div>
2892 }
2893 </div>
2894 </div>
2895 }
2896 @using System.Reflection
2897 @using Dynamicweb.Rapido.Blocks.Components
2898 @using Dynamicweb.Rapido.Blocks.Components.Articles
2899 @using Dynamicweb.Rapido.Blocks
2900
2901 @* Component for the articles *@
2902
2903 @helper RenderArticleInfoTable(ArticleInfoTable settings)
2904 {
2905 <table class="table table--clean">
2906 @foreach (var row in settings.Rows)
2907 {
2908 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two";
2909
2910 <tr>
2911 @if (!String.IsNullOrEmpty(row.Icon))
2912 {
2913 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td>
2914 }
2915 <td class="u-no-margin-on-p-elements">
2916 <div class="u-bold">@row.Title</div>
2917 @if (!String.IsNullOrEmpty(row.SubTitle))
2918 {
2919 if (row.Link == null)
2920 {
2921 <div>@row.SubTitle</div>
2922 }
2923 else
2924 {
2925 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a>
2926 }
2927 }
2928 </td>
2929 </tr>
2930 }
2931 </table>
2932 }
2933 @using System.Reflection
2934 @using Dynamicweb.Rapido.Blocks.Components
2935 @using Dynamicweb.Rapido.Blocks.Components.General
2936 @using Dynamicweb.Rapido.Blocks.Components.Articles
2937 @using Dynamicweb.Rapido.Blocks
2938
2939 @* Component for the articles *@
2940
2941 @helper RenderArticleGalleryModal(ArticleGalleryModal settings)
2942 {
2943 Modal galleryModal = new Modal
2944 {
2945 Id = "ParagraphGallery",
2946 Width = ModalWidth.Full,
2947 BodyTemplate = RenderArticleGalleryModalContent()
2948 };
2949
2950 @Render(galleryModal)
2951 }
2952
2953 @helper RenderArticleGalleryModalContent() {
2954 <div class="modal__image-min-size-wrapper">
2955 @Render(new Image {
2956 Id = "ParagraphGallery",
2957 Path = "#",
2958 CssClass = "modal--full__img",
2959 DisableLazyLoad = true,
2960 DisableImageEngine = true
2961 })
2962 </div>
2963
2964 <div class="modal__images-counter" id="ParagraphGallery_counter"></div>
2965
2966 @Render(new Button {
2967 Id = "ParagraphGallery_prev",
2968 ButtonType = ButtonType.Button,
2969 ButtonLayout = ButtonLayout.None,
2970 CssClass = "modal__prev-btn",
2971 Icon = new Icon { Prefix = "far", Name = "fa-angle-left", LabelPosition = IconLabelPosition.After },
2972 OnClick = "Gallery.prevImage('ParagraphGallery')"
2973 })
2974
2975 @Render(new Button {
2976 Id = "ParagraphGallery_next",
2977 ButtonType = ButtonType.Button,
2978 ButtonLayout = ButtonLayout.None,
2979 CssClass = "modal__next-btn",
2980 Icon = new Icon { Prefix = "far", Name = "fa-angle-right", LabelPosition = IconLabelPosition.After },
2981 OnClick = "Gallery.nextImage('ParagraphGallery')"
2982 })
2983 }
2984 @using System.Reflection
2985 @using Dynamicweb.Rapido.Blocks.Components
2986 @using Dynamicweb.Rapido.Blocks.Components.Articles
2987 @using Dynamicweb.Rapido.Blocks
2988
2989
2990 @* Component for the articles *@
2991
2992 @helper RenderArticleRelated(ArticleRelated settings)
2993 {
2994 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : "";
2995 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : "";
2996
2997 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width">
2998 <div class="center-container dw-mod">
2999 <div class="grid u-padding">
3000 <div class="grid__col-md-12 grid__col-xs-12">
3001 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2>
3002 </div>
3003 </div>
3004
3005 <div class="js-handlebars-root u-padding" id="@settings.Title.Replace(" ", String.Empty)" data-template="RelatedSimpleTemplate" data-json-feed="/Default.aspx?ID=@settings.FeedPageId&@settings.Query&ExcludeItemID=@settings.CurrentPageId&PageSize=@settings.PageSize"></div>
3006
3007 <script id="RelatedSimpleTemplate" type="text/x-template">
3008 {{#.}}
3009 <div class="grid u-padding-bottom--lg">
3010 {{#Cases}}
3011 <div class="grid__col-lg-3 grid__col-sm-6 image-hover--zoom dw-mod">
3012 <a href="{{link}}" class="u-full-height u-color-light--bg u-flex u-flex--column">
3013 {{#if image}}
3014 <div class="u-color-light--bg u-no-padding dw-mod">
3015 <div class="flex-img image-hover__wrapper">
3016 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=680&height=314&crop=1&DoNotUpscale=True&Compression=75&image={{image}}" alt="{{title}}" />
3017 </div>
3018 </div>
3019 {{/if}}
3020
3021 <div class="card u-color-light--bg u-full-height dw-mod">
3022 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3>
3023 <p class="article__short-summary dw-mod">{{summary}}</p>
3024 </div>
3025 </a>
3026 </div>
3027 {{/Cases}}
3028 </div>
3029 {{/.}}
3030 </script>
3031 </div>
3032 </section>
3033 }
3034 @using System.Reflection
3035 @using Dynamicweb.Rapido.Blocks.Components
3036 @using Dynamicweb.Rapido.Blocks.Components.Articles
3037 @using Dynamicweb.Rapido.Blocks
3038
3039
3040 @* Component for the articles *@
3041
3042 @helper RenderArticleMenu(ArticleMenu settings)
3043 {
3044 if (!String.IsNullOrEmpty(settings.Title)) {
3045 <div class="u-margin u-border-bottom">
3046 <h3 class="u-no-margin">@settings.Title</h3>
3047 </div>
3048 }
3049
3050 <ul class="menu-left u-margin-bottom dw-mod">
3051 @foreach (var item in settings.Items)
3052 {
3053 @Render(item)
3054 }
3055 </ul>
3056 }
3057
3058 @helper RenderArticleMenuItem(ArticleMenuItem settings)
3059 {
3060 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#";
3061
3062 if (!String.IsNullOrEmpty(settings.Title)) {
3063 <li class="menu-left__item dw-mod">
3064 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a>
3065 </li>
3066 }
3067 }
3068 @using System.Reflection
3069 @using Dynamicweb.Rapido.Blocks.Components
3070 @using Dynamicweb.Rapido.Blocks.Components.Articles
3071 @using Dynamicweb.Rapido.Blocks
3072
3073 @* Component for the articles *@
3074
3075 @helper RenderArticleList(ArticleList settings)
3076 {
3077 if (Pageview != null)
3078 {
3079 bool isParagraph = Pageview.CurrentParagraph != null ? true : false;
3080 string[] sortArticlesListBy = new string[2];
3081
3082 if (isParagraph) {
3083 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };
3084 }
3085 else {
3086 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" };
3087 }
3088
3089 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString();
3090
3091 if (!settings.DisablePagination) {
3092 @RenderItemList(new
3093 {
3094 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle",
3095 ListSourceType = settings.SourceType,
3096 ListSourcePage = sourcePage,
3097 ItemFieldsList = "*",
3098 Filter = settings.Filter,
3099 ListOrderBy = sortArticlesListBy[0],
3100 ListOrderByDirection = sortArticlesListBy[1],
3101 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date",
3102 ListSecondOrderByDirection = "ASC",
3103 IncludeAllChildItems = true,
3104 ListTemplate = settings.Template,
3105 ListPageSize = settings.PageSize.ToString()
3106 });
3107 } else {
3108 @RenderItemList(new
3109 {
3110 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle",
3111 ListSourceType = settings.SourceType,
3112 ListSourcePage = sourcePage,
3113 ItemFieldsList = "*",
3114 Filter = settings.Filter,
3115 ListOrderBy = sortArticlesListBy[0],
3116 ListOrderByDirection = sortArticlesListBy[1],
3117 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date",
3118 ListSecondOrderByDirection = "ASC",
3119 IncludeAllChildItems = true,
3120 ListTemplate = settings.Template,
3121 ListPageSize = settings.PageSize.ToString(),
3122 ListViewMode = "Partial",
3123 ListShowTo = settings.PageSize + 1
3124 });
3125 }
3126 }
3127 }
3128 @using System.Reflection
3129 @using Dynamicweb.Rapido.Blocks.Components.Articles
3130
3131
3132 @* Component for the articles *@
3133
3134 @helper RenderArticleSummary(ArticleSummary settings)
3135 {
3136 if (!String.IsNullOrEmpty(settings.Text))
3137 {
3138 <div class="article__summary dw-mod">@settings.Text</div>
3139 }
3140 }
3141 @using System.Reflection
3142 @using Dynamicweb.Rapido.Blocks.Components
3143 @using Dynamicweb.Rapido.Blocks.Components.Articles
3144 @using Dynamicweb.Rapido.Blocks
3145
3146 @* Component for the articles *@
3147
3148 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings)
3149 {
3150 string pageId = Pageview.ID.ToString();
3151 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All");
3152 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());
3153
3154 foreach (var option in settings.Categories)
3155 {
3156 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter;
3157 }
3158
3159 if (selectedFilter == pageId)
3160 {
3161 selectedFilter = Translate("All");
3162 }
3163
3164 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
3165 {
3166 <div class="u-pull--right u-margin-left">
3167 <div class="collection u-no-margin">
3168 <h5>@Translate("Category")</h5>
3169 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />
3170 <div class="dropdown u-w180px dw-mod">
3171 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>
3172 <div class="dropdown__content dw-mod">
3173 @foreach (var option in settings.Categories)
3174 {
3175 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>
3176 }
3177 </div>
3178 <label class="dropdown-trigger-off" for="CategorySelector"></label>
3179 </div>
3180 </div>
3181 </div>
3182 }
3183 else
3184 {
3185 <div class="u-full-width u-margin-bottom">
3186 <h5 class="u-no-margin">@Translate("Category")</h5>
3187 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" />
3188 <div class="dropdown u-full-width dw-mod">
3189 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label>
3190 <div class="dropdown__content dw-mod">
3191 @foreach (var option in settings.Categories)
3192 {
3193 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div>
3194 }
3195 </div>
3196 <label class="dropdown-trigger-off" for="CategorySelector"></label>
3197 </div>
3198 </div>
3199 }
3200 }
3201 @using System.Reflection
3202 @using Dynamicweb.Rapido.Blocks.Components
3203 @using Dynamicweb.Rapido.Blocks.Components.Articles
3204 @using Dynamicweb.Rapido.Blocks
3205 @using System.Collections.Generic
3206
3207 @* Component for the articles *@
3208
3209 @helper RenderArticleListFilter(ArticleListFilter settings)
3210 {
3211 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All");
3212 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString());
3213
3214 if (settings.Options != null)
3215 {
3216 if (settings.Options is IEnumerable<dynamic>)
3217 {
3218 var options = (IEnumerable<dynamic>) settings.Options;
3219 settings.Options = options.OrderBy(item => item.Name);
3220 }
3221
3222 foreach (var option in settings.Options)
3223 {
3224 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter;
3225 }
3226
3227 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
3228 {
3229 <div class="u-pull--right u-margin-left">
3230 <div class="collection u-no-margin">
3231 <h5>@settings.Label</h5>
3232 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />
3233 <div class="dropdown u-w180px dw-mod">
3234 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>
3235 <div class="dropdown__content dw-mod">
3236 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>
3237 @foreach (var option in settings.Options)
3238 {
3239 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>
3240 }
3241 </div>
3242 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>
3243 </div>
3244 </div>
3245 </div>
3246 }
3247 else
3248 {
3249 <div class="u-full-width u-margin-bottom">
3250 <h5 class="u-no-margin">@settings.Label</h5>
3251 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" />
3252 <div class="dropdown u-full-width w-mod">
3253 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label>
3254 <div class="dropdown__content dw-mod">
3255 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div>
3256 @foreach (var option in settings.Options)
3257 {
3258 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div>
3259 }
3260 </div>
3261 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label>
3262 </div>
3263 </div>
3264 }
3265 }
3266 }
3267 @using System.Reflection
3268 @using Dynamicweb.Rapido.Blocks.Components
3269 @using Dynamicweb.Rapido.Blocks.Components.Articles
3270 @using Dynamicweb.Rapido.Blocks
3271
3272 @* Component for the articles *@
3273
3274 @helper RenderArticleListSearch(ArticleListSearch settings)
3275 {
3276 string searchParameter = !string.IsNullOrEmpty(settings.SearchParameter) ? settings.SearchParameter : "Title";
3277 string searchWord = HttpContext.Current.Request.QueryString.Get(searchParameter);
3278 string searchString = !string.IsNullOrEmpty(searchWord) ? searchWord.Trim('*') : "";
3279 string className = "u-w340px u-pull--right u-margin-left";
3280
3281 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")
3282 {
3283 className = "u-full-width";
3284 }
3285
3286 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className">
3287 <input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('@searchParameter', '*' + document.getElementById('ArticleListSearchInput').value + '*')">
3288 @*<input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParametersInCurrentURL({'Title' : '*' + document.getElementById('ArticleListSearchInput').value + '*', 'ScientificName' : '*' + document.getElementById('ArticleListSearchInput').value + '*'})">*@
3289 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button>
3290 </div>
3291 }
3292 @using System.Reflection
3293 @using Dynamicweb.Rapido.Blocks.Components
3294 @using Dynamicweb.Rapido.Blocks.Components.Articles
3295 @using Dynamicweb.Rapido.Blocks
3296
3297 @* Component for the articles *@
3298
3299 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings)
3300 {
3301 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div>
3302 }
3303 @using System.Reflection
3304 @using Dynamicweb.Rapido.Blocks.Components
3305 @using Dynamicweb.Rapido.Blocks.Components.General
3306 @using Dynamicweb.Rapido.Blocks.Components.Articles
3307 @using Dynamicweb.Rapido.Blocks
3308 @using System.Text.RegularExpressions
3309
3310 @* Component for the articles *@
3311
3312 @helper RenderArticleListItem(ArticleListItem settings)
3313 {
3314 switch (settings.Type) {
3315 case ArticleListItemType.Card:
3316 @RenderArticleListItemCard(settings);
3317 break;
3318 case ArticleListItemType.List:
3319 @RenderArticleListItemList(settings);
3320 break;
3321 case ArticleListItemType.Simple:
3322 @RenderArticleListItemSimple(settings);
3323 break;
3324 default:
3325 @RenderArticleListItemCard(settings);
3326 break;
3327 }
3328 }
3329
3330 @helper RenderArticleListItemCard(ArticleListItem settings) {
3331 <a href="@settings.Link" class="u-full-height u-color-light--bg u-flex u-flex--column">
3332 <div class="u-color-light--bg u-no-padding dw-mod">
3333 @if (settings.Logo != null)
3334 {
3335 string backgroundImage = settings.Image != null ? "background-image:url(/Admin/Public/GetImage.ashx?width=992&height=760&crop=0&Compression=75&DoNotUpscale=True&image=" + settings.Image.Path + "); background-size: cover;" : "";
3336 settings.Logo.ImageDefault.Crop = 5;
3337 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;
3338 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;
3339 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">
3340 @if (settings.Stickers != null)
3341 {
3342 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None)
3343 {
3344 @Render(settings.Stickers);
3345 }
3346 }
3347 @RenderImage(settings.Logo)
3348 </div>
3349 } else if (settings.Image != null)
3350 {
3351 <div class="flex-img image-hover__wrapper u-position-relative dw-mod">
3352 @if (settings.Stickers != null)
3353 {
3354 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None)
3355 {
3356 @Render(settings.Stickers);
3357 }
3358 }
3359 @Render(settings.Image)
3360 </div>
3361 }
3362 </div>
3363
3364 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))
3365 {
3366 <div class="card u-color-light--bg u-full-height dw-mod">
3367 @if (settings.Stickers != null)
3368 {
3369 if (settings.Stickers.Position == StickersListPosition.Custom)
3370 {
3371 @Render(settings.Stickers);
3372 }
3373 }
3374 @if (!String.IsNullOrEmpty(settings.Title))
3375 {
3376 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>
3377 }
3378 @if (!String.IsNullOrEmpty(settings.SubTitle))
3379 {
3380 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3381 }
3382 @if (!String.IsNullOrEmpty(settings.Summary))
3383 {
3384 <p class="article__short-summary dw-mod">@settings.Summary</p>
3385 }
3386 </div>
3387 }
3388 </a>
3389 }
3390
3391 @helper RenderArticleListItemList(ArticleListItem settings) {
3392 <a href="@settings.Link">
3393 <div class="grid u-color-light--bg u-no-padding dw-mod">
3394 <div class="grid__col-md-3">
3395 <div class="u-color-light--bg u-no-padding dw-mod">
3396 @if (settings.Logo != null)
3397 {
3398 string backgroundImage = settings.Image != null ? "background-image:url(/Admin/Public/GetImage.ashx?width=992&height=760&crop=0&Compression=75&DoNotUpscale=True&image=" + settings.Image.Path + "); background-size: cover;" : "";
3399 settings.Logo.ImageDefault.Crop = 5;
3400 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width;
3401 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height;
3402 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage">
3403 @if (settings.Stickers != null)
3404 {
3405 if (settings.Stickers.Position != StickersListPosition.Custom)
3406 {
3407 @Render(settings.Stickers);
3408 }
3409 }
3410 @RenderImage(settings.Logo)
3411 </div>
3412 } else if (settings.Image != null)
3413 {
3414 <div class="flex-img image-hover__wrapper dw-mod">
3415 @if (settings.Stickers != null)
3416 {
3417 if (settings.Stickers.Position != StickersListPosition.Custom)
3418 {
3419 @Render(settings.Stickers);
3420 }
3421 }
3422 @Render(settings.Image)
3423 </div>
3424 }
3425 </div>
3426 </div>
3427
3428 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary))
3429 {
3430 <div class="grid__col-md-9">
3431 @if (!String.IsNullOrEmpty(settings.Title))
3432 {
3433 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3>
3434 }
3435 @if (settings.Stickers != null)
3436 {
3437 if (settings.Stickers.Position == StickersListPosition.Custom)
3438 {
3439 @Render(settings.Stickers);
3440 }
3441 }
3442 @if (!String.IsNullOrEmpty(settings.SubTitle))
3443 {
3444 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3445 }
3446 @if (!String.IsNullOrEmpty(settings.Summary))
3447 {
3448 <p class="article__short-summary dw-mod">@settings.Summary</p>
3449 }
3450 </div>
3451 }
3452 </div>
3453 </a>
3454 }
3455
3456 @helper RenderArticleListItemSimple(ArticleListItem settings) {
3457 <a href="@settings.Link" class="u-color-inherit">
3458 <div class="grid u-color-light--bg u-no-padding dw-mod">
3459 <div class="grid__col-md-12">
3460 @if (!String.IsNullOrEmpty(settings.Title))
3461 {
3462 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div>
3463 }
3464 @if (!String.IsNullOrEmpty(settings.SubTitle))
3465 {
3466 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div>
3467 }
3468 </div>
3469 </div>
3470 </a>
3471 }
3472 @using System.Reflection
3473 @using Dynamicweb.Rapido.Blocks.Components.Articles
3474
3475
3476 @* Component for the articles *@
3477
3478 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings)
3479 {
3480 <small class="article__subscription">
3481 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))
3482 {
3483 <text>@Translate("Written")</text>
3484 }
3485 @if (!string.IsNullOrWhiteSpace(settings.Author))
3486 {
3487 <text>@Translate("by") @settings.Author</text>
3488 }
3489 @if (!string.IsNullOrWhiteSpace(settings.Date))
3490 {
3491 <text>@Translate("on") @settings.Date</text>
3492 }
3493 </small>
3494 }
3495 @using System.Reflection
3496 @using Dynamicweb.Rapido.Blocks.Components.Articles
3497 @using Dynamicweb.Rapido.Blocks.Components.General
3498
3499
3500 @* Component for the articles *@
3501
3502 @helper RenderArticleLink(ArticleLink settings)
3503 {
3504 if (!string.IsNullOrEmpty(settings.Title))
3505 {
3506 Button link = new Button {
3507 ConfirmText = settings.ConfirmText,
3508 ConfirmTitle = settings.ConfirmTitle,
3509 ButtonType = settings.ButtonType,
3510 Id = settings.Id,
3511 Title = settings.Title,
3512 AltText = settings.AltText,
3513 OnClick = settings.OnClick,
3514 CssClass = settings.CssClass,
3515 Disabled = settings.Disabled,
3516 Icon = settings.Icon,
3517 Name = settings.Name,
3518 Href = settings.Href,
3519 ButtonLayout = settings.ButtonLayout,
3520 ExtraAttributes = settings.ExtraAttributes
3521 };
3522 <div class="grid__cell">
3523 @Render(link)
3524 </div>
3525 }
3526 }
3527 @using System.Reflection
3528 @using Dynamicweb.Rapido.Blocks
3529 @using Dynamicweb.Rapido.Blocks.Components.Articles
3530 @using Dynamicweb.Rapido.Blocks.Components.General
3531
3532
3533 @* Component for the articles *@
3534
3535 @helper RenderArticleCarousel(ArticleCarousel settings)
3536 {
3537 <div class="grid">
3538 <div class="grid__col-12 u-no-padding u-margin-bottom">
3539 <div class="carousel" id="carousel_@settings.Id">
3540 <div class="carousel__container js-carousel-slides dw-mod">
3541 @RenderBlockList(settings.SubBlocks)
3542 </div>
3543 </div>
3544 </div>
3545 </div>
3546
3547 <script>
3548 document.addEventListener("DOMContentLoaded", function () {
3549 new CarouselModule("#carousel_@settings.Id", {
3550 slideTime: 0,
3551 dots: true
3552 });
3553 });
3554 </script>
3555 }
3556
3557 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings)
3558 {
3559 string imageEngine = "/Admin/Public/GetImage.ashx?";
3560
3561 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image;
3562 if (settings.ImageSettings != null)
3563 {
3564 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : "";
3565 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : "";
3566 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&";
3567 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&";
3568 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&";
3569 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&";
3570 }
3571 defaultImage += "&Image=" + settings.Image;
3572
3573 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')">
3574 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title">
3575 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2>
3576 <div class="article-list__item-info">
3577 @if (settings.Stickers != null)
3578 {
3579 settings.Stickers.Position = StickersListPosition.Custom;
3580 @Render(settings.Stickers);
3581 }
3582
3583 <small class="u-margin-top--lg u-color-light">
3584 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date)))
3585 {
3586 <text>@Translate("Written")</text>
3587 }
3588 @if (!string.IsNullOrWhiteSpace(settings.Author))
3589 {
3590 <text>@Translate("by") @settings.Author</text>
3591 }
3592 @if (!string.IsNullOrWhiteSpace(settings.Date))
3593 {
3594 <text>@Translate("on") @settings.Date</text>
3595 }
3596 </small>
3597 </div>
3598
3599 <h3 class="article__short-summary u-color-light">@settings.Summary</h3>
3600 </a>
3601 @if (settings.UseFilters == true)
3602 {
3603 <div class="background-image image-filter image-filter--darken dw-mod"></div>
3604 }
3605 </div>
3606 }
3607 @using System.Text.RegularExpressions
3608 @using Dynamicweb.Rapido.Blocks.Components
3609 @using Dynamicweb.Rapido.Blocks.Components.General
3610 @using Dynamicweb.Rapido.Blocks.Components.Articles
3611 @using Dynamicweb.Rapido.Blocks
3612
3613 @* Component for the articles *@
3614
3615 @helper RenderArticleVideo(ArticleVideo settings)
3616 {
3617 if (settings.Url != null)
3618 {
3619 //getting video ID from youtube URL
3620 string videoCode = settings.Url;
3621 Regex regex = new Regex(@".be\/(.[^?]*)");
3622 Match match = regex.Match(videoCode);
3623 string videoId = "";
3624 if (match.Success)
3625 {
3626 videoId = match.Groups[1].Value;
3627 }
3628 else
3629 {
3630 regex = new Regex(@"v=([^&]+)");
3631 match = regex.Match(videoCode);
3632 if (match.Success)
3633 {
3634 videoId = match.Groups[1].Value;
3635 }
3636 }
3637
3638 int autoPlay = settings.AutoPlay == "true" ? 1 : 0;
3639
3640 <div class="video-wrapper">
3641 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div>
3642 </div>
3643 }
3644 }
3645 @using System.Reflection
3646 @using Dynamicweb.Rapido.Blocks.Components
3647 @using Dynamicweb.Rapido.Blocks.Components.Articles
3648 @using Dynamicweb.Rapido.Blocks
3649
3650
3651 @functions{
3652 BlocksPage articlePageComponent = BlocksPage.GetBlockPage("DynamicArticle");
3653 public class DF_ArticleParagraph : ComponentBase
3654 {
3655 public ItemViewModel ParagraphContent {get; set;}
3656 public int counter {get; set;}
3657 public string imageColumns {get; set;}
3658 public string imageLayout {get; set;}
3659 public string contentColumns {get; set;}
3660 }
3661
3662 }
3663
3664 @helper RenderDF_ArticleParagraph(DF_ArticleParagraph settings)
3665 {
3666 ItemViewModel paragraph = settings.ParagraphContent;
3667 int count = settings.counter;
3668 string imageColumns = settings.imageColumns;
3669 string imageLayout = settings.imageLayout;
3670 string contentColumns = settings.contentColumns;
3671
3672
3673
3674 string paragraphListHeading = "12";
3675 var contentPosition = paragraph.GetList("ContentPosition") != null ? paragraph.GetList("ContentPosition").SelectedValue : "";
3676 //content position
3677 // number 5 is a random one to make the first item greater than second one
3678 var contentCountTextDecisionFirst = contentPosition == "left" || contentPosition == "top" ? 1 : 0;
3679 var contentCountImageDecisionFirst = contentPosition == "left" || contentPosition == "top" ? 5 : 0;
3680 var contentCountTextDecisionSecond = contentPosition == "right" || contentPosition == "bottom" ? 5 : 0;
3681 var contentCountImageDecisionSecond = contentPosition == "right" || contentPosition == "bottom" ? 1 : 0;
3682
3683 var paragraphTextColumn = contentPosition == "top" || contentPosition == "bottom" ? "12" : "6";
3684 var paragraphImageColumn = contentPosition == "top" || contentPosition == "bottom" ? "12" : "6";
3685
3686
3687
3688 if (!paragraph.GetBoolean("RenderAsQuote"))
3689 {
3690 //string enableDropCap = Model.Item.GetString("EnableDropCap") != null ? Model.Item.GetList("EnableDropCap").SelectedValue.ToLower() : "default";
3691 //enableDropCap = enableDropCap == "default" && GetParentSettingsItem("EnableDropCap") != null ? GetParentSettingsItem("EnableDropCap").ToString().ToLower() : enableDropCap;
3692 string text = paragraph.GetString("Text") != null ? paragraph.GetString("Text") : "";
3693
3694 //if (!String.IsNullOrEmpty(text) && enableDropCap == "true" && count == 0 && paragraph.GetString("Text").Substring(0, 3) == "<p>")
3695 //{
3696 // string firstLetter = paragraph.GetString("Text").Substring(3, 1);
3697 // text = paragraph.GetString("Text").Remove(3, 1);
3698 // text = text.Insert(3, "<span class=\"article__drop-cap\">" + firstLetter + "</span>");
3699 // }
3700
3701 if (!String.IsNullOrEmpty(paragraph.GetString("Heading")))
3702 {
3703 var hideHeading = paragraph.GetBoolean("HideHeading");
3704 var hideHeadingClass = hideHeading == true ? "u-hidden" : "";
3705
3706 Block articleParagraphHeader = new Block
3707 {
3708 Id = "ArticleParagraph" + count + "Heading",
3709 SortId = (count * 10),
3710 Component = new ArticleSubHeader { Title = paragraph.GetString("Heading") },
3711 Design = new Design
3712 {
3713 RenderType = RenderType.Column,
3714 Size = paragraphListHeading,
3715 CssClass = String.Format("u-color-light--bg u-padding-left--lg u-padding-right--lg {0}", hideHeadingClass)
3716 }
3717 };
3718 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphHeader);
3719 }
3720
3721 if (paragraph.GetFile("Image") != null)
3722 {
3723 string imageTitle = !string.IsNullOrEmpty(paragraph.GetString("Heading")) ? paragraph.GetString("Heading") : "";
3724 string imageCaption = !string.IsNullOrEmpty(paragraph.GetString("ImageCaption")) ? paragraph.GetString("ImageCaption") : "";
3725
3726
3727 Block articleParagraphImage = new Block
3728 {
3729 Id = "ArticleParagraph" + count + "Image",
3730 SortId = (count * 10) + 2 + contentCountImageDecisionFirst + contentCountImageDecisionSecond,
3731 Design = new Design
3732 {
3733 RenderType = RenderType.Column,
3734 Size = paragraphImageColumn,
3735 CssClass = "u-color-light--bg u-padding--lg"
3736 }
3737 };
3738
3739 if (imageLayout == "banner")
3740 {
3741 ArticleBanner banner = new ArticleBanner
3742 {
3743 Image = new Image {
3744 Path = paragraph.GetFile("Image"),
3745 ImageDefault = new ImageSettings { Height = 650, Width = 1300 },
3746 Caption = paragraph.GetString("ImageCaption")
3747 },
3748 Heading = imageTitle,
3749 UseFilters = false
3750 };
3751 articleParagraphImage.Component = banner;
3752 }
3753 else
3754 {
3755 ArticleImage image = new ArticleImage
3756 {
3757 Image = new Image
3758 {
3759 Path = paragraph.GetFile("Image"),
3760 Title = imageCaption != "" ? imageCaption : imageTitle,
3761 ImageDefault = new ImageSettings { Height = 650, Width = 1300 },
3762 Caption = paragraph.GetString("ImageCaption")
3763 }
3764 };
3765 articleParagraphImage.Component = image;
3766 }
3767
3768 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphImage);
3769 }
3770
3771
3772 if (!String.IsNullOrEmpty(text))
3773 {
3774 Block articleParagraphText = new Block
3775 {
3776 Id = "ArticleParagraph" + count + "Text",
3777 SortId = (count * 10) + 3 + contentCountTextDecisionFirst + contentCountTextDecisionSecond,
3778 Component = new ArticleText { Text = text },
3779 Design = new Design
3780 {
3781 RenderType = RenderType.Column,
3782 Size = paragraphTextColumn,
3783 CssClass = "u-color-light--bg u-padding-left--lg u-padding-right--lg u-no-padding-y"
3784 }
3785 };
3786
3787 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphText);
3788 }
3789
3790 if (!String.IsNullOrEmpty(paragraph.GetString("VideoURL")))
3791 {
3792 Block articleParagraphVideo = new Block
3793 {
3794 Id = "ArticleParagraph" + count + "Video",
3795 SortId = (count * 10) + 1,
3796 Component = new ArticleVideo { Url = paragraph.GetString("VideoURL"), AutoPlay = "false" },
3797 Design = new Design
3798 {
3799 RenderType = RenderType.Column,
3800 Size = imageColumns,
3801 CssClass = "u-color-light--bg u-padding--lg"
3802 }
3803 };
3804 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphVideo);
3805 }
3806 }
3807 else
3808 {
3809 if (!String.IsNullOrEmpty(paragraph.GetString("Text")))
3810 {
3811 string quoteText = paragraph.GetString("Text") != null ? paragraph.GetString("Text") : "";
3812 string quoteAuthor = paragraph.GetString("Heading") != null ? paragraph.GetString("Heading") : "";
3813
3814 Block articleParagraphQuote = new Block
3815 {
3816 Id = "ArticleParagraph" + count + "Quote",
3817 SortId = (count * 10) + 3,
3818 Component = new ArticleQuote { Image = new Image { Path = paragraph.GetFile("Image") }, Text = quoteText, Author = quoteAuthor },
3819 Design = new Design
3820 {
3821 RenderType = RenderType.Column,
3822 Size = contentColumns,
3823 CssClass = "u-color-light--bg u-padding--lg"
3824 }
3825 };
3826 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphQuote);
3827 }
3828 }
3829
3830
3831 }
3832
3833 @using System.Reflection
3834 @using Dynamicweb.Rapido.Blocks.Components
3835 @using Dynamicweb.Rapido.Blocks.Components.Articles
3836 @using Dynamicweb.Rapido.Blocks
3837
3838 @functions{
3839 //BlocksPage articlePageComponent = BlocksPage.GetBlockPage("DynamicArticle");
3840 public class DF_RelatedProducts : ComponentBase
3841 {
3842 public string Title {get; set;}
3843 public string Id {get; set;}
3844 public string FeedPageId {get; set;}
3845 public string Query {get; set;}
3846 public string CurrentPageId {get; set;}
3847 public string CurrentProductId {get; set;}
3848 public int PageSize {get; set;}
3849 public bool productManual {get; set;}
3850 }
3851 }
3852
3853 @helper RenderDF_RelatedProducts(DF_RelatedProducts settings)
3854 {
3855 <section class="multiple-paragraphs-container paragraph-container--full-width article--related-products">
3856 <div class="center-container dw-mod">
3857 <div class="grid u-padding">
3858 <div class="grid__col-md-12 grid__col-xs-12">
3859 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2>
3860 </div>
3861 </div>
3862 @if(settings.productManual == false) {
3863 <div class="js-handlebars-root false u-padding" id="@settings.Id" data-template="ProductContainer" data-json-feed="/Default.aspx?ID=@settings.FeedPageId&@settings.Query&ExcludeItemID=@settings.CurrentPageId&PageSize=@settings.PageSize"></div>
3864 } else {
3865 <div class="js-handlebars-root true u-padding" id="@settings.Id" data-template="ProductContainer" data-json-feed="@settings.FeedPageId"></div>
3866 }
3867
3868 <script id="ProductContainer" type="text/x-template">
3869 {{#.}}
3870 <div class="u-min-h400px u-full-width">
3871 <div class="grid">
3872 {{#ifCond totalPages '>' 1}}
3873 <div class="grid__col-45px grid__col--bleed-x content-promotion__buttons prev">
3874 <div class="grid__cell grid__cell--align-middle-left">
3875 @{
3876 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('" + settings.Id + "', '{{prevPage}}')" };
3877 prevButton.ExtraAttributes.Add("", "{{prevdisabled}}");
3878 }
3879 @Render(prevButton)
3880 </div>
3881 </div>
3882 {{/ifCond}}
3883 <div class="grid__col-auto grid__col--bleed-x content-promotion__products">
3884 <div id="ProductsContainer" data-template="ProductGridItemContainer" class="grid product-list dw-mod" data-save-cookie="true">
3885 {{#ProductsContainer}}
3886 <div id="Product{{productId}}" class="grid__col-3 product-list__grid-item dw-mod">
3887 {{#Product}}
3888 <div class="grid__col--auto js-product-scroll-trigger u-no-padding u-full-height" data-params="{{googleImpression}}">
3889 <div class="grid__cell product-list__grid-item__image dw-mod {{noImage}}">
3890 <a href="{{link}}"
3891 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}"
3892 class="u-block u-position-relative image-hover__wrapper dw-mod">
3893 @Render(new Image { Path = "{{image}}", ImageDefault = new ImageSettings { Width = 300, Height = 300, Crop = 5, FillCanvas = true, DoNotUpscale = true }, Title = "{{name}}", CssClass = "grid__cell-img grid__cell-img--centered u-min-h180px" })
3894 {{#StickersContainers}}
3895 {{>StickersContainer}}
3896 {{/StickersContainers}}
3897 </a>
3898
3899 @*<div class="favorites favorites--for-grid-view u-pull--right {{hasVariants}} dw-mod" {{hasVariants}}>
3900 {{#Favorite}}
3901 {{>FavoriteTemplate}}
3902 {{/Favorite}}
3903 </div>*@
3904
3905 </div>
3906
3907 <div class="grid__cell product-list__grid-item__price-info dw-mod">
3908 <a href="{{link}}" onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" title="{{name}}" class="u-color-inherit">
3909 @Render(new Heading { Title = "{{name}}", Level = 6, CssClass = "u-condensed-text u-bold" })
3910 </a>
3911 @RenderGridViewPriceInfo()
3912 </div>
3913
3914 <div class="product-list__grid-item__footer dw-mod">
3915 @RenderProductGridItemAddToCart()
3916 </div>
3917 </div>
3918 {{/Product}}
3919 </div>
3920 {{/ProductsContainer}}
3921 </div>
3922 </div>
3923 {{#ifCond totalPages '>' 1}}
3924 <div class="grid__col-45px grid__col--bleed-x content-promotion__buttons next">
3925 <div class="grid__cell grid__cell--align-middle-right">
3926 @{
3927 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('" + settings.Id + "', '{{nextPage}}')" };
3928 nextButton.ExtraAttributes.Add("", "{{nextdisabled}}");
3929 }
3930 @Render(nextButton)
3931 </div>
3932 </div>
3933 {{/ifCond}}
3934 </div>
3935 </div>
3936 {{/.}}
3937 </script>
3938 <script id="StickersContainer" type="text/x-template">
3939 <div class="stickers-container stickers-container--{{{convertStickerPositionToClassName Position}}} dw-mod">
3940 {{#Stickers}}
3941 {{>Sticker}}
3942 {{/Stickers}}
3943 </div>
3944 </script>
3945
3946 <script id="Sticker" type="text/x-template">
3947 @Render(new Sticker { Title = "{{Title}}", CssClass = "{{CssClass}}" })
3948 </script>
3949
3950 <script>
3951 @{
3952 bool relatedUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
3953
3954 if (relatedUseGoogleTagManager)
3955 {
3956 <text>
3957 //document.addEventListener("DOMContentLoaded", function (event) {
3958 // Scroll.AddIsInViewportListener(".js-product-scroll-trigger", function (elem) {
3959 //let googleImpression = JSON.parse(elem.getAttribute("data-params"));
3960 //googleImpression.list = "Produse recomandate";
3961 //googleEnchantImpression(googleImpression);
3962 // elem.classList.remove("js-product-scroll-trigger");
3963 // });
3964 // });
3965 </text>
3966 }
3967 }
3968 </script>
3969 </div>
3970 </section>
3971 }
3972
3973 @helper RenderGridViewPriceInfo()
3974 {
3975 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
3976 bool showPrice = !Pageview.AreaSettings.GetItem("ProductList").GetBoolean("HidePrice");
3977 bool showCartButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowAddToCartButton");
3978 bool showVATPrice = Pageview.AreaSettings.GetItem("ProductList").GetBoolean("ShowBothPricesWithWithoutVAT");
3979 bool isPricesWithVATEnabled = Dynamicweb.Ecommerce.Common.Context.DisplayPricesWithVat;
3980
3981 if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed())
3982 {
3983 if (pointShopOnly)
3984 {
3985 <text>
3986 {{#if havePointPrice}}
3987 <div class="price price--product-list dw-mod">{{points}} @Translate("points")</div>
3988 @if (showCartButton)
3989 {
3990 <text>
3991 {{#unless canBePurchasedWithPoints}}
3992 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small>
3993 {{/unless}}
3994 </text>
3995 }
3996 {{else}}
3997 @Translate("Not available")
3998 {{/if}}
3999 </text>
4000 }
4001 else
4002 {
4003 <div class="price price--product-list dw-mod">{{price}}</div>
4004 <div class="before-price {{onSale}} dw-mod">{{discount}}</div>
4005 if (showVATPrice)
4006 {
4007 <div class="vat-price vat-price--product-list u-margin-top dw-mod">
4008 @if (isPricesWithVATEnabled)
4009 {
4010 <span>@Translate("excl. VAT")</span><span> ({{priceWithoutVAT}})</span>
4011 }
4012 else
4013 {
4014 <span>@Translate("incl. VAT")</span><span> ({{priceWithVAT}})</span>
4015 }
4016 </div>
4017 }
4018 <text>
4019 {{#if priceRRP}}
4020 <div><small>@Translate("RRP") {{priceRRP}}</small></div>
4021 {{/if}}
4022 </text>
4023 }
4024 }
4025 }
4026
4027 @helper RenderProductGridItemAddToCart() {
4028 var gridViewSettings = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView");
4029 var ecommerceSettings = Pageview.AreaSettings.GetItem("Ecommerce");
4030
4031 bool pointShopOnly = ecommerceSettings.GetBoolean("PointShopOnly");
4032 bool showCartButton = gridViewSettings.GetBoolean("ShowAddToCartButton");
4033 bool showViewButton = gridViewSettings.GetBoolean("ShowViewButton");
4034 string viewMoreText = gridViewSettings.GetString("ViewMoreText");
4035 viewMoreText = !string.IsNullOrEmpty(viewMoreText) ? viewMoreText : "View";
4036 string wrapperClass = "buttons-collection--center";
4037 int columnsCount = gridViewSettings.GetList("Columns") != null ? Converter.ToInt32(gridViewSettings.GetList("Columns").SelectedValue) : 4;
4038 bool hideButtonText = columnsCount >= 4 || Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet";
4039
4040 if (pointShopOnly && columnsCount <= 4)
4041 {
4042 hideButtonText = false;
4043 }
4044
4045 var viewBtn = new Link
4046 {
4047 Href = "{{link}}",
4048 Id = "CartButton_{{id}}",
4049 Title = Translate(viewMoreText),
4050 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}",
4051 ButtonLayout = ButtonLayout.Secondary,
4052 CssClass = "u-no-margin"
4053 };
4054
4055 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
4056 {
4057 var addToCartBtn = new AddToCart
4058 {
4059 WrapperCssClass = wrapperClass,
4060 AddButton = new AddToCartButton
4061 {
4062 ProductId = "{{productId}}",
4063 VariantId = "{{variantid}}",
4064 UnitId = "{{unitId}}",
4065 ProductInfo = "{{productInfo}}",
4066 BuyForPoints = pointShopOnly,
4067 HideTitle = hideButtonText,
4068 OnClick = "{{facebookPixelAction}}",
4069 ExtraAttributes = new Dictionary<string, string>
4070 {
4071 { "{{disabledBuyButton}}", "" }
4072 }
4073 }
4074 };
4075
4076 if (!pointShopOnly)
4077 {
4078 addToCartBtn.QuantitySelector = new QuantitySelector
4079 {
4080 Id = "Quantity{{id}}"
4081 };
4082 }
4083
4084 if (showCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
4085 {
4086 if (!showViewButton)
4087 {
4088 @Render(addToCartBtn)
4089 }
4090 else
4091 {
4092 <text>{{#if hideAddToCartButton}}</text>
4093 <div>@Render(viewBtn)</div>
4094 <text>{{else}}</text>
4095 @Render(addToCartBtn)
4096 <text>{{/if}}</text>
4097 }
4098 }
4099 else if (showViewButton)
4100 {
4101 <div>@Render(viewBtn)</div>
4102 }
4103 }
4104 else if (showViewButton)
4105 {
4106 <div>@Render(viewBtn)</div>
4107 }
4108 }
4109
4110 @* Simple helpers *@
4111
4112 @*Requires the Gallery ItemType that comes with Rapido*@
4113 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) {
4114 if (gallery != null && gallery.Count > 0)
4115 {
4116 int count = 1;
4117
4118 foreach (var item in gallery)
4119 {
4120 if (item.GetFile("ImagePath") != null)
4121 {
4122 string image = item.GetFile("ImagePath").PathUrlEncoded;
4123 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&height=820&crop=5&Compression=75&DoNotUpscale=1&image=";
4124 int imagesCount = gallery.Count;
4125
4126 if (count == 1)
4127 {
4128 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))">
4129 <span class="gallery__main-image">
4130 <img src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=992&height=760&crop=0&Compression=75&DoNotUpscale=1&image=@image" class="b-lazy flex-img js-gallery" alt="" data-for="ParagraphGallery" data-image="@imagePrefix@image" />
4131 </span>
4132 <span class="gallery__image-counter">
4133 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span>
4134 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span>
4135 </span>
4136 </label>
4137 }
4138 else
4139 {
4140 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div>
4141 }
4142
4143 count++;
4144 }
4145 }
4146
4147 @Render(new ArticleGalleryModal())
4148 }
4149 }
4150
4151 @helper RenderMobileFilters(List<Block> subBlocks)
4152 {
4153 if (subBlocks.Count > 0)
4154 {
4155 <div class="grid__col-12">
4156 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" />
4157 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters">
4158 @RenderBlockList(subBlocks)
4159 </div>
4160 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label>
4161 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label>
4162 </div>
4163 }
4164 }
4165
4166
4167 @* Include the Blocks for the page *@
4168 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
4169
4170 @using System
4171 @using System.Web
4172 @using System.Collections.Generic
4173 @using Dynamicweb.Rapido.Blocks.Extensibility
4174 @using Dynamicweb.Rapido.Blocks
4175
4176 @functions {
4177 string GoogleTagManagerID = "";
4178 string GoogleAnalyticsID = "";
4179 }
4180
4181 @{
4182 GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID");
4183 GoogleAnalyticsID = Model.Area.Item.GetItem("Settings").GetString("GoogleAnalyticsTrackingID");
4184
4185 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");
4186
4187 if (!string.IsNullOrWhiteSpace(GoogleAnalyticsID))
4188 {
4189 Block tagManager = new Block()
4190 {
4191 Id = "GoogleAnalytics",
4192 SortId = 0,
4193 Template = RenderGoogleAnalyticsSnippet()
4194 };
4195 topSnippetsBlocksPage.Add("Head", tagManager);
4196 }
4197
4198 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID))
4199 {
4200 Block tagManager = new Block()
4201 {
4202 Id = "TagManager",
4203 SortId = 1,
4204 Template = RenderGoogleTagManager()
4205 };
4206 topSnippetsBlocksPage.Add("Head", tagManager);
4207
4208 Block tagManagerBodySnippet = new Block()
4209 {
4210 Id = "TagManagerBodySnippet",
4211 SortId = 1,
4212 Template = RenderGoogleTagManagerBodySnippet()
4213 };
4214 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManagerBodySnippet);
4215 }
4216
4217 Block facebookPixel = new Block()
4218 {
4219 Id = "FacebookPixel",
4220 SortId = 2,
4221 Template = RenderFacebookPixel()
4222 };
4223
4224 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel);
4225 }
4226
4227 @helper RenderGoogleAnalyticsSnippet()
4228 {
4229 <!-- Global site tag (gtag.js) - Google Analytics -->
4230 @*<script async src="https://www.googletagmanager.com/gtag/js?id=@GoogleAnalyticsID"></script>
4231 <script>
4232 window.dataLayer = window.dataLayer || [];
4233 function gtag(){dataLayer.push(arguments);}
4234 gtag('js', new Date());
4235
4236 gtag('config', '@GoogleAnalyticsID');
4237 </script>*@
4238
4239 }
4240
4241 @helper RenderGoogleTagManager()
4242 {
4243 <script>
4244 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
4245 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
4246 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
4247 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
4248 })(window,document,'script','dataLayer','@GoogleTagManagerID');
4249 </script>
4250
4251
4252
4253
4254
4255
4256
4257 @*google consent mode v2*@
4258 <script>
4259 window.dataLayer = window.dataLayer || [];
4260 function gtag(){dataLayer.push(arguments);}
4261
4262 gtag('consent', 'default', {
4263 'ad_storage': 'denied',
4264 'ad_user_data': 'denied',
4265 'ad_personalization': 'denied',
4266 'analytics_storage': 'denied',
4267 'functionality_storage': 'denied',
4268 'personalization_storage': 'denied',
4269 'security_storage': 'denied'
4270 });
4271 </script>
4272
4273 }
4274
4275 @helper RenderGoogleTagManagerBodySnippet()
4276 {
4277 <!-- Google Tag Manager (noscript) -->
4278 <noscript>
4279 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID"
4280 height="0" width="0" style="display:none;visibility:hidden"></iframe>
4281 </noscript>
4282 <!-- End Google Tag Manager (noscript) -->
4283
4284
4285
4286
4287
4288
4289 }
4290
4291 @helper RenderFacebookPixel()
4292 {
4293 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID");
4294
4295 if (!string.IsNullOrWhiteSpace(FacebookPixelID))
4296 {
4297 <!-- Facebook Pixel Code -->
4298 <script>
4299 !function(f,b,e,v,n,t,s)
4300 {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
4301 n.callMethod.apply(n,arguments):n.queue.push(arguments)};
4302 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
4303 n.queue=[];t=b.createElement(e);t.async=!0;
4304 t.src=v;s=b.getElementsByTagName(e)[0];
4305 s.parentNode.insertBefore(t,s)}(window, document,'script',
4306 'https://connect.facebook.net/en_US/fbevents.js');
4307 fbq('init', '@FacebookPixelID');
4308 fbq('track', 'PageView');
4309 </script>
4310 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript>
4311 }
4312 }
4313
4314 @helper RenderSnippetMeta()
4315 {
4316 @RenderSnippet("Meta")
4317 }
4318 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
4319
4320 @using System
4321 @using System.Web
4322 @using System.Collections.Generic
4323 @using Dynamicweb.Rapido.Blocks
4324 @using Dynamicweb.Rapido.Blocks.Extensibility
4325 @using Dynamicweb.Security.UserManagement
4326 @using Dynamicweb.Security.UserManagement.ExternalAuthentication
4327 @using Dynamicweb.Rapido.Blocks.Components.General
4328
4329 @{
4330 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master");
4331
4332 Block loginModal = new Block()
4333 {
4334 Id = "LoginModal",
4335 SortId = 10,
4336 Component = new Modal
4337 {
4338 Id = "SignIn",
4339 Heading = new Heading
4340 {
4341 Level = 0,
4342 Title = Translate("Sign in")
4343 },
4344 Width = ModalWidth.Sm,
4345 BodyTemplate = RenderLoginForm()
4346 }
4347 };
4348
4349 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal);
4350 }
4351
4352 @helper RenderLoginForm()
4353 {
4354 int pageId = Model.TopPage.ID;
4355 string userSignedInErrorText = "";
4356 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
4357 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
4358 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
4359 bool showModalOnStart = pageId != GetPageIdByNavigationTag("CustomerCenter") && Model.LogOnFailed;
4360 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
4361 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");
4362
4363 ProviderCollection providers = Provider.GetActiveProviders();
4364
4365 if (Model.LogOnFailed)
4366 {
4367 switch (Model.LogOnFailedReason)
4368 {
4369 case LogOnFailedReason.PasswordLengthInvalid:
4370 userSignedInErrorText = Translate("Password length is invalid");
4371 break;
4372 case LogOnFailedReason.IncorrectLogin:
4373 userSignedInErrorText = Translate("Invalid email or password");
4374 break;
4375 case LogOnFailedReason.ExceededFailedLogOnLimit:
4376 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked");
4377 break;
4378 case LogOnFailedReason.LoginLocked:
4379 userSignedInErrorText = Translate("The user account is temporarily locked");
4380 break;
4381 case LogOnFailedReason.PasswordExpired:
4382 userSignedInErrorText = Translate("The password has expired and needs to be renewed");
4383 break;
4384 default:
4385 userSignedInErrorText = Translate("An unknown error occured");
4386 break;
4387 }
4388 }
4389
4390 Form form = new Form { Method = FormMethod.Post, Name = "LoginModalForm" };
4391
4392 TextField passwordField = new TextField { Id = "login-password", Type = TextFieldType.Password, Name = "password", Label = Translate("Password"), Required = true };
4393
4394 if (!hideForgotPasswordLink) {
4395 passwordField.Link = new Link { Title = Translate("Forgot password?"), Href = "/Default.aspx?id=" + signInProfilePageId + "&LoginAction=Recovery" };
4396 }
4397
4398 form.Add(new HiddenField { Name = "ID", Value = Converter.ToString(pageId) });
4399 form.Add(new HiddenField { Name = "DWExtranetUsernameRemember", Value = "True" });
4400 form.Add(new HiddenField { Name = "DWExtranetPasswordRemember", Value = "True" });
4401 form.Add(new HiddenField { Name = "LoginAction", Value = "Login" });
4402 form.Add(new TextField { Id = "LoginUsername", Name = "username", Label = Translate("Email"), CssClass = "u-full-width", Required = true });
4403 form.Add(passwordField);
4404 form.Add(new NotificationMessage { Message = userSignedInErrorText, MessageType = NotificationMessageType.Error });
4405 form.Add(new CheckboxField { Id = "LoginRememberMe", Value = "True", Name = "Autologin", Label = Translate("Remember me") });
4406 form.Add(new Button { ButtonType = ButtonType.Submit, Title = Translate("Sign in"), CssClass = "btn--full", OnClick = "Buttons.LockButton(event)" });
4407
4408 foreach (Provider LoginProvider in providers)
4409 {
4410 var ProviderName = LoginProvider.Name.ToLower();
4411 form.Add(new Link {
4412 Href = "/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=" + LoginProvider.ID,
4413 Icon = new Icon { Prefix = "fab", Name = "fa-" + ProviderName, CssClass = "fa-1_5x", LabelPosition = IconLabelPosition.After },
4414 ButtonLayout = ButtonLayout.LinkClean,
4415 CssClass = "btn--condensed u-margin-bottom u-margin-right u-inline-block u-color-" + ProviderName,
4416 AltText = ProviderName
4417 });
4418 }
4419
4420 if (!hideCreateAccountLink) {
4421 form.Add(new Text { Content = "<div class=\"u-border-top u-full-width u-margin-bottom--lg\"></div>" });
4422 form.Add(new Link
4423 {
4424 Href = "/Default.aspx?id=" + createAccountPageId,
4425 ButtonLayout = ButtonLayout.LinkClean,
4426 Title = Translate("Create account"),
4427 CssClass = "u-full-width u-ta-center"
4428 });
4429 }
4430
4431 @Render(form)
4432
4433 if (showModalOnStart)
4434 {
4435 <script>
4436 document.getElementById("SignInModalTrigger").checked = true;
4437 </script>
4438 }
4439 }
4440
4441 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet")
4442 {
4443 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4444
4445 @using System
4446 @using System.Web
4447 @using System.Collections.Generic
4448 @using Dynamicweb.Rapido.Blocks.Extensibility
4449 @using Dynamicweb.Rapido.Blocks
4450 @using Dynamicweb.Rapido.Services
4451
4452
4453 @functions {
4454 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master");
4455 }
4456
4457 @{
4458 var mobileTopLayout = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetString("Design")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left";
4459 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
4460 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || !Dynamicweb.Rapido.Services.User.IsBuyingAllowed();
4461
4462 var totalNumberOfProductsForDefault = 0;
4463 using (var contexter = new OrderContexter(Dynamicweb.Ecommerce.Orders.OrderContext.GetOrderContextById("ORDERCONTEXT7")))
4464 {
4465 var cartContext = Dynamicweb.Ecommerce.Common.Context.Cart;
4466 totalNumberOfProductsForDefault = cartContext != null ? Converter.ToInt32(cartContext.ProductOrderLines.Sum(ol => ol.Quantity)) : 0;
4467 }
4468
4469 var totalNumberOfProductsForIngrasaminte = 0;
4470 using (var contexter = new OrderContexter(Dynamicweb.Ecommerce.Orders.OrderContext.GetOrderContextById("ORDERCONTEXT5")))
4471 {
4472 var cartContext = Dynamicweb.Ecommerce.Common.Context.Cart;
4473 totalNumberOfProductsForIngrasaminte = cartContext != null ? Converter.ToInt32(cartContext.ProductOrderLines.Sum(ol => ol.Quantity)) : 0;
4474 }
4475
4476 var totalNumberOfProductsForAllCarts = totalNumberOfProductsForDefault + totalNumberOfProductsForIngrasaminte;
4477
4478 Block mobileHeader = new Block()
4479 {
4480 Id = "MobileTop",
4481 SortId = 10,
4482 Template = RenderMobileTop(),
4483 SkipRenderBlocksList = true
4484 };
4485 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader);
4486
4487 Block mobileHeaderNavigation = new Block()
4488 {
4489 Id = "MobileHeaderNavigation",
4490 SortId = 10,
4491 Template = RenderMobileHeaderNavigation(),
4492 SkipRenderBlocksList = true,
4493 BlocksList = new List<Block> {
4494 new Block {
4495 Id = "MobileHeaderNavigationTrigger",
4496 SortId = 10,
4497 Template = RenderMobileHeaderNavigationTrigger()
4498 }
4499 }
4500 };
4501 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation);
4502
4503 Block mobileHeaderLogo = new Block()
4504 {
4505 Id = "MobileHeaderLogo",
4506 SortId = 20,
4507 Template = RenderMobileHeaderLogo(),
4508 SkipRenderBlocksList = true
4509 };
4510 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo);
4511
4512 Block mobileHeaderContact = new Block()
4513 {
4514 Id = "MobileHeaderActions",
4515 SortId = 25,
4516 Template = RenderMobileTopContact(),
4517 SkipRenderBlocksList = true
4518 };
4519 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderContact);
4520
4521 Block mobileHeaderActions = new Block()
4522 {
4523 Id = "MobileHeaderActions",
4524 SortId = 30,
4525 Template = RenderMobileTopActions(),
4526 SkipRenderBlocksList = true
4527 };
4528 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions);
4529
4530 Block mobileHeaderSignIn = new Block()
4531 {
4532 Id = "MobileHeaderAccount",
4533 SortId = 70,
4534 Template = RenderMobileHeaderSignIn(),
4535 SkipRenderBlocksList = true
4536 };
4537 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderSignIn);
4538
4539
4540 Block mobileHeaderActions2 = new Block()
4541 {
4542 Id = "MobileHeaderActions2",
4543 SortId = 80,
4544 Template = RenderMobileTopActions2(),
4545 SkipRenderBlocksList = true
4546 };
4547 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions2);
4548
4549 if (!mobileHideSearch)
4550 {
4551 Block mobileHeaderSearch = new Block
4552 {
4553 Id = "MobileHeaderSearch",
4554 SortId = 10,
4555 Template = RenderMobileTopSearch()
4556 };
4557 mobileHeaderBlocksPage.Add("mobileHeaderActions2", mobileHeaderSearch);
4558 }
4559
4560 Block mobileHeaderMiniCart;
4561
4562 if (!mobileHideCart)
4563 {
4564 mobileHeaderMiniCart = new Block
4565 {
4566 Id = "MobileHeaderMiniCart",
4567 SortId = 20,
4568 Template = RenderMobileTopMiniCart(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte)
4569 };
4570
4571 Block miniCartCounterScriptTemplate = new Block
4572 {
4573 Id = "MiniCartCounterScriptTemplate",
4574 Template = RenderMobileMiniCartCounterContent()
4575 };
4576 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);
4577 }
4578 else
4579 {
4580 mobileHeaderMiniCart = new Block
4581 {
4582 Id = "MobileHeaderMiniCart",
4583 SortId = 20
4584 };
4585 }
4586
4587 if (!mobileHideSearch)
4588 {
4589 Block mobileHeaderSearchBar = new Block()
4590 {
4591 Id = "MobileHeaderSearchBar",
4592 SortId = 30,
4593 Template = RenderMobileTopSearchBarCustom()
4594 };
4595 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar);
4596 }
4597
4598
4599 Block mobileModalCart = new Block
4600 {
4601 Id = "MobileModalCart",
4602 SortId = 90,
4603 Template = RenderCheckCartModal(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte)
4604 };
4605 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileModalCart);
4606
4607
4608
4609
4610 switch (mobileTopLayout)
4611 {
4612 case "nav-left":
4613 mobileHeaderNavigation.SortId = 10;
4614 mobileHeaderLogo.SortId = 20;
4615 mobileHeaderActions.SortId = 30;
4616 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);
4617 break;
4618 case "nav-right":
4619 mobileHeaderLogo.SortId = 10;
4620 mobileHeaderActions.SortId = 20;
4621 mobileHeaderNavigation.SortId = 30;
4622 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart);
4623 break;
4624 case "nav-search-left":
4625 mobileHeaderNavigation.SortId = 10;
4626 mobileHeaderLogo.SortId = 20;
4627 mobileHeaderActions.SortId = 30;
4628 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);
4629 break;
4630 case "search-left":
4631 mobileHeaderActions.SortId = 10;
4632 mobileHeaderLogo.SortId = 20;
4633 mobileHeaderNavigation.SortId = 30;
4634 mobileHeaderMiniCart.SortId = 0;
4635 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart);
4636 break;
4637 }
4638 }
4639
4640
4641 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
4642
4643 @using System
4644 @using System.Web
4645 @using Dynamicweb.Rapido.Blocks.Extensibility
4646 @using Dynamicweb.Rapido.Blocks
4647
4648 @{
4649 BlocksPage customMobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master");
4650 }
4651
4652
4653
4654
4655 @helper RenderMobileTop() {
4656 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList();
4657
4658 <nav class="main-navigation-mobile dw-mod">
4659 <div class="center-container top-container__center-container dw-mod">
4660 <div class="grid grid--align-center mobile__header-items">
4661 @RenderBlockList(subBlocks)
4662 </div>
4663 </div>
4664 </nav>
4665 }
4666
4667 @helper RenderMobileHeaderNavigation() {
4668 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList();
4669
4670 <div class="grid__col-auto-width grid__col--bleed hamburger__item">
4671 <ul class="menu dw-mod">
4672 @RenderBlockList(subBlocks)
4673 </ul>
4674 </div>
4675 }
4676
4677 @helper RenderMobileHeaderNavigationTrigger() {
4678 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
4679 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label>
4680 </li>
4681 }
4682
4683 @helper RenderMobileHeaderLogo() {
4684 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList();
4685
4686 var mobileTopLayout = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetString("Design")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left";
4687 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : "";
4688 string firstPageId = Model.Area.FirstActivePage.ID.ToString();
4689 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName");
4690
4691 string mobileLogo = "/Files/Images/logo-dynamicweb.png";
4692 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null)
4693 {
4694 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded;
4695 }
4696
4697 if (Path.GetExtension(mobileLogo).ToLower() != ".svg")
4698 {
4699 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&width=100&crop=5&Compression=75&image=" + mobileLogo;
4700 }
4701 else
4702 {
4703 mobileLogo = HttpUtility.UrlDecode(mobileLogo);
4704 }
4705
4706 <div class="grid__col-auto grid__col--bleed logo__item">
4707 <div class="grid__cell @centeredLogo">
4708 <a href="/" class="logo logo--mobile u-inline-block dw-mod">
4709 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" />
4710 </a>
4711 </div>
4712
4713 @RenderBlockList(subBlocks)
4714 </div>
4715 }
4716
4717 @helper RenderMobileTopContact() {
4718 <div class="grid__col-auto-width grid__col--bleed contact__item">
4719 <a class="dw-mod u-no-margin u-flex grid--justify-center" href="tel:0219145" style="color:#fff; line-height: 1; font-size:24px;">
4720 <i class="fas fa-phone u-no-margin" style="font-size:24px;"></i>
4721 </a>
4722 </div>
4723 }
4724
4725 @helper RenderMobileTopActions() {
4726 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList();
4727
4728 <div class="grid__col-auto-width grid__col--bleed cart__item">
4729 <ul class="menu dw-mod">
4730 @RenderBlockList(subBlocks)
4731 </ul>
4732 </div>
4733 }
4734
4735 @helper RenderMobileTopActions2() {
4736 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions2").OrderBy(item => item.SortId).ToList();
4737
4738 <div class="grid__col-auto-width grid__col--bleed search__item">
4739 <ul class="menu dw-mod">
4740 @RenderBlockList(subBlocks)
4741 </ul>
4742 </div>
4743 }
4744
4745 @helper RenderMobileHeaderSignIn() {
4746 <div class="menu-mobile__item grid__col--bleed account__item u-margin-right--lg">
4747 <label for="SignInModalTrigger" onclick="document.getElementById('MobileNavTrigger').checked = false;" class="menu-mobile__link dw-mod menu-mobile__link--highlighted"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i></label>
4748 </div>
4749 }
4750
4751
4752
4753 @helper RenderMobileTopSearch() {
4754 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
4755 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">
4756 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>
4757 </label>
4758 </li>
4759 }
4760
4761 @helper RenderMobileTopMiniCart(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0) {
4762 int miniCartFeedDefaultPageId = GetPageIdByNavigationTag("MiniCartFeed");
4763 int miniCartFeedIngrasamintePageId = GetPageIdByNavigationTag("MiniCartFeedIngrasaminte");
4764 int miniCartFeedSelectedPageId = totalNumberOfProductsForDefault > 0 || totalNumberOfProductsForIngrasaminte == 0 ? miniCartFeedDefaultPageId : miniCartFeedIngrasamintePageId;
4765
4766 string cartProductsCount = (totalNumberOfProductsForDefault + totalNumberOfProductsForIngrasaminte).ToString();
4767
4768 int cartPageId = GetPageIdByNavigationTag("CartPage");
4769 int cartPageIngrasaminteId = GetPageIdByNavigationTag("CartPageIngrasaminte");
4770
4771 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper">
4772 <div class="mini-cart dw-mod">
4773 <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="menu__link menu__link--icon menu__link--mobile dw-mod js-mini-cart-button" data-cartpage-ingrasaminte="@cartPageIngrasaminteId" data-cartpage-regular="@cartPageId" data-order-context="@cartProductsCount">
4774 <div id="minicart_icon" class="u-inline u-position-relative" data-miniCartFeedId="@miniCartFeedDefaultPageId" data-miniCartFeed-IngrasaminteId="@miniCartFeedIngrasamintePageId" data-miniCart-ContextId="@miniCartFeedSelectedPageId">
4775 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i>
4776 <div class="mini-cart__counter dw-mod">
4777 <div class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedSelectedPageId&feedType=Counter" data-init-onload="false" data-preloader="false">
4778 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount">
4779 @cartProductsCount
4780 </div>
4781 </div>
4782 </div>
4783 </div>
4784 </a>
4785 </div>
4786 </li>
4787 }
4788
4789 @helper RenderMobileTopSearchBar()
4790 {
4791 string searchFeedId = "";
4792 string searchSecondFeedId = "";
4793 int groupsFeedId;
4794 int productsPageId = GetPageIdByNavigationTag("ProductsPage");
4795 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
4796 string resultPageLink;
4797 string searchPlaceholder;
4798 string searchType = "product-search";
4799 string searchTemplate;
4800 string searchContentTemplate = "";
4801 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";
4802 bool showGroups = true;
4803
4804 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch")
4805 {
4806 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";
4807 resultPageLink = contentSearchPageLink;
4808 searchPlaceholder = Translate("Search page");
4809 groupsFeedId = 0;
4810 searchType = "content-search";
4811 searchTemplate = "SearchPagesTemplate";
4812 showGroups = false;
4813 }
4814 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch")
4815 {
4816 searchFeedId = productsPageId + "&feed=true";
4817 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true";
4818 resultPageLink = Converter.ToString(productsPageId);
4819 searchPlaceholder = Translate("Search products or pages");
4820 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");
4821 searchType = "combined-search";
4822 searchTemplate = "SearchProductsTemplateWrap";
4823 searchContentTemplate = "SearchPagesTemplateWrap";
4824 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");
4825 }
4826 else
4827 {
4828 resultPageLink = Converter.ToString(productsPageId);
4829 searchFeedId = productsPageId + "&feed=true";
4830 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed");
4831 searchPlaceholder = Translate("Search products");
4832 searchTemplate = "SearchProductsTemplate";
4833 searchType = "product-search";
4834 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector");
4835 }
4836
4837 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" />
4838
4839 <div class="main-navigation-mobile typeahead-mobile dw-mod">
4840 <div class="center-container top-container__center-container dw-mod">
4841 <div class="grid">
4842 <div class="grid__col-auto padding-position-tb">
4843 <div class="typeahead-mobile__search-field dw-mod js-typeahead" data-page-size="@(searchType == "combined-search" ? 4 : 8)" id="MobileProductSearch" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-search-type="@searchType">
4844 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue">
4845 @if (string.IsNullOrEmpty(searchSecondFeedId))
4846 {
4847 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></ul>
4848 }
4849 else
4850 {
4851 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid">
4852 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></div>
4853 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="MobileContentSearchBarContent" data-template="@searchContentTemplate" data-json-feed="/Default.aspx?ID=@searchSecondFeedId" data-init-onload="false"></div>
4854 </div>
4855 }
4856 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn" aria-label="product search"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button>
4857 </div>
4858 </div>
4859 <!-- <div class="grid__col-auto-width close__button">
4860 <ul class="menu dw-mod">
4861 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod">
4862 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod">
4863 <i class="fas fa-times fa-1_5x"></i>
4864 </label>
4865 </li>
4866 </ul>
4867 </div> -->
4868 </div>
4869 </div>
4870 </div>
4871 @RenderFreeShippingMessageMobile()
4872 }
4873
4874 @helper RenderMobileMiniCartCounterContent()
4875 {
4876 <script id="MiniCartCounterContent" type="text/x-template">
4877 {{#.}}
4878 <div class="js-mini-cart-counter-content dw-mod" data-count="{{totalnumberofproductsforallcarts}}">
4879 {{totalnumberofproductsforallcarts}}
4880 </div>
4881 {{/.}}
4882 </script>
4883 }
4884
4885
4886 @helper RenderCheckCartModal(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0) {
4887 int cartRegularProductsCount = Converter.ToInt32(Model.Cart.TotalProductsCount);
4888 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
4889 string cartIngrasamintePageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPageIngrasaminte");
4890 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
4891
4892 <div class="check-cart__wrapper u-hidden">
4893
4894 <label for="Check_Cart" class="dw-mod">
4895 <button class="u-no-margin u-margin-top--lg btn btn--primary dw-mod" style="pointer-events: none;">@Translate("Selecteaza Cosul")</button>
4896 </label>
4897 <!-- Trigger for the login modal -->
4898 <input type="checkbox" id="Check_Cart" class="modal-trigger" />
4899 </div>
4900 <!-- Add address modal -->
4901 <div class="modal-container">
4902 <label for="Check_Cart" id="CheckCartModalOverlay" class="modal-overlay"></label>
4903 <div class="modal modal--md" id="CheckCartModal">
4904 <div class="modal__header no-border">
4905 <button type="button" class="close btn btn--primary dw-mod u-margin-top--lg"><i class="fas fa-times"></i></button>
4906 <h2 class="u-ta-center">@Translate("Selecteaza Cosul")</h2>
4907 </div>
4908 <div class="modal__body">
4909 <div class="mini-cart-dropdown__body u-flex dw-mod">
4910 <div class="js-handlebars-root u-flex grid--direction-column u-full-width dw-mod" id="MiniCartContentMobile" data-template="MiniCartContentMobileTemplate" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart"></div>
4911 </div>
4912 </div>
4913 </div>
4914 </div>
4915
4916 <script id="MiniCartContentMobileTemplate" type="text/x-template">
4917 {{#.}}
4918 <div class="form__field-group--bordered" style="padding:1rem;">
4919 <div class="container__cart-type">
4920 <div class="radio">
4921 <div>
4922 <input id="cart1" name="radio-2" value="" type="radio" checked>
4923 <label for="cart1" class="radio-label">Cosul Ingrasaminte:</label>
4924 </div>
4925 <div class="radio__item">
4926 <div style="font-size: 1.4rem;">Nr. Produs(e):<span style="color:#fb8100; font-weight: bold; margin-left:0.3rem;"> {{totalnumberofproductsforingrasamintecart}}</span></div>
4927 <div><button type="button" title="Goleste cosul" class="u-no-margin" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event, 'ORDERCONTEXT5');"><i class="fas fa-trash-alt" alt="goleste cosul"></i></button></div>
4928 </div>
4929 </div>
4930 <div class="radio">
4931 <div>
4932 <input id="cart2" name="radio-2" value="" type="radio">
4933 <label for="cart2" class="radio-label">Cosul cu restul produselor:</label>
4934 </div>
4935 <div class="radio__item">
4936 <div style="font-size: 1.4rem;">Nr. Produs(e):<span style="color:#fb8100; font-weight: bold; margin-left:0.3rem;"> {{totalnumberofproductsfordefaultcart}}</span></div>
4937 <div><button type="button" title="Goleste cosul" class="u-no-margin" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event, 'ORDERCONTEXT7');"><i class="fas fa-trash-alt" alt="goleste cosul"></i></button></div>
4938 </div>
4939 </div>
4940 </div>
4941 <a id="go_to_cart" href="" class="u-full-width u-no-margin u-margin-top--lg btn btn--primary dw-mod">@Translate("Vezi cosul")</a>
4942 </div>
4943 {{/.}}
4944 </script>
4945
4946 }
4947
4948 @helper RenderFreeShippingMessageMobile() {
4949
4950 @* Free shipping message *@
4951 <div class="content-container grid__col-12 dw-mod freeshipping-msg" style="background-color: #8fbf00;">
4952 <div class="center-container top-container__center-container content-row content-row--full content-row--column-gap-none content-row--stretch content-row--height-auto dw-mod">
4953
4954 <div class="u-full-width u-align-center u-align-self-center dw-mod">
4955 <div class="u-full-height">
4956 <div class="content-row__item__body padding-size-xs padding-position-around dw-mod">
4957 <div class="freeshipping__banner">
4958 <img src="/Files/Templates/Designs/Rapido/Images/icon_transport_white_new.png" alt='@Translate("FreeShippingMessage1")' class="u-margin-right--xs" height="25px" />
4959 <div class="content__container-wrapper">
4960 <div class="freeshipping_text-wrapper">
4961 <p class="content__container__list__item">@Translate("FreeShippingMessage1")</p>
4962 <p class="content__container__list__item">@Translate("FreeShippingMessage2")</p>
4963 </div>
4964 </div>
4965 <img src="/Files/Templates/Designs/Rapido/Images/icon_transport_white_new.png" alt='@Translate("FreeShippingMessage1")' class="u-margin-left--xs" style="transform: scaleX(-1);" height="25px" />
4966 </div>
4967 </div>
4968 </div>
4969 </div>
4970
4971 </div>
4972 </div>
4973
4974 }
4975
4976 @helper RenderMobileTopSearchBarCustom() {
4977 var paragraphId = Model.ID;
4978 string searchTerm = string.Empty;
4979 var productPage = GetPageIdByNavigationTag("ProductsPage");
4980 var searchResultsPage = GetPageIdByNavigationTag("ProductContentSearchResults");
4981
4982
4983 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request["q"]))
4984 {
4985 searchTerm = Dynamicweb.Context.Current.Request["q"];
4986
4987 }
4988
4989
4990 @*<div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar"
4991 data-page-size="7"
4992 data-search-feed-id="@options.searchFeedId"
4993 data-search-second-feed-id="@options.searchSecondFeedId"
4994 data-result-page-id="@options.resultPageLink"
4995 data-groups-page-id="@options.groupsFeedId"
4996 data-search-type="@options.searchType">
4997 @if (options.showGroups)
4998 {
4999 <button type="button" class="btn btn--condensed u-color-light-gray--bg typeahead-group-btn dw-mod js-typeahead-groups-btn" data-group-id="all">@Translate("All")</button>
5000 <ul class="dropdown dropdown--absolute-position u-min-w220px js-handlebars-root js-typeahead-groups-content dw-mod" id="ProductSearchBarGroupsContent" data-template="SearchGroupsTemplate" data-json-feed="/Default.aspx?ID=@options.groupsFeedId&feedType=productGroups" data-init-onload="false" data-preloader="minimal"></ul>
5001 }
5002 <div class="typeahead-search-field">
5003 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue">
5004 @if (string.IsNullOrEmpty(options.searchSecondFeedId))
5005 {
5006 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul>
5007 }
5008 else
5009 {
5010 <div class="dropdown dropdown--absolute-position dropdown--combined grid">
5011 <div class="js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-init-onload="false"></div>
5012 <div class="js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-init-onload="false"></div>
5013 </div>
5014 }
5015 </div>
5016 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn btn--no-radius" title="@Translate("Search")"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button>
5017 </div>*@
5018
5019 <div class="js-async-fetch-placeholder" style="position:relative; top: -50px; display: flex;">
5020 <div class="dropdown js-type-ahead-dropdown type-ahead-dropdown u-relative" style="width: calc(100% - 50px); margin: 0 auto;">
5021 <form method="get"
5022 action="@productPage"
5023 data-search-results-page="@searchResultsPage"
5024 data-product-details-page="/Default.aspx?ID=@productPage"
5025 data-product-list-page="/Default.aspx?ID=@productPage"
5026 data-search-layout="field"
5027 class="js-suggest-form suggest-form">
5028
5029 <input type="hidden" class="js-type-ahead-parameter" />
5030 <input type="hidden" name="ID" value="@productPage"/>
5031 <input type="hidden" name="redirect" value="false" />
5032 <input type="hidden" name="SearchLayout" value="field" />
5033
5034 @*<label for="searchField_@paragraphId" class="visually-hidden">@Translate("Search here")</label>*@
5035
5036 <span class="u-position-absolute top-0 icon-2 px-3 u-flex align-items-center h-100 search-icon">
5037 <i class="fas fa-search"></i>
5038 </span>
5039 <input id="searchField_@paragraphId"
5040 class="form-control js-type-ahead-field type-ahead-field py-2 ps-5 pe-3 m-0 u-full-width"
5041 type="search"
5042 placeholder="@Translate("Search here")"
5043 autocomplete="off"
5044 maxlength="255"
5045 name="q"
5046 value="@searchTerm"
5047 data-original="@searchTerm"
5048 onfocus="Typeahead.init()">
5049
5050 <button type="button"
5051 onclick="var f = document.getElementById('searchField_@paragraphId'); f.value = ''; f.focus();"
5052 class="btn h-100 icon-2 reset-search"
5053 aria-label="@Translate("Clear search")"
5054 style="opacity: 0; position: absolute; top: 0; right: 0; visibility: hidden;">
5055 @*@ReadFile(iconPath + "x.svg")*@
5056 <i class="fas fa-times"></i>
5057 </button>
5058
5059 <ul class="dropdown-menu w-100 js-type-ahead-menu type-ahead-menu p-3"></ul>
5060 <ul class="dropdown-menu w-100 p-3 searchterm__history"></ul>
5061 </form>
5062 </div>
5063 </div>
5064 }</text>
5065 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5066
5067 @using System
5068 @using System.Web
5069 @using System.Collections.Generic
5070 @using Dynamicweb.Rapido.Blocks.Extensibility
5071 @using Dynamicweb.Rapido.Blocks
5072
5073 @functions {
5074 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master");
5075 }
5076
5077 @{
5078 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");
5079 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
5080 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");
5081 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");
5082 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");
5083 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");
5084
5085 Block mobileNavigation = new Block()
5086 {
5087 Id = "MobileNavigation",
5088 SortId = 10,
5089 Template = MobileNavigation(),
5090 SkipRenderBlocksList = true
5091 };
5092 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation);
5093
5094 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink)
5095 {
5096 Block mobileNavigationSignIn = new Block
5097 {
5098 Id = "MobileNavigationSignIn",
5099 SortId = 10,
5100 Template = RenderMobileNavigationSignIn()
5101 };
5102 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn);
5103 }
5104
5105 Block mobileNavigationMenu = new Block
5106 {
5107 Id = "MobileNavigationMenu",
5108 SortId = 20,
5109 Template = RenderMobileNavigationMenu()
5110 };
5111 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu);
5112
5113 Block mobileNavigationActions = new Block
5114 {
5115 Id = "MobileNavigationActions",
5116 SortId = 30,
5117 Template = RenderMobileNavigationActions(),
5118 SkipRenderBlocksList = true
5119 };
5120 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions);
5121
5122 if (!mobileNavigationItemsHideSignIn)
5123 {
5124 if (Model.CurrentUser.ID <= 0)
5125 {
5126 Block mobileNavigationSignInAction = new Block
5127 {
5128 Id = "MobileNavigationSignInAction",
5129 SortId = 10,
5130 Template = RenderMobileNavigationSignInAction()
5131 };
5132 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction);
5133
5134 if (!mobileHideCreateAccountLink)
5135 {
5136 Block mobileNavigationCreateAccountAction = new Block
5137 {
5138 Id = "MobileNavigationCreateAccountAction",
5139 SortId = 20,
5140 Template = RenderMobileNavigationCreateAccountAction()
5141 };
5142 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction);
5143 }
5144 }
5145 else
5146 {
5147 if (!mobileHideMyOrdersLink)
5148 {
5149 Block mobileNavigationOrdersAction = new Block
5150 {
5151 Id = "MobileNavigationOrdersAction",
5152 SortId = 20,
5153 Template = RenderMobileNavigationOrdersAction()
5154 };
5155 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction);
5156 }
5157 if (!mobileHideMyFavoritesLink)
5158 {
5159 Block mobileNavigationFavoritesAction = new Block
5160 {
5161 Id = "MobileNavigationFavoritesAction",
5162 SortId = 30,
5163 Template = RenderMobileNavigationFavoritesAction()
5164 };
5165 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction);
5166 }
5167 if (!mobileHideMySavedCardsLink)
5168 {
5169 Block mobileNavigationSavedCardsAction = new Block
5170 {
5171 Id = "MobileNavigationFavoritesAction",
5172 SortId = 30,
5173 Template = RenderMobileNavigationSavedCardsAction()
5174 };
5175 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction);
5176 }
5177
5178 Block mobileNavigationSignOutAction = new Block
5179 {
5180 Id = "MobileNavigationSignOutAction",
5181 SortId = 40,
5182 Template = RenderMobileNavigationSignOutAction()
5183 };
5184 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction);
5185 }
5186 }
5187
5188 if (Model.Languages.Count > 1)
5189 {
5190 Block mobileNavigationLanguagesAction = new Block
5191 {
5192 Id = "MobileNavigationLanguagesAction",
5193 SortId = 50,
5194 Template = RenderMobileNavigationLanguagesAction()
5195 };
5196 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction);
5197 }
5198 }
5199
5200
5201 @helper MobileNavigation()
5202 {
5203 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList();
5204 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left";
5205 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right";
5206
5207 <!-- Trigger for mobile navigation -->
5208 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" />
5209
5210 <!-- Mobile navigation -->
5211 <nav class="mobile-navigation mobile-navigation--@position dw-mod">
5212 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper">
5213 @RenderBlockList(subBlocks)
5214 </div>
5215 </nav>
5216
5217 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label>
5218 }
5219
5220 @helper RenderMobileNavigationSignIn()
5221 {
5222 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
5223 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
5224 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
5225 string myProfilePageLink = linkStart + myProfilePageId;
5226 string userName = Model.CurrentUser.FirstName;
5227 if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(Model.CurrentUser.LastName))
5228 {
5229 userName += " " + Model.CurrentUser.LastName;
5230 }
5231 if (string.IsNullOrEmpty(userName))
5232 {
5233 userName = Model.CurrentUser.Name;
5234 }
5235 if (string.IsNullOrEmpty(userName))
5236 {
5237 userName = Model.CurrentUser.UserName;
5238 }
5239 if (string.IsNullOrEmpty(userName))
5240 {
5241 userName = Model.CurrentUser.Email;
5242 }
5243
5244 <ul class="menu menu-mobile">
5245 <li class="menu-mobile__item">
5246 <a href="@myProfilePageLink" class="menu-mobile__link dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @userName</a>
5247 </li>
5248 </ul>
5249 }
5250
5251 @helper RenderMobileNavigationMenu()
5252 {
5253 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";
5254 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt";
5255 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3";
5256 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
5257 int startLevel = 0;
5258
5259 @RenderNavigation(new
5260 {
5261 id = "mobilenavigation",
5262 cssclass = "menu menu-mobile dwnavigation",
5263 startLevel = @startLevel,
5264 ecomStartLevel = @startLevel + 1,
5265 endlevel = @levels,
5266 expandmode = "all",
5267 template = @menuTemplate
5268 })
5269
5270 if (isSlidesDesign)
5271 {
5272 <script>
5273 function goToLevel(level) {
5274 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%";
5275 }
5276
5277 document.addEventListener('DOMContentLoaded', function () {
5278 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length);
5279 });
5280 </script>
5281 }
5282
5283 if (renderPagesInToolBar)
5284 {
5285 @RenderNavigation(new
5286 {
5287 id = "topToolsMobileNavigation",
5288 cssclass = "menu menu-mobile dwnavigation",
5289 template = "ToolsMenuForMobile.xslt"
5290 })
5291 }
5292 }
5293
5294 @helper RenderMobileNavigationActions()
5295 {
5296 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ;
5297
5298 <ul class="menu menu-mobile">
5299 @RenderBlockList(subBlocks)
5300 </ul>
5301 }
5302
5303 @helper RenderMobileNavigationSignInAction()
5304 {
5305 <li class="menu-mobile__item">
5306 <label for="SignInModalTrigger" onclick="document.getElementById('MobileNavTrigger').checked = false;" class="menu-mobile__link dw-mod menu-mobile__link--highlighted"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Sign in")</label>
5307 </li>
5308 }
5309
5310 @helper RenderMobileNavigationCreateAccountAction()
5311 {
5312 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
5313
5314 <li class="menu-mobile__item">
5315 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Default.aspx?ID=@createAccountPageId"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Create account")</a>
5316 </li>
5317 }
5318
5319 @helper RenderMobileNavigationProfileAction()
5320 {
5321 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
5322 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
5323 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
5324 string myProfilePageLink = linkStart + myProfilePageId;
5325
5326 <li class="menu-mobile__item">
5327 <a href="@myProfilePageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("My Profile")</a>
5328 </li>
5329 }
5330
5331 @helper RenderMobileNavigationOrdersAction()
5332 {
5333 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
5334 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
5335 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
5336 string myOrdersPageLink = linkStart + myOrdersPageId;
5337 string ordersIcon = "fas fa-list";
5338
5339 <li class="menu-mobile__item">
5340 <a href="@myOrdersPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@ordersIcon menu-mobile__link-icon"></i> @Translate("My Orders")</a>
5341 </li>
5342 }
5343
5344 @helper RenderMobileNavigationFavoritesAction()
5345 {
5346 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
5347 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
5348 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
5349 string myFavoritesPageLink = linkStart + myFavoritesPageId;
5350 string favoritesIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "fa fa-star";
5351
5352
5353 <li class="menu-mobile__item">
5354 <a href="@myFavoritesPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@favoritesIcon menu-mobile__link-icon"></i> @Translate("My Favorites")</a>
5355 </li>
5356 }
5357
5358 @helper RenderMobileNavigationSavedCardsAction()
5359 {
5360 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
5361 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID=";
5362 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");
5363 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;
5364 string savedCardsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards").SelectedValue : "fas fa-credit-card";
5365
5366 <li class="menu-mobile__item">
5367 <a href="@mySavedCardsPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@savedCardsIcon menu-mobile__link-icon"></i> @Translate("My Saved Cards")</a>
5368 </li>
5369 }
5370
5371 @helper RenderMobileNavigationSignOutAction()
5372 {
5373 int pageId = Model.TopPage.ID;
5374 string signOutIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon").SelectedValue : "far fa-sign-out-alt";
5375
5376 <li class="menu-mobile__item">
5377 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId" onclick="RememberState.SetCookie('useAnotherAddress', false)"><i class="@signOutIcon menu-mobile__link-icon"></i> @Translate("Sign out")</a>
5378 </li>
5379 }
5380
5381 @helper RenderMobileNavigationLanguagesAction()
5382 {
5383 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides";
5384
5385 string selectedLanguage = "";
5386 foreach (var lang in Model.Languages)
5387 {
5388 if (lang.IsCurrent)
5389 {
5390 selectedLanguage = lang.Name;
5391 }
5392 }
5393
5394 <li class="menu-mobile__item dw-mod">
5395 @if (isSlidesDesign)
5396 {
5397 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);">
5398 }
5399 else
5400 {
5401 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger">
5402 }
5403 <div class="menu-mobile__link__wrap">
5404 <label for="MobileMenuCheck_Language" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue menu-mobile__link-icon"></i> @selectedLanguage</label>
5405 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label>
5406 </div>
5407 <ul class="menu-mobile menu-mobile__submenu expand-menu">
5408 @if (isSlidesDesign)
5409 {
5410 <li class="menu-mobile__item dw-mod">
5411 <div class="menu-mobile__link__wrap">
5412 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" />
5413 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label>
5414 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label>
5415 </div>
5416 </li>
5417 }
5418 @foreach (var lang in Model.Languages)
5419 {
5420 <li class="menu-mobile__item dw-mod">
5421 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod menu-mobile__link--level-1" href="/Default.aspx?ID=@lang.Page.ID">@lang.Name</a>
5422 </li>
5423 }
5424 </ul>
5425 </li>
5426 }</text>
5427 }
5428 else
5429 {
5430 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5431
5432 @using System
5433 @using System.Web
5434 @using System.Collections.Generic
5435 @using Dynamicweb.Rapido.Blocks.Extensibility
5436 @using Dynamicweb.Rapido.Blocks
5437
5438 @functions {
5439 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master");
5440 }
5441
5442 @{
5443 Block masterTools = new Block()
5444 {
5445 Id = "MasterDesktopTools",
5446 SortId = 10,
5447 Template = RenderDesktopTools(),
5448 SkipRenderBlocksList = true,
5449 BlocksList = new List<Block>
5450 {
5451 new Block {
5452 Id = "MasterDesktopToolsText",
5453 SortId = 10,
5454 Template = RenderDesktopToolsText(),
5455 Design = new Design
5456 {
5457 Size = "auto",
5458 HidePadding = true,
5459 RenderType = RenderType.Column
5460 }
5461 },
5462 new Block {
5463 Id = "MasterDesktopToolsNavigation",
5464 SortId = 20,
5465 Template = RenderDesktopToolsNavigation(),
5466 Design = new Design
5467 {
5468 Size = "auto-width",
5469 HidePadding = true,
5470 RenderType = RenderType.Column
5471 }
5472 }
5473 }
5474 };
5475 headerBlocksPage.Add("MasterHeader", masterTools);
5476
5477 Block masterDesktopExtra = new Block()
5478 {
5479 Id = "MasterDesktopExtra",
5480 SortId = 10,
5481 Template = RenderDesktopExtra(),
5482 SkipRenderBlocksList = true
5483 };
5484 headerBlocksPage.Add("MasterHeader", masterDesktopExtra);
5485
5486 Block masterDesktopNavigation = new Block()
5487 {
5488 Id = "MasterDesktopNavigation",
5489 SortId = 20,
5490 Template = RenderDesktopNavigation(),
5491 SkipRenderBlocksList = true
5492 };
5493 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation);
5494 }
5495
5496 @* Include the Blocks for the page *@
5497 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5498
5499 @using System
5500 @using System.Web
5501 @using Dynamicweb.Rapido.Blocks.Extensibility
5502 @using Dynamicweb.Rapido.Blocks
5503
5504 @{
5505 Block masterDesktopLogo = new Block
5506 {
5507 Id = "MasterDesktopLogo",
5508 SortId = 10,
5509 Template = RenderDesktopLogo(),
5510 Design = new Design
5511 {
5512 Size = "auto-width",
5513 HidePadding = true,
5514 RenderType = RenderType.Column,
5515 CssClass = "grid--align-self-center"
5516 }
5517 };
5518
5519 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo);
5520 }
5521
5522
5523 @helper RenderDesktopLogo()
5524 {
5525 string firstPageId = Model.Area.FirstActivePage.ID.ToString();
5526 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5527 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : "";
5528 alignClass = topLayout == "splitted-center" ? "u-middle" : alignClass;
5529 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png";
5530 if (Path.GetExtension(logo).ToLower() != ".svg")
5531 {
5532 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight");
5533 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40;
5534 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&crop=5&Compression=75&image=" + logo;
5535 }
5536 else
5537 {
5538 logo = HttpUtility.UrlDecode(logo);
5539 }
5540
5541 <div class="logo @alignClass dw-mod">
5542 <a href="/" class="logo__img dw-mod u-block">
5543 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" />
5544 </a>
5545 </div>
5546 }
5547 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5548
5549 @using System
5550 @using System.Web
5551 @using Dynamicweb.Rapido.Blocks.Extensibility
5552 @using Dynamicweb.Rapido.Blocks
5553
5554 @functions {
5555 bool isMegaMenu;
5556 }
5557
5558 @{
5559 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false;
5560 Block masterDesktopMenu = new Block
5561 {
5562 Id = "MasterDesktopMenu",
5563 SortId = 10,
5564 Template = RenderDesktopMenu(),
5565 Design = new Design
5566 {
5567 Size = "auto",
5568 HidePadding = true,
5569 RenderType = RenderType.Column
5570 }
5571 };
5572
5573 if (isMegaMenu)
5574 {
5575 masterDesktopMenu.Design.CssClass = "u-reset-position";
5576 }
5577
5578 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu);
5579 }
5580
5581 @helper RenderDesktopMenu()
5582 {
5583 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5584 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : "";
5585 menuAlignment = topLayout == "minimal-center" ? "grid--align-self-center" : topLayout;
5586 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : "";
5587 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
5588 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders");
5589 int startLevel = renderPagesInToolBar ? 1 : 0;
5590 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink");
5591 string isHomepage = Model.Area.FirstPage.ID == Model.ID ? "true" : "false";
5592 int productPage = GetPageIdByNavigationTag("ProductsPage");
5593 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment">
5594 @if (!isMegaMenu)
5595 {
5596 @RenderNavigation(new
5597 {
5598 id = "topnavigation",
5599 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",
5600 startLevel = startLevel,
5601 ecomStartLevel = startLevel + 1,
5602 endlevel = 4,
5603 expandmode = "all",
5604 template = "BaseMenuWithDropdown.xslt",
5605 isHomepage = isHomepage,
5606 productsPage = productPage
5607 });
5608 }
5609 else
5610 {
5611 @RenderNavigation(new
5612 {
5613 id = "topnavigation",
5614 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap",
5615 startLevel = startLevel,
5616 ecomStartLevel = startLevel + 1,
5617 endlevel = 5,
5618 promotionImage = megamenuPromotionImage,
5619 promotionLink = promotionLink,
5620 expandmode = "all",
5621 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(),
5622 template = "BaseMegaMenu.xslt",
5623 isHomepage = isHomepage,
5624 productsPage = productPage
5625 });
5626 }
5627 </div>
5628 }
5629 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5630
5631 @using System
5632 @using System.Web
5633 @using Dynamicweb.Rapido.Blocks.Extensibility
5634 @using Dynamicweb.Rapido.Blocks
5635
5636 @{
5637 Block masterDesktopActionsMenu = new Block
5638 {
5639 Id = "MasterDesktopActionsMenu",
5640 SortId = 10,
5641 Template = RenderDesktopActionsMenu(),
5642 Design = new Design
5643 {
5644 CssClass = "u-flex"
5645 },
5646 SkipRenderBlocksList = true
5647
5648 };
5649 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu);
5650
5651 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink")))
5652 {
5653 Block masterDesktopActionsHeaderButton = new Block
5654 {
5655 Id = "MasterDesktopActionsHeaderButton",
5656 SortId = 10,
5657 Template = RenderHeaderButton()
5658 };
5659 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton);
5660 }
5661 }
5662
5663 @helper RenderDesktopActionsMenu()
5664 {
5665 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList();
5666
5667 <ul class="menu u-flex dw-mod">
5668 @RenderBlockList(subBlocks)
5669 </ul>
5670 }
5671
5672
5673 @helper RenderHeaderButton()
5674 {
5675 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText");
5676 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink");
5677 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : "";
5678
5679 <li class="menu__item menu__item--horizontal menu--clean dw-mod">
5680 <a class="dw-mod u-no-margin u-padding-right" href="tel:0219145" style="color:#fff; line-height: 1; font-size:18px;">
5681 <span class="header__buton-icon">
5682 <i class="fas fa-phone" style="font-size:24px;"></i></span>(021) 9145
5683 </a>
5684 </li>
5685 }
5686 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5687
5688 @using System
5689 @using System.Web
5690 @using Dynamicweb.Core;
5691 @using System.Text.RegularExpressions
5692 @using Dynamicweb.Rapido.Blocks.Extensibility
5693 @using Dynamicweb.Rapido.Blocks
5694
5695 @{
5696 Block masterDesktopActionsMenuLanguageSelector = new Block
5697 {
5698 Id = "MasterDesktopActionsMenuLanguageSelector",
5699 SortId = 40,
5700 Template = RenderLanguageSelector()
5701 };
5702
5703 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector);
5704 }
5705
5706 @helper RenderLanguageSelector()
5707 {
5708 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5709 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
5710 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5711 string languageViewType = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue) ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue.ToLower() : "";
5712
5713 if (Model.Languages.Count > 1)
5714 {
5715 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod">
5716 <div class="@menuLinkClass dw-mod" title="@Translate("Language")">
5717 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i>
5718 </div>
5719 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell">
5720 @foreach (var lang in Model.Languages)
5721 {
5722 string widthClass = "menu__item--fixed-width";
5723 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name;
5724 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty);
5725 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1);
5726
5727 if (languageViewType == "flag-culture")
5728 {
5729 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName;
5730 }
5731
5732 if (languageViewType == "flag")
5733 {
5734 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>";
5735 widthClass = "";
5736 }
5737
5738 if (languageViewType == "name")
5739 {
5740 langInfo = lang.Name;
5741 }
5742
5743 if (languageViewType == "culture")
5744 {
5745 langInfo = cultureName;
5746 widthClass = "";
5747 }
5748
5749 <div class="menu__item dw-mod @widthClass">
5750 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a>
5751 </div>
5752 }
5753 </div>
5754 </li>
5755 }
5756 }
5757 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5758
5759 @using System
5760 @using System.Web
5761 @using Dynamicweb.Rapido.Blocks.Extensibility
5762 @using Dynamicweb.Rapido.Blocks
5763
5764 @{
5765 Block masterDesktopActionsMenuSignIn = new Block
5766 {
5767 Id = "MasterDesktopActionsMenuSignIn",
5768 SortId = 20,
5769 Template = RenderSignIn()
5770 };
5771
5772 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn);
5773 }
5774
5775 @helper RenderSignIn()
5776 {
5777 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn");
5778 string userInitials = "";
5779 int pageId = Model.TopPage.ID;
5780 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
5781 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard");
5782 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile");
5783 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders");
5784 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
5785 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards");
5786 int myOrderDraftsPageId = GetPageIdByNavigationTag("OrderDraft");
5787 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
5788 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount");
5789 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile");
5790 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders");
5791 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards");
5792 bool hideMyOrderDraftsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrderDrafts");
5793 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites");
5794 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink");
5795
5796 string linkStart = "/Default.aspx?ID=";
5797 if (Model.CurrentUser.ID <= 0)
5798 {
5799 linkStart += signInProfilePageId + "&RedirectPageId=";
5800 }
5801
5802 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
5803 string myProfilePageLink = linkStart + myProfilePageId;
5804 string myOrdersPageLink = linkStart + myOrdersPageId;
5805 string myFavoritesPageLink = linkStart + myFavoritesPageId;
5806 string mySavedCardsPageLink = linkStart + mySavedCardsPageId;
5807 string myOrderDraftsLink = linkStart + myOrderDraftsPageId;
5808
5809 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user";
5810 string favoritesIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "fa fa-star";
5811 string orderDraftsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard";
5812
5813 if (Model.CurrentUser.ID != 0)
5814 {
5815 userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName);
5816 }
5817
5818 if (!navigationItemsHideSignIn)
5819 {
5820 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5821 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean";
5822 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5823
5824 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod sign_in_element">
5825 <div class="@menuLinkClass dw-mod">
5826 @if (Model.CurrentUser.ID <= 0)
5827 {
5828 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i>
5829 }
5830 else
5831 {
5832 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a>
5833 }
5834 </div>
5835 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod">
5836 <ul class="list list--clean dw-mod">
5837 @if (Model.CurrentUser.ID <= 0)
5838 {
5839 <li>
5840 <label for="SignInModalTrigger" class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)">@Translate("Sign in")</label>
5841 </li>
5842
5843 if (!hideCreateAccountLink)
5844 {
5845 @RenderListItem("/Default.aspx?ID=" + createAccountPageId, Translate("Create account"));
5846 }
5847 if (!hideForgotPasswordLink)
5848 {
5849 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?"))
5850 }
5851 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
5852 {
5853 @RenderSeparator()
5854 }
5855 }
5856 @if (!hideMyProfileLink)
5857 {
5858 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon)
5859 }
5860 @if (!hideMyOrdersLink)
5861 {
5862 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list")
5863 }
5864 @if (!hideMyFavoritesLink)
5865 {
5866 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon)
5867 }
5868 @if (!hideMySavedCardsLink)
5869 {
5870 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card")
5871 }
5872 @if (!hideMyOrderDraftsLink)
5873 {
5874 @RenderListItem(myOrderDraftsLink, Translate("My Order drafts"), orderDraftsIcon)
5875 }
5876 @if (Model.CurrentUser.ID > 0)
5877 {
5878 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink)
5879 {
5880 @RenderSeparator()
5881 }
5882
5883 //Check if impersonation is on
5884 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0)
5885 {
5886 <li>
5887 <div class="list__link dw-mod" onclick="document.getElementById('StopImpersonationModalTrigger').checked = true;">
5888 @Translate("Sign out")
5889 </div>
5890 </li>
5891 } else {
5892 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out"))
5893 }
5894 }
5895 </ul>
5896 </div>
5897 </li>
5898 }
5899 }
5900
5901 @helper RenderListItem(string link, string text, string icon = null) {
5902 <li>
5903 <a href="@link" class="list__link dw-mod" onclick="RememberState.SetCookie('useAnotherAddress', false)">
5904 @if (!string.IsNullOrEmpty(icon)){<i class="@icon u-margin-right"></i>}@text
5905 </a>
5906 </li>
5907 }
5908
5909 @helper RenderSeparator()
5910 {
5911 <li class="list__seperator dw-mod"></li>
5912 }
5913 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5914
5915 @using System
5916 @using System.Web
5917 @using Dynamicweb.Rapido.Blocks.Extensibility
5918 @using Dynamicweb.Rapido.Blocks
5919
5920 @{
5921 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites");
5922
5923 Block masterDesktopActionsMenuFavorites = new Block
5924 {
5925 Id = "MasterDesktopActionsMenuFavorites",
5926 SortId = 30,
5927 Template = RenderFavorites()
5928 };
5929
5930 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0)
5931 {
5932 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites);
5933 }
5934 }
5935
5936 @helper RenderFavorites()
5937 {
5938 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites");
5939 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId;
5940
5941 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
5942 string liClasses = topLayout != "normal" && topLayout != "splitted-center" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
5943 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
5944
5945 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
5946 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")">
5947 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i>
5948 </a>
5949 </li>
5950 }
5951 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
5952
5953 @using System
5954 @using System.Web
5955 @using Dynamicweb.Rapido.Blocks.Extensibility
5956 @using Dynamicweb.Rapido.Blocks
5957 @using Dynamicweb.Rapido.Services
5958 @using Dynamicweb.Ecommerce
5959 @using Dynamicweb.Ecommerce.Orders
5960 @using Df.Dw
5961
5962 @{
5963 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");
5964 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";
5965
5966 var totalNumberOfProductsForDefault = 0;
5967 using (var contexter = new OrderContexter(Dynamicweb.Ecommerce.Orders.OrderContext.GetOrderContextById("ORDERCONTEXT7")))
5968 {
5969 var cartContext = Dynamicweb.Ecommerce.Common.Context.Cart;
5970 totalNumberOfProductsForDefault = cartContext != null ? Converter.ToInt32(cartContext.ProductOrderLines.Sum(ol => ol.Quantity)) : 0;
5971 }
5972
5973 var totalNumberOfProductsForIngrasaminte = 0;
5974 using (var contexter = new OrderContexter(Dynamicweb.Ecommerce.Orders.OrderContext.GetOrderContextById("ORDERCONTEXT5")))
5975 {
5976 var cartContext = Dynamicweb.Ecommerce.Common.Context.Cart;
5977 totalNumberOfProductsForIngrasaminte = cartContext != null ? Converter.ToInt32(cartContext.ProductOrderLines.Sum(ol => ol.Quantity)) : 0;
5978 }
5979
5980 var totalNumberOfProductsForAllCarts = totalNumberOfProductsForDefault + totalNumberOfProductsForIngrasaminte;
5981
5982 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart)
5983 {
5984 Block masterDesktopActionsMenuMiniCart = new Block
5985 {
5986 Id = "MasterDesktopActionsMenuMiniCart",
5987 SortId = 60,
5988 Template = RenderMiniCart(miniCartLayout == "dropdown"),
5989 SkipRenderBlocksList = true,
5990 BlocksList = new List<Block>()
5991 };
5992
5993 Block miniCartCounterScriptTemplate = new Block
5994 {
5995 Id = "MiniCartCounterScriptTemplate",
5996 Template = RenderMiniCartCounterContent()
5997 };
5998
5999 //dropdown layout is default
6000 RazorEngine.Templating.TemplateWriter layoutTemplate;
6001 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate;
6002
6003 switch (miniCartLayout)
6004 {
6005 case "dropdown":
6006 layoutTemplate = RenderMiniCartDropdownLayout();
6007 miniCartTriggerTemplate = RenderMiniCartTriggerLink(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte);
6008 break;
6009 case "panel":
6010 layoutTemplate = RenderMiniCartPanelLayout();
6011 //miniCartTriggerTemplate = RenderMiniCartTriggerLabel();
6012 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte);
6013 break;
6014 case "modal":
6015 layoutTemplate = RenderMiniCartModalLayout();
6016 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte);
6017 break;
6018 case "none":
6019 default:
6020 layoutTemplate = RenderMiniCartDropdownLayout();
6021 miniCartTriggerTemplate = RenderMiniCartTriggerLink(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte);
6022 break;
6023 }
6024
6025 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block
6026 {
6027 Id = "MiniCartTrigger",
6028 Template = miniCartTriggerTemplate
6029 });
6030
6031 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
6032 {
6033 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block
6034 {
6035 Id = "MiniCartLayout",
6036 Template = layoutTemplate
6037 });
6038 }
6039
6040 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart);
6041 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate);
6042 }
6043
6044 if (hideCart && Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
6045 {
6046 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block {
6047 Id = "CartInitialization"
6048 });
6049 }
6050 }
6051
6052 @helper RenderMiniCart(bool hasMouseEnterEvent)
6053 {
6054 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList();
6055 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
6056 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean";
6057 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
6058 string mouseEvent = "";
6059 string id = "MiniCart";
6060 if (hasMouseEnterEvent)
6061 {
6062 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\"";
6063 id = "miniCartTrigger";
6064 }
6065 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent>
6066 @RenderBlockList(subBlocks)
6067 </li>
6068 }
6069
6070 @helper RenderMiniCartTriggerLabel(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0)
6071 {
6072 int cartPageId = GetPageIdByNavigationTag("CartPage");
6073 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";
6074 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
6075 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
6076 int miniCartFeedDefaultPageId = GetPageIdByNavigationTag("MiniCartFeed");
6077 int miniCartFeedIngrasamintePageId = GetPageIdByNavigationTag("MiniCartFeedIngrasaminte");
6078 int miniCartFeedSelectedPageId = totalNumberOfProductsForDefault > 0 || totalNumberOfProductsForIngrasaminte == 0 ? miniCartFeedDefaultPageId : miniCartFeedIngrasamintePageId;
6079
6080 <div id="minicart_icon" data-miniCartFeedId="@miniCartFeedDefaultPageId" data-miniCartFeed-IngrasaminteId="@miniCartFeedIngrasamintePageId" data-miniCart-ContextId="@miniCartFeedSelectedPageId" class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedSelectedPageId&feedType=MiniCart')" title="@Translate("Cart")">
6081 <div class="u-inline u-position-relative">
6082 <i class="@cartIcon fa-1_5x"></i>
6083 @RenderMiniCartCounter(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte)
6084 </div>
6085 </div>
6086 }
6087
6088 @helper RenderMiniCartTriggerLink(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0)
6089 {
6090 int cartPageId = GetPageIdByNavigationTag("CartPage");
6091 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart";
6092 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
6093 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
6094
6095 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button" title="@Translate("Cart")">
6096 <span class="u-inline u-position-relative">
6097 <i class="@cartIcon fa-1_5x"></i>
6098 @RenderMiniCartCounter(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte)
6099 </span>
6100 </a>
6101 }
6102
6103 @helper RenderMiniCartCounter(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0)
6104 {
6105 int miniCartFeedDefaultPageId = GetPageIdByNavigationTag("MiniCartFeed");
6106 int miniCartFeedIngrasamintePageId = GetPageIdByNavigationTag("MiniCartFeedIngrasaminte");
6107 int miniCartFeedSelectedPageId = totalNumberOfProductsForDefault > 0 || totalNumberOfProductsForIngrasaminte == 0 ? miniCartFeedDefaultPageId : miniCartFeedIngrasamintePageId;
6108
6109 string cartProductsCount = (totalNumberOfProductsForDefault + totalNumberOfProductsForIngrasaminte).ToString();
6110 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
6111 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");
6112 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : "";
6113 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : "";
6114
6115 if (showPrice && counterPosition == "right")
6116 {
6117 cartProductsCount = Translate("Cart") + " (" + cartProductsCount + ")";
6118 }
6119 <span class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod">
6120 <span class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedSelectedPageId&feedType=Counter" data-init-onload="false" data-preloader="false">
6121 <span class="js-mini-cart-counter-content" data-count="@cartProductsCount">
6122 @cartProductsCount @cartProductsTotalPrice
6123 </span>
6124 </span>
6125 </span>
6126 }
6127
6128 @helper RenderMiniCartCounterContent()
6129 {
6130 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice");
6131 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
6132 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice;
6133
6134 <script id="MiniCartCounterContent" type="text/x-template">
6135 {{#.}}
6136 <span class="js-mini-cart-counter-content dw-mod" data-count="{{totalnumberofproductsforallcarts}}">
6137 @if (showPriceInMiniCartCounter)
6138 {
6139 @Translate("Cart")<text>({{totalnumberofproductsforallcarts}}) {{totalprice}}</text>
6140 }
6141 else
6142 {
6143 <text>{{totalnumberofproductsforallcarts}}</text>
6144 }
6145 </span>
6146 {{/.}}
6147 </script>
6148 }
6149
6150
6151
6152 @helper RenderMiniCartDropdownLayout()
6153 {
6154 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
6155 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
6156
6157 <div class="mini-cart mini-cart-dropdown js-mini-cart grid__cell dw-mod" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="dropdown" data-cart-page-link="@cartPageLink">
6158 <div class="mini-cart-dropdown__inner dw-mod">
6159 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3>
6160 <div class="mini-cart-dropdown__body u-flex dw-mod">
6161 <div class="js-handlebars-root u-flex grid--direction-column u-full-width dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div>
6162 </div>
6163 </div>
6164 </div>
6165 }
6166
6167 @helper RenderMiniCartPanelLayout()
6168 {
6169 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
6170 int minicartIngrasaminteFeedPageId = GetPageIdByNavigationTag("MiniCartFeedIngrasaminte");
6171 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
6172 string cartIngrasamintePageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPageIngrasaminte");
6173
6174
6175 <div class="mini-cart grid__cell dw-mod">
6176 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" />
6177 <div class="panel panel--right panel--with-close-btn dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink">
6178 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label>
6179 <div class="panel__content u-full-width dw-mod">
6180 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3>
6181 <div class="panel__content-body panel__content-body--cart dw-mod">
6182 <div class="select__carts-wrapper">
6183 <select id="CartSelect" data-json-feed="/Default.aspx?feedType=MiniCart&ID=">
6184 <option value="@minicartIngrasaminteFeedPageId">Cosul Ingrasaminte</option>
6185 <option value="@miniCartFeedPageId">Cosul cu restul produselor</option>
6186 </select>
6187 </div>
6188 <div class="js-handlebars-root u-flex grid--direction-column u-full-height dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div>
6189 </div>
6190 </div>
6191 </div>
6192 </div>
6193 }
6194
6195 @helper RenderMiniCartModalLayout()
6196 {
6197 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
6198 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage");
6199
6200 <div class="mini-cart grid__cell dw-mod">
6201 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" />
6202 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink">
6203 <label for="miniCartTrigger" class="modal-overlay"></label>
6204 <div class="modal modal--md modal--top-right dw-mod">
6205 <div class="modal__body u-flex grid--direction-column dw-mod">
6206 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3>
6207 <div class="js-handlebars-root u-flex grid--direction-column dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div>
6208 </div>
6209 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label>
6210 </div>
6211 </div>
6212 </div>
6213 }
6214
6215 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6216
6217 @using System
6218 @using System.Web
6219 @using Dynamicweb.Rapido.Blocks.Extensibility
6220 @using Dynamicweb.Rapido.Blocks
6221
6222 @{
6223 bool showOrderDraftLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOrderDraftIcon");
6224
6225 Block masterDesktopActionsMenuOrderDraft = new Block
6226 {
6227 Id = "MasterDesktopActionsMenuOrderDraft",
6228 SortId = 40,
6229 Template = RenderOrderDraft()
6230 };
6231
6232 if (showOrderDraftLink && Model.CurrentUser.ID > 0)
6233 {
6234 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuOrderDraft);
6235 }
6236 }
6237
6238 @helper RenderOrderDraft()
6239 {
6240 int OrderDraftPageId = GetPageIdByNavigationTag("OrderDraft");
6241 string OrderDraftPageLink = "/Default.aspx?ID=" + OrderDraftPageId;
6242 string draftIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard";
6243
6244
6245 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
6246 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
6247 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
6248
6249 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
6250 <a href="@OrderDraftPageLink" class="@menuLinkClass dw-mod" title="@Translate("My order drafts")">
6251 <span class="u-inline u-position-relative">
6252 <i class="@draftIcon fa-1_5x"></i>
6253 </span>
6254 </a>
6255 </li>
6256 }
6257 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6258
6259 @using System
6260 @using System.Web
6261 @using Dynamicweb.Rapido.Blocks.Extensibility
6262 @using Dynamicweb.Rapido.Blocks
6263
6264 @{
6265 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart");
6266
6267 Block masterDesktopActionsMenuDownloadCart = new Block
6268 {
6269 Id = "MasterDesktopActionsMenuDownloadCart",
6270 SortId = 50,
6271 Template = RenderDownloadCart()
6272 };
6273
6274 if (showDownloadCartLink && Model.CurrentUser.ID > 0)
6275 {
6276 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart);
6277 }
6278 }
6279
6280 @helper RenderDownloadCart()
6281 {
6282 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart");
6283 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId;
6284
6285 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
6286 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean";
6287 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
6288 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right";
6289
6290 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod">
6291 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")">
6292 <span class="u-inline u-position-relative">
6293 <i class="fas fa-cart-arrow-down fa-1_5x"></i>
6294 <span class="mini-cart__counter u-hidden @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod js-download-cart-counter"></span>
6295 </span>
6296 </a>
6297 </li>
6298 }
6299 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6300
6301 @using System
6302 @using System.Web
6303 @using Dynamicweb.Rapido.Blocks.Extensibility
6304 @using Dynamicweb.Rapido.Blocks
6305
6306 @functions {
6307 public class SearchConfiguration
6308 {
6309 public string searchFeedId { get; set; }
6310 public string searchSecondFeedId { get; set; }
6311 public int groupsFeedId { get; set; }
6312 public string resultPageLink { get; set; }
6313 public string searchPlaceholder { get; set; }
6314 public string searchType { get; set; }
6315 public string searchTemplate { get; set; }
6316 public string searchContentTemplate { get; set; }
6317 public string searchValue { get; set; }
6318 public bool showGroups { get; set; }
6319
6320 public SearchConfiguration()
6321 {
6322 searchFeedId = "";
6323 searchSecondFeedId = "";
6324 searchType = "product-search";
6325 searchContentTemplate = "";
6326 showGroups = true;
6327 }
6328 }
6329 }
6330 @{
6331 Block masterSearchBar = new Block
6332 {
6333 Id = "MasterSearchBar",
6334 SortId = 40,
6335 Template = RenderSearch("bar"),
6336 Design = new Design
6337 {
6338 Size = "auto",
6339 HidePadding = true,
6340 RenderType = RenderType.Column
6341 }
6342 };
6343
6344 Block masterSearchAction = new Block
6345 {
6346 Id = "MasterDesktopActionsMenuSearch",
6347 SortId = 10,
6348 Template = RenderSearch()
6349 };
6350
6351 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar);
6352 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction);
6353 }
6354
6355 @helper RenderSearch(string type = "mini-search")
6356 {
6357 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage"));
6358 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
6359 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch";
6360
6361 SearchConfiguration searchConfiguration = null;
6362
6363 switch (searchType) {
6364 case "contentSearch":
6365 searchConfiguration = new SearchConfiguration() {
6366 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
6367 resultPageLink = contentSearchPageLink,
6368 searchPlaceholder = Translate("Search page"),
6369 groupsFeedId = 0,
6370 searchType = "content-search",
6371 searchTemplate = "SearchPagesTemplate",
6372 showGroups = false
6373 };
6374 break;
6375 case "combinedSearch":
6376 searchConfiguration = new SearchConfiguration() {
6377 searchFeedId = productsPageId + "&feed=true",
6378 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true",
6379 resultPageLink = Converter.ToString(productsPageId),
6380 searchPlaceholder = Translate("Search products or pages"),
6381 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
6382 searchType = "combined-search",
6383 searchTemplate = "SearchProductsTemplateWrap",
6384 searchContentTemplate = "SearchPagesTemplateWrap",
6385 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
6386 };
6387 break;
6388 default: //productSearch
6389 searchConfiguration = new SearchConfiguration() {
6390 resultPageLink = Converter.ToString(productsPageId),
6391 searchFeedId = productsPageId + "&feed=true",
6392 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"),
6393 searchPlaceholder = Translate("Search products"),
6394 searchTemplate = "SearchProductsTemplate",
6395 searchType = "product-search",
6396 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector")
6397 };
6398 break;
6399 }
6400 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";
6401
6402 if (type == "mini-search") {
6403 @RenderMiniSearch(searchConfiguration)
6404 } else {
6405 @RenderSearchBar(searchConfiguration)
6406 }
6407 }
6408
6409 @helper RenderSearchBar(SearchConfiguration options)
6410 {
6411 var paragraphId = Model.ID;
6412 string searchTerm = string.Empty;
6413 var productPage = GetPageIdByNavigationTag("ProductsPage");
6414 var searchResultsPage = GetPageIdByNavigationTag("ProductContentSearchResults");
6415
6416
6417 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request["q"]))
6418 {
6419 searchTerm = Dynamicweb.Context.Current.Request["q"];
6420
6421 }
6422
6423
6424 @*<div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar"
6425 data-page-size="7"
6426 data-search-feed-id="@options.searchFeedId"
6427 data-search-second-feed-id="@options.searchSecondFeedId"
6428 data-result-page-id="@options.resultPageLink"
6429 data-groups-page-id="@options.groupsFeedId"
6430 data-search-type="@options.searchType">
6431 @if (options.showGroups)
6432 {
6433 <button type="button" class="btn btn--condensed u-color-light-gray--bg typeahead-group-btn dw-mod js-typeahead-groups-btn" data-group-id="all">@Translate("All")</button>
6434 <ul class="dropdown dropdown--absolute-position u-min-w220px js-handlebars-root js-typeahead-groups-content dw-mod" id="ProductSearchBarGroupsContent" data-template="SearchGroupsTemplate" data-json-feed="/Default.aspx?ID=@options.groupsFeedId&feedType=productGroups" data-init-onload="false" data-preloader="minimal"></ul>
6435 }
6436 <div class="typeahead-search-field">
6437 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue">
6438 @if (string.IsNullOrEmpty(options.searchSecondFeedId))
6439 {
6440 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul>
6441 }
6442 else
6443 {
6444 <div class="dropdown dropdown--absolute-position dropdown--combined grid">
6445 <div class="js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-init-onload="false"></div>
6446 <div class="js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-init-onload="false"></div>
6447 </div>
6448 }
6449 </div>
6450 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn btn--no-radius" title="@Translate("Search")"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button>
6451 </div>*@
6452
6453 <div class="js-async-fetch-placeholder">
6454 <div class="dropdown js-type-ahead-dropdown type-ahead-dropdown u-relative" style="width: 500px;">
6455 <form method="get"
6456 action="@productPage"
6457 data-search-results-page="@searchResultsPage"
6458 data-product-details-page="/Default.aspx?ID=@productPage"
6459 data-product-list-page="/Default.aspx?ID=@productPage"
6460 data-search-layout="field"
6461 class="js-suggest-form suggest-form">
6462
6463 <input type="hidden" class="js-type-ahead-parameter" />
6464 <input type="hidden" name="ID" value="@productPage"/>
6465 <input type="hidden" name="redirect" value="false" />
6466 <input type="hidden" name="SearchLayout" value="field" />
6467
6468 @*<label for="searchField_@paragraphId" class="visually-hidden">@Translate("Search here")</label>*@
6469
6470 <span class="u-position-absolute top-0 icon-2 px-3 u-flex align-items-center h-100 search-icon">
6471 <i class="fas fa-search"></i>
6472 </span>
6473 <input id="searchField_@paragraphId"
6474 class="form-control js-type-ahead-field type-ahead-field py-2 ps-5 pe-3 m-0 u-full-width"
6475 type="search"
6476 placeholder="@Translate("Search here")"
6477 autocomplete="off"
6478 maxlength="255"
6479 name="q"
6480 value="@searchTerm"
6481 data-original="@searchTerm"
6482 onfocus="Typeahead.init()">
6483
6484 <button type="button"
6485 onclick="var f = document.getElementById('searchField_@paragraphId'); f.value = ''; f.focus();"
6486 class="btn h-100 icon-2 reset-search"
6487 aria-label="@Translate("Clear search")"
6488 style="opacity: 0; position: absolute; top: 0; right: 0; visibility: hidden;">
6489 @*@ReadFile(iconPath + "x.svg")*@
6490 <i class="fas fa-times"></i>
6491 </button>
6492
6493 <ul class="dropdown-menu w-100 js-type-ahead-menu type-ahead-menu p-3"></ul>
6494 <ul class="dropdown-menu w-100 p-3 searchterm__history"></ul>
6495 </form>
6496 </div>
6497 </div>
6498 }
6499
6500 @helper RenderMiniSearch(SearchConfiguration options)
6501 {
6502 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
6503 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon";
6504
6505 <li class="menu__item menu__item--horizontal menu__item--top-level menu__item--icon u-hidden-xxs is-dropdown is-dropdown--no-icon dw-mod" id="miniSearchIcon">
6506 <div class="@menuLinkClass dw-mod" title="@Translate("Search")">
6507 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i>
6508 </div>
6509 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod">
6510 <div class="typeahead js-typeahead" id="ProductSearchBar"
6511 data-page-size="7"
6512 data-search-feed-id="@options.searchFeedId"
6513 data-search-second-feed-id="@options.searchSecondFeedId"
6514 data-result-page-id="@options.resultPageLink"
6515 data-search-type="@options.searchType">
6516 <div class="typeahead-search-field">
6517 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue">
6518 @if (string.IsNullOrEmpty(options.searchSecondFeedId))
6519 {
6520 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul>
6521 }
6522 else
6523 {
6524 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned">
6525 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></div>
6526 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-json-feed="/Default.aspx?ID=@options.searchSecondFeedId" data-init-onload="false"></div>
6527 </div>
6528 }
6529 </div>
6530 </div>
6531 </div>
6532 </li>
6533 }
6534 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6535
6536 @using System
6537 @using System.Web
6538 @using Dynamicweb.Rapido.Blocks.Extensibility
6539 @using Dynamicweb.Rapido.Blocks
6540
6541 @{
6542 string headerConfigurationTopLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
6543 bool headerConfigurationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
6544
6545 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master");
6546
6547 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo");
6548 headerConfigurationPage.RemoveBlock(configDesktopLogo);
6549
6550 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu");
6551 headerConfigurationPage.RemoveBlock(configDesktopMenu);
6552
6553 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar");
6554 headerConfigurationPage.RemoveBlock(configSearchBar);
6555
6556 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch");
6557 headerConfigurationPage.RemoveBlock(configSearchAction);
6558
6559 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu");
6560 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu);
6561
6562 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra");
6563
6564 switch (headerConfigurationTopLayout)
6565 {
6566 case "condensed": //2
6567 configDesktopLogo.Design.Size = "auto-width";
6568 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
6569
6570 configDesktopMenu.SortId = 20;
6571 configDesktopMenu.Design.Size = "auto";
6572 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6573
6574 configDesktopActionsMenu.SortId = 30;
6575 configDesktopActionsMenu.Design.Size = "auto-width";
6576 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
6577
6578 if (!headerConfigurationHideSearch)
6579 {
6580 configSearchBar.SortId = 40;
6581 configSearchBar.Design.Size = "12";
6582 configDesktopExtra.SortId = 50;
6583 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
6584 }
6585 break;
6586 case "splitted": //3
6587 configDesktopLogo.Design.Size = "auto";
6588 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
6589
6590 if (!headerConfigurationHideSearch)
6591 {
6592 configSearchBar.SortId = 20;
6593 configSearchBar.Design.Size = "auto";
6594 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
6595 }
6596
6597 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6598
6599 configDesktopActionsMenu.SortId = 20;
6600 configDesktopActionsMenu.Design.Size = "auto-width";
6601 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
6602 break;
6603 case "splitted-center": //4
6604 configDesktopLogo.Design.Size = "auto";
6605 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
6606 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6607
6608 configDesktopActionsMenu.SortId = 30;
6609 configDesktopActionsMenu.Design.Size = "auto-width";
6610 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu);
6611
6612 if (!headerConfigurationHideSearch)
6613 {
6614 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
6615 }
6616 break;
6617 case "minimal": //5
6618 configDesktopLogo.Design.Size = "auto-width";
6619 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
6620
6621 configDesktopMenu.Design.Size = "auto";
6622 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6623
6624 configDesktopActionsMenu.SortId = 20;
6625 configDesktopActionsMenu.Design.Size = "auto-width";
6626 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
6627
6628 if (!headerConfigurationHideSearch)
6629 {
6630 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
6631 }
6632 break;
6633 case "minimal-center": //6
6634 configDesktopLogo.Design.Size = "auto-width";
6635 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
6636
6637 configDesktopMenu.Design.Size = "auto";
6638 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6639
6640 configDesktopActionsMenu.SortId = 20;
6641 configDesktopActionsMenu.Design.Size = "auto-width";
6642 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
6643
6644 if (!headerConfigurationHideSearch)
6645 {
6646 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
6647 }
6648 break;
6649 case "minimal-right": //7
6650 configDesktopLogo.Design.Size = "auto-width";
6651 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo);
6652
6653 configDesktopMenu.Design.Size = "auto";
6654 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6655
6656 configDesktopActionsMenu.SortId = 20;
6657 configDesktopActionsMenu.Design.Size = "auto-width";
6658 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
6659
6660 if (!headerConfigurationHideSearch)
6661 {
6662 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
6663 }
6664 break;
6665 case "two-lines": //8
6666 configDesktopLogo.Design.Size = "auto";
6667 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
6668
6669 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6670
6671 configDesktopActionsMenu.SortId = 20;
6672 configDesktopActionsMenu.Design.Size = "auto-width";
6673 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
6674
6675 if (!headerConfigurationHideSearch)
6676 {
6677 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
6678 }
6679 break;
6680 case "two-lines-centered": //9
6681 configDesktopLogo.Design.Size = "auto";
6682 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
6683
6684 configDesktopMenu.Design.Size = "auto-width";
6685 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6686
6687 configDesktopActionsMenu.SortId = 20;
6688 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu);
6689
6690 if (!headerConfigurationHideSearch)
6691 {
6692 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction);
6693 }
6694 break;
6695 case "normal": //1
6696 default:
6697 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo);
6698
6699 if (!headerConfigurationHideSearch)
6700 {
6701 configSearchBar.SortId = 20;
6702 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar);
6703 }
6704
6705 configDesktopActionsMenu.SortId = 30;
6706 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu);
6707
6708 configDesktopActionsMenu.Design.Size = "auto-width";
6709 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu);
6710 break;
6711 }
6712 }
6713 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6714
6715 @using System
6716 @using System.Web
6717 @using Dynamicweb.Rapido.Blocks.Extensibility
6718 @using Dynamicweb.Rapido.Blocks
6719
6720 @{
6721
6722 }
6723
6724
6725 @helper RenderDesktopTools()
6726 {
6727 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList();
6728
6729 <div class="tools-navigation dw-mod">
6730 <div class="center-container grid top-container__center-container dw-mod">
6731 @RenderBlockList(subBlocks)
6732 </div>
6733 </div>
6734 }
6735
6736 @helper RenderDesktopToolsText()
6737 {
6738 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText");
6739 if (!string.IsNullOrEmpty(toolsText))
6740 {
6741 <div class="u-margin-top u-margin-bottom">@toolsText</div>
6742 }
6743 }
6744
6745 @helper RenderDesktopToolsNavigation()
6746 {
6747 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar");
6748
6749 if (renderPagesInToolBar)
6750 {
6751 @RenderNavigation(new
6752 {
6753 id = "topToolsNavigation",
6754 cssclass = "menu menu-tools dw-mod dwnavigation",
6755 template = "TopMenu.xslt"
6756 })
6757 }
6758 }
6759
6760 @helper RenderDesktopNavigation()
6761 {
6762 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList();
6763 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal";
6764 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : "";
6765
6766 @RenderFreeShippingMessage()
6767
6768 <nav class="main-navigation dw-mod">
6769 <div class="center-container top-container__center-container grid @alignClass dw-mod">
6770 @RenderBlockList(subBlocks)
6771 </div>
6772 </nav>
6773 }
6774
6775 @helper RenderDesktopExtra()
6776 {
6777 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList();
6778
6779 if (subBlocks.Count > 0)
6780 {
6781 <div class="header header-top dw-mod">
6782 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod">
6783 <div class="menu-bars__wrapper">
6784 <i class="fas fa-bars"></i>
6785 </div>
6786 @RenderBlockList(subBlocks)
6787 </div>
6788 </div>
6789 }
6790 }
6791
6792 @helper RenderFreeShippingMessage()
6793 {
6794
6795 @* Free shipping message *@
6796 <div class="content-container grid__col-12 dw-mod freeshipping-msg">
6797 <div class="center-container top-container__center-container content-row content-row--full content-row--column-gap-none content-row--stretch content-row--height-auto dw-mod">
6798
6799 <div class="u-full-width u-align-center u-align-self-center dw-mod">
6800 <div class="u-full-height">
6801 <div class="content-row__item__body padding-size-xs padding-position-around dw-mod">
6802 <div class="freeshipping__banner">
6803 <img src="/Files/Templates/Designs/Rapido/Images/icon_transport_white_new.png" alt='@Translate("FreeShippingMessage1")' class="u-margin-right--lg" height="30px" />
6804 <div class="content__container-wrapper">
6805 <div class="freeshipping_text-wrapper">
6806 <p class="content__container__list__item">@Translate("FreeShippingMessage1")</p>
6807 <p class="content__container__list__item">@Translate("FreeShippingMessage2")</p>
6808 </div>
6809 </div>
6810 <img src="/Files/Templates/Designs/Rapido/Images/icon_transport_white_new.png" alt='@Translate("FreeShippingMessage1")' class="u-margin-left--lg" style="transform: scaleX(-1);" height="30px" />
6811 </div>
6812 </div>
6813 </div>
6814 </div>
6815
6816 </div>
6817 </div>
6818
6819 }</text>
6820 }
6821
6822 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
6823
6824 @using System
6825 @using System.Web
6826 @using Dynamicweb.Rapido.Blocks.Extensibility
6827 @using Dynamicweb.Rapido.Blocks
6828 @using Dynamicweb.Rapido.Blocks.Components.General
6829 @using Dynamicweb.Frontend
6830
6831 @functions {
6832 int impersonationPageId;
6833 string impersonationLayout;
6834 int impersonationFeed;
6835 Block impersonationBar;
6836
6837 string getUserNameFromParams(string firstName, string middleName, string lastName, string name, string email, string userName)
6838 {
6839 string username = "";
6840
6841 if (!string.IsNullOrEmpty(firstName) && !string.IsNullOrEmpty(lastName))
6842 {
6843 username = firstName + " " + (!string.IsNullOrEmpty(middleName) ? middleName + " " : "") + lastName;
6844 }
6845 else if (!string.IsNullOrEmpty(name))
6846 {
6847 username = name;
6848 }
6849 else if (!string.IsNullOrEmpty(email))
6850 {
6851 username = email;
6852 }
6853 else
6854 {
6855 username = userName;
6856 }
6857 return username;
6858 }
6859
6860 string getUserName(UserViewModel user)
6861 {
6862 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName);
6863 }
6864
6865 string getUserName(Dynamicweb.Security.UserManagement.User user)
6866 {
6867 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName);
6868 }
6869 }
6870
6871 @{
6872 impersonationPageId = GetPageIdByNavigationTag("Impersonation");
6873 impersonationLayout = Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout") != null ? Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout").SelectedValue : "bar";
6874 impersonationFeed = GetPageIdByNavigationTag("UsersFeed");
6875
6876 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0)
6877 {
6878 impersonationBar = new Block
6879 {
6880 Id = "ImpersonationBar",
6881 SortId = 50,
6882 Template = RenderImpersonation(),
6883 SkipRenderBlocksList = true,
6884 Design = new Design
6885 {
6886 Size = "auto-width",
6887 HidePadding = true,
6888 RenderType = RenderType.Column
6889 }
6890 };
6891
6892 if (impersonationLayout == "top-bar") {
6893 impersonationBar.SortId = 9;
6894 }
6895
6896 Block impersonationContent = new Block
6897 {
6898 Id = "ImpersonationContent",
6899 SortId = 20
6900 };
6901
6902 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0)
6903 {
6904 //Render stop impersonation view
6905 impersonationContent.Template = RenderStopImpersonationView();
6906
6907
6908 Modal stopImpersonation = new Modal
6909 {
6910 Id = "StopImpersonation",
6911 Heading = new Heading {
6912 Level = 2,
6913 Title = Translate("Sign out"),
6914 Icon = new Icon {
6915 Name = "fa-sign-out",
6916 Prefix = "fas",
6917 LabelPosition = IconLabelPosition.After
6918 }
6919 },
6920 Width = ModalWidth.Sm,
6921 BodyTemplate = RenderStopImpersonationForm()
6922 };
6923
6924 Block stopImpersonationBlock = new Block
6925 {
6926 Id = "StopImpersonationBlock",
6927 SortId = 10,
6928 Component = stopImpersonation
6929 };
6930 impersonationBar.BlocksList.Add(stopImpersonationBlock);
6931 }
6932 else
6933 {
6934 //Render main view
6935 switch (impersonationLayout)
6936 {
6937 case "right-lower-box":
6938 impersonationContent.BlocksList.Add(
6939 new Block {
6940 Id = "RightLowerBoxHeader",
6941 SortId = 10,
6942 Component = new Heading {
6943 Level = 5,
6944 Title = Translate("View the list of users you can sign in as"),
6945 CssClass = "impersonation-text"
6946 }
6947 }
6948 );
6949 impersonationContent.BlocksList.Add(
6950 new Block {
6951 Id = "RightLowerBoxContent",
6952 SortId = 20,
6953 Template = RenderImpersonationControls()
6954 }
6955 );
6956 break;
6957 case "right-lower-bar":
6958 impersonationContent.BlocksList.Add(
6959 new Block {
6960 Id = "RightLowerBarContent",
6961 SortId = 10,
6962 Template = RenderImpersonationControls()
6963 }
6964 );
6965 break;
6966 case "bar":
6967 default:
6968 impersonationContent.BlocksList.Add(
6969 new Block {
6970 Id = "ViewListLink",
6971 SortId = 20,
6972 Template = RenderViewListLink()
6973 }
6974 );
6975 impersonationContent.BlocksList.Add(
6976 new Block {
6977 Id = "BarTypeaheadSearch",
6978 SortId = 30,
6979 Template = RenderTypeaheadSearch()
6980 }
6981 );
6982 break;
6983 }
6984 }
6985 impersonationBar.BlocksList.Add(impersonationContent);
6986
6987 impersonationBar.BlocksList.Add(
6988 new Block
6989 {
6990 Id = "ImpersonationSearchTemplates",
6991 SortId = 30,
6992 Template = RenderSearchResultTemplate()
6993 }
6994 );
6995 if (impersonationLayout != "bar" && impersonationLayout != "top-bar")
6996 {
6997 impersonationBar.BlocksList.Add(
6998 new Block
6999 {
7000 Id = "ImpersonationSearchScripts",
7001 SortId = 40,
7002 Template = RenderSearchScripts()
7003 }
7004 );
7005 }
7006 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar);
7007 }
7008 }
7009
7010 @helper RenderImpersonation()
7011 {
7012 List<Block> subBlocks = impersonationBar.BlocksList.OrderBy(item => item.SortId).ToList();
7013 <input type="checkbox" class="impersonation-trigger js-remember-state" id="ImpersonationMinimizeTrigger" />
7014 <div class="impersonation impersonation--@(impersonationLayout)-layout dw-mod" id="Impersonation">
7015 @if (impersonationLayout == "right-lower-box")
7016 {
7017 @RenderRightLowerBoxHeader()
7018 }
7019 <div class="center-container top-container__center-container impersonation__container @(impersonationLayout != "bar" && impersonationLayout != "top-bar" ? "impersonation__container--box" : "") dw-mod">
7020 @*Impersonation*@
7021 @RenderBlockList(subBlocks)
7022 </div>
7023 </div>
7024 }
7025
7026 @helper RenderRightLowerBoxHeader()
7027 {
7028 <div class="impersonation__header dw-mod">
7029 <div class="impersonation__title">@Translate("Impersonation")</div>
7030 <label for="ImpersonationMinimizeTrigger" class="btn btn--impersonation impersonation__minimize-btn dw-mod" onclick="this.blur();">
7031 @Render(new Icon
7032 {
7033 Prefix = "fas",
7034 Name = "fa-window-minimize"
7035 })
7036 </label>
7037 </div>
7038 }
7039
7040 @helper RenderStopImpersonationView()
7041 {
7042 string secondaryUserName = getUserName(Model.CurrentSecondaryUser);
7043 string userName = getUserName(Pageview.User);
7044 string impersonationText = "<span class=\"impersonation-light-text dw-mod\">" + Translate("Logged in as") + "</span> <b>" + secondaryUserName + "</b> <span class=\"impersonation-light-text dw-mod\">" + Translate("by") + "</span> <b>" + userName + "</b> ";
7045 impersonationText = Dynamicweb.Security.UserManagement.User.ImpersonationMode == Dynamicweb.Security.UserManagement.UserImpersonation.Full ? "<span class=\"impersonation-light-text dw-mod\">" + Translate("Logged in as") + "</span> <b>" + userName + "</b> <span class=\"impersonation-light-text dw-mod\">" + Translate("by") + "</span> <b>" + secondaryUserName + "</b> " : impersonationText;
7046
7047 if (impersonationLayout == "right-lower-box")
7048 {
7049 <div class="u-margin-bottom--lg u-ta-center">
7050 @impersonationText
7051 </div>
7052 <div class="u-margin-bottom--lg u-ta-center">
7053 @RenderSwitchAccountButton()
7054 </div>
7055 @RenderStopImpersonationButton()
7056 }
7057 else
7058 {
7059 <div class="grid grid--align-center impersonation__stop-wrap">
7060 <div class="impersonation-bar-item dw-mod">
7061 @impersonationText
7062 </div>
7063 <div class="impersonation-bar-item dw-mod">
7064 @RenderSwitchAccountButton()
7065 </div>
7066 <div class="impersonation-bar-item dw-mod">
7067 @RenderStopImpersonationButton()
7068 </div>
7069 </div>
7070 }
7071 }
7072
7073 @helper RenderSwitchAccountButton() {
7074 @Render(new Button
7075 {
7076 Href = "/Default.aspx?ID=" + impersonationPageId,
7077 ButtonType = ButtonType.Button,
7078 ButtonLayout = ButtonLayout.Clean,
7079 Title = Translate("Switch account"),
7080 Icon = new Icon {
7081 Name = "fa-users",
7082 Prefix = "fal",
7083 LabelPosition = IconLabelPosition.After
7084 },
7085 CssClass = "u-no-margin u-color-inherit"
7086 })
7087 }
7088
7089 @helper RenderStopImpersonationForm()
7090 {
7091 string secondaryUserName = getUserName(Model.CurrentSecondaryUser);
7092 string userName = getUserName(Pageview.User);
7093 int pageId = Model.TopPage.ID;
7094
7095 <form method="post" class="u-no-margin">
7096 @Render(new Button
7097 {
7098 ButtonType = ButtonType.Submit,
7099 ButtonLayout = ButtonLayout.Secondary,
7100 Title = Translate("Sign out as") + " " + userName,
7101 Href = "/Default.aspx?ID=" + impersonationPageId,
7102 CssClass = "btn--full",
7103 Name = "DwExtranetRemoveSecondaryUser"
7104 })
7105
7106 @Render(new Button
7107 {
7108 ButtonType = ButtonType.Submit,
7109 ButtonLayout = ButtonLayout.Secondary,
7110 Title = Translate("Sign out as") + " " + secondaryUserName,
7111 Href = "/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId,
7112 CssClass = "btn--full",
7113 Name = "DwExtranetRemoveSecondaryUser"
7114 })
7115 </form>
7116 }
7117
7118 @helper RenderStopImpersonationButton() {
7119 @Render(new Button
7120 {
7121 ButtonType = ButtonType.Button,
7122 ButtonLayout = ButtonLayout.Clean,
7123 Title = Translate("Sign out"),
7124 Icon = new Icon {
7125 Name = "fa-sign-out",
7126 Prefix = "fal",
7127 LabelPosition = IconLabelPosition.After
7128 },
7129 OnClick = "document.getElementById('StopImpersonationModalTrigger').checked = true",
7130 CssClass = "u-no-margin"
7131 })
7132 }
7133
7134 @helper RenderImpersonationControls()
7135 {
7136 <div class="impersonation__controls">
7137 @RenderViewListLink()
7138 @RenderSearchBox()
7139 </div>
7140 @RenderResultsList()
7141 }
7142
7143 @helper RenderViewListLink()
7144 {
7145 string title = impersonationLayout == "right-lower-box" ? Translate("View the list") : Translate("View the list of users you can sign in as");
7146 string buttonClasses = impersonationLayout == "right-lower-box" ? "impersonation__button btn btn--impersonation" : "impersonation__link impersonation__link";
7147
7148 @Render(new Link {
7149 ButtonLayout = ButtonLayout.None,
7150 Title = title,
7151 Href = "/Default.aspx?ID=" + impersonationPageId,
7152 CssClass = buttonClasses
7153 })
7154 }
7155
7156 @helper RenderSearchBox()
7157 {
7158 <div class="impersonation__search-wrap">
7159 <input placeholder="@Translate("Search users")" type="text" class="impersonation__search-field dw-mod" onkeyup="searchKeyUpHandler(event)" id="ImpersonationBoxSearchField">
7160 <div id="ImpersonationBoxSearchFind" class="impersonation__search-icon dw-mod" onclick="updateResults(document.getElementById('ImpersonationBoxSearchField').value)">
7161 <i class="fal fa-search"></i>
7162 </div>
7163 <div id="ImpersonationBoxSearchClear" class="impersonation__search-icon u-hidden dw-mod" onclick="clearResults();">
7164 <i class="fal fa-times"></i>
7165 </div>
7166 </div>
7167 }
7168
7169 @helper RenderTypeaheadSearch()
7170 {
7171 <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar"
7172 data-page-size="5"
7173 data-search-feed-id="@impersonationFeed"
7174 data-result-page-id="@impersonationPageId"
7175 data-search-type="user-search"
7176 data-search-parameter-name="q">
7177
7178 <div class="typeahead-search-field">
7179 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" placeholder="@Translate("Search users")">
7180 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ImpersonationSearchBarContent" data-template="ImpersonationSearchResult" data-json-feed="/Default.aspx?ID=@impersonationFeed" data-init-onload="false"></ul>
7181 </div>
7182 </div>
7183 }
7184
7185 @helper RenderResultsList()
7186 {
7187 <ul id="ImpersonationBoxSearchResults" class="impersonation__search-results js-handlebars-root dw-mod" data-template="ImpersonationSearchResult" data-json-feed="/Default.aspx?ID=@impersonationFeed" data-init-onload="false" data-preloader="minimal"></ul>
7188 }
7189
7190 @helper RenderSearchResultTemplate()
7191 {
7192 <script id="ImpersonationSearchResult" type="text/x-template">
7193 {{#.}}
7194 {{#Users}}
7195 <li class="impersonation__search-results-item impersonation-user">
7196 <form method="post" class="impersonation-user__form" name="account{{id}}">
7197 <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}">
7198 <div class="impersonation-user__info">
7199 <div class="impersonation-user__name">{{userName}}</div>
7200 <div class="impersonation-user__number">{{customerNumber}}</div>
7201 </div>
7202 @Render(new Button
7203 {
7204 ButtonType = ButtonType.Submit,
7205 ButtonLayout = ButtonLayout.Secondary,
7206 Title = Translate("Sign in as"),
7207 CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "")
7208 })
7209 </form>
7210 </li>
7211 {{/Users}}
7212 {{#unless Users}}
7213 <li class="impersonation__search-results-item impersonation__search-results-item--not-found">
7214 @Translate("Your search gave 0 results")
7215 </li>
7216 {{/unless}}
7217 {{/.}}
7218 </script>
7219 }
7220
7221 @helper RenderSearchScripts()
7222 {
7223 <script>
7224 let inputDelayTimer;
7225 function searchKeyUpHandler(e) {
7226 clearTimeout(inputDelayTimer);
7227 let value = e.target.value;
7228 if (value != "") {
7229 inputDelayTimer = setTimeout(function () {
7230 updateResults(value);
7231 }, 500);
7232 } else {
7233 clearResults();
7234 }
7235 };
7236
7237 function updateResults(value) {
7238 if (value == "") {
7239 return null;
7240 }
7241 HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value);
7242 document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden");
7243 document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden");
7244 }
7245
7246 function clearResults() {
7247 document.getElementById("ImpersonationBoxSearchField").value = "";
7248 HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults");
7249 document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden");
7250 document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden");
7251 }
7252 </script>
7253 }
7254 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
7255
7256 @using System
7257 @using System.Web
7258 @using System.Collections.Generic
7259 @using Dynamicweb.Rapido.Blocks.Extensibility
7260 @using Dynamicweb.Rapido.Blocks
7261
7262 @{
7263 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master");
7264 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table";
7265
7266 Block orderLines = new Block
7267 {
7268 Id = "MiniCartOrderLines",
7269 SkipRenderBlocksList = true,
7270 BlocksList = new List<Block>
7271 {
7272 new Block {
7273 Id = "MiniCartOrderLinesList",
7274 SortId = 20,
7275 Template = RenderMiniCartOrderLinesList()
7276 }
7277 }
7278 };
7279
7280 Block orderlinesScriptTemplates = new Block
7281 {
7282 Id = "OrderlinesScriptTemplates"
7283 };
7284
7285 if (orderlinesView == "table")
7286 {
7287 orderLines.Template = RenderMiniCartOrderLinesTable();
7288 orderLines.BlocksList.Add(
7289 new Block
7290 {
7291 Id = "MiniCartOrderlinesTableHeader",
7292 SortId = 10,
7293 Template = RenderMiniCartOrderLinesHeader()
7294 }
7295 );
7296
7297 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates();
7298 }
7299 else
7300 {
7301 orderLines.Template = RenderMiniCartOrderLinesBlocks();
7302 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates();
7303 }
7304
7305 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates);
7306
7307 Block miniCartScriptTemplates = new Block()
7308 {
7309 Id = "MasterMiniCartTemplates",
7310 SortId = 1,
7311 Template = RenderMiniCartScriptTemplates(),
7312 SkipRenderBlocksList = true,
7313 BlocksList = new List<Block>
7314 {
7315 orderLines,
7316 new Block {
7317 Id = "MiniCartFooter",
7318 Template = RenderMiniCartFooter(),
7319 SortId = 50,
7320 SkipRenderBlocksList = true,
7321 BlocksList = new List<Block>
7322 {
7323 new Block {
7324 Id = "MiniCartSubTotal",
7325 Template = RenderMiniCartSubTotal(),
7326 SortId = 30
7327 },
7328 new Block {
7329 Id = "MiniCartFees",
7330 Template = RenderMiniCartFees(),
7331 SortId = 40
7332 },
7333 new Block {
7334 Id = "MiniCartPoints",
7335 Template = RenderMiniCartPoints(),
7336 SortId = 50
7337 },
7338 new Block {
7339 Id = "MiniCartTotal",
7340 Template = RenderMiniCartTotal(),
7341 SortId = 60
7342 },
7343 new Block {
7344 Id = "MiniCartDisclaimer",
7345 Template = RenderMiniCartDisclaimer(),
7346 SortId = 70
7347 },
7348 new Block {
7349 Id = "MiniCartActions",
7350 Template = RenderMiniCartActions(),
7351 SortId = 80
7352 }
7353 }
7354 }
7355 }
7356 };
7357
7358 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates);
7359 }
7360
7361 @helper RenderMiniCartScriptsTableTemplates()
7362 {
7363 <script id="MiniCartOrderline" type="text/x-template">
7364 {{#unless isEmpty}}
7365 <tr>
7366 <td class="u-w60px"><a href="{{link}}" class="{{hideimage}}"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=50&height=50&crop=5&Compression=75&image={{image}}" alt="{{name}}" title="{{name}}"></a></td>
7367 <td class="u-va-middle">
7368 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a>
7369 {{#if variantname}}
7370 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a>
7371 {{/if}}
7372 {{#ifCond produsNelocalizat "!==" "True"}}
7373 {{#if unitname}}
7374 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div>
7375 {{/if}}
7376 {{/ifCond}}
7377 </td>
7378 <td class="u-ta-right u-va-middle">{{quantity}}</td>
7379 <td class="u-ta-right u-va-middle">
7380 {{#if pointsTotal}}
7381 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
7382 {{else}}
7383 {{totalprice}}
7384 {{/if}}
7385 </td>
7386 </tr>
7387 {{/unless}}
7388 </script>
7389
7390 <script id="MiniCartOrderlineDiscount" type="text/x-template">
7391 {{#unless isEmpty}}
7392 <tr class="table__row--no-border">
7393 <td class="u-w60px"> </td>
7394 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td>
7395 <td class="u-ta-right"> </td>
7396 <td class="u-ta-right">{{totalprice}}</td>
7397 </tr>
7398 {{/unless}}
7399 </script>
7400 }
7401
7402 @helper RenderMiniCartScriptsListTemplates()
7403 {
7404
7405 <script id="MiniCartOrderline" type="text/x-template">
7406 {{#unless isEmpty}}
7407 <div class="mini-cart-orderline grid dw-mod">
7408 <div class="grid__col-4">
7409 <a href="{{link}}" class="{{hideimage}}">
7410 <img class="" src="/Admin/Public/GetImage.ashx?width=100&height=100&crop=5&Compression=75&image={{image}}" alt="{{name}}" title="{{name}}">
7411 </a>
7412 </div>
7413 <div class="grid__col-8">
7414 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--truncate mini-cart-orderline__name--md u-padding-right--lg" title="{{name}}">{{name}}</a>
7415 {{#if variantname}}
7416 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div>
7417 {{/if}}
7418 {{#ifCond produsNelocalizat "!==" "True"}}
7419 {{#if unitname}}
7420 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div>
7421 {{/if}}
7422 {{/ifCond}}
7423 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div>
7424
7425 {{#ifCond estimatedDeliver "!==" "01.01.0001"}}
7426 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Estimare livrare"): {{estimatedDeliver}}</div>
7427 {{/ifCond}}
7428
7429 <div class="grid__cell-footer">
7430 <div class="grid__cell">
7431 <div class="u-pull--left mini-cart-orderline__price dw-mod">
7432 {{#if pointsTotal}}
7433 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
7434 {{else}}
7435 {{totalprice}}
7436 {{/if}}
7437 </div>
7438 <button type="button"
7439 title="@Translate("Remove orderline")"
7440 class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod"
7441 onclick="{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}}Cart.UpdateCart('miniCartContent', '/Default.aspx?ID={{cartFeedPageId}}', '{{removeLink}}', true);">@Translate("Remove")</button>
7442 </div>
7443 </div>
7444 </div>
7445 </div>
7446 {{/unless}}
7447 </script>
7448
7449 <script id="MiniCartOrderlineDiscount" type="text/x-template">
7450 {{#unless isEmpty}}
7451 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod">
7452 <div class="grid__col-8">
7453 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div>
7454 </div>
7455 <div class="grid__col-4 u-align-right">{{totalprice}}</div>
7456 </div>
7457 {{/unless}}
7458 </script>
7459 }
7460
7461 @helper RenderMiniCartScriptTemplates()
7462 {
7463 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList();
7464 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
7465 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage"));
7466 bool miniCartUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
7467
7468 <script id="MiniCartContent" type="text/x-template">
7469 {{#.}}
7470 {{#unless isEmpty}}
7471 @if (miniCartUseGoogleTagManager)
7472 {
7473 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text>
7474 }
7475 @RenderBlockList(subBlocks)
7476 {{/unless}}
7477
7478 {{#if isEmpty}}
7479 {{cartIsEmptyMessage}}
7480 {{/if}}
7481 {{/.}}
7482 </script>
7483 }
7484
7485 @helper RenderMiniCartOrderLinesTable()
7486 {
7487 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();
7488
7489 <div class="u-overflow-auto">
7490 <table class="table mini-cart-table dw-mod">
7491 @RenderBlockList(subBlocks)
7492 </table>
7493 </div>
7494 }
7495
7496 @helper RenderMiniCartOrderLinesBlocks()
7497 {
7498 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList();
7499
7500 <div class="u-overflow-hidden">
7501 @RenderBlockList(subBlocks)
7502 </div>
7503 }
7504
7505 @helper RenderMiniCartOrderLinesHeader()
7506 {
7507 <thead>
7508 <tr>
7509 <td> </td>
7510 <td>@Translate("Product")</td>
7511 <td class="u-ta-right">@Translate("Qty")</td>
7512 <td class="u-ta-right" width="120">@Translate("Price")</td>
7513 </tr>
7514 </thead>
7515 }
7516
7517 @helper RenderMiniCartOrderLinesList()
7518 {
7519 <text>
7520 {{#OrderLines}}
7521 {{#ifCond template "===" "CartOrderline"}}
7522 {{>MiniCartOrderline}}
7523 {{/ifCond}}
7524 {{#ifCond template "===" "CartOrderlineMobile"}}
7525 {{>MiniCartOrderline}}
7526 {{/ifCond}}
7527 {{#ifCond template "===" "CartOrderlineDiscount"}}
7528 {{>MiniCartOrderlineDiscount}}
7529 {{/ifCond}}
7530 {{/OrderLines}}
7531 </text>
7532 }
7533
7534 @helper RenderMiniCartFees()
7535 {
7536 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
7537 if (!pointShop)
7538 {
7539 <text>
7540 {{#unless hidePaymentfee}}
7541 <div class="grid">
7542 <div class="grid__col-6 grid__col--bleed-y">
7543 {{paymentmethod}}
7544 </div>
7545 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div>
7546 </div>
7547 {{/unless}}
7548 </text>
7549 }
7550 <text>
7551 {{#unless hideShippingfee}}
7552 <div class="grid">
7553 <div class="grid__col-6 grid__col--bleed-y">
7554 {{shippingmethod}}
7555 </div>
7556 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div>
7557 </div>
7558 {{/unless}}
7559 </text>
7560 <text>
7561 {{#if hasTaxSettings}}
7562 <div class="grid">
7563 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div>
7564 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div>
7565 </div>
7566 {{/if}}
7567 </text>
7568 }
7569
7570 @helper RenderMiniCartFooter()
7571 {
7572 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList();
7573
7574 <div class="mini-cart__footer u-border-top u-padding-top dw-mod">
7575 @RenderBlockList(subBlocks)
7576 </div>
7577 }
7578
7579 @helper RenderMiniCartActions()
7580 {
7581 int cartPageId = GetPageIdByNavigationTag("CartPage");
7582 int cart2PageId = GetPageIdByNavigationTag("CartPageIngrasaminte");
7583
7584 <button type="button" title="@Translate("Empty cart")" class="btn btn--secondary u-full-width dw-mod u-no-margin u-margin-bottom" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event, '{{orderContext}}');">@Translate("Empty cart")</button>
7585 <a href="{{cartLink}}" title="@Translate("Go to cart")" class="btn btn--primary u-full-width u-no-margin dw-mod">@Translate("Go to cart")</a>
7586 }
7587
7588 @helper RenderMiniCartPoints()
7589 {
7590 <text>
7591 {{#if earnings}}
7592 <div class="grid">
7593 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div>
7594 <div class="grid__col-6 grid__col--bleed-y grid--align-end">
7595 <div>
7596 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")
7597 </div>
7598 </div>
7599 </div>
7600 {{/if}}
7601 </text>
7602 }
7603
7604 @helper RenderMiniCartSubTotal()
7605 {
7606 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID);
7607 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
7608 if (!pointShop)
7609 {
7610 <text>
7611 {{#unless hideSubTotal}}
7612 <div class="grid dw-mod u-bold">
7613 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div>
7614 <div class="grid__col-6 grid__col--bleed-y grid--align-end">
7615 @if (hasTaxSettings)
7616 {
7617 <text>{{subtotalpricewithouttaxes}}</text>
7618 }
7619 else
7620 {
7621 <text>{{subtotalprice}}</text>
7622 }
7623 </div>
7624 </div>
7625 {{/unless}}
7626 </text>
7627 }
7628 }
7629
7630 @helper RenderMiniCartTotal()
7631 {
7632 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
7633
7634 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod">
7635 <div class="grid__col-6">@Translate("Total")</div>
7636 <div class="grid__col-6 grid--align-end">
7637 <div>
7638 @if (pointShop)
7639 {
7640 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points")
7641 }
7642 else
7643 {
7644 <text>{{totalprice}}</text>
7645 }
7646 </div>
7647 </div>
7648 </div>
7649 }
7650
7651 @helper RenderMiniCartDisclaimer()
7652 {
7653 <text>
7654 {{#if showCheckoutDisclaimer}}
7655 <div class="grid u-margin-bottom u-ta-right">
7656 <small class="grid__col-12">{{checkoutDisclaimer}}</small>
7657 </div>
7658 {{/if}}
7659 </text>
7660 }
7661 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
7662
7663 @using Dynamicweb.Rapido.Blocks.Extensibility
7664 @using Dynamicweb.Rapido.Blocks
7665 @using Dynamicweb.Rapido.Blocks.Components.General
7666 @using Dynamicweb.Rapido.Blocks.Components
7667 @using Dynamicweb.Rapido.Services
7668
7669 @{
7670 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : "";
7671 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown";
7672 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart");
7673
7674 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType))
7675 {
7676 if (addToCartNotificationType == "modal")
7677 {
7678 Block addToCartNotificationModal = new Block
7679 {
7680 Id = "AddToCartNotificationModal",
7681 Template = RenderAddToCartNotificationModal()
7682 };
7683
7684 Block addToCartNotificationScript = new Block
7685 {
7686 Id = "AddToCartNotificationScript",
7687 Template = RenderAddToCartNotificationModalScript()
7688 };
7689 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal);
7690 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);
7691 }
7692 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet")
7693 {
7694 Block addToCartNotificationScript = new Block
7695 {
7696 Id = "AddToCartNotificationScript",
7697 Template = RenderAddToCartNotificationToggleScript()
7698 };
7699 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript);
7700 }
7701 }
7702 }
7703
7704 @helper RenderAddToCartNotificationModal()
7705 {
7706 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div>
7707 }
7708
7709 @helper RenderAddToCartNotificationModalScript()
7710 {
7711 int cartPageId = GetPageIdByNavigationTag("CartPage");
7712
7713 <script id="LastAddedProductTemplate" type="text/x-template">
7714 @{
7715
7716 Modal lastAddedProduct = new Modal
7717 {
7718 Id = "LastAddedProduct",
7719 Heading = new Heading
7720 {
7721 Level = 2,
7722 Title = Translate("Product is added to the cart")
7723 },
7724 Width = ModalWidth.Md,
7725 BodyTemplate = RenderModalContent()
7726 };
7727
7728 lastAddedProduct.AddActions(
7729 new Button
7730 {
7731 ButtonType = ButtonType.Button,
7732 ButtonLayout = ButtonLayout.Secondary,
7733 Title = Translate("Continue shopping"),
7734 CssClass = "u-pull--left u-no-margin btn--sm",
7735 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false"
7736 },
7737 new Link
7738 {
7739 Href = "/Default.aspx?ID=" + cartPageId,
7740 ButtonLayout = ButtonLayout.Secondary,
7741 CssClass = "u-pull--right u-no-margin btn--sm",
7742 Title = Translate("Proceed to checkout"),
7743 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false"
7744 }
7745 );
7746
7747 @Render(lastAddedProduct)
7748 }
7749 </script>
7750 <script>
7751 document.addEventListener('addToCart', function (event) {
7752 Cart.ShowLastAddedProductModal(event.detail);
7753 });
7754 </script>
7755 }
7756
7757 @helper RenderModalContent()
7758 {
7759 <div class="grid">
7760 <div class="grid__col-2">
7761 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true })
7762 </div>
7763 <div class="u-padding grid--align-self-center">
7764 <span>{{quantity}}</span> x
7765 </div>
7766 <div class="grid__col-auto grid--align-self-center">
7767 <div>{{productInfo.name}}</div>
7768 {{#if productInfo.variantName}}
7769 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small>
7770 {{/if}}
7771 {{#if productInfo.unitName}}
7772 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small>
7773 {{/if}}
7774 </div>
7775 </div>
7776 }
7777
7778 @helper RenderAddToCartNotificationToggleScript()
7779 {
7780 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
7781
7782 <script>
7783 document.addEventListener('addToCart', function () {
7784 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId');
7785 });
7786 </script>
7787 }
7788 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
7789
7790 @using System
7791 @using System.Web
7792 @using System.Collections.Generic
7793 @using Dynamicweb.Rapido.Blocks.Extensibility
7794 @using Dynamicweb.Rapido.Blocks
7795 @using Dynamicweb.Rapido.Blocks.Components.General
7796
7797 @functions {
7798 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master");
7799 }
7800
7801 @{
7802 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content");
7803 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content");
7804 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content");
7805 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header");
7806 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header");
7807 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header");
7808
7809 Block masterFooterContent = new Block()
7810 {
7811 Id = "MasterFooterContent",
7812 SortId = 10,
7813 Template = RenderFooter(),
7814 SkipRenderBlocksList = true
7815 };
7816 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent);
7817
7818 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader))
7819 {
7820 Block masterFooterColumnOne = new Block
7821 {
7822 Id = "MasterFooterColumnOne",
7823 SortId = 10,
7824 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent),
7825 Design = new Design
7826 {
7827 Size = "auto",
7828 RenderType = RenderType.Column
7829 }
7830 };
7831 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne);
7832 }
7833
7834 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader))
7835 {
7836 Block masterFooterColumnTwo = new Block
7837 {
7838 Id = "MasterFooterColumnTwo",
7839 SortId = 20,
7840 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent),
7841 Design = new Design
7842 {
7843 Size = "auto",
7844 RenderType = RenderType.Column
7845 }
7846 };
7847 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo);
7848 }
7849
7850 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader))
7851 {
7852 Block masterFooterColumnThree = new Block
7853 {
7854 Id = "MasterFooterColumnThree",
7855 SortId = 30,
7856 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent),
7857 Design = new Design
7858 {
7859 Size = "auto",
7860 RenderType = RenderType.Column
7861 }
7862 };
7863 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree);
7864 }
7865
7866 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0)
7867 {
7868 Block masterFooterSocialLinks = new Block
7869 {
7870 Id = "MasterFooterSocialLinks",
7871 SortId = 40,
7872 Template = RenderFooterSocialLinks(),
7873 Design = new Design
7874 {
7875 Size = "auto",
7876 RenderType = RenderType.Column,
7877 CssClass = "footer__column-wrapper"
7878 }
7879 };
7880 //footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks);
7881 }
7882
7883
7884 Block masterFooterNewsletterSignUpNew = new Block
7885 {
7886 Id = "MasterFooterNewsletterSignUp",
7887 SortId = 50,
7888 Template = RenderFooterNewsletterSignUp(),
7889 Design = new Design
7890 {
7891 Size = "auto",
7892 RenderType = RenderType.Column,
7893 CssClass = "footer__column-wrapper"
7894 }
7895 };
7896 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUpNew);
7897
7898
7899 @*if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0)
7900 {
7901 Block masterFooterPayments = new Block
7902 {
7903 Id = "MasterFooterPayments",
7904 SortId = 60,
7905 Template = RenderFooterPayments(),
7906 Design = new Design
7907 {
7908 Size = "12",
7909 RenderType = RenderType.Column
7910 }
7911 };
7912 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments);
7913 }
7914
7915 Block masterFooterCopyright = new Block
7916 {
7917 Id = "MasterFooterCopyright",
7918 SortId = 70,
7919 Template = RenderFooterCopyright(),
7920 Design = new Design
7921 {
7922 Size = "12",
7923 RenderType = RenderType.Column
7924 }
7925 };
7926 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright);*@
7927 }
7928
7929 @helper RenderFooter()
7930 {
7931 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList();
7932 string footerBG = Model.Area.Item.GetItem("Layout").GetString("FooterBackgroundColor");
7933
7934 <footer class="footer no-print dw-mod">
7935 <div class="center-container top-container__center-container dw-mod">
7936 <div class="grid grid--external-bleed-x footer__wrapper">
7937 @RenderBlockList(subBlocks)
7938 </div>
7939 </div>
7940 <div class="footer__bottom" style="background-color: @footerBG;">
7941 <div class="center-container top-container__center-container dw-mod">
7942 <div class="grid grid--external-bleed-x footer__wrapper bottom">
7943 @if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0)
7944 {
7945 <div class="footer__bottom-payments">@RenderFooterPayments()</div>
7946 }
7947 <div class="footer__bottom-copyright">@RenderFooterCopyright()</div>
7948 </div>
7949 </div>
7950 </div>
7951 </footer>
7952 }
7953
7954
7955 @helper RenderFooterColumn(string header, string content)
7956 {
7957 <h3 class="footer__heading dw-mod">@header</h3>
7958 <div class="footer__content dw-mod">
7959 @content
7960 </div>
7961 }
7962
7963 @helper RenderFooterNewsletterSignUp()
7964 {
7965 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp"))
7966 {
7967 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString();
7968 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart };
7969
7970 form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId });
7971 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" });
7972 form.Add(new TextField {
7973 Id = "NewsletterEmail", Name = "NewsletterEmail", Placeholder = Translate("Your email address"),
7974 Type = TextFieldType.Email,
7975 ActionButton = new Button {
7976 ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed"
7977 }
7978 });
7979
7980 <h3 class="footer__heading dw-mod">@Translate("Mailing list")<i class="icon--accordion fas fa-chevron-down"></i></h3>
7981 <div class="footer__content dw-mod">
7982 @Render(form)
7983 </div>
7984 }
7985
7986 @RenderANPCIcons()
7987 @RenderFooterSocialLinks()
7988 }
7989
7990 @helper RenderFooterSocialLinks()
7991 {
7992 @*<h3 class="footer__heading dw-mod">@Translate("Social links")<i class="icon--accordion fas fa-chevron-down"></i></h3>*@
7993 <div class="u-margin-top dw-mod">
7994 <div class="collection dw-mod">
7995 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks"))
7996 {
7997 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel;
7998 string socialIconClass = socialIcon.SelectedValue;
7999 string socialIconTitle = socialIcon.SelectedName;
8000 string socialLink = socialitem.GetString("Link");
8001
8002 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a>
8003 }
8004 </div>
8005 </div>
8006 }
8007
8008 @helper RenderFooterPayments()
8009 {
8010 <div class="footer__content dw-mod">
8011 <div class="collection dw-mod">
8012 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments"))
8013 {
8014 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel;
8015 string paymentImage = null;
8016 string paymentTitle = paymentItem.SelectedName;
8017 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault();
8018 if (selected != null)
8019 {
8020 paymentImage = selected.Icon;
8021 }
8022
8023 <div class="footer__card-type">
8024 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" />
8025 </div>
8026 }
8027 </div>
8028 </div>
8029 }
8030
8031 @helper RenderFooterCopyright()
8032 {
8033 var termsAndConditionsTechnologyPageId = GetPageIdByNavigationTag("TermsAndConditionsAgricoverTechnology"); //term and conditions for Ingrasaminte
8034 var copyRightNonIngrasaminte = Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText");
8035 var copyRightIngrasaminte = Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightTextIngrasaminte");
8036
8037 int currentPageId = Dynamicweb.Frontend.PageView.Current().Page.ID;
8038 var contextIdIngrasaminte = currentPageId == GetPageIdByNavigationTag("CartPageIngrasaminte") || currentPageId == termsAndConditionsTechnologyPageId;
8039 var checkGroupIdUrl = !string.IsNullOrEmpty(HttpContext.Current.Request["GroupID"]) ? HttpContext.Current.Request.QueryString.Get("GroupID") : ""; //ingrasaminte groupid => GROUP304
8040 var copyRightsDecision = checkGroupIdUrl == "GROUP304" || contextIdIngrasaminte ? copyRightIngrasaminte : copyRightNonIngrasaminte;
8041 string currentYear = DateTime.Now.Year.ToString();
8042
8043
8044
8045 <div class="grid__col-12 footer__copyright dw-mod">
8046 <p>© @currentYear @copyRightsDecision</p>
8047 </div>
8048 }
8049
8050 @helper RenderANPCIcons()
8051 {
8052 <div class="u-margin-top--lg u-margin-bottom--lg">
8053 <a href="https://anpc.ro/ce-este-sal/" target="_blank"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=250&Compression=95&image=/Files/Images/pictograma1-ANPC.png" alt="ANPC" title="ANPC" /></a>
8054
8055 <a href="https://ec.europa.eu/consumers/odr" target="_blank"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=250&Compression=95&image=/Files/Images/pictograma2-ANPC.png" alt="Solutionarea online a litigiilor" title="Solutionarea online a litigiilor" /></a>
8056 </div>
8057 }
8058 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
8059
8060 @using System
8061 @using System.Web
8062 @using System.Collections.Generic
8063 @using Dynamicweb.Rapido.Blocks.Extensibility
8064 @using Dynamicweb.Rapido.Blocks
8065 @using Dynamicweb.Ecommerce.Common
8066
8067 @{
8068 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master");
8069
8070 Block masterScriptReferences = new Block()
8071 {
8072 Id = "MasterScriptReferences",
8073 SortId = 1,
8074 Template = RenderMasterScriptReferences()
8075 };
8076 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences);
8077 }
8078
8079 @helper RenderMasterScriptReferences() {
8080 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script>
8081 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script>
8082 <script src="/Files/Templates/Designs/Rapido/js/comments.js"></script>
8083 <link rel="stylesheet" id="commentsCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/comments-rating.css">
8084 <script src="/Files/Templates/Designs/Rapido/js/custom-typeahead.js"></script>
8085
8086 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript"))
8087 {
8088 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js?v=1"></script>
8089 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js");
8090 }
8091
8092 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js");
8093 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js");
8094 }
8095 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
8096
8097 @using System
8098 @using System.Web
8099 @using System.Collections.Generic
8100 @using Dynamicweb.Rapido.Blocks.Extensibility
8101 @using Dynamicweb.Rapido.Blocks
8102 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
8103 @using Dynamicweb.Rapido.Services
8104
8105 @{
8106 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master");
8107 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch");
8108 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID"));
8109
8110 if (!navigationItemsHideSearch || isFavoriteList)
8111 {
8112 Block masterSearchScriptTemplates = new Block()
8113 {
8114 Id = "MasterSearchScriptTemplates",
8115 SortId = 1,
8116 Template = RenderSearchScriptTemplates()
8117 };
8118
8119 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates);
8120 }
8121 }
8122
8123 @helper RenderSearchScriptTemplates()
8124 {
8125 int productsPageId = GetPageIdByNavigationTag("ProductsPage");
8126 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID;
8127 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"));
8128 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"));
8129 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults");
8130 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton");
8131 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton");
8132 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton");
8133 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
8134
8135 <script id="SearchGroupsTemplate" type="text/x-template">
8136 {{#.}}
8137 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li>
8138 {{/.}}
8139 </script>
8140
8141 <script id="SearchProductsTemplate" type="text/x-template">
8142 {{#each .}}
8143 {{#Product}}
8144 {{#ifCond template "!==" "SearchMore"}}
8145 <li class="dropdown__item dropdown__item--seperator dw-mod">
8146 @if (useFacebookPixel)
8147 {
8148 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text>
8149 }
8150 @if (useGoogleTagManager)
8151 {
8152 <text>{{{googleEnchantImpression googleImpression}}}</text>
8153 }
8154 <div>
8155 <a href="{{link}}"
8156 class="js-typeahead-link u-color-inherit u-pull--left"
8157 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}"
8158 title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}">
8159 <div class="u-margin-right u-pull--left {{noimage}}"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=45&height=36&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"></div>
8160 <div class="u-pull--left">
8161 <div class="u-bold u-truncate-text js-typeahead-name u-max-w300px">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div>
8162 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed())
8163 {
8164 if (pointShopOnly)
8165 {
8166 <text>
8167 {{#if havePointPrice}}
8168 <div>
8169 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points")
8170 </div>
8171 {{else}}
8172 <small class="help-text u-no-margin">@Translate("Not available")</small>
8173 {{/if}}
8174 {{#unless canBePurchasedWithPoints}}
8175 {{#if havePointPrice}}
8176 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small>
8177 {{/if}}
8178 {{/unless}}
8179 </text>
8180 }
8181 else
8182 {
8183 <div>{{#ifCond priceDouble '>' 0}}{{price}}{{/ifCond}}</div>
8184 }
8185 }
8186 </div>
8187 </a>
8188 @*<div class="u-margin-left u-pull--right">
8189 @{
8190 var viewBtn = new Link
8191 {
8192 Href = "{{link}}",
8193 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}",
8194 ButtonLayout = ButtonLayout.Secondary,
8195 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside",
8196 Title = Translate("View")
8197 };
8198 }
8199 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
8200 {
8201 <text>{{#if hideAddToCartButton}}</text>
8202 @Render(viewBtn)
8203 <text>{{else}}</text>
8204 @Render(new AddToCartButton
8205 {
8206 HideTitle = true,
8207 ProductId = "{{productId}}",
8208 ProductInfo = "{{productInfo}}",
8209 BuyForPoints = pointShopOnly,
8210 OnClick = "{{facebookPixelAction}}",
8211 CssClass = "u-w80px u-no-margin js-ignore-click-outside",
8212 Icon = new Icon {
8213 CssClass = "js-ignore-click-outside"
8214 },
8215 ExtraAttributes = new Dictionary<string, string>
8216 {
8217 { "{{disabledBuyButton}}", "" }
8218 }
8219 })
8220 <text>{{/if}}</text>
8221 }
8222 else if (showViewButton)
8223 {
8224 @Render(viewBtn)
8225 }
8226 @if (showAddToDownloadButton)
8227 {
8228 <button type="button" class="btn btn--primary u-no-margin btn--condensed dw-mod js-add-to-downloads" title="@Translate("Add")" data-product-id="{{productId}}">
8229 <i class="fas fa-plus js-button-icon"></i>
8230 </button>
8231 }
8232 </div>*@
8233 </div>
8234 </li>
8235 {{/ifCond}}
8236 {{#ifCond template "===" "SearchMore"}}
8237 {{>SearchMoreProducts}}
8238 {{/ifCond}}
8239 {{/Product}}
8240 {{else}}
8241 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">
8242 @Translate("Your search gave 0 results")
8243 </li>
8244 {{/each}}
8245 </script>
8246
8247 <script id="SearchMoreProducts" type="text/x-template">
8248 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
8249 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
8250 @Translate("View products")
8251 </a>
8252 </li>
8253 </script>
8254
8255 <script id="SearchMorePages" type="text/x-template">
8256 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod">
8257 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link">
8258 @Translate("View descriptions")
8259 </a>
8260 </li>
8261 </script>
8262
8263 <script id="SearchPagesTemplate" type="text/x-template">
8264 {{#each .}}
8265 {{#ifCond template "!==" "SearchMore"}}
8266 <li class="dropdown__item dropdown__item--seperator dropdown__item--no-padding dw-mod">
8267 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link dropdown__link u-color-inherit u-flex">
8268 {{#ifCond icon "!==" null}}
8269 <div class="u-margin-right u-flex grid--align-center"><i class="fa {{icon}} u-w20px u-ta-center"></i></div>
8270 {{/ifCond}}
8271
8272 {{#ifCond image "!==" null}}
8273 <div class="seach__image-wrapper dropdown" style='background:url("{{image}}");'></div>
8274 {{/ifCond}}
8275
8276 <div class="u-flex grid--align-center"><div class='u-bold u-truncate-text u-inline-block js-typeahead-name'>{{name}}</div></div>
8277
8278 </a>
8279 </li>
8280 {{/ifCond}}
8281 {{#ifCond template "===" "SearchMore"}}
8282 {{>SearchMorePages}}
8283 {{/ifCond}}
8284 {{else}}
8285 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod">
8286 @Translate("Your search gave 0 results")
8287 </li>
8288 {{/each}}
8289 </script>
8290
8291 <script id="SearchPagesTemplateWrap" type="text/x-template">
8292 <div class="dropdown__column-header">@Translate("Pages")</div>
8293 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod">
8294 {{>SearchPagesTemplate}}
8295 </ul>
8296 </script>
8297
8298 <script id="SearchProductsTemplateWrap" type="text/x-template">
8299 <div class="dropdown__column-header">@Translate("Products")</div>
8300 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod">
8301 {{>SearchProductsTemplate}}
8302 </ul>
8303 </script>
8304 }
8305
8306 @using Dynamicweb.Rapido.Blocks.Components
8307 @using Dynamicweb.Rapido.Blocks.Components.General
8308 @using Dynamicweb.Rapido.Blocks
8309 @using System.IO
8310
8311
8312 @using Dynamicweb.Rapido.Blocks.Components.General
8313 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
8314
8315
8316 @* Component *@
8317
8318 @helper RenderVariantMatrix(VariantMatrix settings) {
8319 if (settings != null)
8320 {
8321 int productLoopCounter = 0;
8322 int groupCount = 0;
8323 List<VariantOption> firstDimension = new List<VariantOption>();
8324 List<VariantOption> secondDimension = new List<VariantOption>();
8325 List<VariantOption> thirdDimension = new List<VariantOption>();
8326
8327 foreach (VariantGroup variantGroup in settings.GetVariantGroups())
8328 {
8329 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions())
8330 {
8331 if (groupCount == 0) {
8332 firstDimension.Add(variantOptions);
8333 }
8334 if (groupCount == 1)
8335 {
8336 secondDimension.Add(variantOptions);
8337 }
8338 if (groupCount == 2)
8339 {
8340 thirdDimension.Add(variantOptions);
8341 }
8342 }
8343 groupCount++;
8344 }
8345
8346 int rowCount = 0;
8347 int columnCount = 0;
8348
8349 <script>
8350 var variantsCollection = [];
8351 </script>
8352
8353 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId">
8354 @if (groupCount == 1)
8355 {
8356 <tbody>
8357 @foreach (VariantOption firstVariantOption in firstDimension)
8358 {
8359 var variantId = firstVariantOption.Id;
8360 <tr>
8361 <td class="u-bold">
8362 @firstVariantOption.Name
8363 </td>
8364 <td>
8365 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
8366 </td>
8367 </tr>
8368 productLoopCounter++;
8369 }
8370
8371 <tr>
8372 <td> </td>
8373 <td>
8374 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
8375 </td>
8376 </tr>
8377 </tbody>
8378 }
8379 @if (groupCount == 2)
8380 {
8381 <thead>
8382 <tr>
8383 <td> </td>
8384 @foreach (VariantOption variant in secondDimension)
8385 {
8386 <td>@variant.Name</td>
8387 }
8388 </tr>
8389 </thead>
8390 <tbody>
8391 @foreach (VariantOption firstVariantOption in firstDimension)
8392 {
8393 string variantId = "";
8394 columnCount = 0;
8395
8396 <tr>
8397 <td class="u-min-w120px">@firstVariantOption.Name</td>
8398
8399 @foreach (VariantOption secondVariantOption in secondDimension)
8400 {
8401 variantId = firstVariantOption.Id + "." + secondVariantOption.Id;
8402 <td>
8403 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
8404 </td>
8405
8406 columnCount++;
8407
8408 productLoopCounter++;
8409 }
8410
8411 <td>
8412 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div>
8413 </td>
8414 </tr>
8415
8416 rowCount++;
8417 }
8418
8419 @{
8420 columnCount = 0;
8421 }
8422
8423 <tr>
8424 <td> </td>
8425 @foreach (VariantOption secondVariantOption in secondDimension)
8426 {
8427 <td>
8428 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
8429 </td>
8430
8431 columnCount++;
8432 }
8433 <td> </td>
8434 </tr>
8435 </tbody>
8436 }
8437 @if (groupCount == 3)
8438 {
8439 <thead>
8440 <tr>
8441 <td> </td>
8442 @foreach (VariantOption thirdVariantOption in thirdDimension)
8443 {
8444 <td>@thirdVariantOption.Name</td>
8445 }
8446 </tr>
8447 </thead>
8448 <tbody>
8449 @foreach (VariantOption firstVariantOption in firstDimension)
8450 {
8451 int colspan = (thirdDimension.Count + 1);
8452
8453 <tr>
8454 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td>
8455 </tr>
8456
8457 foreach (VariantOption secondVariantOption in secondDimension)
8458 {
8459 string variantId = "";
8460 columnCount = 0;
8461
8462 <tr>
8463 <td class="u-min-w120px">@secondVariantOption.Name</td>
8464
8465 @foreach (VariantOption thirdVariantOption in thirdDimension)
8466 {
8467 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id;
8468
8469 <td>
8470 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount)
8471 </td>
8472
8473 columnCount++;
8474 productLoopCounter++;
8475 }
8476
8477 <td>
8478 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div>
8479 </td>
8480 </tr>
8481 rowCount++;
8482 }
8483 }
8484
8485 @{
8486 columnCount = 0;
8487 }
8488
8489 <tr>
8490 <td> </td>
8491 @foreach (VariantOption thirdVariantOption in thirdDimension)
8492 {
8493 <td>
8494 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div>
8495 </td>
8496
8497 columnCount++;
8498 }
8499 <td> </td>
8500 </tr>
8501 </tbody>
8502 }
8503 </table>
8504
8505 <script>
8506 document.addEventListener("DOMContentLoaded", function (event) {
8507 MatrixUpdateQuantity("@settings.ProductId");
8508 });
8509
8510 MatrixUpdateQuantity = function (productId) {
8511 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId);
8512 var allQtyFields = currentMatrix.getElementsByClassName("js-qty");
8513
8514 var qtyRowArr = [];
8515 var qtyColumnArr = [];
8516
8517 var totalQty = 0;
8518
8519 for (var i = 0; i < allQtyFields.length; i++) {
8520 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0;
8521 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0;
8522 }
8523
8524 for (var i = 0; i < allQtyFields.length; i++) {
8525 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value);
8526 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value);
8527 totalQty += parseFloat(allQtyFields[i].value);
8528 }
8529
8530 //Update row counters
8531 for (var i = 0; i < qtyRowArr.length; i++) {
8532 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0];
8533
8534 if (qtyRowArr[i] != undefined && qtyCounter != null) {
8535 var currentCount = qtyCounter.innerHTML;
8536 qtyCounter.innerHTML = qtyRowArr[i];
8537
8538 if (currentCount != qtyCounter.innerHTML) {
8539 qtyCounter.classList.add("qty-field--active");
8540 }
8541 }
8542
8543 }
8544
8545 //Update column counters
8546 for (var i = 0; i < qtyColumnArr.length; i++) {
8547 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0];
8548
8549 if (qtyColumnArr[i] != undefined && qtyCounter != null) {
8550 var currentCount = qtyCounter.innerHTML;
8551 qtyCounter.innerHTML = qtyColumnArr[i];
8552
8553 if (currentCount != qtyCounter.innerHTML) {
8554 qtyCounter.classList.add("qty-field--active");
8555 }
8556 }
8557 }
8558
8559 if (document.getElementById("TotalQtyCount_" + productId)) {
8560 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty;
8561 }
8562
8563 //Clean up animations
8564 setTimeout(function () {
8565 for (var i = 0; i < qtyRowArr.length; i++) {
8566 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0];
8567 if (qtyCounter != null) {
8568 qtyCounter.classList.remove("qty-field--active");
8569 }
8570 }
8571 for (var i = 0; i < qtyColumnArr.length; i++) {
8572 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0];
8573 if (qtyCounter != null) {
8574 qtyCounter.classList.remove("qty-field--active");
8575 }
8576 }
8577 }, 1000);
8578 }
8579 </script>
8580 }
8581 }
8582
8583 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount)
8584 {
8585 string loopCount = productLoopCounter.ToString();
8586
8587 bool combinationFound = false;
8588 double stock = 0;
8589 double quantityValue = 0;
8590 string note = "";
8591
8592 VariantProduct variantProduct = null;
8593
8594 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct))
8595 {
8596 stock = variantProduct.Stock;
8597 quantityValue = variantProduct.Quantity;
8598 combinationFound = true;
8599 }
8600
8601 if (combinationFound)
8602 {
8603 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" />
8604 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" />
8605 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" />
8606 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" />
8607 <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">
8608
8609 if (stock != 0)
8610 {
8611 <small>@Translate("Stock") @stock</small>
8612 }
8613
8614 <script>
8615 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}';
8616 variantsCollection.push(variants);
8617 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" );
8618 </script>
8619 }
8620 else
8621 {
8622 <div class="use-btn-height" style="background-color: #a8a8a8"></div>
8623 }
8624 }
8625 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
8626
8627 @* Component *@
8628
8629 @helper RenderAddToCart(AddToCart settings)
8630 {
8631 //set Id for quantity selector to get it's value from button
8632 if (settings.QuantitySelector != null)
8633 {
8634 if (string.IsNullOrEmpty(settings.QuantitySelector.Id))
8635 {
8636 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N");
8637 }
8638
8639 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id;
8640
8641 if (settings.Disabled)
8642 {
8643 settings.QuantitySelector.Disabled = true;
8644 }
8645
8646 if (string.IsNullOrEmpty(settings.QuantitySelector.Name))
8647 {
8648 settings.QuantitySelector.Name = settings.QuantitySelector.Id;
8649 }
8650 }
8651
8652 if (settings.Disabled)
8653 {
8654 settings.AddButton.Disabled = true;
8655 }
8656
8657 settings.AddButton.CssClass += " btn--condensed";
8658
8659 //unitsSelector
8660 if (settings.UnitSelector != null)
8661 {
8662 if (settings.Disabled)
8663 {
8664 settings.QuantitySelector.Disabled = true;
8665 }
8666 }
8667
8668 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
8669 @if (settings.UnitSelector != null)
8670 {
8671 @Render(settings.UnitSelector)
8672 }
8673 @if (settings.QuantitySelector != null)
8674 {
8675 @Render(settings.QuantitySelector)
8676 }
8677 @Render(settings.AddButton)
8678 </div>
8679 }
8680 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
8681
8682 @* Component *@
8683
8684 @helper RenderAddToCartButton(AddToCartButton settings)
8685 {
8686 if (!settings.HideTitle)
8687 {
8688 if (string.IsNullOrEmpty(settings.Title))
8689 {
8690 if (settings.BuyForPoints)
8691 {
8692 settings.Title = Translate("Buy with points");
8693 }
8694 else
8695 {
8696 settings.Title = Translate("Add to cart");
8697 }
8698 }
8699 }
8700 else
8701 {
8702 settings.Title = "";
8703 }
8704
8705 if (settings.Icon == null)
8706 {
8707 settings.Icon = new Icon();
8708 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After;
8709 }
8710
8711 if (string.IsNullOrEmpty(settings.Icon.Name))
8712 {
8713 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue;
8714 }
8715
8716 settings.OnClick = "Cart.AddToCart(event, { " +
8717 "id: '" + settings.ProductId + "'," +
8718 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") +
8719 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") +
8720 (settings.BuyForPoints ? "buyForPoints: true," : "") +
8721 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") +
8722 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") +
8723 "});" + settings.OnClick;
8724
8725 @RenderButton(settings)
8726 }
8727 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
8728
8729 @* Component *@
8730
8731 @helper RenderUnitSelector(UnitSelector settings)
8732 {
8733 if (string.IsNullOrEmpty(settings.Id))
8734 {
8735 settings.Id = Guid.NewGuid().ToString("N");
8736 }
8737 var disabledClass = settings.Disabled ? "disabled" : "";
8738
8739 <input type="checkbox" id="@settings.Id" class="dropdown-trigger" />
8740 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)>
8741 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@settings.Id">@settings.SelectedOption</label>
8742 <div class="dropdown__content dw-mod">
8743 @settings.OptionsContent
8744 </div>
8745 <label class="dropdown-trigger-off" for="@settings.Id"></label>
8746 </div>
8747 }
8748 @using System.Reflection
8749 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
8750
8751 @* Component *@
8752
8753 @helper RenderQuantitySelector(QuantitySelector settings)
8754 {
8755 var attributes = new Dictionary<string, string>();
8756
8757 /*base settings*/
8758 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); }
8759 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); }
8760 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); }
8761 if (settings.Disabled) { attributes.Add("disabled", "true"); }
8762 if (settings.Required) { attributes.Add("required", "true"); }
8763 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); }
8764 /*end*/
8765
8766 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); }
8767 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); }
8768 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); }
8769 if (settings.ReadOnly) { attributes.Add("readonly", "true"); }
8770 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); }
8771 if (settings.Min == null) { settings.Min = 1; }
8772 attributes.Add("min", settings.Min.ToString());
8773 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); }
8774 if (settings.Value == null) { settings.Value = 1; }
8775 attributes.Add("value", settings.Value.ToString());
8776 attributes.Add("type", "number");
8777
8778 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
8779
8780 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" />
8781 }
8782 @using Dynamicweb.Rapido.Blocks.Components
8783
8784 @using Dynamicweb.Frontend
8785 @using Dynamicweb.Frontend.Devices
8786 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce
8787 @using Dynamicweb.Rapido.Blocks.Components.General
8788 @using System.Collections.Generic;
8789
8790 @* Component *@
8791
8792 @helper RenderCustomerCenterList(CustomerCenterList settings)
8793 {
8794 bool isTouchDevice = Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet" ? true : false;
8795 string hideActions = isTouchDevice ? "u-block" : "";
8796
8797 <table class="table data-list dw-mod">
8798 @if (settings.GetHeaders().Length > 0) {
8799 <thead>
8800 <tr class="u-bold">
8801 @foreach (CustomerCenterListHeaderItem header in settings.GetHeaders())
8802 {
8803 var attributes = new Dictionary<string, string>();
8804 if (!string.IsNullOrEmpty(header.Id)) { attributes.Add("id", header.Id); }
8805 if (!string.IsNullOrEmpty(header.CssClass)) { attributes.Add("class", header.CssClass); }
8806 attributes.Add("align", header.Align.ToString());
8807 attributes = attributes.Concat(header.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
8808
8809 <td @ComponentMethods.AddAttributes(attributes)>@header.Title</td>
8810 }
8811 </tr>
8812 </thead>
8813 }
8814 @foreach (CustomerCenterListItem listItem in settings.GetItems())
8815 {
8816 int columnCount = 0;
8817 int totalColumns = listItem.GetInfoItems().Length;
8818 string rowHasActions = listItem.GetActions().Length > 0 ? "data-list__item--has-actions" : "";
8819 listItem.Id = !string.IsNullOrEmpty(listItem.Id) ? listItem.Id : Guid.NewGuid().ToString("N");
8820
8821 var attributes = new Dictionary<string, string>();
8822 if (!string.IsNullOrEmpty(listItem.Title)) { attributes.Add("title", listItem.Title); };
8823
8824 attributes = attributes.Concat(listItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
8825 <tbody class="data-list__item @rowHasActions @listItem.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes)>
8826 <tr>
8827 @if (!string.IsNullOrEmpty(listItem.Title) || !string.IsNullOrEmpty(listItem.Description)) {
8828 string onClick = !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : "";
8829
8830 <td rowspan="2" @onClick class="data-list__main-item dw-mod">
8831 @if (!string.IsNullOrEmpty(listItem.Title)) {
8832 <div class="u-bold">@listItem.Title</div>
8833 }
8834 @if (!string.IsNullOrEmpty(listItem.Description)) {
8835 <div>@listItem.Description</div>
8836 }
8837 </td>
8838 }
8839
8840 @foreach (CustomerCenterListInfoItem infoItem in listItem.GetInfoItems())
8841 {
8842 var infoAttributes = new Dictionary<string, string>();
8843 if (!string.IsNullOrEmpty(infoItem.Id)) { infoAttributes.Add("id", infoItem.Id); };
8844 if (!string.IsNullOrEmpty(infoItem.OnClick)) { infoAttributes.Add("onclick", infoItem.OnClick); };
8845 infoAttributes.Add("align", infoItem.Align.ToString());
8846
8847 infoAttributes = infoAttributes.Concat(infoItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value);
8848 string columnClick = columnCount < (totalColumns-1) && !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : "";
8849
8850 <td @ComponentMethods.AddAttributes(infoAttributes) @columnClick class="data-list__info-item dw-mod">
8851 @if (!string.IsNullOrEmpty(infoItem.Title)) {
8852 <div>@infoItem.Title</div>
8853 }
8854 @if (!string.IsNullOrEmpty(infoItem.Subtitle)) {
8855 <div><small>@infoItem.Subtitle</small></div>
8856 }
8857 </td>
8858
8859 columnCount++;
8860 }
8861 </tr>
8862 <tr>
8863 <td colspan="@columnCount" align="right" class="u-va-bottom u-no-border">
8864 <div class="data-list__actions @hideActions dw-mod" id="ActionsMenu_@listItem.Id">
8865 @foreach (ButtonBase action in listItem.GetActions())
8866 {
8867 action.ButtonLayout = ButtonLayout.LinkClean;
8868 action.Icon.CssClass += " u-full-height";
8869 action.CssClass += " data-list__action-button link";
8870
8871 @Render(action)
8872 }
8873 </div>
8874 </td>
8875 </tr>
8876 </tbody>
8877 }
8878 </table>
8879 }
8880 @using System.Reflection
8881 @using Dynamicweb.Rapido.Blocks.Components
8882 @using Dynamicweb.Rapido.Blocks.Components.Articles
8883 @using Dynamicweb.Rapido.Blocks
8884
8885
8886 @functions{
8887
8888 public class DF_ItemListField : ComponentBase
8889 {
8890 public int[] itemList {get; set;}
8891 public string itemListDisplay {get; set;}
8892 public string itemLabel {get; set;}
8893 }
8894
8895 }
8896
8897 @helper RenderDF_ItemListField(DF_ItemListField settings)
8898 {
8899 if(settings.itemList != null)
8900 {
8901 int[] itemList = settings.itemList;
8902 string itemLabel = settings.itemLabel;
8903 string itemListDisplay = settings.itemListDisplay != null ? settings.itemListDisplay: "linkList";
8904 var pageService = Dynamicweb.Extensibility.ServiceLocator.Current.GetInstance<Dynamicweb.Content.IPageService>();
8905 var pages = pageService.GetPages(itemList);
8906
8907 if(pages.Any())
8908 {
8909 <div class="grid__col-md-4 grid__col-sm-12 u-margin-bottom">
8910 <div class="u-bold">@itemLabel</div>
8911 <ul>
8912 @foreach(var page in pages)
8913 {
8914 if(page != null)
8915 {
8916 <li><a href="/Default.aspx?ID=@page.ID">@page.MenuText</a></li>
8917 }
8918 }
8919 </ul>
8920 </div>
8921
8922 }
8923 }
8924 }
8925
8926 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
8927
8928 @using System
8929 @using System.Web
8930 @using System.Collections.Generic
8931 @using Dynamicweb.Rapido.Blocks.Extensibility
8932 @using Dynamicweb.Rapido.Blocks
8933
8934 @{
8935 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master");
8936
8937 Block primaryBottomSnippets = new Block()
8938 {
8939 Id = "MasterJavascriptInitializers",
8940 SortId = 100,
8941 Template = RenderPrimaryBottomSnippets()
8942 };
8943 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets);
8944
8945 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed())
8946 {
8947 Block miniCartPageId = new Block
8948 {
8949 Id = "MiniCartPageId",
8950 Template = RenderMiniCartPageId()
8951 };
8952 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, miniCartPageId);
8953 }
8954 }
8955
8956 @helper RenderPrimaryBottomSnippets()
8957 {
8958 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode");
8959 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
8960
8961 //if (isWireframeMode)
8962 //{
8963 //<script>
8964 //Wireframe.Init(true);
8965 //</script>
8966 //}
8967
8968
8969 if (useGoogleTagManager)
8970 {
8971 <script>
8972 document.addEventListener('addToCart', function(event) {
8973 var googleImpression = JSON.parse(event.detail.productInfo.googleImpression);
8974 if (typeof googleImpression == "string") {
8975 googleImpression = JSON.parse(event.detail.productInfo.googleImpression);
8976 }
8977 dataLayer.push({
8978 'event': 'addToCart',
8979 'ecommerce': {
8980 'currencyCode': googleImpression.currency,
8981 'add': {
8982 'products': [{
8983 'name': googleImpression.name,
8984 'id': googleImpression.id,
8985 'price': googleImpression.price,
8986 'brand': googleImpression.brand,
8987 'category': googleImpression.category,
8988 'variant': googleImpression.variant,
8989 'quantity': event.detail.quantity
8990 }]
8991 }
8992 }
8993 });
8994 });
8995 </script>
8996 }
8997
8998 //if digitalwarehouse
8999 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"))
9000 {
9001 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]);
9002
9003 if (string.IsNullOrEmpty(cartContextId))
9004 {
9005 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2");
9006 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps);
9007 cartContextId = cartSettings.OrderContextID;
9008 HttpContext.Current.Application["DownloadCartContext"] = cartContextId;
9009 }
9010
9011 <script>
9012 let downloadCart = new DownloadCart({
9013 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"),
9014 contextId: "@cartContextId",
9015 addButtonText: "@Translate("Add")",
9016 removeButtonText: "@Translate("Remove")"
9017 });
9018 </script>
9019 }
9020
9021 <!--$$Javascripts-->
9022 }
9023
9024 @helper RenderMiniCartPageId()
9025 {
9026 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed");
9027 <script>
9028 window.cartId = "@miniCartFeedPageId";
9029 </script>
9030 }
9031 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
9032
9033 @using System
9034 @using System.Web
9035 @using System.Collections.Generic
9036 @using Dynamicweb.Rapido.Blocks
9037
9038 @{
9039 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master");
9040
9041 }
9042
9043 @* Include Replacement blocks *@
9044 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
9045
9046 @using System
9047 @using System.Web
9048 @using System.Collections.Generic
9049 @using Dynamicweb.Rapido.Blocks
9050 @using Dynamicweb.Rapido.Blocks.Extensibility
9051
9052 @{
9053
9054
9055 BlocksPage masterBlocksBlocksPage = BlocksPage.GetBlockPage("Master");
9056
9057
9058 //string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content");
9059 //string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content");
9060 //string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content");
9061 //string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header");
9062 //string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header");
9063 //string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header");
9064 IList<ItemViewModel> footerColumnOneLinks = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetItems("Pages");
9065 IList<ItemViewModel> footerColumnTwoLinks = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetItems("Pages");
9066 IList<ItemViewModel> footerColumnThreeLinks = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetItems("Pages");
9067
9068
9069 bool footerColumnOneHasLinks = footerColumnOneLinks != null && footerColumnOneLinks.Count > 0 ? true : false;
9070 bool footerColumnTwoHasLinks = footerColumnTwoLinks != null && footerColumnTwoLinks.Count > 0 ? true : false;
9071 bool footerColumnThreeHasLinks = footerColumnThreeLinks != null && footerColumnThreeLinks.Count > 0 ? true : false;
9072
9073
9074 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader) || footerColumnOneHasLinks)
9075 {
9076
9077 Block masterFooterColumnOne = new Block
9078 {
9079 Id = "MasterFooterColumnOne",
9080 SortId = 10,
9081 Template = RenderFooterColumnCustom(footerColumnOneHeader, footerColumnOneContent, footerColumnOneLinks),
9082 Design = new Design {
9083 Size = "auto",
9084 RenderType = RenderType.Column,
9085 CssClass = "footer__column-wrapper"
9086 }
9087 };
9088 masterBlocksBlocksPage.ReplaceBlock(masterFooterColumnOne);
9089 }
9090
9091 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader) )
9092 {
9093 Block masterFooterColumnTwo = new Block
9094 {
9095 Id = "MasterFooterColumnTwo",
9096 SortId = 20,
9097 Template = RenderFooterColumnCustom(footerColumnTwoHeader, footerColumnTwoContent, footerColumnTwoLinks),
9098 Design = new Design
9099 {
9100 Size = "auto",
9101 RenderType = RenderType.Column,
9102 CssClass = "footer__column-wrapper"
9103 }
9104 };
9105 masterBlocksBlocksPage.ReplaceBlock(masterFooterColumnTwo);
9106 }
9107
9108 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader))
9109 {
9110 Block masterFooterColumnThree = new Block
9111 {
9112 Id = "MasterFooterColumnThree",
9113 SortId = 30,
9114 Template = RenderFooterColumnUtilsCustom(footerColumnThreeHeader, footerColumnThreeContent, footerColumnThreeLinks),
9115 Design = new Design
9116 {
9117 Size = "auto",
9118 RenderType = RenderType.Column,
9119 CssClass = "footer__column-wrapper"
9120 }
9121 };
9122 masterBlocksBlocksPage.ReplaceBlock(masterFooterColumnThree);
9123 }
9124
9125 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp"))
9126 {
9127 Block masterFooterNewsletterSignUp = new Block
9128 {
9129 Id = "MasterFooterNewsletterSignUp",
9130 SortId = 2,
9131 Template = RenderFooterNewsletterSignUpCustom(),
9132 Design = new Design
9133 {
9134 Size = "auto",
9135 RenderType = RenderType.Column,
9136 CssClass = "footer__column-wrapper"
9137 }
9138 };
9139 // masterBlocksBlocksPage.ReplaceBlock(masterFooterNewsletterSignUp);
9140 }
9141
9142 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0)
9143 {
9144 Block masterFooterSocialLinks = new Block
9145 {
9146 Id = "MasterFooterSocialLinks",
9147 SortId = 1,
9148 Template = RenderFooterSocialLinksCustom(),
9149 Design = new Design
9150 {
9151 Size = "auto",
9152 RenderType = RenderType.Column,
9153 CssClass = "footer__column-wrapper"
9154 }
9155 };
9156 //masterBlocksBlocksPage.ReplaceBlock(masterFooterSocialLinks);
9157 }
9158
9159 // edit payments
9160 //if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0)
9161 //{
9162 //Block masterFooterPaymentsCustom = new Block
9163 //{
9164 //Id = "MasterFooterPayments",
9165 //SortId = 60,
9166 //Design = new Design
9167 //{
9168 //Size = "12",
9169 //RenderType = RenderType.Column
9170 //}
9171 //};
9172 //masterBlocksBlocksPage.ReplaceBlock(masterFooterPaymentsCustom);
9173 //}
9174
9175
9176 Block masterFooterCopyrightCustom = new Block
9177 {
9178 Id = "MasterFooterCopyright",
9179 SortId = 70,
9180 Template = RenderFooterCopyrightCustom(),
9181 Design = new Design
9182 {
9183 Size = "12",
9184 RenderType = RenderType.Column
9185 }
9186 };
9187 masterBlocksBlocksPage.ReplaceBlock(masterFooterCopyrightCustom);
9188 }
9189
9190 @helper RenderFooterColumnCustom(string header, string content, IList<ItemViewModel> links) {
9191 <h3 class="footer__heading dw-mod">@header<i class="icon--accordion fas fa-chevron-down"></i></h3>
9192 <div class="footer__content dw-mod">
9193 @if(links.Any()){
9194 <ul class="footer-links u-margin-bottom dw-mod">
9195 @foreach(var pageLink in links){
9196 string link = pageLink.GetString("Link");
9197 string title = pageLink.GetString("Title");
9198 string icon = pageLink.GetString("Icon");
9199 string newWindow = pageLink.GetBoolean("NewWindow") ? " target=\"_blank\"" : "";
9200 <li class="footer-links__item dw-mod">
9201 <a href="@link" @newWindow class="footer-links__link dw-mod">@icon @title</a>
9202 </li>
9203 }
9204 </ul>
9205 }else{
9206 @content
9207 }
9208 </div>
9209 }
9210
9211 @helper RenderFooterColumnUtilsCustom(string header, string content, IList<ItemViewModel> links) {
9212
9213 var termsAndConditionsDistributionPageId = GetPageIdByNavigationTag("TermsAndConditionsAgricoverDistribution");
9214 var termsAndConditionsTechnologyPageId = GetPageIdByNavigationTag("TermsAndConditionsAgricoverTechnology");
9215
9216 var termsAndConditionsDistributionPageUrl = $"/Default.aspx?ID={termsAndConditionsDistributionPageId}";
9217 var termsAndConditionsTechnologyPageUrl = $"/Default.aspx?ID={termsAndConditionsTechnologyPageId}";
9218
9219
9220 int currentPageId = Dynamicweb.Frontend.PageView.Current().Page.ID;
9221 var contextIdIngrasaminte = currentPageId == GetPageIdByNavigationTag("CartPageIngrasaminte") || currentPageId == termsAndConditionsTechnologyPageId;
9222 var checkGroupIdUrl = !string.IsNullOrEmpty(HttpContext.Current.Request["GroupID"]) ? HttpContext.Current.Request.QueryString.Get("GroupID") : ""; //ingrasaminte groupid => GROUP304
9223
9224
9225 var termsAndConditionsLinkDecision = checkGroupIdUrl == "GROUP304" || contextIdIngrasaminte ? termsAndConditionsTechnologyPageUrl : termsAndConditionsDistributionPageUrl;
9226
9227
9228 <h3 class="footer__heading dw-mod">@header<i class="icon--accordion fas fa-chevron-down"></i></h3>
9229 <div class="footer__content dw-mod">
9230 @if(links.Any()){
9231 <ul class="footer-links u-margin-bottom dw-mod">
9232 @foreach(var pageLink in links){
9233 string link = pageLink.GetString("Link");
9234 string title = pageLink.GetString("Title");
9235 string icon = pageLink.GetString("Icon");
9236 string newWindow = pageLink.GetBoolean("NewWindow") ? " target=\"_blank\"" : "";
9237 <li class="footer-links__item dw-mod">
9238 @if(pageLink.Id == "16") {
9239 <a href="@termsAndConditionsLinkDecision" @newWindow class="footer-links__link dw-mod">@icon @title</a>
9240 }
9241 else {
9242 <a href="@link" @newWindow class="footer-links__link dw-mod">@icon @title</a>
9243 }
9244 </li>
9245 }
9246 </ul>
9247 }else{
9248 @content
9249 }
9250
9251
9252 </div>
9253 }
9254
9255 @helper RenderFooterNewsletterSignUpCustom() {
9256 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString();
9257
9258 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3>
9259 <div class="footer__content dw-mod">
9260 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data">
9261 <input name="ID" value="@newsletterSignUpPageId" type="hidden" />
9262 <label for="NewsletterEmail" class="u-margin-bottom">@Translate("Sign up if you would like to receive occasional treats from us", "Sign up if you would like to receive occasional treats from us")</label>
9263 <div class="form__field-combi">
9264 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' class="u-full-width use-btn-primary-height" />
9265 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' />
9266 </div>
9267 </form>
9268 </div>
9269
9270
9271 }
9272
9273 @helper RenderFooterSocialLinksCustom() {
9274 string logoFooter = Model.Area.Item.GetItem("Custom").GetFile("WhiteLogoImage") != null ? Model.Area.Item.GetItem("Custom").GetFile("WhiteLogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png";
9275
9276 if (Path.GetExtension(logoFooter).ToLower() != ".svg")
9277 {
9278 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight");
9279 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40;
9280 logoFooter = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&crop=5&Compression=75&image=" + logoFooter;
9281 }
9282 else
9283 {
9284 logoFooter = HttpUtility.UrlDecode(logoFooter);
9285 }
9286
9287 <div class="footer_logo__wrapper">
9288 <img src="@logoFooter" alt='@Translate("Logo")' />
9289 </div>
9290 <div class="footer__content dw-mod">
9291 <div class="collection dw-mod">
9292 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks"))
9293 {
9294 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel;
9295 string socialIconClass = socialIcon.SelectedValue;
9296 string socialIconTitle = socialIcon.SelectedName;
9297 string socialLink = socialitem.GetString("Link");
9298
9299 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a>
9300 }
9301 </div>
9302 </div>
9303 }
9304
9305 @helper RenderFooterCopyrightCustom() {
9306 <div class="grid__col-12 footer__copyright dw-mod">
9307 <p class="u--heading-sans u-ta-center">@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p>
9308 </div>
9309 }
9310 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
9311
9312 @using System
9313 @using System.Web
9314 @using System.Collections.Generic
9315 @using Dynamicweb.Rapido.Blocks
9316 @using Dynamicweb.Rapido.Blocks.Extensibility
9317 @using Dynamicweb.Security.UserManagement
9318 @using Dynamicweb.Security.UserManagement.ExternalAuthentication
9319 @{
9320 Block loginModalCustom = new Block()
9321 {
9322 Id = "LoginModal",
9323 SortId = 10,
9324 Template = LoginModalCustom()
9325 };
9326
9327 loginBlocksPage.ReplaceBlock(loginModalCustom);
9328 }
9329
9330 @helper LoginModalCustom() {
9331 int pageId = Model.TopPage.ID;
9332 string productPage = GetPageIdByNavigationTag("ProductsPage").ToString();
9333 string userSignedInError = !Model.LogOnFailed ? "" : "checked";
9334 string userSignedInErrorText = "";
9335 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage");
9336 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery";
9337 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount");
9338 bool isCartPage = GetPageIdByNavigationTag("CartPage") == pageId ? true : false;
9339 string redirectToDashboard = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=" + GetPageIdByNavigationTag("CustomerDashboard"));
9340 string redirectDecision = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ProductID")) || !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("GroupID")) || isCartPage || HttpContext.Current.Request.Url.AbsoluteUri.Contains(productPage) ? "" : redirectToDashboard;
9341
9342 if (Model.LogOnFailed) {
9343 switch (Model.LogOnFailedReason)
9344 {
9345 case LogOnFailedReason.PasswordLengthInvalid:
9346 userSignedInErrorText = Translate("Password length is invalid");
9347 break;
9348 case LogOnFailedReason.IncorrectLogin:
9349 userSignedInErrorText = Translate("Invalid email or password");
9350 break;
9351 case LogOnFailedReason.ExceededFailedLogOnLimit:
9352 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked");
9353 break;
9354 case LogOnFailedReason.LoginLocked:
9355 userSignedInErrorText = Translate("The user account is temporarily locked");
9356 break;
9357 case LogOnFailedReason.PasswordExpired:
9358 userSignedInErrorText = Translate("The password has expired and needs to be renewed");
9359 break;
9360 default:
9361 userSignedInErrorText = Translate("An unknown error occured");
9362 break;
9363 }
9364 }
9365
9366 <!-- Trigger for the login modal -->
9367 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError />
9368
9369 <!-- Login modal -->
9370 <div class="modal-container">
9371 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label>
9372 <div class="modal modal--md" id="SignInModal">
9373 <div class="modal__header no-border">
9374 <button type="button" class="close btn btn--primary dw-mod u-margin-top--lg"><i class="fas fa-times"></i></button>
9375 <div class="u-bold u-ta-center">@Translate("Sign in")</div>
9376 </div>
9377 <div class="modal__body">
9378 <form method="post" id="LoginForm" class="u-no-margin">
9379 <input type="hidden" name="ID" value="@pageId" />
9380 <input type="hidden" name="DWExtranetUsernameRemember" value="True" />
9381 <input type="hidden" name="DWExtranetPasswordRemember" value="True" />
9382 @if(redirectDecision!=""){
9383 <input type="hidden" name="redirect" value="@redirectDecision">
9384 }
9385 @* <label for="username">@Translate("Email")</label> *@
9386 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email")" />
9387
9388 @* <label for="password">@Translate("Password")</label> *@
9389 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" />
9390 <div class="field-error dw-mod">@userSignedInErrorText</div>
9391
9392 <div class="form__field-group dw-mod">
9393 <input type="checkbox" id="LoginRememberMe" name="Autologin" checked="checked" value="True" class="form__control">
9394 <label for="LoginRememberMe">
9395 @Translate("Remember me", "Remember me")
9396 </label>
9397 </div>
9398
9399 <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?")</a>
9400
9401 <button type="submit" class="btn btn--primary btn--full dw-mod u-margin-top--lg" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button>
9402 @{
9403 ProviderCollection providers = Provider.GetActiveProviders();
9404 }
9405
9406 @foreach(Provider LoginProvider in providers)
9407 {
9408 var ProviderName = LoginProvider.Name.ToLower();
9409 <a href="/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=@LoginProvider.ID" title="@LoginProvider.Name" class="btn btn--clean btn--condensed u-color-@ProviderName dw-mod"><i class="fab fa-@ProviderName fa-1_5x"></i></a>
9410 }
9411
9412
9413 <div class="dw-mod u-margin-top--lg">
9414 <div class="u-ta-center u-margin-bottom--lg">
9415 <h5 class="u-no-margin">@Translate("No Idera account?")</h5>
9416 <p class="u-no-margin" style="font-size: 13px;">@Translate("Follow the steps and become a member today")</p>
9417 </div>
9418 <a class="btn btn--primary btn--full dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")</a>
9419 </div>
9420 </form>
9421 </div>
9422 </div>
9423 </div>
9424 }
9425
9426 @* Include New blocks *@
9427 @*Include("NewBlocks/Promotion.cshtml")*@
9428 @using Dynamicweb.Content
9429
9430
9431 @{
9432 //BlocksPage masterBlocksBlocksPage = BlocksPage.GetBlockPage("Master");
9433
9434 Block megaMenu = new Block
9435 {
9436 Id = "MegaMenu",
9437 SortId = 100,
9438 Template = RenderMegaMenu()
9439 };
9440 masterBlocksBlocksPage.Add(MasterBlockId.MasterFooter, megaMenu);
9441 }
9442
9443 @helper RenderMegaMenu(){
9444 int megaMenuPage = GetPageIdByNavigationTag("MenuConfiguration");
9445 if(megaMenuPage > 0){
9446 <div class="hidden">
9447 @RenderPageContent(@megaMenuPage)
9448 </div>
9449 }
9450 }
9451
9452 @*Include("NewBlocks/FooterPayments.cshtml")*@
9453
9454
9455 @functions {
9456 public class ManifestIcon
9457 {
9458 public string src { get; set; }
9459 public string type { get; set; }
9460 public string sizes { get; set; }
9461 }
9462
9463 public class Manifest
9464 {
9465 public string name { get; set; }
9466 public string short_name { get; set; }
9467 public string start_url { get; set; }
9468 public string display { get; set; }
9469 public string background_color { get; set; }
9470 public string theme_color { get; set; }
9471 public List<ManifestIcon> icons { get; set; }
9472 }
9473 }
9474
9475 <!DOCTYPE html>
9476
9477 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">
9478
9479
9480
9481 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@
9482 @RenderBlockList(masterPage.BlocksRoot.BlocksList)
9483
9484
9485
9486 @helper RenderMasterHead() {
9487 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList();
9488
9489 <head>
9490 <!-- Rapido version 3.3 -->
9491
9492 @RenderBlockList(subBlocks)
9493 </head>
9494 }
9495
9496 @helper RenderMasterMetadata() {
9497 var swatches = new Dynamicweb.Content.Items.ColorSwatchService();
9498 var brandColors = swatches.GetColorSwatch(1);
9499 string brandColorOne = brandColors.Palette["BrandColor1"];
9500
9501 var productParameter = System.Web.HttpContext.Current.Request["ProductID"];
9502 productParameter = productParameter != null ? productParameter.ToString() : string.Empty;
9503
9504
9505 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) {
9506 Manifest manifest = new Manifest
9507 {
9508 name = Model.Area.Item.GetItem("Settings").GetString("AppName"),
9509 short_name = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppShortName")) ? Model.Area.Item.GetItem("Settings").GetString("AppShortName") : Model.Area.Item.GetItem("Settings").GetString("AppName"),
9510 start_url = "/",
9511 display = "standalone",
9512 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"),
9513 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor")
9514 };
9515
9516 manifest.icons = new List<ManifestIcon> {
9517 new ManifestIcon {
9518 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
9519 sizes = "192x192",
9520 type = "image/png"
9521 },
9522 new ManifestIcon {
9523 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
9524 sizes = "512x512",
9525 type = "image/png"
9526 },
9527 new ManifestIcon {
9528 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded,
9529 sizes = "1024x1024",
9530 type = "image/png"
9531 }
9532 };
9533
9534 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json");
9535 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest);
9536 string currentManifest = File.ReadAllText(manifestFilePath);
9537
9538 if (manifestJSON != currentManifest)
9539 {
9540 File.WriteAllText(manifestFilePath, manifestJSON);
9541 }
9542 }
9543
9544 //rules for canonical or no index
9545 string index = "index";
9546 string follow = "follow";
9547 if(!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("SortBy")))
9548 {
9549 index = "noindex";
9550 follow = "nofollow";
9551 }
9552
9553 string pageId = Pageview.ID.ToString();
9554 string manufacturerPageID = GetPageIdByNavigationTag("Producator").ToString();
9555
9556 <meta charset="utf-8" />
9557 <title>@Model.Title</title>
9558 <meta name="viewport" content="width=device-width, initial-scale=1.0">
9559 <meta name="robots" content="@index, @follow">
9560 <meta name="theme-color" content="@brandColorOne" />
9561 <meta name="google-site-verification" content="fOnOkTFsVxit3eqaNeScNIwNJot3ZDCbp6Enp1F5Kvc" />
9562 <meta name="facebook-domain-verification" content="wyf89bmetllx8aqb50gbuvmkob2g06" />
9563 if (!Model.MetaTags.Contains("og:image")) {
9564 Pageview.Meta.AddTag("og:image", string.Format("{0}://{1}{2}", Dynamicweb.Context.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, Model.PropertyItem.GetFile("OpenGraphImage")));
9565 }
9566
9567 if (!Model.MetaTags.Contains("og:description")) {
9568 Pageview.Meta.AddTag("og:description", Model.Description);
9569 }
9570 if (productParameter == string.Empty && pageId != manufacturerPageID)
9571 {
9572 Pageview.Meta.AddTag("og:title", Model.Title);
9573 }
9574
9575 Pageview.Meta.AddTag("og:site_name", Model.Name);
9576 Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString());
9577 Pageview.Meta.AddTag("og:type", "Website");
9578 Pageview.Meta.AddTag("fb:page_id", Model.ID.ToString());
9579
9580 @Model.MetaTags
9581 }
9582
9583 @helper RenderMasterCss() {
9584 var fonts = new string[] {
9585 getFontFamily("Layout", "HeaderFont"),
9586 getFontFamily("Layout", "SubheaderFont"),
9587 getFontFamily("Layout", "TertiaryHeaderFont"),
9588 getFontFamily("Layout", "BodyText"),
9589 getFontFamily("Layout", "Header", "ToolsFont"),
9590 getFontFamily("Layout", "Header", "NavigationFont"),
9591 getFontFamily("Layout", "MobileNavigation", "Font"),
9592 getFontFamily("ProductList", "Facets", "HeaderFont"),
9593 getFontFamily("ProductPage", "PriceFontDesign"),
9594 getFontFamily("Ecommerce", "SaleSticker", "Font"),
9595 getFontFamily("Ecommerce", "NewSticker", "Font"),
9596 getFontFamily("Ecommerce", "CustomSticker", "Font")
9597 };
9598
9599 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks;
9600 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png";
9601 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro");
9602 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css";
9603 if (useFontAwesomePro)
9604 {
9605 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css";
9606 }
9607
9608 //Favicon
9609 <link href="@favicon" rel="icon" type="image/png">
9610
9611 //Base (Default, wireframe) styles
9612 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css">
9613 @*<link rel="preload" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
9614 <noscript><link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css"></noscript>*@
9615
9616 //Rapido Css from Website Settings
9617 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css">
9618 @*<link rel="preload" href="@autoCssLink" as="style" onload="this.onload=null;this.rel='stylesheet'">
9619 <noscript><link rel="stylesheet" id="rapidoCss" href="@autoCssLink"></noscript>*@
9620
9621 bool debugLive = !string.IsNullOrEmpty(HttpContext.Current.Request["debuglive"]) ? true : false;
9622 if (!debugLive)
9623 {
9624 //Ignite Css (Custom site specific styles)
9625 <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css?v=90">
9626 @*<link rel="preload" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css?v=67" as="style" onload="this.onload=null;this.rel='stylesheet'">
9627 <noscript><link rel="stylesheet" id="igniteCss" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css?v=68"></noscript>*@
9628
9629 <link rel="preload" href="/Files/Templates/Designs/Rapido/css/ignite/print.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
9630 <noscript><link rel="stylesheet" id="igniteCss" href="/Files/Templates/Designs/Rapido/css/ignite/print.css"></noscript>
9631
9632 } else {
9633 @* <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/dist/app.bundle.css?v=1"> *@
9634 <link rel="preload" href="/Files/Templates/Designs/Rapido/dist/app.bundle.css?v=3" as="style" onload="this.onload=null;this.rel='stylesheet'">
9635 <noscript><link rel="stylesheet" id="igniteCss" href="/Files/Templates/Designs/Rapido/dist/app.bundle.css?v=3"></noscript>
9636 }
9637
9638
9639 <link rel="preload" href="/Files/Templates/Designs/Rapido/css/custom.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
9640
9641 //Font awesome
9642 @*<link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css">*@
9643 <link rel="preload" href="@fontAwesomeCssLink" as="style" onload="this.onload=null;this.rel='stylesheet'">
9644 <noscript><link rel="stylesheet" href="@fontAwesomeCssLink"></noscript>
9645
9646 //Flag icon
9647 @*<link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css">*@
9648 <link rel="preload" href="/Files/Templates/Designs/AgricoverCorporate/css/fonts/flag-icon.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
9649 <noscript><link rel="stylesheet" href="/Files/Templates/Designs/AgricoverCorporate/css/fonts/flag-icon.min.css"></noscript>
9650
9651 //Google fonts
9652 var family = string.Join("%7C", fonts.Where(x => !string.IsNullOrEmpty(x)).Distinct().Select(x => string.Format("{0}:100,200,300,400,500,600,700,800,900", x)));
9653
9654 @*<link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet">*@
9655 <link rel="preload" href="https://fonts.googleapis.com/css?family=@family&display=swap" as="style" onload="this.onload=null;this.rel='stylesheet'">
9656 <noscript><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=@family&display=swap"></noscript>
9657
9658 PushPromise(favicon);
9659 PushPromise(fontAwesomeCssLink);
9660 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css");
9661 PushPromise(autoCssLink);
9662 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css?v=50");
9663 PushPromise("/Files/Images/placeholder.gif");
9664 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css");
9665 }
9666
9667 @helper RenderMasterManifest() {
9668 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")))
9669 {
9670 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json">
9671 PushPromise("/Files/Templates/Designs/Rapido/manifest.json");
9672 }
9673 }
9674
9675 @helper RenderMasterBody() {
9676 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList();
9677 string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : "";
9678 if (!String.IsNullOrEmpty(designLayout)) {
9679 designLayout = "class=\"" + designLayout + "\"";
9680 }
9681
9682 <body @designLayout>
9683 @RenderBlockList(subBlocks)
9684
9685 @{
9686 bool consentIsGranted = System.Web.HttpContext.Current.Request?.Cookies["Dynamicweb.CookieOptInLevel"]?.Value == "2";
9687 }
9688 @if (consentIsGranted)
9689 {
9690 <script>
9691 document.addEventListener("DOMContentLoaded", function() {
9692 consentGranted();
9693 });
9694 function consentGranted() {
9695 gtag('consent', 'update', {
9696 'ad_storage': 'granted',
9697 'ad_user_data': 'granted',
9698 'ad_personalization': 'granted',
9699 'analytics_storage': 'granted',
9700 'functionality_storage': 'granted',
9701 'personalization_storage': 'granted',
9702 'security_storage': 'granted'
9703 });
9704 }
9705 </script>
9706 }
9707
9708
9709 </body>
9710 }
9711
9712 @helper RenderMasterHeader()
9713 {
9714 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList();
9715 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");
9716 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : "";
9717
9718 <header class="top-container @stickyTop dw-mod" id="Top">
9719 @RenderBlockList(subBlocks)
9720 </header>
9721 }
9722
9723 @helper RenderMain()
9724 {
9725 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList();
9726
9727 <main class="site dw-mod">
9728 @RenderBlockList(subBlocks)
9729 </main>
9730 }
9731
9732 @helper RenderPageContent()
9733 {
9734 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop");
9735 string pagePos = isNavigationStickyMenu ? "js-page-pos" : "";
9736
9737 <div id="Page" class="page @pagePos">
9738 <div id="content">
9739 @RenderSnippet("Content")
9740 </div>
9741 </div>
9742 }
9743
9744 @* Hack to support nested helpers *@
9745 @SnippetStart("Content")
9746 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
9747
9748
9749
9750 @* Render the grid *@
9751 @Model.Grid("Grid", "Grid", "default:true;sort:1", "Pages")
9752
9753 @SnippetEnd("Content")
9754
9755
9756 @{
9757
9758 var phone = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("ContactNumber")) ? Model.Area.Item.GetItem("Settings").GetString("ContactNumber") : "";
9759 var name = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetItem("Address").GetString("Name")) ? Model.Area.Item.GetItem("Settings").GetItem("Address").GetString("Name") : "";
9760 var country = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetItem("Address").GetString("Country")) ? Model.Area.Item.GetItem("Settings").GetItem("Address").GetString("Country") : "";
9761 var city = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetItem("Address").GetString("City")) ? Model.Area.Item.GetItem("Settings").GetItem("Address").GetString("City") : "";
9762 var region = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetItem("Address").GetString("Region")) ? Model.Area.Item.GetItem("Settings").GetItem("Address").GetString("Region") : "";
9763 var postalCode = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetItem("Address").GetString("PostalCode")) ? Model.Area.Item.GetItem("Settings").GetItem("Address").GetString("PostalCode") : "";
9764 var street = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetItem("Address").GetString("StreetAddress")) ? Model.Area.Item.GetItem("Settings").GetItem("Address").GetString("StreetAddress") : "";
9765 var image = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetFile("BusinessPhoto").Path) ? Model.Area.Item.GetItem("Settings").GetFile("BusinessPhoto").Path : "";
9766 var logoImage = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetFile("BusinessLogo").Path) ? Model.Area.Item.GetItem("Settings").GetFile("BusinessLogo").Path : "";
9767 var url = Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host;
9768 }
9769
9770
9771 @if(currentPageId == contactPageId) {
9772
9773 // Schema LocalBusiness
9774 <script type="application/ld+json">
9775 {
9776 "@@context": "https://schema.org",
9777 "@@type": "LocalBusiness",
9778 "name": "@name",
9779 "image": "@image",
9780 "@@id": "@url",
9781 "url": "@url",
9782 "telephone": "@phone",
9783 "address": {
9784 "@@type": "PostalAddress",
9785 "streetAddress": "@street",
9786 "addressLocality": "@city",
9787 "postalCode": "",
9788 "addressCountry": "RO"
9789 }
9790 }
9791 </script>
9792 }
9793
9794
9795 @if(currentPageId == homePageId) {
9796 // Schema Website
9797 <script type="application/ld+json">
9798 {
9799 "@@context": "https://schema.org",
9800 "@@type": "WebSite",
9801 "url": "@url",
9802 "potentialAction": {
9803 "@@type": "SearchAction",
9804 "target": "@url/search?&q={query}",
9805 "query": "required"
9806 }
9807 }
9808 </script>
9809
9810 // Schema Organization
9811 <script type="application/ld+json">
9812 { "@@context" : "https://schema.org",
9813 "@@type" : "Organization",
9814 "url" : "@url",
9815 "contactPoint" : [
9816 {
9817 "@@type" : "ContactPoint",
9818 "telephone" : "@phone",
9819 "contactType" : "customer service"
9820 }
9821 ]}
9822 </script>
9823 }
9824
9825 </html>
9826
9827
9828
9829
9830