### Timeline Time Hint Display Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/day/DayShow.html Displays the start and end times for timeline entries if they are not already marked as occupied in the hour. This helps in visualizing the distribution of activities throughout the day. ```smarty {if ($checkin->id || $checkin->isTrace) && floor($checkin->min/60)<23 && empty($\_timeline\_time\_hints\_occupation\_by\_hr[ floor($checkin->min/$\_mins\_in\_hr) ]) && empty($\_timeline\_time\_hints\_occupation\_by\_hr[ floor($checkin->min/$\_mins\_in\_hr)-1 ]) && empty($\_timeline\_time\_hints\_occupation\_by\_hr[ floor($checkin->min/$\_mins\_in\_hr)+1 ]) && empty($\_timeline\_time\_hints\_occupation\_by\_hr[ floor($checkin->min/$\_mins\_in\_hr)-2 ]) && empty($\_timeline\_time\_hints\_occupation\_by\_hr[ floor($checkin->min/$\_mins\_in\_hr)+2 ])} {statusTimeHelper::renderIntAsHHMMTime($checkin->min)} {$\_timeline\_time\_hints\_occupation\_by\_hr[ floor($checkin->min/$\_mins\_in\_hr) ] = 1} {/if} {if ($checkin->id || $checkin->isTrace) && empty($\_timeline\_time\_hints\_occupation\_by\_hr[ floor($checkin->max/$\_mins\_in\_hr) ]) && empty($\_timeline\_time\_hints\_occupation\_by\_hr[ floor($checkin->max/$\_mins\_in\_hr)-1 ]) && empty($\_timeline\_time\_hints\_occupation\_by\_hr[ floor($checkin->max/$\_mins\_in\_hr)+1 ]) && empty($\_timeline\_time\_hints\_occupation\_by\_hr[ floor($checkin->max/$\_mins\_in\_hr)-2 ]) && empty($\_timeline\_time\_hints\_occupation\_by\_hr[ floor($checkin->max/$\_mins\_in\_hr)+2 ])} {statusTimeHelper::renderIntAsHHMMTime($checkin->max)} {$\_timeline\_time\_hints\_occupation\_by\_hr[ floor($checkin->max/$\_mins\_in\_hr) ] = 1} {/if} ``` -------------------------------- ### Welcome Message for New Users Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/day/DayEditor.html Displays a welcome message and instructions for users who haven't made their first report. ```HTML/Smarty {if !$stts->getContextUser()->getLastCheckinDatetime()} 🎉   [`**Hello and welcome!** Add your first work report by **dragging the time slider** or by **selecting your daily status** in the menu so all your teammates get to know what you are up to on this day.`] {/if} ``` -------------------------------- ### Initializing Tooltip for Online Time Hint Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/week/WeekDonut.html Initializes a tooltip for an icon that provides a hint about online time tracking. This requires a specific HTML structure and a tooltip template. ```javascript $("#s-weekly-online-time-hint-icon-{$donut->weekNum}").waTooltip({ template: "#s-weekly-online-time-hint-body-{$donut->weekNum}", placement: "left" }); ``` -------------------------------- ### Iterating Through User Day Check-ins Source: https://github.com/1312inc/webasyst-status/blob/master/widgets/team/templates/DayInfo.html This snippet iterates through each user's check-in data for a given day. It calculates the density of check-ins and sets up tooltip content based on whether the check-in is a trace, has projects, or is a general log. ```html {foreach $dayDto->userDayInfos as $userDayInfo} {\* @var statusDayUserInfoDto $userDayInfo \*} {$\_timeline\_time\_hints\_occupation\_by\_hr = \[ \]}{\* \[h\] = 0/1 \*} {if $wa->isMobile()} {$\_mins\_in\_hr = 120} {else} {$\_mins\_in\_hr = 60} {/if} {$\_day\_trace\_count = 0} {foreach $userDayInfo->checkins as $checkin}{strip} {if $checkin->max > $checkin->min} {$\\\_ __checkin\_density = $checkin->duration / ($checkin->max - $checkin->min)} {else} {$\\\_ __checkin\_density = 0} {/if} id}id="s-timeline-content-{$checkin->id}{if $checkin->isTrace}-trace{/if}"{/if} {if $checkin->hasProjects}data-wa-tooltip-content="{statusTimeHelper::renderIntAsHHMMTime($checkin->min)}—{statusTimeHelper::renderIntAsHHMMTime($checkin->max)} / {$checkin->projectDurationTitle|escape}"{elseif $checkin->isTrace}data-wa-tooltip-content="{statusTimeHelper::renderIntAsHHMMTime($checkin->min)}—{statusTimeHelper::renderIntAsHHMMTime($checkin->max)} / {sprintf('[\`%d minutes of Webasyst online time: %s active, %s idle\`]', $checkin->max-$checkin->min, $checkin->durationString, $checkin->breakString)}"{else}data-wa-tooltip-content="{statusTimeHelper::renderIntAsHHMMTime($checkin->min)}—{statusTimeHelper::renderIntAsHHMMTime($checkin->max)} / {sprintf('[\`%s (project not specified)\`]', $checkin->durationString)}"{/if} data-trace-id="{$checkin->id}" data-trace-start="{$checkin->startTimestamp|wa\_datetime}" data-trace-end="{$checkin->endTimestamp|wa\_datetime}" data-trace-start-server="{date('Y-m-d H:i:s', $checkin->startTimestamp)}" data-trace-end-server="{date('Y-m-d H:i:s', $checkin->endTimestamp)}" > {if $checkin->isTrace} {$\_day\_trace\_count = $\_day\_trace\_count + 1} {/if} {if $checkin->id && $checkin->hasProjects && !$checkin->isTrace} #s-timeline-content-{$checkin->id} { background: -webkit-linear-gradient(left, {$checkin->projectDurationCss}); } {/if} ( function($) { $(".s-widget-{$widget\_id} #s-timeline-content-{$checkin->id}{if $checkin->isTrace}-trace{/if}").waTooltip( { 'class':'s-timeline-sontent-tooltip{if $checkin->isTrace}-trace{/if}' } ); })(jQuery); {/strip}{/foreach} ``` -------------------------------- ### Day Editor Initialization and Click Handling Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/chronology/Chronology.html Manages the click events for editable days in the chronology. It also includes logic to trigger the editor for the first available editable day or based on routing hash. ```javascript $.status.$status_content.off('click.stts', '.s-day'); if (dayEditable) { $.status.$status_content.on('click.stts', '.s-day', function (e) { if ($(e.target).closest('[data-status-walog-app-logs]').length) { return; } $.status.dayEditor($(this)); }); // var $editableDay = $.status.$status_content.find('.s-editable-now'); // if (!$editableDay.length) { // var $editableDay = $.status.$status_content.find('.s-day:first'); // } // $editableDay.trigger('click.stts'); $.status.$status_content.on('loadEditor.stts', function () { var loadSelector = '.s-day:first'; if ($.status.routing.hash === 'y') { loadSelector = '.s-day:eq(1)'; } $.status.$status_content.find(loadSelector).trigger('click.stts'); }); } }()); ``` -------------------------------- ### Webasyst Status App Initialization Source: https://github.com/1312inc/webasyst-status/blob/master/templates/layouts/Default.html Initializes the Webasyst Status application using jQuery. Requires account name, admin status, user ID, and backend URL. This snippet is typically used within a $(function() { ... }); block. ```javascript $.status.init({ account_name: '{$wa->accountName()|escape:'javascript'}', isAdmin: {$isAdmin}, userId: {$stts->getUser()->getContactId()}, backendUrl: '{$wa_backend_url}' }); ``` -------------------------------- ### Initialize Tooltip for Timeline Actions Source: https://github.com/1312inc/webasyst-status/blob/master/widgets/user/templates/DayInfo.html Initializes a Webasyst tooltip for timeline action mark elements, applying a background color based on the associated application's color. This uses jQuery. ```javascript ( function($) { $(".s-widget-{$widget\_id} #s-timeline-action-mark-{$walogByDatetime.app\_id}-{$walogByDatetime.datetime|strtotime}").waTooltip( { 'style': 'background: {$walogByDatetime.app\_color};' } ); })(jQuery); ``` -------------------------------- ### Displaying Walog Tooltips Source: https://github.com/1312inc/webasyst-status/blob/master/widgets/team/templates/DayInfo.html This snippet iterates through walogs by datetime and sets up tooltips for timeline actions. The tooltip style is customized based on the application's color. ```html {foreach $userDayInfo->walogsByDatetime as $walogByDatetime}{strip} ( function($) { $(".s-widget-{$widget\_id} #s-timeline-action-mark-{$walogByDatetime.app\_id}-{$walogByDatetime.datetime|strtotime}").waTooltip( { 'style': 'background: {$walogByDatetime.app\_color};' } ); })(jQuery); {/strip}{/foreach} ``` -------------------------------- ### Initialize Tooltip for User Picture Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/day/DayShow.html Initializes a tooltip for a user's profile picture on a specific day. This is typically used for displaying additional user information on hover. ```javascript ( function($) { $("#s-day-userpic-{$userDayInfo->contactId}-{$day->date}").waTooltip(); })(jQuery); ``` -------------------------------- ### Initialize Tooltip for Timeline Action Mark Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/day/DayShow.html Initializes a tooltip for timeline action marks, setting the background color based on the application's color. This visually distinguishes different types of activities. ```javascript ( function($) { $("#s-timeline-action-mark-{$walogByDatetime.app\_id}-{$walogByDatetime.datetime|strtotime}").waTooltip( { 'style': 'background: {$walogByDatetime.app\_color};' } ); })(jQuery); ``` -------------------------------- ### Initialize Tooltip for Timeline Content Source: https://github.com/1312inc/webasyst-status/blob/master/widgets/user/templates/DayInfo.html Initializes a Webasyst tooltip for timeline content elements, applying specific classes for styling. This uses jQuery. ```javascript ( function($) { $(".s-widget-{$widget\_id} #s-timeline-content-{$checkin->id}{if $checkin->isTrace}-trace{/if}").waTooltip( { 'class':'s-timeline-sontent-tooltip{if $checkin->isTrace}-trace{/if}' } ); })(jQuery); ``` -------------------------------- ### JavaScript for Status Dropdown Initialization Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/todaystatus/TodaystatusList.html Initializes a Webasyst dropdown component for the status selection interface using jQuery. ```javascript (function($) { $("[data-status-today-status-date=\"{$statusDate}\"]").waDropdown({ hover: false, items: ".menu > li > a" }); })(jQuery); ``` -------------------------------- ### Iterating Through Check-ins Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/day/DayEditor.html Loops through user check-ins, skipping trace entries, and applies specific formatting for the first check-in. ```HTML/Smarty {$itr = 0} {foreach $userDayInfo->checkins as $checkin} {if !$checkin->isTrace} id == $userDayInfo->firstCheckin->id}data-checkin-first{/if} data-checkin-has-projects="{$checkin->hasProjects|intval}" > {if $itr === 0} {if $stts->canShowTrace()} {for $i=1 to 23}{strip} _ {if $i % 3 == 0}{$i}{/if}_ {/strip}{/for} {/if} {if $stts->canShowTrace()} {foreach $userDayInfo->checkins as $c}{strip} {\* sorry for the inner cycle :) *}{if $c->isTrace} {if $c->max > $c->min} {$\_checkin\_density = $c->duration / ($c->max - $c->min)} {else} {$\_checkin\_density = 0} {/if} {/if} {/strip}{/foreach} {foreach $userDayInfo->walogsByDatetime as $w}{strip} {/strip}{/foreach} {/if} {/if} {foreach $checkin->projectsDuration as $projectDuration} id}checked{/if}> {$projectDuration->project->name|escape} [{$projectDuration->durationPercent}%](#) {/foreach} break}checked{/if} name="checkin\[break\]" value="1"> [`Break`] [{$checkin->breakString}](#) {if $itr === 0} [](# "[`Remove interval for today`]")[](# "[`Remove interval for today`]") {/if} {$itr = $itr + 1} {/if} {/foreach} ``` -------------------------------- ### Initialize Tooltip for Timeline Content Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/day/DayShow.html Initializes a tooltip for timeline content, applying a specific class for styling. This is used for displaying detailed information about check-ins or traces. ```javascript ( function($) { $("#s-timeline-content-{$checkin->id}{if $checkin->isTrace}-trace{/if}").waTooltip( { 'class': 's-timeline-sontent-tooltip{if $checkin->isTrace}-trace{/if}' } ); })(jQuery); ``` -------------------------------- ### Displaying Project Durations Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/week/WeekDonut.html Iterates through project data to display the name and duration for projects that meet specific criteria (positive duration or idle time for project ID 0). ```html {foreach $donut->data as $p} {if $donut->hasData && ($p->id > 0 && $p->totalDuration > 0 || $p->id == 0 && $p->totalDuration >= 10)}* {$p->name|escape} {$p->totalDurationStr} {/if} {/foreach} ``` -------------------------------- ### Status Day Timeline Integration (JavaScript) Source: https://github.com/1312inc/webasyst-status/blob/master/widgets/clock/templates/Round.html Integrates the status day timeline visualization. It imports the necessary module, sets up data and locale messages, and renders the timeline within a specified element. Includes a timeout to re-render the widget. ```javascript import { statusDayTimeline } from "{$widget_url}js/statusDayTimeline.js"; const data = {$data}; const messages = { h: '[\`h\`]', m: '[\`m\`]', online: '[\`online\`]', active: '[\`active\`]', idle: '[\`idle\`]', noProject: '[\`noProject\`]' }; if (typeof d3 !== 'undefined') { statusDayTimeline().$el('#timeline_{$widget_id}').setLocale(messages).render(data); } (function () { setTimeout(function () { try { DashboardWidgets[{$widget_id}].renderWidget(); } catch (e) { } }, 10 * 60 * 1000); })(); ``` -------------------------------- ### Include Today's Status List Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/day/DayEditor.html Includes the TodaystatusList.html template to display statuses for the current day. ```HTML/Smarty {include inline file='./../todaystatus/TodaystatusList.html' statuses=$statuses currentStatus=$userDayInfo->todayStatus statusDate=$day->date} ``` -------------------------------- ### Project Duration CSS Styling Source: https://github.com/1312inc/webasyst-status/blob/master/widgets/user/templates/DayInfo.html Applies a background gradient to timeline elements that represent projects, using a color defined by the project's duration. Excludes trace elements. ```smarty #s-timeline-content-{$checkin->id} { background: -webkit-linear-gradient(left, {$checkin->projectDurationCss}); } ``` -------------------------------- ### Initialize Round Clock Widget (JavaScript) Source: https://github.com/1312inc/webasyst-status/blob/master/widgets/clock/templates/Round.html Initializes the Round Clock widget. It checks if the StatusRoundClock class is already loaded; if not, it asynchronously loads the JavaScript file. Then, it creates a new instance of the clock with specified options. ```javascript {\* Init Controller *} {include file="../js/clockController.js" inline} {\* Initialize *} ( function() { var is_loaded = (typeof StatusRoundClock !== "undefined"), js_href = "{$widget_url}js/statusRoundClock.js?v={$wa->version()}", widget = DashboardWidgets["{$widget_id}"], options = { widget_id: "{$widget_id}", widget_name: "{$widget_name}", widget_app: "{$widget_app}", show_town: {if !empty($town)}true{else}false{/if}, source: "local", offset: 0, size: "{$size}" }; if (is_loaded) { widget.clock = new StatusRoundClock(options); } else { $.getScript(js_href, function() { widget.clock = new StatusRoundClock(options); }); } })(); ``` -------------------------------- ### Timeline Content Rendering Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/day/DayShow.html Renders individual timeline content blocks for check-ins, including duration, project information, and trace details. It also sets data attributes for tooltips and trace information. ```smarty {if $checkin->max > $checkin->min} {$\\\_ extit{checkin}\\\_ extit{density} = $checkin->duration / ($checkin->max - $checkin->min)} {else} {$\\\_ extit{checkin}\\\_ extit{density} = 0} {/if} id}id="s-timeline-content-{$checkin->id}{if $checkin->isTrace}-trace{/if}"{/if} {if $checkin->hasProjects}data-wa-tooltip-content="{statusTimeHelper::renderIntAsHHMMTime($checkin->min)}—{statusTimeHelper::renderIntAsHHMMTime($checkin->max)} / {$checkin->projectDurationTitle|escape}"{elseif $checkin->isTrace}data-wa-tooltip-content="{statusTimeHelper::renderIntAsHHMMTime($checkin->min)}—{statusTimeHelper::renderIntAsHHMMTime($checkin->max)} / {sprintf('[\`%d minutes of Webasyst online time: %s active, %s idle\`]', $checkin->max-$checkin->min, $checkin->durationString, $checkin->breakString)}"{else}data-wa-tooltip-content="{statusTimeHelper::renderIntAsHHMMTime($checkin->min)}—{statusTimeHelper::renderIntAsHHMMTime($checkin->max)} / {sprintf('[\`%s (project not specified)\`]', $checkin->durationString)}"{/if} data-trace-id="{$checkin->id}" data-trace-start="{$checkin->startTimestamp|wa\_datetime}" data-trace-end="{$checkin->endTimestamp|wa\_datetime}" data-trace-start-server="{date('Y-m-d H:i:s', $checkin->startTimestamp)}" data-trace-end-server="{date('Y-m-d H:i:s', $checkin->endTimestamp)}" > {if $checkin->isTrace} {$\_day\_trace\_count = $\_day\_trace\_count + 1} {/if} ``` -------------------------------- ### Mobile vs. Desktop Time Calculation Source: https://github.com/1312inc/webasyst-status/blob/master/widgets/user/templates/DayInfo.html Sets the number of minutes in an hour based on whether the view is mobile or desktop. This affects time density calculations. ```smarty {\$\_mins\_in\_hr = 120} {else} {\$\_mins\_in\_hr = 60} {/if} ``` -------------------------------- ### Displaying Current Status in HTML Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/todaystatus/TodaystatusList.html Renders the current status name, background color, and font color. Includes logic to display default text if no status is set. ```html {if isset($currentStatus) && $currentStatus->getCalendarId()}{$currentStatus->getName()|escape|truncate:32}{else}{if $statusDate == 'tomorrow'}\[`Status for tomorrow`\]{elseif $statusDate == date('Y-m-d')}\[`Status for today`\]{else}\[`Set daily status`\]{/if}{/if} ``` -------------------------------- ### Webasyst Status Mobile Sidebar Initialization Source: https://github.com/1312inc/webasyst-status/blob/master/templates/layouts/Default.html Initializes a collapsible sidebar for the Status app on mobile devices. It also resets scroll position and hides the sidebar content on hash changes. ```javascript (function ($) { var sidebar = $('#status-left-sidebar').waShowSidebar(); window.addEventListener('hashchange', function () { window.scrollTo(0, 0); sidebar.data('sidebar').$sidebar_content.hide(); }); })(jQuery); ``` -------------------------------- ### Displaying First Check-in Comment Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/day/DayEditor.html Shows the comment associated with the user's first check-in of the day. ```HTML/Smarty {$userDayInfo->firstCheckin->comment|escape} ``` -------------------------------- ### Webasyst Dropdown Initialization (jQuery) Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/report/Report.html Initializes a Webasyst dropdown component for an element with the ID 'reportSelect'. This is typically used for selection menus within the report interface. ```javascript (function($) { $("#reportSelect").waDropdown({ hover: false }); })(jQuery); ``` -------------------------------- ### Status Selection List in HTML Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/todaystatus/TodaystatusList.html Iterates through available statuses, highlighting the selected one and providing data attributes for interaction. ```html {foreach $statuses as $status}* getCalendarId() == $status->getCalendarId()}class="selected"{/if} data-status-calendar-id="{$status->getCalendarId()}" data-status-status-id="{$status->getStatusId()}" > [{$status->getName()|escape}]({/foreach} ``` -------------------------------- ### Handle No Activity Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/day/DayShow.html Displays a 'No activity' message if the user has no recorded activities for the day. This serves as a fallback when no other content is rendered. ```smarty {foreachelse} [\`No activity\`] {/foreach} ``` -------------------------------- ### Displaying Walog Counts Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/day/DayEditor.html Iterates through walogs to display counts for non-webasyst applications. ```HTML/Smarty {foreach $userDayInfo->walogs as $walog} {if $walog->count && $walog->appId != 'webasyst'} [**{$walog->count}**](#) {/if} {/foreach} {if $stts->canShowTrace()} {foreach $userDayInfo->walogsByDatetime as $walogByDatetime}{strip} {/strip}{/foreach} {/if} ``` -------------------------------- ### User Day Info Loop in Smarty Source: https://github.com/1312inc/webasyst-status/blob/master/widgets/user/templates/DayInfo.html Iterates through user day information for each user, casting to the appropriate DTO. This is the main loop for displaying daily user status. ```smarty {foreach $dayDto->userDayInfos as $userDayInfo} {\* @var statusDayUserInfoDto $userDayInfo \*} ``` -------------------------------- ### Save Shortcut Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/day/DayEditor.html Indicates the keyboard shortcut for saving and displays a 'Saved' status. ```HTML/Smarty _Ctrl + S_   [`Saved`] ``` -------------------------------- ### Day Name and Date Display Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/day/DayEditor.html Displays the day name and date, with special labels for 'Today' and 'Yesterday'. ```HTML/Smarty {if $day->yesterday}class="s-yesterday"{/if}> {if $day->today}[`Today`]{/if} {if $day->yesterday}[`Yesterday`]{/if} {$day->dayname}{if !$day->today}, {$day->dayHuman}{/if} ``` -------------------------------- ### Display First Check-in Comment Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/day/DayShow.html Displays the comment associated with the user's first check-in of the day. Comments are escaped and converted to new lines for readability. ```smarty {if $userDayInfo->firstCheckin->comment} {$userDayInfo->firstCheckin->comment|escape|nl2br} {/if} ``` -------------------------------- ### Webasyst Status Template Logic Source: https://github.com/1312inc/webasyst-status/blob/master/templates/layouts/Default.html Basic HTML template structure for the Webasyst Status application, including dynamic content rendering and conditional logic for locale and review widgets. ```html {$wa->appName()} — {$wa->accountName()} {$wa->css()} {if ($wa->locale() == 'ru\_RU')} {/if} {$wa->header()} {$sidebar_html} {if $showReviewWidget && method_exists($wa->installer, 'reviewWidget')} {$wa->installer->reviewWidget('app/status')} {/if} ``` -------------------------------- ### Webasyst Status Locale Settings Source: https://github.com/1312inc/webasyst-status/blob/master/templates/layouts/Default.html Extends the global $.wa.locale object with specific translations for the Status application. Used for internationalization. ```javascript $.wa.locale = $.extend($.wa.locale || {}, { 'Adjust time': "[\`Adjust time\`]", 'Save': "[\`Save\`]", 'Cancel': "[\`Cancel\`]", }); ``` -------------------------------- ### Report Data Loading and Display (JavaScript) Source: https://github.com/1312inc/webasyst-status/blob/master/templates/actions/report/Report.html Handles click events to load detailed report data dynamically via AJAX. Appends new rows to the table and updates the UI based on the response. Use when a user clicks an action to load more granular report details. ```javascript 'use strict'; (function () { var $w = $('[data-status-wrapper="report"]'), $loading = $(''); $w.on('click.stts', '[data-status-report-action="load-data"]', function (e) { e.preventDefault(); var $this = $(this), loadType = $this.data('status-load-data'), loadId = $this.data('status-load-data-id'), start = $w.data('status-report-start'), end = $w.data('status-report-end'), $tr = $this.closest('tr'), hash = loadType + '-' + loadId; if ($tr.next().data('status-report-loaded-from') == hash) { $w.find('[data-status-report-loaded-from="' + hash + '"]').remove(); $tr.removeClass('bold'); return; } $this.after($loading); $w.find(':input').prop('disable', true); $.get('?module=report&action=loadData', { type: loadType, id: loadId, start: start, end: end }, function (r) { if (r.status === 'ok') { $.each(r.data, function () { var newTr = '' + '
' + this.icon + ' ' + this.nameEscaped + '
' + '' + this.durationFloat + ''+ +'', $lastTr = $w.find('[data-status-report-loaded-from="' + hash + '"]:last'); if ($lastTr.length) { $lastTr.after(newTr); } else { $tr.after(newTr); } }); $tr.addClass('bold'); } }).always(function () { $loading.remove(); $w.find(':input').prop('disable', false); }); }) .on('click.stts', '[data-status-report-period]', function (e) { var $this = $(this), type = $this.data('status-report-period'); if (type === 'custom'){ e.preventDefault(); $w.find('[data-status-report-period-custom]').show(); $("#reportSelect").data("dropdown").hide(); } }); var initCustom = function () { var dateFormat = 'yy-mm-dd', datepicker_options = { changeMonth: true, changeYear: true, shortYearCutoff: 2, dateShowWeek: false, showOtherMonths: true, selectOtherMonths: true, stepMonths: 1, // numberOfMonths: 3, gotoCurrent: true, constrainInput: false, dateFormat: dateFormat, }, $from = $w.find('[data-status-report-period-custom] input:first').datepicker(datepicker_options), $to = $w.find('[data-status-report-period-custom] input:last').datepicker(datepicker_options); $w.on('click.stts', '[data-status-report-action="load-custom-period"]', function (e) { e.preventDefault(); window.location.hash = '#/reports/' + $from.val() + '/' + $to.val(); }); }; initCustom(); if ($w.data('status-report-period') === 'custom') { $w.find('[data-status-report-period-custom]').show(); } })(); ``` -------------------------------- ### Tiny Ad HTML Structure and jQuery Dialog Trigger Source: https://github.com/1312inc/webasyst-status/blob/master/templates/include/tinyAds.html This snippet contains the HTML structure for a tiny ad and the associated jQuery code that initializes a dialog box when a specific action button is clicked. The dialog displays promotional information including an app icon, title, discount, description, promocode, and purchase links. ```html
<\/div>
<\/i><\/a>

{$tinyAd.title} −{$tinyAd.discount}%

{$tinyAd.body}

<\/div>