@extends('layouts.app')
@section('title', __('mednotify::lang.templates'))
@section('content')
<section class="content-header"><h1>@lang('mednotify::lang.templates')</h1>
    <p>@lang('mednotify::lang.templates_help')</p>
</section>
<section class="content">
    @component('components.widget', ['class' => 'box-primary'])
        <div class="table-responsive">
            <table class="table table-bordered table-striped">
                <thead><tr>
                    <th>@lang('mednotify::lang.event')</th>
                    <th>@lang('mednotify::lang.module')</th>
                    @foreach($channels as $channel)
                        <th class="text-center">@lang('mednotify::lang.channel_' . $channel)</th>
                    @endforeach
                </tr></thead>
                <tbody>
                @forelse($events as $event)
                    <tr>
                        <td>
                            <strong>{{ $event->label }}</strong><br>
                            <small class="text-muted"><code>{{ $event->event_key }}</code></small>
                        </td>
                        <td>{{ $event->module_key ?: '—' }}</td>
                        @foreach($channels as $channel)
                            <td class="text-center">
                                <button class="btn btn-xs btn-default mednotify-modal-btn"
                                    data-href="{{ route('mednotify.templates.edit', ['event_key' => $event->event_key, 'channel' => $channel]) }}">
                                    <i class="fa fa-edit"></i> @lang('messages.edit')
                                </button>
                            </td>
                        @endforeach
                    </tr>
                @empty
                    <tr><td colspan="{{ count($channels) + 2 }}" class="text-center text-muted">@lang('mednotify::lang.no_events')</td></tr>
                @endforelse
                </tbody>
            </table>
        </div>
    @endcomponent
    <div class="modal fade mednotify_modal" tabindex="-1" role="dialog"></div>
</section>
@endsection
@section('javascript')
@include('mednotify::partials.crud_scripts')
@endsection
