<commit_before>@extends('voyager::master')

@section('head')
    <script type="text/javascript" src="{{ config('voyager.assets_path') }}/lib/js/jsonarea/jsonarea.min.js"></script>
    <script>var valid_json = [];</script>
@stop

@section('page_header')
    <div class="page-title">
        <i class="voyager-data"></i> @if(isset($dataType->id)){{ 'Edit BREAD for ' . $dataType->name . ' table' }}@elseif(isset($table)){{ 'Create BREAD for ' . $table . ' table' }}@endif
    </div>
@stop

@section('content')

    @if(isset($dataType->name))
        <?php $table = $dataType->name ?>
    @endif

    <?php $fieldOptions = isset($dataType) ? $dataType->fieldOptions() : DB::select("DESCRIBE `${table}`"); ?>

    <div class="page-content container-fluid">
        <div class="row">
            <div class="col-md-12">

                <form role="form"
                      action="@if(isset($dataType->id)){{ route('voyager.database.edit_bread', $dataType->id) }}@else{{ route('voyager.database.store_bread') }}@endif"
                      method="POST">
                    @if(isset($dataType->id))
                        <input type="hidden" value="{{ $dataType->id }}" name="id">
                        {{ method_field("PUT") }}
                    @endif
                    <!-- CSRF TOKEN -->
                    {{ csrf_field() }}

                    <div class="panel panel-primary panel-bordered">

                        <div class="panel-heading">
                            <h3 class="panel-title">Edit the rows for the {{ $table }} table below:</h3>
                        </div>

                        <table id="users" class="table table-hover">
                            <thead>
                            <tr>
                                <th>Field</th>
                                <th>Field Info</th>
                                <th>Visibility</th>
                                <th>Input Type</th>
                                <th>Display Name</th>
                                <th>Optional Details</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($fieldOptions as $data)
                                @if(isset($dataType->id))
                                    <?php $dataRow = TCG\Voyager\Models\DataRow::where('data_type_id', '=',
                                            $dataType->id)->where('field', '=', $data->Field)->first(); ?>
                                @endif
                                <tr>
                                    <td><h4><strong>{{ $data->Field }}</strong></h4></td>
                                    <td>
                                        <strong>Type:</strong> <span>{{ $data->Type }}</span><br/>
                                        <strong>Key:</strong> <span>{{ $data->Key }}</span><br/>
                                        <strong>Required:</strong>
                                        @if($data->Null == "NO")
                                            <span>Yes</span>
                                            <input type="hidden" value="1" name="field_required_{{ $data->Field }}"
                                                   checked="checked">
                                        @else
                                            <span>No</span>
                                            <input type="hidden" value="0" name="field_required_{{ $data->Field }}">
                                        @endif
                                    </td>
                                    <td>
                                        <input type="checkbox"
                                               name="field_browse_{{ $data->Field }}" @if(isset($dataRow->browse) && $dataRow->browse){{ 'checked="checked"' }}@elseif($data->Key == 'PRI')@elseif($data->Type == 'timestamp' && $data->Field == 'updated_at')@elseif(!isset($dataRow->browse)){{ 'checked="checked"' }}@endif>
                                        Browse<br/>
                                        <input type="checkbox"
                                               name="field_read_{{ $data->Field }}" @if(isset($dataRow->read) && $dataRow->read){{ 'checked="checked"' }}@elseif($data->Key == 'PRI')@elseif($data->Type == 'timestamp' && $data->Field == 'updated_at')@elseif(!isset($dataRow->read)){{ 'checked="checked"' }}@endif>
                                        Read<br/>
                                        <input type="checkbox"
                                               name="field_edit_{{ $data->Field }}" @if(isset($dataRow->edit) && $dataRow->edit){{ 'checked="checked"' }}@elseif($data->Key == 'PRI')@elseif($data->Type == 'timestamp' && $data->Field == 'updated_at')@elseif(!isset($dataRow->edit)){{ 'checked="checked"' }}@endif>
                                        Edit<br/>
                                        <input type="checkbox"
                                               name="field_add_{{ $data->Field }}" @if(isset($dataRow->add) && $dataRow->add){{ 'checked="checked"' }}@elseif($data->Key == 'PRI')@elseif($data->Type == 'timestamp' && $data->Field == 'created_at')@elseif($data->Type == 'timestamp' && $data->Field == 'updated_at')@elseif(!isset($dataRow->add)){{ 'checked="checked"' }}@endif>
                                        Add<br/>
                                        <input type="checkbox"
                                               name="field_delete_{{ $data->Field }}" @if(isset($dataRow->delete) && $dataRow->delete){{ 'checked="checked"' }}@elseif($data->Key == 'PRI')@elseif($data->Type == 'timestamp' && $data->Field == 'updated_at')@elseif(!isset($dataRow->delete)){{ 'checked="checked"' }}@endif>
                                        Delete<br/>
                                    </td>
                                    <input type="hidden" name="field_{{ $data->Field }}" value="{{ $data->Field }}">
                                    <td>
                                        @if($data->Key == 'PRI')
                                            <p>Primary Key</p>
                                            <input type="hidden" value="PRI" name="field_input_type_{{ $data->Field }}">
                                        @elseif($data->Type == 'timestamp')
                                            <p>Timestamp</p><commit_msg>[Patch] Make checkbox's label clickable on bread editor (#327)<commit_after>@extends('voyager::master')

@section('head')
    <script type="text/javascript" src="{{ config('voyager.assets_path') }}/lib/js/jsonarea/jsonarea.min.js"></script>
    <script>var valid_json = [];</script>
@stop

@section('page_header')
    <div class="page-title">
        <i class="voyager-data"></i> @if(isset($dataType->id)){{ 'Edit BREAD for ' . $dataType->name . ' table' }}@elseif(isset($table)){{ 'Create BREAD for ' . $table . ' table' }}@endif
    </div>
@stop

@section('content')

    @if(isset($dataType->name))
        <?php $table = $dataType->name ?>
    @endif

    <?php $fieldOptions = isset($dataType) ? $dataType->fieldOptions() : DB::select("DESCRIBE `${table}`"); ?>

    <div class="page-content container-fluid">
        <div class="row">
            <div class="col-md-12">

                <form role="form"
                      action="@if(isset($dataType->id)){{ route('voyager.database.edit_bread', $dataType->id) }}@else{{ route('voyager.database.store_bread') }}@endif"
                      method="POST">
                    @if(isset($dataType->id))
                        <input type="hidden" value="{{ $dataType->id }}" name="id">
                        {{ method_field("PUT") }}
                    @endif
                    <!-- CSRF TOKEN -->
                    {{ csrf_field() }}

                    <div class="panel panel-primary panel-bordered">

                        <div class="panel-heading">
                            <h3 class="panel-title">Edit the rows for the {{ $table }} table below:</h3>
                        </div>

                        <table id="users" class="table table-hover">
                            <thead>
                            <tr>
                                <th>Field</th>
                                <th>Field Info</th>
                                <th>Visibility</th>
                                <th>Input Type</th>
                                <th>Display Name</th>
                                <th>Optional Details</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($fieldOptions as $data)
                                @if(isset($dataType->id))
                                    <?php $dataRow = TCG\Voyager\Models\DataRow::where('data_type_id', '=',
                                            $dataType->id)->where('field', '=', $data->Field)->first(); ?>
                                @endif
                                <tr>
                                    <td><h4><strong>{{ $data->Field }}</strong></h4></td>
                                    <td>
                                        <strong>Type:</strong> <span>{{ $data->Type }}</span><br/>
                                        <strong>Key:</strong> <span>{{ $data->Key }}</span><br/>
                                        <strong>Required:</strong>
                                        @if($data->Null == "NO")
                                            <span>Yes</span>
                                            <input type="hidden" value="1" name="field_required_{{ $data->Field }}"
                                                   checked="checked">
                                        @else
                                            <span>No</span>
                                            <input type="hidden" value="0" name="field_required_{{ $data->Field }}">
                                        @endif
                                    </td>
                                    <td>
                                        <input type="checkbox"
                                               id="field_browse_{{ $data->Field }}"
                                               name="field_browse_{{ $data->Field }}" @if(isset($dataRow->browse) && $dataRow->browse){{ 'checked="checked"' }}@elseif($data->Key == 'PRI')@elseif($data->Type == 'timestamp' && $data->Field == 'updated_at')@elseif(!isset($dataRow->browse)){{ 'checked="checked"' }}@endif>
                                        <label for="field_browse_{{ $data->Field }}">Browse</label><br/>
                                        <input type="checkbox"
                                               id="field_read_{{ $data->Field }}"
                                               name="field_read_{{ $data->Field }}" @if(isset($dataRow->read) && $dataRow->read){{ 'checked="checked"' }}@elseif($data->Key == 'PRI')@elseif($data->Type == 'timestamp' && $data->Field == 'updated_at')@elseif(!isset($dataRow->read)){{ 'checked="checked"' }}@endif>
                                        <label for="field_read_{{ $data->Field }}">Read</label><br/>
                                        <input type="checkbox"
                                               id="field_edit_{{ $data->Field }}"
                                               name="field_edit_{{ $data->Field }}" @if(isset($dataRow->edit) && $dataRow->edit){{ 'checked="checked"' }}@elseif($data->Key == 'PRI')@elseif($data->Type == 'timestamp' && $data->Field == 'updated_at')@elseif(!isset($dataRow->edit)){{ 'checked="checked"' }}@endif>
                                        <label for="field_edit_{{ $data->Field }}">Edit</label><br/>
                                        <input type="checkbox"
                                               id="field_add_{{ $data->Field }}"
                                               name="field_add_{{ $data->Field }}" @if(isset($dataRow->add) && $dataRow->add){{ 'checked="checked"' }}@elseif($data->Key == 'PRI')@elseif($data->Type == 'timestamp' && $data->Field == 'created_at')@elseif($data->Type == 'timestamp' && $data->Field == 'updated_at')@elseif(!isset($dataRow->add)){{ 'checked="checked"' }}@endif>
                                            <label for="field_add_{{ $data->Field }}">Add</label><br/>
                                        <input type="checkbox"
                                               id="field_delete_{{ $data->Field }}"
                                               name="field_delete_{{ $data->Field }}" @if(isset($dataRow->delete) && $dataRow->delete){{ 'checked="checked"' }}@elseif($data->Key == 'PRI')@elseif($data->Type == 'timestamp' && $data->Field == 'updated_at')@elseif(!isset($dataRow->delete)){{ 'checked="checked"' }}@endif>
                                                <label for="field_delete_{{ $data->Field }}">Delete</label><br/>
                                    </td>
                                    <input type="hidden" name="field_{{ $data->Field }}" value="{{ $data->Field }}">
                                    <td>
                                        @if($data->Key == 'PRI')
                                            <p>Primary Key</p>
                                            <input type="hidden" value="PRI" name="field_input_type_{{ $data->Field }}">
                                        @elseif($data->Type == 'timestamp')
                                            <p>Timestamp</p>
{'fraction_non_alphanumeric': 0.17034259667695928, 'fraction_numerical': 0.0013968534039111896, 'mean_word_length': 1.2057726609372466, 'pattern_counts': {'":': 0, '<': 185, '<?xml version=': 0, '>': 319, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 120, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2556553', 'n_tokens_mistral': 3257, 'n_tokens_neox': 3159, 'n_words': 524}