{
    "id": 24,
    "content": "{{-- ============================================================\r\n     COMPONENT: News — BERITA TERKINI + SUARA ANDA\r\n     \"BERITA TERKINI\" kini DB-driven dari modul Content Article (kategori NEWS).\r\n\r\n     Sumber data:\r\n       · content_article             → article_category = 'NEWS', article_status = ACTIVE,\r\n                                       tetingkap terbit (scopePublished: tarikh + MASA),\r\n                                       article_date, article_image, article_sorting\r\n       · content_article_translation → article_translation_title + article_translation_content\r\n\r\n     Imej guna helper image_url() → fallback public/dynaweb4/img/No_Image_Available.jpg.\r\n     \"SUARA ANDA\" = 4 pautan SEBENAR ke halaman sedia ada (Aduan & Maklum Balas,\n     Aduan Integriti, Kaji Selidik Kepuasan Pelanggan 2026, Kaji Selidik Kepuasan\n     Digital 2026). Tiada modul konsultasi awam dalam sistem.\r\n     CSS .news / .news-img / .date ada dalam Layout site NRES.\r\n     Guna pada page lain: assign komponen ini + letak {!! $news_nres !!}.\r\n     ============================================================ --}}\r\n\r\n@php\r\n    $nwsLang = ($lang ?? session('locale', 'ms')) === 'en' ? 'en' : 'ms';\r\n\r\n    $nwsRows = \\App\\Models\\Backend\\ContentArticle::query()\r\n        ->where('article_category', 'NEWS')\r\n        ->published()\r\n        ->orderByDesc('article_date')\r\n        ->orderByDesc('article_id')\r\n        ->limit(3)\r\n        ->get();\r\n\r\n    $nwsIds = $nwsRows->pluck('article_id')->all();\r\n\r\n    $nwsTr = $nwsIds\r\n        ? DB::table('content_article_translation')\r\n            ->whereIn('article_translation_parent_id', $nwsIds)\r\n            ->get()\r\n            ->groupBy('article_translation_parent_id')\r\n        : collect();\r\n\r\n    $nwsMonths = [\r\n        'ms' => [1 => 'Januari', 'Februari', 'Mac', 'April', 'Mei', 'Jun', 'Julai', 'Ogos', 'September', 'Oktober', 'November', 'Disember'],\r\n        'en' => [1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\r\n    ];\r\n\r\n    $nwsItems = [];\r\n\r\n    foreach ($nwsRows as $nwsRow) {\r\n        $rows = $nwsTr[$nwsRow->article_id] ?? collect();\r\n\r\n        $tr = $rows->firstWhere('article_translation_language', $nwsLang)\r\n            ?? $rows->firstWhere('article_translation_main', 1)\r\n            ?? $rows->first();\r\n\r\n        if (! $tr || trim((string) $tr->article_translation_title) === '') {\r\n            continue;\r\n        }\r\n\r\n        $ts = $nwsRow->article_date ? strtotime((string) $nwsRow->article_date) : null;\r\n        $ts = $ts ?: strtotime((string) $nwsRow->created_at);\r\n\r\n        $excerpt = trim(preg_replace('/\\s+/', ' ', strip_tags((string) $tr->article_translation_content)));\r\n\r\n        if (mb_strlen($excerpt) > 150) {\r\n            $excerpt = rtrim(mb_substr($excerpt, 0, 147)).'…';\r\n        }\r\n\r\n        $nwsItems[] = [\r\n            'title' => trim((string) $tr->article_translation_title),\r\n            'excerpt' => $excerpt,\r\n            'img' => image_url($nwsRow->article_image),\r\n            'day' => $ts ? date('d', $ts) : '',\r\n            'month' => $ts ? ($nwsMonths[$nwsLang][(int) date('n', $ts)] ?? '') : '',\r\n            'year' => $ts ? date('Y', $ts) : '',\r\n        ];\r\n    }\r\n@endphp\r\n\r\n<section class=\"row g-3 mt-4 mb-5\">\r\n      <div class=\"col-lg-6\"><div class=\"card-soft p-3 h-100\">\r\n        <div class=\"d-flex justify-content-between align-items-center mb-2\"><h2 class=\"panel-title mb-0\">{{ t('Berita Terkini') }}</h2><a href=\"/{{ $siteSlug ?? 'nres' }}/article\" class=\"text-teal small fw-semibold text-decoration-none\">{{ t('Lihat Semua') }} <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M9 5l7 7-7 7\"/></svg></a></div>\r\n        @forelse ($nwsItems as $nwsItem)\r\n        <div class=\"news d-flex gap-3 py-3\"><div class=\"news-img\"><img src=\"{{ $nwsItem['img'] }}\" alt=\"{{ $nwsItem['title'] }}\"><div class=\"date\"><b>{{ $nwsItem['day'] }}</b><small>{{ $nwsItem['month'] }}<br>{{ $nwsItem['year'] }}</small></div></div><div class=\"flex-grow-1\"><h3>{{ $nwsItem['title'] }}</h3><p>{{ $nwsItem['excerpt'] }}</p></div><span class=\"text-teal align-self-center\"><svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M9 5l7 7-7 7\"/></svg></span></div>\r\n        @empty\r\n        <p class=\"small text-muted mb-0\">{{ t('Tiada berita buat masa ini.') }}</p>\r\n        @endforelse\r\n      </div></div>\r\n<div class=\"col-lg-6\"><div class=\"card-soft p-3 h-100\">\r\n        <h2 class=\"panel-title mb-2\">{{ t('Suara Anda') }}</h2>\r\n        <p class=\"small text-muted mb-1\">{{ t('Saluran untuk anda beri pandangan, maklum balas dan aduan.') }}</p>\r\n        <a href=\"/{{ $siteSlug ?? 'nres' }}/complaints-feedback\" class=\"eng d-flex gap-3 align-items-center py-3\"><span class=\"eicon\"><svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M4 5h16v11H9l-5 4z\"/><path d=\"M8 9h8M8 12h5\"/></svg></span><div class=\"flex-grow-1\"><b>{{ t('Complaints & Feedback') }}</b><p class=\"mb-0\">{{ t('Salurkan aduan, pertanyaan dan cadangan anda kepada NRES.') }}</p></div><span class=\"text-teal\"><svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M9 5l7 7-7 7\"/></svg></span></a>\r\n        <a href=\"/{{ $siteSlug ?? 'nres' }}/integrity-complaint\" class=\"eng d-flex gap-3 align-items-center py-3\"><span class=\"eicon\"><svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M12 3l7 3v6c0 4-3 7-7 9-4-2-7-5-7-9V6z\"/><path d=\"M9 12l2 2 4-4\"/></svg></span><div class=\"flex-grow-1\"><b>{{ t('Integrity Complaint') }}</b><p class=\"mb-0\">{{ t('Laporkan salah laku dan pelanggaran integriti secara sulit.') }}</p></div><span class=\"text-teal\"><svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M9 5l7 7-7 7\"/></svg></span></a>\r\n        <a href=\"/{{ $siteSlug ?? 'nres' }}/customer-satisfaction-2026\" class=\"eng d-flex gap-3 align-items-center py-3\"><span class=\"eicon\"><svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"5\" y=\"4\" width=\"14\" height=\"17\" rx=\"2\"/><path d=\"M9 4h6v3H9zM8.5 12l1.5 1.5 3-3M8 17h8\"/></svg></span><div class=\"flex-grow-1\"><b>{{ t('Customer Satisfaction Survey 2026') }}</b><p class=\"mb-0\">{{ t('Beri maklum balas tentang kualiti perkhidmatan dan urusan pelanggan.') }}</p></div><span class=\"text-teal\"><svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M9 5l7 7-7 7\"/></svg></span></a>\r\n        <a href=\"/{{ $siteSlug ?? 'nres' }}/digital-satisfaction-2026\" class=\"eng d-flex gap-3 align-items-center py-3\"><span class=\"eicon\"><svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"12\" rx=\"2\"/><path d=\"M8 20h8M12 16v4\"/></svg></span><div class=\"flex-grow-1\"><b>{{ t('Digital Satisfaction Survey 2026') }}</b><p class=\"mb-0\">{{ t('Nilai pengalaman anda menggunakan portal dan perkhidmatan digital NRES.') }}</p></div><span class=\"text-teal\"><svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M9 5l7 7-7 7\"/></svg></span></a>\r\n      </div></div>\r\n    </section>\r\n"
}