@php $active = 0; // 1. ตรวจสอบว่ามีการ Login อยู่หรือไม่ if (Auth::check()) { // ดึง ID ของ User ที่ Login อยู่ $user_id = Auth::id(); // หา Role จากตาราง user_meta $user_role = DB::table('user_meta') ->where('user_userid', $user_id) ->value('user_role'); // 2. ตรวจสอบว่าเจอ Role หรือไม่ ถ้าเจอค่อย Query ต่อ if ($user_role) { // ดึงรายการ item ที่เคยถูกปฏิเสธ (rejected) ไปแล้วในระบบ Active $rejected_items_active = DB::table('workflow_approve') ->where('workflow_approve_status', 'rejected') ->pluck('workflow_approve_item') // ดึงเฉพาะ ID ของใบคำร้อง/ไอเทม ->toArray(); // ค้นหาเอกสารค้างอนุมัติ (pending) $data_active = DB::table('workflow_approve') ->where('workflow_approve_status', 'pending') ->whereNotIn('workflow_approve_item', $rejected_items_active) // ไม่เอาไอเทมที่เคยโดน reject ->orderBy('workflow_approve_order', 'asc') // เรียงลำดับเพื่อให้เจอลำดับแรกก่อน ->get(); // ยุบกลุ่มข้อมูลตามใบคำร้อง (item) เพื่อหาคนที่มีสิทธิ์อนุมัติในลำดับปัจจุบัน $current_approvers_active = $data_active->unique('workflow_approve_item')->values(); $user_role_array = explode('///', $user_role); // ใช้ whereIn เพื่อเช็กว่า workflow_approve_who_id ในคิวปัจจุบัน ตรงกับเลขใดเลขหนึ่งใน Array ของเราหรือไม่ if ($current_approvers_active->whereIn('workflow_approve_who_id', $user_role_array)->isNotEmpty()) { $active = 1; } else { $active = 0; } } } // ===== หน้า index เป็น "Theme" จัดการผ่านเมนู Manage Index ===== // 1 theme = ชื่อหลัก + ชื่อรอง + ภาพพื้นหลัง 1 ชุด ถ้ามีมากกว่า 1 theme ที่ Active // จะแสดงเป็นสไลด์ เปลี่ยนทั้งชุด (ชื่อ+ภาพ) ไปพร้อมกัน ไม่ใช่แค่เปลี่ยนภาพ $index_themes = DB::table('index_theme') ->where('index_theme_status', 'active') ->orderBy('index_theme_order') ->get(); if ($index_themes->isEmpty()) { // ยังไม่ได้ตั้งค่า Theme ใดๆ ผ่านเมนู Manage Index ใช้ค่า default ไปก่อน $default_theme = new stdClass(); $default_theme->index_theme_id = 0; $default_theme->index_theme_title = 'Consulting Center'; $default_theme->index_theme_subtitle = "\"Your Trusted Partner in Growth\"\n\"Expert Consulting for Modern Businesses\""; $default_theme->index_theme_banner_image = null; $index_slides = collect([$default_theme]); } else { $index_slides = $index_themes; } $index_active_theme_ids = $index_themes->pluck('index_theme_id'); $index_theme_links = DB::table('index_theme_link') ->whereIn('index_theme_id', $index_active_theme_ids) ->where('index_theme_link_status', 'active') ->orderBy('index_theme_link_order') ->get(); // ===== ธีมตกแต่งของหน้า Hero (กิ่งไม้ + พุ่มต้นไม้ + อนุภาคร่วง) ===== // เดิมมีแค่ธีม sakura เท่านั้นที่มีต้นไม้/กิ่งประดับตรงนี้ ธีมอื่น (summer/rainy/autumn/winter) // ยังไม่มีเลย ตอนนี้ขยายให้ทำงานได้กับทุกฤดู โดยใช้โทนสีชุดเดียวกับ partials/season_decor.blade.php // (ที่ใช้ตกแต่งหน้าทั่วไป) เพื่อให้สีสันของกิ่งไม้/อนุภาคไปในทิศทางเดียวกันทั้งเว็บ // รูปทรงกิ่ง/ต้นไม้ยังใช้โครงเดิม (สลับแค่สี) เพราะรูปทรงออกแบบมาดีอยู่แล้ว ไม่จำเป็นต้องวาดใหม่ทุกฤดู $heroSeasonConfig = [ 'sakura' => [ 'stroke' => '#8a6152', 'shades' => ['#fff0f5', '#ffd9e8', '#ffb6d0', '#ff8fbd'], 'particle_bg' => 'radial-gradient(circle at 30% 30%, #fff0f5, #ffb6d0 60%, #ff8fbd)', 'particle_shape' => '70% 0 70% 0', // กลีบซากุระ 'lantern_body' => '#ff7a9c', 'lantern_border' => '#e85d84', 'lantern_glow' => '#ffd3e0', 'section_bg_start' => '#fff5f8', 'section_bg_end' => '#fdf9fb', 'section_glow_rgba' => 'rgba(255,182,208,.30)', ], 'summer' => [ 'stroke' => '#2f8f5b', 'shades' => ['#eafff2', '#b9f5cf', '#7de3a3', '#ffd95e'], 'particle_bg' => 'radial-gradient(circle at 30% 30%, #fff8d9, #ffe066 60%, #ffd23f)', 'particle_shape' => '50%', // ประกาย/แสงแดด 'lantern_body' => '#ffcc4d', 'lantern_border' => '#e8a012', 'lantern_glow' => '#fff3c4', 'section_bg_start' => '#fffdf2', 'section_bg_end' => '#fefbf0', 'section_glow_rgba' => 'rgba(255,224,80,.30)', ], 'rainy' => [ 'stroke' => '#4a6fa5', 'shades' => ['#eef5ff', '#cfe3ff', '#a9cdfb', '#7fb2f0'], 'particle_bg' => 'linear-gradient(180deg, rgba(255,255,255,.9), rgba(150,190,240,.85))', 'particle_shape' => '50% 50% 50% 0', // หยดน้ำ 'lantern_body' => '#7fb2f0', 'lantern_border' => '#4a78b0', 'lantern_glow' => '#eaf3ff', 'section_bg_start' => '#f3f8ff', 'section_bg_end' => '#fbfdff', 'section_glow_rgba' => 'rgba(127,178,240,.28)', ], 'autumn' => [ 'stroke' => '#8a5a2b', 'shades' => ['#fff2df', '#ffd08a', '#f3a24d', '#c9682b'], 'particle_bg' => 'radial-gradient(circle at 30% 30%, #fff2df, #f3a24d 60%, #c9682b)', 'particle_shape' => '0 70% 0 70%', // ใบไม้ร่วง 'lantern_body' => '#f3a24d', 'lantern_border' => '#c9682b', 'lantern_glow' => '#ffe6c2', 'section_bg_start' => '#fff8ef', 'section_bg_end' => '#fdf9f3', 'section_glow_rgba' => 'rgba(243,162,77,.30)', ], 'winter' => [ 'stroke' => '#7c93a8', 'shades' => ['#ffffff', '#eef6fb', '#d9ecf7', '#c3e1f2'], 'particle_bg' => 'radial-gradient(circle at 30% 30%, #ffffff, #eaf6ff 70%)', 'particle_shape' => '50%', // เกล็ดหิมะ 'lantern_body' => '#dcecf7', 'lantern_border' => '#a9c9de', 'lantern_glow' => '#ffffff', 'section_bg_start' => '#f7fbfe', 'section_bg_end' => '#fbfdff', 'section_glow_rgba' => 'rgba(195,225,242,.35)', ], ]; $heroDecor = $heroSeasonConfig[$activeSeasonTheme ?? 'none'] ?? null; @endphp @extends('layouts.master') @section('title', 'Consulting Center') @section('style') @endsection @section('content') {{-- เริ่มเนื้อหาได้เลย ไม่ต้อง @include header --}}
{{-- ชื่อหลัก/ชื่อรอง อยู่นอก Swiper ไม่เลื่อนตามรูป แค่ fade เปลี่ยนตอนสไลด์เปลี่ยน --}}
{{-- กิ่งซากุระประดับกรอบ Title/Subtitle มุมบนซ้าย + มุมล่างขวา วาดขึ้นเองด้วย SVG (ไม่ใช้ภาพที่ copy มาจาก Google เพื่อไม่ให้มีปัญหาเรื่องลิขสิทธิ์) --}} @php // ช่อดอกไล่ตามแนวกิ่งถี่ขึ้นและซ้อนต่อเนื่องกัน (จุดกึ่งกลางแต่ละช่ออยู่ใกล้กันมากขึ้น) // เพื่อไม่ให้ดูเป็นดอกลอยเดี่ยวๆ ห่างๆ กันแบบเดิม $captionBranchClusters = [ ['cx' => 14, 'cy' => 16, 'count' => 6, 'spread' => 10], ['cx' => 40, 'cy' => 10, 'count' => 7, 'spread' => 12], ['cx' => 62, 'cy' => 22, 'count' => 6, 'spread' => 10], ['cx' => 50, 'cy' => 44, 'count' => 5, 'spread' => 9], ['cx' => 80, 'cy' => 40, 'count' => 7, 'spread' => 12], ['cx' => 100, 'cy' => 58, 'count' => 6, 'spread' => 10], ['cx' => 86, 'cy' => 78, 'count' => 5, 'spread' => 9], ['cx' => 118, 'cy' => 96, 'count' => 7, 'spread' => 12], ['cx' => 140, 'cy' => 110, 'count' => 6, 'spread' => 10], ['cx' => 126, 'cy' => 132, 'count' => 5, 'spread' => 9], ['cx' => 158, 'cy' => 146, 'count' => 7, 'spread' => 12], ['cx' => 180, 'cy' => 160, 'count' => 6, 'spread' => 10], ['cx' => 168, 'cy' => 182, 'count' => 5, 'spread' => 9], ['cx' => 198, 'cy' => 190, 'count' => 6, 'spread' => 10], ['cx' => 210, 'cy' => 204, 'count' => 5, 'spread' => 9], ]; // ใช้ชุดสีตามฤดูที่ active อยู่ ($heroDecor คำนวณไว้ที่ @php บนสุดของไฟล์) แทนสีชมพูตายตัว $captionPetalShades = $heroDecor['shades'] ?? ['#fff0f5', '#ffd9e8', '#ffb6d0', '#ff8fbd']; $captionBranchStroke = $heroDecor['stroke'] ?? '#8a6152'; @endphp {{-- เดิมมีแค่ธีม sakura เท่านั้นที่มีกิ่งประดับรอบ Title/Subtitle ตรงนี้ ตอนนี้เปิดให้ทุกฤดู (summer/rainy/autumn/winter) ใช้กิ่งทรงเดียวกันได้ แค่เปลี่ยนสีตาม $heroDecor --}} @if($heroDecor) @php mt_srand(); @endphp {{-- กลีบซากุระร่วงพลิ้วผ่านแถว Title/Subtitle แบบจางๆ (อยู่หลังตัวอักษร ไม่บังการอ่าน) --}} @endif @foreach($index_slides as $i => $slide)

{{ $slide->index_theme_title }}

@if(!empty($slide->index_theme_subtitle)) @php $subtitle_lines = array_values(array_filter(array_map('trim', explode("\n", $slide->index_theme_subtitle)))); @endphp
@foreach($subtitle_lines as $j => $line) {{ $line }} @endforeach
@endif
@endforeach
@foreach($index_slides as $slide)
@endforeach
{{-- ต้นซากุระเต็มต้นยืนอยู่ในช่องว่าง 2 ข้างของรูป (ต้นขวาใช้ SVG เดียวกันแล้วกลับด้วย CSS) ออกแบบใหม่ให้ทุกกลุ่มดอกอยู่ "ปลายกิ่ง" จริงๆ ไม่ใช่วางลอยๆ กลางอากาศแบบเดิม (ของเดิมมีบางกลุ่มดอกไม่มีกิ่งรองรับ ทำให้ดูเป็นก้อนดอกลอยแยกออกจากต้น) --}} @php // จุดศูนย์กลางกลุ่มดอกซากุระ บน viewBox 0 0 200 500 — พิกัดตรงนี้ต้อง "ตรงกับปลายกิ่ง" ในพาธข้างล่างเป๊ะๆ $treeClusters = [ ['cx' => 104, 'cy' => 36, 'count' => 13, 'spread' => 34], // ยอดบนสุด ปลายลำต้น ['cx' => 150, 'cy' => 104, 'count' => 10, 'spread' => 28], // กิ่งบนขวา ['cx' => 25, 'cy' => 184, 'count' => 9, 'spread' => 26], // กิ่งกลางซ้าย ['cx' => 114, 'cy' => 282, 'count' => 9, 'spread' => 26], // กิ่งกลางขวา ['cx' => 20, 'cy' => 294, 'count' => 8, 'spread' => 24], // กิ่งล่างซ้าย ใกล้โคนต้น ]; // ใช้ชุดสีตามฤดูที่ active อยู่แทนสีน้ำตาล/ชมพูตายตัว $petalShades = $heroDecor['shades'] ?? ['#fff0f5', '#ffd9e8', '#ffb6d0', '#ff8fbd']; $treeTrunkStroke = $heroDecor['stroke'] ?? '#6b4a3a'; @endphp {{-- เดิมมีแค่ธีม sakura เท่านั้นที่มีต้นไม้เต็มต้นตรงนี้ ตอนนี้เปิดให้ทุกฤดู ใช้ทรงต้นไม้เดิม แค่เปลี่ยนสีลำต้น/พุ่มดอกตามฤดูที่เลือก ($heroDecor) --}} @if($heroDecor) {{-- reseed random หลังวาดพุ่มซากุระ (ที่ mt_srand() ไว้ให้ต้นซ้าย-ขวาสมมาตรกัน) กันไม่ให้ตำแหน่งกลีบไม้ร่วงด้านล่างค้างค่า seed เดิมจนออกมาเหมือนเดิมทุกครั้ง --}} @php mt_srand(); @endphp {{-- กลีบซากุระร่วงพลิ้วผ่านหน้ารูปแบบวนลูป --}} @endif
@if($index_theme_links->isNotEmpty())
{{-- ชุดตกแต่งของ "Explore More" คนละแบบกับต้นซากุระต้นใหญ่ด้านบน (ตัดปัญหาดูเหมือนภาพซ้ำ): เดิมมีแค่ธีมซากุระเท่านั้นที่มีโคม/บอนไซตรงนี้ ตอนนี้เปิดให้ทุกฤดู (summer/rainy/autumn/winter) ใช้ทรงเดียวกันได้ แค่เปลี่ยนสีตาม $heroDecor: - โคมกระดาษห้อยจากมุมบน (ซ้าย/ขวา ใช้ SVG เดียวกัน กลับด้านด้วย scaleX เหมือนแนวทางต้นซากุระ) - ต้นบอนไซทรงเตี้ยกว้างที่มุมล่าง (คนละทรงกับต้นซากุระต้นสูงบาง ด้านบน) วาดขึ้นเองด้วย SVG ล้วน ไม่ใช้ภาพจากอินเทอร์เน็ต จึงไม่มีปัญหาลิขสิทธิ์ --}} @php // กลุ่มดอกเล็กๆ ประดับข้างโคม $lanternBlossom = [ ['cx' => 18, 'cy' => 8, 'count' => 5, 'spread' => 9], ['cx' => 4, 'cy' => 22, 'count' => 4, 'spread' => 7], ]; // พุ่มดอกทรงเตี้ยกว้างของต้นบอนไซ (คนละตำแหน่ง/สัดส่วนกับ $treeClusters ของต้นใหญ่) $bonsaiClusters = [ ['cx' => 150, 'cy' => 70, 'count' => 11, 'spread' => 40], ['cx' => 70, 'cy' => 96, 'count' => 10, 'spread' => 36], ['cx' => 190, 'cy' => 110, 'count' => 8, 'spread' => 28], ['cx' => 40, 'cy' => 130, 'count' => 8, 'spread' => 26], ]; @endphp @if($heroDecor) @php mt_srand(); @endphp @endif

Explore More

@if($index_theme_links->count() > 3) {{-- มากกว่า 3 อัน: แสดงเป็นแถวเลื่อนอัตโนมัติไปทางซ้ายวนลูปไม่รู้จบ (เหมือนเทป) --}} @else {{-- 3 อันหรือน้อยกว่า: แสดงเป็นแถวนิ่ง จัดกึ่งกลาง --}} @endif
@endif @endsection @section('script') {{-- Swiper: สไลด์ Theme ของหน้า index (ชื่อหลัก+ชื่อรอง+ภาพ เปลี่ยนพร้อมกันทั้งชุด) ตั้งค่าที่เมนู Manage Index --}} @endsection {{-- โค้ด Swiper --}}