@extends('layouts.admin') @section('title', '알림 템플릿 관리') @section('content')

@yield('title')

등록
@php $currentTarget = request('target', ''); $rawTargets = \App\Models\NotificationTemplate::getTargets(); // 다차원 배열 또는 1차원 배열 어떤 구조여도 안전하게 [key => label] 문자열로 변환 $targetsConfig = collect($rawTargets)->map(function ($item, $key) { return is_array($item) ? ($item['label'] ?? $item['name'] ?? (string)$key) : (string)$item; })->toArray(); @endphp
전체 보기 @foreach($targetsConfig as $tKey => $tLabel) {{ $tLabel }} @endforeach
@slot('filters') @if(request('target')) @endif @php $notificationCategories = config('notification_categories.categories', []); // 1단 카테고리 배열 안전 매핑 [ '키' => '표시이름' ] $parentOptions = collect($notificationCategories)->mapWithKeys(function ($cat, $key) { $name = is_array($cat) ? ($cat['name'] ?? (string)$key) : (string)$cat; return [(string)$key => $name]; })->toArray(); $selectedCategory = request('category'); $currentSubcategories = ($selectedCategory && isset($notificationCategories[$selectedCategory]['subcategories'])) ? $notificationCategories[$selectedCategory]['subcategories'] : []; // 채널/구분(Type) 옵션 1차원 문자열 보장 $rawTypes = \App\Models\NotificationTemplate::getTypes(); $typeOptions = collect($rawTypes)->map(function ($item, $key) { return is_array($item) ? ($item['label'] ?? $item['name'] ?? (string)$key) : (string)$item; })->toArray(); @endphp @endslot
@forelse($templates as $template) @php // 모델 접근자 또는 인라인 fallback을 통한 테마 클래스 및 아이콘 결정 $screenClass = method_exists($template, 'getScreenClassAttribute') ? $template->screen_class : match ($template->type) { 'ALIMTALK' => 'screen-alimtalk', 'EMAIL' => 'screen-email', default => 'screen-sms', }; $channelIcon = method_exists($template, 'getChannelIconAttribute') ? $template->channel_icon : match ($template->type) { 'ALIMTALK' => 'fa-solid fa-comment', 'EMAIL' => 'fa-solid fa-envelope-open-text', default => 'fa-solid fa-comment-sms', }; // 문자열 보장된 표시 데이터 추출 $targetDisplayName = is_array($template->target_name) ? ($template->target_name['label'] ?? $template->target) : ($template->target_name ?: $template->target); $categoryDisplayName = is_array($template->category_name) ? ($template->category_name['name'] ?? '') : $template->category_name; $subcategoryDisplayName = is_array($template->subcategory_name) ? ($template->subcategory_name['name'] ?? '') : $template->subcategory_name; $targetLower = strtolower((string)$template->target); @endphp
{{ now()->format('H:i') }}
{{ $categoryDisplayName }} {{ $subcategoryDisplayName }} {{ $template->is_web_notify ? '웹 ON' : '웹 OFF' }}
{{ $template->type }}
{{ $template->code }}
수신: @if($targetLower === 'user') {{ $targetDisplayName }} @elseif($targetLower === 'shop') {{ $targetDisplayName }} @elseif($targetLower === 'admin') {{ $targetDisplayName }} @else {{ $targetDisplayName }} @endif
@if($template->type === 'EMAIL')
발송자: GLOBEAU 고객센터
@endif @if($template->title)
{{ $template->type === 'EMAIL' ? '제목: ' . $template->title : '[' . $template->title . ']' }}
@endif
{{ $template->content }}
@if($template->is_web_notify && !empty($template->action_url))
이동: {{ $template->action_url }}
@endif @if($template->description)
{{ $template->description }}
@endif
@empty
등록되었거나 검색 조건에 일치하는 알림 템플릿이 없습니다.
@endforelse
@if(isset($templates) && method_exists($templates, 'hasPages') && $templates->hasPages())
{{ $templates->appends(request()->query())->links('vendor.pagination.admin') }}
@endif
@endsection @push('styles') @endpush @push('scripts') @endpush