{#
This file is part of EC-CUBE
Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
http://www.ec-cube.co.jp/
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% extends 'default_frame.twig' %}
{% set body_class = 'front_page' %}
{% block main %}
{# 重要/緊急お知らせアラート(表示期間内の全件を表示) #}
{% set ImportantNewsList = repository('Eccube\\Entity\\News').findActiveImportantNewsList() %}
{% for news in ImportantNewsList %}
{# 緊急(2)は赤、重要(1)は黄色 #}
{% set alertClass = news.importanceLevel == 2 ? 'alert-danger' : 'alert-warning' %}
{% set iconClass = news.importanceLevel == 2 ? 'fa-exclamation-triangle' : 'fa-bullhorn' %}
{% set labelText = news.importanceLevel == 2 ? '緊急' : '重要' %}
<div class="alert {{ alertClass }} alert-dismissible fade show mx-0 mb-3" role="alert">
<i class="fa {{ iconClass }} fa-lg me-2"></i>
<span class="badge bg-{{ news.importanceLevel == 2 ? 'danger' : 'warning' }} me-2 fs-6">{{ labelText }}</span>
<span class="fw-bold">
{{ news.publish_date|date_day }}
{% if news.url %}
<a href="{{ news.url }}" class="alert-link" {% if news.link_method == '1' %}target="_blank" rel="noopener"{% endif %}>
{{ news.title }}
</a>
{% else %}
<a href="{{ url('news_detail', {'id': news.id}) }}" class="alert-link ps-3">
{{ news.title }}
</a>
{% endif %}
</span>
</div>
{% endfor %}
{% endblock %}