@extends('layouts.app')

@section('title', __('bms::lang.notification_matrix'))

@section('content')

<section class="content-header">
    <h1>@lang('bms::lang.notification_matrix')
        <small>@lang('bms::lang.notification_matrix_help')</small>
    </h1>
</section>

<section class="content">
    {!! Form::open(['route' => 'bms.notifications.update', 'method' => 'PUT']) !!}
    @component('components.widget', ['class' => 'box-primary'])
        <div class="table-responsive">
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th style="width:34%">@lang('bms::lang.update_type')</th>
                        @foreach($channels as $key => $label)
                            <th class="text-center">{{ $label }}</th>
                        @endforeach
                    </tr>
                </thead>
                <tbody>
                    @foreach($updateTypes as $type => $typeLabel)
                        @php $active = $matrix[$type] ?? []; @endphp
                        <tr>
                            <td><strong>{{ $typeLabel }}</strong></td>
                            @foreach($channels as $key => $label)
                                <td class="text-center">
                                    <input type="checkbox" name="matrix[{{ $type }}][]" value="{{ $key }}"
                                        {{ in_array($key, $active) ? 'checked' : '' }}>
                                </td>
                            @endforeach
                        </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
        <button type="submit" class="tw-dw-btn tw-dw-btn-primary tw-text-white">
            <i class="fa fa-save"></i> @lang('messages.update')
        </button>
        <p class="text-muted" style="margin-top:14px;">
            @lang('bms::lang.notification_matrix_note')
        </p>
    @endcomponent
    {!! Form::close() !!}
</section>

@endsection
