adminDashboardWidget.ftl
1 <#-- Macro: adminDashboardWidget
2 Description: Generates a widget for use in the admin dashboard. It generates a Bootstrap card that includes a header with a title and control buttons, and a body that can display any content.
3 Parameters:
4 - id (string, required): the ID of the widget.
5 - title (string, required): the title to display in the widget header.
6 - color (string, optional): the color of the widget header, using a Bootstrap color class (e.g. "primary", "success", "danger").
7 - url (string, optional): the URL of a settings page for the widget.
8 - class (string, optional): the class to apply to the widget element.
9 - bodyClass (string, optional): the class to apply to the widget body element.
10 - params (string, optional): additional parameters to add to the widget element.
11 -->
12 <#macro adminDashboardWidget id title hasHeader=false sm=12 md=4 color='primary' url='' class='' bodyClass='table-responsive no-padding' actions=true actionMenu='' params=''>
13 <@columns sm=sm! md=md! class='widget-col' id='zone-${id!}'>
14 <@box style='solid' color='${color}' id='${id}_dashboard_card' class='box-widget' params=' data-id="${id}" draggable="true"'>
15 <#if hasHeader>
16 <@boxHeader titleLevel='h3' title=title! titleActions=actions>
17 <div class="dropdown">
18 <a href="#" class="btn-action" data-bs-toggle="dropdown">
19 <!-- Download SVG icon from http://tabler.io/icons/icon/dots-vertical -->
20 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-1">
21 <path d="M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path>
22 <path d="M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path>
23 <path d="M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path>
24 </svg>
25 </a>
26 <div class="dropdown-menu dropdown-menu-end">
27 <#if actionMenu!=''>${actionMenu!}</#if>
28 <#if url!=''><@aButton color='link' class='dropdown-item' href=url! title='#i18n{portal.util.labelModify}' /></#if>
29 <@button color='link' class='dropdown-item text-danger' style='card-control remove' buttonTargetId='#${id}_dashboard_card' title='#i18n{portal.util.labelHide}' />
30 </div>
31 </div>
32 </@boxHeader>
33 </#if>
34 <@boxBody class=bodyClass id='${id}_dashboard_card_body'>
35 <#if !hasHeader><h3 class="card-title">${title}</h3></#if>
36 <@row>
37 <@columns>
38 <#nested>
39 </@columns>
40 <#if !hasHeader && actionMenu !=''>
41 <@columns md=1>
42 <div class="dropdown ">
43 <a href="#" class="btn-action" data-bs-toggle="dropdown">
44 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-1">
45 <path d="M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path>
46 <path d="M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path>
47 <path d="M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path>
48 </svg>
49 </a>
50 <div class="dropdown-menu dropdown-menu-end">
51 ${actionMenu!}
52 </div>
53 </div>
54 </@columns>
55 </#if>
56 </@row>
57 </@boxBody>
58 </@box>
59 </@columns>
60 </#macro>