<?php
/**
 * @package   DPCalendar
 * @copyright Copyright (C) 2014 Digital Peak GmbH. <https://www.digital-peak.com>
 * @license   https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
 */

\defined('_JEXEC') or die();

use Joomla\CMS\Helper\ModuleHelper;
use Joomla\CMS\HTML\HTMLHelper;

if ($params->get('show_map', 1)) {
	$layoutHelper->renderLayout('block.map', $displayData);
}

$document->loadScriptFile('views/calendar/default.js');
$document->loadScriptFile('views/calendar/default.js');
$document->loadStyleFile('default.css', 'mod_dpcalendar_mini');
$document->addStyle($params->get('custom_css', ''));

require ModuleHelper::getLayoutPath('mod_dpcalendar_mini', '_scripts');

$compact = $params->get('compact_events', 2) == 1 ? 'compact' : 'expanded';
?>
<div class="mod-dpcalendar-mini mod-dpcalendar-mini_<?php echo $compact; ?> mod-dpcalendar-mini-<?php echo $module->id; ?>">
	<div class="mod-dpcalendar-mini__loader">
		<?php echo $layoutHelper->renderLayout('block.loader', $displayData); ?>
	</div>
	<div class="mod-dpcalendar-mini__custom-text">
		<?php echo HTMLHelper::_('content.prepare', $translator->translate($params->get('textbefore', ''))); ?>
	</div>
	<div class="mod-dpcalendar-mini__calendar dp-calendar"
		data-options="DPCalendar.module.mini.<?php echo $module->id; ?>.options"></div>
	<?php require ModuleHelper::getLayoutPath('mod_dpcalendar_mini', 'default_map'); ?>
	<?php require ModuleHelper::getLayoutPath('mod_dpcalendar_mini', 'default_quickadd'); ?>
	<?php require ModuleHelper::getLayoutPath('mod_dpcalendar_mini', 'default_icons'); ?>
	<div class="dp-filter">
		<form class="dp-form">
			<?php foreach ($ids as $id) { ?>
				<input type="hidden" name="filter[calendars][]" value="<?php echo $id; ?>">
			<?php } ?>
			<input type="hidden" name="list[start-date]">
			<input type="hidden" name="list[end-date]">
		</form>
	</div>
	<div class="mod-dpcalendar-mini__custom-text">
		<?php echo HTMLHelper::_('content.prepare', $translator->translate($params->get('textafter', ''))); ?>
	</div>
</div>
